X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=tictactoe.js;h=2a8dd06f9d580398e483e7a554883beee54bcc4e;hb=fbf331eedc7d4579ec861c140e26a11b04278c1c;hp=7d7450c5ab6c4504e16aba53e9c011bd02757286;hpb=9e5bf65868eaafcb11d09c0fee02e0d3d7c2121f;p=empires-server diff --git a/tictactoe.js b/tictactoe.js index 7d7450c..2a8dd06 100644 --- a/tictactoe.js +++ b/tictactoe.js @@ -29,28 +29,8 @@ class TicTacToe extends Game { return true; } - - broadcast_move(square) { - this.broadcast_event("move", square); - } } -router.post('/move', (request, response) => { - const game = request.game; - const square = request.body.move; - - const legal = game.add_move(square); - - /* Inform this client whether the move was legal. */ - response.send(JSON.stringify(legal)); - - /* And only if legal, inform all clients. */ - if (! legal) - return; - - game.broadcast_move(square); -}); - exports.router = router; exports.Game = TicTacToe;