#include "HumanNimPlayer.hpp"
#include <iostream> HumanNimPlayer::HumanNimPlayer() { std::cout << "Welcome! What is your name?" << std::endl; do { std::cout << "Name: "; if (!(std::cin >> name)) { name = "Anonymous"; } } while (name==""); } const std::string& HumanNimPlayer::get_name() const { return name; } NimMove HumanNimPlayer::get_move(const NimGame& game) const { NimMove move; do { unsigned int heap_index, count; std::cout << name << ", your move: "; if (!(std::cin >> heap_index >> count)) { return NimMove(); } move = NimMove(heap_index, count); } while (!game.valid_move(move)); return move; } // support dynamic loading extern "C" { NimPlayer* construct() { return new HumanNimPlayer(); } } // extern "C" |