From c851d42bd1a1f480ad38e02ae1e5f4e678154514 Mon Sep 17 00:00:00 2001 From: Stefan Rupp Date: Mon, 13 Apr 2020 16:14:36 +0200 Subject: [PATCH] starting reworking --- server.py | 8 +-- templates/home/control.html | 14 +++- templates/home/player.html | 22 ++++-- views/control.py | 35 ++++++++- views/player.py | 18 +++-- wiz_game.py | 137 +++++++++++++++++++++++++++++------- 6 files changed, 194 insertions(+), 40 deletions(-) diff --git a/server.py b/server.py index 84bcb63..768259c 100755 --- a/server.py +++ b/server.py @@ -18,10 +18,10 @@ def main(): #wiz_game.the_game.add_player("p3", 3) #wiz_game.the_game.add_player("p4", 4) #wiz_game.the_game.deal_cards(12) - wiz_game.the_game.add_player("p1", 1) - wiz_game.the_game.add_player("p2", 2) - wiz_game.the_game.add_player("p3", 3) - wiz_game.the_game.add_player("p4", 4) + wiz_game.the_game.add_player("p1") + wiz_game.the_game.add_player("p2") + wiz_game.the_game.add_player("p3") + wiz_game.the_game.add_player("p4") wiz_game.the_game.init_game() diff --git a/templates/home/control.html b/templates/home/control.html index 9bacbbd..f1d56b3 100644 --- a/templates/home/control.html +++ b/templates/home/control.html @@ -14,10 +14,19 @@ >{{loop.index}}: {{card}} | {% endfor %} -
  • +
    Trump Card: {{trump_card}}
    Trump Color: {{trump_color}}
    -
  • +
    + {% if trick_finished %} + Winner: {{trick_winner}} with Card {{highest_card}} + start next trick + {% endif %} + {% if hand_finished %} + Winner: {{trick_winner}} with Card {{highest_card}} + start next hand + {% endif %} +

    diff --git a/templates/home/player.html b/templates/home/player.html index 73acbc2..d2a03ef 100644 --- a/templates/home/player.html +++ b/templates/home/player.html @@ -7,10 +7,17 @@

    Play a nice game of cards?

    - Player {{player}} view
    + Player {{player+1}} view
    Table
    - {% for key,value in played_cards.items() %} - || {{key.name}}: {{value}} + {% for player,card in played_cards %} + || + {% if player.id == active_player %} + + {% endif %} + {{player.name}}: {{card}} + {% if player.id == active_player %} + + {% endif %} {% endfor %} ||
    @@ -24,11 +31,18 @@ {% for card in cards %}

  • >card {{loop.index}} is: {{card}}
    - {% if playerActive %} + {% if playerActive and not choose_trump_color %} play card {{loop.index}}<{{card}}> {% endif %}
  • {% endfor %} + {% if choose_trump_color %} + Choose Trump Color: + Red> + Green> + Blue> + Yellow > + {% endif %}