Skip to content

Commit e8d2370

Browse files
Daniel WhiteDaniel White
authored andcommitted
Modified how we indicate whether a promotion has occured, saving 3 bytes.
1 parent fb5ca43 commit e8d2370

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

iota.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ D(x, y, p, e) {
4545
I t==y & f==x | (x==H && D(8,0,0,H))) {
4646
X=f,Y=t;
4747
E= m%8==2&t!=f+d ? f+t>>1 : 9; // Set ep-target square if double pawn move.
48-
R B[t]==m%128; // Indicate if promotion has NOT occured.
48+
R B[t]-m&7; // Indicate if promotion has occured.
4949
}
5050

5151
// Undo move.
@@ -69,7 +69,7 @@ main() {
6969
Z"i",1)) puts("readyok") // Reply to 'isready'.
7070
Z"g",1)) // Go command. Make a move and print it.
7171
i=D(H, 0, 0, E),
72-
printf("bestmove %c%i%c%i%c\n", X%16+97, X/16+1, Y%16+97, Y/16+1, i?32:98)
72+
printf("bestmove %c%i%c%i%c\n", X%16+97, X/16+1, Y%16+97, Y/16+1, i?98:32)
7373
Z"p",1)) { // Parse 'position' command.
7474
F S=32;i<8;B[i+++96]=202) // Reset board to start position.
7575
B[i]=(B[i+112]=T[i+23])-S, // Pieces.

0 commit comments

Comments
 (0)