02-07-2021, 08:19 AM
I just got an idea how to implement Projex without the need of specially adapted board geometries. Essentially, the idea is the following. Normally, Hex-like games such as Projex are played on the cells, and the goal is to connect cells. My idea is to play on the vertices of the dual graph instead, and to build a path by connecting the occupied cells with edges. This makes it easy to just represent the board as the graph where edges represent adjacency between sites, and to mark opposite sides of the Projex board as adjacent by adding edges between them. For Projex, the winning condition is then simply to create a closed path / loop which contains an odd number of edges connecting opposite sides.
For simplicity, I started out with a simplified Projex board which has only 6 sites, where each site represents a pair of opposite faces of a dodecahedron. Turning cells to vertices, this gives a projective icosahedron, where the graph is just a complete graph with 6 vertices. Also the winning condition is very simple: create a loop involving an odd number of "wrap around" edges which connect "almost opposite" vertices (the 5 edges forming the pentagram). On this board, the winning condition is to occupy two non-adjacent sites on the perimeter and one site between them to connect them (either the center site or another perimeter site). So far, so good.
My first attempt is attached. I run into two problems:
First, I try to add edges between if both vertices they connect are occupied by the mover. I thought I could achieve it this way:
However, in the fifth move of the attached trial an edge is added between a red (the last played) and a blue vertex, and I don't see the reason why this happens. Maybe I misunderstand the (sites Incident ...) ludeme, the documentation seems a bit unclear.
Another issue is with the winning condition. I'm still lacking an idea how to count the "wraparound edges" inside a path. A pointer in the right direction would be appreciated. (The attached file contains a "dummy win condition" so that I could focus on the move logic first.)
For simplicity, I started out with a simplified Projex board which has only 6 sites, where each site represents a pair of opposite faces of a dodecahedron. Turning cells to vertices, this gives a projective icosahedron, where the graph is just a complete graph with 6 vertices. Also the winning condition is very simple: create a loop involving an odd number of "wrap around" edges which connect "almost opposite" vertices (the 5 edges forming the pentagram). On this board, the winning condition is to occupy two non-adjacent sites on the perimeter and one site between them to connect them (either the center site or another perimeter site). So far, so good.
My first attempt is attached. I run into two problems:
First, I try to add edges between if both vertices they connect are occupied by the mover. I thought I could achieve it this way:
Code:
(forEach Site # Find all sites around the last position which the mover already owns.
(intersection
(sites Around Vertex (last To))
(sites Occupied by:Mover)
)
(add
(to Edge # Occupy the edge between last played and already owned vertex.
(intersection
(sites Incident Edge of:Vertex at:(site))
(sites Incident Edge of:Vertex at:(last To))
)
)
)
)
However, in the fifth move of the attached trial an edge is added between a red (the last played) and a blue vertex, and I don't see the reason why this happens. Maybe I misunderstand the (sites Incident ...) ludeme, the documentation seems a bit unclear.
Another issue is with the winning condition. I'm still lacking an idea how to count the "wraparound edges" inside a path. A pointer in the right direction would be appreciated. (The attached file contains a "dummy win condition" so that I could focus on the move logic first.)