2020-04-05 16:00:48 +02:00
|
|
|
from app_instance import api
|
|
|
|
|
|
|
|
from wiz_game import the_game
|
|
|
|
|
|
|
|
|
|
|
|
@api.route("/player/{player}")
|
|
|
|
def index(req, resp, player: str):
|
|
|
|
p = int(player)
|
2020-04-05 23:27:33 +02:00
|
|
|
tcard = the_game.trump_card
|
|
|
|
tcolor = the_game.get_trump_color()
|
2020-04-06 22:42:31 +02:00
|
|
|
table = the_game.table
|
|
|
|
resp.content = api.template('home/player.html', player=player, cards=the_game.players[p].cards,
|
|
|
|
trump_card=tcard, trump_color=tcolor, played_cards=table.played_cards)
|
|
|
|
|
|
|
|
|
|
|
|
@api.route("/player/{player}/play/{card}")
|
|
|
|
def play(req, resp, player: str, card: str):
|
|
|
|
p = int(player)
|
|
|
|
pl = the_game.players[p]
|
|
|
|
c = pl.play_card(int(card))
|
|
|
|
the_game.table.play_card(p, c)
|
2020-04-07 21:13:23 +02:00
|
|
|
url = '/player/'+player
|
|
|
|
api.redirect(resp, url, status_code=303)
|
2020-04-06 22:42:31 +02:00
|
|
|
|