diff options
author | Robby Zambito <contact@robbyzambito.me> | 2022-01-19 23:42:46 -0500 |
---|---|---|
committer | Robby Zambito <contact@robbyzambito.me> | 2022-01-19 23:42:46 -0500 |
commit | 05634144f15595de006f86aaeb413119f38e510b (patch) | |
tree | d9b48505ebd1f116b5699bf68e592fe66ccbf5b7 /src | |
parent | c3ed67477ce2bae4d08218df68b185a32c0271e0 (diff) |
Fix issue where top and left edge were not properly accounted for.
Diffstat (limited to 'src')
-rw-r--r-- | src/move.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -111,7 +111,7 @@ bool apply_move(enum player_color **board, enum player_color current_player, // Flip in up direction bool flipped_up = false; for (int i = move.row - 1; - i > 0 && board[i][move.col] != EMPTY && !flipped_up; i--) { + i >= 0 && board[i][move.col] != EMPTY && !flipped_up; i--) { if (board[i][move.col] == current_player) { if (i < move.row - 1) { for (int j = move.row; j > i; j--) { @@ -143,7 +143,7 @@ bool apply_move(enum player_color **board, enum player_color current_player, // Flip in left direction bool flipped_left = false; for (int i = move.col - 1; - i > 0 && board[move.row][i] != EMPTY && !flipped_left; i--) { + i >= 0 && board[move.row][i] != EMPTY && !flipped_left; i--) { if (board[move.row][i] == current_player) { if (i < move.col - 1) { for (int j = move.col; j > i; j--) { |