restructured data.json to differentiate edible and regular items

This commit is contained in:
Lynne Megido 2019-07-20 08:33:12 +10:00
parent 556bcefa33
commit 2fc0c32511
2 changed files with 56 additions and 45 deletions

View File

@ -48,10 +48,15 @@
"I want to go on something more thrilling than {}."
],
"items": [
"I've already got a {}.",
"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."
],
"stalls": [
"I can't find {}!"
],
@ -143,6 +148,7 @@
"Submarine Ride"
],
"stalls": {
"edible": {
"Fruity Ices Stall": "Fruity Ice",
"Chip Shop": "Chips",
"Pizza Stall": "Pizza",
@ -150,18 +156,13 @@
"Drinks Stall": "Drink",
"Candyfloss Stall": "Candyfloss",
"Popcorn Stall": "Popcorn",
"Balloon Stall": "Balloon",
"Souvenir Stall": "Cuddly Toy",
"Information Kiosk": "Park Map",
"Hot Dog Stall": "Hot Dog",
"Sea Food Stall": "Fried Tentacle",
"Toffee Apple Stall": "Toffee Apple",
"Hat Stall": "Hat",
"Fried Chicken Stall": "Fried Chicken",
"Coffee Shop": "Coffee",
"Lemonade Stall": "Lemonade",
"Doughnut Shop": "Doughnut",
"T-Shirt Stall": "T-Shirt",
"Beef Noodles Stall": "Beef Noodles",
"Chicken Nuggets Stall": "Chicken Nuggets",
"Fried Rice Noodles Stall": "Fried Rice Noodles",
@ -177,14 +178,22 @@
"Soybean Milk Stall": "Soybean Milk",
"Star Fruit Drink Stall": "Star Fruit Drink",
"Sujeonggwa Stall": "Sujeonggwa",
"Sunglasses Stall": "Sunglasses",
"Art Deco Food Stall": "Noodles",
"Neptune's Seafood Stall": "Tentacles",
"Toffee Apple Market Stall": "Toffee Apple",
"Witches Brew Soup": "Wonton Soup",
"Lemonade Market Stall": "Lemonade",
"Moon Juice": "Moon Juice",
"Moon Juice": "Moon Juice"
},
"other": {
"Balloon Stall": "Balloon",
"Souvenir Stall": "Cuddly Toy",
"Information Kiosk": "Park Map",
"Hat Stall": "Hat",
"T-Shirt Stall": "T-Shirt",
"Sunglasses Stall": "Sunglasses",
"Soft Toy Stall": "Cuddly Toy"
}
}
}
}

View File

@ -37,6 +37,8 @@ def get_object(kind):
num = random.choice([1, 1, 1, 1, 1, 2, 2, 3])
if kind == "rides":
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)
thoughts_weighted = []
for key in data['thoughts']:
@ -48,7 +50,7 @@ thought_type = "rides"
thought = random.choice(data['thoughts'][thought_type])
if thought_type == "rides":
thought = thought.format(get_object('rides'))
if thought_type in ['rides', 'gentle-rides', 'thrilling-rides']:
thought = thought.format(get_object(thought_type))
print(thought)