<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ctak/include, branch main</title>
<subtitle>An implementation of Tak and a computer opponent in C</subtitle>
<id>https://git.l-3.space/ctak/atom?h=main</id>
<link rel='self' href='https://git.l-3.space/ctak/atom?h=main'/>
<link rel='alternate' type='text/html' href='https://git.l-3.space/ctak/'/>
<updated>2026-08-28T18:37:41Z</updated>
<entry>
<title>fix longstanding negamax bug</title>
<updated>2026-08-28T18:37:41Z</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=c415ed2a0bbab890fc1fdd2179c8f1405940c15a'/>
<id>urn:sha1:c415ed2a0bbab890fc1fdd2179c8f1405940c15a</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>2026-08-28T18:37:41Z</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=f0139acd1d648dd1db93ee3d3b75546fb7b24c77'/>
<id>urn:sha1:f0139acd1d648dd1db93ee3d3b75546fb7b24c77</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>2026-08-28T18:37:41Z</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=0e81096d5ecb6027814e7aae10b461e774f96407'/>
<id>urn:sha1:0e81096d5ecb6027814e7aae10b461e774f96407</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>2026-08-28T18:37:41Z</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=cb2b78ced27fc7996ed11c3450f69138d7d1b61f'/>
<id>urn:sha1:cb2b78ced27fc7996ed11c3450f69138d7d1b61f</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>2026-08-28T18:37:41Z</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=0223a9bec5535fced1a7698b55fd42155d9b0446'/>
<id>urn:sha1:0223a9bec5535fced1a7698b55fd42155d9b0446</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>
<entry>
<title>new neural network arch (faster + better) &amp; minor changes + fixes</title>
<updated>2026-08-28T18:37:41Z</updated>
<author>
<name>tslil clingman</name>
<email>tslil@posteo.de</email>
</author>
<published>2023-01-15T15:03:37Z</published>
<link rel='alternate' type='text/html' href='https://git.l-3.space/ctak/commit/?id=ee216c008a188a9436fedb85c70ee5d1719733b1'/>
<id>urn:sha1:ee216c008a188a9436fedb85c70ee5d1719733b1</id>
<content type='text'>
Gone is the convolutional neural network, for it turns out not only is
it more difficult to train, but all of the extra information about
board layers didn't make much of a difference at this size.

So cnn1986 has been replaced by nn1986, a standard, two-layer, dense
nn configured as a binary classifier and (mis)used in that capacity.
Note: total number of parameters is unchanged.

HARK: this new nn exposes a bug somewhere in ctak. Run ctlm with
self-play to see the completely borked board state at the end.
</content>
</entry>
<entry>
<title>Welcome geminict!</title>
<updated>2026-08-28T18:37:41Z</updated>
<author>
<name>tslil clingman</name>
<email>tslil@posteo.de</email>
</author>
<published>2021-10-05T22:22:23Z</published>
<link rel='alternate' type='text/html' href='https://git.l-3.space/ctak/commit/?id=cf175fc346f1b208766b1f55d3673a7b208f322a'/>
<id>urn:sha1:cf175fc346f1b208766b1f55d3673a7b208f322a</id>
<content type='text'>
This is a special interface to negamax_cnn1986 which is designed to
generate output for use in a CGI tak interface to be used over gemini.

Also in this commit is a reformating of the various source files to
use the traditional tab width of 8 spaces.
</content>
</entry>
<entry>
<title>More towel wringing: re-implemented check_road_colour</title>
<updated>2026-08-28T18:37:41Z</updated>
<author>
<name>tslil clingman</name>
<email>tslil@posteo.de</email>
</author>
<published>2021-07-02T16:00:00Z</published>
<link rel='alternate' type='text/html' href='https://git.l-3.space/ctak/commit/?id=640d404b3cf3324aca4424fc3da4806d4562d0e4'/>
<id>urn:sha1:640d404b3cf3324aca4424fc3da4806d4562d0e4</id>
<content type='text'>
Previously check_win would call check_road_colour once for each road
colour, and check_road_colour would call a depth-first search (DFS)
for each of the two axes. This meant that we were doing (up to) *four*
depth-first searches for each call of check_win.

I have replaced both axial DFS with the world's worst TM
implementation of a connected component generation algorithm backed by
the least guaranteed disjoint set data structure. Essentially doing
anything about union find correctly is slower than just ... not doing
it. Although we lose the asymptotic complexity, in practice we're
doing this millions of times per turn, for a fixed board size and
that's what matters.

All in all, it appears that i've managed to shave about 69ns off
check_win, per call -- nice! This amounts to 50ms or so saved at depth
5 per engine move, in one of my test games.

Unfortunately nearly 99% of the time is still taken by evaluating the
convolutional neural network. It's slow.
</content>
</entry>
<entry>
<title>Trying to make things faster</title>
<updated>2026-08-28T18:37:41Z</updated>
<author>
<name>tslil</name>
<email>tslil@posteo.de</email>
</author>
<published>2021-06-01T19:20:48Z</published>
<link rel='alternate' type='text/html' href='https://git.l-3.space/ctak/commit/?id=0deb42134cb7f0ed6ec809c3de1052ab2dfe2235'/>
<id>urn:sha1:0deb42134cb7f0ed6ec809c3de1052ab2dfe2235</id>
<content type='text'>
I tried the following, but they all made things worse:
- moving away from the singly-linked (tail tracking) list for actions
	by:
	  + using an array zipper for a deque
		+ using an array to poorly hold a floating deque
- caching the results of generating move lists in the transposition
	table and then
		+ copying the resulting list/zip/deque instead of generating it
		+ applying the move-to-front without copying, but this made the
			search order worse. Presumably in this case shallower nodes were
			messing up the search tree with garbage moves?

I think some of this is not supposed to happen, but i have just the
right combination of poor evaluation function and naively ordered and
cheap move generation that i'm in a local minimum here.
</content>
</entry>
<entry>
<title>Fix copyright notice in files, and small preemptive optimisation</title>
<updated>2026-08-28T18:37:41Z</updated>
<author>
<name>tslil clingman</name>
<email>tslil@posteo.de</email>
</author>
<published>2021-03-28T04:19:05Z</published>
<link rel='alternate' type='text/html' href='https://git.l-3.space/ctak/commit/?id=2dbb9fa9b69e49d49cebb1c17559f6fe67600a4d'/>
<id>urn:sha1:2dbb9fa9b69e49d49cebb1c17559f6fe67600a4d</id>
<content type='text'>
Eventually there'll be a more complicated data generation step than
the one we're presently using, so having it in-lined in the loop is
wasteful. Ideally also this would be update per ply and we could avoid
recalculating it entirely for every query -- though it's probably
``fast enough'' for now. Also, caching is WIP.
</content>
</entry>
</feed>
