From 23e55bd0ecbc107b706c283fd0423736191d2831 Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Fri, 22 Jan 2021 21:51:51 -0500 Subject: [PATCH] Fix --- commands/games-mp/nim.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/commands/games-mp/nim.js b/commands/games-mp/nim.js index 2b0f0c09..3eb80dff 100644 --- a/commands/games-mp/nim.js +++ b/commands/games-mp/nim.js @@ -191,7 +191,11 @@ module.exports = class NimCommand extends Command { const isOdd = movesLeft % 2 === 1; const largest = Math.max(...board); const indexOfMax = board.indexOf(largest); - if (largest === 1 && isOdd) return [indexOfMax, 1]; + if (largest === 1 && isOdd) { + board[indexOfMax] -= 1; + return [indexOfMax, 1]; + } + board[indexOfMax] -= largest - Number(isOdd); return [indexOfMax, largest - Number(isOdd)]; } for (let i = 0; i < board.length; i++) {