Is it possible that the crazyhouse rules once were changed?
The bug obviously is that Sjeng does not know that a once promoted pawn
has to be dropped as pawn again (and not as the promoted piece).
Sjeng 11.2 is more than 15 years old meanwhile)
Is it possible that the crazyhouse rules once were changed?
The bug obviously is that Sjeng does not know that a once promoted pawn
has to be dropped as pawn again (and not as the promoted piece).
Sjeng 11.2 is more than 15 years old meanwhile)
Well, the good thing is the source is there
I really like your recent crazyhouse activities.
Guenther
It is possible.
Every now and then I am searching who created this variant and when?
The code seems to track down the promoted pawn in the move history. But as the program does so many make() move and unmake() move during searches, the tracking of this promoted pieces get lost.
I had three runs with SjaakII_131a-64 and all resulted always with an illegal move so far until I stopped it.
(A pity though that my debug file for the first run was not saved because it had axb6 until depth 11 IIRC)
But that shouldn't matter as I only had illegal moves so far as output, namely axb6, B@b5, Q@b7 all ignoring K in check.
197832 <first : # Begin iterative deepening loop for position "r5nr/p4ppp/1Bb1p3/3pP3/1p2n3/8/PPP1NPPP/R1B2RK1[QPnbbqp] w - - 0 20"
the position in question has no black king, so there's no check to ignore.
Question is, why is there no king? Some set of circumstances seems to have changed it into a Bishop but I'm at a loss to see how. Could be a make/unmake issue, could be a random memory corruption caused by an out-of-bounds access. If it's the latter that could explain why it's hard to reproduce on another OS; really not sure though.
Does the problem reproduce if you start from a FEN, or only if you step through the game history?
Guenther wrote:
Is it possible that the crazyhouse rules once were changed?
The bug obviously is that Sjeng does not know that a once promoted pawn
has to be dropped as pawn again (and not as the promoted piece).
There are different variants regarding these rules.
The one where promoted pieces demote to pawn after capture is generally called "Crazyhouse".
The one where promoted pieces keep their rank is generally called "Chessgi" (as a port-manteau of Chess+Shogi, although promoted pieces demote in Shogi).
However, there is some room for confusion regarding the exact rules across different sources. We never really played Crazyhouse, but we did play Bughouse ("doorgeef schaak") as kids, but with the rule that you were not allowed to drop with check.
Well, the good thing is the source is there
Yeah, but that may not help very much. A Queen that demotes to Pawn on capture is really a different piece from a normal Queen. If the code does not track that it can be a royal pain to fix that, and may require re-writing large chunks of it.
I had three runs with SjaakII_131a-64 and all resulted always with an illegal move so far until I stopped it.
(A pity though that my debug file for the first run was not saved because it had axb6 until depth 11 IIRC)
But that shouldn't matter as I only had illegal moves so far as output, namely axb6, B@b5, Q@b7 all ignoring K in check.
197832 <first : # Begin iterative deepening loop for position "r5nr/p4ppp/1Bb1p3/3pP3/1p2n3/8/PPP1NPPP/R1B2RK1[QPnbbqp] w - - 0 20"
the position in question has no black king, so there's no check to ignore.
Question is, why is there no king? Some set of circumstances seems to have changed it into a Bishop but I'm at a loss to see how. Could be a make/unmake issue, could be a random memory corruption caused by an out-of-bounds access. If it's the latter that could explain why it's hard to reproduce on another OS; really not sure though.
Yeah you are right, I just looked at the given PV and not at the FEN output given by SjaakII. I have added some more debug parts below,
where you can see when the King transforms mysteriously into a Bishop! (soon after it suddenly goes up to depth 60)
*I used 'quote' here, because that allows formatting tags inside, other than 'code'.*
I had three runs with SjaakII_131a-64 and all resulted always with an illegal move so far until I stopped it.
(A pity though that my debug file for the first run was not saved because it had axb6 until depth 11 IIRC)
But that shouldn't matter as I only had illegal moves so far as output, namely axb6, B@b5, Q@b7 all ignoring K in check.
197832 <first : # Begin iterative deepening loop for position "r5nr/p4ppp/1Bb1p3/3pP3/1p2n3/8/PPP1NPPP/R1B2RK1[QPnbbqp] w - - 0 20"
the position in question has no black king, so there's no check to ignore.
Question is, why is there no king? Some set of circumstances seems to have changed it into a Bishop but I'm at a loss to see how. Could be a make/unmake issue, could be a random memory corruption caused by an out-of-bounds access. If it's the latter that could explain why it's hard to reproduce on another OS; really not sure though.
Yeah you are right, I just looked at the given PV and not at the FEN output given by SjaakII. I have added some more debug parts below,
where you can see when the King transforms mysteriously into a Bishop! (soon after it suddenly goes up to depth 60)
Ah, well spotted.
What happens here: it sees mate, so the depth very quickly reaches 60 (which is the maximum depth it will search), and then it waits for input. Then on the next iteration, after Qxc6, it initially sees the mate, but then it loses the mate and the king mysteriously transforms into a Bishop.
Still no clue why that happens, but at least it's something I should be able to code a test for that will terminate the search when it happens. Hopefully that makes it a bit easier to reproduce.
Sjaak II version 633 (x86_64)
Type 'help' for a list of commands and help topics
8r n b q k b n r
7p p p p p p p p
6
5
4
3
2P P P P P P P P
1R N B Q K B N R *
a b c d e f g h
#[Chess] 0w>variant crazyhouse
8r n b q k b n r
7p p p p p p p p
6
5
4
3
2P P P P P P P P
1R N B Q K B N R *
a b c d e f g h
White holdings [ ]
Black holdings [ ]
#[Crazyhouse] 0w>level 40 15 0
8r n b q k b n r
7p p p p p p p p
6
5
4
3
2P P P P P P P P
1R N B Q K B N R *
a b c d e f g h
White holdings [ ]
Black holdings [ ]
#[Crazyhouse] 0w>setboard r5nr/p2k1ppp/1BP1p3/2QpP3/qp2n3/8/PPP1NPPP/R1B2RK1[Pnbb] b - - 0 1
8r n r *
7p k p p p
6 B P p
5 Q p P
4q p n
3
2P P P N P P P
1R B R K
a b c d e f g h
White holdings [ P: 01 ]
Black holdings [ n: 01 b: 02 ]
#[Crazyhouse] 0b (f)+> time 90000
8r n r *
7p k p p p
6 B P p
5 Q p P
4q p n
3
2P P P N P P P
1R B R K
a b c d e f g h
White holdings [ P: 01 ]
Black holdings [ n: 01 b: 02 ]
#[Crazyhouse] 0b (f)+>go
2. 0.01 926 +4.35 1. ... Qxc6 2. Qxc6 Kxc6 3. Q@c7 Kb5 4. Bxa7
3. 0.01 1553 +4.35 1. ... Qxc6 2. Qxc6 Kxc6 3. Q@c7 Kb5 4. Bxa7
4. 0.03 5529 +4.40 1. ... Qxc6 2. Qxc6 Kxc6 3. Q@c7 Kb5 4. Bxa7 Rf8
5. 0.04 5788 +4.26 1. ... Qxc6?
5. 0.05 8301 +3.39 1. ... Qxc6?
5. 0.05 8653 +2.56 1. ... Qxc6?
5. 0.05 8717 +0.00 1. ... Qxc6?
5. 0.08 14375 -2.20 1. ... Qxc6 2. Qxc6 Kxc6 3. Nd4 Kd7 4. Q@c6 Ke7 5. P@d6 Nxd6 6. Bg5 f6 7. exd6 Kf7 8. Qxa8 axb6
6. 0.09 15764 -2.36 1. ... Qxc6?
6. 0.09 15913 -2.59 1. ... Qxc6?
6. 0.13 25039 -3.81 1. ... Qxc6?
6. 0.15 28012 -5.42 1. ... Qxc6?
6. 0.16 30330 -8.86 1. ... Qxc6?
6. 0.16 30631 -17.15 1. ... Qxc6?
6. 0.25 48050 -30.01 1. ... Qxc6?
6. 0.30 58605 -159.86 1. ... Qxc6?
6. 0.74 131561 -159.92 1. ... Qxc6 2. Qxc6 Kxc6 3. Q@c7 Kb5 4. Nd4 Ka6
[...]
60. 1.23 201944 -159.92 1. ... Qxc6 2. Qxc6 Kxc6 3. Q@c7 Kb5 4. Nd4 Ka6 5. P@b5
Time remaining 14:58.67
move Qxc6
8r n r
7p k p p p
6 B q p
5 Q p P
4 p n
3
2P P P N P P P
1R B R K *
a b c d e f g h
White holdings [ P: 01 ]
Black holdings [ n: 01 b: 02 p: 01 ]
#[Crazyhouse] 1w>c5c6
2. 0.00 4 -159.94 2. ... Kxc6?
2. 0.00 4 -159.94 2. ...
3. 0.00 167 -159.94 2. ... Kxc6 3. Q@c7 Kb5 4. Nd4 Ka6 5. P@b5 Ka6 6. P@b5
4. 0.00 167 -160.00 2. ...
Time remaining 14:58.67
move Kxc6
8r n r
7p p p p
6 B p p
5 p P
4 p n
3
2P P P N P P P
1R B R K *
a b c d e f g h
White holdings [ Q: 01 P: 01 ]
Black holdings [ n: 01 b: 02 q: 01 p: 01 ]
#[Crazyhouse] 3w>
Note too that the score in the fourth line is odd (-160.00, which means "checkmate now") and the PV is missing. So something is clearly up there.
The good thing though is that I can finally reproduce it!
I am tempted to make a new engine for drop variants, which then should be able to play Crazyhouse as well. My current engine Shokidoki can only handle boards up to 9x9, up to 15 piece types, and has no easy way to handle special moves like castling, e.p. or under-promotion. Soit would be hard to have it do Crazyhouse. I would furthermore like to have an engine that can handle boards up to 11x11, which could also encode special moves.
What I have in mind is based on a 22x11 mailbox board, with a double ring of boundary guards encoded as negative numbers around it. The off-board squares would hold complemented holdings counts, so that they also would always be negative, and be perceived as boundary guards. The 22x11 area can be indexed by square numbers running from 0-241, which fits in a single byte.
In the move encoding off-board from-squares would indicate drop moves, and directly address the holdings counter for the dropped piece type. Off-board to-squares would be used to indicate promotions. They would be used to index board-sized decoding tables that would specify the promotion shift (to be added to the piece code) and the true (on-board) to-square of the move. The on-board part of these tables would just contain 0 and the index itself.
Special moves for Chess could also be encoded by off-board to-squares; you would need codes for 2x8 double pushes (special because they should set the e.p.square), 2x8 e.p. capture to-squares, and 4 castlings. Unlike in Shogi variants, where promotions can take place anywhere on the board, as also moves that leave the zone can promote, promotions in Chess are limited to the last rank. But because there is promotion choice, each possible to-square needs 4 different codes there, which would still require a full 8x8 board worth of off-board codes. (Well, are promotions to B or R ever of any use in Crazyhouse?) But in Chess the board is only 8 ranks, so ranks 9-11 can be used to encode the double-pushes, e.p. captures and castlings. By testig if a to-square is >= 22*8 we can then recognize the move is special, and use a lookup table to decide what special action to take (set e.p. square, delete an e.p. victim, or move a Rook). Other moves would be normal moves, drops or promotions, and would be handled the normal way.
As for piece codes 0 could signify empty squares, 32-63 white pieces, and 64-95 black pieces. That would allow 32 piece types per color. Wa Shogi has 17 unpromoted pieces, of which 14 can promote, so 31 types in total. On a drop a (negative) holdings count would appear to be the type of the 'from-piece' (which would have to be restored on UnMake), while the 'to-piece' (appearing on the to-square) would come from a board-sized table. All negative piece types would share the same PST, consisting only of an off-board part (as the on-board part would never be used, negative codes never occurring on the board), which would contain the in-hand values of all piece types. Real piece types, or the empty square, would never use the off-board part, so that white and black tables can be interleaved. (Space becomes an issue, when you have 2x31 11x11 tables...)