The new Tafl engine (AI)

Post Reply
sovaz1997
Posts: 53
Joined: Fri Apr 24, 2026 9:47 am

Re: The new Tafl engine (AI)

Post by sovaz1997 »

Ytreza wrote: Mon May 18, 2026 10:46 am It seems the bug was also in the training because the engine thinks the positon is completely lost before the wrong king capture.
It'll be better once I fix it :)
Although further training might help after the fix.
sovaz1997
Posts: 53
Joined: Fri Apr 24, 2026 9:47 am

Re: The new Tafl engine (AI)

Post by sovaz1997 »

Hi all!
A new version of TaflZero is now available on the https://playtafl.org/

Larger neural network with a new architecture
WebGPU support, so for now it's will working even faster than old small nn.
The new NN recognizes forts.
About 100 Elo stronger than the previous version, and improvements are ongoing...

One downside: for the historical variant, I had to use the same "Copenhagen" network due to the new architecture. However, training a version for that variant as well won't be a problem in the future.

Forts already in self-play! (https://discord.com/channels/1497183685 ... 8732514344)

--------

Code: Select all

# PLAYER             : RATING  ERROR   POINTS  PLAYED    (%)
   1 T2 10x128 g0206    : 2510.7   25.8    331.0     432   76.6% # a lot of probably because added proved-mate heuristic
   2 T2 10x128 g0204    : 2442.8    6.7   5122.5    7304   70.1%
   3 T2 10x128 g0198    : 2402.9    6.8   4008.0    6144   65.2%
   4 T2 10x128 g0201    : 2396.2    7.3   2389.5    3773   63.3%
   5 T2 10x128 g0196    : 2395.6    7.9   2833.0    4471   63.4%
   6 T0.2 6x64 g0146    : 2388.9    4.8   7932.5   11202   70.8%
   7 T2 10x128 g0192    : 2367.3    7.8   2486.0    4183   59.4%
   8 T2 10x128 g0195    : 2363.4    8.1   1984.5    3437   57.7%
   9 T2 10x128 g0190    : 2343.2    9.7   1300.5    2503   52.0%
  10 T2 10x128 g0184    : 2342.1    6.6   3032.5    5246   57.8%
  11 T2 10x128 g0180    : 2328.9    7.7   1831.5    3484   52.6%
  12 T2 10x128 g0187    : 2322.1    8.6   2030.5    3837   52.9%
  13 T2 10x128 g0178    : 2309.3    8.3   1391.0    2917   47.7%
  14 T2 10x128 g0171    : 2296.6    6.6   2480.0    4816   51.5%
  15 T2 6x64 g0157      : 2267.0    5.7   4150.0    8080   51.4%
  16 T2 10x128 g0167    : 2263.3    7.2   2314.5    4920   47.0%
  17 T2 6x64 g0149      : 2247.3    4.8   6077.5   11992   50.7%
  18 T2 6x64 g0141      : 2238.3    6.2   3311.0    7195   46.0%
  19 T2 6x64 g0138      : 2233.3    5.4   3300.5    7270   45.4%
  20 T2 6x64 g0127      : 2207.7    5.1   4511.5   10192   44.3%
  21 T2 6x64 g0122      : 2198.4    5.8   4375.0   10196   42.9%
  22 T2 6x64 g0132      : 2184.6    6.1   2739.0    7124   38.4%
  23 T2 6x64 g0124      : 2168.0    5.4   3928.5   10194   38.5%
  24 T2 6x64 g0120      : 2146.8    4.7   4345.5   12198   35.6%
  25 T2 6x64 g0119      : 2135.1    5.3   3948.0   11198   35.3%
sovaz1997
Posts: 53
Joined: Fri Apr 24, 2026 9:47 am

Re: The new Tafl engine (AI)

Post by sovaz1997 »

Last tests:

Code: Select all

# PLAYER             : RATING  ERROR   POINTS  PLAYED    (%)
   1 T2 10x128 g0213    : 2548.5    8.9   3398.5    4265   79.7%
   2 T2 10x128 g0209    : 2491.9    6.3   5269.0    7069   74.5%
   3 T2 10x128 g0208    : 2488.0   11.1   1704.5    2409   70.8%
   4 T2 10x128 g0206    : 2465.6    9.8   2088.5    3007   69.5%
   5 T2 10x128 g0204    : 2417.9    6.0   5345.0    7892   67.7%
   6 T2 10x128 g0198    : 2377.9    6.3   4199.0    6733   62.4%
   7 T2 10x128 g0196    : 2371.5    7.0   3025.5    5060   59.8%
   8 T2 10x128 g0201    : 2369.6    5.8   2567.5    4361   58.9%
   9 T0.2 6x64 g0146    : 2363.9    5.1   8098.5   11793   68.7%
+185 elo over old version!

Also recently launched engine matches - https://tv.playtafl.org/
Also updated engine to gen213 on https://playtafl.org/
GaryW
Posts: 5
Joined: Wed Jun 24, 2026 8:43 pm

Re: The new Tafl engine (AI)

Post by GaryW »

Hi, could someone advise me on how the AI player rating system is calculated. Apologies if I have missed an explanation elsewhere in the posts. I have created a Hnefatafl game with AI players of various strengths. I have implemented;

Search Algorithm

Minimax with Alpha-Beta pruning — the core search that looks ahead several moves, pruning branches that can't improve the result
Iterative Deepening — searches depth 1, then 2, then 3 etc., using time budgets
Transposition Table — caches previously evaluated positions to avoid repeating work
Killer Move Heuristic — tries moves that caused cutoffs in sibling nodes first
Late Move Reduction (LMR) — searches quiet (non-tactical) late moves at reduced depth, re-searching only if they look promising
Move Ordering
Moves are prioritised: king escape wins → blocking escape → capture threats → actual captures → defender protection → positional moves.

Opening Book

MCTS (Monte Carlo Tree Search)
Available as an alternative at higher strength levels

Web Worker

It plays all board sizes, 7x7 through to 19x19 and ten rulesets including Old, Copenhagen, Fetlar, Tawlbrdd, Ard Ri, Brandub, Magpie, Tablut, Berserk and Sea Battle.

I have not ventured into the realm of neural networks but I'm keen to learn how to measure the effectiveness of the AI so far implemented.

Thank you in advance for any guidance.
Ytreza
Posts: 46
Joined: Tue Aug 27, 2019 5:56 pm

Re: The new Tafl engine (AI)

Post by Ytreza »

Without neural network you cannot have a decent engine.
GaryW
Posts: 5
Joined: Wed Jun 24, 2026 8:43 pm

Re: The new Tafl engine (AI)

Post by GaryW »

Thanks for your reply, I had avoided a neural approach as it seems that also requires a very focussed board size and rule set, whereas for my game app I've been trying to have the engine tackle all board sizes and various rule sets, but I have of course come to the realization that 'jack of all trades, master of none' is the likely result.
sovaz1997
Posts: 53
Joined: Fri Apr 24, 2026 9:47 am

Re: The new Tafl engine (AI)

Post by sovaz1997 »

GaryW wrote: Mon Oct 12, 2026 11:13 pm Hi, could someone advise me on how the AI player rating system is calculated. Apologies if I have missed an explanation elsewhere in the posts. I have created a Hnefatafl game with AI players of various strengths. I have implemented;

Search Algorithm

Minimax with Alpha-Beta pruning — the core search that looks ahead several moves, pruning branches that can't improve the result
Iterative Deepening — searches depth 1, then 2, then 3 etc., using time budgets
Transposition Table — caches previously evaluated positions to avoid repeating work
Killer Move Heuristic — tries moves that caused cutoffs in sibling nodes first
Late Move Reduction (LMR) — searches quiet (non-tactical) late moves at reduced depth, re-searching only if they look promising
Move Ordering
Moves are prioritised: king escape wins → blocking escape → capture threats → actual captures → defender protection → positional moves.

Opening Book

MCTS (Monte Carlo Tree Search)
Available as an alternative at higher strength levels

Web Worker

It plays all board sizes, 7x7 through to 19x19 and ten rulesets including Old, Copenhagen, Fetlar, Tawlbrdd, Ard Ri, Brandub, Magpie, Tablut, Berserk and Sea Battle.

I have not ventured into the realm of neural networks but I'm keen to learn how to measure the effectiveness of the AI so far implemented.

Thank you in advance for any guidance.
Hi, I'm used Ordo (util that used for calculate ratings from chess game files).
You can try, maybe approach without NN could work on smaller board sizes, with more simple rules.
GaryW
Posts: 5
Joined: Wed Jun 24, 2026 8:43 pm

Re: The new Tafl engine (AI)

Post by GaryW »

Thanks, I'll look at Ordo. I think what I've realised is that without a neural approach, the ai engine is more reactionary than strategic. I should add that I've used ai to generate the engine and to continue tweaking it based on ai self play games.
sovaz1997
Posts: 53
Joined: Fri Apr 24, 2026 9:47 am

Re: The new Tafl engine (AI)

Post by sovaz1997 »

Hello everyone! I'm updated website https://playtafl.org/.
TaflZero now plays significantly stronger overall.

You can choose a difficulty level from 1 to 21 (level 21 uses a larger nn, which may run more slowly).
Also there are new analysis mode and you can analyze your games.

Historical Hnefatafl and Tablut can also be played. For now, they use older neural networks, which are also slated for further training.

I don’t want to jump to conclusions, but it’s likely that TaflZero in Copenhagen variant currently surpasses every human on the planet in terms of playing strength. Not sure, and it would be interesting to know.
Draganov
Posts: 77
Joined: Fri Oct 30, 2020 2:59 pm

Re: The new Tafl engine (AI)

Post by Draganov »

I played against it with the blacks on the Level 21 with 1s per move and managed to win (I also played blitz, thinking maybe 1-3 seconds per move). I am definitely stronger than level 21 (1s per move). However, I am sure it is stronger than me, if it has more time to think. I also recognized that it didn't detect that I won in one of the games in which I managed to take all of its pieces and blocked its king without possible move. So, the game continued despite the engine couldn't make a move.
I think the engine is strong enough to give us the evaluation of the world champions. I hope you will be able to analyze the championship games of all of the Hnefatafl world champions and present us with statistics. I wonder who played the best tafl over the years. Some interesting questions are:
How good was Schachus in 2014? Was he back then better than Casshern now?
How well I played in my peak in 2021? Was I playing better in 2021 than in 2024 when I won my second world championship?
How good was Plantagenet in 2017 when he defeated a green version of Casshern? Will Plantagenet from 2017 played better tafl than Casshern nowadays?
Did the overall strength of the players has increased over the years or Schachus, Nath and Crust were superior?

For the research, you can take only the championship games for all of the winners in the world championships and analyze the games. I think we need to exclude from the analyzes positions that are completely won by one of the sides. For example, the engine will still detect some errors when the blacks are winning by blocking all of the corners and have a black cordon build because in such a position, the blacks might not play the optimal moves but they actually don't need to find the best moves. Or when the whites are in a completely lost position, they might choose to play a sub-optimal move that has more potential to bring some complications on the board. Such positions should be excluded unless the errors led to losing the game or completely changed the chances in the position. Maybe the best way is to exclude analyzes of positions in which one of the sides have an advantage more than 50 points.
Post Reply