src/chess/knight.c

changeset 163
2a6d83f4677e
parent 80
b980a7192b5a
equal deleted inserted replaced
162:f0fc70b6f8f9 163:2a6d83f4677e
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(const 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