Last active
April 9, 2020 03:45
-
-
Save XChrisUnknownX/caeb75416a3885688b68b5b2fd1b4861 to your computer and use it in GitHub Desktop.
This is a sample of a text game "starter pack" I am creating. I needed somewhere to store it where I could access it easily. This particular build contains a choices function for a multiple choice game and a random character creator
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
import random | |
import time | |
# going to create a starter pack for text games in Python. | |
# TABLE OF CONTENTS: | |
# Contains: | |
# choices(a): # Choices is going to accept a, an integer, how many choices you're giving the player. | |
# Returns integer of the choice, 1 to a. | |
# choicestest(): Tests choices(a). | |
# | |
# createcharacter(): creates a list that has traits of a random character, and can be used to create a proper reference to the character. | |
# createcharactertest(): Tests creating a character. | |
# | |
# createpasswordminigame(a): Creates a random password from numbers and uppercase/lowercase letters. Returns a list. "".join for best results. | |
# createpasswordminigametest(): Test for the password minigame function. | |
# | |
# inventory(a) prints your SHORT, SIMPLE inventory, a, a list. Also returns a. | |
# inventorytest() | |
# | |
# healthprint(a,b,c) prints health, an integer, a. b is whether there is a health cap. c is an integer that represents the health cap. | |
# healthprinttest() | |
# | |
# walletprint(a,b) prints your currency, a, and also your currency name, b. | |
# walletprinttest() | |
# | |
# gdpgrowth(a,b,c) accepts a, an integer, an amount of currency, takes b, a string that must be "day", "month", or "year". Grows by c percent in decimal form per year. EXAMPLE: gdpgrowth(100,"year",.08) | |
# gdpdecline(a,b,c) accepts an integer, a, takes b, a string that must be "day", "month", or "year". Grows by c percent in decimal form per year. EXAMPLE: gdpdecline(100,"year",.08) would go down 8 percent for year, that 8 percent a year can also be broken into month or day. | |
# gdpgrowthtest() tests gdp growth and decline. | |
# | |
# mockblackjack(a) accepts a, an integer, the number of games you must win to return the function. Returns "player" or "dealer" to tell you who won. | |
# | |
# choices is going to accept a, an integer, how many choices you're giving a player. | |
# for best results, tell the player what the choices are before hand, and that they should only enter the number given. | |
# choices returns the integer of the choice, 1 to a | |
# EXAMPLE: | |
# print("You are going to the store. Do you want to...1. go to the store? 2. eat chicken. 3. Sing!") | |
# choices(3) | |
def choices(a): | |
while True: | |
astringy = str(a) | |
selection = input("Enter the number of your choice: ") | |
try: | |
selectioninteger = int(selection) | |
if selectioninteger < 1: | |
print("You cannot enter a number less than 1.") | |
continue | |
elif selectioninteger > a: | |
print("You cannot enter a number greater than " + astringy + ".") | |
continue | |
else: | |
break | |
except: | |
print("You must enter a number.") | |
continue | |
return selectioninteger | |
# choices test pack, part of testsuite(). | |
def choicestest(): | |
print("You are going to the store. Do you want to...1. Go to the store? 2. Eat a chicken! 3. Sing!") | |
answer = choices(3) | |
if answer == 1: | |
print("You go to the store.") | |
elif answer == 2: | |
print("You eat a chicken.") | |
elif answer == 3: | |
print("You sing!") | |
else: | |
print("The code is bugged! Maybe a float was given?") | |
input("End of choices test. Enter to continue.") | |
# createcharacter() creates a list with various character traits that can be used to correctly relate any random character to any random character. Being a list, its traits are also modifiable as needed. | |
def createcharacter(): | |
#This very first part decides the character's name and gender. | |
malenames = ["Andrew","Anthony","Angel","Abel","Alexander","Allen","Alan","Aaron","Axel","Adam","Ari","Abraham","Antonio","Augustus","Amir","Abdi","Alfred","Alvin","Andre","Andres","Arthur","Angelo","Albert","Arman","Ace","Alejandro","Armando","Bernard","Bjorn","Bernie","Barney","Bailey","Billy","Barry","Ben","Bruce","Benjamin","Booker","Bob","Barnabus","Baird","Brian","Bryan","Brock","Boggy","Boris","Christopher","Claude","Charles","Cornelius","Charlie","Chris","Carl","Chase","Corey","Connor","Craig","Clifford","Cyrus","Chopper","Chad","Constantine","David","Dominic","Dominick","Domenick","Dan","Daniel","Daven","Darius","Don","Donald","Dick","Darren","Daryl","Dwayne","Dane","Drake","Desmond","Doc","Dennis","Dimitri","Dale","Dante","Edgar","Edward","Edwin","Edmond","Edmund","Ed","Edd","Eric","Eddie","Elijah","Elton","Ernie","Frank","Fred","Fredrick","Frederick","Frederico","Forest","Falco","Fenton","Gary","Garry","Greg","Gabriel","Gregg","Gerard","Gilbert","Glen","Glenn","Hank","Herbert","Hercules","Hani","Hugo","Hector","Horace","Harry","Harold","Igor","John","Jacob","Jon","Jesus","Jakub","Jeremy","Jonathan","Jeffrey","Johanathan","Johnathan","Jaime","Jamie","James","Jerry","Jim","Jimmy","Junior","Jack","Jake","Jeremiah","Josh","Joshua","Jaquan","Kris","Kristopher","Ken","Kenny","Kenneth","Kyle","Konstantine","Kristofer","Kobi","Kobe","Kevin","Keith","Lewis","Luis","Lambert","Linus","Loki","Lonny","Lenny","Luke","Lucas","Lester","Lukas","Lars","Lance","Loren","Marcus","Mark","Markus","Marc","Michael","Leslie","Larry","Lawrence","Mike","Mikhail","Martin","Marty","Melvin","Morgan","Mallow","Matthew,","Matt","Manny","Moe","Max","Morris","Milo","Montel","Maximus","Mordred","Merlin","Nathan","Nathaniel","Nick","Nicholas","Nikolas","Neil","Nik","Noggy","Oggy","Ozzy","Oswald","Oliver","Oz","Orlan","Orion","Omar","Peter","Piotr","Patrick","Pablo","Paco","Packie","Patrizio","Perseus","Pat","Paul","Poe","Paulie","Quin","Quinn","Quenton","Quinten","Quintin","Quade","Richie","Richard","Rich","Ryan","Ron","Ronald","Remy","Randy","Raymond","Rupert","Randolph","Randolf","Regnier","Raz","Rick","Ricky","Ricardo","Raul","Robert","Rob","Roc","Rocco","Sam","Samuel","Sargon","Steve","Steven","Stephen","Stephan","Syed","Sammy","Saul","Sean","Shawn","Sal","Salvatore","Simon","Stuart","Stu","Stewart","Sonny","Thomas","Thom","Tom","Travis","Tim","Timothy","Tyler","Toren","Terry","Tor","Theodore","Thor","Tai","Uther","Ulfric","Ugo","Vincent","Vance","Vinny","Vin","Wen","Waldo","Walter","Wayne","William","Will","Wally","Xin","Xavier","Yuri","Zoro","Zack","Zackary","Zachary","Zach","Zane"] | |
# There are about 309 male names. | |
femalenames = ["Anna","Ana","Annie","Alexandra","Agatha","Althea","Arlene","Ali","Amaya","Amy","Alexa","Alana","Alice","Alissandra","Angel","Amanda","Alexandria","Ami","Anya","Anju","Aria","Anne","Ann","Allison","Allyson","Aniyah","Brittany","Britt","Beth","Bethany","Barbara","Bonnie","Bonny","Becca","Bekah","Bess","Bessany","Christina","Christine","Courtney","Christin","Celestine","Christi","Cristi","Carri","Caroline","Carolina","Carolea","Caylee","Cate","Catelyn","Celia","Cecelia","Casandra","Cassy","Casaundra","Corrin","Carmen","Constantina","Cornelia","Cora","Dalia","Dalila","Delilah","Dani","Danielle","Dorris","Debra","Deborah","Destiny","Dana","Dorothy","Dora","Denise","Dolores","Dori","Diane","Donna","Doreen","Dawn","Deanna","Dina","Deena","Dee","Ella","Elle","Ellie","Elvira","Ester","Erica","Elizabeth","Elisabeth","Elena","Eileen","Emily","Erin","Eve","Evie","Frida","Frita","Flor","Fay","Freya","Fran","Francesca","Fanny","Gayle","Gail","Gwen","Gweneth","Gloria","Gabrielle","Guadalupe","Gabriella","Geanine","Gee","Georgina","Gela","Hailey","Hanna","Hannah","Haley","Harrah","Hela","Hellen","Helena","Hermoine","Holly","Irene","Irena","Ilana","Ilene","Ingrid","Jerri","Jerrine","Jeanine","Jovanna","Joyanna","Joy","Jane","Jayna","Jean","Jeanie","Jen","Jennifer","Jamie","Jackie","Jacquelyn","Jaquelyn","Julie","Julia","Jacqueline","Joanne","Jodie","Jesebelle","Jazmine","Jasmine","Krista","Kristin","Kirstin","Kristina","Kristine","Konstantina","Kaylee","Karen","Kora","Katelyn","Kate","Katie","Korrin","Kassy","Kasandra","Khaleesi","Kairi","Kasaundra","Kelly","Kylie","Kairi","Kari","Kendra","Kendria","Leslie","Loria","Lena","Lora","Laura","Lauren","Laurie","Leyla","Leelah","Lorelei","Luna","Lee","Linda","Lexi","Mika","Mariah","Melody","Melissa","Marie","Mary","Maria","Morticia","Marnie","Mable","Monique","Monica","Miley","Michelle","Michele","Molly","Micelle","Madeline","Mikela","Michaela","Monika","Marjorie","Moria","Maureen","Melony","Melinda","Melissandra","Moreen","Nelly","Nicole","Nikki","Nancy","Ovelia","Ophelia","Olivia","Omnia","Odessa","Patricia","Penelope","Persephone","Paula","Pauline","Paulina","Pat","Polly","Polina","Quintana","Quina","Rachel","Renee","Rebecca","Raven","Raquel","Racquel","Reyna","Roni","Rori","Sally","Sara","Sarah","Sonia","Saria","Selene","Susan","Suzanne","Susie","Selena","Selestine","Simone","Selestina","Sandy","Sharon","Saliyah","Sandra","Saundra","Sasha","Trish","Tricia","Tess","Tish","Trisha","Theresa","Therese","Teresa","Terese","Talia","Taliyah","Thea","Theodora","Tyrene","Tabatha","Terry","Tracy","Tyanna","Tianna","Tiara","Tyara","Tylena","Tracey","Ula","Vinchenza","Valerie","Victoria","Vicky","Vick","Vickie","Wilma","Xena","Xaria","Yuri","Yolanda","Zena","Zalia","Zaria"] | |
#There are about 309 female names. | |
lastnames = ['Akina', 'Alderman', 'Aliaga', 'Almog', 'Amelkin', 'Angeles', 'Ansari', 'Appel', 'Arena', 'Arias', 'Armstrong', 'Arriaga', 'Ashworth', 'Baez', 'Bannister', 'Barclay', 'Beal', 'Benson', 'Bergen', 'Bhuyan', 'Braver', 'Bravo', 'Breakstone', 'Briody', 'Brodowski', 'Brown', 'Buchanan', 'Buckmeier', 'Calderon', 'Callahan', 'Carberry', 'Carny', 'Casler', 'Castle', 'Castler', 'Cerruti', 'Chandler', 'Chang', 'Chi', 'Chilelli', 'Chong', 'Christobek', 'Cleland', 'Cleveland', 'Clott', 'Cohen', 'Collins', 'Colon', 'Cotto', 'Dapelo', 'Dartt', 'Das', 'Dauman', 'Davidson', 'Davila', 'Day', 'Dayan', 'Deluna', 'Demasi', 'Derby', 'Dey', 'Diamond', 'Dieckmann', 'Dipietro', 'Dobre', 'Doherty', 'Dolan', 'Dougherty', 'Douglas', 'Douglass', 'Doyle', 'Duffy', 'Dunbar', 'Durant', 'Eacho', 'Edwards', 'Eliassaint', 'Escobar', 'Exantus', 'Failla', 'Fakury', 'Falzone', 'Fayman', 'Feerst', 'Feinman', 'Figman', 'Fischer', 'Fisher', 'Fishkin', 'Flyer', 'Gachette', 'Galper', 'Gentile', 'Ginensky', 'Goldberg', 'Goldfarb', 'Gookin', 'Grant', 'Green', 'Greene', 'Groaner', 'Gronningsater', 'Gu', 'Hagler', 'Hannay', 'Haper', 'Heaney', 'Heinrich', 'Heyman', 'Himselson', 'Hopkirk', 'Horowitz', 'Huang', 'Hughes', 'Humbert', 'Hutchinson', 'Ierardi', 'Iheanachor', 'Illym', 'Ingelson', 'Isdokwe', 'Jafari', 'Jaffe', 'Jagielski', 'Johnson', 'Jones', 'Kean', 'Kharlamenko', 'Kishnani', 'Klengler', 'Klopfer', 'Kogan', 'Komar', 'Korek', 'Koretz', 'Kujo', 'Kurtz', 'Lane', 'Langsam', 'Laspina', 'Lerner', 'Lesher', 'Levin', 'Liben', 'Lieberman', 'Lietz', 'Liu', 'Lubin', 'Lubow', 'Lyons', 'Malhotra', 'Malone', 'Maloney', 'Manini', 'Mardirossian', 'Mariani', 'Marrero', 'Marrufo', 'Martinez', 'Mazarin', 'McDonnel', 'McGoldrick', 'McHugh', 'McNamara', 'Mease', 'Medici', 'Meehan', 'Meggett', 'Mehta', 'Mennin', 'Meyer', 'Miles', 'Millan', 'Miller', 'Mills', 'Mirabella', 'Moroney', 'Morrell', 'Morril', 'Murray', 'Musso', 'Nedich', 'Neri', 'Nicolay', 'Nolan', 'Novak', 'Novillo', 'Novis', 'Nowak', "O'Toole", 'Obus', 'Ortsman', 'Pang', 'Paolillo', 'Paple', 'Park', 'Parker', 'Pasinkoff', 'Pate', 'Pathmanathan', 'Payne', 'Peltier', 'Pemberton', 'Perbix', 'Perez', 'Perks', 'Perlin', 'Perlstein', 'Pesin', 'Pierce', 'Poole', 'Poppish', 'Quan', 'Rankin', 'Ransdell', 'Rapisarda', 'Rappaport', 'Reade', 'Redding', 'Redmond', 'Rendeiro', 'Rene', 'Rezai', 'Richman', 'Richmond', 'Ringer', 'Rivera', 'Roberts', 'Robitaille', 'Rodrigues', 'Rodriguez', 'Rosenblum', 'Ross', 'Rossman', 'Rottenberg', 'Roussel', 'Rowe', 'Rozovsky', 'Ruffin', 'Ruger', 'Ruglia', 'Rutger', 'Salters', 'Santo', 'Sattar', 'Scarcella', 'Schiavone', 'Schwartz', 'Seabrooks', 'Serette', 'Sessa', 'Shah', 'Shapovalova', 'Shin', 'Silberman', 'Silverman', 'Simchi', 'Sims', 'Slater', 'Smith', 'Sohn', 'Sorett', 'Stanziale', 'Stearn', 'Stearns', 'Stengel', 'Stephenson', 'Stevens', 'Stevenson', 'Stocking', 'Swensen', 'Swenson', 'Tian', 'Tibbets', 'Tirrell', 'Todadze', 'Toder', 'Tuccio', 'Tucker', 'Tyrell', 'Ukomedu', 'Umber', 'Umbert', 'Urena', 'Valentine', 'Vargas', 'Vasques', 'Vasquez', 'Ventura', 'Villaamil', 'Vogelman', 'Volk', 'Voshtina', 'Walker', 'Wallenstein', 'Washington', 'Weinstein', 'Weiss', 'Wellington', 'Wells', 'Williams', 'Wintle', 'Wittwer', 'Wolk', 'Wong', 'Woolworth', 'Wooten', 'Wright', 'Xe', 'Xee', 'Xi', 'Yanez', 'Yavinsky', 'Yeung', 'Yim', 'Yones', 'Young', 'Zalter', 'Zarabi'] | |
#About 319 last names. | |
# pick gender: | |
# this also picks all relation language. | |
gender = random.choice(["male","female"]) | |
if gender == "male": | |
# all gender-specific titles here. | |
firstname = random.choice(malenames) | |
prefix = "Mr." | |
manorwoman = "man" | |
boyorgirl = "boy" | |
pronoun = "he" | |
thatisherdog = "his" | |
thatshers = "his" | |
thatshim = "him" | |
relationtochild = "father" | |
relationtospouse = "husband" | |
relationtosibling = "brother" | |
relationtoniece = "uncle" | |
relationtograndchild = "grandfather" | |
relationtograndfather = "grandson" | |
relationtoaunt = "nephew" | |
relationtofather = "son" | |
elif gender == "female": | |
#all gender-specific titles here. | |
firstname = random.choice(femalenames) | |
prefix = "Ms." | |
manorwoman = "woman" | |
boyorgirl = "girl" | |
pronoun = "she" | |
thatisherdog = "her" | |
thatshers = "hers" | |
thatshim = "her" | |
relationtochild = "mother" | |
relationtospouse = "wife" | |
relationtosibling = "sister" | |
relationtoniece = "aunt" | |
relationtograndchild = "grandmother" | |
relationtograndfather = "granddaughter" | |
relationtoaunt = "niece" | |
relationtofather = "daughter" | |
else: | |
error = "There is an error in the gender choosing code." | |
return error | |
pass | |
#All non-gender specific information can go on this line. | |
lastname = random.choice(lastnames) | |
fullname = firstname + " " + lastname | |
#Succinctly, this can be used to make a dynamic, random story. "This is " + character[1]+", "+character[7]+" is great." | |
#MAP | |
# 0 is gender | |
# 1 is full name | |
# 2 is first name | |
# 3 is last name | |
# 4 is prefix | |
# 5 is man or woman | |
# 6 is boy or girl | |
# 7 is pronoun | |
# 8 is thatisherdog | |
# 9 is thatshers | |
# 10 is thatshim | |
# 11 is relation to a child | |
# 12 is relation to a spouse | |
# 13 is relation to a sibling | |
# 14 is relation to a niece | |
# 15 is relation to a grandchild | |
# 16 is relation to a grandfather | |
# 17 is relation to an aunt | |
# 18 is relation to a father | |
character = [gender,fullname,firstname,lastname,prefix,manorwoman,boyorgirl,pronoun,thatisherdog,thatshers,thatshim, relationtochild, relationtospouse, relationtosibling, relationtoniece, relationtograndchild, relationtograndfather,relationtoaunt,relationtofather] | |
return character | |
def createcharactertest(): | |
gary = createcharacter() | |
print(gary) | |
input("The test for creating a character has just been run. It should give you a character list with proper names and gender references. him/her/his/hers/he/she. Press enter to continue. ") | |
def createpasswordminigame(a): | |
# a is the number of characters in your password for any individual minigame. Returns a list that you should "".join. | |
letters = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","1","2","3","4","5","6","7","8","9","0"] | |
password = [] | |
for n in range(0,a): | |
item = random.choice(letters) | |
password.append(item) | |
return password | |
def createpasswordminigametest(): | |
jimmy = createpasswordminigame(3) | |
print(jimmy) | |
print("A three-letter password list indicates the function worked correctly.") | |
jimmyjon = "".join(jimmy) | |
print(jimmyjon) | |
print("A three-letter string indicates that the password has been successfully joined correctly.") | |
input("Function is now ending. Consider test successful if 3-character list and 3-character string were the same. ") | |
# addon code of november 2018 | |
def inventory(a): | |
#inventory shall be a way of tracking (printing) inventory. a should be an inventory list of strings. Currently only works with simple inventories and would not be good for large inventory systems. also returns a. | |
print("Your inventory contains:") | |
for i in a: | |
timer = random.choice([.25,.50,.75,1]) | |
time.sleep(timer) | |
print(i) | |
time.sleep(timer) | |
return a | |
def inventorytest(): | |
invent = ["sword","spear","chicken","disease"] | |
inventory(invent) | |
print("trying variables instead") | |
sword = "sword" | |
spear = "spear" | |
chicken = "chicken" | |
disease = "disease" | |
inventvar = [sword,spear,chicken,disease] | |
inventory(inventvar) | |
def healthprint(a,b,c): | |
#Accepts an integer for health, a, and a boolean, True or False, for "health is capped at c". returns a, the health, after capping it. to check for death, create a condition of if a <= 0. | |
xs = str(a) | |
if a > c and b == True: | |
a = c | |
elif a <= 0: | |
print("You have " + xs + " health.") | |
return a | |
else: | |
pass | |
xs = str(a) | |
print("You have " + xs + " health.") | |
return a | |
def healthprinttest(): | |
print("assuming -120 health") | |
currenthealth = healthprint(-120,True,100) | |
if currenthealth <= 0: | |
print("dead") | |
else: | |
print("not dead") | |
print("and returned") | |
print(currenthealth) | |
print("Assuming zero health"+" should read dead") | |
currenthealth = healthprint(0,True,100) | |
if currenthealth <= 0: | |
print("dead") | |
else: | |
print("not dead") | |
pass | |
print("and returned") | |
print(currenthealth) | |
print("assuming 50 health. should read proper health and half dead") | |
currenthealth = healthprint(50,True,100) | |
if currenthealth <= 0: | |
print("dead") | |
else: | |
print("not dead") | |
print("and returned") | |
print(currenthealth) | |
currenthealth = healthprint(120,True,100) | |
print("Simulating 120 health cap at 100") | |
if currenthealth <= 0: | |
print("dead ") | |
else: | |
print("not dead") | |
print("and returned") | |
print(currenthealth) | |
currenthealth = healthprint(120,False,100) | |
print("simulating 120 health no 100 cap") | |
if currenthealth <= 0: | |
print("dead") | |
else: | |
print("not dead") | |
print("and returned") | |
print(currenthealth) | |
print("test completed for health print") | |
def walletprint(a,b): | |
# accepts an integer, a, and a string, your currency name, b. also returns a. | |
xs = str(a) | |
print("You have " + xs + " " + b + ".") | |
return a | |
def walletprinttest(): | |
print("now going to test 100 of variable named cash and 100 of string that says cash") | |
cash = "cash" | |
walletprint(100,cash) | |
walletprint(100,"cash") | |
def gdpgrowth(a,b,c): | |
#accepts the amount of money of an authority, a, and grows it by c percent a year, make sure b is "day","month",or "year" note for best display use round on a final number. | |
if a < 0: | |
a = a * -1 | |
revert = True | |
else: | |
revert = False | |
pass | |
if b == "day": | |
perc = c / 365 | |
elif b == "week": | |
perc = c / 52 | |
elif b == "month": | |
perc = c / 12 | |
elif b == "year": | |
perc = c / 1 | |
else: | |
return "ERROR in Growth function c entry." | |
if b == "day": | |
x = a * perc | |
elif b == "week": | |
x = a * perc | |
elif b == "month": | |
x = a * perc | |
elif b == "year": | |
x = a * perc | |
else: | |
return "ERROR IN GDP GROWTH FUNCTION ENTRY of variable b" | |
if revert == True: | |
a = a * -1 | |
else: | |
pass | |
x += a | |
return x | |
def gdpdecline(a,b,c): | |
#takes a an integer and declines it by c, the decimal percent of growth per year based on b, day, month, year. use round to show results of a final number. | |
if a < 0: | |
a = a * -1 | |
revert = True | |
else: | |
revert = False | |
pass | |
if b == "day": | |
perc = c / 365 | |
elif b == "week": | |
perc = c / 52 | |
elif b == "month": | |
perc = c / 12 | |
elif b == "year": | |
perc = c / 1 | |
else: | |
return "ERROR in Growth function c entry." | |
if b == "day": | |
x = a * perc | |
elif b == "week": | |
x = a * perc | |
elif b == "month": | |
x = a * perc | |
elif b == "year": | |
x = a * perc | |
else: | |
return "ERROR IN GDP GROWTH FUNCTION ENTRY of variable b" | |
if revert == True: | |
a = a * -1 | |
else: | |
pass | |
x = a - x | |
return x | |
def gdpgrowthtest(): | |
# tests gdp decline also | |
print("all tests begin with 100 currency and a assume approximately 2 percent gdp growth over a quarter.") | |
print("Currency growth over 10 days.") | |
currency = 100 | |
for i in range(0,10): | |
print(currency) | |
currency = gdpgrowth(currency,"day",.08) | |
print(currency) | |
print("Currency growth over 10 months.") | |
currency = 100 | |
for i in range(0,10): | |
print(currency) | |
currency = gdpgrowth(currency,"month",.08) | |
print(currency) | |
print("Currency growth over 10 years.") | |
currency = 100 | |
for i in range(0,10): | |
print(currency) | |
currency = gdpgrowth(currency,"year",.08) | |
print(currency) | |
print("now testing gdp decline for 1000 years.") | |
currency = 100 | |
for i in range(0,1000): | |
print(currency) | |
currency = gdpdecline(currency,"year",.08) | |
currency = round(currency,2) | |
print(currency) | |
print("thousand year decline over.") | |
print("testing a thousand years of growth") | |
currency = 100 | |
for i in range(0,1000): | |
print(currency) | |
currency = gdpgrowth(currency,"year",.08) | |
currency = round(currency,2) | |
print(currency) | |
print("test starting from -100 currency") | |
currency = -100 | |
for i in range(0,10): | |
currency = gdpdecline(currency,"year",.08) | |
print(currency) | |
currency = None | |
print("end of the gdp decline and growth test.") | |
def mockblackjack(a): | |
# 8 decks in blackjack. | |
# 416 cards | |
# 32 aces. | |
# 32 2s | |
# 32 3s | |
# 32 4s | |
# 32 5s | |
# 32 6s | |
# 32 7s | |
# 32 8 | |
# 32 9 | |
# 32 10 | |
# 32 jack | |
# 32 queen | |
# 32 king | |
# a will be an integer, the number of games needed to return the function as a string. player or dealer. player means player won. | |
deck = 416 | |
ace = "ace" | |
two = "two" | |
three = "three" | |
four = "four" | |
five = "five" | |
six = "six" | |
seven = "seven" | |
eight = "eight" | |
nine = "nine" | |
ten = "ten" | |
jack = "jack" | |
queen = "queen" | |
king = "king" | |
aces = 32 | |
twos = 32 | |
threes = 32 | |
fours = 32 | |
fives = 32 | |
sixs = 32 | |
sevens = 32 | |
eights = 32 | |
nines = 32 | |
tens = 32 | |
jacks = 32 | |
queens = 32 | |
kings = 32 | |
checker = aces + twos + threes + fours + fives + sixs + sevens + eights + nines + tens + jacks + queens + kings | |
if checker == deck: | |
pass | |
else: | |
return "ERROR in number of cards" | |
dealergameswon = 0 | |
playergameswon = 0 | |
decklist = [ace,two,three,four,five,six,seven,eight,nine,ten,jack,queen,king] | |
while True: | |
dealerhasace = False | |
playerhasace = False | |
x = "card" | |
xs = 0 | |
if playergameswon == 1: | |
playeronee = "game" | |
else: | |
playeronee = "games" | |
if dealergameswon == 1: | |
playertwoo = "game" | |
else: | |
playertwoo = "games" | |
dealergameswonstring = str(dealergameswon) | |
playergameswonstring = str(playergameswon) | |
print("You have won " + playergameswonstring + " " + playeronee + ".") | |
time.sleep(1.5) | |
print("Dealer has won " + dealergameswonstring + " " + playertwoo + ".") | |
time.sleep(1.5) | |
if playergameswon == a: | |
return "player" | |
elif dealergameswon == a: | |
return "dealer" | |
else: | |
pass | |
if deck <= 30: | |
print("Shuffling deck.") | |
time.sleep(1.5) | |
deck = 416 | |
ace = "ace" | |
two = "two" | |
three = "three" | |
four = "four" | |
five = "five" | |
six = "six" | |
seven = "seven" | |
eight = "eight" | |
nine = "nine" | |
ten = "ten" | |
jack = "jack" | |
queen = "queen" | |
king = "king" | |
aces = 32 | |
twos = 32 | |
threes = 32 | |
fours = 32 | |
fives = 32 | |
sixs = 32 | |
sevens = 32 | |
eights = 32 | |
nines = 32 | |
tens = 32 | |
jacks = 32 | |
queens = 32 | |
kings = 32 | |
continue | |
else: | |
pass | |
print("Dealer drawing a card, face down.") | |
time.sleep(1.5) | |
x = random.choice(decklist) | |
if x == ace: | |
xs = aces | |
elif x == two: | |
xs = twos | |
elif x == three: | |
xs = threes | |
elif x == four: | |
xs = fours | |
elif x == five: | |
xs = fives | |
elif x == six: | |
xs = sixs | |
elif x == seven: | |
xs = sevens | |
elif x == eight: | |
xs = eights | |
elif x == nine: | |
xs = nines | |
elif x == ten: | |
xs = tens | |
elif x == jack: | |
xs = jacks | |
elif x == queen: | |
xs = queens | |
elif x == king: | |
xs = kings | |
else: | |
pass | |
return "error 2" | |
while xs <= 0: | |
x = random.choice(decklist) | |
if x == ace: | |
xs = aces | |
elif x == one: | |
xs = ones | |
elif x == two: | |
xs = twos | |
elif x == three: | |
xs = threes | |
elif x == four: | |
xs = fours | |
elif x == five: | |
xs = fives | |
elif x == six: | |
xs = sixs | |
elif x == seven: | |
xs = sevens | |
elif x == eight: | |
xs = eights | |
elif x == nine: | |
xs = nines | |
elif x == ten: | |
xs = tens | |
elif x == jack: | |
xs = jacks | |
elif x == queen: | |
xs = queens | |
elif x == king: | |
xs = kings | |
else: | |
return "error in choosing dealer card error 22" | |
deck -= 1 | |
if x == ace: | |
aces -= 1 | |
dealerfirstcard = ace | |
dealerscore = 11 | |
dealerhasace = True | |
elif x == two: | |
twos -= 1 | |
dealerfirstcard = two | |
dealerscore = 2 | |
elif x == three: | |
threes -= 1 | |
dealerfirstcard = three | |
dealerscore = 3 | |
elif x == four: | |
fours -= 1 | |
dealerfirstcard = four | |
dealerscore = 4 | |
elif x == five: | |
fives -= 1 | |
dealerfirstcard = five | |
dealerscore = 5 | |
elif x == six: | |
sixs -= 1 | |
dealerfirstcard = six | |
dealerscore = 6 | |
elif x == seven: | |
sevens -= 1 | |
dealerfirstcard = seven | |
dealerscore = 7 | |
elif x == eight: | |
eights -= 1 | |
dealerfirstcard = eight | |
dealerscore = 8 | |
elif x == nine: | |
nines -= 1 | |
dealerfirstcard = nine | |
dealerscore = 9 | |
elif x == ten: | |
tens -= 1 | |
dealerfirstcard = ten | |
dealerscore = 10 | |
elif x == jack: | |
jacks -= 1 | |
dealerfirstcard = jack | |
dealerscore = 10 | |
elif x == queen: | |
queens -= 1 | |
dealerfirstcard = queen | |
dealerscore = 10 | |
elif x == king: | |
kings -= 1 | |
dealerfirstcard = king | |
dealerscore = 10 | |
else: | |
return "ERROR in draw dealer first face down card. error 4." | |
print("Dealer dealing you a card, face up.") | |
time.sleep(1.5) | |
x = random.choice(decklist) | |
# marker for copy paste code | |
if x == ace: | |
xs = aces | |
elif x == two: | |
xs = twos | |
elif x == three: | |
xs = threes | |
elif x == four: | |
xs = fours | |
elif x == five: | |
xs = fives | |
elif x == six: | |
xs = sixs | |
elif x == seven: | |
xs = sevens | |
elif x == eight: | |
xs = eights | |
elif x == nine: | |
xs = nines | |
elif x == ten: | |
xs = tens | |
elif x == jack: | |
xs = jacks | |
elif x == queen: | |
xs = queens | |
elif x == king: | |
xs = kings | |
else: | |
pass | |
return "error 9" | |
while xs <= 0: | |
x = random.choice(decklist) | |
if x == ace: | |
xs = aces | |
elif x == one: | |
xs = ones | |
elif x == two: | |
xs = twos | |
elif x == three: | |
xs = threes | |
elif x == four: | |
xs = fours | |
elif x == five: | |
xs = fives | |
elif x == six: | |
xs = sixs | |
elif x == seven: | |
xs = sevens | |
elif x == eight: | |
xs = eights | |
elif x == nine: | |
xs = nines | |
elif x == ten: | |
xs = tens | |
elif x == jack: | |
xs = jacks | |
elif x == queen: | |
xs = queens | |
elif x == king: | |
xs = kings | |
else: | |
return "error in choosing dealer card error 22" | |
deck -= 1 | |
if x == ace: | |
aces -= 1 | |
playerfirstcard = ace | |
playerscore = 11 | |
playerhasace = True | |
elif x == two: | |
twos -= 1 | |
playerfirstcard = two | |
playerscore = 2 | |
elif x == three: | |
threes -= 1 | |
playerfirstcard = three | |
playerscore = 3 | |
elif x == four: | |
fours -= 1 | |
playerfirstcard = four | |
playerscore = 4 | |
elif x == five: | |
fives -= 1 | |
playerfirstcard = five | |
playerscore = 5 | |
elif x == six: | |
sixs -= 1 | |
playerfirstcard = six | |
playerscore = 6 | |
elif x == seven: | |
sevens -= 1 | |
playerfirstcard = seven | |
playerscore = 7 | |
elif x == eight: | |
eights -= 1 | |
playerfirstcard = eight | |
playerscore = 8 | |
elif x == nine: | |
nines -= 1 | |
playerfirstcard = nine | |
playerscore = 9 | |
elif x == ten: | |
tens -= 1 | |
playerfirstcard = ten | |
playerscore = 10 | |
elif x == jack: | |
jacks -= 1 | |
playerfirstcard = jack | |
playerscore = 10 | |
elif x == queen: | |
queens -= 1 | |
playerfirstcard = queen | |
playerscore = 10 | |
elif x == king: | |
kings -= 1 | |
playerfirstcard = king | |
playerscore = 10 | |
else: | |
return "I Am error 33" | |
if playerfirstcard == ace: | |
aan = "an" | |
else: | |
aan = "a" | |
playerscorestring = str(playerscore) | |
print("You have " + aan + " " + playerfirstcard + "." + " You have " + playerscorestring + ".") | |
aan = None | |
time.sleep(1.5) | |
print("Dealer is dealing a card, face up.") | |
# dealer second card comment marker | |
x = random.choice(decklist) | |
if x == ace: | |
xs = aces | |
elif x == two: | |
xs = twos | |
elif x == three: | |
xs = threes | |
elif x == four: | |
xs = fours | |
elif x == five: | |
xs = fives | |
elif x == six: | |
xs = sixs | |
elif x == seven: | |
xs = sevens | |
elif x == eight: | |
xs = eights | |
elif x == nine: | |
xs = nines | |
elif x == ten: | |
xs = tens | |
elif x == jack: | |
xs = jacks | |
elif x == queen: | |
xs = queens | |
elif x == king: | |
xs = kings | |
else: | |
pass | |
return "error 2" | |
while xs <= 0: | |
x = random.choice(decklist) | |
if x == ace: | |
xs = aces | |
elif x == one: | |
xs = ones | |
elif x == two: | |
xs = twos | |
elif x == three: | |
xs = threes | |
elif x == four: | |
xs = fours | |
elif x == five: | |
xs = fives | |
elif x == six: | |
xs = sixs | |
elif x == seven: | |
xs = sevens | |
elif x == eight: | |
xs = eights | |
elif x == nine: | |
xs = nines | |
elif x == ten: | |
xs = tens | |
elif x == jack: | |
xs = jacks | |
elif x == queen: | |
xs = queens | |
elif x == king: | |
xs = kings | |
else: | |
return "error in choosing dealer card error 22" | |
deck -= 1 | |
if x == ace: | |
aces -= 1 | |
dealersecondcard = ace | |
if dealerfirstcard == ace: | |
dealerscore += 1 | |
else: | |
dealerscore += 11 | |
worth = "unknown" | |
dealerhasace = True | |
elif x == two: | |
twos -= 1 | |
dealersecondcard = two | |
dealerscore += 2 | |
worth = "2" | |
elif x == three: | |
threes -= 1 | |
dealersecondcard = three | |
dealerscore += 3 | |
worth = "3" | |
elif x == four: | |
fours -= 1 | |
dealersecondcard = four | |
dealerscore += 4 | |
worth = "4" | |
elif x == five: | |
fives -= 1 | |
dealersecondcard = five | |
dealerscore += 5 | |
worth = "5" | |
elif x == six: | |
sixs -= 1 | |
dealersecondcard = six | |
dealerscore += 6 | |
worth = "6" | |
elif x == seven: | |
sevens -= 1 | |
dealersecondcard = seven | |
dealerscore += 7 | |
worth = "7" | |
elif x == eight: | |
eights -= 1 | |
dealersecondcard = eight | |
dealerscore += 8 | |
worth = "8" | |
elif x == nine: | |
nines -= 1 | |
dealersecondcard = nine | |
dealerscore += 9 | |
worth = "9" | |
elif x == ten: | |
tens -= 1 | |
dealersecondcard = ten | |
dealerscore += 10 | |
worth = "10" | |
elif x == jack: | |
jacks -= 1 | |
dealersecondcard = jack | |
dealerscore += 10 | |
worth = "10" | |
elif x == queen: | |
queens -= 1 | |
dealersecondcard = queen | |
dealerscore += 10 | |
worth = "10" | |
elif x == king: | |
kings -= 1 | |
dealersecondcard = king | |
dealerscore += 10 | |
worth = "10" | |
else: | |
return "ERROR in draw dealer first face down card. error 4." | |
print("Dealer shows a " + dealersecondcard + " worth " + worth + ".") | |
time.sleep(1.5) | |
print("Dealer is passing you your second card.") | |
time.sleep(1.5) | |
# marker for player second card | |
x = random.choice(decklist) | |
# marker for copy paste code | |
if x == ace: | |
xs = aces | |
elif x == two: | |
xs = twos | |
elif x == three: | |
xs = threes | |
elif x == four: | |
xs = fours | |
elif x == five: | |
xs = fives | |
elif x == six: | |
xs = sixs | |
elif x == seven: | |
xs = sevens | |
elif x == eight: | |
xs = eights | |
elif x == nine: | |
xs = nines | |
elif x == ten: | |
xs = tens | |
elif x == jack: | |
xs = jacks | |
elif x == queen: | |
xs = queens | |
elif x == king: | |
xs = kings | |
else: | |
pass | |
return "error 9" | |
while xs <= 0: | |
x = random.choice(decklist) | |
if x == ace: | |
xs = aces | |
elif x == one: | |
xs = ones | |
elif x == two: | |
xs = twos | |
elif x == three: | |
xs = threes | |
elif x == four: | |
xs = fours | |
elif x == five: | |
xs = fives | |
elif x == six: | |
xs = sixs | |
elif x == seven: | |
xs = sevens | |
elif x == eight: | |
xs = eights | |
elif x == nine: | |
xs = nines | |
elif x == ten: | |
xs = tens | |
elif x == jack: | |
xs = jacks | |
elif x == queen: | |
xs = queens | |
elif x == king: | |
xs = kings | |
else: | |
return "error in choosing dealer card error 22" | |
deck -= 1 | |
if x == ace: | |
aces -= 1 | |
playersecondcard = ace | |
if playerfirstcard == ace: | |
playerscore += 1 | |
else: | |
playerscore += 11 | |
playerhasace = True | |
elif x == two: | |
twos -= 1 | |
playersecondcard = two | |
playerscore += 2 | |
elif x == three: | |
threes -= 1 | |
playersecondcard = three | |
playerscore += 3 | |
elif x == four: | |
fours -= 1 | |
playersecondcard = four | |
playerscore += 4 | |
elif x == five: | |
fives -= 1 | |
playersecondcard = five | |
playerscore += 5 | |
elif x == six: | |
sixs -= 1 | |
playersecondcard = six | |
playerscore += 6 | |
elif x == seven: | |
sevens -= 1 | |
playersecondcard = seven | |
playerscore += 7 | |
elif x == eight: | |
eights -= 1 | |
playersecondcard = eight | |
playerscore += 8 | |
elif x == nine: | |
nines -= 1 | |
playersecondcard = nine | |
playerscore += 9 | |
elif x == ten: | |
tens -= 1 | |
playersecondcard = ten | |
playerscore += 10 | |
elif x == jack: | |
jacks -= 1 | |
playersecondcard = jack | |
playerscore += 10 | |
elif x == queen: | |
queens -= 1 | |
playersecondcard = queen | |
playerscore += 10 | |
elif x == king: | |
kings -= 1 | |
playersecondcard = king | |
playerscore += 10 | |
else: | |
return "I Am error 33" | |
if playersecondcard == ace: | |
aan = "an" | |
else: | |
aan = "a" | |
playerscorestring = str(playerscore) | |
print("You have " + aan + " " + playersecondcard + "." + " You have " + playerscorestring + ".") | |
aan = None | |
time.sleep(1.5) | |
# at this point in the game, both players have all four cards. | |
if dealerfirstcard == ace: | |
aan = "an" | |
else: | |
aan = "a" | |
dealerscorestring = str(dealerscore) | |
print("Dealer flips over dealer's first card, revealing " + aan + " " + dealerfirstcard + "." + " Dealer has " + dealerscorestring + ".") | |
aan = None | |
if playerscore == 21 and dealerscore == 21: | |
print("You and the dealer both have blackjack. Push!") | |
continue | |
elif playerscore == 21: | |
print("You have blackjack! You win!") | |
playergameswon += 1 | |
continue | |
elif dealerscore == 21: | |
print("Dealer has blackjack! Dealer wins!") | |
dealergameswon += 1 | |
continue | |
else: | |
pass | |
while True: | |
if playerscore > 21: | |
print("Bust. Dealer wins.") | |
time.sleep(1.5) | |
lost = True | |
break | |
else: | |
lost = False | |
print("You now have the option to stand or hit.") | |
decision = input() | |
if decision == "stand": | |
break | |
elif decision == "hit": | |
pass | |
#while Truebreak | |
# place hit logic fool | |
x = random.choice(decklist) | |
if x == ace: | |
xs = aces | |
elif x == two: | |
xs = twos | |
elif x == three: | |
xs = threes | |
elif x == four: | |
xs = fours | |
elif x == five: | |
xs = fives | |
elif x == six: | |
xs = sixs | |
elif x == seven: | |
xs = sevens | |
#while true break | |
elif x == eight: | |
xs = eights | |
elif x == nine: | |
xs = nines | |
elif x == ten: | |
xs = tens | |
elif x == jack: | |
xs = jacks | |
elif x == queen: | |
xs = queens | |
elif x == king: | |
xs = kings | |
else: | |
#while true break | |
return "hit or stand player error" | |
while xs <= 0: | |
x = random.choice(decklist) | |
if x == ace: | |
xs = aces | |
elif x == two: | |
xs = twos | |
elif x == three: | |
xs = threes | |
elif x == four: | |
xs = fours | |
elif x == five: | |
xs == fives | |
elif x == six: | |
xs = sixs | |
elif x == seven: | |
xs = sevens | |
elif x == eight: | |
#while true break | |
xs = eights | |
elif x == nine: | |
xs = nines | |
elif x == ten: | |
xs = tens | |
elif x == jack: | |
xs = jacks | |
elif x == queen: | |
xs = queens | |
elif x == king: | |
xs = kings | |
else: | |
return "error" | |
deck -= 1 | |
if x == ace: | |
playerpick = ace | |
if playerscore > 10: | |
playerscore += 1 | |
else: | |
playerscore += 11 | |
aces -= 1 | |
elif x == two: | |
playerpick = two | |
playerscore += 2 | |
twos -= 1 | |
elif x == three: | |
playerpick = three | |
playerscore += 3 | |
threes -= 1 | |
elif x == four: | |
playerpick = four | |
playerscore += 4 | |
fours -= 1 | |
elif x == five: | |
playerpick = five | |
playerscore += 5 | |
fives -= 1 | |
elif x == six: | |
playerpick = six | |
playerscore += 6 | |
sixs -= 1 | |
elif x == seven: | |
playerpick = seven | |
playerscore += 7 | |
sevens -= 1 | |
elif x == eight: | |
playerpick = eight | |
playerscore += 8 | |
eights -= 1 | |
elif x == nine: | |
playerpick = nine | |
playerscore += 9 | |
nines -= 1 | |
elif x == ten: | |
playerpick = ten | |
playerscore += 10 | |
tens -= 1 | |
elif x == jack: | |
playerpick = jack | |
playerscore += 10 | |
jacks -= 1 | |
elif x == queen: | |
playerpick = queen | |
playerscore += 10 | |
queens -= 1 | |
elif x == king: | |
playerpick = king | |
playerscore += 10 | |
kings | |
else: | |
return "Error." | |
playerscorestring = str(playerscore) | |
if playerpick == ace: | |
aan = "an" | |
else: | |
aan = "a" | |
print("You got " + aan + " "+ playerpick + "." + " You have " + playerscorestring + ".") | |
time.sleep(1.5) | |
aan = None | |
continue | |
else: | |
continue | |
if lost == True: | |
dealergameswon += 1 | |
continue | |
else: | |
pass | |
playerscorestring = str(playerscore) | |
dealerscorestring = str(dealerscore) | |
print("You have " + playerscorestring +".") | |
time.sleep(1.5) | |
print("Dealer has " + dealerscorestring + ".") | |
time.sleep(1.5) | |
print("Dealer is making a decision.") | |
time.sleep(1.5) | |
while True: | |
if dealerscore > 21: | |
print("Dealer busts. Player wins.") | |
time.sleep(1.5) | |
playergameswon += 1 | |
break | |
else: | |
pass | |
if dealerscore < playerscore and dealerscore > 17: | |
print("Dealer stands at 17 or higher. Player wins.") | |
time.sleep(1.5) | |
playergameswon += 1 | |
break | |
elif dealerscore > 21: | |
print("Dealer busts. Player wins.") | |
time.sleep(1.5) | |
playergameswon += 1 | |
break | |
elif dealerscore > playerscore: | |
print("Dealer score is higher. Dealer wins.") | |
time.sleep(1.5) | |
dealergameswon += 1 | |
break | |
elif dealerscore == playerscore: | |
print("Dealer and player have identical scores. Push!") | |
time.sleep(1.5) | |
break | |
else: | |
print("Dealer draws a card.") | |
x = random.choice(decklist) | |
if x == ace: | |
xs = aces | |
elif x == two: | |
xs = twos | |
elif x == three: | |
xs = threes | |
elif x == four: | |
xs = fours | |
elif x == five: | |
xs = fives | |
elif x == six: | |
xs = sixs | |
elif x == seven: | |
xs = sevens | |
elif x == eight: | |
xs = eights | |
elif x == nine: | |
xs = nines | |
elif x == ten: | |
xs = tens | |
elif x == jack: | |
xs = jacks | |
elif x == queen: | |
xs = queens | |
elif x == king: | |
xs = kings | |
else: | |
return "error" | |
while xs <= 0: | |
x = random.choice(decklist) | |
if x == ace: | |
xs = aces | |
elif x == two: | |
xs = twos | |
elif x == three: | |
xs = threes | |
elif x == four: | |
xs = fours | |
elif x == five: | |
xs = fives | |
elif x == six: | |
xs = sixs | |
elif x == seven: | |
xs = sevens | |
elif x == eight: | |
xs = eights | |
elif x == nine: | |
xs = nines | |
elif x == ten: | |
xs = tens | |
elif x == jack: | |
xs = jacks | |
elif x == queen: | |
xs = queens | |
elif x == king: | |
xs = kings | |
else: | |
return "error" | |
deck -= 1 | |
if x == ace: | |
dealerpick = ace | |
if dealerscore > 10: | |
dealerscore += 1 | |
else: | |
dealerscore += 11 | |
aces -= 1 | |
elif x == two: | |
dealerpick = two | |
dealerscore += 2 | |
twos -= 1 | |
elif x == three: | |
dealerpick = three | |
dealerscore += 3 | |
threes -= 1 | |
elif x == four: | |
dealerpick = four | |
dealerscore += 4 | |
fours -= 1 | |
elif x == five: | |
dealerpick = five | |
dealerscore += 5 | |
fives -= 1 | |
elif x == six: | |
dealerpick = six | |
dealerscore += 6 | |
sixs -= 1 | |
elif x == seven: | |
dealerpick = seven | |
dealerscore += 7 | |
sevens -= 1 | |
elif x == eight: | |
dealerpick = eight | |
dealerscore += 8 | |
eights -= 1 | |
elif x == nine: | |
dealerpick = nine | |
dealerscore += 9 | |
nines -= 1 | |
elif x == ten: | |
dealerpick = ten | |
dealerscore += 10 | |
tens -= 1 | |
elif x == jack: | |
dealerpick = jack | |
dealerscore += 10 | |
jacks -= 1 | |
elif x == queen: | |
dealerpick = queen | |
dealerscore += 10 | |
queens -= 1 | |
elif x == king: | |
dealerpick = king | |
dealerscore += 10 | |
kings -= 1 | |
else: | |
return "error" | |
if dealerpick == ace: | |
aan = "an" | |
else: | |
aan = "a" | |
print("Dealer draws a " + dealerpick + ". ") | |
time.sleep(1.5) | |
dealerscorestring = str(dealerscore) | |
playerscorestring = str(playerscore) | |
print("Dealer has " + dealerscorestring + ".") | |
time.sleep(1.5) | |
print("Player has " + playerscorestring + ".") | |
time.sleep(1.5) | |
continue | |
# all game wins should resolve before this continue | |
continue | |
def mockblackjacktest(): | |
print("test seven games of blackjack returns result") | |
x = mockblackjack(7) | |
print(x) | |
print("test over") | |
# This test suite can be used to test all functions in the pack. | |
def testsuite(): | |
choicestest() | |
createcharactertest() | |
createpasswordminigametest() | |
inventorytest() | |
healthprinttest() | |
walletprinttest() | |
gdpgrowthtest() | |
mockblackjacktest() | |
testSTPH = False | |
if testSTPH == True: | |
testsuite() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment