Files
Untitled-Cat-Game/untitled/rules.py
2026-06-24 17:26:03 -04:00

16 lines
629 B
Python

import string
def validate_cat_name(name, auto_gen=False):
ALLOWED = set(string.ascii_letters + string.digits)
if not auto_gen:
if len(name) < 4 or len(name) > 24:
return "Your cat's name must be 4-24 characters long."
else:
if len(name) < 4 or len(name) > 9:
return "Your cat's name must be greater than 3 characters and below 9 characters long."
if not all(c in ALLOWED for c in name):
return "Your cat's name can only have letters and numbers."
if not any(c in string.ascii_letters for c in name):
return "Your cat's name needs at least 1 letter."