26
$\begingroup$

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:

  1. Any live cell with fewer than two live neighbours dies, as if caused by under-population.
  2. Any live cell with two or three live neighbours lives on to the next generation.
  3. Any live cell with more than three live neighbours dies, as if by over-population.
  4. 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.

Knights can move in an L shape 2 squares in one way, one in the perpindicular. Knight moves

An example sequence repeating with period 5 is:
Made by George Sicherman

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:
Standard Conway's glider

So here are the challenges I see springing forth from this line of thought:

  1. Can you make a traversing infinite knight pattern?
  2. Can you disprove the existence of an infinite knight traversal?
  3. 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[0])):
            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[0])
    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[0])):
        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[0])
    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)

Resources of interest:
Wikipedia Conways game of Life
Cool Conway's standard game patterns

$\endgroup$
9
  • $\begingroup$ @JonathanAllan woops, thought that was sort of synonymous with Chess knight moves in an L. $\endgroup$ Aug 9, 2016 at 20:49
  • 3
    $\begingroup$ My understanding of the question: Consider a cellular automaton just like Conway's Life except that the neighbourhood of a cell consists not of itself plus the 8 other squares a chess king can move to but of itself plus the 8 other squares a chess knight can move to. Now, are there things like gliders and glider guns and so forth in this modified system, as there are in ordinary Life? $\endgroup$
    – Gareth McCaughan
    Aug 9, 2016 at 21:08
  • $\begingroup$ (So a "knight pattern" means a configuration in knight's-move-Life.) $\endgroup$
    – Gareth McCaughan
    Aug 9, 2016 at 21:09
  • 1
    $\begingroup$ What he said, I will try to update it to make it more self evident. $\endgroup$ Aug 9, 2016 at 21:25
  • 1
    $\begingroup$ This should be called simply Knights Life, it has a nice ring to it.. $\endgroup$ Aug 26, 2016 at 15:51

1 Answer 1

4
$\begingroup$

Just to get the ball rolling with some of the stuff I have looked into so far:

The leading edge case:
In order to glide there must be a side that is expanding (here we consider the case of moving right, without loss of generality). For this to happen at some point 3 points have to be left of the initial point to produce it. This is possible from 2 different conditions. 2 knights 2 blocks left and then 1 up or down with 1 knight 2 up or down and 1 left. The alternative is 2 knights 2 up or down and 1 left and a single knight 2 left and 1 up or down.

8's indicate where the new knight will be.

2 2 left case:
OOOOO
OOXOO
OXOOO
OOO8O
OXOOO
OOOOO
2 1 left case:
OOOOO
OOXOO
OXOOO
OOO8O
OOOOO
OOXOO

below is a starting grid that creates the 2-2 left case (8's are for where the new places will be created)
OOOOO
OOXOO
OXOOO
XOO8O
OO8OO
XOXOO
OO8OO
XOOOO
OXOOO

I think I next am going to look more theoretical at how a white knight only attacking black squares affects potential interactions.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.