last trick is now visible

This commit is contained in:
2020-04-25 22:00:23 +02:00
parent 72e968274b
commit dc87897b77
3 changed files with 36 additions and 1 deletions

View File

@ -26,7 +26,7 @@ def show(req, resp, player: str):
choose_trump_color = False
resp.content = api.template('home/player.html', player=p, playerActive=isActive, choose_trump_player=prev_player,
cards=the_game.players[p].cards, choose_trump_color=choose_trump_color,
trump_card=tcard, trump_color=tcolor, played_cards=the_game.played_cards)
trump_card=tcard, trump_color=tcolor, played_cards=the_game.played_cards, last_trick=the_game.last_trick)
@api.route("/player/{player}/play/{card}")
@ -34,6 +34,17 @@ async def play(req, resp, player: str, card: str):
p = int(player)
c = int(card)
the_game.play_card(p, c)
if the_game.is_hand_finished():
print("hand finished")
trick_winner, highest_card = the_game.get_trick_winner()
trick_winner.take_trick()
#the_game.next_hand()
elif the_game.is_trick_finished():
print("trick finished")
trick_winner, highest_card = the_game.get_trick_winner()
trick_winner.take_trick()
the_game.next_trick()
url = '/player/'+player
for ws in the_game.websockets:
try: