code clean up and rd update

This commit is contained in:
simonkellet 2022-05-21 22:44:50 +01:00
parent a7463156aa
commit 517d366f22
3 changed files with 13 additions and 2 deletions

View File

@ -11,4 +11,15 @@ then
./ttt
```
## CPU
There is infact a CPU programmed into this application!
You can play against it if you swap out:
```c
41 player_choice('O');
```
with
```c
41 cpu_choice('O');
```
Enjoy!

4
main.c
View File

@ -1,7 +1,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <time.h>
#include <unistd.h>
#define ROWS 3
#define COLUMNS 3
@ -14,7 +14,6 @@
#define RESET "\033[0m"
char board[ROWS][COLUMNS];
char ESC = 27;
void print_board();
void clear_board();
@ -105,6 +104,7 @@ void player_choice(char player){
if(board[pr][pc] != ' ' ){
printf(BOLDRED "\n[%c] Cannot play here, skipping...\n" RESET, player);
sleep(2);
} else {
board[pr][pc] = player;
}

BIN
ttt

Binary file not shown.