| 43 return bishop_isblocked(gamestate, move); |
43 return bishop_isblocked(gamestate, move); |
| 44 } |
44 } |
| 45 } |
45 } |
| 46 |
46 |
| 47 size_t queen_moves(const GameState *gamestate, |
47 size_t queen_moves(const GameState *gamestate, |
| 48 Color c, Rank r, File f, Move *moves) { |
48 Color c, File f, Rank r, Move *moves) { |
| 49 |
49 |
| 50 size_t count = 0; |
50 size_t count = 0; |
| 51 const int directions[8][2] = { |
51 const int directions[8][2] = { |
| 52 { 1, 0}, |
52 { 1, 0}, |
| 53 {-1, 0}, |
53 {-1, 0}, |
| 68 moves[count].piece = mkpiece(QUEEN, c); |
68 moves[count].piece = mkpiece(QUEEN, c); |
| 69 moves[count].fromrank = r; |
69 moves[count].fromrank = r; |
| 70 moves[count].fromfile = f; |
70 moves[count].fromfile = f; |
| 71 moves[count].torank = rank; |
71 moves[count].torank = rank; |
| 72 moves[count].tofile = file; |
72 moves[count].tofile = file; |
| 73 moves[count].capture = piece_at(gamestate, rank, file) != 0; |
73 moves[count].capture = piece_at(gamestate, file, rank) != 0; |
| 74 count++; |
74 count++; |
| 75 |
75 |
| 76 rank += directions[i][0]; |
76 rank += directions[i][0]; |
| 77 file += directions[i][1]; |
77 file += directions[i][1]; |
| 78 } |
78 } |