11-28-2020, 01:08 AM
(This post was last modified: 11-28-2020, 01:50 AM by AlekErickson.)
Eric, I think I am almost solved my problem with this swapping. Check out my following code when you get a spare moment - for some reason it is not allowing me to move at all.
I am trying to allow players to Swap adjacent enemy stones if they place a stone that creates a crosscut.
(define "IsCut" (is Pattern {F R F R F} whats:{(mover) (next)}))
(game "Test" (players 2) (equipment {(board (square 8))
(piece "Ball" Each (forEach Site (sites Around (from) if:(is Enemy (who at:(to)))) (move Swap Pieces (from) (site))))
(regions P1 { (sites Side N) (sites Side S) } ) (regions P2 { (sites Side W) (sites Side E) } )})
(rules
(start {(place "Ball1" (sites {36 51 54} )) (place "Ball2" (sites {35 14 10}))} )
(play (do (move Add (to (sites Empty)) (then (while "IsCut" (forEach Piece ))))))
(end {(if (is Connected All Mover) (result Mover Win))})
)
)
I also tried this code, and it also did not let me add any pieces to the board.
(define "IsCut" (is Pattern {F R F R F} whats:{(mover) (next)})) (game "Test" (players 2)
(equipment {(board (square 8))
(piece "Ball" Each (forEach Site (sites Around (from) if:(is Enemy (who at:(to)))) (move Swap Pieces (from) (site))))
(regions P1 { (sites Side N) (sites Side S) } ) (regions P2 { (sites Side W) (sites Side E) } )})
(rules (play (or (do (move Add (to (sites Empty)) (then (if "IsCut" (moveAgain))))) (forEach Piece )))
(end {(if (is Connected All Mover) (result Mover Win))})))
I am trying to allow players to Swap adjacent enemy stones if they place a stone that creates a crosscut.
(define "IsCut" (is Pattern {F R F R F} whats:{(mover) (next)}))
(game "Test" (players 2) (equipment {(board (square 8))
(piece "Ball" Each (forEach Site (sites Around (from) if:(is Enemy (who at:(to)))) (move Swap Pieces (from) (site))))
(regions P1 { (sites Side N) (sites Side S) } ) (regions P2 { (sites Side W) (sites Side E) } )})
(rules
(start {(place "Ball1" (sites {36 51 54} )) (place "Ball2" (sites {35 14 10}))} )
(play (do (move Add (to (sites Empty)) (then (while "IsCut" (forEach Piece ))))))
(end {(if (is Connected All Mover) (result Mover Win))})
)
)
I also tried this code, and it also did not let me add any pieces to the board.
(define "IsCut" (is Pattern {F R F R F} whats:{(mover) (next)})) (game "Test" (players 2)
(equipment {(board (square 8))
(piece "Ball" Each (forEach Site (sites Around (from) if:(is Enemy (who at:(to)))) (move Swap Pieces (from) (site))))
(regions P1 { (sites Side N) (sites Side S) } ) (regions P2 { (sites Side W) (sites Side E) } )})
(rules (play (or (do (move Add (to (sites Empty)) (then (if "IsCut" (moveAgain))))) (forEach Piece )))
(end {(if (is Connected All Mover) (result Mover Win))})))