forked from benwu030/Text_based_game
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtictactoe.h
29 lines (18 loc) · 827 Bytes
/
tictactoe.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
//tictactoe.h
//Program Description: header file of tictacktoe.cpp
#ifndef TIKTACTOE_H
#define TIKTACTOE_H
//Display Tiktactoe playing board
void TTT_Display(char board[3][4]);
//Check if 'x' or 'o' wins
int TTT_CheckWin(char board[3][4]);
//Handle Both User and AI input of moves
void TTT_HandlePlayerInput(char board[3][4]);
// minimax algorithm from https://www.geeksforgeeks.org/minimax-algorithm-in-game-theory-set-3-tic-tac-toe-ai-finding-optimal-move/
int minimax(char board[3][4], int depth, bool isMax);
//Find best move for AI
void TTT_AIMove(char board[3][4]);// optimize AI that will never lose
void TTT_AIMove_Random(char board[3][4]);// dumb computer that use random to make choice
//Main function to execute TicTacToe
bool TicTacToe(int diffculty); //diffculty = 1 Optimized AI; Other Dummy AI
#endif