Page 5 of 8

Re: The new Tafl engine (AI)

Posted: Mon Apr 27, 2026 11:57 am
by sovaz1997
Ytreza wrote: Mon Apr 27, 2026 11:48 am 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.

Yes, that might be a good idea. And I think it's likely to work. Net will understand faster about corners and forts. In theory it could be good boost on first stage of training.

I'll leave the main training as is while the ELO is increasing.
But as an experiment, we could try running a parallel test with a small network (32x5 for example) and a small number of nodes using this rule. We can disable it correctly once the network understands how to create forts.

Re: The new Tafl engine (AI)

Posted: Mon Apr 27, 2026 12:13 pm
by sovaz1997
Although I'm not sure about understanding forts, since after blocking corners, the game ends immediately.
I think it'll learn corner blocking sooner, but it's already good at it.

Re: The new Tafl engine (AI)

Posted: Mon Apr 27, 2026 12:30 pm
by Ytreza
The game doesn't end immediately after blocking corners: if there is enough potential on a side to build a fort, and enough defenders remaining, then the game keeps going.

Some examples:
endgame.jpg
endgame.jpg (227.97 KiB) Viewed 239 times
1st column top: sides open but not enough defenders to build a fort.
1st column bottom: still possible to build a fort => game continues

2nd column top: not enough space to build the type 1 fort, and not enough defenders to build type 2.
2nd column bottom: 6 defenders can still theoretically build type 2 fort => game continues.

3rd column top: the king is trapped and will never escape => white loses.
3rd column bottom: the king is not quite trapped, white can still theoretically capture i6, then j6 => game continues.

Re: The new Tafl engine (AI)

Posted: Mon Apr 27, 2026 1:02 pm
by sovaz1997
Ah I see what you mean, we should check possibility to build the fort
Yes, we can try make this experiment, maybe it will improve fort statistics

It's easy to check: we run bfs search from king and filter friend pieces, check is corners available or not.
After we are checking this cells for existing place fir building fort (>= 3 cells in the row), depending on fort type possibility


Maybe in this case it will works
About difference between last 2 examples - maybe no needed to check it exactly like forts, I think it will not affect a lot kn train process.

Re: The new Tafl engine (AI)

Posted: Mon Apr 27, 2026 1:10 pm
by Ytreza
Yes >=3 if >= 6 defenders remain, or >=4 if >= 4 defenders remain. I will check my code but I think that's what I do.

Edit: I checked, that's indeed what I do. Of course you also need to allow shieldwall capture by virtual white pieces after flood-fill.

Re: The new Tafl engine (AI)

Posted: Fri May 01, 2026 11:18 am
by sovaz1997
Hi all :)
I give you some statistics on current training runs.

Code: Select all

# PLAYER                                  : RATING  ERROR   POINTS  PLAYED    (%)
1 TaflZero 10x128 gen054                  : 2322.4    6.7   2687.0    5000   53.7%
2 TaflZero 10x128 gen051                  : 2311.3    6.5   2592.0    5000   51.8%
3 TaflZero 10x128 gen050                  : 2305.7    7.1   1982.0    3930   50.4%
4 TaflZero 6x64   gen147 (playtafl.org)   : 2299.6    6.2   2440.0    4939   49.4%
5 TaflZero 10x128 gen046                  : 2294.3    6.2   2395.0    4938   48.5%
6 TaflZero 10x128 gen047                  : 2269.7    6.6   1936.0    4342   44.6%
Image

So far, without changing settings or lowering the LR, there has been growth. It's slow, sometimes with slight spikes, but networks are emerging that achieve better results in terms of playing strength.

The newest network is about 20 ELO points (+-) ahead of the previous generation network (which had a LR reduction).

If further growth continues without increasing the percentage of forts, I don't think they're necessary at the current stage of training to achieve its goals.

If the ELO growth plateaus, I'll consider a curriculum focused on forts.
We have some ideas:
1) Ytreza's suggestion to end early if a fort is impossible
2) Try temporarily disabling corner wins
3) Alternatively, always save positions with fort wins and don't remove them from the training window.

-------
Infinite search with the ability to stop it (for analysis) and multipv output for displaying multiple lines have also been added to the engine.

Re: The new Tafl engine (AI)

Posted: Thu May 07, 2026 11:35 pm
by sovaz1997
Hi all!
Last time I'm working on adding 2nd variant in the engine - Historical variant.
It's already available for testing on https://playtafl.org/

This variant was used for experimenting with training settings. It uses a small, fast 32x4 NN.

Image

Re: The new Tafl engine (AI)

Posted: Fri May 08, 2026 4:23 pm
by Ytreza
I've found another endgame issue. In the following position, the engine playing black doesn't attempt to enclose white, it just repeats a useless move (thinking time 5s).
endgame.png
endgame.png (122.89 KiB) Viewed 123 times

Re: The new Tafl engine (AI)

Posted: Fri May 08, 2026 6:01 pm
by sovaz1997
Ytreza wrote: Fri May 08, 2026 4:23 pm I've found another endgame issue. In the following position, the engine playing black doesn't attempt to enclose white, it just repeats a useless move (thinking time 5s).

endgame.png
That's true. Our main problem right now is that the engine doesn't understand forts and full surroundings (the most complex patterns that will allow us to break through the plateau and achieve perfection in the game).
Perhaps the engine should learn forts, and then it will start learning surrounding as a defense against forts.

But so far I've reached a plateau on a large network, about same like current network on the site. So I think it makes sense to try training a small 32x4 network on Copenhagen.
In theory, it could reach the same level as larger networks, but in less time.

Re: The new Tafl engine (AI)

Posted: Sat May 09, 2026 5:22 pm
by Ytreza
I don't quite understand how the engine can win as black in the training if it doesn't know how to surround.