Created
January 27, 2016 00:24
-
-
Save joshgit/c631a9cfd2d37c05f3a8 to your computer and use it in GitHub Desktop.
price choices
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def format_price(price): | |
def add_decimal(price, d): | |
price = str(price / 10 ** d) | |
return price[:-1] + '.' + price[-1] | |
if price < 10 ** 8: | |
return '%s' % price | |
elif price < 10 ** 11: | |
return '%sm' % add_decimal(price, 5) | |
elif price < 10 ** 14: | |
return '%sb' % add_decimal(price, 8) | |
elif price < 10 ** 17: | |
return '%st' % add_decimal(price, 11) | |
elif price < 10 ** 20: | |
return '%sq' % add_decimal(price, 14) | |
else: | |
return '%sQ' % add_decimal(price, 19) | |
def autopricechoice(): | |
autopricetkinter.set("Auto-Clicker (Costs: $%s)" % format_price(game_state.get_autoprice())) | |
def printpricechoice(): | |
printpricetkinter.set("Money Printer (Costs: $%s)" % format_price(game_state.get_printprice())) | |
def counterfeitpricechoice(): | |
counterfeitpricetkinter.set("Counterfeit Company (Costs: $%s)" % format_price(game_state.get_counterfeit_price())) | |
def sharepricechoice(): | |
sharepricetkinter.set("Sharemarket Crash (Costs: $%s)" % format_price(game_state.get_shareprice())) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment