We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e73e67e commit a6599bfCopy full SHA for a6599bf
1 file changed
ticTacToe.scala
@@ -461,6 +461,9 @@ class TicTacToeBoard() {
461
}
462
463
def setSpaceOwner(space : Int, newOwner : String) {
464
+ if (space < 1 || space > 9) {
465
+ throw new InvalidParameter(s"A player tried to move to space ${space}, which is not a valid space on the Tic-tac-toe board.")
466
+ }
467
if (previousMarkMove == newOwner) {
468
throw new TwoMovesInARow(s"${newOwner} tried to make a move on the board, but it was the last player to make a move. Can't make two moves in a row.")
469
0 commit comments