diff options
| author | tslil <tslil@posteo.de> | 2021-07-02 12:00:00 -0400 |
|---|---|---|
| committer | tslil <tslil@posteo.de> | 2026-08-28 19:37:41 +0100 |
| commit | 07c5dded49d5943f54cca0c75a7a93a30ee2f323 (patch) | |
| tree | b10b8d5b76a8fe6021552fd1750289621586e563 /COPYING | |
| parent | 0deb42134cb7f0ed6ec809c3de1052ab2dfe2235 (diff) | |
More towel wringing: re-implemented check_road_colour
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.
Diffstat (limited to 'COPYING')
0 files changed, 0 insertions, 0 deletions
