Ludii Forum
Conditional win condition - Printable Version

+- Ludii Forum (https://ludii.games/forums)
+-- Forum: Questions (https://ludii.games/forums/forumdisplay.php?fid=13)
+--- Forum: About the Ludii Grammar (https://ludii.games/forums/forumdisplay.php?fid=15)
+--- Thread: Conditional win condition (/showthread.php?tid=305)



Conditional win condition - Michael - 11-29-2020

I can’t figure out how to implement a conditional win condition, for example a tie-breaker. I can’t see that there is a place where I can have something like

(if 
    <boolean>
    (result Mover Win)
    (byScore)
)

How does one do this in Ludii?


RE: Conditional win condition - Eric Piette - 11-30-2020

Hi,

One syntaxial way to do what you describe is

Code:
(end {
      (if
         <BooleanFunction>
         (result Mover Win)
      )
      (if true (byScore))
})

The conditions in the ending rules are always checked in the order they are described in the .lud.

Of course that description would be a bit weird because if the first condition is false, the game will always end directly by the score so that is also possible:

Code:
(end
    (if <BooleanFunction> {
       (if
           <BooleanFunction>
           (result Mover Win)
      )
      (if true (byScore))
   })
)


Regards,
Eric