From 10905ad190410e3d2980017c42a484ec9654420f Mon Sep 17 00:00:00 2001 From: CaptainPewPew Date: Tue, 12 May 2020 19:44:53 -0400 Subject: added space between each board --- Tic Tac Toe.c | 16 +++++++++++----- readme.md | 9 +++++++++ ttt | Bin 8836 -> 16984 bytes 3 files changed, 20 insertions(+), 5 deletions(-) mode change 100644 => 100755 Tic Tac Toe.c diff --git a/Tic Tac Toe.c b/Tic Tac Toe.c old mode 100644 new mode 100755 index 2506cd0..e927068 --- a/Tic Tac Toe.c +++ b/Tic Tac Toe.c @@ -2,15 +2,20 @@ #include #include #include + char check_board(char[10],char[10]); int print_board(char[10]); int check_tied(char[10]); + // 0|1|2 // - - - // 3|4|5 // - - - // 6|7|8 +//TODO: Add timer of 2 second? +//TODO: Add more stuff to do than TTT + int main(void){ char board[10] = " "; char vis_board[10] = "123456789"; @@ -19,7 +24,7 @@ int main(void){ int block; char gg[10]; char *ptr; - + //main game loop while (1){ @@ -51,10 +56,10 @@ int main(void){ } break; } - + } - - + + //checks if win condition met or tie if (check_board(vis_board,board) == 1){ if (x_turn){ @@ -71,7 +76,7 @@ int main(void){ printf("\nGame tied\n"); break; } - + x_turn = !x_turn; o_turn = !o_turn; @@ -82,6 +87,7 @@ int main(void){ } int print_board(char board[10]){ + printf("\n"); for (int i = 0; i < strlen(board); ++i){ printf("%c",board[i]); if (i != 2 && i != 5 && i != 8){ diff --git a/readme.md b/readme.md index e69de29..7c9f797 100644 --- a/readme.md +++ b/readme.md @@ -0,0 +1,9 @@ +# Tic Tac Toe + +The game is tic tac toe. + +I made this in first year engineering as a bored project since my C programming class wasn't challenging enough and I just wanted to do something more fun than what was asked. + +# Plans +[ ] Maybe I will add a timer to each turn to up the difficulty +[ ] a way to clear the terminal so it doen't get too flooded diff --git a/ttt b/ttt index 1fb05ea..347cca6 100755 Binary files a/ttt and b/ttt differ -- cgit v1.2.3