diff --git a/src/c/ticTacToe.c b/src/c/ticTacToe.c index f8d5e1a..38be611 100644 --- a/src/c/ticTacToe.c +++ b/src/c/ticTacToe.c @@ -32,11 +32,17 @@ void initField(char field[3][3]) { void getPlayerInput(char field[3][3]){ int row, col; - printf("Enter the field as row col: "); - scanf("%d %d", &row, &col); - row -= 1; - col -= 1; - field[row][col] = 'O'; + bool valid = false; + while (!valid){ + printf("Enter the field as row col: "); + scanf("%d %d", &row, &col); + row -= 1; + col -= 1; + if(validateUserInput(row, col)){ + field[row][col] = 'O'; + valid = validateUserInput(row, col); + } + } } bool validateUserInput(int row, int col){