From da74e64afcb69e736a2226998c844fdcd36f57b9 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sat, 9 Mar 2019 11:41:06 -0500 Subject: [PATCH] updated decider program to be more user-friendly (it's still pretty unusable though) --- decider.py | 46 ++++++++++++++++++++++++++++------------------ prob_functions.py | 2 +- 2 files changed, 29 insertions(+), 19 deletions(-) diff --git a/decider.py b/decider.py index 3315f4c..bc87190 100644 --- a/decider.py +++ b/decider.py @@ -9,21 +9,31 @@ def get_input(prompt): print('Please enter a number') -powders_in_hand = get_input('How many Serum Powder are in your hand?') -other_in_hand = get_input('How many other cards are in your hand?') -powders_on_bottom = get_input( - 'How many Serum Powder are on the bottom of your library?') -other_on_bottom = get_input( - 'How many other cards are on the bottom of your library?') -powders_in_deck = get_input( - 'How many Serum Powder are in your deck (but that you know are not on the bottom)?' -) -other_in_deck = get_input( - 'How many other cards are in your deck (but that you know are not on the bottom)?' -) -mull_count = get_input( - 'How many times have you taken a normal mulligan (i.e. how many cards will you need to put on the bottom)?' -) - -action_to_take(powders_in_hand, other_in_hand, powders_in_deck, other_in_deck, - powders_on_bottom, other_on_bottom, mull_count) +powders_in_deck = 4 +other_in_deck = 52 +powders_on_bottom = 0 +other_on_bottom = 0 +mull_count = 0 + +while True: + print('\nIf you have a Bazaar, keep!\n') + + powders_in_hand = get_input('How many Serum Powder are in your hand?') + other_in_hand = get_input('How many other cards are in your hand?') + + best_action = action_to_take(powders_in_hand, other_in_hand, powders_in_deck, other_in_deck, + powders_on_bottom, other_on_bottom, mull_count) + + print(advice_string(best_action, mull_count)) + + if best_action == 'regular': + mull_count += 1 + powders_in_deck += powders_on_bottom + other_in_deck += other_on_bottom + powders_on_bottom = other_on_bottom = 0 + else: + powders_to_bottom, other_to_bottom = best_action + powders_on_bottom += powders_to_bottom + other_on_bottom += other_to_bottom + powders_in_deck -= powders_in_hand + other_in_deck -= other_in_hand diff --git a/prob_functions.py b/prob_functions.py index d74f9b1..45ac032 100644 --- a/prob_functions.py +++ b/prob_functions.py @@ -180,4 +180,4 @@ def action_to_take(powders_in_hand, mull_dict[(powders_to_bottom, other_to_bottom)] = powder_mull best_action = max(mull_dict.keys(), key=mull_dict.get) - print(advice_string(best_action, mull_count)) + return best_action