-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAI.h
27 lines (23 loc) · 1.14 KB
/
AI.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
#include <limits.h>
#include "common/data.h"
#define MIN(X, Y) ((X) < (Y) ? (X) : (Y))
#define MAX(X, Y) ((X) > (Y) ? (X) : (Y))
typedef enum {
Ongoing = 0, //game is still going
AIWin = 1,
PlayerWin = 2,
BoardFull = 3
} GameStatus;
struct AIMove {
int column;
int score;
GameStatus gameStatus;
};
//struct Hashmap* copyBoard(const struct Hashmap* restrict board, const int x, const int y);
int count(const int* restrict window, int token);
void evaluateWindow(const int* restrict window, int* restrict score);
void getScore(const struct Hashmap* restrict board, const int* restrict centres, const int x, const int y, int* restrict finalScore);
GameStatus isGameOver(const struct Hashmap* restrict board, const int row, const int column);
int inline safeWinScore(const int scale, const int depth, const int maxDepth);
struct AIMove* minimax(const struct Hashmap* restrict board, const int x, const int y, const int column, const int* restrict centres, const int player, const int depth, const int maxDepth, int alpha, int beta);
void AIMakeMove(const struct Hashmap* restrict board, int* restrict column, const int* restrict centres, const int depth);