Files
Whiskerbound/systems/world.py

27 lines
724 B
Python

from data.cat import Cat
import systems.ui as ui
import re
def check_cat_name(name):
name = name.strip()
if not name:
return "Please choose a name:"
if len(name) > 4 or len(name) < 20:
return "Please choose a name greater than 4 charecters and less than 20:"
if re.search(r"[^a-zA-Z \-']", name):
return "Please only use letters, spaces, hyphens and apostrophes:"
return "Ok"
def shelter():
# TODO: make
name = ui.text("Welcome to the shelter! Please choose a name for your cat:")
while True:
check_result = check_cat_name(name)
if check_result != "Ok":
name = ui.text(check_result)
else:
break
return Cat(name)