X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=lmno.js;h=b6c5b78e04e6b83a6700c19d623a6e55d625f1c8;hb=00507589b4984d50a34a383975fc6323db19bcfa;hp=60c0f44000dfa702ec04c4b9cddbbb6d9600a40f;hpb=53806350bc2b8e36bf9d2561729b4608403af96d;p=lmno-server diff --git a/lmno.js b/lmno.js index 60c0f44..b6c5b78 100644 --- a/lmno.js +++ b/lmno.js @@ -302,13 +302,13 @@ for (let key in engines) { const game = request.game; const move = request.body.move; - const legal = game.add_move(move); + const result = game.add_move(move); - /* Inform this client whether the move was legal. */ - response.send(JSON.stringify(legal)); + /* Feed move response back to the client. */ + response.json(result); /* And only if legal, inform all clients. */ - if (! legal) + if (! result.legal) return; game.broadcast_move(move);