From 4a4f084441b5e57ac9dd015abbf1f40b7aada54e Mon Sep 17 00:00:00 2001 From: fdai7775 Date: Fri, 2 Feb 2024 12:49:14 +0000 Subject: [PATCH] refactoring: get_Move --- src/main/c/GameTic_Tac_Toe/tictactoe.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/c/GameTic_Tac_Toe/tictactoe.c b/src/main/c/GameTic_Tac_Toe/tictactoe.c index e7eeee9..e15cf80 100644 --- a/src/main/c/GameTic_Tac_Toe/tictactoe.c +++ b/src/main/c/GameTic_Tac_Toe/tictactoe.c @@ -26,6 +26,13 @@ void displayBoard() { } } +int get_move(){ + int choice; + printf("Spieler %c, waehle eine Zahl (1-9): ", (currentPlayer == PLAYER_X) ? 'X' : 'O'); + scanf("%d", &choice); + return choice; +} + char checkLine(char a, char b, char c) { if (a == b && b == c) return a; return ' '; @@ -97,12 +104,6 @@ int isGameOver() { return (winner == PLAYER_X || winner == PLAYER_O || isBoardFull()); } -int get_move(){ - int choice; - printf("Spieler %c, waehle eine Zahl (1-9): ", (currentPlayer == PLAYER_X) ? 'X' : 'O'); - scanf("%d", &choice); - return choice; -} void printGameResult(char winner) { if (winner == PLAYER_X || winner == PLAYER_O) {