Ludii Forum
siteFromCoordinate - Printable Version

+- Ludii Forum (https://ludii.games/forums)
+-- Forum: Suggestions (https://ludii.games/forums/forumdisplay.php?fid=10)
+--- Forum: Ludii Features / Services (https://ludii.games/forums/forumdisplay.php?fid=11)
+--- Thread: siteFromCoordinate (/showthread.php?tid=25)



siteFromCoordinate - Quentin Cohen-Solal - 01-29-2020

It would be nice to have a method analogous to vertexWithCoordinate which returns the sites while preserving the 2D (or 3D) structure of the game (that of the graphic representation).
More precisely, this method, container.siteFromCoordinate (n, m, k) should return the site at the position (n, m, k), with n the coordinate in x, m the coordinate in y and k the coordinate in z.
Unlike vertexWithCoordinate, from what I understood, we could retrieve the information found at the sites corresponding to edges and faces, in addition to vertices.
For example, for a game like Contagion or Dots and Boxes, siteFromCoordinate(0,0,0) would return the site of the vertex at the bottom left, siteFromCoordinate(1,0,0) would return the site of the arc at right of the previous vertex and siteFromCoordinate(1,1,0) would return the face whose vertex at its bottom left corner is the previous vertex. If a coordinate does not correspond to any site, the method returns null, as for vertexWithCoordinate. For a game where arcs and faces do not correspond to any information from the game, siteFromCoordinate(n, m, 0) should coincide with the site of vertexWithCoordinate(n, m), so as to have compact coordinates.

I don't know how stacking games work, but siteFromCoordinate should allow us to retrieve all the information related to the sites in the container.

I suppose that is planned, but vertexWithCoordinate should work for games with a PeralikatumaBoard, WheelBoard and if possible CustomBoard board type.

In addition, I take this opportunity to say that I found the vertexWithCoordinate from version 0.3 better to that of version 0.6 for hexagonal diamond board (as hex), because it is twice more compact and also more symmetrical in a certain meaning.