From a1ce9d4b7a927b0a15d3d40f2a08c5605196097a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benno=20F=C3=BCnfst=C3=BCck?= Date: Thu, 6 Feb 2020 17:46:40 +0100 Subject: [PATCH] fix battleships --- battleships.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; } }