Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Case for 'even money' #60

Closed
jmolero opened this issue May 7, 2019 · 4 comments
Closed

Case for 'even money' #60

jmolero opened this issue May 7, 2019 · 4 comments

Comments

@jmolero
Copy link
Contributor

jmolero commented May 7, 2019

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.

@kedoska
Copy link
Owner

kedoska commented May 10, 2019

@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.

@jmolero
Copy link
Contributor Author

jmolero commented May 20, 2019

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)

@kedoska
Copy link
Owner

kedoska commented May 21, 2019

@jmolero I'll try to fix the CI as apparently, it is currently failing, but the #61 looks good to me. I just want to make sure it can be turned on and off by the rules to avoid introducing new functionality in production.

@jmolero
Copy link
Contributor Author

jmolero commented May 22, 2019

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.

@kedoska kedoska closed this as completed Dec 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants