fixed 2 bugs in last round!

This commit is contained in:
Stefan Rupp 2020-04-19 00:38:57 +02:00
parent 1b32fe295d
commit 38102ce778
4 changed files with 15 additions and 10 deletions

View File

@ -3,19 +3,23 @@
{% block content %} {% block content %}
<div class="content"> <div class="content">
<h1><span class="font-semi-bold">Gambling Foo</span> <span class="smaller">A RESTful gaming service</span></h1> <h1><span class="font-semi-bold">Cowiz Gambling Den</span> <span class="smaller">A RESTful gaming service</span></h1>
<p class="lead"> <p class="lead">
Play a nice game of cards?<br> Play a nice game of cards!<br>
<br> <br>
<strong>Endpoints</strong> <strong>Endpoints</strong>
<ul> <ul>
<li> <li>
<strong>Shuffle Card Deck</strong><br> <strong>Players</strong><br>
<a href="/api/shuffle">GET /api/shuffle</a> <a href="/player/0">Player 1</a>
<a href="/player/1">Player 2</a>
<a href="/player/2">Player 3</a>
<a href="/player/3">Player 4</a>
<a href="/player/4">Player 5</a>
<a href="/player/5">Player 6</a>
</li> </li>
<li> <li>
<strong>Movies by director</strong><br> Spam Bacon Sausage + Spam
<a href="/api/director/cameron">GET /api/director/{director_name}</a>
</li> </li>
<!-- <!--
<li> <li>
@ -39,7 +43,6 @@
</p> </p>
<p class="disclaimer"> <p class="disclaimer">
Spam Bacon Sausage + Spam
Spam Spam Spam Spam Spam Spam Spam Spam Spam Spam
Spam Baked Beans Spam Spam Baked Beans Spam
Spam Spam + Spam Spam Spam + Spam

View File

@ -34,6 +34,7 @@
<div>{% block content %}{% endblock %}</div> <div>{% block content %}{% endblock %}</div>
</div> </div>
</div> </div>
<!--
<div class="row"> <div class="row">
<div class="links"> <div class="links">
<ul> <ul>
@ -51,6 +52,7 @@
Copyright &copy; Talk Python Training Copyright &copy; Talk Python Training
</div> </div>
</div> </div>
-->
</div> </div>
</div> </div>

View File

@ -19,7 +19,7 @@ def show(req, resp, player: str):
#active_player = the_game.active_player #active_player = the_game.active_player
prev_player = the_game.get_prev_player() prev_player = the_game.get_prev_player()
if tcard.value == 'Z' and tcolor == '-': if tcard and tcard.value == 'Z' and tcolor == '-':
choose_trump_color = True choose_trump_color = True
else: else:
choose_trump_color = False choose_trump_color = False

View File

@ -130,7 +130,7 @@ class WizGame:
high_player, high_card = cards[0] high_player, high_card = cards[0]
for player, card in cards[1:]: for player, card in cards[1:]:
if get_higher_card(high_card, card, self.trump_card.color): if get_higher_card(high_card, card, self.trump_card.color if self.trump_card else '-'):
high_card = card high_card = card
high_player = player high_player = player
return high_player, high_card return high_player, high_card
@ -198,6 +198,6 @@ class WizGame:
return self.start_player-1 return self.start_player-1
p = ["p1", "p2", "p3", "p4"] p = ["Astrid", "Stephan", "Patrice", "struppi"]
the_game = WizGame(p) the_game = WizGame(p)