This commit is contained in:
jandrews
2026-01-16 13:00:39 -05:00
parent 72928df0cc
commit ce69c6b474
5 changed files with 18 additions and 6 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -44,6 +44,7 @@ class Dealer:
self.deal_card_to_player()
game.state["score"] = self.get_player_score()
def set_up_new_round(self, game):
self.deck = Deck(self.position)
for agent in self.deck.get_agents():
@@ -81,6 +82,8 @@ class Dealer:
return (x + 4 * len(self.dealer_cards), y)
def get_player_score(self):
"""if score >21 set A va """
return sum([card.value() for card in self.player_cards])
def end_round(self, game):

View File

@@ -1,11 +1,20 @@
from retro.game import Game
from dealer import Dealer
import json
dealer = Dealer((1, 1))
state = {
def play():
dealer = Dealer((1, 1))
state = {
"score": 0,
"options": "h to hit or s to stay",
}
game = Game([dealer], state)
game.play()
"options": "H to hit or F to stay",
}
game = Game([dealer], state)
game.play()
with open("result.json") as result_file:
json.dump(game.state)
if __name__ == '__main__':
play()