-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame_state.cc
63 lines (45 loc) · 1.09 KB
/
game_state.cc
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
#include "includes/game_state.h"
#include "includes/types.h"
#include <iostream>
GameState::GameState(BITBOARD w, BITBOARD b, BITBOARD q) :
whitePawns(w), blackPawns(b), allQueens(q), currentPlayer(-1){
}
GameState::GameState(BITBOARD w, BITBOARD b, BITBOARD q, int player) :
whitePawns(w), blackPawns(b), allQueens(q), currentPlayer(player){
}
GameState::~GameState(){
}
BITBOARD GameState::whites(){
return (whitePawns);
}
BITBOARD GameState::blacks(){
return (blackPawns);
}
BITBOARD GameState::queens(){
return (allQueens);
}
BITBOARD GameState::queens(int player){
if(player == black)
return (allQueens & blackPawns);
else
return (allQueens & whitePawns);
}
int GameState::player() {
return (currentPlayer);
}
void GameState::setState(BITBOARD w, BITBOARD b, BITBOARD q, int player) {
whitePawns = w;
blackPawns = b;
allQueens = q;
currentPlayer = player;
}
void GameState::tooglePlayer(){
if(currentPlayer == black){
currentPlayer = white;
}else if(currentPlayer == white){
currentPlayer = black;
}
}
void GameState::setPlayer(int player){
currentPlayer = player;
}