New Terminal Output:

root@f3f8d6319494:/app# python3 -c "
> import struct
> with open('/app/frames.tza', 'rb') as f:
>     f.read(4)
>     w, h = struct.unpack('<HH', f.read(4))
>     n_frames, max_bytes = struct.unpack('<II', f.read(8))
>
>     frames = []
>     for i in range(n_frames):
>         frames.append(f.read(w*h))
>
>     # Calculate total changes and runs
>     total_changes = 0
>     total_runs = 0
>     for i in range(1, n_frames):
>         changes = [frames[i-1][j] != frames[i][j] for j in range(w*h)]
>         for r in range(h):
>             in_run = False
>             for c in range(w):
>                 idx = r * w + c
>                 if changes[idx]:
>                     total_changes += 1
>                     if not in_run:
>                         in_run = True
>                         total_runs += 1
>                 else:
>                     in_run = False
>
>     print(f'Total changes across all frames: {total_changes}')
>     print(f'Total runs across all frames: {total_runs}')
>     print(f'Avg changes/frame: {total_changes/n_frames:.1f}')
>     print(f'Avg runs/frame: {total_runs/n_frames:.1f}')
>     print(f'Est cost with cursor pos: {total_runs * 7 + total_changes + n_frames}')
>     print(f'Budget: {max_bytes}')
> "
Total changes across all frames: 156415
Total runs across all frames: 20050
Avg changes/frame: 130.3
Avg runs/frame: 16.7
Est cost with cursor pos: 297965
Budget: 69000
root@f3f8d6319494:/app#
