This commit is contained in:
Daniel Ledda
2020-06-23 23:55:38 +02:00
parent ff73721678
commit 150f027583
2 changed files with 8 additions and 4 deletions

View File

@@ -99,7 +99,7 @@ class Game:
def play_round(self) -> None: def play_round(self) -> None:
self.renderer.render_message("Round {} start!".format(self.round_count)) self.renderer.render_message("Round {} start!".format(self.round_count))
self.deal_cards() self.deal_cards()
self.determine_game_type() self.decide_on_game()
self.update_trump_ranking() self.update_trump_ranking()
for i in range(len(self.deck) // Game.PLAYER_COUNT): for i in range(len(self.deck) // Game.PLAYER_COUNT):
self.trick_count += 1 self.trick_count += 1
@@ -112,7 +112,7 @@ class Game:
self.renderer.render_message("{}: {} points.".format(player.get_name(), score)) self.renderer.render_message("{}: {} points.".format(player.get_name(), score))
self.renderer.render_message("Round end!") self.renderer.render_message("Round end!")
def determine_game_type(self) -> None: def decide_on_game(self) -> None:
player_choosing = self.current_player_index player_choosing = self.current_player_index
player = None player = None
for i in range(len(self.players)): for i in range(len(self.players)):

View File

@@ -47,7 +47,8 @@ class HumanDecisionInterface(DecisionMaker):
try: try:
print("Choose a game to play: ") print("Choose a game to play: ")
print(", ".join( print(", ".join(
["Pass (1)"] + ["{} ({})".format(round_type.name, i + 1) for i, round_type in enumerate(round_types) ["Pass (1)"] + ["{} ({})".format(round_type.name, i + 1)
for i, round_type in enumerate(round_types)
if round_type is not None])) if round_type is not None]))
attempt = int(input(" -> ")) attempt = int(input(" -> "))
type_choice = round_types[attempt - 1] type_choice = round_types[attempt - 1]
@@ -62,7 +63,10 @@ class HumanDecisionInterface(DecisionMaker):
suit_choice = None suit_choice = None
while suit_choice is None: while suit_choice is None:
try: try:
suit_types = [suit for suit in Card.Suit] if type_choice != RoundType.Sauspiel else sauspiel_choices if type_choice == RoundType.Sauspiel:
suit_types = sauspiel_choices
else:
suit_types = [suit for suit in Card.Suit]
print("Choose a suit to play with: ") print("Choose a suit to play with: ")
print(", ".join(["{} ({})".format(suit.name, i + 1) for i, suit in enumerate(suit_types)])) print(", ".join(["{} ({})".format(suit.name, i + 1) for i, suit in enumerate(suit_types)]))
attempt = int(input(" -> ")) attempt = int(input(" -> "))