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
#ifndef HUMAN_NIM_PLAYER_HPP
#define HUMAN_NIM_PLAYER_HPP

#include <iostream>
#include <string>
#include "NimMove.hpp"

template<typename Game>
struct HumanNimPlayer {
   NimMove get_move(const Game& game) const {
      using namespace std;
      NimMove move;
      do {
     unsigned int heap_index; unsigned int count;
     std::cout << "Your move: ";
     if (!(std::cin >> heap_index >> count)) {
        return NimMove();
     }
     move = NimMove(heap_index, count);
      } while (!game.valid_move(move));
      return move;
   }
};

#endif