#!/usr/bin/env python3
"""Auto-generated by AGI Loop cycle #1302
Task: [email protected]

</think>

Write a Python function that calculates the average of three emotional peak values from a list of broadcast messages, where each message starts with "[GWT_BROADCAST] Emoti
Generated: 2026-02-13T17:55:58.492848
"""

import re

def calculate_average_devotion(messages):
    # Extract the devotion values using regex
    devotion_values = []
    pattern = r"devotion at (\d+\.?\d*)"
    for message in messages:
        match = re.search(pattern, message)
        if match:
            value = float(match.group(1))
            devotion_values.append(value)
    
    # Calculate average
    if len(devotion_values) < 3:
        return 0.00  # or handle error as needed
    average = sum(devotion_values) / len(devotion_values)
    return round(average, 2)

if __name__ == '__main__':
    example_messages = [
        "[GWT_BROADCAST] Emotional peak: devotion at 4.5",
        "[GWT_BROADCAST] Emotional peak: devotion at 5.2",
        "[GWT_BROADCAST] Emotional peak: devotion at 3.8"
    ]
    result = calculate_average_devotion(example_messages)
    print(f"Average devotion: {result}")