Code:
(define "CaptureSurrounded"
(enclose
(from (difference (sites Board) (sites Empty)))
Adjacent
(between
if:(is Enemy (who at:(between)))
(apply
(and
(addScore Mover 1)
(remove (between))
)
)
)
)
)
Causes java.lang.NullPointerException when loading. Same with "(from (sites Board))".
Full file:
Code:
(define "CaptureSurrounded"
(enclose
(from (difference (sites Board) (sites Empty)))
Adjacent
(between
if:(is Enemy (who at:(between)))
(apply
(and
(addScore Mover 1)
(remove (between))
)
)
)
)
)
(define "Refill"
(and {
(remove (sites hand Mover))
(add (piece (id "HexA" Mover)) (to (handSite Mover 0)))
(add (piece (id "HexB" Mover)) (to (handSite Mover 1)))
("CaptureSurrounded")
})
)
(game "Blooms"
(players 2)
(equipment {
(board (hex 5))
(piece "HexA" Each)
(piece "HexB" Each)
(hand Each size:2)
})
(rules
(start {
(place "HexA1" (handSite P1 0))
(place "HexB1" (handSite P1 1))
(place "HexA2" (handSite P2 0))
(place "HexB2" (handSite P2 1))
})
(play
(or
(move
(from (sites Hand Mover))
(to (sites Empty))
(then
(if
(and
(not ("HandEmpty" Mover))
(> (count Moves) 1)
)
(moveAgain)
"Refill"
)
)
)
(if ("SameTurn")
(move Pass (then "Refill"))
)
)
)
(end
(if
(>= (score Mover) 15)
(result Mover Win)
)
)
)
)
(metadata
(graphics {
(player Colour P1 (colour Blue))
(player Colour P2 (colour Red))
(piece Colour P1 "HexB" fillColour:(colour LightBlue) )
(piece Colour P2 "HexB" fillColour:(colour LightRed) )
})
)
FYI, I have implemented the same thing using:
Code:
(define "CaptureSurrounded"
(forEach Group if:
(and
(is Enemy (who at:(to)))
(= 0 (count Liberties at:(to)))
)
(and
(addScore Mover (count Sites in:(sites)))
(remove (sites))
)
)
)
and it doesn't crash. The initial problem remains, though.