X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=tictactoe.js;h=da55c9f48e42c663f3e4016acaf6f4f083f15061;hb=00507589b4984d50a34a383975fc6323db19bcfa;hp=d5a07b25506b79618993ed9ec67befb6ee289936;hpb=53806350bc2b8e36bf9d2561729b4608403af96d;p=lmno-server diff --git a/tictactoe.js b/tictactoe.js index d5a07b2..da55c9f 100644 --- a/tictactoe.js +++ b/tictactoe.js @@ -15,7 +15,7 @@ class TicTacToe extends Game { add_move(square) { /* Cannot move to an occupied square. */ if (this.state.board[square]) - return false; + return { legal: false, message: "Square is already occupied" }; this.state.board[square] = this.state.next_player; this.state.moves.push(square); @@ -25,7 +25,7 @@ class TicTacToe extends Game { else this.state.next_player = "X"; - return true; + return { legal: true }; } }