29 |
29 |
30 #include "knight.h" |
30 #include "knight.h" |
31 #include "rules.h" |
31 #include "rules.h" |
32 #include <stdlib.h> |
32 #include <stdlib.h> |
33 |
33 |
34 _Bool knight_chkrules(Move *move) { |
34 bool knight_chkrules(Move *move) { |
35 int dx = abs(move->fromfile - move->tofile); |
35 int dx = abs(move->fromfile - move->tofile); |
36 int dy = abs(move->fromrow - move->torow); |
36 int dy = abs(move->fromrow - move->torow); |
37 |
37 |
38 return (dx == 2 && dy == 1) || (dx == 1 && dy == 2); |
38 return (dx == 2 && dy == 1) || (dx == 1 && dy == 2); |
39 } |
39 } |