Ludii Forum
Simplified rules for Thongs - Printable Version

+- Ludii Forum (https://ludii.games/forums)
+-- Forum: Suggestions (https://ludii.games/forums/forumdisplay.php?fid=10)
+--- Forum: Submit Your Games (https://ludii.games/forums/forumdisplay.php?fid=23)
+--- Thread: Simplified rules for Thongs (/showthread.php?tid=1717)



Simplified rules for Thongs - dale walton - 12-24-2023

I have Simplified the rules for Throngs and added them as a separate ruleset in the attached script.

The script also uses a new algorithm to calculate the moves which is fairly efficient to express and to execute:
Count the steps: if the from is occupied, step in the same direction, if it is empty step in all directions where it hasn't already stepped.
Unfortunately this is not yet possible to do with  (count Steps (step)) because (step) cannot take a conditional direction, and the (count Steps) is probably not designed to handle crossing paths, that can occur here.

Therefore I had to script it manually.
However, since it is a recursive tree like structure, it requires nested (results) or requires storing arrays of intermediate values using (remember). 
- The first is fast to evaluate, but slow to compile when the tree is large (the compile time grows factorially)
- The latter is fast to compile but is slow to run, especially with the long move data logs.
Therefore I have implemented it both ways with the (results) method taking the bulk of the short distance moves too provide speed, and the (remember) system handling the rarer and more constrained long distance cases to keep the tree for (results) small.

I give an option to shift the level at which this break occurs, setting it at 3-/4+ for a compile of a couple seconds as default, and allowing up to 5-/6+ which compiles in about 20 seconds for an AI that plays a reasonable game on the small default board.

I hop that in the future the (count Steps (step)) method can be enhanced to allow its use in implementing the algorythm, as this would solve the both the compile time an search  time issues with a minimal amount of scripting, and make the script far easier to understand.

Because the combined algorithm is now more efficient than the former one, I have also merged the moves back together into (from)-(to) moves rather than the former solution that separated them to solve the efficiency problems. This also helps the AI in gaining depth, as is halves the number of AI moves per turn. The AI now does a depth equivalent to about 8-10 of the former moves, (4-5 of the actual 'maneuvers' or moves of the current version) Since it still is 4 moves in a round, this is just enough to avoid blunders, and thus it now plays fairly well.
Due to the structure of Ludii I can't extend this fully to the placements, because I would like to make the placed piece half visible after the from part of the move, but if I pre-place it using (do) the logic works, but there is no refresh of the board that shows this addition to the board directly after the (from) and before the (to). Thus for this case, I continue to break it into two moves - but this means that after a placement, the 2nd action is a blue dot instead of a red dot, because it is actually part of a separate decision turn.

Despite all these notes, the script works well, and I hope you can include it in the next release.