So I was thinking about Conway's game of life and the ridiculous kinds of patterns that can be made (Things that move across infinite space etc) and then I thought, hey could a chess knight do this as well?
A refresher on the rules:
- Any live cell with fewer than two live neighbours dies, as if caused by under-population.
- Any live cell with two or three live neighbours lives on to the next generation.
- Any live cell with more than three live neighbours dies, as if by over-population.
- Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.
The new definition of a "Neighbour" is whoever a knight could move to.
Of course this is the internet so some people have looked into it some already: Various repeating patterns with various periods
Alas they gave no example of these moving self-repeating patterns, so I wondered: Is it possible for knights in conway's game of life to traverse an infinite board in a repeating manner?
Below is an example of a standard conway's game of life glider:
So here are the challenges I see springing forth from this line of thought:
- Can you make a traversing infinite knight pattern?
- Can you disprove the existence of an infinite knight traversal?
- Can you make a generator pattern that will shoot off the infinite pattern if it exists.
To be honest somewhat expect the disproval more than anything else due to knights sharing no more than 2 neighbors and various parity type things that may arise, but I hope there do exist patterns.
So below is some base code for running the knight game of life in python. This is definitely not optimal (some kind of minesweeper like setup would probably be dope). But I hope this gives some interested people a good starting point.
""" By GoingHamateur """ def new_grid(): my_grid =  my_line =  x_size = 20 y_size = 20 for i in range(x_size): my_line.append('O') for j in range(y_size): my_grid.append(my_line[:]) return my_grid def print_grid(grid): for line in grid: for square in line: print(square,) print("") print("") def place_knight(grid, row, col): grid[row][col] = "X" def is_knight(grid, row, col): return grid[row][col] == "X" def generation(grid): next_gen = new_grid() for col in range(len(grid)): for row in range(len(grid)): n = neighbours(grid, row, col) if is_knight(grid, row, col): if n == 2 or n == 3: # dun dun dun dun stayin alive stayin alive place_knight(next_gen, row, col) elif n == 3: place_knight(next_gen, row, col) # let there be life return next_gen def neighbours(grid, row, col): y_size = len(grid) x_size = len(grid) x_diffs = [-2, -2, -1, -1, 1, 1, 2, 2] y_diffs = [1, -1, 2, -2, 2, -2, 1, -1] neighbours = 0 for i in range(len(x_diffs)): #the number formerly known as eight x = col + x_diffs[i] y = row + y_diffs[i] if in_grid(grid, y, x): #deep on the inside it kills me that row number is y value neighbours += is_knight(grid, y, x) # Fun Fact: True == 1 in python #stackoverdflowfacts return neighbours def print_neighbours(grid): for row in range(len(grid)): for col in range(len(grid)): n = neighbours(grid, row, col) print(n,) print("") print("") def in_grid(grid, row, col): y_size = len(grid) x_size = len(grid) return row >= 0 and col >= 0 and row < y_size and col < x_size x_vals = [1,2,3,3,4,5,5,6,6,7,7,8,8,9,10,10,11,12] y_vals = [2,4,1,3,5,2,4,2,4,2,4,2,4,5,1 ,3 ,4 , 2] g = new_grid() for i in range(len(x_vals)): place_knight(g, y_vals[i], x_vals[i]) def run_generations(g, num_gens): print_grid(g) for i in range(num_gens): g = generation(g) print_grid(g) run_generations(g, 6)