The new Tafl engine (AI)

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

The new Tafl engine (AI)

Post by sovaz1997 »

Hello everyone!
I'd like to share my development of a new Tafl engine - TaflZero. It currently implements the rules of Copenhagen Hnefatafl 11x11.

You can play with it here: https://playtafl.org/
You can ask me questions and give me feedback :)

Links
Discord server: https://discord.com/invite/BvakpmGSTa
Source code: https://github.com/sovelin/taflzero
Last edited by sovaz1997 on Mon Apr 27, 2026 3:25 am, edited 8 times in total.
Draganov
Posts: 75
Joined: Fri Oct 30, 2020 2:59 pm

Re: The new Tafl engine (AI)

Post by Draganov »

I tested it and I am definitely amazed. It is by far the strongest tafl engine that I have ever seen. The previously existing engines had playing strength of about 1400-1500 (if we use the rating system on Aage's website).
I tested your engine with the default thinking time of 1 second per move and I managed to beat it with the blacks most of the times (I also played blitz thinking 2-3 seconds per move). However, the games were really dynamic and intensive. However, when the engine plays with the blacks, it plays much worse. It can't effectively defend against shieldwall or exit forts. So, based on my estimation the default version (1 sec per move) plays at around 2000 rating with the whites and 1600 with the blacks. I am planning to test it with 10 seconds per move and see if I will manage to win a game against it.
We need more strong players like Alex Hnefatafl, OdinHimself, Cacreal, Plantagenet, Herjan or myself to test it. It will be interesting to see if we can win against it. The biggest challenge for your AI will be Casshern who is by far the best tafl player who has ever played. If the engine can beat Casshern, the tafl game will be death like the chess is death.
sovaz1997
Posts: 43
Joined: Fri Apr 24, 2026 9:47 am

Re: The new Tafl engine (AI)

Post by sovaz1997 »

Thank you very much! Yes, your words were passed on to me.
I'm used AlphaZero approach in this.

I’m planning to release a local version that runs on GPU — it will be 50–100 times faster.

Training is ongoing, and I believe the engine will continue to get stronger. Attackers has a more strategic style of play, and it takes longer to learn.
sovaz1997
Posts: 43
Joined: Fri Apr 24, 2026 9:47 am

Re: The new Tafl engine (AI)

Post by sovaz1997 »

(message from small forum)
Waclaw: I accidentally found a sequence of moves for Black that loops the AI. There are 24 pairs of moves in total. I repeated it three times with the same effect. This AI is not programmed to make an unfavorable move. However, such a move would allow it to continue playing.


Yeah, the engine deterministic. But I can add the parameter that will add some randomness into the engine. This is already used in nn learning, without it engine would play one game always and training would be impossible.
sovaz1997
Posts: 43
Joined: Fri Apr 24, 2026 9:47 am

Re: The new Tafl engine (AI)

Post by sovaz1997 »

Btw I made local match between 100 node per move vs 2500 nodes per move

It's like CPU vs GPU on same time (1s):
Or like CPU (1s) vs. CPU (25s)

Code: Select all

# PLAYER                    : RATING    POINTS  PLAYED    (%)
1 TaflZero NN 2500 nodes    : 2641.0     196.0     200   98.0%
2 TaflZero NN 100 nodes     : 1959.0       4.0     200    2.0%

So in general I'm working on local gui for the engine and it will possible to launch it in GPU.
Will add playing vs. engine and analysis mode first.
Draganov
Posts: 75
Joined: Fri Oct 30, 2020 2:59 pm

Re: The new Tafl engine (AI)

Post by Draganov »

I found out another weak point in its play with the whites. When playing with the whites, the engine is playing very sharply trying to set up guillotine positions or attacking the corners in a strong way, mobilizing the king early and putting a lot of pressure on the corners. However, I found out that in some games, the engine managed to clear 5-6 squares on the edge and instead of trying to build an exit fort, which will be impossible for me to block, decided to continue penetrating the corners. I think it put much more weight on attacking the corners and neglecting the exit fort options. In some of the games, I managed to block its king on the edge. The engine had a good position but missed my moves that blocked the king on the edge and it lost the game.
Waclaw
Posts: 1
Joined: Sat Apr 25, 2026 8:53 am

Re: The new Tafl engine (AI)

Post by Waclaw »

Here are the screenshots. Although you have already responded to that situation.
Attachments
1777104538611.jpg
1777104538611.jpg (44.36 KiB) Viewed 562 times
1777104528308.jpg
1777104528308.jpg (33.24 KiB) Viewed 562 times
1777104516345.jpg
1777104516345.jpg (51.12 KiB) Viewed 562 times
Draganov
Posts: 75
Joined: Fri Oct 30, 2020 2:59 pm

Re: The new Tafl engine (AI)

Post by Draganov »

I managed to beat it on 10 sec per move. So, I think on 10 sec it plays like a 2100 player. In my opinion the engine on 10 sec plays as strong as myself.
Sovaz, could you test it to play against itself when both sides have 1 minute per move. Maybe it will give us an answer which side is stronger - the blacks or the whites.
Could you also share the game notation when both sides played with 1 minute per move? I just want to see this ultra-high quality game.
Is it possible to add an option where a player can upload a game notation and the engine to analyze how well both players played. I want to analyze the championship games of the world champions and see how well Schachus played in 2014 or Herjan in 2016. It will answer a lot of interesting questions like whether the best version of Herjan played better than the champion version of Adam? Was Casshern better in his champion years than Plantagenet in 2017? How strong was I in 2021?
For example in chess.com we have a similar function to analyze the games of other players. And some chess enthusiasts made projects of comparing the world champions and their accuracy.
sovaz1997
Posts: 43
Joined: Fri Apr 24, 2026 9:47 am

Re: The new Tafl engine (AI)

Post by sovaz1997 »

Hello guys!
Now it's possible to copy your games with this button. You will got link that you can past here, and game will opened! Like this: https://playtafl.org/?game=RwAzYWFhYWEz ... wDsxfRDWsd

Image
sovaz1997
Posts: 43
Joined: Fri Apr 24, 2026 9:47 am

Re: The new Tafl engine (AI)

Post by sovaz1997 »

Draganov wrote: Sat Apr 25, 2026 10:15 am I managed to beat it on 10 sec per move. So, I think on 10 sec it plays like a 2100 player. In my opinion the engine on 10 sec plays as strong as myself.
Sovaz, could you test it to play against itself when both sides have 1 minute per move. Maybe it will give us an answer which side is stronger - the blacks or the whites.
Could you also share the game notation when both sides played with 1 minute per move? I just want to see this ultra-high quality game.
Is it possible to add an option where a player can upload a game notation and the engine to analyze how well both players played. I want to analyze the championship games of the world champions and see how well Schachus played in 2014 or Herjan in 2016. It will answer a lot of interesting questions like whether the best version of Herjan played better than the champion version of Adam? Was Casshern better in his champion years than Plantagenet in 2017? How strong was I in 2021?
For example in chess.com we have a similar function to analyze the games of other players. And some chess enthusiasts made projects of comparing the world champions and their accuracy.
Okay! Yeah, I can do it :)
Today I will make mini-match between GPU versions on 1 minute and try to prepare the links to high quality games.

I think it will be stronger tactically on more time, but won't understand some positional concepts.
Therefore, the training continues. Sooner or later, she'll (hopefully) discover more complex patterns.

So, 1 minute per move on my GPU is equal to 1-2 hours per move on web, will start soon!
Post Reply