SjaakII 1.0 RC1

Discussion of anything and everything relating to chess playing software and machines.

Moderator: Ras

User avatar
hgm
Posts: 28498
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: SjaakII 1.0 RC6

Post by hgm »

Great Dragon image! Looks very dangerous! Just needs a bit fatter outline.

I like the next Wa theme. Just don't know how to make white/black distinction on some of the pieces. :(

Image
myfish
Posts: 131
Joined: Sat Feb 07, 2015 3:17 pm

Re: SjaakII 1.0 RC6

Post by myfish »

hgm wrote:Great Dragon image! Looks very dangerous! Just needs a bit fatter outline.
It was simply a very reworking of a public domain svg. It does work and it's not a direct copy. I can change the outline readily.
I like the next Wa theme. Just don't know how to make white/black distinction on some of the pieces. :(

Image
Yes, I can see how they will work.
Dare I suggest placing those on opposing 'koma' in white, and black, or even black and white squares that show inverted black and white.
myfish
Posts: 131
Joined: Sat Feb 07, 2015 3:17 pm

Re: SjaakII 1.0 RC6

Post by myfish »

Like this for example.

Image
myfish
Posts: 131
Joined: Sat Feb 07, 2015 3:17 pm

Re: SjaakII 1.0 RC6

Post by myfish »

How about this for white

Image
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: SjaakII 1.0 RC6

Post by Evert »

myfish wrote:How about this for white

Image
The transparent eye looks weird, I would suggest filling it in.
myfish
Posts: 131
Joined: Sat Feb 07, 2015 3:17 pm

Re: SjaakII 1.0 RC6

Post by myfish »

sure, no worries.
myfish
Posts: 131
Joined: Sat Feb 07, 2015 3:17 pm

Re: SjaakII 1.0 RC6

Post by myfish »

Not sure where our hard working developers have gone but, here is a question.

I have mentioned this before but, it's bugging me so I'll try another angle.

Shogi is a pain to give value to pieces, we are agreed on this I think as it's so dynamic.
So, is there a way...

I would assume sjaakii and hgm's engines/xboard knows the difference between black, and white.

So, let me be white (xboard white).

Habu says, amongst others that a tokin is worth 2 golds. (To ME) yet, it's worth a pawn to black if taken. There are effectively, 5 golds in 9x9 shogi.

In order of value, they decrease to the loser of a piece. If I lose a tokin, it's a pawn to black. If I lose a narigin, it's silver to black.

What I'm asking is, can we floating values depending on ...

What a piece is
What a piece becomes
What a piece is likely to become.

Lets say I drop a pawn 1 rank from promotion, or, in the promotion zone, it is LIKELY to promote so, is a greater threat to black and, about to be worth 2 generals for white.

Assuming we have a pawn of 80 and a gold value of 500, and, the best professional players are suggesting, a tokin is worth 2 generals, the tokin should be worth 1000 right ?

Well, I've kind of tried this and it really does alter game play. It's not correct, but it certainly steers the game.

Lets suggest we make it worth 750, so 50% more than the gold, a jump from 80, to 750 isn't a nice progression in value.

Can't pawns increase in value, incrementally as they head toward the promotion zone.

Just all stuff rattling around in my head that to me, shouldn't be impossible. As sjaakii already has zones, couldn't we define value by zone, position, threat etc.

Fixed values aren't working. Yes, you get a game, often a really challenging game but the machine is working in 'reaction to promotion and threat' not the premise of such.

Again, just ideas. Forgive me for thinking out loud if it's stupid.
User avatar
hgm
Posts: 28498
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: SjaakII 1.0 RC6

Post by hgm »

This is already what most programs do. (Don't know about the details in Sjaak.) E.g. Fairy-Max counts Pawns on 6th rank as 1.8 Pawn, and on 7th rank as 2.6, because they bind an opponent minor (worth ~3) to prevent their promotion on 8th. In general the value of each piece used by Chess programs is dependent on its location on the board ('Piece-Square Tables'), although the dependence is usually not as extreme as for Pawns.

In Shokidoki I use 4 values per piece-type pair: unpromoted, promoted, pre-promoted and in hand. These are then a bit tweaked depending on exact board location. Pre-promoted means in the zone, so that any move would promote it. Pawns, Knights and Lances could also have that just before the zone, as they only have moves that go into it. But OTOH they have only very few moves in any case, making the threat of promotion not very large, whether in the zone or on the threshold, and Knight and Lance do not gain that much on promotion anyway, so for those I don't bother.

I seriously doubt if there is any truth in this Tokin = 2 Gold business. It should be easy enough to check it, btw: just make two different files with definitions of Shogi (you could call the variant 'myshogi'), differing only in the Toking value (500 vs 1000), and play 1000 fast games between Sjaak using one vs Sjaak using the other overnight. (Possibly using XBoard's opening book you compiled from game kifu to force diversity.) That should tell you which value works better. (Use XBoard's 'nickname' assignment to distinguis the two.)

Logic tells you it would be reasonable to expect trading a Tokin for a Gold. After such a trade, the opponent gets a Pawn in hand, you get a Gold. These will eventually get back onto the board. So when you start with a Pawn on the board against a Gold for him, after promoting to Tokin, forcing the trade (which you wouldn't have been able to do if you were still only a Pawn), and dropping back, you revesed that. So in the very end you gained 2 Golds versus 2 Pawns. Now the Pawns must be worth something, so the end result is already less than a gain of 2 Golds. When you would set the value of Tokin to 2 Golds, you would at that point be 2 Gold minus 1 Pawn ahead, as promotion trades the Pawn for a Tokin. That is more than after you trade the Pawn for his Gold, with as a result that it would start avoiding such trades. That seems crippling, as I don't think it is reasonable to expect you will get a chance to trade it for more than a Gold. And then you would have no use of your Tokin at all: they would flee in panic for enemy Golds, all withdrawing safely behind your own lines. In fact it is important that the Tokin is worth significantly less than 2 Gold minus 2 Pawn, in order to make the engine consider trading the Tokin for a real Gold a good deal, and striving for it. You also have to account for the fact that the Pawn inintially gets in the hand, from where it can be dropped 'pre-promoted', while there is no way to promote a Gold.

Of course a Pawn is not worth all that much. E.g. when you put G=500 and P=80, 2G-2P = 840. If you value Tokin = 600, the promotion gain would be 520. And even if you take only 20% (~100) of that as a bonus for the Pawn being pre-promoted, assuming that the opponent will drop his Pawn pre-promoted will end you in a situaition where you gained only 740. That leaves a gap of 140 for realizing the actual Tokin-vs-Gold trade, which is already less than what the engine would get for gaining a Pawn (160). So it would prefer gobbling up more Pawns over elimininating the opponent's Gold defenders, and I doubt very much if that would be a good strategy. (But I never played Shogi...) So 600 (1.2 x Gold) seems already an over-valuation.

Anyway, playing games will tell you which value works best. What I discovered in early versions of Shokidoki was that it thought it could compensate the loss of other material by producing hoards of Tokins in the corner of the board. Which of course was totally useless; one Tokin there already was so far removed from the action that it never participated in the game, but if you have one there, creating a second is even more useless, as it could never do anything the other one that was there could not have already done alone. So play enormously improved when I let the value of Tokins decrease to just a fraction of their nominal value towards the board (side) edges. Then creating Tokins at the edge would not compete with trying to preserve its pieces elsewhere on the board, and already created Tokins would rather move away from the edge (i.e. always closer to the action) whenever possible, then creating new ones at the edge.

P.S. where can I find this cool Dragon SVG? Can you also do a Wolf? I have conceived a new Chess variant 'Werewolf Chess' that badly needs it. It uses a rule taken from Maka Dai Dai Shogi that whichever piece captures a Werewolf becomes a Werewolf. :D
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: SjaakII 1.0 RC6

Post by Evert »

myfish wrote:Not sure where our hard working developers have gone but, here is a question.

I have mentioned this before but, it's bugging me so I'll try another angle.

Shogi is a pain to give value to pieces, we are agreed on this I think as it's so dynamic.
So, is there a way...

I would assume sjaakii and hgm's engines/xboard knows the difference between black, and white.

So, let me be white (xboard white).

Habu says, amongst others that a tokin is worth 2 golds. (To ME) yet, it's worth a pawn to black if taken. There are effectively, 5 golds in 9x9 shogi.

In order of value, they decrease to the loser of a piece. If I lose a tokin, it's a pawn to black. If I lose a narigin, it's silver to black.

What I'm asking is, can we floating values depending on ...

What a piece is
What a piece becomes
What a piece is likely to become.

Lets say I drop a pawn 1 rank from promotion, or, in the promotion zone, it is LIKELY to promote so, is a greater threat to black and, about to be worth 2 generals for white.

Assuming we have a pawn of 80 and a gold value of 500, and, the best professional players are suggesting, a tokin is worth 2 generals, the tokin should be worth 1000 right ?

Well, I've kind of tried this and it really does alter game play. It's not correct, but it certainly steers the game.

Lets suggest we make it worth 750, so 50% more than the gold, a jump from 80, to 750 isn't a nice progression in value.

Can't pawns increase in value, incrementally as they head toward the promotion zone.

Just all stuff rattling around in my head that to me, shouldn't be impossible. As sjaakii already has zones, couldn't we define value by zone, position, threat etc.

Fixed values aren't working. Yes, you get a game, often a really challenging game but the machine is working in 'reaction to promotion and threat' not the premise of such.
First of all, you have to distinguish static material evaluation (what pieces are worth) from dynamical positional evaluation (how this depends on where they are on the board).

Nominally, SjaakII uses "centi-pawn" units for its evaluation, so a pawn has a base value of 100 points. It already cheats on this by making a pawn worth 100 points in the end game, and less than that in the opening. Added on to this material value are various positional terms: centralisation, proximity to promotion zones, mobility, threat against the enemy king, etc.

The question is: what is the relative weight for these different terms? The answer to this term is different for Chess and Shogi (in general: variants with piece drops), which is where the notion that there's no such thing as piece value in Shogi comes from: the dynamical terms are much more important, relative to the material terms, than they are in chess.

This is why I scaled back the material values in Shogi a while ago: by making the material values smaller, the positional terms become more important. For instance, SjaakII's normal value for an unpromoted pawn in Shogi is only 24 (rather than 80).

So this is something you can play with. If you set the material values lower, positional terms become more important.

SjaakII has a heuristic function to estimate piece values that was calibrated to reproduce approximately its values for Chess and Shogi (which I put in by hand). It takes into account how pieces move and what they promote to to determine the value. To get an idea of what it thinks are reasonable piece values, leave all piece values blank, load the variant and give the command "pieceinfo". The value is part of the output.

Beware that this type of heuristic is notoriously unreliable: there is no mathematical formula that can derive the piece values accurately from just the moves of that particular piece (certainly not for sliders, leapers are a bit easier apparently). You can take it as a first guess and iterate from there; it should not be hard to improve on it.

I can post details of how it estimates piece values later.
myfish
Posts: 131
Joined: Sat Feb 07, 2015 3:17 pm

Re: SjaakII 1.0 RC6

Post by myfish »

hgm wrote:
I seriously doubt if there is any truth in this Tokin = 2 Gold business. It should be easy enough to check it, btw: just make two different files with definitions of Shogi (you could call the variant 'myshogi'), differing only in the Toking value (500 vs 1000), and play 1000 fast games between Sjaak using one vs Sjaak using the other overnight.
Useful response, thanks. I do believe there is 'some evidence' to support this and a number of professionals subscribe to it.

I did change the values in sjaakii and the moment you do get a tokin, the shape of the game seems to change far more and tokins become magnets to attack almost.

This is why I asked about progressive value.
I haven't tried a whole bunch of machine <> machine games but I could I suppose.

So, I copy the variants.txt, rename the values in one and launch the first sjaakii with the modified variants file. Will it do that ?

Like xboard -fcp sjaakii -scp sjaakii /path/to/modvariants.txt ?

I'll go look at this nickname thing. Thanks.