removespace

master
Ada Varriale 2 years ago
parent 27f0f284b4
commit 342626b281

@ -7,28 +7,38 @@ import random
#Read the game name list from the games.txt file #Read the game name list from the games.txt file
#Make a game name list #Make a game name list
gamenames = open("text/games.txt").read().split("\n") gamenames = open("text/games.txt").read().split("\n")
print(type(gamenames)) #print(type(gamenames))
print(gamenames) #print(gamenames)
#Read the verbs list from the verbs.txt file #Read the verbs list from the verbs.txt file
#Make a verbs list #Make a verbs list
verbs = open("text/verbs.txt").read().split("\n") verbs = open("text/verbs.txt").read().split("\n")
print(type(verbs)) #print(type(verbs))
print(verbs) #print(verbs)
#Read the objects list from the objects.txt file #Read the objects list from the objects.txt file
#Make a objects list #Make a objects list
objects = open("text/object.txt").read().split("\n") objects = open("text/object.txt").read().split("\n")
print(type(objects)) def spaceremover (defspace):
print(objects) for object in defspace:
if object == "":
defspace.remove("")
return defspace
objects = spaceremover(objects)
verbs = spaceremover(verbs)
gamenames = spaceremover(gamenames)
#print(type(objects))
#print(objects)
#object = ["teammate", "card", "turn", "place", "board", "dice", "nice", "backgammon"] #object = ["teammate", "card", "turn", "place", "board", "dice", "nice", "backgammon"]
#verb = ["choose", "pick", "give", "burn", "cut"] #verb = ["choose", "pick", "give", "burn", "cut"]
#Then it writes a title #Then it writes a title
print("How to play " + random.choice(gamenames)) print(" " *10+"How to play " + random.choice(gamenames))
print("~*"*30)
#Then it loops through instructions #Then it loops through instructions
for i in range(6): for i in range(6):
print("Rule " + str(i+1) + ": "+ random.choice(verbs) + " a " + random.choice(objects)) print(" " *10+"Rule " + str(i+1) + ": "+ random.choice(verbs) + " a " + random.choice(objects))

Loading…
Cancel
Save