-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTermInterface.cpp
73 lines (42 loc) · 1.07 KB
/
TermInterface.cpp
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
#include "TermInterface.h"
using namespace std;
//constructors
TermInterface::TermInterface(Board* initBoard)
: board(initBoard)
{
board = initBoard;
}
//setters
//getters
void TermInterface::printBoard(){
for(int i = 0; i < board->getY(); i++){
for(int j = 0; j < board->getX(); j++){
if(board->getOccupied(i * board->getX() + j)){
if(board->getPiece(i * board->getX() + j)->getTeam() == 0) cout << "+ ";
if(board->getPiece(i * board->getX() + j)->getTeam() == 1) cout << "x ";
}else if((i + j) % 2){
cout << "0 ";
}else{
cout << "O ";
}
}
cout << "\n";
}
}
void TermInterface::printValidMoves(int start)
{
if(board->getOccupied(start))
{
for(int i = 0; i < board->getY(); i++)
{
for(int j = 0; j < board->getX(); j++)
{
if(board->getPiece(start)->getMoveValid(start, (i * board->getX() + j), board->getX(), board->getTeam(i * board->getX() + j))) cout << "0 ";
else {
cout << "X ";
}
}
cout << "\n";
}
}
}