queen Movement working

This commit is contained in:
k 2025-06-19 04:45:30 -04:00
parent 9f06b9d86c
commit 5dd8f04286
3 changed files with 13 additions and 4 deletions

View File

@ -6,4 +6,5 @@ int knightMove(game *g, move* moves);
int rookMove(game *g, move *moves);
int bishopMove(game *g, move *moves);
int kingMove(game *g, move *moves);
int queenMove(game *g, move *moves);
#endif

View File

@ -61,6 +61,7 @@ int main() {
cnt += rookMove(g,(mov+cnt));
cnt += bishopMove(g,(mov+cnt));
cnt += kingMove(g,(mov+cnt));
cnt += queenMove(g,(mov+cnt));
move *m = &mov[rand() % cnt];
char *end = "";

View File

@ -238,12 +238,19 @@ int bishopScan(game *g, move *moves, long long w, long long b) {
return index;
}
int kingMove(game *g, move *moves){
return kingScan(g,moves,g->white.king,g->black.king);
int queenMove(game *g, move *moves){
int size = 0;
long long w,b;
w = g->white.queen;
b = g->black.queen;
size += rookScan(g,moves,w,b);
size += bishopScan(g,moves,w,b);
return size;
}
int kingScan(game *g, move *moves, long long w, long long b) {
long long king = g->whiteToMove ? w : b;
int kingMove(game *g, move *moves){
long long king = g->whiteToMove ? g->white.king : g->black.king;
long long occupied = g->whiteToMove ? fullSet(&g->white) : fullSet(&g->black);
int index = 0;