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,48 +148,52 @@
"Submarine Ride"
],
"stalls": {
"Fruity Ices Stall": "Fruity Ice",
"Chip Shop": "Chips",
"Pizza Stall": "Pizza",
"Burger Bar": "Burger",
"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",
"Funnel Cake Shop": "Funnel Cake",
"Ice Cream Cone Stall": "Ice Cream Cone",
"Meatball Soup Stall": "Meatball Soup",
"Pretzel Stall": "Pretzel",
"Roast Sausage Stall": "Roast Sausage",
"Sub Sandwich Stall": "Sub Sandwich",
"Wonton Soup Stall": "Wonton Soup",
"Hot Chocolate Stall": "Hot Chocolate",
"Iced Tea Stall": "Iced Tea",
"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",
"Soft Toy Stall": "Cuddly Toy"
"edible": {
"Fruity Ices Stall": "Fruity Ice",
"Chip Shop": "Chips",
"Pizza Stall": "Pizza",
"Burger Bar": "Burger",
"Drinks Stall": "Drink",
"Candyfloss Stall": "Candyfloss",
"Popcorn Stall": "Popcorn",
"Hot Dog Stall": "Hot Dog",
"Sea Food Stall": "Fried Tentacle",
"Toffee Apple Stall": "Toffee Apple",
"Fried Chicken Stall": "Fried Chicken",
"Coffee Shop": "Coffee",
"Lemonade Stall": "Lemonade",
"Doughnut Shop": "Doughnut",
"Beef Noodles Stall": "Beef Noodles",
"Chicken Nuggets Stall": "Chicken Nuggets",
"Fried Rice Noodles Stall": "Fried Rice Noodles",
"Funnel Cake Shop": "Funnel Cake",
"Ice Cream Cone Stall": "Ice Cream Cone",
"Meatball Soup Stall": "Meatball Soup",
"Pretzel Stall": "Pretzel",
"Roast Sausage Stall": "Roast Sausage",
"Sub Sandwich Stall": "Sub Sandwich",
"Wonton Soup Stall": "Wonton Soup",
"Hot Chocolate Stall": "Hot Chocolate",
"Iced Tea Stall": "Iced Tea",
"Soybean Milk Stall": "Soybean Milk",
"Star Fruit Drink Stall": "Star Fruit Drink",
"Sujeonggwa Stall": "Sujeonggwa",
"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"
},
"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)