11-26-2020, 02:02 AM
(This post was last modified: 11-26-2020, 02:03 AM by AlekErickson.)
I have created a more detailed example that does not have the expected behavior, although from looking at the code you might guess what I want it to do.
Instead of allowing a Swap move upon formation of crosscut, it somehow lets the mover move twice. I will attach the full .lud in a reply to this message.
(define "SwapInDirection"
(forEach Site
(sites Occupied by:Any)
(if
(is Occupied (ahead (site) #1))
(move Swap Pieces
(site)
(ahead (site) #1)
)
)
)
)
(game "SwapOrAdd"
(players 2)
(equipment {
(board <Board> use:Vertex)
(piece "Ball" Each)
(regions P1 { (sites Side N) (sites Side S) } )
(regions P2 { (sites Side W) (sites Side E) } )
})
(rules
(play
(move Add (to (sites Empty))
(then
(while (is Pattern {F R F R F} whats:{(mover) (next)})
(or
{
("SwapInDirection" N)
("SwapInDirection" E)
("SwapInDirection" S)
("SwapInDirection" W)
}
)
)
)
)
)
(end {
(if (is Connected Orthogonal Mover) (result Mover Win))
})
)
)
as I said, here's the lud to my non-functioning (but compiling) example.
Instead of allowing a Swap move upon formation of crosscut, it somehow lets the mover move twice. I will attach the full .lud in a reply to this message.
(define "SwapInDirection"
(forEach Site
(sites Occupied by:Any)
(if
(is Occupied (ahead (site) #1))
(move Swap Pieces
(site)
(ahead (site) #1)
)
)
)
)
(game "SwapOrAdd"
(players 2)
(equipment {
(board <Board> use:Vertex)
(piece "Ball" Each)
(regions P1 { (sites Side N) (sites Side S) } )
(regions P2 { (sites Side W) (sites Side E) } )
})
(rules
(play
(move Add (to (sites Empty))
(then
(while (is Pattern {F R F R F} whats:{(mover) (next)})
(or
{
("SwapInDirection" N)
("SwapInDirection" E)
("SwapInDirection" S)
("SwapInDirection" W)
}
)
)
)
)
)
(end {
(if (is Connected Orthogonal Mover) (result Mover Win))
})
)
)
as I said, here's the lud to my non-functioning (but compiling) example.