The new Tafl engine (AI)

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

Re: The new Tafl engine (AI)

Post by sovaz1997 »

On 50K nodes (Nath vs. Bainn) https://playtafl.org/?game=RwAzYWFhYWEz ... UWFQHgCm0B
It's equal to 10 minutes per move on the https://playtafl.org/

Code: Select all

[1/28] black f2i2  winrate 41.8%
  [2/28] white e5e2  winrate 39.3%
  [3/28] black b6b3  winrate 43.3%
  [4/28] white f5b5  winrate 37.1%
  [5/28] black d1d2  winrate 48.5%
  [6/28] white f4c4  winrate 47.0%
  [7/28] black d2c2  winrate 51.5%
  [8/28] white d6d1  winrate 47.8%
  [9/28] black f10c10  winrate 67.2%
  [10/28] white f6f3  winrate 68.1%
  [11/28] black j6j3  winrate 74.4%
  [12/28] white f3d3  winrate 73.6%
  [13/28] black d11d4  winrate 88.9%
  [14/28] white e6e4  winrate 90.1%
  [15/28] black a6d6  winrate 91.1%
  [16/28] white d1c1  winrate 91.3%
  [17/28] black j3e3  winrate 92.6%
  [18/28] white c4c3  winrate 92.8%
  [19/28] black a4a2  winrate 93.9%
  [20/28] white c3c6  winrate 94.1%
  [21/28] black d6d5  winrate 95.6%
  [22/28] white c6c5  winrate 94.0%
  [23/28] black a7d7  winrate 96.2%
  [24/28] white d3d1  winrate 94.9%
  [25/28] black d5d2  winrate 99.5%
  [26/28] white c1c4  winrate 99.5%
  [27/28] black b3b1  winrate 99.6%
  [28/28] white d1c1  winrate 99.8%
  White accuracy: 98.7%  |  Black accuracy: 94.5%
@Draganov I gave some deep analysis examples.
Perhaps the engine analyzes well enough if given time.
I'm interested in your opinion on the proposed moves:

So, for engine, mistakes was in next moves:
5. f10c10 (suggested best: f1f3, c2c1, g1g3 later and even with small advantage for black)
6. j6j3 (suggested: h1h3). But position already not good for black
7. d11d4 (suggested: d11d6). After this "mistake" engine thinks that position probably lost for black with 10% chance for white estimated
Ytreza
Posts: 45
Joined: Tue Aug 27, 2019 5:56 pm

Re: The new Tafl engine (AI)

Post by Ytreza »

Moving 2nd line attackers toward corners too early is usually a bad idea.

Playing against the engine I notice it loves playing on the 3rd row, even if it means letting defenders access corners.

I'm actually impressed how the engine playing white finds potential in the opening. It knows the right timing to get the king out, and when and how to invade a corner efficiently. In actual corner fights it might start doing weird things, like repetitions that don't make sense, or missing obvious tactics. And in endgame it's pretty bad at the moment.

To make it learn edge forts more efficiently, maybe you could start by training it on endgame problems instead of just letting it play against itself? Or do you think it would overfit?

Personnally I believe it is not strong enough yet to analyze top player games in a meaningful way. However I would very much like to see how it evaluates the game balance, even without edge forts. I'd suggest you take some models at various training stages and let them play eg 1000 games, then plot the balance as function of training stage. I can also try to do it but this week is busy :)
sovaz1997
Posts: 43
Joined: Fri Apr 24, 2026 9:47 am

Re: The new Tafl engine (AI)

Post by sovaz1997 »

Ytreza wrote: Mon Apr 27, 2026 7:21 am Moving 2nd line attackers toward corners too early is usually a bad idea.

Playing against the engine I notice it loves playing on the 3rd row, even if it means letting defenders access corners.

I'm actually impressed how the engine playing white finds potential in the opening. It knows the right timing to get the king out, and when and how to invade a corner efficiently. In actual corner fights it might start doing weird things, like repetitions that don't make sense, or missing obvious tactics. And in endgame it's pretty bad at the moment.

To make it learn edge forts more efficiently, maybe you could start by training it on endgame problems instead of just letting it play against itself? Or do you think it would overfit?

Personnally I believe it is not strong enough yet to analyze top player games in a meaningful way. However I would very much like to see how it evaluates the game balance, even without edge forts. I'd suggest you take some models at various training stages and let them play eg 1000 games, then plot the balance as function of training stage. I can also try to do it but this week is busy :)
We already have the balance graphic, here for every 1 million positions in train process:

Image
To make it learn edge forts more efficiently, maybe you could start by training it on endgame problems instead of just letting it play against itself? Or do you think it would overfit?
So far, ELO is growing thanks to basic training.
It's probably too early now, and manually feeding it data would be very difficult to provide enough. And yes, it can retrain itself from that.
Ytreza
Posts: 45
Joined: Tue Aug 27, 2019 5:56 pm

Re: The new Tafl engine (AI)

Post by Ytreza »

We already have the balance graphic, here for every 1 million positions in train process:
Great! I assume the sharp transition is when it learned basic corner tactics?

If you need more ressources for training, I might have access to a supercomputing center.
sovaz1997
Posts: 43
Joined: Fri Apr 24, 2026 9:47 am

Re: The new Tafl engine (AI)

Post by sovaz1997 »

Definitely, it was corners :)
Ytreza
Posts: 45
Joined: Tue Aug 27, 2019 5:56 pm

Re: The new Tafl engine (AI)

Post by Ytreza »

Actually white having 40% wins without edge forts is surprisingly good. I would have expected black to always be able to close corners.

Honestly when playing black against the engine I have a hard time defending corners and when I manage it's at the cost of a lot of pieces and leaving sides wide open. I get the impression the only reason I win is because the AI doesn't know the forts.

That said building edge forts is not an easy task so the game might actually end up being very balanced at the end of the day! Very exciting :)
sovaz1997
Posts: 43
Joined: Fri Apr 24, 2026 9:47 am

Re: The new Tafl engine (AI)

Post by sovaz1997 »

Yes, the result is good.
Maybe that's why the nn doesn't look at forts, since its existing knowledge is enough for it to create wins.
sovaz1997
Posts: 43
Joined: Fri Apr 24, 2026 9:47 am

Re: The new Tafl engine (AI)

Post by sovaz1997 »

Anyway I need ro check some things.
In some cases engine do 3-fold repetitions, but instead doing this it could continue playing differently.
Maybe this could improve training.
Ytreza
Posts: 45
Joined: Tue Aug 27, 2019 5:56 pm

Re: The new Tafl engine (AI)

Post by Ytreza »

If white is about to repeat, could you prevent the move from being played at all?

You could also try to implement the "partial surround" rule: black wins if white cannot escape or build a fort anymore, even when given an arbitrary number of free moves. It's a bit annoying to check algorithmically but that would save computing resources by cutting lengthy endgame, and that could help white understanding edge forts faster.

In practice you can approximate this win check by doing flood-fill with white, then capture black pieces which become sandwiched, then flood-fill again, repeat until there are no capture possible, and finally remove all white pieces and check if the king can access a corner.
Last edited by Ytreza on Mon Apr 27, 2026 11:49 am, edited 1 time in total.
Ytreza
Posts: 45
Joined: Tue Aug 27, 2019 5:56 pm

Re: The new Tafl engine (AI)

Post by Ytreza »

Another interesting stat is the number of pieces remaining (especially black pieces) at the end of the game. If white manages to capture more than 6 in corner fights, it becomes difficult for black to later defend against forts.
Post Reply