Ludii Forum
How to instantiate an arbitrary single site in a region? - 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: How to instantiate an arbitrary single site in a region? (/showthread.php?tid=182)



How to instantiate an arbitrary single site in a region? - dale walton - 09-17-2020

eg: the following doesn't work.

(to
  (sites Around
    (sites Random (<region>))

  )
)

And/or how can I fix the site selected by Random so that Around can function in a sensible finite set of sites when using it as an argument,  to randomly select a contiguous region...


RE: How to instantiate an arbitrary single site in a region? - Eric Piette - 09-17-2020

Hi Dale,


(to
  (sites Around
    (sites Random (<region>))
  )
)

Alone? Or inside a specific ludeme? I need a full example to understand what you mean.

But if you use it like that:

Code:
(play
     (move
        Add
        (to
            (sites Around
                (sites Random (sites Empty) num:1)
            )
        )
     )
)

That works.

Regards,
Eric


RE: How to instantiate an arbitrary single site in a region? - dale walton - 09-17-2020

Good to see that works.

I didn't keep a copy of my problem code. I had something like (difference (sites Empty) (sites Occupied by:Mover)) inside the Random and no explicit num:1 and was getting random single legal move positions roaming around the board and not allowing selection... , but I am not sure about what if anything more I had around the whole thing...