mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-25 22:32:50 +02:00
If no good pick, choose random
This commit is contained in:
@@ -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];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user