Skip to content

Commit 8dc0bb4

Browse files
authored
Update flip_tiles.hpp
1 parent 9f15646 commit 8dc0bb4

1 file changed

Lines changed: 13 additions & 8 deletions

File tree

flip_tiles.hpp

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,16 +89,21 @@ void Table::flipTiles(coor move)
8989
}
9090
}
9191
}
92-
if (isValid)
92+
try
9393
{
94-
this->moves.push_back(move);
95-
// the chosen square is assigned to current player's color
96-
setBoard(move.row, move.col, getTurn());
94+
if (isValid)
95+
{
96+
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+
}
97104
}
98-
else
105+
catch (const char *msg)
99106
{
100-
cout << "Illegal move" << endl;
101-
sleep(2);
102-
exit(EXIT_FAILURE);
107+
std::cerr << msg << '\n';
103108
}
104109
}

0 commit comments

Comments
 (0)