If no good pick, choose random

This commit is contained in:
Dragon Fire
2021-01-22 20:41:39 -05:00
parent 0e5214ee28
commit 97e56bf830
+4 -1
View File
@@ -198,6 +198,9 @@ module.exports = class NimCommand extends Command {
}
}
}
return null;
const randomRow = Math.floor(Math.random() * board.length);
const randomAmount = Math.floor(Math.random() * board[randomRow]) + 1;
board[randomRow] -= randomAmount;
return [randomRow, randomAmount];
}
};