Compare commits

..

2 Commits

Author SHA1 Message Date
13b8cd4b5e fix 2026-06-24 12:57:22 -04:00
47d2d7bc67 lot 2026-06-24 12:57:21 -04:00
7 changed files with 62 additions and 15 deletions

3
.gitignore vendored
View File

@@ -12,4 +12,5 @@ wheels/
# CUSTOM STUFF
untitled/saves
.ruff_cache
.pytest_cache
.pytest_cache
DEBUG_MODE

20
tests/test_generation.py Normal file
View File

@@ -0,0 +1,20 @@
from untitled import generation
def test_cat_description_gen():
traits_a = {
"size": "tiny",
"color": "tuxedo",
"eyes": "blue",
"personality": "judges you silently",
}
traits_an = {
"size": "average sized",
"color": "tuxedo",
"eyes": "blue",
"personality": "judges you silently",
}
a = "A tiny tuxedo kitten with blue eyes who judges you silently"
an = "An average sized tuxedo kitten with blue eyes who judges you silently"
assert generation.generate_trait_sentence(traits_a) == a
assert generation.generate_trait_sentence(traits_an) == an

View File

@@ -1,3 +1,4 @@
import os
import time
from untitled import content, screens, ui
@@ -5,13 +6,14 @@ from untitled import content, screens, ui
class App:
def __init__(self):
pass
self.debug = os.path.exists("DEBUG_MODE")
def run(self):
# Intro
ui.clear()
time.sleep(1)
ui.splash()
if not self.debug:
ui.clear()
time.sleep(1)
ui.splash()
# Main Menu
while True: # forEVER!... forEVER!... forEVER!... forEVER!...

View File

@@ -3,19 +3,24 @@ import random
from untitled import content
def generate_trait_sentence(traits):
article = "An" if traits["size"][0] in "aeiou" else "A"
description = f"{article} {traits["size"]} {traits["color"]} kitten with {traits["eyes"]} eyes who {traits["personality"]}"
return description
def generate_cat_choice(personality=None):
size = random.choice(content.CAT_SIZES)
color = random.choice(content.CAT_COLORS)
eyes = random.choice(content.CAT_EYE_COLORS)
personality = personality or random.choice(content.CAT_PERSONALITIES)
article = "An" if size[0] in "aeiou" else "A"
description = f"{article} {size} {color} kitten with {eyes} eyes who {personality}"
return description, {
traits = {
"size": size,
"color": color,
"eyes": eyes,
"personality": personality,
}
return generate_trait_sentence(traits), traits
def generate_cat_choices(n=5):

12
untitled/rules.py Normal file
View File

@@ -0,0 +1,12 @@
import string
def validate_cat_name(name):
ALLOWED = set(string.ascii_letters + string.digits)
if len(name) < 4 or len(name) > 24:
return "Your cat's name must be 4-24 characters long."
if not all(c in ALLOWED for c in name):
return "Letters and numbers only."
if not any(c in string.ascii_letters for c in name):
return "Your cat's name needs at least 1 letter."

View File

@@ -3,10 +3,13 @@ from untitled import generation, ui
def adoption():
print("Welcome to the shelter!")
choice = "Reroll"
while choice == "Reroll":
choices = generation.generate_cat_choices()
choice = ui.select(
"Please choose a cat to adopt!",
list(ui.Choice(cat[0], cat[1]) for cat in choices) + ["Reroll"],
)
name = None
while not name:
choice = "Reroll"
while choice == "Reroll":
choices = generation.generate_cat_choices()
choice = ui.select(
"Please choose a cat to adopt:",
[ui.Choice(cat[0], cat[1]) for cat in choices] + ["Reroll"],
)
name = ui.text("Please choose a name for your cat:")

View File

@@ -38,3 +38,7 @@ def splash():
def select(title, options):
return questionary.select(title, options).ask()
def text(title):
return questionary.text(title).ask()