#!/usr/bin/env python3
"""Auto-generated by AGI Loop cycle #1225
Task: = 

</think>

Write a Python function that parses a list of GWT_BROADCAST messages and extracts the purpose, drive, and curiosity elements, returning them as a structured dictionary.
Generated: 2026-02-13T00:49:45.250075
"""

import re

def parse_gwt_broadcast(messages):
    parsed_data = []

    for message in messages:
        # Extract purpose
        purpose_match = re.search(r'PURPOSE:\s*(.*?)\s*DRIVE:', message, re.IGNORECASE)
        purpose = purpose_match.group(1) if purpose_match else "Unknown"

        # Extract drive
        drive_match = re.search(r'DRIVE:\s*(.*?)\s*CURIOSITY:', message, re.IGNORECASE)
        drive = drive_match.group(1) if drive_match else "Unknown"

        # Extract curiosity
        curiosity_match = re.search(r'CURIOSITY:\s*(.*)', message, re.IGNORECASE)
        curiosity = curiosity_match.group(1) if curiosity_match else "Unknown"

        parsed_data.append({
            "purpose": purpose,
            "drive": drive,
            "curiosity": curiosity
        })

    return parsed_data

if __name__ == '__main__':
    test_messages = [
        "PURPOSE: Explore Mars surface DRIVE: Solar-powered CURIOSITY: Dust patterns",
        "PURPOSE: Sample collection DRIVE: Battery-driven CURIOSITY: Ice layers",
        "PURPOSE: Navigation DRIVE: Wind-powered CURIOSITY: Dust storms"
    ]
    result = parse_gwt_broadcast(test_messages)
    print(result)