change nomenclature

This commit is contained in:
Stefan Rupp 2020-10-11 18:10:05 +02:00
parent 89d11ee759
commit 2092c52edb
5 changed files with 16 additions and 16 deletions

View File

@ -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)

View File

@ -22,9 +22,9 @@
Winner: {{trick_winner}} with Card {{highest_card}}
<a href="/control/next_trick/">start next trick</a>
{% endif %}
{% if hand_finished %}
{% if round_finished %}
Winner: {{trick_winner}} with Card {{highest_card}}
<a href="/control/next_hand/">start next hand</a>
<a href="/control/next_round/">start next round</a>
{% endif %}
<br>
<a href="/control/undo_last/">undo last card</a>

View File

@ -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)

View File

@ -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():

View File

@ -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):