From 9d14bc56b2b5caa799c9c42ca6074ac26ef759df Mon Sep 17 00:00:00 2001 From: lockeshor Date: Tue, 6 Oct 2026 23:56:14 -0400 Subject: [PATCH] fill out creatures file and implement loadCreatures --- ai_prompts/2.txt | 9 +++++++++ creatures.tsv | 22 +++++++++++----------- main.py | 19 +++++++++++++++++-- 3 files changed, 37 insertions(+), 13 deletions(-) create mode 100644 ai_prompts/2.txt diff --git a/ai_prompts/2.txt b/ai_prompts/2.txt new file mode 100644 index 0000000..79b5718 --- /dev/null +++ b/ai_prompts/2.txt @@ -0,0 +1,9 @@ +############################################### +Prompt to Kiro AI (Default): + + + +Response: + + +############################################### \ No newline at end of file diff --git a/creatures.tsv b/creatures.tsv index ddaea2b..b9871f3 100644 --- a/creatures.tsv +++ b/creatures.tsv @@ -1,11 +1,11 @@ -name description price sprite-file difficulty length weight -The Rainbow Fish -Pufferfish -Turtle -Shrimp -Lobster -Aubrey Fish Requested by the artist, my girlfriend. -Hammerhead Shark -Koi Fish -One Fish Two Fish Red Fish Blue Fish Yes, you caught a book. -Bone Fish \ No newline at end of file +name description price sprite-file difficulty length (in) weight (lbs) +The Rainbow Fish The friendliest fish from our childhood 120 rainbow-fish.png 90 8.2 1.4 +Pufferfish yeeeeowwwch!! 56 pufferfish.png 50 6.8 3.1 +Turtle "Give me some fin. Noggin. Duuuude." - Crush, Finding Nemo 30 turtle.png 40 72 180 +Shrimp Yeah, I'm a little small. Whaddaboutit? 18 shrimp.png 20 0.7 0.2 +Lobster ROCK LOBSTERRRR OOOO OOOH 82 lobster.png 80 13.3 4.5 +Aubrey Fish Requested by the artist, my girlfriend. 65 aubrey-fish.png 60 4.3 1.9 +Hammerhead Shark Great for building a shed. Not so great in the ocean 150 hammerhead.png 100 120 560 +Koi Fish WHO'S HOUSE?? MUDGE HOUSE!! 26 mudge-fish.png 20 10.4 1.6 +One Fish Two Fish Red Fish Blue Fish Yes, you caught a book. 66 book.png 70 8.5 2 +Bone Fish He must have needed saltwater... 12 bone-fish.png 10 16.1 0.8 \ No newline at end of file diff --git a/main.py b/main.py index cc7ad79..fe0662f 100644 --- a/main.py +++ b/main.py @@ -19,14 +19,29 @@ from cmu_graphics import * # the data source (TSV path, save path) can change without touching gameplay. # ============================================================================= -def loadCreatures(path): +def loadCreatures(path="creatures.tsv"): # Read creatures.tsv (tab-separated) and parse it into a usable structure. # Suggested return: a list of dicts, one per creature, with keys matching # the header row: name, description, price, sprite-file, difficulty, # length, weight. Convert numeric columns (price, difficulty, length, # weight) from strings to int/float here; leave missing fields as sensible # defaults so partially-filled rows (like the current TSV) don't crash. - pass + creatures = [] + with open(path) as f: + lines = f.readlines() + for line in lines[1:]: #ignore header + data = line.split("\t") + creatures.append({ + "name": data[0], + "description": data[1], + "price": float(data[2]), + "sprite-file": data[3], + "difficulty": int(data[4]), + "length": float(data[5]), #inches + "weight": float(data[6]) #pounds + }) + + return creatures def loadSave(path):