1234567891011121314151617181920 |
- #include "RealPlayer.h"
- #include "Position.h"
- #include <iostream>
- #include <utility>
- #include <stdexcept>
- std::pair<Position, Position> RealPlayer::get_move(Chessboard board, char color)
- {
- char pos1[2];
- char pos2[2];
- std::cout << "Please enter your move: ";
- std::cin >> pos1;
- std::cin >> pos2;
- if (board.get_cell(Position(pos1[0], pos1[1])).get_figure() == nullptr or board.get_cell(Position(pos1[0], pos1[1])).get_figure()->get_color() != color )
- throw std::invalid_argument("Player Plays Against the Rules");
- return std::pair<Position, Position>(Position(pos1[0], pos1[1]), Position(pos1[2], pos1[3]));
- }
|