diff options
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -141,8 +141,15 @@ int validate_move(int move[2], int color, int* board) { legal_move = kingMoves; break; case PAWN: - if (piece & BLACK) legal_move = blackPawnMoves; - else legal_move = pawnMoves; + if (piece & BLACK) { + if (board[destination] != EMPTY) legal_move = blackPawnAttackMoves; + else if (origin >> 4 == 6) legal_move = newBlackPawnMoves; + else legal_move = blackPawnMoves; + } else { + if (board[destination] != EMPTY) legal_move = pawnAttackMoves; + else if (origin >> 4 == 1) legal_move = newPawnMoves; + else legal_move = pawnMoves; + } break; default: return -2; |