diff --git a/battleships.c b/battleships.c index 700de90..ca5414e 100644 --- a/battleships.c +++ b/battleships.c @@ -232,7 +232,7 @@ void update_state(struct state * state, struct position pos) { int letter_count = 0; for (int x = 0; x < BOARD_SIZE; ++x) { for (int y = 0; y < BOARD_SIZE; ++y) { - if (isalpha(state->board[pos.y][pos.x])) { + if (isalpha(state->board[y][x])) { letter_count += 1; } }