40 int dx = move->tofile > move->fromfile ? 1 : -1; |
40 int dx = move->tofile > move->fromfile ? 1 : -1; |
41 |
41 |
42 uint8_t y = move->fromrow; |
42 uint8_t y = move->fromrow; |
43 uint8_t x = move->fromfile; |
43 uint8_t x = move->fromfile; |
44 |
44 |
45 do { |
45 while (x != move->tofile-dx && y != move->torow-dy) { |
46 x += dx; |
46 x += dx; |
47 y += dy; |
47 y += dy; |
48 if (board[y][x]) { |
48 if (board[y][x]) { |
49 return 1; |
49 return 1; |
50 } |
50 } |
51 } while (x != move->tofile && y != move->torow); |
51 } |
52 |
52 |
53 return 0; |
53 return 0; |
54 } |
54 } |
55 |
55 |
56 static int bishop_getloc_fixedfile(Board board, Move *move) { |
56 static int bishop_getloc_fixedfile(Board board, Move *move) { |