| 29 |
29 |
| 30 #include "bishop.h" |
30 #include "bishop.h" |
| 31 #include "rules.h" |
31 #include "rules.h" |
| 32 #include <stdlib.h> |
32 #include <stdlib.h> |
| 33 |
33 |
| 34 bool bishop_chkrules(Move* move) { |
34 bool bishop_chkrules(const Move* move) { |
| 35 return abs(move->torow-move->fromrow) == abs(move->tofile-move->fromfile); |
35 return abs(move->torow-move->fromrow) == abs(move->tofile-move->fromfile); |
| 36 } |
36 } |
| 37 |
37 |
| 38 bool bishop_isblocked(GameState *gamestate, Move *move) { |
38 bool bishop_isblocked(const GameState *gamestate, const Move *move) { |
| 39 int dy = move->torow > move->fromrow ? 1 : -1; |
39 int dy = move->torow > move->fromrow ? 1 : -1; |
| 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; |