src/chess/knight.c

changeset 170
bde99d803caf
parent 169
9962f5d98764
equal deleted inserted replaced
169:9962f5d98764 170:bde99d803caf
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 }
40 40
41 size_t knight_moves(GameState *gamestate, Color c, Row r, File f, Move *moves) { 41 size_t knight_moves(const GameState *gamestate,
42 Color c, Row r, File f, Move *moves) {
42 43
43 size_t count = 0; 44 size_t count = 0;
44 const int offsets[8][2] = { 45 const int offsets[8][2] = {
45 { 2, 1}, 46 { 2, 1},
46 { 2, -1}, 47 { 2, -1},

mercurial