Case for 'even money'
Closed this issue · 4 comments
I think the engine is missing the insurance special case where the dealer asks for 'even money'. This kind of insurance should be available when the dealer has an ace card and the player has a blackjack.
After the 'DEAL' action, and if the player has a blackjack and the dealer face-up card is an ace, the game goes to the 'SHOWDOWN' stage instead of asking for even money/insurance.
The following link has an explanation with an example: http://www.hitorsplit.com/articles/What_is_Insurance_and_Even_Money.html
I might try to add this to the engine but maybe you can give me some hints.
@jmolero this could be done introducing a new rule
(ie evenMoneyInsurance
). I will look into the required tests but it does not seem to be complex.
Could be added as a rule but I think it should be part of the insurance. Even money is the mathematical result of the player taking insurance and having a blackjack: https://en.wikipedia.org/wiki/Even_money
The player gets paid the same if has a blackjack and takes insurance regardless of the dealer cards.
I implemented this without the rule flag on #61
I tried all the cases of insurance and even money to check I didn't introduce any bugs:
- insurance with dealer BJ (net pay: 0)
- insurance without dealer BJ player wins (net pay: 0.5)
- insurance without dealer BJ player loses (net pay: -1.5)
- insurance without dealer BJ push (net pay: -0.5)
- even money with dealer BJ (net pay: 1)
- even money without dealer BJ (net pay: 1)
Thanks @kedoska for looking into this. I think you are right, I didn't take into account it could be a breaking change.
I pushed another commit that adds the evenMoneyInsurance
rule and I set it to false by default in the preset. To enable even money, both insurance
and evenMoneyInsurance
need to be set to true. I also updated the tests for this feature in this commit.