<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ctak/include/negamax.c, branch hybrid_rootstrap</title>
<subtitle>An implementation of Tak and a computer opponent in C</subtitle>
<id>https://git.l-3.space/ctak/atom/include/negamax.c?h=hybrid_rootstrap</id>
<link rel='self' href='https://git.l-3.space/ctak/atom/include/negamax.c?h=hybrid_rootstrap'/>
<link rel='alternate' type='text/html' href='https://git.l-3.space/ctak/'/>
<updated>2026-09-16T20:02:53Z</updated>
<entry>
<title>fix tt issue for non-self-play</title>
<updated>2026-09-16T20:02:53Z</updated>
<author>
<name>tslil</name>
<email>tslil@posteo.de</email>
</author>
<published>2026-09-16T19:10:33Z</published>
<link rel='alternate' type='text/html' href='https://git.l-3.space/ctak/commit/?id=1898add0142b70b3fef5af78a6f3d7399a3f2cd5'/>
<id>urn:sha1:1898add0142b70b3fef5af78a6f3d7399a3f2cd5</id>
<content type='text'>
A little subtle, but in non-self-play games sharing tt entries is incorrect. We must therefore key additionally on the evaulation function itself.
</content>
</entry>
<entry>
<title>flood fill for roads, fix dragon, memoise leaf eval, enable diagonal in nn_train.py</title>
<updated>2026-09-12T14:47:15Z</updated>
<author>
<name>tslil</name>
<email>tslil@posteo.de</email>
</author>
<published>2026-09-11T17:36:10Z</published>
<link rel='alternate' type='text/html' href='https://git.l-3.space/ctak/commit/?id=a361728f39812e25599323c52510c0eb3131bd90'/>
<id>urn:sha1:a361728f39812e25599323c52510c0eb3131bd90</id>
<content type='text'>
</content>
</entry>
<entry>
<title>~25% speedup in selfplay due to: incremental zobrist hashing, smarter road checking, re-using the input computed for the NN</title>
<updated>2026-09-09T20:45:17Z</updated>
<author>
<name>tslil</name>
<email>tslil@posteo.de</email>
</author>
<published>2026-09-08T10:55:28Z</published>
<link rel='alternate' type='text/html' href='https://git.l-3.space/ctak/commit/?id=1c9e266ae25f7f6067806d139e5971ce8513d2f6'/>
<id>urn:sha1:1c9e266ae25f7f6067806d139e5971ce8513d2f6</id>
<content type='text'>
</content>
</entry>
<entry>
<title>TD-leaf and another negamax bug</title>
<updated>2026-09-04T20:03:59Z</updated>
<author>
<name>tslil</name>
<email>tslil@posteo.de</email>
</author>
<published>2026-09-03T19:17:22Z</published>
<link rel='alternate' type='text/html' href='https://git.l-3.space/ctak/commit/?id=1ca3309dad9d412870b2b793f33af7a7ccabd514'/>
<id>urn:sha1:1ca3309dad9d412870b2b793f33af7a7ccabd514</id>
<content type='text'>
TD-lambda and TD-leaf are separated by the observation that minimax with a parameterised leaf heuristic is differentiable* in the parameters. "All" that had to be done was to extract the "principal variation": which one position survived all of the pruning to become the reported value.

This was a bit fiddly and uncovered a subtle bug (again) in negamax.c: we were not being complete in our overriding of the TT entry and by omitting key it was possible that later searches would find incorrect values.

The more interesting question to me was: how do we introduce enough variety while not corrupting the PV chain? I settled on having selfplay have one of the players be epsilon-random but the other greedy (minimax) and simply report only the greedy portion PV chain. This appears to work well enough in practice and doesn't introduce nonsense training data for the net (we don't force its actions to be nonsensical). I also deciced, perhaps in a departure from tradition, that we had good supervised labels for PVs that happened to be winning states, so the training overrides the targets in that case. Finally rolled back some of the ambition in nn_train.py default arguments.

*almost always
</content>
</entry>
<entry>
<title>TD(lambda), and a big rework</title>
<updated>2026-09-02T11:13:01Z</updated>
<author>
<name>tslil</name>
<email>tslil@posteo.de</email>
</author>
<published>2026-08-30T18:46:07Z</published>
<link rel='alternate' type='text/html' href='https://git.l-3.space/ctak/commit/?id=241156da6f35cb888253e6b8814e7b61a76b4fc7'/>
<id>urn:sha1:241156da6f35cb888253e6b8814e7b61a76b4fc7</id>
<content type='text'>
NOTE: 6x6 weights are as-yet untrained

On the performance side:
* switch from linked-list chaining hash table to direct mapping
* cache check_win by hash
* persist transposition tables across plies (this was a big deal and difficult to puzzle out)
* add align directives to the network floats
* prepare_nn_input gained a small LUT to avoid branching (i suppose you might call this 1D embedding)
* apply mtune=native for the native builds

On the correctness side:
* Zobrist has now includes the ply parity
* the network now predicts something in [-1, 1] using tanh (approximated by polynomials)
* the training object is now MSE because we're learning a value estimate
* use .clangd instead of compile_commands.json

On the training side:
* completely forgo human-derived data set
* implement td(lambda), self-play, tournaments
</content>
</entry>
<entry>
<title>fix longstanding negamax bug</title>
<updated>2026-05-05T21:16:39Z</updated>
<author>
<name>tslil</name>
<email>tslil@posteo.de</email>
</author>
<published>2026-05-05T21:06:02Z</published>
<link rel='alternate' type='text/html' href='https://git.l-3.space/ctak/commit/?id=696c3808220ea9d8c604939894a2d509f05cc4c6'/>
<id>urn:sha1:696c3808220ea9d8c604939894a2d509f05cc4c6</id>
<content type='text'>
we needed to be saving the alpha before the search loop in which we modified it. At this point, though i can't remember, i expect that this is the cause of whatever "instability" the comment was talking about that would have prevented us from using &gt;= in the TT lookup.
</content>
</entry>
<entry>
<title>switch to returning an array of actions instead of a linked list</title>
<updated>2023-01-29T20:52:40Z</updated>
<author>
<name>tslil clingman</name>
<email>tslil@posteo.de</email>
</author>
<published>2023-01-29T19:49:04Z</published>
<link rel='alternate' type='text/html' href='https://git.l-3.space/ctak/commit/?id=2e5ffeaf928626c81ea3147b57b7ee2c660ebfae'/>
<id>urn:sha1:2e5ffeaf928626c81ea3147b57b7ee2c660ebfae</id>
<content type='text'>
- attempts to keep the same move ordering as the list method
- saves ~170msec on a depth 7 search for a given board configuration
- there is room to improve the pre-allocation size estimates, these
  bounds are not obviously tight and it may or may not be faster to
  have tighter bounds or even some form of estimation
</content>
</entry>
<entry>
<title>might as well enable size 6</title>
<updated>2023-01-21T21:00:57Z</updated>
<author>
<name>tslil clingman</name>
<email>tslil@posteo.de</email>
</author>
<published>2023-01-21T18:30:45Z</published>
<link rel='alternate' type='text/html' href='https://git.l-3.space/ctak/commit/?id=72c5056c5aa614d9a86f8b760955cfcf96c44be4'/>
<id>urn:sha1:72c5056c5aa614d9a86f8b760955cfcf96c44be4</id>
<content type='text'>
Same network architecture, same training principle. Predictably this is
too slow.

Also statically allocate state in driver programmes.
</content>
</entry>
<entry>
<title>Change transposition table lookup policy</title>
<updated>2023-01-19T21:40:24Z</updated>
<author>
<name>tslil clingman</name>
<email>tslil@posteo.de</email>
</author>
<published>2023-01-19T21:40:24Z</published>
<link rel='alternate' type='text/html' href='https://git.l-3.space/ctak/commit/?id=24d590fb7fe501a59c9ee0268a956a6fbf4fa092'/>
<id>urn:sha1:24d590fb7fe501a59c9ee0268a956a6fbf4fa092</id>
<content type='text'>
Given the approximate nature of the evaluations and truncated tree
searches, the result of negamax will always be sensitive to the
particulars of the depth bounding and the conditions for referring to
precomputed values.

The tradeoff here is a slight performance penalty (~200ms at depth 6
on my old Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz), but a greatly
increased opponent strength as compared to `&gt;=`, and the old
convolutional network (flawed as the implementation was).
</content>
</entry>
<entry>
<title>switch to explicit game state &amp; important bug fix &amp; clang format</title>
<updated>2023-01-16T11:25:47Z</updated>
<author>
<name>tslil clingman</name>
<email>tslil@posteo.de</email>
</author>
<published>2023-01-15T20:31:00Z</published>
<link rel='alternate' type='text/html' href='https://git.l-3.space/ctak/commit/?id=ef785da721a47e6d13aa854c795d2a9e269285b0'/>
<id>urn:sha1:ef785da721a47e6d13aa854c795d2a9e269285b0</id>
<content type='text'>
Previously the code base assumed that there was a single, global game
state which was the implicit target of all actions taken. Looking
ahead at architectural improvements, this has now been (almost
entirely) made explicit and functions take tak_state_p where
necessary (and also where unnecessary).

Two important fixes to actions.c were made:

- Previously when generating the possible stack moves, stack height
overflows (&gt; 15) were not taken into account and this resulted in the
tree search corrupting the board state. Now action search does not
list all legal actions, rather the subset of these encodeable by the
implementation.

- The check for crushing on a stack move was incorrect (too strict),
and this resulted in many legitimate moves being igonored.

Finally, in other changes, weights have also been improved by training
all games instead of some subset for chosen players, and clang-format
was run on the codebase.
</content>
</entry>
</feed>
