mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Fix blackjack ace calculation breaking if ace isn't last card
This commit is contained in:
@@ -147,7 +147,7 @@ module.exports = class BlackjackCommand extends Command {
|
||||
}
|
||||
|
||||
calculate(hand) {
|
||||
return hand.reduce((a, b) => {
|
||||
return hand.sort((a, b) => a.value - b.value).reduce((a, b) => {
|
||||
let { value } = b;
|
||||
if (value === 11 && a + value > 21) value = 1;
|
||||
return a + value;
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiao",
|
||||
"version": "91.5.2",
|
||||
"version": "91.5.3",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Xiao.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user