I think I have found a way to make my problem more tractable. At the bottom of this post is the code for a trivial but related placement protocol. In this game each player places a group of two stones on their turn. The problem is that I am unable to enforce that the first stone must be placed in such a manner that there is space to place the second. It should be illegal to place in the middle of this formation, for example:
In the version given below you are able to place a stone here and then you pass automatically on the second move. In my attempt to get from this trivial basis to the game I want I have struggled with three difficulties:
In the version given below you are able to place a stone here and then you pass automatically on the second move. In my attempt to get from this trivial basis to the game I want I have struggled with three difficulties:
- I need to be able to scale this to groups larger than 2. In the code given here the second stone is placed at a site in (intersection (sites Around (last To) Orthogonal) (sites Empty)). I thought it would work to replace this "Around" ludeme with (sites Around (sites Group Cell of:Cell at:(last To)) Orthogonal), but I can't get it to work. (It gives a strange error-message full of " ".)
- I need the size of the group to be a function of the cell at which you place the first stone – more precisely the number of the mover's stones in its line of sight.
- And I need, as I mentioned, to restrict the first placement to sites where it is possible to follow up with placing the rest of the stones. I have tried to filter out the sites where this can't be done with (can Move …), but I have not found a way to make that work.
Code:
(game "Trivial2"
(players 2)
(equipment
{
(board (square 8))
(piece "Ball" Each)
}
)
(rules
(play
(if
(= (count MovesThisTurn) 0)
(move Add (to (sites Empty)) (then (moveAgain)))
(if
(< (count MovesThisTurn) 2)
(move
Add
(to
(intersection
(sites Around (last To) Orthogonal)
(sites Empty)
)
)
)
)
)
)
(end (if (all Passed) (byScore)))
)
)