From 50e40ed61e8226ecbb7f1d7d53ba028fad1a9a01 Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 7 Mar 2018 21:57:06 +0900 Subject: :v: --- src/api/stream/othello-game.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'src/api') diff --git a/src/api/stream/othello-game.ts b/src/api/stream/othello-game.ts index a5fb379e80..d086478159 100644 --- a/src/api/stream/othello-game.ts +++ b/src/api/stream/othello-game.ts @@ -55,9 +55,7 @@ export default function(request: websocket.request, connection: websocket.connec let winner; if (isEnded) { - const blackCount = o.board.filter(s => s == 'black').length; - const whiteCount = o.board.filter(s => s == 'white').length; - winner = blackCount == whiteCount ? null : blackCount > whiteCount ? game.black_user_id : game.white_user_id; + winner = o.blackCount == o.whiteCount ? null : o.blackCount > o.whiteCount ? game.black_user_id : game.white_user_id; } const log = { @@ -79,9 +77,6 @@ export default function(request: websocket.request, connection: websocket.connec } }); - publishOthelloGameStream(gameId, 'set', { - color: myColor, - pos - }); + publishOthelloGameStream(gameId, 'set', log); } } -- cgit v1.2.3-freya