|
@ -1,14 +1,11 @@ |
|
|
#include <stdio.h> |
|
|
#include <stdio.h> |
|
|
#include <stdlib.h> |
|
|
#include <stdlib.h> |
|
|
#include <string.h> |
|
|
#include <string.h> |
|
|
|
|
|
#include <stdbool.h> |
|
|
|
|
|
|
|
|
#include "ticTacToe.h" |
|
|
#include "ticTacToe.h" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int something(int a){ |
|
|
|
|
|
return a; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void printPrompt(){ |
|
|
void printPrompt(){ |
|
|
printf("Let's play Tic Tac Toe. You will use O, I will use X.\nJust enter the number of the field you choose as row col.\nYou start.\n"); |
|
|
printf("Let's play Tic Tac Toe. You will use O, I will use X.\nJust enter the number of the field you choose as row col.\nYou start.\n"); |
|
|
} |
|
|
} |
|
@ -37,5 +34,15 @@ void getPlayerInput(char field[3][3]){ |
|
|
int row, col; |
|
|
int row, col; |
|
|
printf("Enter the field as row col: "); |
|
|
printf("Enter the field as row col: "); |
|
|
scanf("%d %d", &row, &col); |
|
|
scanf("%d %d", &row, &col); |
|
|
|
|
|
row -= 1; |
|
|
|
|
|
col -= 1; |
|
|
field[row][col] = 'O'; |
|
|
field[row][col] = 'O'; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool validateUserInput(int row, int col){ |
|
|
|
|
|
if (row < 3 && row >= 0){ |
|
|
|
|
|
if (col < 3 && col >= 0){ |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |