Ludii Forum
Trike - Printable Version

+- Ludii Forum (
+-- Forum: Suggestions (
+--- Forum: Submit Your Games (
+--- Thread: Trike (/showthread.php?tid=120)

Pages: 1 2

Trike - AlekErickson - 08-10-2020

Trike is a two-player, combinatorial, abstract strategy game designed by myself in April 2020.

Trike is partisan, draw-less, finite, cycle-free, always decisive, scalable with board size, and balanced with the pie rule. Trike has high clarity due to the simple movement protocol, singular win condition, low branching factor, and easy-to-read board state. However, Trike is dramatic because it offers players many chances to make fatal errors.

Rules: Play on an equilateral triangular hexagon-tessellated grid. Use a neutral pawn and black/white checkers. Players take turns moving a neutral pawn around on the board (passing is not allowed). The neutral pawn can move any number of empty points, in any direction in a straight line, but cannot move onto, or jump over occupied points. When a player moves the pawn, first they place a checker of their own color, onto the destination point. Then they move the pawn on top of it. When the pawn is trapped, the game is over. At the end of the game, each player gets a point for each checker of their own color adjacent to, or underneath, the pawn. The person with the highest score wins.

Implement pie rule. This means, at the beginning of the game, the first player chooses a color and puts a checker on any point of the board, with the pawn on top of it. At this time only, the second player has a one-time chance to swap sides instead of making a regular move.

(Note, the AI on Ludii is already advancing my knowledge of what it means to play well in this game. It seems there is still a lot to learn). 

RE: Trike - AlekErickson - 08-10-2020

I came across a small bug - if the second player tries to Swap, they just lose instead.

RE: Trike - Eric Piette - 08-11-2020

Hi Alek,

The reason is because you compute the line of sight from the last 'to' position but when a player swaps, that position does not exist (equal to -1), consequently, the set of legal moves is empty and the game ends.

To solve that, you have to store the (last To) position in a variable and then using that to compute the legal moves.

I did it for you, see attachment.

Moreover, I also used some phases in order to avoid the test you have for the first move. That's more efficient and avoid to do that test at each new state.

Tell me if you are ok with all of that, but if you are and are also agree to add your game to our ludii repository we can do it for the next release (with you in credits of course) :)


RE: Trike - AlekErickson - 08-11-2020

It sounds fantastic. Thank you!

Were you able to get it to actually successfully go through a swap without ending the game? In my case, it still doesn't work properly even with the new code you sent.

RE: Trike - AlekErickson - 08-11-2020

I tried several variations of the code but none of them seemed to work.
This should be a general problem for any game using the Swap rule with a win condition involving No Moves Next , or No Lines of Sight from Last Placed.

RE: Trike - Eric Piette - 08-11-2020


The problem is really about the (last To) which can be equal to -1 (when a swap move is applied, no 'to' site in the previous move).

So in attachment I made a slight modification to the description I sent to you to work.

BUT, yes that's also a problem in Ludii. Because the consequences of the moves you describe in the playing rules were also added to the Swap move generating by the meta rule, consequently the variable (var) was set to -1 when we make a swap move. So I fixed that in our dev version and that bug will be fixed in the next release.

Consequently, in your current version you can use the version I sent to you in attachment here to play it. But the file I sent to you previously will be the description in the next release (which is correct).


RE: Trike - AlekErickson - 08-11-2020

thanks, I will wait until the next release. 

The current version you sent me does in fact allow swap, but now it doesn't add a point for having the last move as previous versions did. 
But I will just hope the next release ends up working well. 

Thanks for your help, and I'm looking forward to the next release!

RE: Trike - Eric Piette - 08-11-2020

"but now it doesn't add a point for having the last move as previous versions did".
Not sure what you mean by that.

because I just used what you describe for that which is

(if (no Moves Next)
(addScore Mover 1)

And that means if the next player has no move, the mover gets one points.


RE: Trike - AlekErickson - 08-11-2020

I know, I saw the code and thought that it should work. 
But I tested it... when the game is over, it only scores neighbors, and doesn't give the last Mover 1 point. 
Still not sure why.

RE: Trike - Eric Piette - 08-11-2020

Oh, the rule you try to implement is to give one more point to the last player who placed a piece when the game is over?
That's that or not?