shufflecom-calculations 1.2.1 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/games/blackjack.d.ts +36 -17
- package/lib/games/blackjack.js +72 -24
- package/lib/games/blackjack.js.map +1 -1
- package/lib/games/cardGames.d.ts +1 -1
- package/lib/games/cardGames.js.map +1 -1
- package/lib/games/hilo.d.ts +0 -4
- package/lib/games/hilo.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/games/blackjack.spec.ts +548 -118
- package/src/games/blackjack.ts +125 -55
- package/src/games/cardGames.ts +56 -1
- package/src/games/hilo.ts +0 -6
- package/src/index.ts +1 -0
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import BigNumber from 'bignumber.js';
|
|
2
|
-
import { Blackjack, BlackjackAction, InsuranceStatus, PerfectPairType, SettleBetVars, TwentyOnePlusThreeType } from './blackjack';
|
|
2
|
+
import { Blackjack, BlackjackAction, HandOutcome, InsuranceStatus, PerfectPairType, SettleBetVars, TwentyOnePlusThreeType } from './blackjack';
|
|
3
3
|
import { CardGames, CardValue, Suits, suitsArr } from './cardGames';
|
|
4
4
|
|
|
5
5
|
const getIndex = (value: CardValue) => CardGames.getCardIndexFromDetails({ suit: suitsArr[Math.floor(Math.random() * 4)], value });
|
|
6
6
|
|
|
7
7
|
describe('Blackjack', () => {
|
|
8
8
|
it('should get the correct list of available next actions', () => {
|
|
9
|
-
const funcParams: Array<{ input: [number[], number
|
|
9
|
+
const funcParams: Array<{ input: [number[], [number], InsuranceStatus, boolean]; output: BlackjackAction[] }> = [
|
|
10
10
|
{
|
|
11
11
|
input: [
|
|
12
12
|
[CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '4' }), CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '2' })],
|
|
13
|
-
[CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' })
|
|
13
|
+
[CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' })],
|
|
14
14
|
InsuranceStatus.ELIGIBLE,
|
|
15
15
|
false,
|
|
16
16
|
],
|
|
@@ -19,7 +19,7 @@ describe('Blackjack', () => {
|
|
|
19
19
|
{
|
|
20
20
|
input: [
|
|
21
21
|
[CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' }), CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '2' })],
|
|
22
|
-
[CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '6' })
|
|
22
|
+
[CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '6' })],
|
|
23
23
|
InsuranceStatus.INELIGIBLE,
|
|
24
24
|
false,
|
|
25
25
|
],
|
|
@@ -28,7 +28,7 @@ describe('Blackjack', () => {
|
|
|
28
28
|
{
|
|
29
29
|
input: [
|
|
30
30
|
[CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' }), CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' })],
|
|
31
|
-
[CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '6' })
|
|
31
|
+
[CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '6' })],
|
|
32
32
|
InsuranceStatus.INELIGIBLE,
|
|
33
33
|
true,
|
|
34
34
|
],
|
|
@@ -37,7 +37,7 @@ describe('Blackjack', () => {
|
|
|
37
37
|
{
|
|
38
38
|
input: [
|
|
39
39
|
[CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' }), CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' })],
|
|
40
|
-
[CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '6' })
|
|
40
|
+
[CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '6' })],
|
|
41
41
|
InsuranceStatus.INELIGIBLE,
|
|
42
42
|
false,
|
|
43
43
|
],
|
|
@@ -46,7 +46,7 @@ describe('Blackjack', () => {
|
|
|
46
46
|
{
|
|
47
47
|
input: [
|
|
48
48
|
[CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '10' }), CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' })],
|
|
49
|
-
[CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '6' })
|
|
49
|
+
[CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '6' })],
|
|
50
50
|
InsuranceStatus.INELIGIBLE,
|
|
51
51
|
false,
|
|
52
52
|
],
|
|
@@ -55,7 +55,7 @@ describe('Blackjack', () => {
|
|
|
55
55
|
{
|
|
56
56
|
input: [
|
|
57
57
|
[CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '3' }), CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' })],
|
|
58
|
-
[CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' })
|
|
58
|
+
[CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' })],
|
|
59
59
|
InsuranceStatus.INELIGIBLE,
|
|
60
60
|
false,
|
|
61
61
|
],
|
|
@@ -68,7 +68,7 @@ describe('Blackjack', () => {
|
|
|
68
68
|
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'J' }),
|
|
69
69
|
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '10' }),
|
|
70
70
|
],
|
|
71
|
-
[CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' })
|
|
71
|
+
[CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' })],
|
|
72
72
|
InsuranceStatus.INELIGIBLE,
|
|
73
73
|
false,
|
|
74
74
|
],
|
|
@@ -81,7 +81,7 @@ describe('Blackjack', () => {
|
|
|
81
81
|
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'J' }),
|
|
82
82
|
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' }),
|
|
83
83
|
],
|
|
84
|
-
[CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' })
|
|
84
|
+
[CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' })],
|
|
85
85
|
InsuranceStatus.INELIGIBLE,
|
|
86
86
|
false,
|
|
87
87
|
],
|
|
@@ -94,7 +94,7 @@ describe('Blackjack', () => {
|
|
|
94
94
|
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '2' }),
|
|
95
95
|
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' }),
|
|
96
96
|
],
|
|
97
|
-
[CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' })
|
|
97
|
+
[CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' })],
|
|
98
98
|
InsuranceStatus.INELIGIBLE,
|
|
99
99
|
false,
|
|
100
100
|
],
|
|
@@ -178,6 +178,7 @@ describe('Blackjack', () => {
|
|
|
178
178
|
[BlackjackAction.SPLIT, BlackjackAction.HIT, BlackjackAction.HIT],
|
|
179
179
|
[BlackjackAction.SPLIT, BlackjackAction.HIT],
|
|
180
180
|
],
|
|
181
|
+
output: true,
|
|
181
182
|
},
|
|
182
183
|
{
|
|
183
184
|
input: [
|
|
@@ -186,6 +187,7 @@ describe('Blackjack', () => {
|
|
|
186
187
|
[BlackjackAction.SPLIT, BlackjackAction.HIT, BlackjackAction.HIT],
|
|
187
188
|
[BlackjackAction.SPLIT, BlackjackAction.DOUBLE_DOWN],
|
|
188
189
|
],
|
|
190
|
+
output: true,
|
|
189
191
|
},
|
|
190
192
|
{
|
|
191
193
|
input: [
|
|
@@ -194,9 +196,11 @@ describe('Blackjack', () => {
|
|
|
194
196
|
[BlackjackAction.SPLIT, BlackjackAction.HIT, BlackjackAction.HIT],
|
|
195
197
|
[BlackjackAction.SPLIT, BlackjackAction.HIT, BlackjackAction.STAND],
|
|
196
198
|
],
|
|
199
|
+
output: true,
|
|
197
200
|
},
|
|
198
201
|
{
|
|
199
202
|
input: [[getIndex('2'), getIndex('5'), getIndex('10'), getIndex('5')], [], [BlackjackAction.HIT, BlackjackAction.HIT], []],
|
|
203
|
+
output: true,
|
|
200
204
|
},
|
|
201
205
|
{
|
|
202
206
|
input: [
|
|
@@ -205,21 +209,12 @@ describe('Blackjack', () => {
|
|
|
205
209
|
[BlackjackAction.SPLIT, BlackjackAction.HIT, BlackjackAction.HIT],
|
|
206
210
|
[BlackjackAction.SPLIT, BlackjackAction.HIT, BlackjackAction.HIT],
|
|
207
211
|
],
|
|
212
|
+
output: true,
|
|
208
213
|
},
|
|
209
214
|
];
|
|
210
215
|
|
|
211
216
|
funcParams.forEach((param) => {
|
|
212
|
-
|
|
213
|
-
const result = Blackjack.playingMainHand(...param.input);
|
|
214
|
-
expect(result).toEqual(param.output);
|
|
215
|
-
} else {
|
|
216
|
-
try {
|
|
217
|
-
Blackjack.playingMainHand(...param.input);
|
|
218
|
-
expect(true).toEqual(false);
|
|
219
|
-
} catch (error: unknown) {
|
|
220
|
-
expect((error as Error).message).toEqual('No available action');
|
|
221
|
-
}
|
|
222
|
-
}
|
|
217
|
+
expect(Blackjack.playingMainHand(...param.input)).toEqual(param.output);
|
|
223
218
|
});
|
|
224
219
|
|
|
225
220
|
/**
|
|
@@ -232,21 +227,41 @@ describe('Blackjack', () => {
|
|
|
232
227
|
});
|
|
233
228
|
|
|
234
229
|
it('calculate main bet payout correctly, accounting for blackjacks after splitting', () => {
|
|
235
|
-
const funcParams: Array<{ input: [number[], number[], boolean]; output:
|
|
236
|
-
{
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
{
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
{ input: [[getIndex('
|
|
245
|
-
{ input: [[getIndex('
|
|
230
|
+
const funcParams: Array<{ input: [number[], number[], boolean]; output: ReturnType<typeof Blackjack.getHandOutcome> }> = [
|
|
231
|
+
{
|
|
232
|
+
input: [[getIndex('4'), getIndex('5')], [getIndex('A'), getIndex('10')], false],
|
|
233
|
+
output: { multiplier: new BigNumber(2.5), outcome: HandOutcome.BLACKJACK },
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
input: [[getIndex('9'), getIndex('10')], [getIndex('10'), getIndex('A')], false],
|
|
237
|
+
output: { multiplier: new BigNumber(2.5), outcome: HandOutcome.BLACKJACK },
|
|
238
|
+
},
|
|
239
|
+
{ input: [[getIndex('9'), getIndex('10')], [getIndex('10'), getIndex('A')], true], output: { multiplier: new BigNumber(2), outcome: HandOutcome.WIN } },
|
|
240
|
+
{ input: [[getIndex('10'), getIndex('A')], [], false], output: { multiplier: new BigNumber(0), outcome: HandOutcome.LOSS } },
|
|
241
|
+
{ input: [[getIndex('10'), getIndex('A')], [getIndex('J'), getIndex('A')], false], output: { multiplier: new BigNumber(1), outcome: HandOutcome.PUSH } },
|
|
242
|
+
{
|
|
243
|
+
input: [[getIndex('8'), getIndex('A')], [getIndex('J'), getIndex('10'), getIndex('9')], false],
|
|
244
|
+
output: { multiplier: new BigNumber(0), outcome: HandOutcome.LOSS },
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
input: [[getIndex('6'), getIndex('10'), getIndex('9')], [getIndex('J'), getIndex('2'), getIndex('5')], false],
|
|
248
|
+
output: { multiplier: new BigNumber(2), outcome: HandOutcome.WIN },
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
input: [[getIndex('8'), getIndex('10')], [getIndex('J'), getIndex('2'), getIndex('5')], false],
|
|
252
|
+
output: { multiplier: new BigNumber(0), outcome: HandOutcome.LOSS },
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
input: [[getIndex('8'), getIndex('10')], [getIndex('J'), getIndex('3'), getIndex('5')], false],
|
|
256
|
+
output: { multiplier: new BigNumber(1), outcome: HandOutcome.PUSH },
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
input: [[getIndex('8'), getIndex('10')], [getIndex('J'), getIndex('4'), getIndex('5')], false],
|
|
260
|
+
output: { multiplier: new BigNumber(2), outcome: HandOutcome.WIN },
|
|
261
|
+
},
|
|
246
262
|
];
|
|
247
263
|
funcParams.forEach((param) => {
|
|
248
|
-
|
|
249
|
-
expect(result).toEqual(param.output);
|
|
264
|
+
expect(Blackjack.getHandOutcome(...param.input)).toStrictEqual(param.output);
|
|
250
265
|
});
|
|
251
266
|
|
|
252
267
|
/**
|
|
@@ -383,6 +398,99 @@ describe('Blackjack', () => {
|
|
|
383
398
|
*/
|
|
384
399
|
});
|
|
385
400
|
|
|
401
|
+
it('should play the dealer hand correctly', () => {
|
|
402
|
+
const funcParams: Array<{ input: [number[], number, number[]]; output: ReturnType<typeof Blackjack.playDealerHand> }> = [
|
|
403
|
+
{
|
|
404
|
+
input: [
|
|
405
|
+
[CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' }), CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '6' })],
|
|
406
|
+
3,
|
|
407
|
+
[
|
|
408
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' }),
|
|
409
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '6' }),
|
|
410
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '10' }),
|
|
411
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '4' }),
|
|
412
|
+
],
|
|
413
|
+
],
|
|
414
|
+
output: [CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' }), CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '6' })],
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
input: [
|
|
418
|
+
[CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' }), CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' })],
|
|
419
|
+
2,
|
|
420
|
+
[
|
|
421
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' }),
|
|
422
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' }),
|
|
423
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '5' }),
|
|
424
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '4' }),
|
|
425
|
+
],
|
|
426
|
+
],
|
|
427
|
+
output: [
|
|
428
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' }),
|
|
429
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' }),
|
|
430
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '5' }),
|
|
431
|
+
],
|
|
432
|
+
},
|
|
433
|
+
{
|
|
434
|
+
input: [
|
|
435
|
+
[CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '7' }), CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '6' })],
|
|
436
|
+
2,
|
|
437
|
+
[
|
|
438
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' }),
|
|
439
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '6' }),
|
|
440
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' }),
|
|
441
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '4' }),
|
|
442
|
+
],
|
|
443
|
+
],
|
|
444
|
+
output: [
|
|
445
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '7' }),
|
|
446
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '6' }),
|
|
447
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' }),
|
|
448
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '4' }),
|
|
449
|
+
],
|
|
450
|
+
},
|
|
451
|
+
{
|
|
452
|
+
input: [
|
|
453
|
+
[CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '7' }), CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '10' })],
|
|
454
|
+
1,
|
|
455
|
+
[
|
|
456
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' }),
|
|
457
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '6' }),
|
|
458
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' }),
|
|
459
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '4' }),
|
|
460
|
+
],
|
|
461
|
+
],
|
|
462
|
+
output: [CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '7' }), CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '10' })],
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
input: [
|
|
466
|
+
[CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '2' }), CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '2' })],
|
|
467
|
+
1,
|
|
468
|
+
[
|
|
469
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' }),
|
|
470
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '6' }),
|
|
471
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '4' }),
|
|
472
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' }),
|
|
473
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' }),
|
|
474
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' }),
|
|
475
|
+
],
|
|
476
|
+
],
|
|
477
|
+
output: [
|
|
478
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '2' }),
|
|
479
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '2' }),
|
|
480
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '6' }),
|
|
481
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '4' }),
|
|
482
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' }),
|
|
483
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' }),
|
|
484
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' }),
|
|
485
|
+
],
|
|
486
|
+
},
|
|
487
|
+
];
|
|
488
|
+
|
|
489
|
+
funcParams.forEach((param) => {
|
|
490
|
+
expect(Blackjack.playDealerHand(...param.input)).toStrictEqual(param.output);
|
|
491
|
+
});
|
|
492
|
+
});
|
|
493
|
+
|
|
386
494
|
it('can calculate the value of cards', () => {
|
|
387
495
|
const funcParams: Array<{ input: number[]; output: number }> = [
|
|
388
496
|
{ input: [getIndex('10'), getIndex('A')], output: 21 },
|
|
@@ -546,7 +654,7 @@ describe('Blackjack', () => {
|
|
|
546
654
|
});
|
|
547
655
|
|
|
548
656
|
it('can calculate the total payout correctly', () => {
|
|
549
|
-
const funcParams: Array<{ input: SettleBetVars; output:
|
|
657
|
+
const funcParams: Array<{ input: SettleBetVars; output: ReturnType<typeof Blackjack.getGameOutcome> }> = [
|
|
550
658
|
// Without sidebets
|
|
551
659
|
// blackjack win
|
|
552
660
|
{
|
|
@@ -554,14 +662,15 @@ describe('Blackjack', () => {
|
|
|
554
662
|
mainPlayerHand: [getIndex('A'), getIndex('10')],
|
|
555
663
|
splitPlayerHand: [],
|
|
556
664
|
dealerHand: [getIndex('10'), getIndex('10')],
|
|
557
|
-
|
|
558
|
-
splitHandBetAmount: new BigNumber(0),
|
|
665
|
+
mainBetAmount: new BigNumber(10),
|
|
559
666
|
twentyOnePlusThreeAmount: new BigNumber(0),
|
|
560
667
|
perfectPairAmount: new BigNumber(0),
|
|
561
668
|
boughtInsurance: false,
|
|
562
669
|
hasSplit: false,
|
|
670
|
+
mainHandDoubleDown: false,
|
|
671
|
+
splitHandDoubleDown: false,
|
|
563
672
|
},
|
|
564
|
-
output: new BigNumber(25),
|
|
673
|
+
output: { payout: new BigNumber(25), multiplier: new BigNumber(2.5), mainHandOutcome: HandOutcome.BLACKJACK, splitHandOutcome: HandOutcome.NONE },
|
|
565
674
|
},
|
|
566
675
|
// blackjack push
|
|
567
676
|
{
|
|
@@ -569,14 +678,15 @@ describe('Blackjack', () => {
|
|
|
569
678
|
mainPlayerHand: [getIndex('A'), getIndex('10')],
|
|
570
679
|
splitPlayerHand: [],
|
|
571
680
|
dealerHand: [getIndex('10'), getIndex('A')],
|
|
572
|
-
|
|
573
|
-
splitHandBetAmount: new BigNumber(0),
|
|
681
|
+
mainBetAmount: new BigNumber(10),
|
|
574
682
|
twentyOnePlusThreeAmount: new BigNumber(0),
|
|
575
683
|
perfectPairAmount: new BigNumber(0),
|
|
576
684
|
boughtInsurance: false,
|
|
577
685
|
hasSplit: false,
|
|
686
|
+
mainHandDoubleDown: false,
|
|
687
|
+
splitHandDoubleDown: false,
|
|
578
688
|
},
|
|
579
|
-
output: new BigNumber(10),
|
|
689
|
+
output: { payout: new BigNumber(10), multiplier: new BigNumber(1), mainHandOutcome: HandOutcome.PUSH, splitHandOutcome: HandOutcome.NONE },
|
|
580
690
|
},
|
|
581
691
|
// blackjack lose
|
|
582
692
|
{
|
|
@@ -584,14 +694,15 @@ describe('Blackjack', () => {
|
|
|
584
694
|
mainPlayerHand: [getIndex('A'), getIndex('6')],
|
|
585
695
|
splitPlayerHand: [],
|
|
586
696
|
dealerHand: [getIndex('10'), getIndex('A')],
|
|
587
|
-
|
|
588
|
-
splitHandBetAmount: new BigNumber(0),
|
|
697
|
+
mainBetAmount: new BigNumber(10),
|
|
589
698
|
twentyOnePlusThreeAmount: new BigNumber(0),
|
|
590
699
|
perfectPairAmount: new BigNumber(0),
|
|
591
700
|
boughtInsurance: false,
|
|
592
701
|
hasSplit: false,
|
|
702
|
+
mainHandDoubleDown: false,
|
|
703
|
+
splitHandDoubleDown: false,
|
|
593
704
|
},
|
|
594
|
-
output: new BigNumber(0),
|
|
705
|
+
output: { payout: new BigNumber(0), multiplier: new BigNumber(0), mainHandOutcome: HandOutcome.LOSS, splitHandOutcome: HandOutcome.NONE },
|
|
595
706
|
},
|
|
596
707
|
// no blackjack win
|
|
597
708
|
{
|
|
@@ -599,28 +710,30 @@ describe('Blackjack', () => {
|
|
|
599
710
|
mainPlayerHand: [getIndex('A'), getIndex('6'), getIndex('4')],
|
|
600
711
|
splitPlayerHand: [],
|
|
601
712
|
dealerHand: [getIndex('10'), getIndex('4')],
|
|
602
|
-
|
|
603
|
-
splitHandBetAmount: new BigNumber(0),
|
|
713
|
+
mainBetAmount: new BigNumber(10),
|
|
604
714
|
twentyOnePlusThreeAmount: new BigNumber(0),
|
|
605
715
|
perfectPairAmount: new BigNumber(0),
|
|
606
716
|
boughtInsurance: false,
|
|
607
717
|
hasSplit: false,
|
|
718
|
+
mainHandDoubleDown: false,
|
|
719
|
+
splitHandDoubleDown: false,
|
|
608
720
|
},
|
|
609
|
-
output: new BigNumber(20),
|
|
721
|
+
output: { payout: new BigNumber(20), multiplier: new BigNumber(2), mainHandOutcome: HandOutcome.WIN, splitHandOutcome: HandOutcome.NONE },
|
|
610
722
|
},
|
|
611
723
|
{
|
|
612
724
|
input: {
|
|
613
725
|
mainPlayerHand: [getIndex('A'), getIndex('6'), getIndex('4')],
|
|
614
726
|
splitPlayerHand: [],
|
|
615
727
|
dealerHand: [getIndex('10'), getIndex('4'), getIndex('10')],
|
|
616
|
-
|
|
617
|
-
splitHandBetAmount: new BigNumber(0),
|
|
728
|
+
mainBetAmount: new BigNumber(10),
|
|
618
729
|
twentyOnePlusThreeAmount: new BigNumber(0),
|
|
619
730
|
perfectPairAmount: new BigNumber(0),
|
|
620
731
|
boughtInsurance: false,
|
|
621
732
|
hasSplit: false,
|
|
733
|
+
mainHandDoubleDown: false,
|
|
734
|
+
splitHandDoubleDown: false,
|
|
622
735
|
},
|
|
623
|
-
output: new BigNumber(20),
|
|
736
|
+
output: { payout: new BigNumber(20), multiplier: new BigNumber(2), mainHandOutcome: HandOutcome.WIN, splitHandOutcome: HandOutcome.NONE },
|
|
624
737
|
},
|
|
625
738
|
// no blackjack push
|
|
626
739
|
{
|
|
@@ -628,28 +741,30 @@ describe('Blackjack', () => {
|
|
|
628
741
|
mainPlayerHand: [getIndex('A'), getIndex('6')],
|
|
629
742
|
splitPlayerHand: [],
|
|
630
743
|
dealerHand: [getIndex('10'), getIndex('4'), getIndex('3')],
|
|
631
|
-
|
|
632
|
-
splitHandBetAmount: new BigNumber(0),
|
|
744
|
+
mainBetAmount: new BigNumber(10),
|
|
633
745
|
twentyOnePlusThreeAmount: new BigNumber(0),
|
|
634
746
|
perfectPairAmount: new BigNumber(0),
|
|
635
747
|
boughtInsurance: false,
|
|
636
748
|
hasSplit: false,
|
|
749
|
+
mainHandDoubleDown: false,
|
|
750
|
+
splitHandDoubleDown: false,
|
|
637
751
|
},
|
|
638
|
-
output: new BigNumber(10),
|
|
752
|
+
output: { payout: new BigNumber(10), multiplier: new BigNumber(1), mainHandOutcome: HandOutcome.PUSH, splitHandOutcome: HandOutcome.NONE },
|
|
639
753
|
},
|
|
640
754
|
{
|
|
641
755
|
input: {
|
|
642
756
|
mainPlayerHand: [getIndex('10'), getIndex('6'), getIndex('4')],
|
|
643
757
|
splitPlayerHand: [],
|
|
644
758
|
dealerHand: [getIndex('10'), getIndex('4'), getIndex('6')],
|
|
645
|
-
|
|
646
|
-
splitHandBetAmount: new BigNumber(0),
|
|
759
|
+
mainBetAmount: new BigNumber(10),
|
|
647
760
|
twentyOnePlusThreeAmount: new BigNumber(0),
|
|
648
761
|
perfectPairAmount: new BigNumber(0),
|
|
649
762
|
boughtInsurance: false,
|
|
650
763
|
hasSplit: false,
|
|
764
|
+
mainHandDoubleDown: false,
|
|
765
|
+
splitHandDoubleDown: false,
|
|
651
766
|
},
|
|
652
|
-
output: new BigNumber(10),
|
|
767
|
+
output: { payout: new BigNumber(10), multiplier: new BigNumber(1), mainHandOutcome: HandOutcome.PUSH, splitHandOutcome: HandOutcome.NONE },
|
|
653
768
|
},
|
|
654
769
|
// no blackjack lose
|
|
655
770
|
{
|
|
@@ -657,28 +772,30 @@ describe('Blackjack', () => {
|
|
|
657
772
|
mainPlayerHand: [getIndex('A'), getIndex('6')],
|
|
658
773
|
splitPlayerHand: [],
|
|
659
774
|
dealerHand: [getIndex('10'), getIndex('J')],
|
|
660
|
-
|
|
661
|
-
splitHandBetAmount: new BigNumber(0),
|
|
775
|
+
mainBetAmount: new BigNumber(10),
|
|
662
776
|
twentyOnePlusThreeAmount: new BigNumber(0),
|
|
663
777
|
perfectPairAmount: new BigNumber(0),
|
|
664
778
|
boughtInsurance: false,
|
|
665
779
|
hasSplit: false,
|
|
780
|
+
mainHandDoubleDown: false,
|
|
781
|
+
splitHandDoubleDown: false,
|
|
666
782
|
},
|
|
667
|
-
output: new BigNumber(0),
|
|
783
|
+
output: { payout: new BigNumber(0), multiplier: new BigNumber(0), mainHandOutcome: HandOutcome.LOSS, splitHandOutcome: HandOutcome.NONE },
|
|
668
784
|
},
|
|
669
785
|
{
|
|
670
786
|
input: {
|
|
671
787
|
mainPlayerHand: [getIndex('J'), getIndex('6'), getIndex('9')],
|
|
672
788
|
splitPlayerHand: [],
|
|
673
789
|
dealerHand: [getIndex('10'), getIndex('J')],
|
|
674
|
-
|
|
675
|
-
splitHandBetAmount: new BigNumber(0),
|
|
790
|
+
mainBetAmount: new BigNumber(10),
|
|
676
791
|
twentyOnePlusThreeAmount: new BigNumber(0),
|
|
677
792
|
perfectPairAmount: new BigNumber(0),
|
|
678
793
|
boughtInsurance: false,
|
|
679
794
|
hasSplit: false,
|
|
795
|
+
mainHandDoubleDown: false,
|
|
796
|
+
splitHandDoubleDown: false,
|
|
680
797
|
},
|
|
681
|
-
output: new BigNumber(0),
|
|
798
|
+
output: { payout: new BigNumber(0), multiplier: new BigNumber(0), mainHandOutcome: HandOutcome.LOSS, splitHandOutcome: HandOutcome.NONE },
|
|
682
799
|
},
|
|
683
800
|
|
|
684
801
|
{
|
|
@@ -689,14 +806,20 @@ describe('Blackjack', () => {
|
|
|
689
806
|
],
|
|
690
807
|
splitPlayerHand: [],
|
|
691
808
|
dealerHand: [CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '10' }), getIndex('7')],
|
|
692
|
-
|
|
693
|
-
splitHandBetAmount: new BigNumber(0),
|
|
809
|
+
mainBetAmount: new BigNumber(10),
|
|
694
810
|
twentyOnePlusThreeAmount: new BigNumber(10),
|
|
695
811
|
perfectPairAmount: new BigNumber(20),
|
|
696
812
|
boughtInsurance: false,
|
|
697
813
|
hasSplit: false,
|
|
814
|
+
mainHandDoubleDown: false,
|
|
815
|
+
splitHandDoubleDown: false,
|
|
816
|
+
},
|
|
817
|
+
output: {
|
|
818
|
+
payout: new BigNumber(1550),
|
|
819
|
+
multiplier: new BigNumber(1550).dividedBy(40),
|
|
820
|
+
mainHandOutcome: HandOutcome.WIN,
|
|
821
|
+
splitHandOutcome: HandOutcome.NONE,
|
|
698
822
|
},
|
|
699
|
-
output: new BigNumber(1550), // 10 * 101 + 20 * 26 + 2 * 10
|
|
700
823
|
},
|
|
701
824
|
{
|
|
702
825
|
input: {
|
|
@@ -706,14 +829,20 @@ describe('Blackjack', () => {
|
|
|
706
829
|
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '10' }),
|
|
707
830
|
CardGames.getCardIndexFromDetails({ suit: Suits.HEARTS, value: '10' }),
|
|
708
831
|
],
|
|
709
|
-
|
|
710
|
-
splitHandBetAmount: new BigNumber(0),
|
|
832
|
+
mainBetAmount: new BigNumber(10),
|
|
711
833
|
twentyOnePlusThreeAmount: new BigNumber(0),
|
|
712
834
|
perfectPairAmount: new BigNumber(10),
|
|
713
835
|
boughtInsurance: false,
|
|
714
836
|
hasSplit: false,
|
|
837
|
+
mainHandDoubleDown: false,
|
|
838
|
+
splitHandDoubleDown: false,
|
|
839
|
+
},
|
|
840
|
+
output: {
|
|
841
|
+
payout: new BigNumber(25),
|
|
842
|
+
multiplier: new BigNumber(25).dividedBy(20),
|
|
843
|
+
mainHandOutcome: HandOutcome.BLACKJACK,
|
|
844
|
+
splitHandOutcome: HandOutcome.NONE,
|
|
715
845
|
},
|
|
716
|
-
output: new BigNumber(25),
|
|
717
846
|
},
|
|
718
847
|
{
|
|
719
848
|
input: {
|
|
@@ -723,14 +852,20 @@ describe('Blackjack', () => {
|
|
|
723
852
|
],
|
|
724
853
|
splitPlayerHand: [],
|
|
725
854
|
dealerHand: [CardGames.getCardIndexFromDetails({ suit: Suits.HEARTS, value: 'J' }), getIndex('A')],
|
|
726
|
-
|
|
727
|
-
splitHandBetAmount: new BigNumber(0),
|
|
855
|
+
mainBetAmount: new BigNumber(10),
|
|
728
856
|
twentyOnePlusThreeAmount: new BigNumber(10),
|
|
729
857
|
perfectPairAmount: new BigNumber(0),
|
|
730
858
|
boughtInsurance: false,
|
|
731
859
|
hasSplit: false,
|
|
860
|
+
mainHandDoubleDown: false,
|
|
861
|
+
splitHandDoubleDown: false,
|
|
862
|
+
},
|
|
863
|
+
output: {
|
|
864
|
+
payout: new BigNumber(60),
|
|
865
|
+
multiplier: new BigNumber(60).dividedBy(20),
|
|
866
|
+
mainHandOutcome: HandOutcome.LOSS,
|
|
867
|
+
splitHandOutcome: HandOutcome.NONE,
|
|
732
868
|
},
|
|
733
|
-
output: new BigNumber(60),
|
|
734
869
|
},
|
|
735
870
|
|
|
736
871
|
// With insurance
|
|
@@ -739,14 +874,20 @@ describe('Blackjack', () => {
|
|
|
739
874
|
mainPlayerHand: [getIndex('A'), getIndex('10')],
|
|
740
875
|
splitPlayerHand: [],
|
|
741
876
|
dealerHand: [getIndex('A'), getIndex('3')],
|
|
742
|
-
|
|
743
|
-
splitHandBetAmount: new BigNumber(0),
|
|
877
|
+
mainBetAmount: new BigNumber(10),
|
|
744
878
|
twentyOnePlusThreeAmount: new BigNumber(0),
|
|
745
879
|
perfectPairAmount: new BigNumber(0),
|
|
746
880
|
boughtInsurance: true,
|
|
747
881
|
hasSplit: false,
|
|
882
|
+
mainHandDoubleDown: false,
|
|
883
|
+
splitHandDoubleDown: false,
|
|
884
|
+
},
|
|
885
|
+
output: {
|
|
886
|
+
payout: new BigNumber(25),
|
|
887
|
+
multiplier: new BigNumber(25).dividedBy(15),
|
|
888
|
+
mainHandOutcome: HandOutcome.BLACKJACK,
|
|
889
|
+
splitHandOutcome: HandOutcome.NONE,
|
|
748
890
|
},
|
|
749
|
-
output: new BigNumber(25),
|
|
750
891
|
},
|
|
751
892
|
// blackjack push
|
|
752
893
|
{
|
|
@@ -754,14 +895,20 @@ describe('Blackjack', () => {
|
|
|
754
895
|
mainPlayerHand: [getIndex('A'), getIndex('10')],
|
|
755
896
|
splitPlayerHand: [],
|
|
756
897
|
dealerHand: [getIndex('A'), getIndex('K')],
|
|
757
|
-
|
|
758
|
-
splitHandBetAmount: new BigNumber(0),
|
|
898
|
+
mainBetAmount: new BigNumber(10),
|
|
759
899
|
twentyOnePlusThreeAmount: new BigNumber(0),
|
|
760
900
|
perfectPairAmount: new BigNumber(0),
|
|
761
901
|
boughtInsurance: true,
|
|
762
902
|
hasSplit: false,
|
|
903
|
+
mainHandDoubleDown: false,
|
|
904
|
+
splitHandDoubleDown: false,
|
|
905
|
+
},
|
|
906
|
+
output: {
|
|
907
|
+
payout: new BigNumber(25),
|
|
908
|
+
multiplier: new BigNumber(25).dividedBy(15),
|
|
909
|
+
mainHandOutcome: HandOutcome.PUSH,
|
|
910
|
+
splitHandOutcome: HandOutcome.NONE,
|
|
763
911
|
},
|
|
764
|
-
output: new BigNumber(25),
|
|
765
912
|
},
|
|
766
913
|
// blackjack lose
|
|
767
914
|
{
|
|
@@ -769,14 +916,15 @@ describe('Blackjack', () => {
|
|
|
769
916
|
mainPlayerHand: [getIndex('A'), getIndex('6')],
|
|
770
917
|
splitPlayerHand: [],
|
|
771
918
|
dealerHand: [getIndex('A'), getIndex('J')],
|
|
772
|
-
|
|
773
|
-
splitHandBetAmount: new BigNumber(0),
|
|
919
|
+
mainBetAmount: new BigNumber(10),
|
|
774
920
|
twentyOnePlusThreeAmount: new BigNumber(0),
|
|
775
921
|
perfectPairAmount: new BigNumber(0),
|
|
776
922
|
boughtInsurance: false,
|
|
777
923
|
hasSplit: false,
|
|
924
|
+
mainHandDoubleDown: false,
|
|
925
|
+
splitHandDoubleDown: false,
|
|
778
926
|
},
|
|
779
|
-
output: new BigNumber(0),
|
|
927
|
+
output: { payout: new BigNumber(0), multiplier: new BigNumber(0), mainHandOutcome: HandOutcome.LOSS, splitHandOutcome: HandOutcome.NONE },
|
|
780
928
|
},
|
|
781
929
|
|
|
782
930
|
// With insurance and sidebets
|
|
@@ -788,14 +936,15 @@ describe('Blackjack', () => {
|
|
|
788
936
|
],
|
|
789
937
|
splitPlayerHand: [],
|
|
790
938
|
dealerHand: [getIndex('A'), getIndex('J')],
|
|
791
|
-
|
|
792
|
-
splitHandBetAmount: new BigNumber(0),
|
|
939
|
+
mainBetAmount: new BigNumber(10),
|
|
793
940
|
twentyOnePlusThreeAmount: new BigNumber(0),
|
|
794
941
|
perfectPairAmount: new BigNumber(0),
|
|
795
942
|
boughtInsurance: true,
|
|
796
943
|
hasSplit: false,
|
|
944
|
+
mainHandDoubleDown: false,
|
|
945
|
+
splitHandDoubleDown: false,
|
|
797
946
|
},
|
|
798
|
-
output: new BigNumber(15),
|
|
947
|
+
output: { payout: new BigNumber(15), multiplier: new BigNumber(1), mainHandOutcome: HandOutcome.LOSS, splitHandOutcome: HandOutcome.NONE },
|
|
799
948
|
},
|
|
800
949
|
{
|
|
801
950
|
input: {
|
|
@@ -805,14 +954,20 @@ describe('Blackjack', () => {
|
|
|
805
954
|
],
|
|
806
955
|
splitPlayerHand: [],
|
|
807
956
|
dealerHand: [getIndex('A'), getIndex('9')],
|
|
808
|
-
|
|
809
|
-
splitHandBetAmount: new BigNumber(0),
|
|
957
|
+
mainBetAmount: new BigNumber(10),
|
|
810
958
|
twentyOnePlusThreeAmount: new BigNumber(0),
|
|
811
959
|
perfectPairAmount: new BigNumber(0),
|
|
812
960
|
boughtInsurance: true,
|
|
813
961
|
hasSplit: false,
|
|
962
|
+
mainHandDoubleDown: false,
|
|
963
|
+
splitHandDoubleDown: false,
|
|
964
|
+
},
|
|
965
|
+
output: {
|
|
966
|
+
payout: new BigNumber(10),
|
|
967
|
+
multiplier: new BigNumber(10).dividedBy(15),
|
|
968
|
+
mainHandOutcome: HandOutcome.PUSH,
|
|
969
|
+
splitHandOutcome: HandOutcome.NONE,
|
|
814
970
|
},
|
|
815
|
-
output: new BigNumber(10),
|
|
816
971
|
},
|
|
817
972
|
|
|
818
973
|
// Split bets without sidebets or insurance
|
|
@@ -828,14 +983,15 @@ describe('Blackjack', () => {
|
|
|
828
983
|
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '7' }),
|
|
829
984
|
],
|
|
830
985
|
dealerHand: [getIndex('6'), getIndex('10')],
|
|
831
|
-
|
|
832
|
-
splitHandBetAmount: new BigNumber(10),
|
|
986
|
+
mainBetAmount: new BigNumber(10),
|
|
833
987
|
twentyOnePlusThreeAmount: new BigNumber(0),
|
|
834
988
|
perfectPairAmount: new BigNumber(0),
|
|
835
989
|
boughtInsurance: false,
|
|
836
990
|
hasSplit: true,
|
|
991
|
+
mainHandDoubleDown: false,
|
|
992
|
+
splitHandDoubleDown: false,
|
|
837
993
|
},
|
|
838
|
-
output: new BigNumber(40),
|
|
994
|
+
output: { payout: new BigNumber(40), multiplier: new BigNumber(2), mainHandOutcome: HandOutcome.WIN, splitHandOutcome: HandOutcome.WIN },
|
|
839
995
|
},
|
|
840
996
|
// Split 1 win 1 push
|
|
841
997
|
{
|
|
@@ -849,14 +1005,15 @@ describe('Blackjack', () => {
|
|
|
849
1005
|
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '8' }),
|
|
850
1006
|
],
|
|
851
1007
|
dealerHand: [getIndex('8'), getIndex('10')],
|
|
852
|
-
|
|
853
|
-
splitHandBetAmount: new BigNumber(10),
|
|
1008
|
+
mainBetAmount: new BigNumber(10),
|
|
854
1009
|
twentyOnePlusThreeAmount: new BigNumber(0),
|
|
855
1010
|
perfectPairAmount: new BigNumber(0),
|
|
856
1011
|
boughtInsurance: false,
|
|
857
1012
|
hasSplit: true,
|
|
1013
|
+
mainHandDoubleDown: false,
|
|
1014
|
+
splitHandDoubleDown: false,
|
|
858
1015
|
},
|
|
859
|
-
output: new BigNumber(30),
|
|
1016
|
+
output: { payout: new BigNumber(30), multiplier: new BigNumber(1.5), mainHandOutcome: HandOutcome.WIN, splitHandOutcome: HandOutcome.PUSH },
|
|
860
1017
|
},
|
|
861
1018
|
// Split 1 win 1 lose
|
|
862
1019
|
{
|
|
@@ -870,14 +1027,15 @@ describe('Blackjack', () => {
|
|
|
870
1027
|
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '5' }),
|
|
871
1028
|
],
|
|
872
1029
|
dealerHand: [getIndex('8'), getIndex('10')],
|
|
873
|
-
|
|
874
|
-
splitHandBetAmount: new BigNumber(10),
|
|
1030
|
+
mainBetAmount: new BigNumber(10),
|
|
875
1031
|
twentyOnePlusThreeAmount: new BigNumber(0),
|
|
876
1032
|
perfectPairAmount: new BigNumber(0),
|
|
877
1033
|
boughtInsurance: false,
|
|
878
1034
|
hasSplit: true,
|
|
1035
|
+
mainHandDoubleDown: false,
|
|
1036
|
+
splitHandDoubleDown: false,
|
|
879
1037
|
},
|
|
880
|
-
output: new BigNumber(20),
|
|
1038
|
+
output: { payout: new BigNumber(20), multiplier: new BigNumber(1), mainHandOutcome: HandOutcome.WIN, splitHandOutcome: HandOutcome.LOSS },
|
|
881
1039
|
},
|
|
882
1040
|
// Split 2 push
|
|
883
1041
|
{
|
|
@@ -891,14 +1049,15 @@ describe('Blackjack', () => {
|
|
|
891
1049
|
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '10' }),
|
|
892
1050
|
],
|
|
893
1051
|
dealerHand: [getIndex('10'), getIndex('10')],
|
|
894
|
-
|
|
895
|
-
splitHandBetAmount: new BigNumber(10),
|
|
1052
|
+
mainBetAmount: new BigNumber(10),
|
|
896
1053
|
twentyOnePlusThreeAmount: new BigNumber(0),
|
|
897
1054
|
perfectPairAmount: new BigNumber(0),
|
|
898
1055
|
boughtInsurance: false,
|
|
899
1056
|
hasSplit: true,
|
|
1057
|
+
mainHandDoubleDown: false,
|
|
1058
|
+
splitHandDoubleDown: false,
|
|
900
1059
|
},
|
|
901
|
-
output: new BigNumber(20),
|
|
1060
|
+
output: { payout: new BigNumber(20), multiplier: new BigNumber(1), mainHandOutcome: HandOutcome.PUSH, splitHandOutcome: HandOutcome.PUSH },
|
|
902
1061
|
},
|
|
903
1062
|
// Split 1 push 1 lose
|
|
904
1063
|
{
|
|
@@ -912,14 +1071,15 @@ describe('Blackjack', () => {
|
|
|
912
1071
|
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '5' }),
|
|
913
1072
|
],
|
|
914
1073
|
dealerHand: [getIndex('10'), getIndex('7')],
|
|
915
|
-
|
|
916
|
-
splitHandBetAmount: new BigNumber(10),
|
|
1074
|
+
mainBetAmount: new BigNumber(10),
|
|
917
1075
|
twentyOnePlusThreeAmount: new BigNumber(0),
|
|
918
1076
|
perfectPairAmount: new BigNumber(0),
|
|
919
1077
|
boughtInsurance: false,
|
|
920
1078
|
hasSplit: true,
|
|
1079
|
+
mainHandDoubleDown: false,
|
|
1080
|
+
splitHandDoubleDown: false,
|
|
921
1081
|
},
|
|
922
|
-
output: new BigNumber(10),
|
|
1082
|
+
output: { payout: new BigNumber(10), multiplier: new BigNumber(0.5), mainHandOutcome: HandOutcome.PUSH, splitHandOutcome: HandOutcome.LOSS },
|
|
923
1083
|
},
|
|
924
1084
|
// Split 2 lose
|
|
925
1085
|
{
|
|
@@ -933,14 +1093,15 @@ describe('Blackjack', () => {
|
|
|
933
1093
|
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '8' }),
|
|
934
1094
|
],
|
|
935
1095
|
dealerHand: [getIndex('10'), getIndex('10')],
|
|
936
|
-
|
|
937
|
-
splitHandBetAmount: new BigNumber(10),
|
|
1096
|
+
mainBetAmount: new BigNumber(10),
|
|
938
1097
|
twentyOnePlusThreeAmount: new BigNumber(0),
|
|
939
1098
|
perfectPairAmount: new BigNumber(0),
|
|
940
1099
|
boughtInsurance: false,
|
|
941
1100
|
hasSplit: true,
|
|
1101
|
+
mainHandDoubleDown: false,
|
|
1102
|
+
splitHandDoubleDown: false,
|
|
942
1103
|
},
|
|
943
|
-
output: new BigNumber(0),
|
|
1104
|
+
output: { payout: new BigNumber(0), multiplier: new BigNumber(0), mainHandOutcome: HandOutcome.LOSS, splitHandOutcome: HandOutcome.LOSS },
|
|
944
1105
|
},
|
|
945
1106
|
|
|
946
1107
|
// Split blackjacks
|
|
@@ -955,14 +1116,15 @@ describe('Blackjack', () => {
|
|
|
955
1116
|
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' }),
|
|
956
1117
|
],
|
|
957
1118
|
dealerHand: [getIndex('10'), getIndex('10')],
|
|
958
|
-
|
|
959
|
-
splitHandBetAmount: new BigNumber(10),
|
|
1119
|
+
mainBetAmount: new BigNumber(10),
|
|
960
1120
|
twentyOnePlusThreeAmount: new BigNumber(0),
|
|
961
1121
|
perfectPairAmount: new BigNumber(0),
|
|
962
1122
|
boughtInsurance: false,
|
|
963
1123
|
hasSplit: true,
|
|
1124
|
+
mainHandDoubleDown: false,
|
|
1125
|
+
splitHandDoubleDown: false,
|
|
964
1126
|
},
|
|
965
|
-
output: new BigNumber(40),
|
|
1127
|
+
output: { payout: new BigNumber(40), multiplier: new BigNumber(2), mainHandOutcome: HandOutcome.WIN, splitHandOutcome: HandOutcome.WIN },
|
|
966
1128
|
},
|
|
967
1129
|
|
|
968
1130
|
// Split Aces
|
|
@@ -977,14 +1139,15 @@ describe('Blackjack', () => {
|
|
|
977
1139
|
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: '10' }),
|
|
978
1140
|
],
|
|
979
1141
|
dealerHand: [getIndex('10'), getIndex('10')],
|
|
980
|
-
|
|
981
|
-
splitHandBetAmount: new BigNumber(10),
|
|
1142
|
+
mainBetAmount: new BigNumber(10),
|
|
982
1143
|
twentyOnePlusThreeAmount: new BigNumber(0),
|
|
983
1144
|
perfectPairAmount: new BigNumber(0),
|
|
984
1145
|
boughtInsurance: false,
|
|
985
1146
|
hasSplit: true,
|
|
1147
|
+
mainHandDoubleDown: false,
|
|
1148
|
+
splitHandDoubleDown: false,
|
|
986
1149
|
},
|
|
987
|
-
output: new BigNumber(20),
|
|
1150
|
+
output: { payout: new BigNumber(20), multiplier: new BigNumber(1), mainHandOutcome: HandOutcome.LOSS, splitHandOutcome: HandOutcome.WIN },
|
|
988
1151
|
},
|
|
989
1152
|
|
|
990
1153
|
// Split bets with double down and sidebets and insurance
|
|
@@ -1003,14 +1166,22 @@ describe('Blackjack', () => {
|
|
|
1003
1166
|
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' }),
|
|
1004
1167
|
CardGames.getCardIndexFromDetails({ suit: Suits.DIAMONDS, value: '7' }),
|
|
1005
1168
|
],
|
|
1006
|
-
|
|
1007
|
-
splitHandBetAmount: new BigNumber(10),
|
|
1169
|
+
mainBetAmount: new BigNumber(10),
|
|
1008
1170
|
twentyOnePlusThreeAmount: new BigNumber(10),
|
|
1009
1171
|
perfectPairAmount: new BigNumber(10),
|
|
1010
1172
|
boughtInsurance: true,
|
|
1011
1173
|
hasSplit: true,
|
|
1174
|
+
mainHandDoubleDown: true,
|
|
1175
|
+
splitHandDoubleDown: false,
|
|
1012
1176
|
},
|
|
1013
|
-
|
|
1177
|
+
// total bet amount: 20 (main hand doubled) + 10 (split hand) + 5 (insurance) + 10 (21+3) + 10 (perfect pair)
|
|
1178
|
+
output: {
|
|
1179
|
+
payout: new BigNumber(380),
|
|
1180
|
+
multiplier: new BigNumber(380).dividedBy(55),
|
|
1181
|
+
mainHandOutcome: HandOutcome.WIN,
|
|
1182
|
+
splitHandOutcome: HandOutcome.WIN,
|
|
1183
|
+
},
|
|
1184
|
+
// win main (40) + win split (20) + perfect pair (10*26) + flush (10*6)
|
|
1014
1185
|
},
|
|
1015
1186
|
{
|
|
1016
1187
|
input: {
|
|
@@ -1027,19 +1198,278 @@ describe('Blackjack', () => {
|
|
|
1027
1198
|
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' }),
|
|
1028
1199
|
CardGames.getCardIndexFromDetails({ suit: Suits.DIAMONDS, value: '9' }),
|
|
1029
1200
|
],
|
|
1030
|
-
|
|
1031
|
-
splitHandBetAmount: new BigNumber(20),
|
|
1201
|
+
mainBetAmount: new BigNumber(10),
|
|
1032
1202
|
twentyOnePlusThreeAmount: new BigNumber(10),
|
|
1033
1203
|
perfectPairAmount: new BigNumber(10),
|
|
1034
1204
|
boughtInsurance: true,
|
|
1035
1205
|
hasSplit: true,
|
|
1206
|
+
mainHandDoubleDown: false,
|
|
1207
|
+
splitHandDoubleDown: true,
|
|
1208
|
+
},
|
|
1209
|
+
// total bet amount: 20 (main hand doubled) + 10 (split hand) + 5 (insurance) + 10 (21+3) + 10 (perfect pair)
|
|
1210
|
+
output: {
|
|
1211
|
+
payout: new BigNumber(90),
|
|
1212
|
+
multiplier: new BigNumber(90).dividedBy(55),
|
|
1213
|
+
mainHandOutcome: HandOutcome.LOSS,
|
|
1214
|
+
splitHandOutcome: HandOutcome.PUSH,
|
|
1215
|
+
}, // push split (20) + mixed pair (7*10)
|
|
1216
|
+
},
|
|
1217
|
+
// double down on main bet only,
|
|
1218
|
+
{
|
|
1219
|
+
input: {
|
|
1220
|
+
mainPlayerHand: [
|
|
1221
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.DIAMONDS, value: '10' }),
|
|
1222
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.SPADES, value: '4' }),
|
|
1223
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.SPADES, value: '4' }),
|
|
1224
|
+
],
|
|
1225
|
+
splitPlayerHand: [],
|
|
1226
|
+
dealerHand: [
|
|
1227
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' }),
|
|
1228
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.DIAMONDS, value: '9' }),
|
|
1229
|
+
],
|
|
1230
|
+
mainBetAmount: new BigNumber(10),
|
|
1231
|
+
twentyOnePlusThreeAmount: new BigNumber(0),
|
|
1232
|
+
perfectPairAmount: new BigNumber(0),
|
|
1233
|
+
boughtInsurance: false,
|
|
1234
|
+
hasSplit: false,
|
|
1235
|
+
mainHandDoubleDown: true,
|
|
1236
|
+
splitHandDoubleDown: false,
|
|
1237
|
+
},
|
|
1238
|
+
output: { payout: new BigNumber(0), multiplier: new BigNumber(0), mainHandOutcome: HandOutcome.LOSS, splitHandOutcome: HandOutcome.NONE },
|
|
1239
|
+
},
|
|
1240
|
+
{
|
|
1241
|
+
input: {
|
|
1242
|
+
mainPlayerHand: [
|
|
1243
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.DIAMONDS, value: '10' }),
|
|
1244
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.SPADES, value: '4' }),
|
|
1245
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.SPADES, value: '7' }),
|
|
1246
|
+
],
|
|
1247
|
+
splitPlayerHand: [],
|
|
1248
|
+
dealerHand: [
|
|
1249
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' }),
|
|
1250
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.DIAMONDS, value: '9' }),
|
|
1251
|
+
],
|
|
1252
|
+
mainBetAmount: new BigNumber(10),
|
|
1253
|
+
twentyOnePlusThreeAmount: new BigNumber(0),
|
|
1254
|
+
perfectPairAmount: new BigNumber(0),
|
|
1255
|
+
boughtInsurance: false,
|
|
1256
|
+
hasSplit: false,
|
|
1257
|
+
mainHandDoubleDown: true,
|
|
1258
|
+
splitHandDoubleDown: false,
|
|
1259
|
+
},
|
|
1260
|
+
output: { payout: new BigNumber(40), multiplier: new BigNumber(2), mainHandOutcome: HandOutcome.WIN, splitHandOutcome: HandOutcome.NONE },
|
|
1261
|
+
},
|
|
1262
|
+
|
|
1263
|
+
// bets with 0 bet amount, check that they work properly with the multiplier
|
|
1264
|
+
{
|
|
1265
|
+
input: {
|
|
1266
|
+
mainPlayerHand: [
|
|
1267
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.DIAMONDS, value: '10' }),
|
|
1268
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.SPADES, value: '4' }),
|
|
1269
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.SPADES, value: '7' }),
|
|
1270
|
+
],
|
|
1271
|
+
splitPlayerHand: [],
|
|
1272
|
+
dealerHand: [
|
|
1273
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' }),
|
|
1274
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.DIAMONDS, value: '9' }),
|
|
1275
|
+
],
|
|
1276
|
+
mainBetAmount: new BigNumber(0),
|
|
1277
|
+
twentyOnePlusThreeAmount: new BigNumber(0),
|
|
1278
|
+
perfectPairAmount: new BigNumber(0),
|
|
1279
|
+
boughtInsurance: false,
|
|
1280
|
+
hasSplit: false,
|
|
1281
|
+
mainHandDoubleDown: true,
|
|
1282
|
+
splitHandDoubleDown: false,
|
|
1283
|
+
},
|
|
1284
|
+
output: { payout: new BigNumber(0), multiplier: new BigNumber(2), mainHandOutcome: HandOutcome.WIN, splitHandOutcome: HandOutcome.NONE },
|
|
1285
|
+
},
|
|
1286
|
+
{
|
|
1287
|
+
input: {
|
|
1288
|
+
mainPlayerHand: [
|
|
1289
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.DIAMONDS, value: '10' }),
|
|
1290
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.SPADES, value: '4' }),
|
|
1291
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.SPADES, value: '6' }),
|
|
1292
|
+
],
|
|
1293
|
+
splitPlayerHand: [],
|
|
1294
|
+
dealerHand: [
|
|
1295
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' }),
|
|
1296
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.DIAMONDS, value: '9' }),
|
|
1297
|
+
],
|
|
1298
|
+
mainBetAmount: new BigNumber(0),
|
|
1299
|
+
twentyOnePlusThreeAmount: new BigNumber(0),
|
|
1300
|
+
perfectPairAmount: new BigNumber(0),
|
|
1301
|
+
boughtInsurance: false,
|
|
1302
|
+
hasSplit: false,
|
|
1303
|
+
mainHandDoubleDown: true,
|
|
1304
|
+
splitHandDoubleDown: false,
|
|
1305
|
+
},
|
|
1306
|
+
output: { payout: new BigNumber(0), multiplier: new BigNumber(1), mainHandOutcome: HandOutcome.PUSH, splitHandOutcome: HandOutcome.NONE },
|
|
1307
|
+
},
|
|
1308
|
+
{
|
|
1309
|
+
input: {
|
|
1310
|
+
mainPlayerHand: [
|
|
1311
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.DIAMONDS, value: '10' }),
|
|
1312
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.SPADES, value: '4' }),
|
|
1313
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.SPADES, value: '5' }),
|
|
1314
|
+
],
|
|
1315
|
+
splitPlayerHand: [],
|
|
1316
|
+
dealerHand: [
|
|
1317
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' }),
|
|
1318
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.DIAMONDS, value: '9' }),
|
|
1319
|
+
],
|
|
1320
|
+
mainBetAmount: new BigNumber(0),
|
|
1321
|
+
twentyOnePlusThreeAmount: new BigNumber(0),
|
|
1322
|
+
perfectPairAmount: new BigNumber(0),
|
|
1323
|
+
boughtInsurance: false,
|
|
1324
|
+
hasSplit: false,
|
|
1325
|
+
mainHandDoubleDown: true,
|
|
1326
|
+
splitHandDoubleDown: false,
|
|
1327
|
+
},
|
|
1328
|
+
output: { payout: new BigNumber(0), multiplier: new BigNumber(0), mainHandOutcome: HandOutcome.LOSS, splitHandOutcome: HandOutcome.NONE },
|
|
1329
|
+
},
|
|
1330
|
+
|
|
1331
|
+
{
|
|
1332
|
+
input: {
|
|
1333
|
+
mainPlayerHand: [
|
|
1334
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.DIAMONDS, value: '10' }),
|
|
1335
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.SPADES, value: '4' }),
|
|
1336
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.SPADES, value: '7' }),
|
|
1337
|
+
],
|
|
1338
|
+
splitPlayerHand: [
|
|
1339
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.DIAMONDS, value: '10' }),
|
|
1340
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.SPADES, value: '4' }),
|
|
1341
|
+
],
|
|
1342
|
+
dealerHand: [
|
|
1343
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' }),
|
|
1344
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.DIAMONDS, value: '9' }),
|
|
1345
|
+
],
|
|
1346
|
+
mainBetAmount: new BigNumber(0),
|
|
1347
|
+
twentyOnePlusThreeAmount: new BigNumber(0),
|
|
1348
|
+
perfectPairAmount: new BigNumber(0),
|
|
1349
|
+
boughtInsurance: false,
|
|
1350
|
+
hasSplit: true,
|
|
1351
|
+
mainHandDoubleDown: true,
|
|
1352
|
+
splitHandDoubleDown: false,
|
|
1353
|
+
},
|
|
1354
|
+
output: { payout: new BigNumber(0), multiplier: new BigNumber(4).dividedBy(3), mainHandOutcome: HandOutcome.WIN, splitHandOutcome: HandOutcome.LOSS },
|
|
1355
|
+
},
|
|
1356
|
+
{
|
|
1357
|
+
input: {
|
|
1358
|
+
mainPlayerHand: [
|
|
1359
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.DIAMONDS, value: '10' }),
|
|
1360
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.SPADES, value: '4' }),
|
|
1361
|
+
],
|
|
1362
|
+
splitPlayerHand: [
|
|
1363
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.DIAMONDS, value: '10' }),
|
|
1364
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.SPADES, value: 'A' }),
|
|
1365
|
+
],
|
|
1366
|
+
dealerHand: [
|
|
1367
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' }),
|
|
1368
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.DIAMONDS, value: '9' }),
|
|
1369
|
+
],
|
|
1370
|
+
mainBetAmount: new BigNumber(0),
|
|
1371
|
+
twentyOnePlusThreeAmount: new BigNumber(0),
|
|
1372
|
+
perfectPairAmount: new BigNumber(0),
|
|
1373
|
+
boughtInsurance: false,
|
|
1374
|
+
hasSplit: true,
|
|
1375
|
+
mainHandDoubleDown: false,
|
|
1376
|
+
splitHandDoubleDown: true,
|
|
1377
|
+
},
|
|
1378
|
+
output: { payout: new BigNumber(0), multiplier: new BigNumber(4).dividedBy(3), mainHandOutcome: HandOutcome.LOSS, splitHandOutcome: HandOutcome.WIN },
|
|
1379
|
+
},
|
|
1380
|
+
{
|
|
1381
|
+
input: {
|
|
1382
|
+
mainPlayerHand: [
|
|
1383
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.DIAMONDS, value: '10' }),
|
|
1384
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.SPADES, value: '4' }),
|
|
1385
|
+
],
|
|
1386
|
+
splitPlayerHand: [
|
|
1387
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.DIAMONDS, value: '10' }),
|
|
1388
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.SPADES, value: 'A' }),
|
|
1389
|
+
],
|
|
1390
|
+
dealerHand: [
|
|
1391
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' }),
|
|
1392
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.DIAMONDS, value: '9' }),
|
|
1393
|
+
],
|
|
1394
|
+
mainBetAmount: new BigNumber(0),
|
|
1395
|
+
twentyOnePlusThreeAmount: new BigNumber(0),
|
|
1396
|
+
perfectPairAmount: new BigNumber(0),
|
|
1397
|
+
boughtInsurance: true,
|
|
1398
|
+
hasSplit: true,
|
|
1399
|
+
mainHandDoubleDown: false,
|
|
1400
|
+
splitHandDoubleDown: true,
|
|
1401
|
+
},
|
|
1402
|
+
output: {
|
|
1403
|
+
payout: new BigNumber(0),
|
|
1404
|
+
multiplier: new BigNumber(4).dividedBy(3.5),
|
|
1405
|
+
mainHandOutcome: HandOutcome.LOSS,
|
|
1406
|
+
splitHandOutcome: HandOutcome.WIN,
|
|
1407
|
+
},
|
|
1408
|
+
},
|
|
1409
|
+
{
|
|
1410
|
+
input: {
|
|
1411
|
+
mainPlayerHand: [
|
|
1412
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.DIAMONDS, value: '10' }),
|
|
1413
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.SPADES, value: '4' }),
|
|
1414
|
+
],
|
|
1415
|
+
splitPlayerHand: [
|
|
1416
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.DIAMONDS, value: '10' }),
|
|
1417
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.SPADES, value: 'A' }),
|
|
1418
|
+
],
|
|
1419
|
+
dealerHand: [
|
|
1420
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' }),
|
|
1421
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.DIAMONDS, value: '9' }),
|
|
1422
|
+
],
|
|
1423
|
+
mainBetAmount: new BigNumber(0),
|
|
1424
|
+
twentyOnePlusThreeAmount: new BigNumber(0),
|
|
1425
|
+
perfectPairAmount: new BigNumber(0),
|
|
1426
|
+
boughtInsurance: true,
|
|
1427
|
+
hasSplit: true,
|
|
1428
|
+
mainHandDoubleDown: false,
|
|
1429
|
+
splitHandDoubleDown: false,
|
|
1430
|
+
},
|
|
1431
|
+
output: {
|
|
1432
|
+
payout: new BigNumber(0),
|
|
1433
|
+
multiplier: new BigNumber(2).dividedBy(2.5),
|
|
1434
|
+
mainHandOutcome: HandOutcome.LOSS,
|
|
1435
|
+
splitHandOutcome: HandOutcome.WIN,
|
|
1436
|
+
},
|
|
1437
|
+
},
|
|
1438
|
+
{
|
|
1439
|
+
input: {
|
|
1440
|
+
mainPlayerHand: [
|
|
1441
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.DIAMONDS, value: '10' }),
|
|
1442
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.SPADES, value: '4' }),
|
|
1443
|
+
],
|
|
1444
|
+
splitPlayerHand: [
|
|
1445
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.DIAMONDS, value: '10' }),
|
|
1446
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.SPADES, value: 'A' }),
|
|
1447
|
+
],
|
|
1448
|
+
dealerHand: [
|
|
1449
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.CLUBS, value: 'A' }),
|
|
1450
|
+
CardGames.getCardIndexFromDetails({ suit: Suits.DIAMONDS, value: '9' }),
|
|
1451
|
+
],
|
|
1452
|
+
mainBetAmount: new BigNumber(0),
|
|
1453
|
+
twentyOnePlusThreeAmount: new BigNumber(0),
|
|
1454
|
+
perfectPairAmount: new BigNumber(0),
|
|
1455
|
+
boughtInsurance: true,
|
|
1456
|
+
hasSplit: true,
|
|
1457
|
+
mainHandDoubleDown: true,
|
|
1458
|
+
splitHandDoubleDown: true,
|
|
1459
|
+
},
|
|
1460
|
+
output: {
|
|
1461
|
+
payout: new BigNumber(0),
|
|
1462
|
+
multiplier: new BigNumber(4).dividedBy(4.5),
|
|
1463
|
+
mainHandOutcome: HandOutcome.LOSS,
|
|
1464
|
+
splitHandOutcome: HandOutcome.WIN,
|
|
1036
1465
|
},
|
|
1037
|
-
output: new BigNumber(90), // push split (20) + mixed pair (7*10)
|
|
1038
1466
|
},
|
|
1039
1467
|
];
|
|
1040
1468
|
|
|
1041
1469
|
funcParams.forEach((param) => {
|
|
1042
|
-
|
|
1470
|
+
const output = Blackjack.getGameOutcome(param.input);
|
|
1471
|
+
expect(output).toStrictEqual(param.output);
|
|
1472
|
+
expect(output.payout).toEqual(param.output.payout);
|
|
1043
1473
|
});
|
|
1044
1474
|
/**
|
|
1045
1475
|
* ONLY 1 HAND(no splits)
|