Skip to content

Commit

Permalink
Merge pull request datamllab#12 from datamllab/dev
Browse files Browse the repository at this point in the history
merge from dev branch
  • Loading branch information
daochenzha authored Oct 15, 2019
2 parents 4a9a3bc + 5ac74b3 commit c2fa8fd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions rlcard/envs/blackjack.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def __init__(self, allow_step_back=False):
''' Initialize the Blackjack environment
'''
super().__init__(Game(allow_step_back), allow_step_back)
self.rank2score = {"A":10, "2":2, "3":3, "4":4, "5":5, "6":6, "7":7, "8":8, "9":9, "T":10, "J":10, "Q":10, "K":10}
self.rank2score = {"A":11, "2":2, "3":3, "4":4, "5":5, "6":6, "7":7, "8":8, "9":9, "T":10, "J":10, "Q":10, "K":10}
self.actions = ['hit', 'stand']
self.state_shape = [2]

Expand Down Expand Up @@ -48,7 +48,7 @@ def get_scores_and_A(hand):
if card[1] == 'A':
has_a = 1
if score > 21 and has_a == 1:
score -= 9
score -= 10
return score, has_a

my_score, _ = get_scores_and_A(my_cards)
Expand Down
4 changes: 2 additions & 2 deletions rlcard/games/blackjack/judger.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class BlackjackJudger(object):
def __init__(self):
''' Initialize a BlackJack judger class
'''
self.rank2score = {"A":10, "2":2, "3":3, "4":4, "5":5, "6":6, "7":7, "8":8, "9":9, "T":10, "J":10, "Q":10, "K":10}
self.rank2score = {"A":11, "2":2, "3":3, "4":4, "5":5, "6":6, "7":7, "8":8, "9":9, "T":10, "J":10, "Q":10, "K":10}

def judge_round(self, player):
''' Judge the target player's status
Expand Down Expand Up @@ -59,7 +59,7 @@ def judge_score(self, cards):
has_A += 1
if score > 21 and has_A > 0:
for _ in range(has_A):
score -= 9
score -= 10
if score < 21:
break
return score

0 comments on commit c2fa8fd

Please sign in to comment.