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 {}." "I want to go on something more thrilling than {}."
], ],
"items": [ "items": [
"I've already got a {}.",
"I can't afford {}.", "I can't afford {}.",
"I'm not paying that much for {}!" "I'm not paying that much for {}!"
], ],
"items-other": [
"I've already got a {}."
],
"items-edible": [
"I've not finished my {} yet."
],
"stalls": [ "stalls": [
"I can't find {}!" "I can't find {}!"
], ],
@ -143,48 +148,52 @@
"Submarine Ride" "Submarine Ride"
], ],
"stalls": { "stalls": {
"Fruity Ices Stall": "Fruity Ice", "edible": {
"Chip Shop": "Chips", "Fruity Ices Stall": "Fruity Ice",
"Pizza Stall": "Pizza", "Chip Shop": "Chips",
"Burger Bar": "Burger", "Pizza Stall": "Pizza",
"Drinks Stall": "Drink", "Burger Bar": "Burger",
"Candyfloss Stall": "Candyfloss", "Drinks Stall": "Drink",
"Popcorn Stall": "Popcorn", "Candyfloss Stall": "Candyfloss",
"Balloon Stall": "Balloon", "Popcorn Stall": "Popcorn",
"Souvenir Stall": "Cuddly Toy", "Hot Dog Stall": "Hot Dog",
"Information Kiosk": "Park Map", "Sea Food Stall": "Fried Tentacle",
"Hot Dog Stall": "Hot Dog", "Toffee Apple Stall": "Toffee Apple",
"Sea Food Stall": "Fried Tentacle", "Fried Chicken Stall": "Fried Chicken",
"Toffee Apple Stall": "Toffee Apple", "Coffee Shop": "Coffee",
"Hat Stall": "Hat", "Lemonade Stall": "Lemonade",
"Fried Chicken Stall": "Fried Chicken", "Doughnut Shop": "Doughnut",
"Coffee Shop": "Coffee", "Beef Noodles Stall": "Beef Noodles",
"Lemonade Stall": "Lemonade", "Chicken Nuggets Stall": "Chicken Nuggets",
"Doughnut Shop": "Doughnut", "Fried Rice Noodles Stall": "Fried Rice Noodles",
"T-Shirt Stall": "T-Shirt", "Funnel Cake Shop": "Funnel Cake",
"Beef Noodles Stall": "Beef Noodles", "Ice Cream Cone Stall": "Ice Cream Cone",
"Chicken Nuggets Stall": "Chicken Nuggets", "Meatball Soup Stall": "Meatball Soup",
"Fried Rice Noodles Stall": "Fried Rice Noodles", "Pretzel Stall": "Pretzel",
"Funnel Cake Shop": "Funnel Cake", "Roast Sausage Stall": "Roast Sausage",
"Ice Cream Cone Stall": "Ice Cream Cone", "Sub Sandwich Stall": "Sub Sandwich",
"Meatball Soup Stall": "Meatball Soup", "Wonton Soup Stall": "Wonton Soup",
"Pretzel Stall": "Pretzel", "Hot Chocolate Stall": "Hot Chocolate",
"Roast Sausage Stall": "Roast Sausage", "Iced Tea Stall": "Iced Tea",
"Sub Sandwich Stall": "Sub Sandwich", "Soybean Milk Stall": "Soybean Milk",
"Wonton Soup Stall": "Wonton Soup", "Star Fruit Drink Stall": "Star Fruit Drink",
"Hot Chocolate Stall": "Hot Chocolate", "Sujeonggwa Stall": "Sujeonggwa",
"Iced Tea Stall": "Iced Tea", "Art Deco Food Stall": "Noodles",
"Soybean Milk Stall": "Soybean Milk", "Neptune's Seafood Stall": "Tentacles",
"Star Fruit Drink Stall": "Star Fruit Drink", "Toffee Apple Market Stall": "Toffee Apple",
"Sujeonggwa Stall": "Sujeonggwa", "Witches Brew Soup": "Wonton Soup",
"Sunglasses Stall": "Sunglasses", "Lemonade Market Stall": "Lemonade",
"Art Deco Food Stall": "Noodles", "Moon Juice": "Moon Juice"
"Neptune's Seafood Stall": "Tentacles", },
"Toffee Apple Market Stall": "Toffee Apple", "other": {
"Witches Brew Soup": "Wonton Soup", "Balloon Stall": "Balloon",
"Lemonade Market Stall": "Lemonade", "Souvenir Stall": "Cuddly Toy",
"Moon Juice": "Moon Juice", "Information Kiosk": "Park Map",
"Soft Toy Stall": "Cuddly Toy" "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]) num = random.choice([1, 1, 1, 1, 1, 2, 2, 3])
if kind == "rides": if kind == "rides":
return "{} {}".format(random.choice(data['objects']['thrilling-rides'] + data['objects']['gentle-rides']), num) 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 = [] thoughts_weighted = []
for key in data['thoughts']: for key in data['thoughts']:
@ -48,7 +50,7 @@ thought_type = "rides"
thought = random.choice(data['thoughts'][thought_type]) thought = random.choice(data['thoughts'][thought_type])
if thought_type == "rides": if thought_type in ['rides', 'gentle-rides', 'thrilling-rides']:
thought = thought.format(get_object('rides')) thought = thought.format(get_object(thought_type))
print(thought) print(thought)