summaryrefslogtreecommitdiff
path: root/ttt.c
diff options
context:
space:
mode:
Diffstat (limited to 'ttt.c')
-rw-r--r--ttt.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/ttt.c b/ttt.c
index 3701d9a..dd7907f 100644
--- a/ttt.c
+++ b/ttt.c
@@ -78,6 +78,16 @@ int check_win(int boardState[3][3]) {
}
return 0;
}
+int is_full(int boardState[3][3]) {
+ //if all squares full, return 1
+ //else return 0
+
+}
+int is_drawn(int boardState[3][3]) {
+ //checks if board is full and if no win is on the board
+ //returns 1 if so, else 0
+
+}
int* user_input_pos() {
int* ip = malloc(2 * sizeof(int));
printf("Enter X coordinate");
@@ -86,20 +96,21 @@ int* user_input_pos() {
scanf("%d", &ip[1]);
return ip;
}
-void clr_scr()
+void clear_screen()
{
system("@cls||clear");
}
int main() {
int board[3][3] = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } };
while(1) {
- clr_scr();
+ clear_screen();
draw_board(board);
int* tl = user_input_pos();
board[tl[0] - 1][3 - tl[1]] = 1;
free(tl);
if(check_win(board) != 0) {
printf("Someone won!");
+ printf('\n');
break;
}
}