// File: game.cxx
#include <cassert> // Provides assert
#include <climits> // Provides INT_MAX and INT_MIN
#include <iostream> // Provides cin, cout
#include <queue> // Provides queue<string>
#include <string> // Provides string
#include "game.h" // Provides definition of game class
using namespace std;
namespace main_savitch_14
{
const int game::SEARCH_LEVELS;
//i have only the functions i needed for the first assignment
//i'll put the rest in when i need them
game::who game::play( )
{
restart( );
while (!is_game_over( ))
{
display_status( );
/*if (last_mover( ) == COMPUTER)*/ make_human_move( );
}
display_status( );
return last_mover();
}
void game::display_message(const string& message) const
{
cout << message;
}
string game::get_user_move( ) const
{
string answer;
display_message("Your move, please: ");
getline(cin, answer);
return answer;
}
void game::make_human_move( )
{
string move;
move = get_user_move( );
while (!is_legal(move))
{
display_message("Illegal move.\n");
move = get_user_move( );
}
make_move(move);
}
}