This commit is contained in:
Dragon Fire
2021-01-19 06:37:41 -05:00
parent e66ec4b64c
commit 468ddfa60e
+8 -11
View File
@@ -122,25 +122,22 @@ module.exports = class ConnectFourCommand extends Command {
max: 1, max: 1,
time: 60000 time: 60000
}); });
if (!turn.size) { const choice = turn ? turn.first().content : null;
if (!choice) {
await msg.say('Sorry, time is up! I\'ll pick their move for them.'); await msg.say('Sorry, time is up! I\'ll pick their move for them.');
i = AIEngine.playAI('hard'); i = AIEngine.playAI('hard');
lastMove = i + 1; lastMove = i + 1;
continue; } else if (choice.toLowerCase() === 'end') {
}
const choice = turn.first().content;
if (choice.toLowerCase() === 'end') {
winner = userTurn ? opponent : msg.author; winner = userTurn ? opponent : msg.author;
break; break;
} } else if (choice.toLowerCase() === 'play for me') {
if (choice.toLowerCase() === 'play for me') {
i = AIEngine.playAI('hard'); i = AIEngine.playAI('hard');
lastMove = i + 1; lastMove = i + 1;
continue; } else {
i = Number.parseInt(choice, 10) - 1;
AIEngine.play(i);
lastMove = i + 1;
} }
i = Number.parseInt(choice, 10) - 1;
AIEngine.play(i);
lastMove = i + 1;
} }
board[colLevels[i]][i] = sign; board[colLevels[i]][i] = sign;
colLevels[i]--; colLevels[i]--;