]> git.cworth.org Git - empires-server/blobdiff - tictactoe.js
Add message string to the return value of add_move
[empires-server] / tictactoe.js
index d5a07b25506b79618993ed9ec67befb6ee289936..da55c9f48e42c663f3e4016acaf6f4f083f15061 100644 (file)
@@ -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 };
   }
 }