From d631506d0415eddf834df0ed05f4414e0b0dc93c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jannes=20H=C3=B6ke?= Date: Tue, 8 Mar 2016 02:59:46 +0100 Subject: [PATCH] tidy up reply_to_query --- bot.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/bot.py b/bot.py index 3880df1..7c1db48 100644 --- a/bot.py +++ b/bot.py @@ -146,24 +146,19 @@ def reply_to_query(bot, update): if game.choosing_color: add_choose_color(results) else: - playable = player.playable_cards() - if playable: - playable = list(sorted(playable)) + playable = list(sorted(player.playable_cards())) - if playable: for card in playable: add_play_card(card, results) - if playable is not False and not game.choosing_color and not player.drew: - add_draw(player, results, could_play_card=bool(len(playable))) + if not player.drew: + add_draw(player, results, could_play_card=bool(len(playable))) - if player.drew and not game.choosing_color: - add_pass(results) + else: + add_pass(results) - if game.last_card.special == c.DRAW_FOUR \ - and not game.choosing_color \ - and game.draw_counter: - add_call_bluff(results) + if game.last_card.special == c.DRAW_FOUR and game.draw_counter: + add_call_bluff(results) add_other_cards(playable, player, results)