#include <windows.h>
#include "graphics.h"
#define AI_LEVEL 2
const ULONG CELL_COUNT = 14;
const ULONG CELL_WIDTH = 30;
const ULONG CELL_HEIGHT = 30;
const UCHAR CHESS_NONE = 0x00;
const UCHAR CHESS_BLACK = 0x01;
const UCHAR CHESS_WHITE = 0x02;
const UCHAR CHESS_BAD = 0xFF;
const CHAR DIR_UP_COLUMN = 1;
const CHAR DIR_DOWN_COLUMN = -1;
const CHAR DIR_UP_ROW = 2;
const CHAR DIR_DOWN_ROW = -2;
const CHAR DIR_UP_LEFT_DIAGONAL = 3;
const CHAR DIR_DOWN_LEFT_DIAGONAL = -3;
const CHAR DIR_UP_RIGHT_DIAGONAL = 4;
const CHAR DIR_DOWN_RIGHT_DIAGONAL = -4;
const ULONG SCORE_2 = 10;
const ULONG SCORE_2_2 = 30;
const ULONG SCORE_3 = 50;
const ULONG SCORE_3_3 = 120;
const ULONG SCORE_4 = 200;
const ULONG SCORE_4_3 = 240;
const ULONG SCORE_4_4 = 360;
const ULONG SCORE_5 = 50000;
const float GRAPH_SCALE = 0.83F;
typedef struct _POS {
ULONG x;
ULONG y;
} POS, *PPOS;
typedef struct _CHESS_PLAYING_STEP {
struct _CHESS_PLAYING_STEP *BLink;
struct _CHESS_PLAYING_STEP *FLink;
ULONG ulStepNumber;
UCHAR ucChess;
POS tPos;
} CHESS_PLAYING_STEP, *PCHESS_PLAYING_STEP;
typedef enum _GAME_STATUS {
STATUS_PLAYING = 0,
STATUS_HUMAN_WIN,
STATUS_COMPUTER_WIN,
} GAME_STATUS;
/* Game.cpp */
BOOLEAN GmInitialize();
VOID GmDeinitialize();
BOOLEAN GmGetIndexByMouseMsg(MOUSEMSG tMsg, PPOS lpPos);
GAME_STATUS GmHumanTurn(POS tPos);
inline UCHAR GmGetBoard(ULONG x, ULONG y);
inline VOID GmSetBoard(ULONG x, ULONG y, UCHAR ucData);
/* AI.cpp */
BOOLEAN AiIsPlayerWin(UCHAR *lpBoard, POS tPos, UCHAR ucChess);
VOID AiGetRandomPos(UCHAR *lpBoard, PPOS lpPos);
ULONG AiGetValidPosAround(POS tBasePos, PPOS lpValidPos, ULONG ulRange);
ULONG AiGetValidPosComplete(POS tBasePos, PPOS lpValidPos);
POS AiGetBestPos(UCHAR *lpBoard, UCHAR ucChess, PLONG lpMaxScore, ULONG ulNode);