Nesting (forEach Site …) - 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: Nesting (forEach Site …) (/showthread.php?tid=188) |
Nesting (forEach Site …) - Michael - 09-23-2020 I can't think of a simple way of finding this out by experiment, so I hope its ok that I just ask instead: Is it possible to use (forEach Site …) inside (forEach Site …)? And if so, does (site) always have the value it has in the outermost context? RE: Nesting (forEach Site …) - Eric Piette - 09-23-2020 Hi, Yes you can use nesting (foreach Site). And if you do that, the (site) value of the outer one can be used to define the region in the deeper (foreach Site) but in the Moves in the deeper (foreach Site), the (site) value will be defined by each site in the deeper (foreach Site). Regards, Eric RE: Nesting (forEach Site …) - Michael - 09-23-2020 Great! Just to see if I understand, here is what I was thinking: Code: (forEach Site RE: Nesting (forEach Site …) - Eric Piette - 09-23-2020 Yes exactly. Eric RE: Nesting (forEach Site …) - Michael - 11-26-2020 Thinking about Alek's swapping-question I have come over a situation where one cannot nest (forEach) because there is no way of specifying which level’s value (site) is supposed to refer to. Here is the relevant define in the attached example: Code: (define "SwapAdjacentEnemy" RE: Nesting (forEach Site …) - Eric Piette - 11-26-2020 Hi, No (site) is always set by the last ludeme using it. However I provided a full example to the Swap question (working only in the next release). Regards, Eric |