44 #ifndef DUMBO_CORE_PLAYER_H
45 #define DUMBO_CORE_PLAYER_H
47 #include <dumbo/core/game_state.h>
48 #include <dumbo/core/move.h>
49 #include <dumbo/core/solver.h>
51 #include <glog/logging.h>
58 template <
typename M,
typename G>
63 : state_(initial_state), solver_(std::move(solver)) {
64 CHECK_NOTNULL(solver_.get());
75 std::unique_ptr<Solver<M, G>> solver_;
80 template <
typename M,
typename G>
85 while (!state_.IsTerminal(&win)) {
90 if (state_.IsMyTurn()) {
91 std::cout <<
"My turn." << std::endl;
92 const M move = solver_->Run(state_);
93 std::cout << move << std::endl;
95 CHECK(state_.NextState(move, &next_state));
98 std::cout <<
"Please input a 0-indexed row [ENTER] and column [ENTER]."
103 std::cout << move << std::endl;
106 while (!state_.NextState(move, &next_state)) {
107 std::cout <<
"Illegal move. Please try again." << std::endl;
109 std::cout << move << std::endl;
120 std::cout <<
"Congratulations! You won the game." << std::endl;
122 std::cout <<
"Sorry. You lost the game." << std::endl;
124 std::cout <<
"Tie game." << std::endl;