-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfoolgo.cc
41 lines (32 loc) · 1.09 KB
/
foolgo.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
#include <iostream>
#include <memory>
#include "board/full_board.h"
#include "game/game.h"
#include "utility/math.h"
#include "player/human_player.h"
#include "player/random_player.h"
using foolgo::math::GetTimeSeed;
using foolgo::board::FullBoard;
using foolgo::game::Game;
using foolgo::player::Player;
using foolgo::player::HumanPlayer;
using foolgo::player::RandomPlayer;
using foolgo::player::NO_PLAYER;
using foolgo::player::WHITE_PLAYER;
using foolgo::player::BLACK_PLAYER;
using foolgo::player::PlayerType;
int main() {
auto seed = GetTimeSeed();
std::unique_ptr<Player<MAIN_BOARD_LEN>> black_player(new HumanPlayer<MAIN_BOARD_LEN>());
std::unique_ptr<Player<MAIN_BOARD_LEN>> white_player(new RandomPlayer<MAIN_BOARD_LEN>(seed));
Game game(std::move(black_player), std::move(white_player));
PlayerType winPlayer = game.run();
if (winPlayer == BLACK_PLAYER) {
std::cout << "黑方胜" << std::endl;
} else if (winPlayer == WHITE_PLAYER) {
std::cout << "白方胜" << std::endl;
} else {
std::cout << "和棋" << std::endl;
}
return 0;
}