Spaces:
Sleeping
Sleeping
| """ | |
| Utility functions and helper classes | |
| """ | |
| import random | |
| from typing import List, Optional, Tuple | |
| class SmurfNameHelper: | |
| """Helper class for managing smurf names""" | |
| # Initial names for starting smurfs | |
| INITIAL_NAMES = ["Lippy", "Anna", "Shooky"] | |
| # Full list of available smurf names | |
| ALL_NAMES = [ | |
| "Brainy", "Hefty", "Handy", "Jokey", "Greedy", "Grouchy", "Clumsy", | |
| "Dreamy", "Vanity", "Lazy", "Farmer", "Baker", "Painter", "Poet", | |
| "Tracker", "Harmony", "Smurfette", "Sassette", "Nanny", "Grandpa", | |
| "Papa", "Wild", "Snappy", "Nat", "Slouchy", "Scaredy", "Tailor", | |
| "Miner", "Dabbler", "Tuffy", "Timber", "Finance", "Reporter" | |
| ] | |
| def get_random_name(cls, used_names: List[str], name_pool: List[str] = None) -> Optional[str]: | |
| """Get a random name from the pool, avoiding used names""" | |
| if name_pool is None: | |
| name_pool = cls.ALL_NAMES | |
| available = [n for n in name_pool if n not in used_names] | |
| return random.choice(available) if available else None | |
| class PokemonColorPalette: | |
| """150 Pokemon-inspired color pairs (main, accent) from the original 150 Pokemon""" | |
| # Color pairs: (main_color, accent_color) - inspired by Pokemon color schemes | |
| # Each pair represents a Pokemon-inspired color combination | |
| # Exactly 150 unique color pairs | |
| COLOR_PAIRS = [ | |
| ((255, 140, 0), (255, 220, 0)), | |
| ((255, 150, 50), (255, 230, 50)), | |
| ((255, 130, 30), (255, 210, 30)), | |
| ((240, 120, 20), (250, 200, 20)), | |
| ((255, 160, 80), (255, 240, 100)), | |
| ((250, 135, 40), (250, 225, 60)), | |
| ((255, 220, 0), (160, 120, 80)), | |
| ((255, 230, 50), (170, 130, 90)), | |
| ((255, 210, 30), (150, 110, 70)), | |
| ((250, 200, 20), (180, 140, 100)), | |
| ((255, 240, 100), (200, 160, 120)), | |
| ((250, 225, 60), (140, 100, 60)), | |
| ((100, 150, 255), (150, 200, 255)), | |
| ((120, 170, 255), (130, 180, 255)), | |
| ((80, 130, 255), (100, 150, 255)), | |
| ((60, 100, 220), (120, 170, 255)), | |
| ((40, 80, 200), (100, 150, 255)), | |
| ((20, 60, 180), (80, 130, 255)), | |
| ((64, 224, 208), (150, 255, 200)), | |
| ((72, 209, 204), (160, 255, 210)), | |
| ((80, 200, 200), (140, 250, 190)), | |
| ((50, 205, 200), (170, 255, 220)), | |
| ((40, 185, 180), (130, 240, 180)), | |
| ((100, 220, 210), (120, 230, 170)), | |
| ((255, 80, 80), (255, 140, 0)), | |
| ((255, 100, 100), (255, 150, 50)), | |
| ((255, 60, 60), (255, 130, 30)), | |
| ((220, 50, 50), (240, 120, 20)), | |
| ((255, 120, 100), (255, 160, 80)), | |
| ((240, 70, 60), (250, 135, 40)), | |
| ((180, 100, 255), (130, 50, 170)), | |
| ((190, 110, 255), (150, 70, 190)), | |
| ((170, 90, 250), (160, 80, 200)), | |
| ((200, 120, 255), (180, 100, 255)), | |
| ((160, 80, 200), (120, 40, 160)), | |
| ((220, 140, 255), (200, 120, 255)), | |
| ((255, 150, 200), (255, 200, 230)), | |
| ((255, 160, 210), (255, 190, 220)), | |
| ((255, 140, 190), (255, 180, 220)), | |
| ((250, 130, 180), (250, 180, 210)), | |
| ((240, 120, 170), (245, 170, 200)), | |
| ((255, 120, 180), (255, 200, 230)), | |
| ((255, 180, 220), (255, 220, 240)), | |
| ((255, 170, 210), (255, 210, 230)), | |
| ((250, 160, 200), (250, 200, 220)), | |
| ((245, 150, 190), (245, 190, 210)), | |
| ((235, 140, 180), (235, 180, 200)), | |
| ((240, 100, 160), (255, 200, 230)), | |
| ((160, 120, 80), (200, 160, 120)), | |
| ((170, 130, 90), (190, 150, 110)), | |
| ((150, 110, 70), (180, 140, 100)), | |
| ((140, 100, 60), (170, 130, 90)), | |
| ((180, 140, 100), (220, 180, 140)), | |
| ((200, 160, 120), (230, 190, 150)), | |
| ((100, 150, 255), (100, 220, 255)), | |
| ((120, 170, 255), (110, 230, 255)), | |
| ((80, 130, 255), (90, 210, 250)), | |
| ((130, 180, 255), (120, 240, 255)), | |
| ((150, 200, 255), (100, 220, 255)), | |
| ((60, 100, 220), (80, 200, 240)), | |
| ((255, 220, 0), (255, 250, 150)), | |
| ((255, 230, 50), (255, 245, 130)), | |
| ((255, 210, 30), (250, 240, 110)), | |
| ((250, 200, 20), (245, 235, 90)), | |
| ((255, 240, 100), (255, 250, 180)), | |
| ((250, 225, 60), (250, 245, 140)), | |
| ((255, 80, 80), (255, 160, 80)), | |
| ((255, 60, 60), (255, 140, 0)), | |
| ((255, 120, 100), (255, 180, 100)), | |
| ((100, 150, 255), (135, 206, 250)), | |
| ((120, 170, 255), (145, 216, 255)), | |
| ((80, 130, 255), (125, 196, 245)), | |
| ((130, 180, 255), (155, 226, 255)), | |
| ((150, 200, 255), (145, 216, 250)), | |
| ((60, 100, 220), (115, 186, 235)), | |
| ((100, 150, 255), (40, 80, 200)), | |
| ((120, 170, 255), (60, 100, 220)), | |
| ((80, 130, 255), (20, 60, 180)), | |
| ((130, 180, 255), (50, 90, 210)), | |
| ((150, 200, 255), (70, 120, 240)), | |
| ((60, 100, 220), (30, 70, 190)), | |
| ((255, 100, 100), (255, 180, 100)), | |
| ((255, 120, 100), (255, 200, 120)), | |
| ((220, 50, 50), (240, 140, 60)), | |
| ((240, 70, 60), (250, 155, 80)), | |
| ((210, 50, 40), (230, 130, 50)), | |
| ((255, 220, 0), (255, 180, 100)), | |
| ((255, 230, 50), (255, 200, 120)), | |
| ((255, 210, 30), (255, 160, 80)), | |
| ((250, 200, 20), (250, 155, 60)), | |
| ((255, 240, 100), (255, 220, 140)), | |
| ((250, 225, 60), (250, 175, 80)), | |
| ((255, 220, 0), (255, 240, 200)), | |
| ((255, 230, 50), (255, 245, 210)), | |
| ((255, 210, 30), (255, 235, 190)), | |
| ((250, 200, 20), (250, 230, 180)), | |
| ((255, 240, 100), (255, 250, 220)), | |
| ((250, 225, 60), (250, 240, 200)), | |
| ((180, 100, 255), (255, 150, 200)), | |
| ((190, 110, 255), (255, 160, 210)), | |
| ((170, 90, 250), (255, 140, 190)), | |
| ((200, 120, 255), (255, 180, 220)), | |
| ((160, 80, 200), (240, 100, 160)), | |
| ((220, 140, 255), (255, 200, 230)), | |
| ((255, 140, 0), (255, 240, 100)), | |
| ((255, 150, 50), (255, 250, 150)), | |
| ((255, 130, 30), (255, 230, 50)), | |
| ((240, 120, 20), (250, 225, 60)), | |
| ((255, 160, 80), (255, 245, 130)), | |
| ((250, 135, 40), (250, 240, 110)), | |
| ((180, 100, 255), (100, 150, 255)), | |
| ((190, 110, 255), (120, 170, 255)), | |
| ((170, 90, 250), (80, 130, 255)), | |
| ((200, 120, 255), (130, 180, 255)), | |
| ((160, 80, 200), (60, 100, 220)), | |
| ((220, 140, 255), (150, 200, 255)), | |
| ((255, 140, 0), (255, 100, 100)), | |
| ((255, 150, 50), (255, 120, 100)), | |
| ((255, 130, 30), (255, 80, 80)), | |
| ((240, 120, 20), (240, 70, 60)), | |
| ((255, 160, 80), (255, 120, 120)), | |
| ((250, 135, 40), (250, 90, 70)), | |
| ((255, 220, 0), (180, 140, 100)), | |
| ((255, 230, 50), (190, 150, 110)), | |
| ((255, 210, 30), (170, 130, 90)), | |
| ((250, 200, 20), (200, 160, 120)), | |
| ((255, 240, 100), (220, 180, 140)), | |
| ((250, 225, 60), (160, 120, 80)), | |
| ((180, 180, 200), (100, 150, 255)), | |
| ((190, 190, 210), (120, 170, 255)), | |
| ((170, 170, 190), (80, 130, 255)), | |
| ((200, 200, 220), (130, 180, 255)), | |
| ((160, 160, 180), (60, 100, 220)), | |
| ((150, 150, 170), (40, 80, 200)), | |
| ((100, 150, 255), (64, 224, 208)), | |
| ((120, 170, 255), (72, 209, 204)), | |
| ((80, 130, 255), (80, 200, 200)), | |
| ((130, 180, 255), (100, 220, 210)), | |
| ((150, 200, 255), (70, 230, 215)), | |
| ((60, 100, 220), (50, 205, 200)), | |
| ((160, 120, 80), (180, 180, 200)), | |
| ((170, 130, 90), (190, 190, 210)), | |
| ((150, 110, 70), (170, 170, 190)), | |
| ((180, 140, 100), (200, 200, 220)), | |
| ((200, 160, 120), (160, 160, 180)), | |
| ((140, 100, 60), (150, 150, 170)), | |
| ((255, 220, 0), (255, 140, 0)), | |
| ((255, 230, 50), (255, 150, 50)), | |
| ((255, 210, 30), (255, 130, 30)), | |
| ((250, 200, 20), (240, 120, 20)) | |
| ] | |
| def get_random_color_pair(cls) -> Tuple[Tuple[int, int, int], Tuple[int, int, int]]: | |
| """Get a random color pair (main_color, accent_color) from the Pokemon palette""" | |
| return random.choice(cls.COLOR_PAIRS) | |
| def get_all_color_pairs(cls) -> List[Tuple[Tuple[int, int, int], Tuple[int, int, int]]]: | |
| """Get all 150 Pokemon color pairs""" | |
| return cls.COLOR_PAIRS.copy() | |