A lot
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
class Cat:
|
||||
def __init__(self, name):
|
||||
def __init__(self, name, traits):
|
||||
self.name = name
|
||||
self.traits = traits
|
||||
|
||||
def to_dict(self):
|
||||
return vars(self)
|
||||
|
||||
19
data/save.py
Normal file
19
data/save.py
Normal file
@@ -0,0 +1,19 @@
|
||||
import json
|
||||
from data.cat import Cat
|
||||
|
||||
|
||||
class SaveData:
|
||||
def __init__(self, cat, money=100):
|
||||
self.cat = cat
|
||||
self.money = money
|
||||
|
||||
|
||||
def save(cat):
|
||||
with open(f"{cat.name}.kitten", "w") as f:
|
||||
json.dump(cat.to_dict(), f)
|
||||
|
||||
|
||||
def load(filepath):
|
||||
with open(filepath) as f:
|
||||
raw = json.load(f)
|
||||
return Cat(**raw)
|
||||
31
data/text.py
Normal file
31
data/text.py
Normal file
@@ -0,0 +1,31 @@
|
||||
CAT_COLORS = [
|
||||
"orange tabby",
|
||||
"black",
|
||||
"white",
|
||||
"gray",
|
||||
"tuxedo",
|
||||
"calico",
|
||||
"tortoiseshell",
|
||||
"siamese",
|
||||
"brown tabby",
|
||||
"ginger",
|
||||
]
|
||||
CAT_SIZES = [
|
||||
"tiny",
|
||||
"small",
|
||||
"average sized",
|
||||
"big",
|
||||
"chonky",
|
||||
]
|
||||
CAT_PERSONALITIES = [
|
||||
"looks like trouble",
|
||||
"judges you silently",
|
||||
"won't stop meowing",
|
||||
"seems half asleep",
|
||||
"is staring at the wall",
|
||||
"purrs endlessly",
|
||||
"already knocked everything over",
|
||||
"needs food right now",
|
||||
"just wants to be somewhere else",
|
||||
]
|
||||
CAT_EYE_COLORS = ["green", "yellow", "blue", "orange"]
|
||||
Reference in New Issue
Block a user