The code in the previous post is fairly quick, but of course we’d always prefer it to be quicker. I’ll keep a record here of things I’ve tried and whether they worked.
September 30, 2025 / code, cuda, train-of-thought
The code in the previous post is fairly quick, but of course we’d always prefer it to be quicker. I’ll keep a record here of things I’ve tried and whether they worked.
September 1, 2025 / code, cuda
The No-three-in-line problem asks how many points can be placed on a n \times n grid so that no three points are on the same line, where the lines considered are of any slope and not just orthogonal and diagonal. Each row/column can contain at most 2 points, so clearly the answer is at most 2n. The real question is, can we actually achieve 2n for every grid size? It’s conjectured that the answer is “no” for grids large enough, but we don’t know where the crossover point is and there’s no indication that the number of 2n-point solutions is falling away from exponential growth, at least up to 18 \times 18!
To my eye, the configurations that work can be quite balanced and attractive. Here are some symmetrical ones for 14 \times 14 (though in general the solutions are not necessarily symmetric in this way):
The most extensive searches for configurations so far have been done
by Achim
Flammenkamp
and later by Ben Chaffin. I’ve written
some CUDA codeBy the way,
the existing cuda-mode
for Emacs is a bit messed up, I have a fork
with some bugfixes here.
of my
own with the goal of pushing things a little further, and I’ll explain
it in the rest of this post.
April 8, 2025 / code, cuda, gol
QuFince is a CUDA tool written by apg to conduct brute-force Game
of Life searches on the cartesian product of two sets of
configurations. That is, each configuration from set A is combined
with each configuration from set B, and run until stabilised. Not
every result is reported, only those where certain criteria are met.
Right now the options are either that the result has some interesting
periodInteresting period here typically means period not dividing
120, to rule out blinkers, pulsars, pentadecathlons and figure
eights, among other things.
(to hunt for glider syntheses of
oscillators), or that the result contains a specified pattern (to
hunt for synthesis components for specific still lifes).
One thing that can’t be done currently is have QuFince report any combination that results in an interesting still life, but without knowing which still life you want in advance. It’s not so obvious what “interesting still life” should mean exactly, but here are some randomly chosen examples of things that should qualify:
We can’t use a population threshold as our criterion for interestingness, because the typical result of one of these QuFince trials is a bunch of uninteresting junk. One option is to do proper object separation, like apgsearch, and then report any object that is sufficiently rare. But a QuFince search can conceivably test hundreds of billions of configurations, and full object separation is simply too slow.
Here I’ll present an alternative, a simple heuristic that works well enough.
April 2, 2025 / code, cuda, gol
As a second foray into CUDA, I’ve written a simple program to hunt for
crawlers in the Game of Life. The kernel itself is too revolting to
make public, but the supporting LifeStateCU
code may be useful for
others. (This could be seen as the first step in a GPU version of
CatForce
/LightCone
…)
March 8, 2025 / code, cuda, officers
Officers is a two-player “take-and-break” game played with heaps of
coins (or if you prefer, piles of beans, or officers and their
subordinates, or groups of people who form indivisible couplesIn
the equivalent game Couples-are-Forever, a move is to choose a heap
and split it into two, with the proviso that you may not split a heap
of size 2. An Officers heap of size n is equivalent to a
Couples-are-Forever heap of size n+1.
, or …). The two players
alternate turns, and every turn consists of removing a coin from a
heap and leaving the remainder in either one or two heaps. In
particular, taking away a lone coin is not a valid move. The winner is
the last player who can make a move.
For example, a game starting with a single pile of 10 coins might proceed
[10] \xrightarrow{\mathcal{L}} [3, 6] \xrightarrow{\mathcal{R}} [3, 1, 4] \xrightarrow{\mathcal{L}} [1, 1, 1, 4] \xrightarrow{\mathcal{R}} [1, 1, 1, 1, 2] \xrightarrow{\mathcal{L}} [1, 1, 1, 1, 1]
at which point player \mathcal{R} is stuck, so player \mathcal{L}
has won.In fact, he was following the winning strategy.
Although
the total number of coins decreases by 1 each turn, the outcome of the
game is not determined simply by the parity of the starting number of
coins: the moment that the game ends also depends on how many piles
are created by the players making splitting moves. As we will soon
see, the winning move from any given position is extremely
unpredictable.
We can solve a game of this kind by calculating the Grundy value for each position, and in this post I’m going to discuss my attempt at calculating these values for Officers as fast as possible.