We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9f15646 commit 8dc0bb4Copy full SHA for 8dc0bb4
1 file changed
flip_tiles.hpp
@@ -89,16 +89,21 @@ void Table::flipTiles(coor move)
89
}
90
91
92
- if (isValid)
+ try
93
{
94
- this->moves.push_back(move);
95
- // the chosen square is assigned to current player's color
96
- setBoard(move.row, move.col, getTurn());
+ if (isValid)
+ {
+ this->moves.push_back(move);
97
+ // the chosen square is assigned to current player's color
98
+ setBoard(move.row, move.col, getTurn());
99
+ }
100
+ else
101
102
+ throw "flipTiles: Illegal move";
103
104
- else
105
+ catch (const char *msg)
106
- cout << "Illegal move" << endl;
- sleep(2);
- exit(EXIT_FAILURE);
107
+ std::cerr << msg << '\n';
108
109
0 commit comments