import random

# Define categories and words for the Word Wrangler game
WORD_CATEGORIES = {
    "animals": [
        "elephant",
        "penguin",
        "giraffe",
        "dolphin",
        "kangaroo",
        "octopus",
        "panda",
        "tiger",
        "koala",
        "flamingo",
        "hedgehog",
        "turtle",
        "zebra",
        "eagle",
        "sloth",
        "raccoon",
        "chameleon",
        "squirrel",
        "hamster",
        "cheetah",
        "platypus",
        "jellyfish",
        "parrot",
        "wolf",
        "hippo",
        "porcupine",
        "ostrich",
        "peacock",
        "alligator",
        "gorilla",
        "armadillo",
        "chipmunk",
        "walrus",
        "weasel",
        "skunk",
        "llama",
        "badger",
        "mongoose",
        "lemur",
        "otter",
        "bison",
        "falcon",
        "meerkat",
        "pelican",
        "cobra",
        "salamander",
        "lobster",
        "seal",
        "narwhal",
        "iguana",
        "piranha",
        "toucan",
        "moose",
        "lynx",
        "stingray",
        "starfish",
        "beaver",
        "vulture",
        "antelope",
        "jaguar",
        "seahorse",
    ],
    "food": [
        "pizza",
        "sushi",
        "burrito",
        "pancake",
        "donut",
        "lasagna",
        "popcorn",
        "chocolate",
        "mango",
        "pretzel",
        "taco",
        "waffle",
        "cupcake",
        "avocado",
        "cookie",
        "croissant",
        "omelette",
        "cheesecake",
        "dumpling",
        "hummus",
        "gelato",
        "risotto",
        "ramen",
        "salsa",
        "kebab",
        "brownie",
        "guacamole",
        "bagel",
        "falafel",
        "biscuit",
        "churro",
        "meatball",
        "tiramisu",
        "enchilada",
        "couscous",
        "gumbo",
        "jambalaya",
        "baklava",
        "popsicle",
        "cannoli",
        "tofu",
        "macaron",
        "empanada",
        "pho",
        "casserole",
        "porridge",
        "granola",
        "fritter",
        "hazelnut",
        "kiwi",
        "pomegranate",
        "artichoke",
        "edamame",
        "zucchini",
        "cashew",
        "brisket",
        "custard",
        "nutmeg",
        "ginger",
    ],
    "household": [
        "chair",
        "pillow",
        "mirror",
        "blanket",
        "lamp",
        "curtain",
        "sofa",
        "refrigerator",
        "blender",
        "bookshelf",
        "dishwasher",
        "carpet",
        "microwave",
        "table",
        "clock",
        "vase",
        "ottoman",
        "candle",
        "drawer",
        "cabinet",
        "doorknob",
        "silverware",
        "bathtub",
        "plunger",
        "toaster",
        "kettle",
        "spatula",
        "doormat",
        "hanger",
        "blinds",
        "ladle",
        "platter",
        "coaster",
        "napkin",
        "sponge",
        "thermostat",
        "showerhead",
        "coatrack",
        "nightstand",
        "cushion",
        "windowsill",
        "bedsheet",
        "countertop",
        "dustpan",
        "footstool",
        "flowerpot",
        "trashcan",
        "colander",
        "detergent",
        "chandelier",
        "laundry",
        "vacuum",
        "teapot",
        "duster",
        "lightbulb",
        "corkscrew",
        "paperweight",
        "doorstop",
        "radiator",
    ],
    "activities": [
        "swimming",
        "painting",
        "dancing",
        "gardening",
        "skiing",
        "cooking",
        "hiking",
        "reading",
        "yoga",
        "fishing",
        "jogging",
        "biking",
        "baking",
        "singing",
        "camping",
        "knitting",
        "surfing",
        "photography",
        "bowling",
        "archery",
        "horseback",
        "meditation",
        "gymnastics",
        "volleyball",
        "tennis",
        "skating",
        "kayaking",
        "climbing",
        "juggling",
        "rowing",
        "snorkeling",
        "embroidery",
        "canoeing",
        "paddleboarding",
        "pottery",
        "birdwatching",
        "karaoke",
        "sailing",
        "pilates",
        "calligraphy",
        "skateboarding",
        "crossword",
        "origami",
        "beekeeping",
        "stargazing",
        "snowboarding",
        "woodworking",
        "fencing",
        "quilting",
        "foraging",
        "geocaching",
        "scrapbooking",
        "welding",
        "glassblowing",
        "whittling",
        "ziplining",
    ],
    "places": [
        "beach",
        "library",
        "mountain",
        "airport",
        "stadium",
        "museum",
        "hospital",
        "castle",
        "garden",
        "hotel",
        "island",
        "desert",
        "university",
        "restaurant",
        "forest",
        "aquarium",
        "theater",
        "canyon",
        "lighthouse",
        "waterfall",
        "vineyard",
        "cathedral",
        "rainforest",
        "farmhouse",
        "greenhouse",
        "observatory",
        "marketplace",
        "boardwalk",
        "temple",
        "courtyard",
        "plantation",
        "lagoon",
        "volcano",
        "meadow",
        "oasis",
        "grotto",
        "peninsula",
        "aviary",
        "chapel",
        "coliseum",
        "bazaar",
        "marina",
        "orchard",
        "brewery",
        "sanctuary",
        "fortress",
        "prairie",
        "reservation",
        "tavern",
        "monument",
        "manor",
        "pavilion",
        "boulevard",
        "campground",
    ],
    "objects": [
        "umbrella",
        "scissors",
        "camera",
        "wallet",
        "bicycle",
        "backpack",
        "telescope",
        "balloon",
        "compass",
        "notebook",
        "keyboard",
        "magnet",
        "headphones",
        "hammer",
        "envelope",
        "binoculars",
        "tambourine",
        "boomerang",
        "megaphone",
        "suitcase",
        "pinwheel",
        "kaleidoscope",
        "microscope",
        "hourglass",
        "harmonica",
        "trampoline",
        "bubblegum",
        "xylophone",
        "typewriter",
        "screwdriver",
        "whistle",
        "chessboard",
        "handcuffs",
        "stethoscope",
        "stopwatch",
        "parachute",
        "blowtorch",
        "calculator",
        "thermometer",
        "mousetrap",
        "crowbar",
        "paintbrush",
        "metronome",
        "surfboard",
        "flipchart",
        "dartboard",
        "wrench",
        "flippers",
        "thimble",
        "protractor",
        "snorkel",
        "doorbell",
        "flashlight",
        "pendulum",
        "abacus",
    ],
    "jobs": [
        "teacher",
        "doctor",
        "chef",
        "firefighter",
        "pilot",
        "astronaut",
        "carpenter",
        "musician",
        "detective",
        "scientist",
        "farmer",
        "architect",
        "journalist",
        "electrician",
        "dentist",
        "veterinarian",
        "librarian",
        "photographer",
        "mechanic",
        "attorney",
        "barista",
        "plumber",
        "bartender",
        "surgeon",
        "therapist",
        "animator",
        "programmer",
        "pharmacist",
        "translator",
        "accountant",
        "florist",
        "butcher",
        "lifeguard",
        "beekeeper",
        "locksmith",
        "choreographer",
        "mortician",
        "paramedic",
        "blacksmith",
        "surveyor",
        "botanist",
        "chiropractor",
        "undertaker",
        "acrobat",
        "welder",
        "hypnotist",
        "zoologist",
        "mime",
        "sommelier",
        "meteorologist",
        "stuntman",
        "diplomat",
        "entomologist",
        "puppeteer",
        "archivist",
        "cartographer",
        "paleontologist",
    ],
    "transportation": [
        "helicopter",
        "submarine",
        "scooter",
        "sailboat",
        "train",
        "motorcycle",
        "airplane",
        "canoe",
        "tractor",
        "limousine",
        "escalator",
        "skateboard",
        "ambulance",
        "ferry",
        "rocket",
        "hovercraft",
        "gondola",
        "segway",
        "zeppelin",
        "bulldozer",
        "speedboat",
        "unicycle",
        "monorail",
        "snowmobile",
        "paddleboat",
        "trolley",
        "rickshaw",
        "caboose",
        "glider",
        "bobsled",
        "jetpack",
        "forklift",
        "dirigible",
        "chariot",
        "sidecar",
        "tandem",
        "battleship",
        "catamaran",
        "toboggan",
        "dinghy",
        "hydrofoil",
        "sleigh",
        "hatchback",
        "kayak",
        "stagecoach",
        "tugboat",
        "airship",
        "skiff",
        "carriage",
        "rowboat",
        "chairlift",
        "steamroller",
    ],
    "clothing": [
        "sweater",
        "sandals",
        "tuxedo",
        "poncho",
        "sneakers",
        "bikini",
        "cardigan",
        "overalls",
        "kimono",
        "mittens",
        "suspenders",
        "kilt",
        "leggings",
        "apron",
        "bowtie",
        "earmuffs",
        "fedora",
        "wetsuit",
        "pajamas",
        "sombrero",
        "raincoat",
        "beret",
        "turtleneck",
        "parka",
        "tiara",
        "toga",
        "bandana",
        "corset",
        "sarong",
        "tunic",
        "visor",
        "ascot",
        "fez",
        "moccasins",
        "blazer",
        "chaps",
        "romper",
        "waders",
        "clogs",
        "garter",
        "camisole",
        "galoshes",
        "bolero",
        "spats",
        "pantyhose",
        "onesie",
        "stiletto",
        "vest",
        "windbreaker",
        "scarf",
        "bonnet",
    ],
    "nature": [
        "glacier",
        "sequoia",
        "geyser",
        "avalanche",
        "tornado",
        "quicksand",
        "stalactite",
        "hurricane",
        "asteroid",
        "tundra",
        "galaxy",
        "nebula",
        "earthquake",
        "stalagmite",
        "constellation",
        "crystal",
        "tributary",
        "abyss",
        "monsoon",
        "magma",
        "erosion",
        "iceberg",
        "mudslide",
        "delta",
        "aurora",
        "gravity",
        "humidity",
        "sinkhole",
        "wildfire",
        "tropics",
        "tsunami",
        "eclipse",
        "metabolism",
        "mirage",
        "hemisphere",
        "spectrum",
        "fossil",
        "plateau",
        "groundwater",
        "undergrowth",
        "oxygen",
        "molecule",
        "pollination",
        "algae",
        "carbon",
        "nitrogen",
        "organism",
        "nucleus",
        "equator",
        "solstice",
        "cocoon",
        "germination",
        "metamorphosis",
        "nocturnal",
        "symbiosis",
        "ecosystem",
        "biodiversity",
    ],
    "emotions": [
        "happiness",
        "sadness",
        "anxiety",
        "surprise",
        "anger",
        "curiosity",
        "embarrassment",
        "nostalgia",
        "envy",
        "gratitude",
        "remorse",
        "boredom",
        "excitement",
        "loneliness",
        "pride",
        "jealousy",
        "contentment",
        "disgust",
        "empathy",
        "euphoria",
        "melancholy",
        "frustration",
        "anticipation",
        "amusement",
        "serenity",
        "disappointment",
        "confidence",
        "resentment",
        "apathy",
        "optimism",
        "pessimism",
        "bewilderment",
        "exhilaration",
        "indifference",
        "enthusiasm",
        "desperation",
        "satisfaction",
        "regret",
        "determination",
        "compassion",
        "hopelessness",
        "relief",
        "infatuation",
        "tranquility",
        "impatience",
        "exasperation",
        "agitation",
        "yearning",
        "sympathy",
        "admiration",
        "astonishment",
        "inspiration",
        "dread",
        "hope",
    ],
}


def generate_game_words(num_words=20):
    """Generate a random selection of words for the Word Wrangler game.

    1. Create a flat list of all words
    2. Remove any duplicates
    3. Randomly select the requested number of words

    Args:
        num_words: Number of words to select for the game

    Returns:
        List of randomly selected words
    """
    # Create a flat list of all words from all categories
    all_words = []
    for category_words in WORD_CATEGORIES.values():
        all_words.extend(category_words)

    # Remove duplicates by converting to a set and back to a list
    all_words = list(set(all_words))

    # Randomly select words
    selected_words = random.sample(all_words, min(num_words, len(all_words)))

    return selected_words
