Ludii Forum
Leap Frog - 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: Leap Frog (/showthread.php?tid=408)



Leap Frog - fbarbe - 02-02-2021

Hi,

After finishing my first game yesterday, I realised that writing games in ludii can be a lot of fun.
So today I wrote Leap Frog, also from the Ludii Portal Whishlist.
Btw, comments on my code style and ludeme choice is great appreciated. I plan on writing a few other "Easy" games and then try some "Medium" and "Hard".

Regards,
Fabio


RE: Leap Frog - cambolbro - 02-02-2021

Hi Fabio,

Nice work!

You can simplify your hop rule as follows:

Code:
(move Hop
    (between
        if:(is Occupied (between))
        (apply (if (is Enemy (who at:(between))) (remove (between))))
    )
    (to if:(is Empty (to)))
)

This actually gives a significant speedup of ~2,600 playouts per second as opposed to your original version's ~1,800. You can check this using Analysis > Time Random Playouts in Background.

Your formatting is perfect, except that we prefer to merge curly braces for collections to save a couple of lines and reduce indentation, so this:

Code:
(start
    {
        (place "Ball1" {"B4" "C5" "C6" ... "G5"})
        (place "Ball2" {"B5" "C3" "C4" ... "G4"})
    }
)

becomes this:

Code:
(start {
    (place "Ball1" {"B4" "C5" "C6" ... "G5"})
    (place "Ball2" {"B5" "C3" "C4" ... "G4"})
})

But this is a minor point and need not be strictly adhered to. 

Please keep them coming :)

Regards,
Cameron


RE: Leap Frog - fbarbe - 02-02-2021

Hi,
Thanks a lot for the useful suggestions.
I have attached an updated version of the game.

Regards,
Fabio


RE: Leap Frog - Eric Piette - 02-04-2021

Hi,

I have added that game to our dev version, it will be available in the next release.

Regards,
Eric