-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathtest_board.cpp
More file actions
34 lines (28 loc) · 782 Bytes
/
test_board.cpp
File metadata and controls
34 lines (28 loc) · 782 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
#include "board.h"
#include "utils.h"
#include <iostream>
#include <cstdlib>
int main(int argc, char *argv[])
{
srand(static_cast<unsigned int>(time(nullptr)));
Board *board=choose_game(AWALE);
board->print();
board->play_random_move(PLAYER_1);
board->print();
board->play_random_move(PLAYER_2);
board->print();
board->play_random_move(PLAYER_1);
board->print();
std::cout << "----------" << std::endl;
Board *copy=board->deepcopy();
Token winner=board->play_random_game(PLAYER_2);
if (winner==NOT_PLAYED) std::cout<<"draw"<<std::endl;
else std::cout<<"player "<<winner<<" won"<<std::endl;
board->print();
delete board;
std::cout << "----------" << std::endl;
copy->play_random_move(PLAYER_2);
copy->print();
delete copy;
return 0;
}