Rybka and underpromotion ?

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

Moderators: hgm, Rebel, chrisw

Fguy64
Posts: 814
Joined: Sat May 09, 2009 4:51 pm
Location: Toronto

Rybka and underpromotion ?

Post by Fguy64 »

I seem to recall reading here something about the refusal of Vas to implement underpromotion, perhaps on some gounds of practicality? I forget the details, and I'm not even sure I have it right.

As a related issue, has anyone here ever seen their engine play an underpromotion in a game, as opposed to a contrived problem
User avatar
M ANSARI
Posts: 3707
Joined: Thu Mar 16, 2006 7:10 pm

Re: Rybka and underpromotion ?

Post by M ANSARI »

According to Vas adding the code for under promotion makes the engine a little weaker and since underpromotion rarely occurs it is not worth adding. Even when underpromotion is a possibility, the chances that this would affect the outcome of the game is very close to zero, as in the majority of the times the game could have been won another way. This would not be good if you are vying for the highest ELO possible in the engine, but might be useful for a "human" or "analysis" version.
Fguy64
Posts: 814
Joined: Sat May 09, 2009 4:51 pm
Location: Toronto

Re: Rybka and underpromotion ?

Post by Fguy64 »

Interesting. With me and my java engine, there are mostly convenience issues. Not having to encode underpromiotion in movegen would free up a few bits in my 4-byte integer for keeping track of other things that make my life easier. in my particular way of doing things that is.

regards.
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: Rybka and underpromotion ?

Post by Sven »

M ANSARI wrote:According to Vas adding the code for under promotion makes the engine a little weaker and since underpromotion rarely occurs it is not worth adding. Even when underpromotion is a possibility, the chances that this would affect the outcome of the game is very close to zero, as in the majority of the times the game could have been won another way. This would not be good if you are vying for the highest ELO possible in the engine, but might be useful for a "human" or "analysis" version.
Vas has posted his explanation in 2007 in Rybka forum. Note that only *Bishop* underpromotions during search (i.e., not for game playing) are affected. I can't tell whether everyone can access that post, so here is the relevant extract:
Vasik Rajlich wrote:Re. bishop underpromotions, actually, I am not really trying to save the 0.01% nodes. It's a matter of simplicity and elegance. Rybka is already too complicated, at least I want the complexity to do something useful.

If you don't do bishop underpromotions, then moves fit easily into 16 bits. 6 bits from origin square, 6 bits for target square, 1 bit for castling flag, 1 bit for en passant, 2 bits for no underpromotion, underpromotion to queen, rook or knight. With bishop underpromotions, you have to start conglomerating the flags. No big problem, but for what benefit?
Sven
Fguy64
Posts: 814
Joined: Sat May 09, 2009 4:51 pm
Location: Toronto

Re: Rybka and underpromotion ?

Post by Fguy64 »

Thanks Sven. I was pleased to read that Vas and I have similar motivations, although obviously he uses a lot fewer bits in total.

This seems to be morphing into a technical discussion but...

In my version, it seems to make my life a lot easier to create and store a sort key when a move is added to the possible moves list. This is why I need so many bits. Then once the list for a particular node is complete, I can do my move ordering using a built in java library function that sorts an array of 32-bit integers.

I suppose arranging all these extra bits comes at a cost. I guess a limitation of java for this kind of programming.
User avatar
hgm
Posts: 27787
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Rybka and underpromotion ?

Post by hgm »

Initially Rybka did not have any under-promotions at all. Joker still doesn't have them. I was surprised how often it loses a game because of an unexpected under-promotion, though. I have seen that several times now.
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: Rybka and underpromotion ?

Post by Sven »

hgm wrote:Initially Rybka did not have any under-promotions at all. Joker still doesn't have them. I was surprised how often it loses a game because of an unexpected under-promotion, though. I have seen that several times now.
According to older postings of Vas in Rybka forum, Rybka understands all underpromotions when played in a game but does not consider bishop underpromotions during search. So it won't lose a game due to an expected underpromotion.

Sven
Fguy64
Posts: 814
Joined: Sat May 09, 2009 4:51 pm
Location: Toronto

Re: Rybka and underpromotion ?

Post by Fguy64 »

Sven Schüle wrote:
hgm wrote:Initially Rybka did not have any under-promotions at all. Joker still doesn't have them. I was surprised how often it loses a game because of an unexpected under-promotion, though. I have seen that several times now.
According to older postings of Vas in Rybka forum, Rybka understands all underpromotions when played in a game but does not consider bishop underpromotions during search. So it won't lose a game due to an expected underpromotion.

Sven
would not the same motivation for excluding Bishop underpromotion in search also reply to Rook underpromotion? I can see why knight would be useful because of it's non-linear movement
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: Rybka and underpromotion ?

Post by Sven »

Fguy64 wrote:
Sven Schüle wrote:
hgm wrote:Initially Rybka did not have any under-promotions at all. Joker still doesn't have them. I was surprised how often it loses a game because of an unexpected under-promotion, though. I have seen that several times now.
According to older postings of Vas in Rybka forum, Rybka understands all underpromotions when played in a game but does not consider bishop underpromotions during search. So it won't lose a game due to an expected underpromotion.

Sven
would not the same motivation for excluding Bishop underpromotion in search also reply to Rook underpromotion? I can see why knight would be useful because of it's non-linear movement
1. With 2 bits you have 4 possible states but encoding the full set "none - Queen - Rook - Bishop - Knight" needs 5 states, so Vas left only one of them out, and that is the one which is most unlikely to have any practical meaning.

2. Promotion to rook can win by avoiding a stalemate as opposed to queening. Promotion to knight can be better than other promotions if it is important to promote with check. But promotion to bishop needs very special circumstances to become the optimal move which are really rare. IIRC one example was related to controlling an enemy passer without giving stalemate. Few examples have been posted somewhere.

Sven
Fguy64
Posts: 814
Joined: Sat May 09, 2009 4:51 pm
Location: Toronto

Re: Rybka and underpromotion ?

Post by Fguy64 »

Sven Schüle wrote:
Fguy64 wrote:
Sven Schüle wrote:
hgm wrote:Initially Rybka did not have any under-promotions at all. Joker still doesn't have them. I was surprised how often it loses a game because of an unexpected under-promotion, though. I have seen that several times now.
According to older postings of Vas in Rybka forum, Rybka understands all underpromotions when played in a game but does not consider bishop underpromotions during search. So it won't lose a game due to an expected underpromotion.

Sven
would not the same motivation for excluding Bishop underpromotion in search also reply to Rook underpromotion? I can see why knight would be useful because of it's non-linear movement
...

2. Promotion to rook can win by avoiding a stalemate as opposed to queening.
...

Sven
OK, I see it now. This is also what I had in mind with the bishop. But I suppose that is not really the point. By eliminating one possible state you save a bit, so you may as well eliminate the bishop rather than the rook.