I discovered an automaton that produced interesting, random-seeming patterns.
The rule was as follows. Given a grid of points, some occupied and some not, and a current point and a previous point; change the current point to the unoccupied point one knight's move (two steps in one direction and one in the other) clockwise from the previous jump (or two if that point is occupied, or three, and so on). Then change the previous point to the old current point, and add the current point to the set of occupied points.
Here are some pictures of the automaton at various stages with no points initially occupied:
And here is the updated code used to generate them:
import turtle
import time
CELL_WIDTH = 8
class V:
def __init__(self, x, y):
self.x = x
self.y = y
def __iter__(self):
yield self.x
yield self.y
def __add__(self, other):
return V(self.x + other.x, self.y + other.y)
def __sub__(self, other):
return V(self.x - other.x, self.y - other.y)
def __str__(self):
return "({}, {})".format(*self)
def move(moves, position, previous, possible_moves, limit):
c = 0
while True:
c += 1
if c > limit:
return None
p = possible_moves.index(tuple(V(*position) - V(*previous)))
for m in possible_moves[p+1:] + possible_moves[:p+1]:
if tuple(V(*position) + V(*m)) not in moves:
moves.append(tuple(V(*position) + V(*m)))
turtle.goto(*tuple(V(*(8 * i for i in position)) + V(*(8 * i for i in m))))
position, previous = moves[-1], position
break
else:
turtle.reset()
return moves, position
def generate(x, y):
return ((x, y), (y, x), (y, -x), (x, -y), (-x, -y), (-y, -x), (-y, x), (-x, y))
original = generate(1, 2)
onethree = generate(1, 3)
onefour = generate(1, 4)
onefive = generate(1, 5)
onesix = generate(1, 6)
twothree = generate(2, 3)
twofive = generate(2, 5)
threefour = generate(3, 4)
threefive = generate(3, 5)
fourfive = generate(4, 5)
if __name__ == "__main__":
turtle.speed(0)
for thing in (original, onefive, onesix):
for i in thing[:2]:
result = move([(0, 0)], (0, 0), i, thing, 10000)
if result is None:
print("Move limit reached")
else:
positions, last = result
print(len(positions))
print()
The automaton does stop after about 369 or 515 steps. However, I only know this because I ran it. How would I go about proving that it does stop in another way, or prove that it stops with any initial finite set of occupied points? Also, has this (or a very similar) automaton been studied before?
Edit: as per magdiragdag's suggestion, I've run it again with different steps:
Step Result
(2, 1) Stops at 369 or 515
(3, 1) Stops at 369 or 515
(4, 1) Stops at 822 or doesn't stop at all (the pattern appears to repeat indefinitely)
(5, 1) Stops at 104 or 505
(6, 1) Stops at 724 or 1600
(7, 1) Stops at 134 or 876
(8, 1) Stops at 1746 or 1768
(9, 1) Stops at 383 or 585
(3, 2) Stops at 104 or 505
(4, 3) Stops at 134 or 876
(5, 2) Stops at 547 or 693
(5, 3) Stops at 822, or doesn't seem to at all (similar pattern to (4, 1) but a different direction)
(5, 4) Stops at 383 or 585
(7, 5) Stops at 724 or 1600
Some jumps can obviously be reduced to others ($(4, 2)$ is the same as $(2, 1)$ etc). Some other jumps also appear to produce the same results:
(1, 2) and (1, 3) 515 or 369
(1, 3) and (1, 2) 515 or 369
(1, 4) and (3, 5) 822 or infinite
(1, 5) and (2, 3) 104 or 505
(1, 6) and (5, 7) 1600 or 724
(1, 7) and (3, 4) 134 or 876
(1, 8) and (7, 9) 1746 or 1768
(1, 9) and (4, 5) 383 or 585
(1, 10) and (9, 11) 1769 or 1769
(1, 11) and (5, 6) 1574 or 824
(1, 12) and (11, 13) 1769 or 1769
(1, 13) and (6, 7) 1909 or 1557
(2, 1) and (1, 3) 515 or 369
(2, 3) and (1, 5) 104 or 505
(2, 5) and (3, 7) 547 or 693
(2, 7) and (5, 9) 1562 or 1027
(2, 9) and (7, 11) 921 or 1401
(2, 11) and (9, 13) 1769 or 1769
(1, 13) and (6, 7) 1909 or 1557
(3, 13) and (5, 8) 1439 or 2724
(5, 13) and (4, 9) 930 or 1808
(7, 13) and (3, 10) 921 or 1769
(9, 13) and (2, 11) 1769 or 1769
(11, 13) and (1, 12) 1769 or 1769
(1, 11) and (5, 6) 1574 or 824
(3, 11) and (4, 7) 1813 or 2065
(5, 11) and (3, 8) 1629 or 964
(7, 11) and (2, 9) 921 or 1401
(9, 11) and (1, 10) 1769 or 1769
(8, 9) 1769 or 1769
(1, 10), (7, 10), (9, 10), (11, 10) and (13, 10) 1769 or 1769
(2, 11), (4, 11), (6, 11), (8, 11), (9, 11), (10, 11) and (12, 11) 1769 or 1769
(1, 12), (5, 12), (7, 12), (11, 12), (13, 12) and (25, 12) 1769 or 1769
(2, 13), (4, 13), (6, 13), (8, 13), (9, 13), (10, 13) and (12, 13) 1769 or 1769
(29, 41) 1769 or 1769
I noticed several patterns in these results.
Let $S(jump)$ denote the stopping time of a jump (e.g. $S(1, 2) = 515\ or\ 369$).
$S(1, x) = S(y, z)$, where $x$ is odd, and $y$ and $z$ are two numbers that add to make $x$, and have a difference of 1.
$S(1, x) = S(x-1, x+1)$, where $x$ is even.
$S(2, x) = S(|x-2|, x+2)$, where $x$ is odd.
From the above two results, it seems possible that $S(n, x) = S(|x-n|, x+n)$ where $x$ is even if $n$ is odd and vice versa (at least for certain values of $n$). I will test this later.
$S(13, x) = S(7-((x+1) / 2), x + (7-((x+1) / 2)))$ where $x$ is odd.
$S(11, x) = S(6-((x+1) / 2), x + (6-((x+1) / 2)))$ where $x$ is odd.
From the above two results, it seems possible that $S(n-1, x) = S((n/2)-((x+1) / 2), x + ((n/2)-((x+1) / 2)))$ where $x$ is odd (at least for certain values of $n$). I will test this later.
A lot of jumps stop at 1769:
$S(10, x)$ where $x$ and 10 are coprime. $S(11, x)$ where $x$ is composite. $S(12, x)$ where $x$ and 12 are coprime. $S(13, x)$ where $x$ is composite.
This suggests that $S(n, x)$ stops at 1769 when $n$ is even and $n$ and $x$ are coprime, and when $n$ is odd and $x$ is composite.
Above a certain point, all jumps seem to stop at 1769. All these jumps seem to have similar patterns.
From a brief search on Wolfram Alpha, I can't see any connections between the number of steps it takes jumps to stop, or anything overly remarkable about the number 1769, which seems to appear a lot.