src/chess/knight.c

changeset 80
b980a7192b5a
parent 55
54ea19938d57
equal deleted inserted replaced
79:ffd452cf05ff 80:b980a7192b5a
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 }

mercurial