implementing game logic

This commit is contained in:
2020-04-12 15:27:05 +02:00
parent 663457d4bc
commit 2862e73e19
6 changed files with 106 additions and 39 deletions

View File

@ -5,7 +5,7 @@ from wiz_game import the_game
@api.route("/control/")
def index(req, resp):
print(req.params)
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())

View File

@ -4,21 +4,25 @@ from wiz_game import the_game
@api.route("/player/{player}")
def index(req, resp, player: str):
def show(req, resp, player: str):
p = int(player)
name = the_game.players[p].name
tcard = the_game.trump_card
tcolor = the_game.get_trump_color()
table = the_game.table
resp.content = api.template('home/player.html', player=player, cards=the_game.players[p].cards,
isActive = the_game.is_players_turn(p)
resp.content = api.template('home/player.html', playerActive=isActive, player=p, 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)
c = int(card)
#pl = the_game.players[p]
#c = pl.play_card(int(card))
#the_game.table.play_card(p, c)
the_game.play_card(p, c)
url = '/player/'+player
api.redirect(resp, url, status_code=303)