1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import numpy as np
import random

def generate_tv_config(height=100, width=100):
    """Generate a pattern that might lead to a long cycle."""
    # Initialize grid
    grid = np.zeros((height, width), dtype=np.int8)
    
    # Create a pattern with alternating blocks
    block_size = 10
    for i in range(0, height, block_size):
        for j in range(0, width, block_size):
            # Determine if we're in an "odd" or "even" block position
            block_type = (i // block_size + j // block_size) % 4
            
            # Fill the block with a pattern dependent on its position
            for bi in range(min(block_size, height - i)):
                for bj in range(min(block_size, width - j)):
                    # Different patterns for different block types
                    if block_type == 0:
                        # Checkerboard pattern
                        grid[i+bi, j+bj] = (bi + bj) % 2
                    elif block_type == 1:
                        # Horizontal stripes
                        grid[i+bi, j+bj] = bi % 2
                    elif block_type == 2:
                        # Vertical stripes
                        grid[i+bi, j+bj] = bj % 2
                    else:
                        # Random pattern with bias
                        grid[i+bi, j+bj] = random.randint(0, 1)
    
    # Add some random noise to reduce symmetry
    for _ in range(1000):
        i = random.randint(0, height-1)
        j = random.randint(0, width-1)
        grid[i, j] = 1 - grid[i, j]  # Flip the bit
    
    return grid

def grid_to_string(grid):
    """Convert the grid to a string representation."""
    result = []
    for i in range(grid.shape[0]):
        row = ''.join(str(int(x)) for x in grid[i])
        result.append(row)
    return '\n'.join(result)

# Generate and print the configuration
np.random.seed(42)  # For reproducibility
grid = generate_tv_config(100, 100)
print(grid_to_string(grid))