generated from mwc/project_game
fykfyk
This commit is contained in:
BIN
chris_demo/__pycache__/card.cpython-311.pyc
Normal file
BIN
chris_demo/__pycache__/card.cpython-311.pyc
Normal file
Binary file not shown.
BIN
chris_demo/__pycache__/dealer.cpython-311.pyc
Normal file
BIN
chris_demo/__pycache__/dealer.cpython-311.pyc
Normal file
Binary file not shown.
BIN
chris_demo/__pycache__/deck.cpython-311.pyc
Normal file
BIN
chris_demo/__pycache__/deck.cpython-311.pyc
Normal file
Binary file not shown.
@@ -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):
|
||||
|
||||
@@ -1,11 +1,20 @@
|
||||
from retro.game import Game
|
||||
from dealer import Dealer
|
||||
import json
|
||||
|
||||
def play():
|
||||
dealer = Dealer((1, 1))
|
||||
state = {
|
||||
"score": 0,
|
||||
"options": "h to hit or s to stay",
|
||||
"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()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user