Compare commits
	
		
			No commits in common. "62e5515472e52e5421bbd22ab6c7b8a98d0d5a37" and "a84b5918b9cbc44dcedd127394528729a02f069f" have entirely different histories.
		
	
	
		
			62e5515472
			...
			a84b5918b9
		
	
		
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@ -1 +0,0 @@
 | 
			
		||||
ttt
 | 
			
		||||
							
								
								
									
										13
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								README.md
									
									
									
									
									
								
							@ -4,11 +4,22 @@ A simple TicTacToe game written in C in under 2 hours!
 | 
			
		||||
 | 
			
		||||
## Usage
 | 
			
		||||
```bash
 | 
			
		||||
./build.sh
 | 
			
		||||
./build
 | 
			
		||||
```
 | 
			
		||||
then 
 | 
			
		||||
```bash
 | 
			
		||||
./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!
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										6
									
								
								main.c
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								main.c
									
									
									
									
									
								
							@ -8,7 +8,7 @@
 | 
			
		||||
#define RED         "\033[31m"      /* Red */
 | 
			
		||||
#define BOLDGREEN   "\033[1m\033[32m"      /* Bold Green */
 | 
			
		||||
#define BOLDYELLOW  "\033[1m\033[33m"      /* Bold Yellow */
 | 
			
		||||
#define BOLDRED     "\033[1m\033[31m"      /* Bold RED */
 | 
			
		||||
#define BOLDRED     "\033[1m\033[31m"      /* Bold Yellow */
 | 
			
		||||
#define BOLDWHITE   "\033[1m\033[37m"      /* Bold White */
 | 
			
		||||
#define BOLDMAGENTA "\033[1m\033[35m"      /* Bold Magenta */
 | 
			
		||||
#define RESET       "\033[0m"
 | 
			
		||||
@ -30,7 +30,7 @@ int main(int argc, char *argv[]){
 | 
			
		||||
    printf("How many players? (1/2)\n> ");
 | 
			
		||||
    scanf("%d", &players);
 | 
			
		||||
 | 
			
		||||
    //TODO Tidy this up!
 | 
			
		||||
    //this could be tidier i think
 | 
			
		||||
    if(players == 1){
 | 
			
		||||
        do{
 | 
			
		||||
            flag = check_win();
 | 
			
		||||
@ -42,12 +42,10 @@ int main(int argc, char *argv[]){
 | 
			
		||||
 | 
			
		||||
            player_choice('X');
 | 
			
		||||
            print_board();
 | 
			
		||||
            sleep(2);
 | 
			
		||||
 | 
			
		||||
            cpu_choice('O');
 | 
			
		||||
            flag = check_win();
 | 
			
		||||
            print_board();
 | 
			
		||||
            sleep(2);
 | 
			
		||||
 | 
			
		||||
        } while(flag == ' ');
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user