(define "FromIsOnTheRegionToFill" (is In #1 (sites (player (mapEntry (mover)))))) (define "ToIsOnTheRegionToFill" (is In #1 (sites (player (mapEntry (mover)))))) (define "Hop" (move Hop (from #1) (between if:(is Occupied (between))) (to if:(and ("IsEmptyAndNotVisited" (to)) (or (not ("FromIsOnTheRegionToFill" #1)) ("ToIsOnTheRegionToFill" (to)) ) ) ) #2 ) ) (define "HopSequence" ("Hop" #1 (then (if (can Move ("Hop" (last To))) (moveAgain))))) //------------------------------------------------------------------------------ (game "Grasshopper" (players 2) (equipment { (board ) (piece "Counter" Each) (map {(pair P1 P2) (pair P2 P1)}) }) (rules (start { (place "Counter1" (sites P1)) (place "Counter2" (sites P2)) }) phases:{ (phase "Movement" (play (forEach Piece (or ("HopSequence" (from)) (move Step (to if:(and (is Empty (to)) (or (not (is In (from) (sites Next))) (is In (to) (sites Next)) ) ) ) ) ) ) ) (nextPhase (is Mover (next)) "MultiJump") ) (phase "MultiJump" (play (or ("HopSequence" (last To)) (move Pass) ) ) (nextPhase (not (is Mover (next))) "Movement") ) } (end ("FillWin" (sites (player (mapEntry (mover)))))) ) ) //------------------------------------------------------------------------------ (option "Board Size" args:{ } { (item "8x8" <(square 8)> < (regions "Home" P1 (expand origin:(coord "A1") steps:3 Orthogonal)) (regions "Home" P2 (expand origin:(coord "H8") steps:3 Orthogonal)) > "The game is played on a board 8x8." )* (item "10x10" <(square 10)> < (regions "Home" P1 (expand origin:(coord "A1") steps:4 Orthogonal)) (regions "Home" P2 (expand origin:(coord "J10") steps:4 Orthogonal)) > "The game is played on a board 10x10." ) }) //------------------------------------------------------------------------------ (metadata (info { (description "Grasshopper is a Halma variant played with a draughts set and published in 1948.") (rules "The rules are the same as for Halma. Pieces move one space orthogonally or diagonally. They may jump over a piece of any color. Multiple jumps in one turn are possible. Jumps do not capture. The player who first places all of their pieces in the opponent's starting position wins.") (source "cyningstan") (id "402") (version "1.3.13") (classification "board/race/fill") (credit "Eric Piette") } ) (ai "Grasshopper_ai" ) )