-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChampion.cpp
More file actions
45 lines (42 loc) · 706 Bytes
/
Champion.cpp
File metadata and controls
45 lines (42 loc) · 706 Bytes
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
#include "Champion.h"
const Coordinate Champion::play(const Board& board) {
if(rival=="XYPlayer"){
if(meFirst){
YXPlayer player;
return player.play(board);
}
else{
int y=1;
for (int x=0; x<board.size(); ++x) {
Coordinate c{x,y};
if (board[c]=='.') {
return c;
}
}
}
}
if(rival=="YXPlayer"){
if(meFirst){
XYPlayer player;
return player.play(board);
}
else{
int x=1;
for (int y=0; x<board.size(); ++x) {
Coordinate c{x,y};
if (board[c]=='.') {
return c;
}
}
}
}
else
{
XYPlayer player;
return player.play(board);
}
}
void Champion::getRival(string name, bool first){
this->rival=name;
this->meFirst=first;
}