-
Notifications
You must be signed in to change notification settings - Fork 0
/
Board.hpp
88 lines (78 loc) · 2.08 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#pragma once
#include "Cell.hpp"
#include <iostream>
#include "Player.hpp"
#include <vector>
struct _Board
{
int _cell[8][8];
int _currentPlayer;
int _mode;
} ;
struct Coords {
int x1 : 4;
int y1 : 4;
int x2 : 4;
int y2 : 4;
Coords ( int x1_, int y1_, int x2_, int y2_ );
bool operator!= ( const Coords &B );
};
struct Move {
std::vector< Coords > coords;
Move(){}
Move( int x1, int y1, int x2, int y2 );
Move( Coords c );
void add( Coords c );
bool operator== ( const Move &B );
};
using namespace std;
class Board{
public:
Cell cell[8][8];
Player player1;
Player player2;
Board();
void initBoard();
bool isMoving;
bool _isMoving;
void setFirstPlayer(int x);
bool selectCell(int x, int y);
bool multipleMoveValid();
void alterTurn();
int checkWin();
bool checkStaleMate();
bool mover(int newX, int newY);
Player currentPlayer;
int xinmultiple;
int yinmultiple;
int xCoordSelectedCell;
int yCoordSelectedCell;
bool validmultiplecheck;
friend std::ostream& operator<<(std::ostream& out, const Board &board);
bool updatevar;
int drawCounter, redP, blackP, redK, blackK;
bool checkCapture( int x, int y );
bool checkCapture( bool color );
std::vector< Move > getMoveSequences( Move move, Board b );
std::vector< Move > getViableMoves( bool color );
std::vector< Move > getViableMoves( int x, int y );
void capture( int x1, int y1, int x2, int y2 );
int move( Coords m );
int move( Move m );
int move( int x1, int y1, int x2, int y2, bool color );
int checkState( bool color );
int evaluateField( int x, int y );
int evaluateBoard( bool color, bool side );
int mode ;
int load();
void save();
private:
struct _Board _board;
void setDisplacementvect(int x,int y);
bool isValidMove(int,int);
void update();
int Xdisplacement,Ydisplacement;
bool checkcaptureavailable();
};
_Board loadfromfile ();
void savetofile(_Board _fboard);