From a910d7d7098296cac7b1db991be35a40942d672f Mon Sep 17 00:00:00 2001 From: David Moeller Date: Fri, 26 Jan 2024 14:16:10 +0100 Subject: [PATCH] marking and unmarking flags --- src/main/c/Minesweeper/minesweeper_start.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/c/Minesweeper/minesweeper_start.c b/src/main/c/Minesweeper/minesweeper_start.c index 298f61d..fd58cfe 100644 --- a/src/main/c/Minesweeper/minesweeper_start.c +++ b/src/main/c/Minesweeper/minesweeper_start.c @@ -74,13 +74,17 @@ void main_menu_minesweeper(){ void game_minesweeper(){ bool running = true; int x, y, t; + Minesweeper_Board board = initialize_minesweeper(); while (running){ - Minesweeper_Board board = initialize_minesweeper(); + system("clear"); draw_minesweeper(board); printf("Next turn (x, y, t(0 = open, 1 = flag)): "); scanf("%d %d %d", &x, &y, &t); getchar(); + if(t == 1){board.tiles[x + y * board.width] = board.tiles[x + y * board.width] == EMPTY ? EMPTY : board.tiles[x + y * board.width] == FLAG ? BLOCK : FLAG;} + + if (t == 2){break;} } }