From 2092c52edb38f4eed9a69e248b98af137a2a4342 Mon Sep 17 00:00:00 2001 From: Stefan Rupp Date: Sun, 11 Oct 2020 18:10:05 +0200 Subject: [PATCH] change nomenclature --- server.py | 2 +- templates/home/control.html | 4 ++-- views/control.py | 16 ++++++++-------- views/player.py | 2 +- wiz_game.py | 8 ++++---- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/server.py b/server.py index 1bf6d10..332f6ec 100755 --- a/server.py +++ b/server.py @@ -13,7 +13,7 @@ def main(): wiz_game.the_game.start_game() #api.run(port=8001, address="127.0.0.1") - api.run(port=8001, address="192.168.42.1") + api.run(port=8001, address="192.168.42.100") exit(0) diff --git a/templates/home/control.html b/templates/home/control.html index 78c9cbf..5234297 100644 --- a/templates/home/control.html +++ b/templates/home/control.html @@ -22,9 +22,9 @@ Winner: {{trick_winner}} with Card {{highest_card}} start next trick {% endif %} - {% if hand_finished %} + {% if round_finished %} Winner: {{trick_winner}} with Card {{highest_card}} - start next hand + start next round {% endif %}
undo last card diff --git a/views/control.py b/views/control.py index decb5fc..d84b96e 100644 --- a/views/control.py +++ b/views/control.py @@ -5,15 +5,15 @@ from wiz_game import the_game @api.route("/control/") def index(req, resp): - hand_finished = the_game.is_hand_finished() + round_finished = the_game.is_round_finished() trick_finished = the_game.is_trick_finished() - if hand_finished: + if round_finished: trick_winner, highest_card = the_game.get_trick_winner() winner = trick_winner.name resp.content = api.template('home/control.html', deck=the_game.card_deck, trump_card=the_game.trump_card, trump_color=the_game.get_trump_color(), - hand_finished=True, trick_finished=False, trick_winner=winner, + round_finished=True, trick_finished=False, trick_winner=winner, highest_card=highest_card ) elif trick_finished: @@ -30,9 +30,9 @@ def index(req, resp): round_finished=False, trick_finished=False ) -@api.route("/control/next_hand/") -async def start_next_hand(req, resp): - the_game.next_hand() +@api.route("/control/next_round/") +async def start_next_round(req, resp): + the_game.next_round() await the_game.send_page_reload() api.redirect(resp, '/control/', status_code=303) @@ -46,9 +46,9 @@ async def start_next_trick(req, resp): @api.route("/control/undo_last/") async def undo_last(req, resp): - hand_finished = the_game.is_hand_finished() + round_finished = the_game.is_round_finished() if the_game.played_cards: - if not hand_finished: + if not round_finished: p, c = the_game.played_cards.pop() the_game.active_player -= 1 p.add_card(c) diff --git a/views/player.py b/views/player.py index cad7c21..12d012b 100644 --- a/views/player.py +++ b/views/player.py @@ -37,7 +37,7 @@ async def play_card(player, card): isActive = False if isActive: the_game.play_card(player, card) - if the_game.is_hand_finished(): + if the_game.is_round_finished(): trick_winner, highest_card = the_game.get_trick_winner() trick_winner.take_trick() elif the_game.is_trick_finished(): diff --git a/wiz_game.py b/wiz_game.py index 6e8fe0e..f853477 100644 --- a/wiz_game.py +++ b/wiz_game.py @@ -155,16 +155,16 @@ class WizGame: else: return True - def is_hand_finished(self): + def is_round_finished(self): h = self.is_trick_finished() if h and self.num_tricks_played == self.current_round: return True else: return False - def next_hand(self): - max_hands = len(self.card_deck)/len(self.players) - if self.current_round <= max_hands: + def next_round(self): + max_rounds = len(self.card_deck)/len(self.players) + if self.current_round <= max_rounds: self.current_round += 1 self.start_player += 1 if self.start_player >= len(self.players):