forked from jtilahun/nullptr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathboard.hpp
52 lines (44 loc) · 1.32 KB
/
board.hpp
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef __BOARD_H__
#define __BOARD_H__
#define NUM_SPACES 64
#define BOARD_SIZE 8
#define TOKEN_DIFF_WEIGHT 20
#define NEIGHBOR_PENALTY 3
#include <bitset>
#include "common.hpp"
using namespace std;
const int HEURISTIC[BOARD_SIZE][BOARD_SIZE] =
{{ 100, -20, 10, 5, 5, 10, -20, 100},
{ -20, -50, -2, -2, -2, -2, -50, -20},
{ 10, -2, -1, -1, -1, -1, -2, 10},
{ 5, -2, -1, -1, -1, -1, -2, 5},
{ 5, -2, -1, -1, -1, -1, -2, 5},
{ 10, -2, -1, -1, -1, -1, -2, 10},
{ -20, -50, -2, -2, -2, -2, -50, -20},
{ 100, -20, 10, 5, 5, 10, -20, 100}};
class Board
{
public:
Board();
~Board();
Board *copy();
bool isDone();
bool hasMoves(Side side);
bool checkMove(Move *m, Side side);
void doMove(Move *m, Side side);
int count(Side side);
int countBlack();
int countWhite();
void setBoard(char data[]);
int getHeuristic(Side side, Side opponentsSide);
private:
bitset<NUM_SPACES> black;
bitset<NUM_SPACES> taken;
int moves_made;
bool occupied(int x, int y);
bool get(Side side, int x, int y);
void set(Side side, int x, int y);
bool onBoard(int x, int y);
bool hasNeighbor(int i, int j, bool is_black);
};
#endif