Skip to content

Commit fb5ca43

Browse files
Daniel WhiteDaniel White
authored andcommitted
Made i global and used to remember rook from square during castling, saves 7 bytes.
1 parent 6d4196d commit fb5ca43

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

iota.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
char c[H], *C,
99
*T="#5)-57234#15BD#24#24$3#EKFA\\FKE/.2##$"; // Piece move steps, board setup data and promotion XORs (subtract '#'=35).
1010

11-
B[H], E, S, X, Y;
11+
B[H], E, S, X, Y, i;
1212

1313
D(x, y, p, e) {
1414
int f=0,t, j, d, m, v, b
@@ -39,7 +39,7 @@ D(x, y, p, e) {
3939
B[t]^=T[p%7+31]-35; // Promotion.
4040
S^=96
4141
I m&16 && t-f-d)
42-
B[f+t>>1]=B[t+(d*3-1)/2],B[t+(d*3-1)/2]=0 // If castling also move rook.
42+
B[f+t>>1]=B[i=t+(d*3-1)/2],B[i]=0 // If castling also move rook.
4343

4444
// Looking to make a move? (if our own move, make sure does not leave us in check)
4545
I t==y & f==x | (x==H && D(8,0,0,H))) {
@@ -63,7 +63,7 @@ D(x, y, p, e) {
6363
R 1;
6464
}
6565

66-
main(i) {
66+
main() {
6767
F ;strtok(gets(c)," ");fflush(i=0)) { // Loop, grabbing input and flushing output.
6868
Z"uci",4)) puts("id name i\nid author D\nuciok") // Reply to 'uci'.
6969
Z"i",1)) puts("readyok") // Reply to 'isready'.

0 commit comments

Comments
 (0)