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()
|
self.deal_card_to_player()
|
||||||
game.state["score"] = self.get_player_score()
|
game.state["score"] = self.get_player_score()
|
||||||
|
|
||||||
|
|
||||||
def set_up_new_round(self, game):
|
def set_up_new_round(self, game):
|
||||||
self.deck = Deck(self.position)
|
self.deck = Deck(self.position)
|
||||||
for agent in self.deck.get_agents():
|
for agent in self.deck.get_agents():
|
||||||
@@ -81,6 +82,8 @@ class Dealer:
|
|||||||
return (x + 4 * len(self.dealer_cards), y)
|
return (x + 4 * len(self.dealer_cards), y)
|
||||||
|
|
||||||
def get_player_score(self):
|
def get_player_score(self):
|
||||||
|
"""if score >21 set A va """
|
||||||
|
|
||||||
return sum([card.value() for card in self.player_cards])
|
return sum([card.value() for card in self.player_cards])
|
||||||
|
|
||||||
def end_round(self, game):
|
def end_round(self, game):
|
||||||
|
|||||||
@@ -1,11 +1,20 @@
|
|||||||
from retro.game import Game
|
from retro.game import Game
|
||||||
from dealer import Dealer
|
from dealer import Dealer
|
||||||
|
import json
|
||||||
|
|
||||||
dealer = Dealer((1, 1))
|
def play():
|
||||||
state = {
|
dealer = Dealer((1, 1))
|
||||||
|
state = {
|
||||||
"score": 0,
|
"score": 0,
|
||||||
"options": "h to hit or s to stay",
|
"options": "H to hit or F to stay",
|
||||||
}
|
}
|
||||||
game = Game([dealer], state)
|
game = Game([dealer], state)
|
||||||
game.play()
|
game.play()
|
||||||
|
|
||||||
|
with open("result.json") as result_file:
|
||||||
|
json.dump(game.state)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
play()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user