counting player pieces in orthogonally adjacent cells - 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: counting player pieces in orthogonally adjacent cells ( /showthread.php?tid=253) |

counting player pieces in orthogonally adjacent cells - QuaGamer - 11-12-2020
What is the syntax for the <to> ludeme if I want to restrict the (move add...) ludeme to only allow the Mover legal moves that add to an empty cell AND at least 2 of the orthogonally adjacent cells to that empty cell contain pieces that are the same as the Mover's piece being added at that to location? I am considering using an "and" operator to restrict: (play (move Add (to (sites Empty)))) to look something like this: (play (move Add (to (sites (and Empty (>= (count Pieces Mover in: orthogonal) 2 ) )))) The count needs to only count the Mover's pieces that are in the orthogonally adjacent region around the empty to cell. Did I identify that correctly? Also, it needs to count the orthogonally adjacent cell U (in the layer upwards from) and D (in the layer downards from) the empty to cells of the legal moves. How can they get included in the region being counted? Is this count even possible? Please help! RE: counting player pieces in orthogonally adjacent cells - Eric Piette - 11-12-2020
Hi, For the syntax of the Add ludeme you have many examples in the Ludii Game Logic Guide and explanation of how to use it. The last one (example ludeme 37) shows you how to describe what you want (to add pieces to a region and to have a condition on the sites you can add). For what you ask to add pieces to empty sites only if 2 orthogonal adjacent sites are owned by you, here an example: Code: `(game "Test"` Regards, Eric RE: counting player pieces in orthogonally adjacent cells - QuaGamer - 11-12-2020
Thanks! Does this also count the adjacent cells Upwards and Downwards from the (to) cell? RE: counting player pieces in orthogonally adjacent cells - Eric Piette - 11-13-2020
If you want all the cells adjacently just modify that (sites Around (to) Own Orthogonal) by (sites Around (to) Own Adjacent) Regards, Eric RE: counting player pieces in orthogonally adjacent cells - QuaGamer - 11-14-2020
(11-13-2020, 07:37 AM)Eric Piette Wrote: If you want all the cells adjacently just modify thatThanks Eric. I want to count all the orthogonal cells around the (to) cell owned by the current Mover. My previous post was asking whether or not the cells Up=U and Down=D from the (to) cell are Orthogonal to the (to) cell even though they are in different layers. The Ludii Game Logic Guide doers not talk about this in the diagram on page 31 for square tilings. Does the (to) cell have 4 orthogonal cells or six orthogonal cells when a square tiling has a layer above and a layer below the (to) cell? RE: counting player pieces in orthogonally adjacent cells - Eric Piette - 11-16-2020
Hi, For any game, the orthogonal definition is the same and this is in the document: "All directions between two sites sharing at least one edge." Consequently in the specific case of a cube, yes 2 sites on top (U & D directions) are orthogonal. But do not forget that's not always the case for all 3D games. For example for a 3D game using a pyramid, U & D are not orthogonal because they do not share an edge. However UNW, UNE, USW, USE, DNW, DNE, DSW, DSE are orthogonal in a pyramid but not U and D. Regards, Eric RE: counting player pieces in orthogonally adjacent cells - QuaGamer - 11-16-2020
Thanks. How many edges do sites in the same location on adjacent layers of a cube share? For 3D sites, orthogonally adjacent cells (sites) share faces, not edges. Each internal site (cell, not vertex) in a cube layout has 8 vertices and 12 edges. it has 6 orthogonally adjacent cells (N, S, E, W, U, D) that share a face, 12 diagonally adjacent cells (NE, NW, SE, SW, UN, US, UE, UW, DN, DS, DE, DW) that share an edge, and 8 extra-diagonal adjacent cells (UNE, UNW, USE, USW, DNE, DNW, DSE, DSW) that share a vertex. This may not be the way Ludii currently implements layers. However, when you get around to implementing 3D games, you will need to take a look at these 3D geometry relationships. RE: counting player pieces in orthogonally adjacent cells - Eric Piette - 11-16-2020
Hi, As a quick non formal answer, if you share a face, you are sharing minimum one edge. The edges are connected the vertices together, and the faces are the spaces between edges. Consequently if 2 cells share a face, they share at least an edge. For the first question, the answer is 4. Regards, Eric RE: counting player pieces in orthogonally adjacent cells - QuaGamer - 11-16-2020
(11-16-2020, 09:12 AM)Eric Piette Wrote: Hi,Hmmm. So if the documentation in the Ludii Logic Guide is correct for the definition of Orthogonal directions: "All directions between two sites sharing at least one edge." does that mean that sites in the directions UN,UE, US, UW, DN, DE, DS, DW are orthogonal to each other in a cube (board (layers 3 (square 3)) ) layout? RE: counting player pieces in orthogonally adjacent cells - Eric Piette - 11-16-2020
Yes. Regards, Eric |