finish thought generation
This commit is contained in:
parent
2fc0c32511
commit
589fd4fe1c
2 changed files with 26 additions and 5 deletions
|
@ -51,12 +51,12 @@
|
|||
"I can't afford {}.",
|
||||
"I'm not paying that much for {}!"
|
||||
],
|
||||
"items-other": [
|
||||
"I've already got a {}."
|
||||
],
|
||||
"items-edible": [
|
||||
"I've not finished my {} yet."
|
||||
],
|
||||
"items-other": [
|
||||
"I've already got a {}."
|
||||
],
|
||||
"stalls": [
|
||||
"I can't find {}!"
|
||||
],
|
||||
|
|
25
post.py
25
post.py
|
@ -39,6 +39,23 @@ def get_object(kind):
|
|||
return "{} {}".format(random.choice(data['objects']['thrilling-rides'] + data['objects']['gentle-rides']), num)
|
||||
elif kind in ["gentle-rides", "thrilling-rides"]:
|
||||
return "{} {}".format(random.choice(data['objects'][kind]), num)
|
||||
elif kind == "items":
|
||||
return random.choice(list(data['objects']['stalls']['edible'].values()) + list(data['objects']['stalls']['other'].values()))
|
||||
elif kind == "items-edible":
|
||||
return random.choice(list(data['objects']['stalls']['edible'].values()))
|
||||
elif kind == "items-other":
|
||||
return random.choice(list(data['objects']['stalls']['other'].values()))
|
||||
elif kind == "stalls":
|
||||
return "{} {}".format(random.choice(list(data['objects']['stalls']['edible'].keys()) + list(data['objects']['stalls']['other'].keys())), num)
|
||||
elif kind == "item-stall":
|
||||
stalls_weighted = []
|
||||
for key in data['objects']['stalls']:
|
||||
for i in range(len(data['objects']['stalls'][key])):
|
||||
stalls_weighted.append(key)
|
||||
stall_type = random.choice(stalls_weighted)
|
||||
choice = random.choice(list(data['objects']['stalls'][stall_type].items()))[::-1]
|
||||
stall = "{} {}".format(choice[1], num)
|
||||
return (choice[0], stall)
|
||||
|
||||
thoughts_weighted = []
|
||||
for key in data['thoughts']:
|
||||
|
@ -46,11 +63,15 @@ for key in data['thoughts']:
|
|||
thoughts_weighted.append(key)
|
||||
|
||||
thought_type = random.choice(thoughts_weighted)
|
||||
thought_type = "rides"
|
||||
|
||||
thought = random.choice(data['thoughts'][thought_type])
|
||||
|
||||
if thought_type in ['rides', 'gentle-rides', 'thrilling-rides']:
|
||||
if thought_type == "plain":
|
||||
pass
|
||||
elif thought_type == "item-stall":
|
||||
objects = get_object(thought_type)
|
||||
thought = thought.format(objects[0], objects[1])
|
||||
else:
|
||||
thought = thought.format(get_object(thought_type))
|
||||
|
||||
print(thought)
|
||||
|
|
Loading…
Reference in a new issue