diff --git a/www/js/game.js b/www/js/game.js index 132bd5e..a80e477 100644 --- a/www/js/game.js +++ b/www/js/game.js @@ -311,30 +311,30 @@ GAME.Game = class { this.state.check += checking_pieces; // Count moves available to next turn player to determine checkmate. - if(this.state.check != 0) { - let moves = 0; + let moves = 0; - // Search for valid board moves. - for(let piece of this.board.pieces) { - if(piece !== null && piece.player == (this.turn & 1)) { - for(let move of this.movement_tiles(piece, piece.tile)) { - if(move.valid) { moves += 1; } - } - - for(let move of this.movement_tiles_alt(piece, piece.tile)) { - if(move.valid) { moves += 1; } - } + // Search for valid board moves. + for(let piece of this.board.pieces) { + if(piece !== null && piece.player == (this.turn & 1)) { + for(let move of this.movement_tiles(piece, piece.tile)) { + if(move.valid) { moves += 1; } } - } - // Search for valid pool placements. - for(let i = 0; i < this.pools[player].pieces.length; ++i) { - for(let move of this.placement_tiles(i, player)) { + for(let move of this.movement_tiles_alt(piece, piece.tile)) { if(move.valid) { moves += 1; } } } + } - if(moves == 0) { this.state.code = GAME.Const.State.Checkmate; } + // Search for valid pool placements. + for(let i = 0; i < this.pools[player].pieces.length; ++i) { + for(let move of this.placement_tiles(i, player)) { + if(move.valid) { moves += 1; } + } + } + + if(moves == 0) { + this.state.code = GAME.Const.State.Checkmate; } } @@ -835,6 +835,7 @@ GAME.Const = { Current: 0, Checkmate: 1, Resign: 2, + Default: 3, }, Direction: [