Created
September 6, 2019 21:30
-
-
Save marcosan93/550f4643980a0b696f2cf4bf5477f770 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def player_move(your_hand, limit, true_cnt, dealer_hand): | |
| """ | |
| Chooses 'hit' or 'stay' depending on the limit set and count | |
| """ | |
| dtotal = hand_total(dealer_hand[:1]) | |
| # Meaning there are plenty of face cards left | |
| if true_cnt > 0: | |
| if hand_total(your_hand) >= limit: | |
| return 'stay' | |
| elif hand_total(your_hand) < limit: | |
| return 'hit' | |
| elif dtotal >= 10: | |
| return 'stay' | |
| # Meaning there are plenty of low cards left: < 6 value | |
| elif true_cnt < 0: | |
| if hand_total(your_hand) <= limit: | |
| return 'hit' | |
| elif hand_total(your_hand) > limit: | |
| return 'stay' | |
| elif dtotal < 10: | |
| return 'hit' | |
| # Meaning the count is neutral so play a basic strategy | |
| else: | |
| if hand_total(your_hand) >= 17: | |
| return 'stay' | |
| elif hand_total(your_hand) < 17: | |
| return 'hit' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment