diff --git a/commands/games-mp/chess.js b/commands/games-mp/chess.js index 3c4d0da9..4e5e0a19 100644 --- a/commands/games-mp/chess.js +++ b/commands/games-mp/chess.js @@ -93,8 +93,8 @@ module.exports = class ChessCommand extends Command { } else { await msg.say('Sorry, time is up! Playing random move.'); const moves = game.moves(); - const pieces = Object.keys(moves); - const piece = pieces[Math.floor(Math.random() * pieces.length)]; + const available = Object.keys(moves); + const piece = available[Math.floor(Math.random() * available.length)]; const move = moves[piece][Math.floor(Math.random() * moves[piece].length)]; game.move(piece, move); lastTurnTimeout = true;