3 bool isAnswerLegal(std::string *answer, std::vector<std::string> *moves) {
4 for (int i = 0; i < moves->size(); ++i) {
5 if (*answer == moves->at(i)) {
8 if (answer->size() > 5) {
9 switch(answer->at(5)) {
14 if (answer->substr(0,5) == moves->at(i)) {
31 std::vector<std::string> *moves;
33 moves = p.getLegalMoves();
35 std::cout << "Legal moves:" << std::endl;
36 for (int i = 0; i < moves->size(); ++i) {
37 std::cout << moves->at(i) << ", ";
40 while (!(input == "Q" || isAnswerLegal(&input, moves))) {
41 std::cout << std::endl << "Enter move: ";
43 if (!(input == "Q" || isAnswerLegal(&input, moves))) {
44 std::cout << "That move is not a valid move. Try again." << std::endl;
53 moves = p.getLegalMoves();
54 if (value == std::numeric_limits<int>::min()) {
55 std::cout << "The white player has been defeated." << std::endl;
58 else if (value == std::numeric_limits<int>::max()) {
59 std::cout << "The black player has been defeated." << std::endl;
62 else if (moves->empty()) {
63 std::cout << "Stalemate." << std::endl;