This commit is contained in:
2026-06-25 16:02:01 -04:00
parent c1a5361255
commit f61889195c
6 changed files with 82 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
from untitled import ui
from untitled.screens import shop
from untitled.screens import shop, work
def options():
@@ -14,6 +14,8 @@ def options():
def go_to(save):
match ui.select("Where do you want to go?", ["The shop", "Back"]):
match ui.select("Where do you want to go?", ["The shop", "Work", "Back"]):
case "The shop":
shop.shop(save)
case "Work":
work.work(save)

View File

@@ -14,7 +14,7 @@ def house(save: model.Save):
case "Check on your cat":
rules.reconcile(save.cat, time.time())
print(
f"{save.cat.name}, {generation.generate_trait_sentence(save.cat.traits).lower()}\nFullness: {round(save.cat.fullness,1)}\nHappiness: {round(save.cat.happiness,1)}"
f"{save.cat.name}, {generation.generate_trait_sentence(save.cat.traits).lower()}\nFullness: {round(save.cat.fullness,1)}\nHappiness: {round(save.cat.happiness,1)}\nMoney: {save.player.money}"
)
case "Feed your cat":
rules.reconcile(save.cat, time.time())

51
untitled/screens/work.py Normal file
View File

@@ -0,0 +1,51 @@
import random
import string
import time
from untitled import content, rules, ui
def work(save):
length = content.WORK_START_LETTERS
total_earned = 0
lost = False
print("Welcome to work!")
print("The rules:")
print(
"Each round, a string of letters will appear, when it says go, type them from memory. If you miss one, you lose, each round gets more money."
)
if not ui.confirm("Would you like to start?"):
return
for i in range(3, 0, -1):
print(i)
time.sleep(1)
ui.clear()
print("Start!")
while not lost:
seconds = 1 + (length * 0.5)
letters = random.choices(string.ascii_lowercase, k=length)
print(f"Round {len(letters)-1}")
print("Memorize:", " ".join(letters))
for i in range(round(seconds), 0, -1):
print(i)
time.sleep(1)
ui.clear()
print(f"Round {len(letters)-1}")
print("Type!")
for letter in letters:
key = ui.getch().lower()
print(key, end=" ", flush=True)
if key != letter:
print(f"\nThe correct key was: {letter}")
lost = True
break
if not lost:
total_earned += content.WORK_EARN_PER_ROUND
print("\nCorrect!")
time.sleep(1)
ui.clear()
length += 1
rules.earn(save.player, total_earned)
print(
f"Game finished! You earned ${total_earned}, you now have ${save.player.money}!"
)