-
Notifications
You must be signed in to change notification settings - Fork 0
/
liveboard.h
72 lines (60 loc) · 2.25 KB
/
liveboard.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#ifndef LIVEBOARD_H
#define LIVEBOARD_H
#include "constants.h"
#include <unistd.h>
#include <bitset>
#include <iomanip>
//int arrr[SIZE][SIZE]={
// { 50, -1, 5, 2, 2, 2, 2, 2, 2, 5, -1, 50 },
// { -1, -10, 1, 1, 1, 1, 1, 1, 1, 1, -10, -1 },
// { 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5 },
// { 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 },
// { 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 },
// { 2, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 2 },
// { 2, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 2 },
// { 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 },
// { 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 },
// { 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5 },
// { -1, -10, 1, 1, 1, 1, 1, 1, 1, 1, -10, -1 },
// { 50, -1, 5, 2, 2, 2, 2, 2, 2, 5, -1, 50 } };
enum direction {LEFT , left_up , up , right_up , RIGHT , right_down , down , left_down};
class LiveBoard
{
private:
std::bitset<BOARD_SIZE> possibleBoard;
std::bitset<BOARD_SIZE> blackBoard;
std::bitset<BOARD_SIZE> whiteBoard;
public:
LiveBoard();
// int getV(int r, int c){return arrr[r][c];}
bool isPossible(int,int);
std::list<Move> possibleList;
int toOneDim(int i ,int j);
void updateColor(int i ,int j ,int aColor);
void flipColor(int,int);
void initializeBoard();
bool notEmpty(int i ,int j);
bool isEmpty(int i , int j);
int poosibleCount(){return possibleBoard.count();}
int whiteCount(){return whiteBoard.count();}
int blackCount(){return blackBoard.count();}
void setPossible(int,int);
void resetPossible(){possibleBoard.reset();possibleList.clear();}
void printBoard();
bool noPossibleMove(){return possibleBoard.none();}
void Display_Board();
void updatePossible(int);
LiveBoard& operator=(LiveBoard& source);
int checkBoard(Move move, int kind);
void set(Move move,int kind);
bool isValid(Move move, int kind);
int Check(Move move, int incx, int incy, int kind , bool toSet) ;
int getColor(int r, int c);
int getColor(int r);
void Initialize_Heuristics();
void Display_Heuristics();
std::bitset<BOARD_SIZE> getPossibleBoard() const;
std::bitset<BOARD_SIZE> getBlackBoard() const;
std::bitset<BOARD_SIZE> getWhiteBoard() const;
};
#endif // LIVEBOARD_H