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



Dodgem - fbarbe - 02-03-2021

Hi,

Third day in a row! I'll see if I can keep this streak and write a new Ludii game every day.
Anyway, here is my implementation of the game Dodgem, from the Ludii Portal Wishlist.
I have followed the coding advice that was given to me in a previous thread, and also used the "option" ludeme for the first time. The only thing I am not entirely sure if it could be written better is the end condition, right now it performs 2 checks and I wonder if it can be written in 1.

Best,
Fabio


RE: Dodgem - cambolbro - 02-03-2021

Hi,

Nice work.

You don't need the second win test do you? If a player has no pieces then that should be caught by the "no moves" test. So this might suffice:

Code:
(end { (if (no Moves Next) (result Next Win)) })

Note that you could have hidden some code in the redundant "no pieces" test by using one of our known defines:

Code:
(if ("NoPiece" Mover) (result Mover Win))

Regards,
Cameron


RE: Dodgem - fbarbe - 02-03-2021

Hi,
The issue with the only having the (no Moves Next) condition is that it only declares the winner one round after it got all the pieces out of the board, after the opponent has played. The rules state instead that a player wins as soon as they don't have any pieces or are stuck (so at the end of their turn, not the opponent's).

Is it recommended to use the defines? I sometimes find them a bit hard to read.

Regards,
Fabio


RE: Dodgem - Eric Piette - 02-04-2021

Hi,

I just looked your .lud file.
Having only


Code:
(end
   (if (= (count Pieces Mover) 0) (result Mover Win))
)

is enough.
Because having no legal moves is equivalent to having no car on the board.

For the define, that's not "recommended", that's up to the game designer. 
But in general that makes the description clearer. That can be your own define described in the files or the ones already available with the release which are in the LLR.

I am adding that game to our dev version and it will be available with the next release.
I have added some graphics metadata for it to be like in the pics I saw online, I attached the file here.

Regards,
Eric