prompt
stringlengths
71
4.65k
completion
stringlengths
34
5.1k
Construct a Ludii game based on the following description Three concentric squares, with lines connecting the midpoints. Nine pieces per player. Players alternate turns placing a piece on the board on an empty spot. When all the pieces have been placed, the players alternate turns moving a piece to an empty adjacent spot along the lines of the board. During either phase, if a player places three of their pieces in a row along the lines on the board, the player removes one of the opponent's pieces. The player who removes all the opponent's pieces wins. ###
(game "Nao Guti" (players 2) (equipment { ("NineMensMorrisBoard") (hand Each) (piece "Marker" Each ("StepToEmpty" ~ (then ("ReplayIfLine3" Orthogonal exact:True))))}) (rules (start (place "Marker" "Hand" count:9)) phases:{ (phase "Placement" (play (if "SameTurn" "RemoveAnyEnemyPiece" (move (from (handSite Mover)) (to (sites Empty)) (then ("ReplayIfLine3" Orthogonal exact:True))))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) (phase "Movement" (play (if "SameTurn" "RemoveAnyEnemyPiece" (forEach Piece))))} (end ("CaptureAll" Next)))) END
Construct a global Ludii definition which fulfills the following requirements. Returns the direction between the last `from' location and the last `to' location. ###
(define "LastDirection" (directions #1 from:(last From) to:(last To))) END
Construct a Ludii game based on the following description 5x5 grid of points, four point in each row, each alternating position with an end point on the left or right edge. Points are connecting with diagonal lines. Twelve pieces per player, positioned on the first three rows closest to the player. Players alternate turns moving a piece forward to an empty adjacent spot along the lines. A player may capture an opponent's piece by hopping over it to an empty spot on the opposite side of it along the lines. Multiple captures are allowed, if possible. When a player's piece reaches the opposite edge of the board from which it started, it becomes a king. Kings may move any distance diagonally forward or backward, and may capture any number of opponent's pieces it leaps over. The king cannot take in multiple directions in one turn. The first player to capture all of the opponent's pieces wins. ###
(define "IsUnpromoted" ("IsPieceAt" "Counter" Mover (last To))) (define "HopDoubleCounter" ("HopCaptureDistance" #1 #2 ~ (then ("ReplayIfCanMove" ("HopCaptureDistance" (from (last To)) SameDirection))))) (define "HopCounter" ("HopCapture" (from #1) (directions {FR FL}) #2)) (game "Dama (Philippines)" (players 2) ("DraughtsEquipment" (rotate 45 (merge { (rectangle 5 4) (shift -1 1 (rectangle 3 6)) (shift -2 2 (rectangle 1 8)) (shift 1 -1 (rectangle 7 2))})) use:Vertex) (rules ("BottomTopSetup" 3 "Counter1" "Counter2") (play (if "SameTurn" (or (if "IsUnpromoted" ("HopCounter" (last To) (then ("ReplayIfCanMove" ("HopCounter" (last To)) ("PromoteIfReach" (sites Next) "DoubleCounter")))) ("HopDoubleCounter" (from (last To)) SameDirection)) (move Pass)) (or { (forEach Piece "Counter" ("HopCounter" (from) (then ("ReplayIfCanMove" ("HopCounter" (last To)) ("PromoteIfReach" (sites Next) "DoubleCounter"))))) (forEach Piece "DoubleCounter" ("HopDoubleCounter" (from) Orthogonal)) (forEach Piece "Counter" ("StepToEmpty" (directions {FR FL})) (then ("PromoteIfReach" (sites Next) "DoubleCounter"))) (forEach Piece "DoubleCounter" (move Slide))}))) (end ("BlockWin")))) END
Construct a Ludii game based on the following description 2x6 board. Four counters in each hole. Sowing proceeds in an anti-clockwise direction. When the final counter of a sowing lands in an occupied hole, the contents are picked up and sowing continues. When the final counter falls in an empty hole, the turn ends. If the empty hole is in the player's row, any counters in the opponent's opposite hole are captured. If a player cannot play, they pass their turn until they are able. The player who captures all of the counters wins. Players then count their pieces by placing four in each hole, and the player who has more than their original number takes ownership of one of the opponent's holes for every four counters more than the original number that have been taken. If no player took four more than the original, the player with three extra gets the hole, if each player has two extra they draw lots to see who gets an extra hole. Play then begins again as before. Play continues until one player owns all of the holes. ###
(define "NumCapturedPieces" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (define "LeftMostEmpty" (trackSite FirstSite from:(mapEntry "LeftMost" Mover) if:(is Empty (to)))) (define "OneRowIsEmpty" (or (all Sites (sites P1) if:(= 0 (count at:(site)))) (all Sites (sites P2) if:(= 0 (count at:(site)))))) (define "RemmemberOwnedHoles" (if (is Mover P1) (remember Value "OwnedP1" #1) (remember Value "OwnedP2" #1))) (define "OwnedHoles" (if (is Mover P1) (sites (values Remembered "OwnedP1")) (sites (values Remembered "OwnedP2")))) (define "Columns" 6) (game "Hufesay" (players 2) (equipment { (mancalaBoard 2 "Columns" store:None (track "Track" "0,E,N,W" loop:True)) (regions "Home" P1 (sites Bottom)) (regions "Home" P2 (sites Top)) (piece "Seed" Shared) (hand Each) (map "LeftMost" {(pair P1 0) (pair P2 11)})}) (rules (start { (set Count 4 to:(sites Track)) (set RememberValue "OwnedP1" (sites Bottom)) (set RememberValue "OwnedP2" (sites Top))}) phases:{ (phase "Sowing" (play (or { (move Select (from (if ("SameTurn") "LastHoleSowed" ("OwnedHoles")) if:(is Occupied (from))) (then (sow apply:(if (> (count at:(to)) 1) (moveAgain) (if (and (is In (to) (sites Mover)) (> (count at:("OppositePit" (to))) 0)) (fromTo (from ("OppositePit" (to))) (to (handSite Mover)) count:(count at:("OppositePit" (to)))))))))} (then (if ("OneRowIsEmpty") (and { (forEach Site (sites (values Remembered "OwnedP1")) (if (is Occupied (site)) (fromTo (from (site)) (to (handSite P1)) count:(count at:(site))))) (forEach Site (sites (values Remembered "OwnedP2")) (if (is Occupied (site)) (fromTo (from (site)) (to (handSite P2)) count:(count at:(site))))) (forget Value "OwnedP1" All) (forget Value "OwnedP2" All) (if (>= ("NumCapturedPieces" P1) ("NumCapturedPieces" P2)) (set NextPlayer (player 1)) (set NextPlayer (player 2)))}))))) (end (if ("NoPieceOnBoard") { (if (> 4 (count Cell at:(handSite P1))) (result P2 Win)) (if (> 4 (count Cell at:(handSite P2))) (result P1 Win))})) (nextPhase ("NoPieceOnBoard") "BetweenRounds")) (phase "BetweenRounds" (play (if (<= 4 (count Cell at:(handSite Mover))) (move (from (handSite Mover)) (to ("LeftMostEmpty")) count:4 (then (and { ("RemmemberOwnedHoles" (last To)) (if (<= 4 (count Cell at:(handSite Mover))) (moveAgain) (if (= 3 (count Cell at:(handSite Mover))) (and { (fromTo (from (handSite Mover)) (to ("LeftMostEmpty")) count:3) (fromTo (from (handSite Next)) (to ("LeftMostEmpty")) count:1) ("RemmemberOwnedHoles" ("LeftMostEmpty"))}) (fromTo (from (handSite Mover)) (to (handSite Next)) count:(count Cell at:(handSite Mover)))))}))))) (nextPhase (and (is Empty (handSite P1)) (is Empty (handSite P2))) "Sowing"))})) END
Construct a Ludii game based on the following description Played on a 4x4 grid. Each player has seven pieces, placed on the intersections of the lines, five on the back row and one on each outer intersection of the second line. Pieces are moved diagonally across the squares. The object is to place one's pieces in the opponent's starting position. The first player to do so wins. ###
(game "O-Pat-Kono" (players 2) (equipment { (board (rectangle 5 5) use:Vertex) (piece "Marker" Each "StepDiagonalToEmpty") (regions "Home" P1 (union (sites Bottom) (sites {"A2" "E2"}))) (regions "Home" P2 (union (sites Top) (sites {"A4" "E4"})))}) (rules (start { (place "Marker1" (sites P1)) (place "Marker2" (sites P2))}) (play (forEach Piece)) (end ("FillWin" (sites Next))))) END
Construct a Ludii game based on the following description 4x7 board. Play begins with three counters in each hole of the outer rows. Players pick up all of the counters in one hole and sow them anti-clockwise. Holes with single counters can be chosen for sowing. When the final counter is sown, the counters in the following hole are picked up and sowing continues with those counters. If this hole is empty, play ends. Captures are made from the player's inner row at the beginning of a turn or a subsequent sowing within a turn. Counters are captured when a player's inner row has occupied holes. Counters in the opponent's holes opposite a player's occupied holes are captured: either from both of the opponent's rows or only the inner row if the corresponding hole in the outer row is empty. If the inner row is empty but the outer row is occupied, there is no capture, and when both rows are occupied they both must be captured. Captures are also made on a subsequent sowing within a turn, in the same manner as above but from the hole the next sowing begins, i.e., the one following the hole in which the last seed of the previous sowing is made. Captured counters are placed in the player's outer row opposite the hole from which the capture was made. Game is won when the opponent's outer row is emptied. At the initial state 3 seeds are in each outer hole. ###
(define "LastHole" (last To afterConsequence:True)) (define "NextHole" ("NextSiteOnTrack" 1 from:#1 "TrackCCW")) (define "InnerPitsWithPossibleCapture" (forEach (difference (sites Mover "Inner") (sites Empty)) if:(is Occupied ("OppositePit" (site))))) (define "InnerPit" (if (is Mover P1) (- #1 "Columns") (+ #1 "Columns"))) (define "EmptyOuterRow" (all Sites (sites #1 "Outer") if:(= 0 (count at:(site))))) (define "Columns" 7) (game "Kisolo" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "TrackCCW1" "0,E,N1,W" loop:True P1) (track "TrackCCW2" "14,E,N1,W" loop:True P2)}) (regions "Home" P1 (sites Track "TrackCCW1")) (regions "Home" P2 (sites Track "TrackCCW2")) (regions "Inner" P1 (difference (sites Track "TrackCCW1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "TrackCCW2") (sites Top))) (regions "Outer" P1 (difference (sites Track "TrackCCW1") (sites P1 "Inner"))) (regions "Outer" P2 (difference (sites Track "TrackCCW2") (sites P2 "Inner"))) (piece "Seed" Shared)}) (rules (start { (set Count 3 to:(union (sites P1 "Outer") (sites P2 "Outer")))}) (play (if (and (or (= 0 (count MovesThisTurn)) (is In 1 (sites Pending))) (!= 0 (count Sites in:(("InnerPitsWithPossibleCapture"))))) (move Select (from ("InnerPitsWithPossibleCapture")) (then (and { (fromTo (from ("OppositePit" (last To))) (to ("InnerPit" (last To)))) (if (is Occupied ("OppositeOuterPit" (last To))) (fromTo (from ("OppositeOuterPit" (last To))) (to ("InnerPit" (last To))))) (moveAgain)} (then (if (!= 0 (count Sites in:(("InnerPitsWithPossibleCapture")))) (set Pending 1)))))) (move Select (from (if (and (is In 2 (sites Pending)) ("SameTurn")) (sites {("NextHole" "LastHole")}) (sites Mover "Home")) if:(> (count at:(from)) 0)) (then (sow "TrackCCW" owner:(mover) apply:(if (is Occupied ("NextHole" (to))) (and { (if (and (is In ("NextHole" (to)) (sites Mover "Inner")) (is Occupied ("OppositePit" ("NextHole" (to))))) (and (fromTo (from ("OppositePit" ("NextHole" (to)))) (to ("InnerPit" ("NextHole" (to))))) (if (is Occupied ("OppositeOuterPit" ("NextHole" (to)))) (fromTo (from ("OppositeOuterPit" ("NextHole" (to)))) (to ("InnerPit" ("NextHole" (to)))))))) (moveAgain) (set Pending 2)}))))))) (end (forEach Player if:("EmptyOuterRow" Player) (result Player Loss))))) END
Construct a Ludii game based on the following description Setup: Pieces of each color are distributed symmetrically on every 3rd cell of the board. (For a game on an order 4 board, the outer cells are not used.) Four game options are provided: 1. Keep-a-riding - Goal: Last to move. Play: No passing. Pieces step to join larger group. When they can't step to join larger group, they can slide to capture. 2. Conflagration, - Goal: Win when you you have no fire left or can't make a move. Play: No passing. A piece can either take a single step to join a larger group, or slide to capture an opponent's piece. 3. Conflagration, - Firestorm Variant (longer) Rule restriction: A piece can only slide to capture when it cannot step to join a larger group. 4. Conflagration, - Backfire Variant (shorter), Rule restriction: A piece can only step to join a larger group when it cannot slide to capture. Conflagration Standard version Order 4 board ###
(define "ColourBackground" (colour 245 245 245)) (define "Last2MoveEnd" ("BlockWin")) (define "AMSEnd" (if (no Moves Next) (result Mover Loss))) (define "StandardEnd" (if (or { (no Moves Next) ("IsSingleGroupOf" Mover) ("IsSingleGroupOf" Next)}) { (if ("IsSingleGroupOf" Mover) (result Mover Win)) (if ("IsSingleGroupOf" Next) (result Next Win)) ("Last2MoveEnd")})) (define "IsSingleGroupOf" (= 1 (count Groups Cell Orthogonal if:(is #1 (who at:(to)))))) (define "Shakattrition" (do (set Var "OriginGroupSize" (size Group at:(from)) (then (set Var "From" (from)))) next:(move (from (from)) (to (intersection (sites Inner) (sites Around (from) if:(is Empty (to)))) if:(<= (var "OriginGroupSize") ("DestinationGroupSize")))))) (define "PriorityCaptureOverMoveByPiece" (forEach Piece (priority (move (from) (to (sites LineOfSight Piece at:(from)) if:(is Next (who at:(to))) (apply (remove (to))))) ("Shakattrition")))) (define "PriorityMoveOverCaptureByPiece" (forEach Piece (priority ("Shakattrition") (move (from) (to (sites LineOfSight Piece at:(from)) if:(is Next (who at:(to))) (apply (remove (to)))))))) (define "MoveOrLOSCapture" (forEach Piece (or (move (from) (to (sites LineOfSight Piece at:(from)) if:(is Next (who at:(to))) (apply (remove (to))))) ("Shakattrition")))) (define "FirstFriend" (sites To (move Hop #1 (between (min 0) if:(or { (= (from) (between)) (is Next (who at:(between))) (is Empty (between))})) (to (sites Inner) if:(is Mover (who at:(to))))))) (define "ValueAtFrom" (set Var "MaxSizeFrom" (max 1 (max (results from:(from) to:("FirstFriend" Orthogonal) (size Group at:(to) Orthogonal if:(= (mover) (who at:(to))))))))) (define "ValueAtTo" (max 1 (max (results from:(last To) to:("FirstFriend" Orthogonal) (size Group at:(to) Orthogonal if:(= (mover) (who at:(to)))))))) (define "MoveToSiteWithFriendVisible" (< 1 (count Pieces Mover in:(sites LineOfSight Piece at:(to) Orthogonal)))) (define "MoveTowardFriendInSameLine" (< 0 (count Pieces Mover in:("FurtherAlongLine" #1)))) (define "FurtherAlongLine" (sites Distance (step #1 (to if:True)) from:(to) (min 1))) (define "AlongLine" (sites Distance (step #1 (to if:True)) from:(from) (min 1))) (define "IsPlayableSiteType" (is In (to) ("PlayableSite"))) (define "PlayableSite" (difference (sites Inner) (sites Occupied by:Mover))) (define "DestinationGroupSize" (count Sites in:(sites Distance Orthogonal (step (to if:(and (!= (var "From") (to)) (is Mover (who at:(to)))))) from:(to) (min 0)))) (game "Conflagration and Keep-a-riding" (players 2) (equipment { (board (hex Hexagon 5) use:Cell) (piece "Disc" Each)}) (rules (start {(place "Disc1" {7 12 15 21 24 28 31 38 41 44 47 52}) (place "Disc2" {8 13 16 19 22 29 32 36 39 45 48 53})}) (play "MoveOrLOSCapture") (end "AMSEnd"))) END
Construct a Ludii game based on the following description The first capture must be of one counter. The first capture must be of three counters, the second of one counter. ###
(define "PiecesOwnedBy" (+ (count at:(mapEntry #1)) (count in:(sites #1)))) (define "Sow" (move Select (from (sites Mover) if:(> (count at:(from)) 0)) (then (sow #1 if:(or { (and {(<= (count at:(to)) 9) (is Odd (count at:(to))) (>= "NumCaptureDone" 2)}) (and ("IsOffBoard" "NumCaptureDone") (= (count at:(to)) 3)) (and (= "NumCaptureDone" 1) (= (count at:(to)) 1))}) apply:(fromTo (from (to)) (to (mapEntry (mover))) count:(count at:(to)) (then (and (if (= "NumCaptureDone" 1) (set Value Mover 2)) (if ("IsOffBoard" "NumCaptureDone") (set Value Mover 1))))) origin:True)))) (define "NumCaptureDone" (value Player Mover)) (game "Ako Okwe" (players 2) (equipment { (mancalaBoard 2 5 { (track "TrackCCW" "1,E,N,W" loop:True) (track "TrackCW" "6,E,S,W" loop:True)}) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 FirstSite) (pair P2 LastSite)}) (piece "Seed" Shared)}) (rules (start (set Count 10 to:(sites Track))) (play (or ("Sow" "TrackCW") ("Sow" "TrackCCW"))) (end ("MancalaByScoreWhen" (no Moves Mover))))) END
Construct a Ludii game based on the following description 3x6 board. Play begins with three counters per hole. Each player owns the row closest to them and the right half of the central row. Sowing occurs in the following direction: from left to right in the player's full row, right to left in the player's half of the central row, proceeding to the opponent's full row and sowing right to left, then left to right in the opponent's part of the central row, then proceeding back to the player's full row and proceeding as before. Sowing always begins from a player's own holes. A player can not sow from their left hand hole in their main row unless it has more than three counters, unless there is no other option. When the last counter falls into an empty hole, the turn ends. If the last counter falls into an occupied hole, the contents of that hole are picked up and sowing continues. A hole is captured by dropping the last counter of a sowing into an opponent's hole which contains three counters, making it have four counters, and becomes a wegue. Captures cannot be made until after the original three counters placed in the holes at the beginning of the game have been moved. Once a wegue is created, the player cannot sow from it. When the final counter of a sowing lands in a wegue owned by the opponent, the player captures two counters from it. Play continues until all of the counters are captured or all of the counters are accumulated in wegue. A new round begins. Players then collect the counters in their captured holes. They count their takings by filling their holes with three counters each as in the beginning, and the player would own every hole they could fill with three counters. If the player has two counters remaining, they also gain another hole and the opponent surrenders their extra counter. At the end of play, if a player captures the opponent's single remaining hole as a wegue, the player captured three counters from it, leaving one for the opponent to continue to play. Play continues until one player cannot fill any holes. ###
(define "SitesMarkedBy" (forEach (sites Board) if:(= #1 (state at:(site))))) (define "LeftMostEmpty" (trackSite FirstSite from:(mapEntry "LeftMost" Mover) if:(is Empty (to)))) (define "OnlyPiecesInMarked" (all Sites (forEach (sites Board) if:(= 0 (state at:(site)))) if:(= 0 (count at:(site))))) (define "RemmemberOwnedHoles" (if (is Mover P1) (remember Value "OwnedP1" #1) (remember Value "OwnedP2" #1))) (define "OpponentOwnedHoles" (if (is Mover P1) (sites (values Remembered "OwnedP2")) (sites (values Remembered "OwnedP1")))) (define "OwnedHoles" (if (is Mover P1) (sites (values Remembered "OwnedP1")) (sites (values Remembered "OwnedP2")))) (define "Columns" 6) (game "Gabata (Aksum)" (players 2) (equipment { (mancalaBoard 3 "Columns" store:None (track "Track" "0,E,N1,W2,17,W,S1,E2" loop:True)) (piece "Seed" Shared) (hand Each) (regions P1 (union (sites Bottom) (intersection (sites Row 1) (expand (sites Right) steps:2)))) (regions P2 (union (sites Top) (intersection (sites Row 1) (expand (sites Left) steps:2)))) (map "LeftMost" {(pair P1 0) (pair P2 17)})}) (rules (start { (set Count 3 to:(sites Track)) (set RememberValue "OwnedP1" (union (sites Bottom) (intersection (sites Row 1) (expand (sites Right) steps:2)))) (set RememberValue "OwnedP2" (union (sites Top) (intersection (sites Row 1) (expand (sites Left) steps:2))))}) phases:{ (phase "Sowing" (play (or { (move Select (from (if ("SameTurn") (sites {(var "Replay")}) ("OwnedHoles")) if:(and { (if (!= (from) (mapEntry "LeftMost" Mover)) True (if ("SameTurn") True (or (< 3 (count at:(from))) (no Pieces All in:(forEach (difference ("OwnedHoles") (mapEntry "LeftMost" Mover)) if:(= 0 (state at:(site)))))))) (< 0 (count at:(from))) (= 0 (state at:(from)))})) (then (sow apply:(if (and { (= 0 (state at:(to))) (= 4 (count at:(to))) (is In (to) ("OpponentOwnedHoles"))}) (set State at:(to) (mover)) (if (< 1 (count at:(to))) (if (= 0 (state at:(to))) (and { (moveAgain) (set Var "Replay" (to))}) (if (!= (mover) (state at:(to))) (and { (fromTo (from (to)) (to (handSite Mover)) count:(min 2 (count at:(to)))) (set State at:(to) (state at:(to)))}))))))))} (then (if ("OnlyPiecesInMarked") (and { (forEach Site ("SitesMarkedBy" 1) (fromTo (from (site)) (to (handSite P1)) count:(count at:(site)))) (forEach Site ("SitesMarkedBy" 2) (fromTo (from (site)) (to (handSite P2)) count:(count at:(site)))) (forget Value "OwnedP1" All) (forget Value "OwnedP2" All)}))))) (end (if ("NoPieceOnBoard") { (if (>= 1 (count Cell at:(handSite P1))) (result P2 Win)) (if (>= 1 (count Cell at:(handSite P2))) (result P1 Win))})) (nextPhase ("NoPieceOnBoard") "BetweenRounds")) (phase "BetweenRounds" (play (if (<= 3 (count Cell at:(handSite Mover))) (move (from (handSite Mover)) (to ("LeftMostEmpty")) count:3 (then (and { ("RemmemberOwnedHoles" (last To)) (if (<= 3 (count Cell at:(handSite Mover))) (moveAgain) (if (= 2 (count Cell at:(handSite Mover))) (and { (fromTo (from (handSite Mover)) (to ("LeftMostEmpty")) count:2) (fromTo (from (handSite Next)) (to ("LeftMostEmpty")) count:1) ("RemmemberOwnedHoles" ("LeftMostEmpty"))})))}))))) (nextPhase (and (is Empty (handSite P1)) (is Empty (handSite P2))) "Sowing"))})) END
Modify the Ludii game according to the following option changes: The version of the game played with 3 players. -> The version of the game played with 4 players. (game "Ilpion" (players 3) (equipment { (board (graph vertices:{ {1 0.5} {3 0} {5 0} {6 0} {7 0} {8 0} {10 0} {11 0} {12 3} {0 2} {3 2} {5 2} {8 2} {8.5 2} {2 3} {7 3} {1 4} {12 4} {2 5} {5 5} {10 5} {10 8} {2 7} {6 7} {8 7} {0 10} {2 9} {5 9} {10 9} {1 10} {5 14} {10 10} {1 12} {4 12} {7 14} {9 12}} edges:{ {0 10} {1 10} {2 11} {3 11} {4 12} {5 12} {6 13} {7 13} {8 13} {10 19} {16 9} {9 10} {11 19} {15 12} {12 20} {13 20} {13 17} {14 18} {18 19} {19 23} {20 23} {20 24} {21 24} {23 26} {22 26} {26 33} {26 32} {32 29} {29 25} {23 27} {27 34} {30 34} {27 35} {31 35} {27 28}}) use:Vertex) (piece "Disc" Each) (piece "Marker" Shared)}) (rules (start { (set Shared Edge (sites Board Edge))}) (play (forEach Site (sites Board) (if (> (count Sites in:(sites Incident Edge of:Vertex at:(to) Shared)) 0) (move Add (to (intersection (sites Empty) (sites {(to)}))) (then (and (if (is TreeCentre Shared) (addScore Mover 1)) (forEach Site (sites Incident Edge of:Vertex at:(last To)) (remove Edge (to))))))))) (end (if (no Moves Mover) (byScore))))) ###
(game "Ilpion" (players 4) (equipment { (board (graph vertices:{ {1 0.5} {3 0} {5 0} {6 0} {7 0} {8 0} {10 0} {11 0} {12 3} {0 2} {3 2} {5 2} {8 2} {8.5 2} {2 3} {7 3} {1 4} {12 4} {2 5} {5 5} {10 5} {10 8} {2 7} {6 7} {8 7} {0 10} {2 9} {5 9} {10 9} {1 10} {5 14} {10 10} {1 12} {4 12} {7 14} {9 12}} edges:{ {0 10} {1 10} {2 11} {3 11} {4 12} {5 12} {6 13} {7 13} {8 13} {10 19} {16 9} {9 10} {11 19} {15 12} {12 20} {13 20} {13 17} {14 18} {18 19} {19 23} {20 23} {20 24} {21 24} {23 26} {22 26} {26 33} {26 32} {32 29} {29 25} {23 27} {27 34} {30 34} {27 35} {31 35} {27 28}}) use:Vertex) (piece "Disc" Each) (piece "Marker" Shared)}) (rules (start { (set Shared Edge (sites Board Edge))}) (play (forEach Site (sites Board) (if (> (count Sites in:(sites Incident Edge of:Vertex at:(to) Shared)) 0) (move Add (to (intersection (sites Empty) (sites {(to)}))) (then (and (if (is TreeCentre Shared) (addScore Mover 1)) (forEach Site (sites Incident Edge of:Vertex at:(last To)) (remove Edge (to))))))))) (end (if (no Moves Mover) (byScore))))) END
Construct a Ludii game based on the following description 2x7 board. Four counters per hole. The first player takes all of the counters from one of their holes. If they take from the central hole, they can be placed in any other hole on the board. If they are from any other hole, they can be placed in any hole except the opposite hole on the opponent's side. Once both players have made this initial move, the main phase of the game begins. Players alternate turns taking counters from one of the holes on their side of the board and sowing them. Groups of four counters are always sown. Play can occur in a clockwise or anti-clockwise direction. Players sow four counters at a time; that is, placing four counters in each hole. When the final four counters land in an empty hole in the player's row, any counters in the opponent's opposite hole are captured, and the player may sow again from another hole. Play continues until all of the counters have been captured, and the player with the most counters wins. ###
(define "PiecesOwnedBy" (+ (count in:(sites Mover)) (count Cell at:(handSite #1)))) (define "NoPieceOnBoard" (= 4 (count Pieces All in:(sites Board)))) (define "Columns" 7) (game "Luuth" (players 2) (equipment { (mancalaBoard 2 "Columns" store:None { (track "TrackCCW" "0,E,N,W" loop:True) (track "TrackCW" "6,W,N,E" loop:True)}) (piece "Seed" Shared) (hand Each) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start (set Count 4 to:(sites Track))) phases:{ (phase "Opening" (play (move (from (sites Mover)) (to (if (is In (from) (sites Centre)) (difference (sites Board) (from)) (difference (sites Board) (sites {(from) ("OppositePit" (from))})))) count:(count at:(from)))) (nextPhase Mover "Sowing")) (phase "Sowing" (play (or (move Select (from (sites Mover) if:(is Occupied (from))) (then (sow numPerHole:4 "TrackCCW" apply:(if (and (is In (to) (sites Mover)) (= 4 (count at:(to)))) (and (moveAgain) (if (is Occupied ("OppositePit" (to))) (fromTo (from ("OppositePit" (to))) (to (handSite Mover)) count:(count at:("OppositePit" (to)))))))))) (move Select (from (sites Mover) if:(is Occupied (from))) (then (sow numPerHole:4 "TrackCW" apply:(if (and (is In (to) (sites Mover)) (= 4 (count at:(to)))) (and (moveAgain) (if (is Occupied ("OppositePit" (to))) (fromTo (from ("OppositePit" (to))) (to (handSite Mover)) count:(count at:("OppositePit" (to)))))))))))))} (end ("MancalaByScoreWhen" ("NoPieceOnBoard"))))) END
Construct a Ludii game based on the following description 8x8 board. The pieces move as follows, with the number per player: 1 x Shah (king): moves one space orthogonally or diagonally. 1 x Fers (counselor): Any distance orthogonally or diagonally.]. 2 x Rukh (rook): Any number of spaces orthogonally. 2 x Pil (elephant): Any distance diagonally. 2 x Asb (horse): Moves as a chess knight. 8 x Sarbaz (soldier): Moves one space forward orthogonally; one space forward diagonally to capture. No en passant. The first move must be the Fers's Sarbaz, which moves two spaces forward. Castling can happen in three moves, moving the Shah forward or backward once orthogonally and once with the Asb's move, and moving the Rukh to the Shah's former space. Castling can also be done on the Fers's side, but moving the Rukh to the Fers's space. When a piece moves to a space occupied by an opponent's piece, the opponent's piece is captured. If the Shah can be captured on the opponent's next turn, it is in check. A player's Shah must not be in check at the end of their turn. If this is impossible, it is checkmate and the opponent wins. ###
(define "PieceHasMoved" (set State at:#1 0)) (game "Persian Chess with a Queen" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) (piece "King_noCross" Each (or { ("StepToNotFriend" ~ (then (if (and (= 1 (state at:(last To))) (= (last To) (mapEntry "AheadKing" Mover))) (set State at:(last To) 2) (if (!= (state at:(last To)) 0) ("PieceHasMoved" (last To)))))) (if (and { (= 1 (state at:(from))) (= 1 (state at:(mapEntry "RookRight" Mover))) (is Empty (mapEntry "KnightKingRightForward" Mover))}) (move (from) (to (mapEntry "KnightKingRightForward" Mover)) (then (if (!= (state at:(last To)) 0) ("PieceHasMoved" (last To)))))) (if (and { (= 1 (state at:(from))) (= 1 (state at:(mapEntry "RookLeft" Mover))) (is Empty (mapEntry "KnightKingLeftForward" Mover))}) (move (from) (to (mapEntry "KnightKingLeftForward" Mover)) (then (if (!= (state at:(last To)) 0) ("PieceHasMoved" (last To)))))) (if (and { (= 2 (state at:(from))) (= 2 (state at:(regionSite (sites Start (piece (id "King" Mover))) index:0)))}) (move (from) (to (mapEntry "KnightKingLeftBackward" Mover)) (then ("PieceHasMoved" (last To))))) (if (and { (= 2 (state at:(from))) (= 3 (state at:(regionSite (sites Start (piece (id "King" Mover))) index:0)))}) (move (from) (to (mapEntry "KnightKingRightBackward" Mover)) (then ("PieceHasMoved" (last To)))))})) (piece "Rook" Each (move Slide Orthogonal (to if:("IsEnemyAt" (to)) (apply (remove (to)))) (then (if (= (state at:(last To)) 1) (if (and (is In (last To) (sites Start (piece (id "King" Mover)))) (= 2 (state at:(where "King" Mover)))) (if (= (last From) (mapEntry "RookLeft" Mover)) (set State at:(last To) 2) (set State at:(last To) 3)) ("PieceHasMoved" (last To)))))) maxState:3) ("ChessBishop" "Bishop_noCross") ("ChessKnight" "Knight") ("ChessQueen" "Ferz_noCross") ("ChessPawn" "Pawn") (map "RookLeft" {(pair 1 "A1") (pair 2 "A8")}) (map "RookRight" {(pair 1 "H1") (pair 2 "H8")}) (map "AheadKing" {(pair 1 "E2") (pair 2 "E7")}) (map "KnightKingRightForward" {(pair 1 "G2") (pair 2 "G7")}) (map "KnightKingLeftForward" {(pair 1 "C2") (pair 2 "C7")}) (map "KnightKingRightBackward" {(pair 1 "G1") (pair 2 "G8")}) (map "KnightKingLeftBackward" {(pair 1 "C1") (pair 2 "C8")})}) (rules (start { (place "Pawn1" (sites Row 1)) (place "Pawn2" (sites Row 6)) (place "Rook1" {"A1" "H1"} state:1) (place "Knight1" {"B1" "G1"}) (place "Bishop_noCross1" {"C1" "F1"}) (place "Ferz_noCross1" coord:"D1") (place "King_noCross1" coord:"E1" state:1) (place "Rook2" {"A8" "H8"} state:1) (place "Knight2" {"B8" "G8"}) (place "Bishop_noCross2" {"C8" "F8"}) (place "Ferz_noCross2" coord:"D8") (place "King_noCross2" coord:"E8" state:1)}) (play (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King_noCross" Mover)))) (end ("Checkmate" "King_noCross")))) END
Construct a Ludii game based on the following description Four 3x4 rectangles, arranged in a cross shape, with a large central square which has diagonals, and spaces in the four corners between each arm of the cross. Four players, played on two teams, with team members sitting on opposite sides of the board. Four pieces per player, with the colors red, black, yellow, and green. Six cowrie shells used as dice: five are white and one is yellow. The number of the mouths which are face-up determine the value of the throw, except for a throw of 3 when one of the cowries with the mouth down is the yellow one, in which case the throw is known as So-hatara, and counts as 4, but allows special moves because it is actually considered four individual throws of 1. When the player throws 1, 5, or So-hatara, the player receives an extra throw. A 1, 5, or So-hatara must be thrown to enter a piece on the board. The entirety of a throw must be used to move one piece, but separate throws in a turn can each be used individually to move a different piece. This does not apply when So-hatara is one of the throws; in this case, the total of the throw can be subdivided however the player sees fit. Pieces enter the board from the center, moving down the central track of their arm, then in an anti-clockwise direction around the board, and then back up the central row of their arm of the board to the central square. If a player lands on a space occupied by a piece of the opposing team, the opponent's piece is sent back to start. Pieces resting on the corner spaces between the arms of the cross cannot be sent to start in any circumstance. The first team who places all of their pieces in the central square wins. ###
(define "PlayingSohatara" (is Pending)) (define "Move" (if ("IsEndTrack" ("NextSiteOnTrack" #1)) "RemoveAPiece" (if ("IsNotOffBoard" ("NextSiteOnTrack" #1)) (if (or (is Empty ("NextSiteOnTrack" #1)) (and ("IsEnemyAt" ("NextSiteOnTrack" #1)) (not (is In ("NextSiteOnTrack" #1) (sites "SafeSites"))))) (move (from) (to ("NextSiteOnTrack" #1) "CaptureEnemyPiece")))))) (define "CaptureEnemyPiece" ("HittingCapture" (handSite (who at:(to))))) (define "RemoveAPiece" (move Remove (from))) (define "SpecialThrows" (or ("Sohatara") (is In ("ThrowValue") (sites {1 5})))) (define "ThrowValue" (count Pips)) (define "Sohatara" (and (= ("ThrowValue") 3) (= 0 ("ValueYellowDice")))) (define "ValueYellowDice" (face 65)) (game "Asi Keliya" (players 4) (equipment { (board (merge { (add (add (merge { (rectangle 3 4) (shift 7 0 (rectangle 3 4)) (shift 3.5 3.5 (rotate 90 (rectangle 3 4))) (shift 3.5 -3.5 (rotate 90 (rectangle 3 4)))}) vertices:{{5.5 1.5}}) edges:{{4 76} {35 76} {19 76} {20 76}}) (shift 3 3 (square 1)) (shift 7 3 (square 1)) (shift 3 -1 (square 1)) (shift 7 -1 (square 1))}) { (track "Track1" "6,52,S,E,N3,E,N1,E,N,W3,N1,W1,N,W,S3,W1,S1,W,S,E3,S1,E1,S,E1,N3,End" P1 directed:True) (track "Track2" "7,11,W,S1,E3,S1,E1,S,E,N3,E1,N1,E,N,W3,N,W1,N,W2,S3,W1,S1,W,S1,E3,End" P2 directed:True) (track "Track3" "17,39,N,W1,S3,W1,S1,W,S,E3,S1,E1,S,E,N3,E,N1,E,N,W3,N,W1,N,W1,S3,End" P3 directed:True) (track "Track4" "21,26,E,N1,W3,N1,W1,N,W,S3,W1,S1,W,S,E3,S1,E1,S,E,N3,E1,N1,E,N1,W3,End" P4 directed:True)}) (piece "Marker" Each ("Move" ("ThrowValue"))) (hand Each) ("StickDice" 6) (map {(pair P1 6) (pair P2 7) (pair P3 17) (pair P4 21)}) (regions "SafeSites" (sites {3 19 16 34}))}) (rules (start { (set Team 1 {P1 P3}) (set Team 2 {P2 P4}) (place "Marker" "Hand" count:4)}) (play (do (if (not ("PlayingSohatara")) (roll)) next:(or (if ("SpecialThrows") (move (from (handSite Mover)) (to (mapEntry (mover)) if:(is Empty (mapEntry (mover)))))) (if (or ("PlayingSohatara") ("Sohatara")) (forEach Die if:("DieNotUsed") (forEach Piece ("Move" (pips))) (then (if (not (all DiceUsed)) (and (set Pending) (moveAgain))))) (forEach Piece))) (then (if ("SpecialThrows") (moveAgain))))) (end ("EscapeTeamWin")))) END
Modify the Ludii game according to the following option changes: The game is played on a 9x9 board -> The game is played on a 15x15 board (game "Gonnect" (players 2) (equipment { (board (square 9) use:Vertex) (piece "Marker" Each) (regions P1 {(sites Side N) (sites Side S)}) (regions P2 {(sites Side W) (sites Side E)})}) (rules (meta { (swap) (no Repeat)}) (play (do (move Add (to (sites Empty)) (then ("EncloseCapture" Orthogonal))) ifAfterwards:("HasFreedom" Orthogonal))) (end { (if (is Connected Mover) (result Mover Win)) ("BlockWin")}))) ###
(game "Gonnect" (players 2) (equipment { (board (square 15) use:Vertex) (piece "Marker" Each) (regions P1 {(sites Side N) (sites Side S)}) (regions P2 {(sites Side W) (sites Side E)})}) (rules (meta { (swap) (no Repeat)}) (play (do (move Add (to (sites Empty)) (then ("EncloseCapture" Orthogonal))) ifAfterwards:("HasFreedom" Orthogonal))) (end { (if (is Connected Mover) (result Mover Win)) ("BlockWin")}))) END
Construct a Ludii game based on the following description The board begins initially with one stone on each playable site. First, according to the player's wish, one stone must be removed. Then, each piece jumps over another piece to an empty site to remove the piece that was jumped over. If the player has no move, they lose. If only one stone is left on the board, the player wins. A win is considered to be good luck and anything you pray for will come true. ###
(game "Jiu Zi Xian Qi" (players 1) (equipment { ("StarBoard" 5) (piece "Marker" P1 ("HopFriendCapture"))}) (rules (start (place "Marker" (sites Board))) phases:{ (phase "Remove" (play (move Remove (sites Board))) (nextPhase "Playing")) (phase "Playing" (play (forEach Piece)) (end { (if (= 1 (count Pieces P1)) (result Mover Win)) ("NoMoves" Loss)}))})) END
Construct a Ludii game based on the following description The first player begins the game by placing a stone anywhere on the board. Then, starting with the second player, players take turns placing a stone orthogonally adjacent to exactly one enemy stone and no friendly stones. ###
(game "Gopher" (players 2) (equipment { (board (hex 6)) (piece "Disc" Each)}) (rules (play (if (= 0 (count Moves)) (move Add (to (sites Empty))) (move Add (to (sites Empty) if:(and (= 0 (count Sites in:(sites Around (to) Own))) (= 1 (count Sites in:(sites Around (to) Enemy)))))))) (end ("NoMoves" Loss)))) END
Construct a global Ludii definition which fulfills the following requirements. Defines a step move to all the directions specified (adjacent by default) to a site occupied by an enemy piece or an empty site. The enemy piece is removed. ###
(define "StepToNotFriend" (move Step #1 (to if:(not ("IsFriendAt" (to))) (apply (remove (to)))) #2)) END
Modify the Ludii game according to the following option changes: A size 4 board is currently selected -> A size 6 board is currently selected (game "Bamboo" (players 2) (equipment { (board (hex 4)) (piece "Disc" Each) (piece "Disc" Neutral)}) (rules (play (do (move Add (to (sites Empty))) ifAfterwards:(<= (max (results from:(sites Occupied by:Mover) to:1 (* 1 (size Group at:(from))))) (count Groups if:(= (who at:(to)) (mover)))))) (end ("NoMoves" Loss)))) ###
(game "Bamboo" (players 2) (equipment { (board (hex 6)) (piece "Disc" Each) (piece "Disc" Neutral)}) (rules (play (do (move Add (to (sites Empty))) ifAfterwards:(<= (max (results from:(sites Occupied by:Mover) to:1 (* 1 (size Group at:(from))))) (count Groups if:(= (who at:(to)) (mover)))))) (end ("NoMoves" Loss)))) END
Construct a Ludii game based on the following description Played on a board with 36 holes arranged in a square, with a gap in the center of each side. There are arcs of five holes branching from opposite corners. Can be played with two to four players, who can also play on teams. One or two pieces per player. Four stick dice are used, with one marked side. Each die is marked differently for a different value: 4, 6, 14, 15. The throws are as follows: All marked sides up = 5; three marked sides up = 3; two marked sides up = 2, one marked side up = the value of the marked side; zero marked sides up = 10. Players’ pieces enter on the branching arcs. The second piece cannot enter before the first one leaves the arc. Each player can choose which direction they wish to move around the board, but they must continue in this direction for the rest of the game. If a player lands on the same spot as the opponent, the opponent’s piece is removed from the board and must re-enter. Player must make an exact throw to get a piece off the board after reentering the arc from the spot where the player entered the board. The player to get both of their pieces off the board first wins. 2 players. Each player has 2 pieces. ###
(define "PieceCanEnterOnlyIfNoPieceOnArc" (and (= (from) (handSite Mover)) (all Sites (sites Mover "Arc") if:(!= (who at:(site)) Mover)))) (define "PieceAlreadyEntered" (!= (from) (handSite Mover))) (define "RememberSelectedTrack" (then (if (and (= (state at:(last To)) 0) (is In (last To) (sites "AllSitesDifferentThanArc"))) (set State at:(last To) #1)))) (define "MoveOn" (if ("IsEndTrack" #1) "RemoveAPiece" (if ("IsNotOffBoard" #1) (if (not ("IsFriendAt" #1)) (move (from) (to #1 "CaptureEnemyPiece")))) #2)) (define "RemoveAPiece" (move Remove (from))) (define "CaptureEnemyPiece" (apply if:("IsEnemyAt" (to)) (and (set State at:(to) 0) (fromTo (from (to)) (to (handSite Next)))))) (define "ThrowValue" (mapEntry "Throw" (count Pips))) (define "SiteToMoveOnTrackCCW" ("NextSiteOnTrack" ("ThrowValue")"TrackCCW")) (define "SiteToMoveOnTrackCW" ("NextSiteOnTrack" ("ThrowValue") "TrackCW")) (define "SiteToMoveOnSelectedTrack" (if (= (state at:(from)) 2) ("NextSiteOnTrack" ("ThrowValue") "TrackCCW") ("NextSiteOnTrack" ("ThrowValue")"TrackCW"))) (game "Ghingskoot" (players 2) (equipment { ("KintsBoard" { (track "TrackCW1" "46,5,SSE,N,E,S,W,NNW,End" P1 directed:True) (track "TrackCCW1" "46,5,SSE,E,N,W,S,NNW,End" P1 directed:True) (track "TrackCW2" "47,41,NNW,S,W,N,E,SSE,End" P2 directed:True) (track "TrackCCW2" "47,41,NNW,W,S,E,N,SSE,End" P2 directed:True)}) (regions "AllSites" (sites Board)) (regions "Arc" P1 (sites {1..5})) (regions "Arc" P2 (sites {41..45})) (regions "AllSitesDifferentThanArc" (difference (sites Board) (union {(sites P1 "Arc") (sites P2 "Arc") (sites {0 32})}))) (dice d:2 facesByDie:{{0 4} {0 6} {0 14} {0 15}} num:4) (piece "Marker" Each (if (= (state at:(from)) 0) (if (or ("PieceAlreadyEntered") ("PieceCanEnterOnlyIfNoPieceOnArc")) (or ("MoveOn" "SiteToMoveOnTrackCW" ("RememberSelectedTrack" 1)) ("MoveOn" "SiteToMoveOnTrackCCW" ("RememberSelectedTrack" 2)))) ("MoveOn" "SiteToMoveOnSelectedTrack"))) (hand Each) (map "Throw" { (pair 0 10) (pair 39 5) (pair 24 3) (pair 25 3) (pair 35 3) (pair 33 3) (pair 10 2) (pair 18 2) (pair 19 2) (pair 20 2) (pair 21 2) (pair 29 2)})}) (rules (start (place "Marker" "Hand" count:2)) (play ("RollMove" (or (forEach Piece) (forEach Piece container:(mover))))) (end ("EscapeWin")))) END
Construct a Ludii game based on the following description A player moves one disk at a time to an empty rod or on a rod where it rests on a larker disk. The goal is to place all of the disks on one rod in decreasing size with the largest on the bottom and the smallest on top. ###
(game "Tower of Hanoi" (players 1) (equipment { (board (rectangle 1 3)) (piece "Counter3" P1) (piece "Counter6" P1) (piece "Counter9" P1)}) (rules (start { (place Stack items:{"Counter9" "Counter6" "Counter3"} 0)}) (play ("MoveToEmptyOrOccupiedByLargerPiece" (sites Occupied by:Mover))) (end { (if (is Target {3 2 1} 2) (result P1 Win)) (if (= (count Moves) 7) (result P1 Loss))}))) END
Construct a Ludii game based on the following description 6x3 or 6 board. Two counters in each hole. Sowing occurs from one of the holes in the player's outermost row which contains counters, in either direction. Sowing moves in a boustrophedon path along the holes, moving from the last hole in the innermost row to the beginning of the outer row. When the final counter lands in an occupied hole, the contents of this hole are picked up and sowing continues. If this hole is in the player's inner row, the contents of the opponent's hole opposite it are captured, and these counters are also used along with the hole in which the last counter fell for the sowing to continue. If the opponent's inner row hole is empty, counters may be captured from their central row, and if both the inner and central rows are empty, captures may be made from the outer hole. Sowing ends when the final counter lands in an empty hole. When a player has only one counter on their side of the board, it may capture by moving from the central row directly to the inner row hole above it to make a capture (i.e., without following the normal track), and on the move prior to the capture, from the outer to the central row. Play continues until one player has captured all of the counters. 6 Holes per row. ###
(define "OuterMostRowWithPieces" (if (!= 0 (count in:(sites Mover "Outer"))) (sites Mover "Outer") (if (!= 0 (count in:(sites Mover "Middle"))) (sites Mover "Middle") (sites Mover "Inner")))) (define "OneSingePieceInTheOuter" (and (= (count in:(sites Mover "Home")) 1) (= (count in:(sites Mover "Outer")) 1))) (define "OneSingePieceInTheMiddle" (and (= (count in:(sites Mover "Home")) 1) (= (count in:(sites Mover "Middle")) 1))) (define "NoPiece" (all Sites (sites Player "Home") if:(= 0 (count at:(site))))) (define "OppositeOuterPit" (if (is Mover P1) (+ #1 (* "Columns" 3)) (- #1 (* "Columns" 3)))) (define "OppositeMiddlePit" (if (is Mover P1) (+ #1 (* "Columns" 2)) (- #1 (* "Columns" 2)))) (define "Columns" 6) (game "Katro" (players 2) (equipment { (mancalaBoard 6 "Columns" store:None { (track "TrackCCW1" "0,E,N1,W,N1,E" loop:True P1) (track "TrackCW1" "5,W,N1,E,N1,W" loop:True P1) (track "TrackCW2" "18,E,N1,W,N1,E" loop:True P2) (track "TrackCCW2" "23,W,N1,E,N1,W" loop:True P2)}) (piece "Seed" Shared) (regions "Home" P1 (sites Track "TrackCCW1")) (regions "Home" P2 (sites Track "TrackCCW2")) (regions "Inner" P1 (sites Row 2)) (regions "Inner" P2 (sites Row 3)) (regions "Middle" P1 (sites Row 1)) (regions "Middle" P2 (sites Row 4)) (regions "Outer" P1 (sites Bottom)) (regions "Outer" P2 (sites Top))}) (rules (start (set Count 2 to:(sites Board))) (play (or { (if (or (= (value Player Mover) 1) (<= (value Player Mover) 0)) (move Select (from (if ("SameTurn") "LastHoleSowed" ("OuterMostRowWithPieces")) if:(> (count at:(from)) 0)) (then (sow "TrackCCW" owner:(mover) apply:(if (> (count at:(to)) 1) (and { (if (<= (value Player Mover) 0) (set Value Mover 1)) (moveAgain) (if (is In (to) (sites Mover "Inner")) (if (!= 0 (count at:("OppositePit" (to)))) (fromTo (from ("OppositePit" (to))) (to (to)) count:(count at:("OppositePit" (to)))) (if (!= 0 (count at:("OppositeMiddlePit" (to)))) (fromTo (from ("OppositeMiddlePit" (to))) (to (to)) count:(count at:("OppositeMiddlePit" (to)))) (if (!= 0 (count at:("OppositeOuterPit" (to)))) (fromTo (from ("OppositeOuterPit" (to))) (to (to)) count:(count at:("OppositeOuterPit" (to))))))))}) (set Value Mover 0)))))) (if (or (= (value Player Mover) 2) (<= (value Player Mover) 0)) (move Select (from (if ("SameTurn") "LastHoleSowed" ("OuterMostRowWithPieces")) if:(> (count at:(from)) 0)) (then (sow "TrackCW" owner:(mover) apply:(if (> (count at:(to)) 1) (and { (if (<= (value Player Mover) 0) (set Value Mover 2)) (moveAgain) (if (is In (to) (sites Mover "Inner")) (if (!= 0 (count at:("OppositePit" (to)))) (fromTo (from ("OppositePit" (to))) (to (to)) count:(count at:("OppositePit" (to)))) (if (!= 0 (count at:("OppositeMiddlePit" (to)))) (fromTo (from ("OppositeMiddlePit" (to))) (to (to)) count:(count at:("OppositeMiddlePit" (to)))) (if (!= 0 (count at:("OppositeOuterPit" (to)))) (fromTo (from ("OppositeOuterPit" (to))) (to (to)) count:(count at:("OppositeOuterPit" (to))))))))}) (set Value Mover 0)))))) (if ("OneSingePieceInTheOuter") (move (from (sites Mover "Outer") if:(> (count at:(from)) 0)) (to (if (is Mover P1) (ahead (from) N) (ahead (from) S))))) (if ("OneSingePieceInTheMiddle") (move (from (sites Mover "Middle") if:(and (> (count at:(from)) 0) (< 1 (count in:(sites Column (column of:(from))))))) (to (if (is Mover P1) (ahead (from) N) (ahead (from) S))) (then (and (if (!= 0 (count at:("OppositePit" (last To)))) (fromTo (from ("OppositePit" (last To))) (to (last To)) count:(count at:("OppositePit" (last To)))) (if (!= 0 (count at:("OppositeMiddlePit" (last To)))) (fromTo (from ("OppositeMiddlePit" (last To))) (to (last To)) count:(count at:("OppositeMiddlePit" (last To)))) (if (!= 0 (count at:("OppositeOuterPit" (last To)))) (fromTo (from ("OppositeOuterPit" (last To))) (to (last To)) count:(count at:("OppositeOuterPit" (last To))))))) (moveAgain)))))})) (end (forEach NonMover if:("NoPiece") (result Player Loss))))) END
Construct a Ludii game based on the following description Definitions: 1 A group is a stone along with all stones one can reach from it through a series of steps onto adjacent stones of the same color. 1.1 The size of a group is the number of stones in it. 2 A brood is a group along with all other groups of identical color, size and shape. Shapes are considered identical across symmetries (just like in Bug). 2.1 The size of a brood is the number of groups in it. 2.2 The order of a brood is the size of the groups in it. 2.3 The mass of a brood is the number of stones in it (its size times its order). Play: On the very first turn of the game, Black places one stone of their colour on any hex. After, that – starting with White – take turns doing one of the following: - Pass. - Place two stones of your colour on empty hexes. When the players pass consecutively, the winner is the player with the higher score. Scoring: For each of your broods, you score its mass multiplied by the lesser of its size and its order. For example, if a brood consists of 2 groups of size 3, it is worth 12 points. Its order is 3, its size is 2 and its mass is 6. Since 2 is smaller than 3, the brood is worth 6*2 = 12. A board of size 5 is currently selected. Nothing is currently printed on the pieces. The 12* placement protocol is currently in effect. This is the protocol described in the rules above. ###
(define "PlaceHex" (do (forEach Site (sites Occupied by:Mover) (set State at:(site) 0)) next:(move Add (piece (id "Hex" Mover)) (to (sites Empty)) (then ("RecordShapeVectorsAsValues"))) (then ("ScorePlayer" (mover))))) (define "ScorePlayer" (forEach Group if:(= #1 (who at:(to))) (remember Value (regionSite (sites) index:0) unique:True) (then (and { ("CountShapesOf" #1) (set Score Mover 0 (then (forEach Piece (addScore Mover (state at:(from))))))})))) (define "CountShapesOf" (forEach Value (values Remembered) (and { (set Var "KeySite" (value) (then (forEach Group if:(= #1 (who at:(to))) ("IfShapessMatchDo" (remember Value "ShapeCount" (var "KeySite")) (var "KeySite")))))} (then ("RecordMultiplier"))) (then (forget Value All)))) (define "RecordMultiplier" (forEach Site (sites Group at:(var "KeySite")) (set State at:(site) (min ("BroodSize") ("GroupSize"))))) (define "BroodSize" (count Value (var "KeySite") in:(values Remembered "ShapeCount"))) (define "GroupSize" (size Group at:(var "KeySite"))) (define "RecordShapeVectorsAsValues" (set Var "LastRow" (row of:(max (array (sites Group at:(last To))))) (then (set Var "LastCol" (max (results from:(sites Group at:(last To)) to:(from) (column of:(from)))) (then (forEach Site (sites Group at:(last To)) (set Value at:(site) (+ (* 32 (- (var "LastRow") (row of:(site)))) (- (var "LastCol") (column of:(site))))))))))) (define "IfShapessMatchDo" (if ("IsSameSizeAsShapeAtValue" #2) (priority { ("IfThisRotationDo" ("DRow") ("DCol") #1 #2) ("IfThisRotationDo" ("DRow") (- "DRow" "DCol") #1 #2) ("IfThisRotationDo" (- "DRow" "DCol") ("DRow") #1 #2) ("IfThisRotationDo" ("DCol") ("DRow") #1 #2) ("IfThisRotationDo" (- "DCol") (- "DRow" "DCol") #1 #2) ("IfThisRotationDo" (- "DCol" "DRow") ("DCol") #1 #2) ("IfThisRotationDo" (- "DRow") (- "DCol") #1 #2) ("IfThisRotationDo" (- "DRow") (- "DCol" "DRow") #1 #2) ("IfThisRotationDo" (- "DCol" "DRow") (- "DRow") #1 #2) ("IfThisRotationDo" (- "DCol") (- "DRow") #1 #2) ("IfThisRotationDo" ("DCol") (- "DCol" "DRow") #1 #2) ("IfThisRotationDo" (- "DRow" "DCol") (- "DCol") #1 #2)}))) (define "IsSameSizeAsShapeAtValue" (= (size Array (array (sites))) (size Array (array (sites Group at:#1))))) (define "DCol" (% (value Piece at:(from)) 32)) (define "DRow" (/ (value Piece at:(from)) 32)) (define "IfThisRotationDo" (if (= 0 (size Array (difference (results from:(sites Group at:#4) to:(from) (+ (+ (* 32 #1) (#2)) (+ (max (results from:(sites Group at:#4) to:(from) (- (* 32 #1)))) (max (results from:(sites Group at:#4) to:(from) (- (#2))))))) (results from:(sites) to:(from) (value Piece at:(from)))))) #3)) (game "Brood" (players 2) (equipment { (board (hex Hexagon 5) use:Cell) (piece "Hex" Each maxState:7 maxValue:1023) (piece "Disc" Neutral) (hand Shared)}) (rules (play (if (or (= 0 (count Moves)) (!= 0 (count MovesThisTurn))) ("PlaceHex") (or (move Pass) (and { ("PlaceHex")} (then (moveAgain)))) (then (forget Value All)))) (end (if (all Passed) (byScore))))) END
Describe the mechanics of the following Ludii game (define "NumRemove" (+ 1 (count MovesThisTurn))) (define "Max" (if (= 1 (count Turns)) (- 40 1) (* 2 (value Player (prev MoverLastTurn))))) (game "Fibonacci Nim" (players 2) (equipment { (board (square 1)) (piece "Marker" Neutral)}) (rules (start (set Count 40 at:0)) (play (if "SameTurn" (or (if (<= "NumRemove" "Max") (move Select (from (last To)) (then (if (= (count at:(last To)) 1) (remove (last To)) (and (set Count at:(last To) (- (count at:(last To)) 1)) (moveAgain)))))) (move Pass (then (set Value Mover (- ("NumRemove") 1))))) (move Select (from (sites Occupied by:Neutral)) (then (if (= (count at:(last To)) 1) (remove (last To)) (and (set Count at:(last To) (- (count at:(last To)) 1)) (moveAgain))))))) (end (if (no Moves Next) (result Mover Win))))) ###
Fibonacci Nim is played by two players, who alternate removing coins or other counters from a pile. On the first move, a player is not allowed to take all of the coins, and on each subsequent move, the number of coins removed can be any number that is at most twice the previous move. According to the normal play convention, the player who takes the last coin wins. Or according to the Misère game, the player who takes the last coin loses. The last mover wins. The game involves a pile of 40 pieces. END
Construct a Ludii game based on the following description Players take turns placing a piece of each color in an empty site. Play ends at the start of the first players turn, if all the players would not be able to complete their turn. Example: for 2 players less than 4 empty sites. Scores are awarded based on the sizes of the groups of each color on the board, which are multiplied. The player with the highest score wins. The game is played on a 5x5 board The version of the game played with 2 players. ###
(game "Omega" (players 2) (equipment { (board (hex 5)) (piece "Marker" Each)}) (rules (play (move Add (piece (+ 1 (% (count Moves) (count Players)))) (to (sites Empty)) (then (if (!= (count MovesThisTurn) (- (count Players) 1)) (moveAgain))))) (end (if (and { (not (is Mover P1)) (is Next P1) (> (pow (count Players) 2) (count Sites in:(sites Empty)))}) (byScore {(score P1 (* (sizes Group P1))) (score P2 (* (sizes Group P2)))}))))) END
Construct a Ludii game based on the following description A player wins by connecting opposite sides of the square board with a chain of their pieces. The game is played on a 13x13 board The first player to connect their two sides wins. ###
(game "Gale" (players 2) (equipment { (board (square 13)) (piece "Square" Each) (regions P1 {(sites Top) (sites Bottom)}) (regions P2 {(sites Left) (sites Right)})}) (rules (start { (place "Square1" (forEach (sites Board) if:(and (is Even (column of:(site))) (is Odd (row of:(site)))))) (place "Square2" (forEach (sites Board) if:(and (is Even (row of:(site))) (is Odd (column of:(site))))))}) (play (move Add (to (sites Empty)))) (end (if (is Connected Mover) (result Mover Win))))) END
Construct a Ludii game based on the following description 5x5 intersecting lines. Triangles on each side, with the apex intersecting with the midpoint of the side of the square. A line is drawn from the apex to the base of each triangle, and a line bisecting it and the two opposite sides. A diamond is drawn within the square, the corners of which intersect with the apices of the triangles and the midpoint of each side is the center point of each quadrant of the square. 24 pieces per player, which begin on the points of the board closest to the player and in the triangle to their right and the right half of the central row. The central point is vacant. Players alternate turns moving a piece to an empty adjacent spot on the board. A piece may capture an opponent's piece by hopping over it to an empty adjacent spot immediately on the opposite side of the opponent's pieces along the lines on the board. The player who captures all of the opponent's pieces wins. ###
(game "Padaivettu" (players 2) (equipment { (board (remove ("AlquerqueGraphWithFourTriangles") edges:{{20 16} {16 12} {12 8} {8 4} {0 6} {6 12} {12 18} {18 24}}) use:Vertex) (piece "Marker" Each (or ("StepToEmpty") ("HopCapture")))}) (rules (start { (place "Marker1" (difference (union (expand (sites Right)) (expand (sites Bottom) steps:4)) (expand (sites Centre) steps:2 W))) (place "Marker2" (difference (union (expand (sites Left)) (expand (sites Top) steps:4)) (expand (sites Centre) steps:2 E)))}) (play (forEach Piece)) (end ("CaptureAll" Next)))) END
Construct a Ludii game based on the following description Goal:Score the product of the sizes of your two largest chains. Highest score wins. In case of a tie, the last to play wins. Chains are a series of adjacent like-colored stones with no branching. Play: Boards starts empty. The darker color starts. On a turn the moving player does one of these actions: - Place one of their stones onto an empty site adjacent to no more than 2 of their stones, or - Remove one of their stones that is adjacent to more than two of their stones. Otherwise he passes. The game ends when both players pass. Order 9, Square Ortho-Grid ###
(define "GridDirection" Orthogonal) (define "AddOrPass" (or { (move Add (piece (id "Disc" Mover)) (to (sites Empty) if:(> 3 (count Pieces Mover in:(sites Around (to) "GridDirection")))) (then (set Var "Added" 1))) (move Pass)})) (define "Score4" (do (forEach Site (sites Occupied by:#1) (if (> 3 (count Pieces #1 in:(sites Around (site) "GridDirection"))) (set State at:(site) 0) (set State at:(site) 1))) next:(do (and { (remember Value 0) (remember Value 0) (forEach Group "GridDirection" (if (no Pieces in:(intersection (sites) (sites State 1))) (remember Value (count Sites in:(sites)))))}) next:(set Var "TopValue" (max (values Remembered)) (then (forget Value (max (values Remembered)) (then (set Score #1 (* (var "TopValue") (max (values Remembered))) (then (forget Value All)))))))))) (define "GridDirection" Orthogonal) (game "Wrigglers Squared" (players 2) (equipment { (board (square 9) use:Vertex) (piece "Disc" Each)}) (rules (play (if (= 1 (var "Added")) (or { "AddOrPass" (forEach Piece (if (< 2 (count Pieces Mover in:(sites Around (from) "GridDirection"))) (move Remove (from) (then (set Var "Added" 0)))) Mover)}) "AddOrPass" (then ("Score4" Mover)))) (end (if (all Passed) { (if (>= (score Mover) (score Next)) (result Mover Win))} (result Next Win))))) END
Modify the Ludii game according to the following option changes: The game is played on the Graph2. -> The game is played on the Graph3. (game "Nedilmarth" (players 2) (equipment { (board (graph vertices:{ {4 0} {12 0} {5 3} {8 4} {11 3} {4 6} {6 7} {8 6} {10 7} {12 6} {0 10} {3 9} {7 9} {9 9} {13 9} {16 10} {5 11} {11 11} {8 13} {8 16}} edges:{{0 1} {0 2} {0 10} {1 4} {1 15} {2 3} {2 5} {3 4} {3 7} {4 9} {5 6} {5 11} {10 11} {11 16} {6 12} {6 7} {7 8} {8 9} {9 14} {14 15} {8 13} {13 12} {12 16} {13 17} {14 17} {16 18} {18 17} {18 19} {10 19} {15 19}}) use:Edge) (piece "Marker" Neutral)}) (rules (start { (set Neutral Edge (sites Board Edge))}) (play (move Remove (sites Occupied by:Neutral on:Edge))) (end (if (is Tree Neutral) (result Mover Win))))) ###
(game "Nedilmarth" (players 2) (equipment { (board (dual (rotate 45 (square 7))) use:Edge) (piece "Marker" Neutral)}) (rules (start { (set Neutral Edge (sites Board Edge))}) (play (move Remove (sites Occupied by:Neutral on:Edge))) (end (if (is Tree Neutral) (result Mover Win))))) END
Construct a Ludii game based on the following description The board is a square, with the diagonals drawn. A circle is drawn around the midpoint of the top side of the square. Two pieces per player, the pieces for one player on the top corners and the other on the remaining corners. Players alternate turns moving along the lines on the board, the player on the top corners moving first, but can never move along the line with the circle. The player who blocks their opponent from being able to move wins. ###
(game "Oumoul Kono" (players 2) (equipment { (board (square 2 diagonals:Solid) use:Vertex) (piece "Disc" Each (move Step (to if:(and { (or { (and (!= (from) (coord "A3")) (!= (from) (coord "C3"))) (and (= (from) (coord "C3")) (!= (to) (coord "A3"))) (and (= (from) (coord "A3")) (!= (to) (coord "C3")))}) (is Empty (to))}))))}) (rules (start { (place "Disc1" (sites Bottom)) (place "Disc2" (sites Top))}) (play (forEach Piece)) (end ("NoMoves" Loss)))) END
Modify the Ludii game according to the following option changes: Order 2 board -> Order 4 board Square 2N grid w/even nodes, no center -> Square 2N grid w/even nodes, no center Highly tactical. Control a site with a surplus of 1 on lines of sight. -> Tactical. Control a site with a surplus of 2 on lines of sight. (define "ColourBackground" (colour 135 170 130)) (define "SquareDiagonal" (board (square 4) use:Vertex)) (define "SquareGrid" (board (square 4) use:Vertex)) (define "Hex2Limp" (board (dual (hex (/ 4 2) (+ 2 (/ 4 2)))) use:Vertex)) (define "BoardUsed" "SquareDiagonal") (define "LoSDirection" All) (define "MoveTwiceThenScore" (if (is Prev Next) (moveAgain) (and ("ScoreFor" Mover) ("ScoreFor" Next)))) (define "ScoreFor" (set Score #1 (+ (results from:(forEach (difference (difference (sites Board) (sites Occupied by:#1)) (sites Occupied by:Neutral)) if:("IsControlledBy" #1 (site))) to:(from) (if (is Empty (to)) 1 2))))) (define "IsControlledBy" (<= (+ 1 (count Pieces in:(sites Around (#2) "LoSDirection" if:(!= 0 (who at:(to)))))) (* 2 (count Pieces #1 in:(sites Around (#2) "LoSDirection"))))) (game "Dogtown Clans" (players 2) (equipment { "BoardUsed" (piece "Counter" P1) (piece "Counter" P2) (piece "X" Neutral) (piece "Counter" Neutral)}) (rules (meta (passEnd NoEnd)) (play (if (and (= -1 (var "DoubleTurnPhase")) (= 1 (mover))) (or (move Pass) (move Add (piece "X0") (to (sites Empty)) (then (if (> 2 (count Pieces in:(sites Occupied by:Neutral))) (moveAgain))))) (or { (move Add (to (sites Empty) if:(not ("IsControlledBy" Next (to)))) (then (if (= -1 (var "DoubleTurnPhase")) (set Var "DoubleTurnPhase" 1) ("MoveTwiceThenScore")))) (move Remove (forEach (sites Occupied by:Next) if:("IsControlledBy" Mover (site))) (then ("MoveTwiceThenScore")))}) (then (if (no Moves Next) (and ("ScoreFor" Mover) ("ScoreFor" Next)))))) (end (if (no Moves Mover) (result Mover Loss))))) ###
(define "ColourBackground" (colour 135 170 130)) (define "SquareDiagonal" (board (square 8) use:Vertex)) (define "SquareGrid" (board (square 8) use:Vertex)) (define "Hex2Limp" (board (dual (hex (/ 8 2) (+ 2 (/ 8 2)))) use:Vertex)) (define "BoardUsed" "SquareGrid") (define "LoSDirection" Orthogonal) (define "MoveTwiceThenScore" (if (is Prev Next) (moveAgain) (and ("ScoreFor" Mover) ("ScoreFor" Next)))) (define "ScoreFor" (set Score #1 (+ (results from:(forEach (difference (difference (sites Board) (sites Occupied by:#1)) (sites Occupied by:Neutral)) if:("IsControlledBy" #1 (site))) to:(from) (if (is Empty (to)) 1 2))))) (define "IsControlledBy" (<= (+ 2 (count Pieces in:(sites Around (#2) "LoSDirection" if:(!= 0 (who at:(to)))))) (* 2 (count Pieces #1 in:(sites Around (#2) "LoSDirection"))))) (game "Dogtown Clans" (players 2) (equipment { "BoardUsed" (piece "Counter" P1) (piece "Counter" P2) (piece "X" Neutral) (piece "Counter" Neutral)}) (rules (meta (passEnd NoEnd)) (play (if (and (= -1 (var "DoubleTurnPhase")) (= 1 (mover))) (or (move Pass) (move Add (piece "X0") (to (sites Empty)) (then (if (> 2 (count Pieces in:(sites Occupied by:Neutral))) (moveAgain))))) (or { (move Add (to (sites Empty) if:(not ("IsControlledBy" Next (to)))) (then (if (= -1 (var "DoubleTurnPhase")) (set Var "DoubleTurnPhase" 1) ("MoveTwiceThenScore")))) (move Remove (forEach (sites Occupied by:Next) if:("IsControlledBy" Mover (site))) (then ("MoveTwiceThenScore")))}) (then (if (no Moves Next) (and ("ScoreFor" Mover) ("ScoreFor" Next)))))) (end (if (no Moves Mover) (result Mover Loss))))) END
Construct a Ludii game based on the following description 5x5 board, played on intersections, with diagonals for each quadrant of the board. One player plays with two tiger pieces, placed on the midpoints of two opposite sides. The other player plays with nineteen goats, divided into three stacks of five and one stack of four, placed in the center of each quadrant. The goats move first. Goats may move one at a time to any adjacent vacant spot. More than one goat can be placed on the goats' starting spots, but not elsewhere. The tiger moves in the same manner, but also may capture a piece by hopping over it. Multiple captures can be made on the same turn with subsequent hops, but only the top goat in a stack is captured when a tiger leaps over it. The goal of the goats is to surround the tigers so they cannot move. The goal of the tigers is to capture all the goats. ###
(game "Sher Bakar" (players 2) (equipment { ("AlquerqueBoard" 5 5) (piece "Goat" P1 (move Step (to if:(or (and (is In (to) (sites "StartingSitesGoats")) ("IsFriendAt" (to))) (is Empty (to)))))) (piece "Tiger" P2 (or ("StepToEmpty") ("HopSequenceCapture"))) (regions "StartingSitesGoats" (sites {"B2" "D2" "D4" "B4"}))}) (rules (start { (place "Tiger2" (sites {"C1" "C5"})) (place Stack "Goat1" (sites {"B2" "D2" "D4"}) count:5) (place Stack "Goat1" (sites {"B4"}) count:4)}) (play (if ("SameTurn") (or (move Pass) ("HopSequenceCaptureAgain")) (forEach Piece top:True))) (end ("NoMovesP2NoPiecesP1")))) END
Construct a Ludii game based on the following description All rules are the same as regular Xiangqi. ###
(define "StepMoveOnThePalace" (move Step #1 (to if:(and (is In (to) (sites Mover "Palace")) (not ("IsFriendAt" (to)))) (apply (remove (to)))))) (define "JiangSameColumnWithNoPieceBetween" (if (= (column of:(where "Jiang" P1)) (column of:(where "Jiang" P2))) (not ("NoSites" (forEach (sites Direction from:(where "Jiang" P1) N stop:(= (to) (where "Jiang" P2))) if:(is Occupied (site))))) True)) (game "Xiang Hex" ("TwoPlayersNorthSouth") (equipment { (board (renumber Cell (rotate 90 (remove (hex Rectangle 9 11) cells:{0 1 11 21 63 74 85 84 94 93 83 73 31 20 9 10})))) (piece "Jiang" Each ("StepMoveOnThePalace" Orthogonal)) (piece "Shi" Each ("StepMoveOnThePalace" Diagonal)) (piece "Xiang" Each (move Slide Diagonal (between (exact 2) if:(and { (is In (between) (sites Mover "Home")) (is Empty (between))})) (to if:("IsEnemyAt" (to)) (apply (remove (to)))))) (piece "Ma" Each (forEach Direction Orthogonal (to if:(is Empty (to)) (apply (forEach Direction (from (to)) (directions {FR FL} of:All) (if (not ("IsFriendAt" (to))) (move (from) (to (apply if:("IsEnemyAt" (to)) (remove (to))))))))))) (piece "Ju" Each ("SlideCapture" Orthogonal)) (piece "Pao" Each (or (move Slide Orthogonal) (move Hop Orthogonal (between before:(count Rows) after:(count Rows) if:(is Occupied (between))) (to if:(is Empty (to)) (apply if:("IsEnemyAt" (to)) (remove (to))))))) (piece "Zu" Each ("StepToNotFriend" (if (is In (from) (sites Mover "Home")) Forward (union (directions {Forward FL FR}) (directions {W E}))))) (regions "PalaceP1" P1 { 0 1 2 4 7 8 12}) (regions "PalaceP2" P2 { 66 70 71 74 76 77 78}) (regions "Home" P1 (forEach (sites Board) if:(< (site) 37))) (regions "Home" P2 (forEach (sites Board) if:(> (site) 41)))}) (rules (start { (place "Jiang1" coord:"A1") (place "Shi1" {"A2" "B1"}) (place "Xiang1" {"A3" "C1"}) (place "Ma1" {"A4" "D1"}) (place "Ju1" {"A5" "E1"}) (place "Pao1" {"B5" "E2"}) (place "Zu1" {"B6" "C5" "D4" "E3" "F2"}) (place "Jiang2" coord:"K11") (place "Shi2" {"J11" "K10"}) (place "Xiang2" {"I11" "K9"}) (place "Ma2" {"H11" "K8"}) (place "Ju2" {"G11" "K7"}) (place "Pao2" {"G10" "J7"}) (place "Zu2" {"F10" "G9" "H8" "I7" "J6"})}) (play (do (forEach Piece) ifAfterwards:(and ("JiangSameColumnWithNoPieceBetween") (not ("IsInCheck" "Jiang" Mover))))) (end { ("Checkmate" "Jiang") ("BlockWin")}))) END
Construct a global Ludii definition which fulfills the following requirements. Defines a graphics turtle walk to get the locations where can move a Chess knight. ###
(define "KnightWalk" { {F F R F} {F F L F}}) END
Construct a Ludii game based on the following description Cross-shaped board made of five squares. The four squares of the arms have diagonals and lines connecting the midpoints of opposite sides. The central square has diagonals and a line connecting the central point with the midpoint of the lower side. One player plays with nineteen pieces, which begin on the uppermost nineteen points. The other player plays with two pieces, which begin on the central space and the one immediately below it. The player with two pieces goes first. Pieces move along the lines of the board to an empty adjacent spot. The player with two pieces may capture an adjacent opponent's piece by hopping over it to an empty spot immediately on the opposite side of it. The player with two pieces wins by capturing all of the opponent's pieces; the player with nineteen pieces wins by blocking the opponent from being able to move. ###
(game "Nuktagaq" (players 2) (equipment { (board (remove ("CrossGraph" 3 7 diagonals:Alternating) edges:{{17 10} {9 10} {10 11}}) use:Vertex) (hand P1) (piece "Marker" P1 (or ("HopCapture") "StepToEmpty")) (piece "Marker" P2 "StepToEmpty")}) (rules (start { (place "Marker2" (difference (expand (sites Top) steps:4) (union (sites Row 2) (sites Centre)))) (place "Marker1" (sites Direction from:(sites Centre) S included:True distance:1))}) (play (forEach Piece)) (end ("NoMovesLossAndNoPiecesPlayerLoss" P2)))) END
Construct a Ludii game based on the following description Tic-Tac-Mo uses the same rules as Tic-Tac-Toe, but the third player plays with a \ ###
(game "Tic-Tac-Mo" (players 3) (equipment { (board (rectangle 3 5)) (piece "Disc" P1) (piece "Cross" P2) (piece "Y" P3)}) (rules (play (move Add (to (sites Empty)))) (end ("Line3Win")))) END
Describe the mechanics of the following Ludii game (define "MoveTo" (move Hop #1 (between (exact (- #2 1)) if:(not ("IsEnemyAt" (between)))) (to if:(not ("IsFriendAt" (to))) (apply (if ("IsEnemyAt" (to)) (remove (to))))))) (define "DistInNWSE" (count Sites in:(difference (sites Direction from:(from) (directions {NW SE}) included:True) (sites Empty)))) (define "DistInNESW" (count Sites in:(difference (sites Direction from:(from) (directions {NE SW}) included:True) (sites Empty)))) (define "DistInRow" (count Sites in:(difference (sites Row (row of:(from))) (sites Empty)))) (define "DistInColumn" (count Sites in:(difference (sites Column (column of:(from))) (sites Empty)))) (game "Lines of Action" (players 2) (equipment { (board (square 8)) (piece "Disc" Each (or { ("MoveTo" (directions {N S}) "DistInColumn") ("MoveTo" (directions {W E}) "DistInRow") ("MoveTo" (directions {NE SW}) "DistInNESW") ("MoveTo" (directions {NW SE}) "DistInNWSE")}))}) (rules (start { (place "Disc1" (difference (union (sites Top) (sites Bottom)) (sites Corners))) (place "Disc2" (difference (union (sites Right) (sites Left)) (sites Corners)))}) (play (forEach Piece)) (end { (if (and (= 1 (count Groups if:(= (who at:(to)) P1))) (= 1 (count Groups if:(= (who at:(to)) P2)))) (result Mover Draw)) (if (= 1 (count Groups if:(= (who at:(to)) P1))) (result P1 Win)) (if (= 1 (count Groups if:(= (who at:(to)) P2))) (result P2 Win))}))) ###
A player wins by connecting all of one's pieces into a contiguous body so that they are connected orthogonally or diagonally. Players alternate moves. Pieces move orthogonally or diagonally. A piece moves exactly as many spaces as there are pieces (belonging to both the player and their opponent) on the line in which it is moving. A piece may jump over the player's own pieces, but not over one belonging to the opponent. A piece can capture piece belonging to the opponent by landing on it. If the two players make a group in the same turn, the game ends in a draw. END
Construct a Ludii game based on the following description To be reconstructed. The rules implemented here are suggested by Jenny Kile as follows: Besides being an 8x8 squared board, the board consists of certain marked spaces which denote safety, entry, or exit for players. The four corners, the four central squares, and two center squares on each side are crosscut, like shown. Two, three, or four people can play the game. If two players are playing, each would sit on one side of the board and enter their two pieces onto the center crosscut squares along the outer side The object of the game is to be the first player to enter and exit both his pieces. A player exits his piece once reaching the center squares. The version of the game played with 2 players. ###
(define "MoveToNextSiteOnTrack" ("NextSiteOnTrack" 1)) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" (mapEntry "DieValue" (count Pips)))) (game "Ashtapada" (players 2) (equipment { (board (square 8) { (track "Track1" "3,E,N,W,S,E1,N6,E5,S5,W4,N4,E3,S3,W1" 1 directed:True) (track "Track2" "60,W,S,E,N,W1,S6,W5,N5,E4,S4,W3,N3,E1" 2 directed:True) (track "Track3" "31,N,W,S,E,N1,W6,N5,E5,S4,W4,N3,E3,S1" 3 directed:True) (track "Track4" "32,S,E,N,W,S1,E6,S5,W5,N4,E4,S3,W3,N1" 4 directed:True)}) ("StickDice" 4) (hand Each) (map "DieValue" {(pair 4 8)}) (map "Entry" {(pair P1 "D1") (pair P2 "E8")}) (map "Exit" {(pair P1 "E3") (pair P2 "D6")}) (regions "Protect" (sites {"A1" "A4" "A5" "A8" "D1" "D4" "D5" "D8" "E1" "E4" "E5" "E8" "H1" "H4" "H5" "H8"})) (piece "Disc" Each (if ("IsNotOffBoard" "SiteToMoveOnTrack") (if (if (is In "SiteToMoveOnTrack" (sites "Protect")) (not ("IsEnemyAt" "SiteToMoveOnTrack")) True) (move (from) (to "SiteToMoveOnTrack" (apply if:("IsEnemyAt" (to)) (fromTo (from (to)) (to (handSite (who at:(to)))))))))))}) (rules (start { (place "Disc1" (handSite P1) count:2) (place "Disc2" (handSite P2) count:2)}) (play ("RollEachNewTurnMove" (if "SameTurn" (or (forEach Piece (if (= (from) (mapEntry "Exit" Mover)) (move Remove (from)) (if ("IsNotOffBoard" "MoveToNextSiteOnTrack") (if (if (is In "MoveToNextSiteOnTrack" (sites "Protect")) (not ("IsEnemyAt" "MoveToNextSiteOnTrack")) True) (move (from) (to "MoveToNextSiteOnTrack" ("HittingCapture" (handSite (who at:(to)))))))))) (if ("HandOccupied" Mover) (move (from (handSite Mover)) (to (mapEntry "Entry" Mover) if:(not ("IsEnemyAt" (to))))))) (if (can Move (forEach Piece)) (forEach Piece (then (if (= (count Pips) 3) (moveAgain)))) (move Pass (then (if (= (count Pips) 3) (moveAgain)))))))) (end ("EscapeWin")))) END
Construct a Ludii game based on the following description Played on a 12x12 board with 30 pieces per player, arranged on the dark squares. Pieces move diagonally one or can jump an opponent's adjacent player to capture it. Pieces can move forward or backwards. When a piece reaches the opposite edge of the board from its starting position, it becomes a king and can may move and jump over any number of spaces diagonally. Captures are compulsory and the maximum number of jumps must be made. Winning is achieved by capturing all the opponent's pieces or by blocking them from moving. The rules are the standard ones. ###
(define "ShouldCapturedButMoved" (and (is In (last From) ("SitesWithPossibleCaptureInPreviousTurn")) (is In (last From) (sites Empty)))) (define "HuffOnePieceOf" (move Select (from #1 if:(is Occupied (from))) (then (and { (remove (last To)) (moveAgain) (set Value Prev 0)})))) (define "SitesWithPossibleCaptureInPreviousTurn" (sites Pending)) (define "RememberSiteWithPossibleCapture" (set Pending (sites From ("MovesWithCapture")))) (define "DidNotCaptured" (= (value Player Prev) 1)) (define "HasNotCaptured" (set Value Mover 1)) (define "HasCaptured" (set Value Mover 0)) (define "PlayRulesHuff" (if (and ("SameTurn") (is Occupied (last To))) (if "IsUnpromoted" ("HopInternationalDraughtsStyle" (from (last To)) (then ("ReplayIfCanMove" ("HopInternationalDraughtsStyle" (from (last To))) ("PromoteIfReach" (sites Next) "DoubleCounter")))) ("HopDiagonalSequenceCaptureAgain" before:(count Rows) after:(count Rows) at:EndOfTurn) (then ("HasCaptured"))) (or { (or (forEach Piece "Counter" ("HopInternationalDraughtsStyle" (from) (then (and ("ReplayIfCanMove" ("HopInternationalDraughtsStyle" (from (last To))) ("PromoteIfReach" (sites Next) "DoubleCounter")) ("HasCaptured"))))) (forEach Piece "DoubleCounter" ("HopDiagonalSequenceCapture" before:(count Rows) after:(count Rows) at:EndOfTurn)) (then ("HasCaptured"))) (forEach Piece "Counter" ("StepToEmpty" (directions {FR FL})) (then (and ("PromoteIfReach" (sites Next) "DoubleCounter") ("HasNotCaptured")))) (forEach Piece "DoubleCounter" (move Slide Diagonal (then ("HasNotCaptured"))))}))) (define "MovesWithCapture" (if "SameTurn" (if "IsUnpromoted" (max Moves ("HopInternationalDraughtsStyle" (from (last To)) (then ("ReplayIfCanMove" ("HopInternationalDraughtsStyle" (from (last To))) ("PromoteIfReach" (sites Next) "DoubleCounter"))))) (max Moves ("HopDiagonalSequenceCaptureAgain" before:(count Rows) after:(count Rows) at:EndOfTurn))) (max Moves (or (forEach Piece "Counter" ("HopInternationalDraughtsStyle" (from) (then ("ReplayIfCanMove" ("HopInternationalDraughtsStyle" (from (last To))) ("PromoteIfReach" (sites Next) "DoubleCounter"))))) (forEach Piece "DoubleCounter" ("HopDiagonalSequenceCapture" before:(count Rows) after:(count Rows) at:EndOfTurn)))))) (define "PlayRules" (if "SameTurn" (if "IsUnpromoted" (max Moves ("HopInternationalDraughtsStyle" (from (last To)) (then ("ReplayIfCanMove" ("HopInternationalDraughtsStyle" (from (last To))) ("PromoteIfReach" (sites Next) "DoubleCounter"))))) (max Moves ("HopDiagonalSequenceCaptureAgain" before:(count Rows) after:(count Rows) at:EndOfTurn))) (priority { (max Moves (or (forEach Piece "Counter" ("HopInternationalDraughtsStyle" (from) (then ("ReplayIfCanMove" ("HopInternationalDraughtsStyle" (from (last To))) ("PromoteIfReach" (sites Next) "DoubleCounter"))))) (forEach Piece "DoubleCounter" ("HopDiagonalSequenceCapture" before:(count Rows) after:(count Rows) at:EndOfTurn)))) (or (forEach Piece "Counter" ("StepToEmpty" (directions {FR FL})) (then ("PromoteIfReach" (sites Next) "DoubleCounter"))) (forEach Piece "DoubleCounter" (move Slide Diagonal)))}))) (define "IsUnpromoted" ("IsPieceAt" "Counter" Mover (last To))) (game "Canadian Draughts" (players 2) ("DraughtsEquipment" (square 12)) (rules ("BlackCellsSetup" 5) (play ("PlayRules")) (end ("BlockWin")))) END
Construct a global Ludii definition which fulfills the following requirements. Defines a nine men's morris board. ###
(define "NineMensMorrisBoard" (board (concentric Square rings:3) use:Vertex)) END
Describe the mechanics of the following Ludii game (define "MoveGhoula" (if ("IsSingletonStack" (where "Ghoula" Neutral)) (move (from (where "Ghoula" Neutral) level:(where Level "Ghoula" Neutral at:(where "Ghoula" Neutral))) (to ("GhoulaOnTrack" "GhoulaTrack" 1))) (move (from (where "Ghoula" Neutral) level:(where Level "Ghoula" Neutral at:(where "Ghoula" Neutral))) (to ("GhoulaOnTrack" "ReverseGhoulaTrack" 1)) (then (if (= (last From) ("KillingSite")) (forEach Level (last From) FromTop (remove (last From) level:(level))) (forEach Level (last From) FromTop (fromTo (from (last From) level:(level)) (to (last To))))))) (then (if ("GhoulaPhaseDone") (set Var 0) (and (if (> (var) 1) (moveAgain)) (set Var (- (var) 1))))))) (define "GhoulaPhaseDone" (and ("IsSingletonStack" (where "Ghoula" Neutral)) (= ("EndTrack") (where "Ghoula" Neutral)))) (define "ActivePiece" (set State at:#1 level:#2 1)) (define "ActivatedPiece" (<= 1 (state at:#1 level:#2))) (define "Sig" (= ("ThrowValue") 1)) (define "IsSpecialThrow" (is In ("ThrowValue") (sites {1 6 4}))) (define "GhoulaOnTrack" ("NextSiteOnTrack" #2 from:(where "Ghoula" Neutral) #1)) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" #2 #1)) (define "BeginningExtensionTrack" 4) (define "EndTrack" 6) (define "Kaaba" 0) (define "KillingSite" 17) (define "ThrowValue" (mapEntry "Throw" (count Pips))) (define "ExternalSite" 20) (game "Sig wa Duqqan (Houmt al-Arbah)" (players 4) (equipment { (board (merge { (shift -4 0 (rectangle 1 4)) (square 4) (shift -4 3 (square 1))}) { (track "Track" "16,E,S1,W,S1,E,S1,W2" directed:True) (track "ExtensionTrack" "4,W" directed:True) (track "GhoulaTrack" "20,16,E,S1,W,S1,E,S1,W2" directed:True) (track "ReverseGhoulaTrack" "6,E,N1,W,N1,E,N1,W" directed:True)}) (piece "Ghoula" Neutral) (piece "Stick" Each (if (= (from) ("EndTrack")) (if (= (state at:(from) level:(level)) 8) (move (from (from) level:(level)) (to ("BeginningExtensionTrack"))) (if ("Sig") (move Select (from (from) level:(level)) (then (set State at:(last To) level:(last LevelTo) (+ 1 (state at:(last To) level:(last LevelTo)))))))) (if (is In (from) (sites Track "Track")) (move (from (from) level:(level) if:(if ("ActivatedPiece" (from) (level)) True ("Sig"))) (to ("SiteToMoveOnTrack" "Track" ("ThrowValue")) if:True) (then (if (not ("ActivatedPiece" (last To) (topLevel at:(last To)))) ("ActivePiece" (last To) (topLevel at:(last To)))))) (if (is In (from) (sites Track "ExtensionTrack")) (or { (if (and (!= (from) ("Kaaba")) ("Sig")) (move (from (from) level:(level)) (to ("SiteToMoveOnTrack" "ExtensionTrack" 1)))) (if (= (from) ("Kaaba")) (move Pass (then (and (if (= 0 ("ThrowValue")) (set Var 2) (set Var ("ThrowValue"))) (moveAgain)))) (if (= 3 ("ThrowValue")) (move Pass (then (and (set Var 3) (moveAgain))))))})))) maxState:8) ("StickDice" 4) (map "Throw" {(pair 0 4) (pair 1 3) (pair 2 0) (pair 3 1) (pair 4 6)})}) (rules (start { (place Stack "Ghoula0" ("ExternalSite")) (place Stack items:{"Stick4" "Stick3" "Stick2" "Stick1"} 16)}) (play (do (if (<= (var) 0) (roll)) next:(if (> (var) 0) ("MoveGhoula") (if (!= 0 ("ThrowValue")) (forEach Piece))) (then (if ("IsSpecialThrow") (moveAgain))))) (end { (forEach Player if:(no Pieces Player) (result Player Loss)) (forEach Player if:("GhoulaPhaseDone") (result Player Win))}))) ###
4x4 board, with an extension of four squares extending from the left of the bottom row. Two or more players, each with one piece. A piece of charcoal plays the part of the Ghoula. Four sticks, with one green side and one white side, used as dice. The throws are as follows: One white side up = 1, this throw is known as \ The game has 4 players. END
Construct a Ludii game based on the following description Players take turns placing two pieces of their colour on empty cells. White places only one stone on their first turn. A player wins by connecting all three board sides with a connected group of their pieces. Played on a size 13 board. The first player to connect all three sides wins. ###
(game "Master Y" (players 2) (equipment { (board (hex Triangle 13)) (piece "Disc")}) (rules phases:{ (phase "Opening" P1 (play (move Add (to (sites Empty)))) (nextPhase "Playing")) (phase "Playing" (play (move Add (to (sites Empty)) (then (if (= 0 (count MovesThisTurn)) (moveAgain))))))} (end (if (is Connected 3 Sides) (result Mover Win))))) END
Construct a global Ludii definition which fulfills the following requirements. Roll dice at each new turn before to compute the legal moves. ###
(define "RollEachNewTurnMove" (do (if ("NewTurn") (roll)) next:#1 #2)) END
Modify the Ludii game according to the following option changes: The game is played on a 6x6 board. -> The game is played on a 8x8 board. (game "Nei-Pat-Kono" (players 2) (equipment { (board (square 6) use:Vertex) (piece "Marker" Each (or ("StepOrthogonalToEmpty") (move Hop Orthogonal (between if:("IsFriendAt" (between))) (to if:("IsEnemyAt" (to))))))}) (rules (start { (place "Marker1" (expand (sites Bottom) steps:(- (/ (count Rows) 2) 1))) (place "Marker2" (expand (sites Top) steps:(- (/ (count Rows) 2) 1)))}) (play (forEach Piece)) (end (if (or (no Moves Next) (<= (count Pieces Next) 1)) (result Mover Win))))) ###
(game "Nei-Pat-Kono" (players 2) (equipment { (board (square 8) use:Vertex) (piece "Marker" Each (or ("StepOrthogonalToEmpty") (move Hop Orthogonal (between if:("IsFriendAt" (between))) (to if:("IsEnemyAt" (to))))))}) (rules (start { (place "Marker1" (expand (sites Bottom) steps:(- (/ (count Rows) 2) 1))) (place "Marker2" (expand (sites Top) steps:(- (/ (count Rows) 2) 1)))}) (play (forEach Piece)) (end (if (or (no Moves Next) (<= (count Pieces Next) 1)) (result Mover Win))))) END
Construct a Ludii game based on the following description Played on a board with two rows of five spaces forming an \ ###
(define "ReplaceStick" (move (from (handSite Mover)) (to (sites Empty)) (then (moveAgain)))) (define "LessThanFourSticksOnBoard" (< (count Sites in:(sites Occupied by:Mover container:"Board")) 4)) (define "HaveRemainingSticks" ("HandOccupied" Mover)) (game "Queah Game" (players 2) (equipment { (board (rotate 45 (merge (shift 1 -1 (rectangle 5 1)) (merge (shift -1 1 (rectangle 1 5)) (square 3))))) (piece "Stick" Each (or ("StepOrthogonalToEmpty") ("HopOrthogonalCapture"))) (hand Each)}) (rules (start { (place "Stick1" {"A1" "B2" "A3" "B4"}) (place "Stick2" {"E5" "D4" "E3" "D2"}) (place "Stick" "Hand" count:6)}) (play (if (and ("HaveRemainingSticks") ("LessThanFourSticksOnBoard")) ("ReplaceStick") (forEach Piece))) (end ("CaptureAll" Next)))) END
Construct a Ludii game based on the following description 2x8 and two stores. Five counters per hole. On each player's first move, they sow three counters into the first hole and two into the second hole. After this, sowing proceeds as usual, with one counter in each hole. Sowing may occur in either direction. When the final counter lands in an occupied hole, the contents of this hole are picked up and sowing continues in the opposite direction. When the final counter falls in an empty hole in the player's own row, the contents of the opposite hole are captured. If the final counter falls into the first of a series of empty holes, the contents of all of the holes opposite the empty holes are captured. It is necessary to enter the opponent's row first and return before making a capture.If the final counter lands in an empty hole in the opponent's row, the turn ends. The winner is the player who has captured the most counters. ###
(define "Capture" (if (and (= 1 (var "GoInOpponentRow")) (is In (to) (sites Mover))) (if (!= 0 (count at:("OppositePit" (to)))) (fromTo (from ("OppositePit" (to))) (to (mapEntry Mover)) count:(count at:("OppositePit" (to))) (then (if (and (is Empty ("NextHole" (last From) #1 1)) (is In ("NextHole" (last From) #1 1) (sites Mover))) (and (if (!= 0 (count at:("NextHole" (last From) #1 1))) (fromTo (from ("NextHole" (last From) #1 1)) (to (mapEntry Mover)) count:(count at:("NextHole" (last From) #1 1)))) (if (and (is Empty ("NextHole" (last From) #1 2)) (is In ("NextHole" (last From) #1 2) (sites Mover))) (and (if (!= 0 (count at:("NextHole" (last From) #1 2))) (fromTo (from ("NextHole" (last From) #1 2)) (to (mapEntry Mover)) count:(count at:("NextHole" (last From) #1 2)))) (if (and (is Empty ("NextHole" (last From) #1 3)) (is In ("NextHole" (last From) #1 3) (sites Mover))) (and (if (!= 0 (count at:("NextHole" (last From) #1 3))) (fromTo (from ("NextHole" (last From) #1 3)) (to (mapEntry Mover)) count:(count at:("NextHole" (last From) #1 3)))) (if (and (is Empty ("NextHole" (last From) #1 4)) (is In ("NextHole" (last From) #1 4) (sites Mover))) (and (if (!= 0 (count at:("NextHole" (last From) #1 4))) (fromTo (from ("NextHole" (last From) #1 4)) (to (mapEntry Mover)) count:(count at:("NextHole" (last From) #1 4)))) (if (and (is Empty ("NextHole" (last From) #1 5)) (is In ("NextHole" (last From) #1 5) (sites Mover))) (and (if (!= 0 (count at:("NextHole" (last From) #1 5))) (fromTo (from ("NextHole" (last From) #1 5)) (to (mapEntry Mover)) count:(count at:("NextHole" (last From) #1 5)))) (if (and (is Empty ("NextHole" (last From) #1 6)) (is In ("NextHole" (last From) #1 6) (sites Mover))) (and (if (!= 0 (count at:("NextHole" (last From) #1 6))) (fromTo (from ("NextHole" (last From) #1 6)) (to (mapEntry Mover)) count:(count at:("NextHole" (last From) #1 6)))) (if (and (is Empty ("NextHole" (last From) #1 7)) (is In ("NextHole" (last From) #1 7) (sites Mover))) (if (!= 0 (count at:("NextHole" (last From) #1 7))) (fromTo (from ("NextHole" (last From) #1 7)) (to (mapEntry Mover)) count:(count at:("NextHole" (last From) #1 7)))))))))))))))))))))) (define "NextHole" ("NextSiteOnTrack" #3 from:#1 #2)) (define "PiecesOwnedBy" (count at:(mapEntry #1))) (define "Columns" 8) (game "Uthi" (players 2) (equipment { (mancalaBoard 2 "Columns" { (track "TrackCW" "8,W,N,E" loop:True) (track "TrackCCW" "1,E,N,W" loop:True)}) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 FirstSite) (pair P2 LastSite)}) (piece "Seed" Shared)}) (rules (start (set Count 5 to:(sites Track))) phases:{ (phase "Opening" (play (or (move Select (from (sites Mover)) (then (and (fromTo (from (last To)) (to ("NextHole" (last To) "TrackCW" 1)) count:3) (fromTo (from (last To)) (to ("NextHole" (last To) "TrackCW" 2)) count:2)))) (move Select (from (sites Mover)) (then (and (fromTo (from (last To)) (to ("NextHole" (last To) "TrackCCW" 1)) count:3) (fromTo (from (last To)) (to ("NextHole" (last To) "TrackCCW" 2)) count:2)))))) (nextPhase Mover "Sowing")) (phase "Sowing" (play (or (if (!= (value Player Mover) 1) (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover)) if:(> (count at:(from)) 0)) (then (sow "TrackCW" apply:(if (> (count at:(to)) 1) (and { (moveAgain) (set Value Mover 1) (if (is In (to) (sites Next)) (set Var "GoInOpponentRow" 1))}) (and { (set Value Mover 0) (set Var "GoInOpponentRow" 0) ("Capture" "TrackCW")})))))) (if (!= (value Player Mover) 2) (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover)) if:(> (count at:(from)) 0)) (then (sow "TrackCCW" apply:(if (> (count at:(to)) 1) (and { (moveAgain) (set Value Mover 2) (if (is In (to) (sites Next)) (set Var "GoInOpponentRow" 1))}) (and { (set Value Mover 0) (set Var "GoInOpponentRow" 0) ("Capture" "TrackCCW")})))))))))} (end ("MancalaByScoreWhen" (no Moves Mover))))) END
Modify the Ludii game according to the following option changes: Played on a size 19 board. -> Played on a size 3 board. (game "Inkblots" (players 2) (equipment { (board (tri Hexagon 19)) (tile "Triangle" Each) (tile "Triangle" Neutral)}) (rules (meta (swap)) (start (place Random {"Triangle1" "Triangle2" "Triangle0"})) (play (move Add (to (sites Empty)) (then (add (piece (id "Triangle" Next)) (to (intersection (expand (sites Occupied by:Next) Orthogonal) (sites Empty))))))) (end (if (no Moves Next) (byScore { (score P1 (count Pieces P1)) (score P2 (count Pieces P2))}))))) ###
(game "Inkblots" (players 2) (equipment { (board (tri Hexagon 3)) (tile "Triangle" Each) (tile "Triangle" Neutral)}) (rules (meta (swap)) (start (place Random {"Triangle1" "Triangle2" "Triangle0"})) (play (move Add (to (sites Empty)) (then (add (piece (id "Triangle" Next)) (to (intersection (expand (sites Occupied by:Next) Orthogonal) (sites Empty))))))) (end (if (no Moves Next) (byScore { (score P1 (count Pieces P1)) (score P2 (count Pieces P2))}))))) END
Construct a Ludii game based on the following description 5x5 board; the central row and column being slightly wider than the others. Two to four players. Four pieces per player. Pieces begin on one of the central squares around the perimeter of the squares; if there are two players, they begin from opposite sides. Four cowrie shells are used as dice, with the count of the throw determined by the number of mouths which land face-up, with none facing up equaling 8. A throw of 4 gives the player another throw. Only the first throw matters for winning extra throws. Pieces move anti-clockwise from their origin point around the perimeter of the square, until they come to the final square before returning to the origin point. They then turn left and proceed around the inner perimeter of squares in a clockwise direction, until the space directly between the origin point and the central square, from which the pieces proceed to the center. When a piece overtakes a piece owned by the opponent, and the opponent's piece is not on one of the central squares of the perimeter, the opponent's pieces are sent back to the origin point, and the player is awarded an extra throw for each piece sent back. The first player to place their four pieces in the center wins. The game is played with 4 players. ###
(define "AllPiecesInCenter" ("AllOwnedPiecesIn" (sites {(centrePoint)}))) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" #2 #1)) (define "Throw4" (= ("ThrowValue") 4)) (define "ThrowValue" (mapEntry "Throw" (count Pips))) (game "Tamman" (players 4) (equipment { (board (merge { (add (merge { (square 2) (shift 4 0 (square 2)) (shift 0 4 (square 2)) (shift 4 4 (square 2))}) edges:{{2 9} {5 12} {8 15} {6 18} {8 20} {15 27} {17 29} {20 27} {23 30} {26 33} {7 19} {16 28}})}) { (track "Track1" "2,E,N,W,S,E1,N3,E2,S2,W1,N1" P1 directed:True) (track "Track2" "6,S,E,N,W,S1,E3,S2,W2,N1,E1" P2 directed:True) (track "Track3" "20,W,S,E,N,W1,S3,W2,N2,E1,S1" P3 directed:True) (track "Track4" "14,N,W,S,E,N1,W3,N2,E2,S1,W1" P4 directed:True)}) ("StickDice" 4) (piece "Marker" Each (move (from (from) level:(level)) (to ("SiteToMoveOnTrack" from:(from) ("ThrowValue")) if:True (apply (if (< 1 ("ThrowValue")) (forEach Site (sites Track Mover "Track" from:("SiteToMoveOnTrack" from:(from) 1) to:("SiteToMoveOnTrack" from:(from) (- ("ThrowValue") 1))) (if (not (is In (sites "SafeSites"))) (forEach Level (site) FromTop (if ("IsEnemyAt" (site) level:(level)) (fromTo (from (site) level:(level)) (to (mapEntry "Entry" (who at:(site) level:(level)))))))))))))) (regions "SafeSites" (sites {2 6 14 20})) (map "Throw" {(pair 0 8) (pair 1 1) (pair 2 2) (pair 3 3) (pair 4 4)}) (map "Entry" {(pair P1 2) (pair P2 6) (pair P3 20) (pair P4 14)})}) (rules (start { (place Stack "Marker1" 2 count:4) (place Stack "Marker2" 6 count:4) (place Stack "Marker3" 20 count:4) (place Stack "Marker4" 14 count:4)}) (play ("RollMove" (forEach Piece) (then (if (and ("Throw4") ("NewTurn")) (moveAgain))))) (end (if ("AllPiecesInCenter") (result Mover Win))))) END
Construct a Ludii game based on the following description Each player simultaneously bets on what the sum of all fingers shown will be. Each bet is added to a common pot. Then each player simultaneously reveals their hand, extending any number of fingers. Any player who successfully guesses the total number of fingers revealed by all players combined scores a point. The game is over when a player reaches a score of 3. The winning players share the pot. The game is played with 2 players. ###
(define "ShowHand" (move (from (sites Occupied by:#1)) (to (- (id #1) 1)) copy:True #1 (then (if (= "SumFingers" (amount #1)) (addScore #1 1)) applyAfterAllMoves:True))) (define "MaxFingers" (* 5 (count Players))) (define "SumFingers" (+ (state at:0) (state at:1))) (define "InitHand" (place #1 (handSite #2) state:0) (place #1 (handSite #2 1) state:1) (place #1 (handSite #2 2) state:2) (place #1 (handSite #2 3) state:3) (place #1 (handSite #2 4) state:4) (place #1 (handSite #2 5) state:5)) (game "Morra" (players 2) (mode Simultaneous) (equipment { (board (union (square 1) (shift 0 2 (square 1)))) (hand Each size:6) (hand Shared) (piece "Hand0" Each)}) (rules (start { ("InitHand" "Hand01" P1) ("InitHand" "Hand02" P2)}) phases:{ (phase "Bet" (play (or { (move Bet P1 (range 0 ("MaxFingers")) (then (set Pot (+ (pot) (amount P1))))) (move Bet P2 (range 0 ("MaxFingers")) (then (set Pot (+ (pot) (amount P2)))))})) (nextPhase "Hand")) (phase "Hand" (play (or { ("ShowHand" P1) ("ShowHand" P2)})) (nextPhase "Observe")) (phase "Observe" (play (move Pass (then (and { (remove 0) (remove 1)})))) (nextPhase "Bet"))} (end (if (or { (= (score P1) 3) (= (score P2) 3)}) (byScore))))) END
Construct a Ludii game based on the following description Players alternate turns placing pieces on one of the spaces. The first player to place four in a row without first making three in a row wins. The version of game with 2 players. The game is played on a 5x5 board. ###
(game "Yavalath" (players 2) (equipment { (board (rotate 90 (hex 5))) (piece "Marker" Each)}) (rules (meta (swap)) (play (move Add (to (sites Empty)))) (end { (if (is Line 4) (result Mover Win)) (if (is Line 3) (result Mover Loss))}))) END
Construct a Ludii game based on the following description An isosceles triangle, with the height of the triangle and two lines, which bisect the sides of the triangle, but intersect the height at the same point, roughly central, such that they are at an angle but do not bisect it. One player plays as the tiger, which begins at the apex of the triangle, the other as four goats, which begin on the central point. The goats play first, removing one of the pieces from the stack to an adjacent empty spot. The tiger moves along the lines to an empty adjacent spot. The goats also move in this way. Goats may only be stacked on the central point. The tiger may capture a goat by jumping over it, and a jump from one side of the triangle to the opposite side, over the central point, is allowed. The goats win by blocking the tiger from being able to move, the tiger wins by capturing one goat. ###
(game "Sher Bakr" (players 2) (equipment { (board (rotate 180 (add (remove (scale 1 2 (wedge 3)) vertices:{2}) vertices:{{2 1.333}} edges:{{4 6} {6 0} {1 6} {6 2}})) use:Vertex) (hand Each) (piece "Goat" P1 (move Step (to if:(or (is Empty (to)) (and (= (to) (centrePoint)) ("IsFriendAt" (to))))))) (piece "Tiger" P2 (or { ("StepToEmpty") ("HopCapture") (if (and {(= (from) 2) ("IsEnemyAt" (centrePoint)) (is Empty 1)}) (move (from 2) (to 1) (then (remove (centrePoint))))) (if (and {(= (from) 1) ("IsEnemyAt" (centrePoint)) (is Empty 2)}) (move (from 1) (to 2) (then (remove (centrePoint)))))}))}) (rules (start { (place Stack "Goat1" (centrePoint) count:4) (place Stack "Tiger2" 0)}) (play (forEach Piece top:True)) (end { (if (no Moves P2) (result P1 Win)) (if (= 3 (count Pieces P1)) (result P2 Win))}))) END
Construct a Ludii game based on the following description Played on an 8x8 board. 8 Bhata (or Padati; move like Chess pawns but without being able to move two on the first turn); 2 Ashva (horses; move like Chess knights); 2 Gaja (elephants; two spaces in any orthogonal direction, jumping over the first square); 2 Ratha (chariots; moves like a rook in chess); 1 Mantri (counselor; moves one square diagonally in any direction); 1 Raja (king; moves one square in any direction). These are set up along one edge of the board: Ratha-Ashva-Gaja-Mantri-Raja-Gaja-Ashva-Ratha, with the eight Bhata lined up in the row in front of these, as in chess. Players take turns moving. When one piece lands on the space occupied by another piece, it is captured. Play continues until one player's king cannot move without being captured. The elephants can jump only orthogonally. ###
(game "Chaturanga" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) ("ChessPawn" "Pawn" ~ (then ("ReplayInMovingOn" (sites Mover "Promotion")))) ("ChessRook" "Rook") ("ChessKing" "King_noCross") (piece "Elephant" Each (move Hop Orthogonal (between if:True) (to if:(not ("IsFriendAt" (to))) (apply (remove (to)))))) ("ChessKnight" "Knight") (piece "Ferz_noCross" Each ("StepToNotFriend" Diagonal)) (regions "Promotion" P1 (sites Top)) (regions "Promotion" P2 (sites Bottom))}) (rules (start { (place "Pawn1" (sites Row 1)) (place "Pawn2" (sites Row 6)) (place "Rook1" {"A1" "H1"}) (place "Knight1" {"B1" "G1"}) (place "Elephant1" {"C1" "F1"}) (place "Ferz_noCross1" coord:"D1") (place "King_noCross1" coord:"E1") (place "Rook2" {"A8" "H8"}) (place "Knight2" {"B8" "G8"}) (place "Elephant2" {"C8" "F8"}) (place "Ferz_noCross2" coord:"E8") (place "King_noCross2" coord:"D8")}) (play (if "SameTurn" (move Promote (last To) (piece "Ferz_noCross") Mover) (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King_noCross" Mover))))) (end { ("Checkmate" "King_noCross") ("MisereBlockWin") ("HavingLessPiecesLoss" Next 1)}))) END
Construct a global Ludii definition which fulfills the following requirements. Checks if a stack has a size of 1 at a site or if the site is empty. ###
(define "IsEmptyOrSingletonStack" (= (topLevel at:#1) 0)) END
Describe the mechanics of the following Ludii game (define "ReleaseCapturePiece" (forEach Site (forEach (sites Occupied by:Mover component:#1) if:(!= 0 (state at:(site)))) (move (from (site)) (to (sites #2) if:(is Empty (to))) (then (set State at:(last To) 0))))) (define "CapturePiece" (custodial (from (last To)) Orthogonal (between (max 1) if:("IsEnemyAt" (between)) (apply (set State at:(between) 1))) (to if:("IsFriendAt" (to))))) (define "AllPawnsInInnerRing" (all Sites (difference (sites Around (sites Centre)) (sites Centre)) if:("IsPieceAt" "Pawn" Mover (site)))) (define "CloserToCentre" (>= (count Steps Orthogonal (from) (centrePoint)) (count Steps Orthogonal (to) (centrePoint)))) (game "Agon" (players 2) (equipment { (board (hex 6)) (piece "Pawn" Each (move Step (to if:(and { (is Empty (to)) ("CloserToCentre") (!= (to) (centrePoint))})) (then ("CapturePiece")))) (piece "Queen" Each (move Step (to if:(and (is Empty (to)) ("CloserToCentre"))) (then ("CapturePiece"))))}) (rules (start { (place "Pawn1" (sites {89 60 20 3 6 51})) (place "Pawn2" (sites {87 84 39 1 30 70})) (place "Queen1" 85) (place "Queen2" 5)}) (play (priority { ("ReleaseCapturePiece" "Queen" Board) ("ReleaseCapturePiece" "Pawn" Outer) (do (forEach Piece) ifAfterwards:(not (can Move ("InterveneCapture" Orthogonal))))})) (end (if ("AllPawnsInInnerRing") { (if ("IsPieceAt" "Queen" Mover (centrePoint)) (result Mover Win)) (if (not ("IsPieceAt" "Queen" Mover (centrePoint))) (result Mover Loss))})))) ###
1. Agon is played on a hexagonal board made of 91 hexagonal playing spaces. Each concentric layer for hexagons is so coloured that it is easy to see a playing space's distance from the centre of the board. 2. The players each start with a queen and six guards. They are placed in a set configuration at the edge of the board, as shown again in the diagram. 3. In his turn a player moves a piece one space in any direction, except for any direction that leads away from the centre. 5. A piece may not land on or jump over another. 6. A piece may not move adjacent to two enemy pieces such that it is directly between them. 7. Only a queen may move to the central space. 8. If a piece becomes sandwiched between two enemies, it is captured. 9. If the queen is captured, then its owner must, on his next turn, remove the queen from her predicament and place her on any other space on the board. 10. Otherwise if one of his guards is captured, the player must remove the guard from his predicament, but the guard must be placed on a space at the edge of the board. 11. Only one captured piece may be so removed each turn; so a player may arrest his opponent's strategy for a number of turns if he makes multiple captures at once or in quick succession. 12. A player has won the game when his queen rests on the central space, and her six guards are on the six spaces adjacent to her. 13. A player has lost the game if his six guards are adjacent to the central space but his queen is not between them, as this configuration prevents either player from ever winning the game. END
Modify the Ludii game according to the following option changes: The game is played on a 9x9 board -> The game is played on a 13x13 board (define "CaptureSurroundedPiece" (enclose (from (last To)) Orthogonal (between if:("IsEnemyAt" (between)) (apply (and (addScore Mover 1) (remove (between))))))) (game "One-Eyed Go" (players 2) (equipment { (board (square 9) use:Vertex) (piece "Marker" Each)}) (rules (play (or (do (move Add (to (sites Empty))) ifAfterwards:("HasFreedom" Orthogonal) (then "CaptureSurroundedPiece")) (move Pass))) (end (if (all Passed) (byScore { (score P1 (+ (score P1) (size Territory P1))) (score P2 (+ (score P2) (size Territory P2)))}))))) ###
(define "CaptureSurroundedPiece" (enclose (from (last To)) Orthogonal (between if:("IsEnemyAt" (between)) (apply (and (addScore Mover 1) (remove (between))))))) (game "One-Eyed Go" (players 2) (equipment { (board (square 13) use:Vertex) (piece "Marker" Each)}) (rules (play (or (do (move Add (to (sites Empty))) ifAfterwards:("HasFreedom" Orthogonal) (then "CaptureSurroundedPiece")) (move Pass))) (end (if (all Passed) (byScore { (score P1 (+ (score P1) (size Territory P1))) (score P2 (+ (score P2) (size Territory P2)))}))))) END
Describe the mechanics of the following Ludii game (define "RemoveEnemyPiece" (if (can Move ("RemoveAnyEnemyPieceNotInLine3" Orthogonal)) ("RemoveAnyEnemyPieceNotInLine3" Orthogonal) ("RemoveAnyEnemyPiece"))) (game "Nine Men's Morris" (players 2) (equipment { ("NineMensMorrisBoard") (hand Each) (piece "Marker" Each ("StepToEmpty" ~ (then ("ReplayIfLine3" Orthogonal exact:True))))}) (rules (start (place "Marker" "Hand" count:9)) phases:{ (phase "Placement" (play (if "SameTurn" "RemoveEnemyPiece" (move (from (handSite Mover)) (to (sites Empty)) (then ("ReplayIfLine3" Orthogonal exact:True))))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) (phase "Movement" (play (if "SameTurn" "RemoveEnemyPiece" (if (> (count Pieces Mover) 3) (forEach Piece) (move (from (sites Occupied by:Mover)) (to (sites Empty)))))))} (end ("HavingLessPiecesLoss" Next 2)))) ###
Played on a board of three concentric squares, with a line bisecting the perimeters of each square on each side, but not extending inside the perimeter of the central square. Play occurs on the intersections of the lines and the corners of the squares. Each player has nine pieces. Play begins with each player placing pieces on empty points. If they make three in a row along the lines, they can remove one of the opponent's pieces. They cannot remove an opponent's piece that is in a three-in-a-row formation unless there are no other options. Once all pieces are placed, players take turns moving pieces one spot to an adjacent point along the lines. If a player makes three in a row, an opponent's piece is removed as in the first phase of the game. Once a player is reduced to three pieces, that player may move to any open space on the board. The game is won when the opponent is reduced to two pieces. END
Describe the mechanics of the following Ludii game (game "Main Tapak Empat" (players 2) (equipment { ("AlquerqueBoard" 5 5) (piece "Goat" P1 "StepToEmpty") (piece "Tiger" P2 (or "HopCapture" "StepToEmpty")) (hand P1)}) (rules (start { (place Stack "Tiger2" (centrePoint)) (place Stack "Goat1" (handSite P1) count:24)}) phases:{ (phase "Placement" P1 (play (move (from (handSite P1)) (to (sites Empty)))) (nextPhase ("HandEmpty" P1))) ("PhaseMovePiece" "Movement")} (end ("NoMovesP2NoPiecesP1")))) ###
5x5 intersecting lines, with diagonals in each 3x3 quadrant. One player plays with two tigers, which begin on the central spot. The other player plays as 24 goats. The goats play first, and may place a piece on any empty spot. The tigers move to an empty spot any distance along the lines on the board, or may hop over an adjacent goat to capture it, provided there is an empty spot immediately on the other side of the goat. Once all of the goats are placed, they may move along the lines to an empty adjacent spot. If the tigers cannot move, the goats win. The tigers win by capturing all the goats. END
Modify the Ludii game according to the following option changes: The game is played on the Graph1. -> The game is played on the Graph3. (game "Windir" (players 2) (equipment { (board (complete (subdivide (regular Star 4))) use:Edge) (piece "Marker" Neutral)}) (rules (play (move Add (piece "Marker0") (to Edge (sites Empty Edge)))) (end (if (is RegularGraph Neutral) (result Mover Loss))))) ###
(game "Windir" (players 2) (equipment { (board (complete (subdivide (regular Star 14))) use:Edge) (piece "Marker" Neutral)}) (rules (play (move Add (piece "Marker0") (to Edge (sites Empty Edge)))) (end (if (is RegularGraph Neutral) (result Mover Loss))))) END
Describe the mechanics of the following Ludii game (define "MoveOnlyIfAdjacentToEnemy" (move Step (to if:(and ("IsEmpty") (is Related Adjacent (from) (sites Occupied by:Next)))))) (define "MoveOnlyIfAdjacentToEnemyOrCentre" (move Step (to if:(and ("IsEmpty") (or (not "Centre") (is Related Adjacent (from) (sites Occupied by:Next))))))) (define "Centre" (= (to) (centrePoint))) (define "IsEmpty" (is Empty (to))) (game "Mu Torere" (players 2) (equipment { (board (concentric {1 8}) use:Vertex) (piece "Marker" Each ("MoveOnlyIfAdjacentToEnemyOrCentre"))}) (rules (start { (place "Marker1" {1..3 8}) (place "Marker2" {4..7})}) (play (forEach Piece)) (end ("NoMoves" Loss)))) ###
Play begins with the pieces on the kewai, each player on half of the circle. Players move by moving one piece to an empty adjacent space. Players can only move to the putahi when the piece being moved is next to an opponent's piece. The player that blocks the other from moving is the winner. The game is played on a wheel board. The game is played with all the rules END
Describe the mechanics of the following Ludii game (define "BigHole" 20) (define "CaptureEnemyPiece" (apply if:("IsEnemyAt" (to)) (remove (to)))) (define "EndSiteOfTrack" (if (= 0 (state at:(last To))) (trackSite EndSite Mover "TrackCW") (trackSite EndSite Mover "TrackCCW"))) (define "ChangeOfTrack" (if (= 0 (state at:(last To))) (set State at:(last To) 1) (set State at:(last To) 0))) (define "SiteToMoveOnTrack" (if (= 0 (state at:(from))) ("NextSiteOnTrack" ("ThrowValue") "TrackCW") ("NextSiteOnTrack" ("ThrowValue") "TrackCCW"))) (define "ThrowValue" (mapEntry "ThrowDiceValue" (count Pips))) (game "Mapuche Game" (players 2) (equipment { (board (remove (concentric {26}) vertices:{0..4}) { (track "TrackCW1" {0 2 4 6 8 10 12 14 16 18 20 19 17 15 13 11 9 7 5 3 1} P1 directed:True) (track "TrackCCW1" {1 3 5 7 9 11 13 15 17 19 20 18 16 14 12 10 8 6 4 2 0} P1 directed:True) (track "TrackCW2" {0 2 4 6 8 10 12 14 16 18 20 19 17 15 13 11 9 7 5 3 1} P2 directed:True) (track "TrackCCW2" {1 3 5 7 9 11 13 15 17 19 20 18 16 14 12 10 8 6 4 2 0} P2 directed:True)} use:Vertex) (regions "AllSitesExceptTop" (difference (sites Board) "BigHole")) (piece "Marker" Each (if ("IsNotOffBoard" "SiteToMoveOnTrack") (if (or (is In "SiteToMoveOnTrack" (sites Empty)) ("IsEnemyAt" "SiteToMoveOnTrack")) (move (from) (to "SiteToMoveOnTrack" "CaptureEnemyPiece"))))) ("StickDice" 4) (map "ThrowDiceValue" {(pair 0 4) (pair 1 0) (pair 2 2) (pair 3 0) (pair 4 3)}) (hand Each)}) (rules (start { (place "Marker1" (sites {0 2 4 6 8 10 12 14 16 18})) (place "Marker2" (sites {1 3 5 7 9 11 13 15 17 19}) state:1)}) (play ("RollMove" (if (can Move (if (!= ("ThrowValue") 0) (forEach Piece))) (forEach Piece (then (if (!= ("ThrowValue") 0) (moveAgain)))) (move Pass (then (if (!= ("ThrowValue") 0) (moveAgain))))) (then (and (if (and (is Occupied "BigHole") (!= "BigHole" (last To))) (remove "BigHole")) (if (= (last To) ("EndSiteOfTrack")) ("ChangeOfTrack")))))) (end { ("CaptureAll" P1) ("CaptureAll" P2)}))) ###
21 holes, arranged in an arc, the central hole larger than the others. Ten pieces per player, each player's pieces beginning on one side of the board, one in each hole. Four beans used as dice, with a black side and a white side. The throws are as follows: Four white sides up = 4; four black sides up = 3; two white/two black up = 2; three white or three black = player loses their turn. Players continue to throw until they lose their turn. If a piece lands in the central hole, and it cannot move from it on its next opportunity, it is removed from the game. Pieces moving into the opponent's side of the board capture any of the opponent's pieces which occupy a space on which they land. When a piece reaches the end of the track, they proceed back in the other direction. The player who captures all ten of the opponent's pieces wins. END
Construct a global Ludii definition which fulfills the following requirements. Defines two opposite table tracks and using hand sites. ###
(define "TableTracksOppositeWithHands" { (track "Track1" {24 0..11 23..12 #1} P1 directed:True) (track "Track2" {25 12..23 11..0 #1} P2 directed:True)}) END
Construct a Ludii game based on the following description Beirut chess follows all the rules and conventions of standard chess, with one difference: Before the game begins, each player secretly attaches a red dot to the bottom of one of their pieces (but not the king). This piece is called a bomb carrier. On any turn, instead of moving, a player may say \ ###
(define "InitialPawnMove" (if (is In (from) (sites Start (piece (what at:(from))))) ("DoubleStepForwardToEmpty" "SetEnPassantLocation"))) (define "EnPassant" (move Step (directions {FR FL}) (to if:"InLocationEnPassant") (then (remove (ahead (last To) Backward))))) (define "InLocationEnPassant" (and (is Pending) (= (to) (value Pending)))) (define "SetEnPassantLocation" (then (set Pending (ahead (last To) Backward)))) (define "Castling" (if (and ("HasNeverMoved" "King") (not ("IsInCheck" "King" Mover))) (or (if (and ("HasNeverMoved" "RookLeft") (can Move ("CastleRook" "RookLeft" E 3 (is Empty (to))))) "BigCastling") (if (and ("HasNeverMoved" "RookRight") (can Move ("CastleRook" "RookRight" W 2 (is Empty (to))))) "SmallCastling")))) (define "BigCastling" ("DecideToCastle" "King" W 2 "KingNotCheckedAndToEmpty" (then ("CastleRook" "RookLeft" E 3 True)))) (define "SmallCastling" ("DecideToCastle" "King" E 2 "KingNotCheckedAndToEmpty" (then ("CastleRook" "RookRight" W 2 True)))) (define "CastleRook" (slide (from (mapEntry #1 (mover))) #2 (between (exact #3) if:#4) (to if:True (apply ("PieceHasMoved" (from)))))) (define "DecideToCastle" (move Slide (from (mapEntry #1 (mover))) #2 (between (exact #3) if:#4) (to if:True (apply ("PieceHasMoved" (from)))) #5)) (define "KingNotCheckedAndToEmpty" (and (is Empty (to)) (not ("IsInCheck" "King" Mover at:(to))))) (define "RememberPieceHasMoved" (then (if (= (state at:(last To)) 1) ("PieceHasMoved" (last To))))) (define "PieceHasMoved" (set State at:#1 0)) (define "HasNeverMoved" (= (state at:(mapEntry #1 (mover))) 1)) (define "NextCanNotMove" (not (can Move (do (forEach Piece Next) ifAfterwards:(not ("IsInCheck" "King" Next)))))) (game "Beirut Chess" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) ("ChessPawn" "Pawn" (or "InitialPawnMove" "EnPassant") (then (and ("ReplayInMovingOn" (sites Mover "Promotion")) (set Counter)))) ("ChessRook" "Rook" (then (set Counter)) ("RememberPieceHasMoved")) ("ChessKing" "King" (then (set Counter)) ("RememberPieceHasMoved")) ("ChessBishop" "Bishop" (then (set Counter))) ("ChessKnight" "Knight" (then (set Counter))) ("ChessQueen" "Queen" (then (set Counter))) (map "King" {(pair 1 "E1") (pair 2 "E8")}) (map "RookLeft" {(pair 1 "A1") (pair 2 "A8")}) (map "RookRight" {(pair 1 "H1") (pair 2 "H8")}) (regions "Promotion" P1 (sites Top)) (regions "Promotion" P2 (sites Bottom))}) (rules (start { (place "Pawn1" (sites Row 1)) (place "Pawn2" (sites Row 6)) (place "Rook1" {"A1" "H1"} state:1) (place "Knight1" {"B1" "G1"}) (place "Bishop1" {"C1" "F1"}) (place "Queen1" coord:"D1") (place "King1" coord:"E1" state:1) (place "Rook2" {"A8" "H8"} state:1) (place "Knight2" {"B8" "G8"}) (place "Bishop2" {"C8" "F8"}) (place "Queen2" coord:"D8") (place "King2" coord:"E8" state:1)}) phases:{ (phase "Bomb" (play (forEach Site (sites Occupied by:Mover) (if (!= (what at:(site)) (id "King" Mover)) (move Select (from (site)) (then (and (set Value at:(last To) 1) (set Hidden Value at:(last To) to:Next))))))) (nextPhase Mover "Play")) (phase "Play" (play (if "SameTurn" (move Promote (last To) (piece {"Queen" "Knight" "Bishop" "Rook"}) Mover) (or (do (or (forEach Piece) ("Castling")) ifAfterwards:(not ("IsInCheck" "King" Mover))) (move Select (from (sites Occupied by:Mover) if:(= 1 (value Piece at:(from)))) (then (forEach Site (sites Around (last To) includeSelf:True) (if (is Occupied (site)) (remove (site))))))))))} (end { (if (or (and ("IsInCheck" "King" Next) ("NextCanNotMove")) ("IsOffBoard" (where "King" Next))) (result Mover Win)) (if ("IsOffBoard" (where "King" Mover)) (result Mover Loss)) (if (or (no Moves Mover) (= (counter) 99)) (result Mover Draw))}))) END
Construct a Ludii game based on the following description 8x8 checkered board. twelve pieces per player, placed on the first three rows closest to the players. Players alternate turns moving a piece forward diagonally to an empty space. Pieces may capture an opponent's piece by hopping over it to an empty adjacent space. Captures are compulsory, multiple captures are possible, the maximum capture possible is required, and failure to do so is penalized by the huff, where the piece that should have made the capture is itself captured. When a piece reaches the opposite edge of the board from where it started, it becomes a king. Kings may move any distance diagonally forward or backward, and may capture any number of opponent's pieces it leaps over. The player who captures all of the opponent's pieces wins. ###
(define "LastCapturingPiece" (value Player Mover)) (define "StoreCapturingPiece" (set Value Mover (last To))) (define "IsUnpromoted" ("IsPieceAt" "Counter" Mover (last To))) (define "RememberSiteWithPossibleCapture" (set Pending (sites From (max Moves (or (forEach Piece "Counter" ("HopCapture" (from) (directions {FR FL}) (then (if (is In (last To) (sites Next)) (and (promote (last To) (piece "DoubleCounter") Mover) ("ReplayIfCanMove" ("HopCaptureDistance" (from (last To)) Diagonal))) ("ReplayIfCanMove" ("HopCapture" (from (last To)) (directions {FR FL}))))))) (forEach Piece "DoubleCounter" ("HopCaptureDistance" (from) Diagonal ~ (then ("ReplayIfCanMove" ("HopCaptureDistance" (from (last To)) Diagonal)))))))))) (define "SitesWithPossibleCaptureInPreviousTurn" (sites Pending)) (game "Damas" ("TwoPlayersNorthSouth") ("DraughtsEquipment" (square 8)) (rules ("BlackCellsSetup" 3) (play (if ("SameTurn") (if "IsUnpromoted" (max Moves ("HopCapture" (from (last To)) (directions {FR FL}) (then (if (is In (last To) (sites Next)) (and (promote (last To) (piece "DoubleCounter") Mover) ("ReplayIfCanMove" ("HopCaptureDistance" (from (last To)) Diagonal))) ("ReplayIfCanMove" ("HopCapture" (from (last To)) (directions {FR FL}))))))) (max Moves ("HopCaptureDistance" (from (last To)) Diagonal ~ (then ("ReplayIfCanMove" ("HopCaptureDistance" (from (last To)) Diagonal)))))) (do ("RememberSiteWithPossibleCapture") next:(or { (forEach Piece "Counter" (max Moves ("HopCapture" (from) (directions {FR FL}) (then (and "StoreCapturingPiece" (if (is In (last To) (sites Next)) (and (promote (last To) (piece "DoubleCounter") Mover) ("ReplayIfCanMove" ("HopCaptureDistance" (from (last To)) Diagonal))) ("ReplayIfCanMove" ("HopCapture" (from (last To)) (directions {FR FL}))))))))) (forEach Piece "DoubleCounter" (max Moves ("HopCaptureDistance" (from) Diagonal ~ (then (and "StoreCapturingPiece" ("ReplayIfCanMove" ("HopCaptureDistance" (from (last To)) Diagonal))))))) (forEach Piece "Counter" ("StepToEmpty" (directions {FR FL}) (then ("PromoteIfReach" (sites Next) "DoubleCounter")))) (forEach Piece "DoubleCounter" (move Slide Diagonal))}) (then (and (if (and (!= ("LastCapturingPiece") (last To)) (not (is In (last To) ("SitesWithPossibleCaptureInPreviousTurn")))) (remove ("SitesWithPossibleCaptureInPreviousTurn"))) (if (and (!= ("LastCapturingPiece") (last To)) (is In (last From) ("SitesWithPossibleCaptureInPreviousTurn"))) (remove (last To)))))))) (end ("ForEachPlayerNoMovesLoss")))) END
Construct a global Ludii definition which fulfills the following requirements. Checks if the board is empty. This ludemeplex is not working for games involving stacks. ###
(define "NoPieceOnBoard" (all Sites (sites Board) if:(= 0 (count at:(site))))) END
Construct a Ludii game based on the following description 8x8 board, with markings in the four central squares, the four corner squares, and the two middle squares of each edge. The pieces have the following movement values: Raja (x1): moves one space in any direction; Mantri (x1): moves diagonally one space; Karabha (x2): jumps exactly two squares diagonally; Raji (x2): moves orthogonally one space and then diagonally another space, jumping over any intervening pieces; Kunjara (x2): moves orthogonally any distance; Patti (x8): move forward orthogonally one space, diagonally forward one space to capture. When a Patti reaches a marked space on the opposite edge of the board, it is promoted to Mantri if it is on a marked square. If it is on an unmarked square, the Patti must move back to the space from which it moved to the last row and is then promoted to Mantri. If the Raja can be taken on the opponent's next turn, it is in check. The Raja must not be in check at the end of the player's turn. If this is not possible, it is checkmate and the opponent wins.If a Raja is in stalemate, and no other pieces can move the player may remove one of the opponent's pieces causing the stalemate. If the opponent is reduced to only their Raja, it is also a victory, though considered a lesser one. Checking the opponent's Raja 64 consecutive times is a win. ###
(define "Move" (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King_noCross" Mover)) (then (if ("IsInCheck" "King_noCross" Next) (set Value Mover (+ 1 (value Player Mover))) (set Value Mover 0))))) (define "ElephantMove" (move Hop Diagonal (between if:True) (to if:(not ("IsFriendAt" (to))) (apply (if ("IsEnemyAt" (to)) (remove (to))))))) (define "NextCanNotMove" (not (can Move (do (forEach Piece Next) ifAfterwards:(not ("IsInCheck" "King_noCross" Next (forEach Piece))))))) (game "Krida Buddhibalasrita" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) ("ChessKing" "King_noCross") (piece "Ferz_noCross" Each ("StepToNotFriend" Diagonal)) ("ChessKnight" "Knight") (piece "Elephant" Each ("ElephantMove")) ("ChessRook" "Rook") ("ChessPawn" "Pawn" ~ (then (if (is In (last To) (sites Mover "Promotion")) (and (promote (last To) (piece "Ferz_noCross") Mover) (if (not (is In (last To) (sites "PromotionMarked"))) (fromTo (from (last To)) (to (last From)))))))) (regions "Promotion" P1 (sites Top)) (regions "Promotion" P2 (sites Bottom)) (regions "PromotionMarked" (sites {"A1" "D1" "E1" "H1" "A8" "D8" "E8" "H8"}))}) (rules (start { (place "Pawn1" (sites Row 1)) (place "Pawn2" (sites Row 6)) (place "Rook1" {"A1" "H1"}) (place "Knight1" {"B1" "G1"}) (place "Elephant1" {"C1" "F1"}) (place "Ferz_noCross1" coord:"D1") (place "King_noCross1" coord:"E1") (place "Rook2" {"A8" "H8"}) (place "Knight2" {"B8" "G8"}) (place "Elephant2" {"C8" "F8"}) (place "Ferz_noCross2" coord:"D8") (place "King_noCross2" coord:"E8")}) (play (if (can Move ("Move")) ("Move") (move Remove (difference (sites Occupied by:Next) (sites Occupied by:Next component:"King_noCross"))))) (end { (if (or (and ("IsInCheck" "King_noCross" Next) ("NextCanNotMove")) (= 1 (count Pieces Next))) (result Mover Win)) (if (= (value Player P1) 64) (result P1 Win)) (if (= (value Player P2) 64) (result P2 Win))}))) END
Construct a Ludii game based on the following description Play: Players take turns placing one stone of their color on any empty hex. Goal: When the board is full, the game is over and the player with the higher score is the winner. Scoring: Each stone is worth 1 point for its owner if it is part of a group connecting opposite sides of the board, and -1 point otherwise. The scoring trick that gave the game its name – namely that each stone is worth either +1 point or -1 point – was (unbeknownst to the inventor of Signum) discovered by Brian Wittmann (the inventor of Loops) 9 years earlier. The score is currently updated only when the board is full. (This makes the AI stronger.) A size 6 board is currently selected ###
(define "ScoreOf" (+ (results from:(sites Occupied by:#1) to:0 (if ("ConnectsAt" (from)) 1 -1)))) (define "UpdateScoreMover" (and (set Score Mover 0) (forEach Group Orthogonal if:(is Mover (who at:(to))) (if ("Connects" (sites)) (addScore Mover (count Sites in:(sites))) (addScore Mover (- (count Sites in:(sites)))))))) (define "LengthOfDiagonal" (* 2 (- 6 1))) (define "ConnectsSLOWER" (or { (is Connected {(sites Side N) #1 (sites Side S)}) (is Connected {(sites Side NW) #1 (sites Side SE)}) (is Connected {(sites Side NE) #1 (sites Side SW)})})) (define "Connects" (= (max (results from:(intersection #1 (sites Perimeter)) to:(intersection #1 (sites Perimeter)) (count Steps (from) (to)))) ("LengthOfDiagonal"))) (define "ConnectsAt" (or { (is Connected at:#1 {(sites Side N) (sites Side S)}) (is Connected at:#1 {(sites Side NW) (sites Side SE)}) (is Connected at:#1 {(sites Side NE) (sites Side SW)})})) (game "Signum" (players 2) (equipment { (board (hex 6)) (piece "Disc" Each)}) (rules (meta (swap)) (play (move Add (to (sites Empty)))) (end (if (is Full) (byScore { (score P1 ("ScoreOf" P1)) (score P2 ("ScoreOf" P2))}))))) END
Modify the Ludii game according to the following option changes: A size 3 board is currently selected -> A size 4 board is currently selected (define "CountAndMarkOddGroupsMover" (and (set Score Mover 0) (forEach Group Orthogonal if:(is Mover (who at:(to))) (if (is Odd (count Sites in:(sites))) (and (addScore Mover -1) (forEach Site (sites) (set State at:(site) 1))) (forEach Site (sites) (set State at:(site) 0)))))) (game "Mono" (players 2) (equipment { (board (hex 3)) (piece "Disc" Each)}) (rules (meta (swap)) (play (move Add (to (sites Empty)) (then ("CountAndMarkOddGroupsMover")))) (end (if (is Full) { (if (= (count Groups if:(= (id P1) (who at:(to)))) (count Groups if:(= (id P2) (who at:(to))))) (byScore)) (if True (byScore { (score P1 (- (count Groups if:(= (id P1) (who at:(to)))))) (score P2 (- (count Groups if:(= (id P2) (who at:(to))))))}))})))) ###
(define "CountAndMarkOddGroupsMover" (and (set Score Mover 0) (forEach Group Orthogonal if:(is Mover (who at:(to))) (if (is Odd (count Sites in:(sites))) (and (addScore Mover -1) (forEach Site (sites) (set State at:(site) 1))) (forEach Site (sites) (set State at:(site) 0)))))) (game "Mono" (players 2) (equipment { (board (hex 4)) (piece "Disc" Each)}) (rules (meta (swap)) (play (move Add (to (sites Empty)) (then ("CountAndMarkOddGroupsMover")))) (end (if (is Full) { (if (= (count Groups if:(= (id P1) (who at:(to)))) (count Groups if:(= (id P2) (who at:(to))))) (byScore)) (if True (byScore { (score P1 (- (count Groups if:(= (id P1) (who at:(to)))))) (score P2 (- (count Groups if:(= (id P2) (who at:(to))))))}))})))) END
Construct a Ludii game based on the following description Oriath has two versions: general and parameter-k. In both versions, the graph is initially uncoloured. Player alternate taking turns, in which the current player colours an uncoloured edge. In the general version, the last player to make a move such that the coloured graph becomes a regular graph wins. For the parameter-k version, the game is won by the last player to make a move such that the coloured graph is a k-regular graph. The game is played on the Graph1. General version ###
(game "Oriath" (players 1) (equipment { (board (complete (regular Star 7)) use:Edge)}) (rules (play (move Add (to Edge (sites Empty Edge)))) (end { (if (is RegularGraph Mover) (result Mover Win))}))) END
Construct a Ludii game based on the following description The player aims to make a Hamiltonian cycle, which is a path in which each vertex is visited once, no edge is visited twice, and the ending point is the same as the starting point. ###
(define "HamiltonianCycle" (is Path Edge Mover length:(exact (count Sites "Board")) closed:True)) (define "IncressPath" (is Path Edge Mover length:(exact (count Moves)))) (game "Icosian" (players 1) (equipment { (board (graph vertices:{ {4 0} {12 0} {5 3} {8 4} {11 3} {4 6} {6 7} {8 6} {10 7} {12 6} {0 10} {3 9} {7 9} {9 9} {13 9} {16 10} {5 11} {11 11} {8 13} {8 16}} edges:{ {0 1} {0 2} {0 10} {1 4} {1 15} {2 3} {2 5} {3 4} {3 7} {4 9} {5 6} {5 11} {10 11} {11 16} {6 12} {6 7} {7 8} {8 9} {9 14} {14 15} {8 13} {13 12} {12 16} {13 17} {14 17} {16 18} {18 17} {18 19} {10 19} {15 19}}) use:Vertex)}) (rules phases:{ (phase "Init" P1 (play (move Add (to Edge (sites Empty Edge)))) (nextPhase "PathMaking")) (phase "PathMaking" P1 (play (or (do (move Add (to Edge (sites Empty Edge))) ifAfterwards:"IncressPath") (do (move Add (to Edge (sites Empty Edge))) ifAfterwards:"HamiltonianCycle"))))} (end (if (>= (count Moves) (count Sites "Board")) (result Mover Win))))) END
Construct a global Ludii definition which fulfills the following requirements. Checks if P1 has no moves and P2 wins and checks if P2 has no pieces and P1 wins. This ludemeplex can be used only in an ending condition. ###
(define "NoMovesP1NoPiecesP2" { (if (no Moves P1) (result P2 Win)) (if (no Pieces P2) (result P1 Win))}) END
Describe the mechanics of the following Ludii game (define "Cardinal" (move (from if:(= (* (from) (if (< 0 (count MovesThisTurn)) 1 0)) (* (last To) (if (< 0 (count MovesThisTurn)) 1 0)))) (to (sites Direction from:(from) #1 stop:(is Occupied (to)) stopIncluded:True) if:(= (next) (who at:(to))) (apply (remove (to)))) #2)) (define "SouthWest" (move (from if:(= (* (from) (if (< 0 (count MovesThisTurn)) 1 0)) (* (last To) (if (< 0 (count MovesThisTurn)) 1 0)))) (to ("Reachable" S W) #1 (apply (remove (to)))) #2)) (define "NorthWest" (move (from if:(= (* (from) (if (< 0 (count MovesThisTurn)) 1 0)) (* (last To) (if (< 0 (count MovesThisTurn)) 1 0)))) (to ("Reachable" N W) #1 (apply (remove (to)))) #2)) (define "SouthEast" (move (from if:(= (* (from) (if (< 0 (count MovesThisTurn)) 1 0)) (* (last To) (if (< 0 (count MovesThisTurn)) 1 0)))) (to ("Reachable" S E) #1 (apply (remove (to)))) #2)) (define "NorthEast" (move (from if:(= (* (from) (if (< 0 (count MovesThisTurn)) 1 0)) (* (last To) (if (< 0 (count MovesThisTurn)) 1 0)))) (to ("Reachable" N E) #1 (apply (remove (to)))) #2)) (define "Reachable" (intersection (sites Occupied by:Enemy) (union (expand (union (sites {(from)}) (sites Distance (step (directions {#1 #2}) (to if:(is Empty (to)))) from:(from) (range 1 Infinity))) #1) (expand (union (sites {(from)}) (sites Distance (step (directions {#1 #2}) (to if:(is Empty (to)))) from:(from) (range 1 Infinity))) #2)))) (define "SouthOf" (< (row of:#1) (row of:#2))) (define "NorthOf" (> (row of:#1) (row of:#2))) (define "WestOf" (< (column of:#1) (column of:#2))) (define "EastOf" (> (column of:#1) (column of:#2))) (define "ReachableCardinalFrom" (intersection (sites Occupied by:Enemy) (sites Direction from:#1 #2 stop:(is Occupied (to)) stopIncluded:True))) (define "ReachableFrom" (intersection (sites Occupied by:Enemy) (union (expand (union (sites {#1}) (sites Distance (step (directions {#2 #3}) (to if:(is Empty (to)))) from:#1 (range 1 Infinity))) #2) (expand (union (sites {#1}) (sites Distance (step (directions {#2 #3}) (to if:(is Empty (to)))) from:#1 (range 1 Infinity))) #3)))) (define "NextEnemies" (if (= 1 (var)) ("ReachableCardinalFrom" (last To) N) (if (= 2 (var)) ("ReachableCardinalFrom" (last To) E) (if (= 3 (var)) ("ReachableCardinalFrom" (last To) S) (if (= 4 (var)) ("ReachableCardinalFrom" (last To) W) (if (= 5 (var)) ("ReachableFrom" (last To) N E) (if (= 6 (var)) ("ReachableFrom" (last To) S E) (if (= 7 (var)) ("ReachableFrom" (last To) N W) ("ReachableFrom" (last To) S W))))))))) (define "Continue" (if (= 1 (var)) ("Cardinal" N ~) (if (= 2 (var)) ("Cardinal" E ~) (if (= 3 (var)) ("Cardinal" S ~) (if (= 4 (var)) ("Cardinal" W ~) (if (= 5 (var)) ("NorthEast" ~ ~) (if (= 6 (var)) ("SouthEast" ~ ~) (if (= 7 (var)) ("NorthWest" ~ ~) ("SouthWest" ~ ~))))))))) (game "Sweep Burrow" (players 2) (equipment { (board (square 8)) (piece "Disc" Each (if (= 0 (count MovesThisTurn)) (or { ("Cardinal" N (then (set Var 1))) ("Cardinal" E (then (set Var 2))) ("Cardinal" S (then (set Var 3))) ("Cardinal" W (then (set Var 4))) ("NorthEast" if:(and ("NorthOf" (to) (from)) ("EastOf" (to) (from))) (then (set Var 5))) ("SouthEast" if:(and ("SouthOf" (to) (from)) ("EastOf" (to) (from))) (then (set Var 6))) ("NorthWest" if:(and ("NorthOf" (to) (from)) ("WestOf" (to) (from))) (then (set Var 7))) ("SouthWest" if:(and ("SouthOf" (to) (from)) ("WestOf" (to) (from))) (then (set Var 8)))}) ("Continue") (then (if (< 0 (count Sites in:("NextEnemies"))) (moveAgain)))))}) (rules (start { (place "Disc1" (forEach (sites Board) if:(or (and (is Even (row of:(site))) (> 2 (% (site) 4))) (and (is Odd (row of:(site))) (< 1 (% (site) 4)))))) (place "Disc2" (forEach (sites Board) if:(or (and (is Odd (row of:(site))) (> 2 (% (site) 4))) (and (is Even (row of:(site))) (< 1 (% (site) 4))))))}) (play (forEach Piece)) (end ("CaptureAll" Next)))) ###
By far the easiest of the variants so far, Sweep Burrow's template is simply the two orthogonal directions involved in making the initial capture. The only further convention here is that if the capture was made with just movement in one direction, you cannot employ a second direction. The player may not end his turn until the capturing piece have no further captures available. END
Modify the Ludii game according to the following option changes: The version of the game played with 3 players. -> The version of the game played with 4 players. (game "Onek Rong" (players 3) (equipment { (board (subdivide (hex 2)) use:Vertex) (piece "Marker" Each)}) (rules (start { (set Cost 1 Vertex at:0) (set Cost 2 Vertex at:1) (set Cost 3 Vertex at:2) (set Cost 1 Vertex at:3) (set Cost 2 Vertex at:4) (set Cost 3 Vertex at:5) (set Cost 1 Vertex at:6) (set Cost 2 Vertex at:7) (set Cost 3 Vertex at:8) (set Cost 3 Vertex at:9) (set Cost 1 Vertex at:10) (set Cost 2 Vertex at:11) (set Cost 3 Vertex at:12) (set Cost 1 Vertex at:13) (set Cost 2 Vertex at:14) (set Cost 3 Vertex at:15) (set Cost 1 Vertex at:16) (set Cost 2 Vertex at:17) (set Cost 3 Vertex at:18) (set Cost 3 Vertex at:19) (set Cost 1 Vertex at:20) (set Cost 2 Vertex at:21) (set Cost 3 Vertex at:22) (set Cost 1 Vertex at:23)}) (play (or (move Claim (to (sites Empty)) (then (if (= 1 (size Group at:(last To))) (addScore Mover (cost Vertex at:(last To)))))) (move Pass))) (end (if (or (= (count Sites in:(sites Empty)) 0) (all Passed)) (byScore))))) ###
(game "Onek Rong" (players 4) (equipment { (board (subdivide (hex 2)) use:Vertex) (piece "Marker" Each)}) (rules (start { (set Cost 1 Vertex at:0) (set Cost 2 Vertex at:1) (set Cost 3 Vertex at:2) (set Cost 1 Vertex at:3) (set Cost 2 Vertex at:4) (set Cost 3 Vertex at:5) (set Cost 1 Vertex at:6) (set Cost 2 Vertex at:7) (set Cost 3 Vertex at:8) (set Cost 3 Vertex at:9) (set Cost 1 Vertex at:10) (set Cost 2 Vertex at:11) (set Cost 3 Vertex at:12) (set Cost 1 Vertex at:13) (set Cost 2 Vertex at:14) (set Cost 3 Vertex at:15) (set Cost 1 Vertex at:16) (set Cost 2 Vertex at:17) (set Cost 3 Vertex at:18) (set Cost 3 Vertex at:19) (set Cost 1 Vertex at:20) (set Cost 2 Vertex at:21) (set Cost 3 Vertex at:22) (set Cost 1 Vertex at:23)}) (play (or (move Claim (to (sites Empty)) (then (if (= 1 (size Group at:(last To))) (addScore Mover (cost Vertex at:(last To)))))) (move Pass))) (end (if (or (= (count Sites in:(sites Empty)) 0) (all Passed)) (byScore))))) END
Construct a global Ludii definition which fulfills the following requirements. Defines backgammon tracks following the same direction for each player but starting from opposite corners. ###
(define "BackgammonTracksSameDirectionOppositeCorners" { (track "Track1" {0..5 7..12 25..20 18..13 #1} P1 directed:True) (track "Track2" {25..20 18..13 0..5 7..12 #1} P2 directed:True)}) END
Construct a Ludii game based on the following description 2x6 board. Four counters in each hole. A player picks up all of the counters in one of the holes in their row and sows them one-by-one in a counterclockwise direction in consecutive holes from the hole the pieces originated. The starting hole is always left empty, even if a player sows in a complete circuit of the board, the original house is skipped and sowing continues in the next hole after it. When the final counter falls into an occupied hole, these are picked up and sowing continues. When the final counter of a sowing lands on in an empty hole in the player's own row, the contents of the hole in the opponent's row opposite it are captured. If the opponent's holes are all empty, the other player must make a move placing counters in the opponent's row. If not possible, the player captures all the counters in their row. The player who has captured the most counters wins. If the game continues in a repeating loop, the players can agree to end the game and capture the counters remaining in their row. ###
(define "CaptureAsInOware" (and (is In #1 (sites Next)) (or (= (count at:#1) 2) (= (count at:#1) 3)))) (define "PiecesOwnedBy" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (define "Columns" 6) (game "Yovodji" (players 2) (equipment { (mancalaBoard 2 "Columns" store:None (track "Track" "0,E,N,W" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece "Seed" Shared) (hand Each)}) (rules (start (set Count 4 to:(sites Track))) (play (if (is Proposed "End") (or (move Vote "End") (move Vote "No")) (or (if (is Cycle) (move Propose "End")) (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover)) if:(< 0 (count at:(from)))) (then (sow apply:(if ("CaptureAsInOware" (to)) (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))) (if (< 1 (count at:(to))) (moveAgain) (if (and (is In (to) (sites Mover)) (< 1 (count at:("OppositePit" (to))))) (fromTo (from ("OppositePit" (to))) (to (handSite Mover)) count:(count at:("OppositePit" (to))))))) includeSelf:False backtracking:("CaptureAsInOware" (from)))))))) (end ("MancalaByScoreWhen" (or (no Moves Mover) (is Decided "End")))))) END
What does the following global Ludii definition do? (define "ThreeMensMorrisGraphWithLeftAndRightTriangles" (merge { (rectangle 3 3 diagonals:Alternating) (shift 1.5 0.5 (rotate -90 (wedge 2))) (shift -1.5 0.5 (rotate 90 (wedge 2)))})) ###
Defines a Three Men's Morris graph with two triangle extensions at the left and right. END
Construct a Ludii game based on the following description 2x12 board, with spaces as points, divided in two. Fifteen pieces per player, which start stacked, two on the players' first three points and three in the next three points. Two six-sided dice. Players unstack the pieces by moving pieces off of the stack, but remaining on the same point, according to the throws of the dice. The value of the throw indicates the number of the point which can be unstacked. For example, a throw of 1 and 4 allows the player to unstack the pieces on points 1 and 4. When all of a player's pieces are unstacked, they must be restacked, in the same way. When they have been successfully restacked, the player then bears off the pieces from this quadrant of the board. When bearing off, players move according to the number on each die by moving one piece the value on one die then another piece the value on the other die, or by moving one piece the value of one die and then the value of the other. The first player to bear off all their pieces wins. ###
(define "Stack" (forEach Level (last To) (set State at:(last To) level:(level) 0))) (define "UnstackHalf" (forEach Level (last To) (set State at:(last To) level:(level) 1))) (define "UnstackFull" (forEach Level (last To) (set State at:(last To) level:(level) 2))) (define "PieceStacked" (or ("PieceFullStacked" #1) ("PieceHalfStacked" #1))) (define "PieceHalfStacked" (= (state at:#1) 1)) (define "PieceFullStacked" (= (state at:#1) 0)) (define "PieceUnstacked" (= (state at:#1) 2)) (define "RemoveAPiece" (move Remove (from))) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" (pips))) (define "SiteToSelect" ("NextSiteOnTrack" (- (pips) 1) from:(mapEntry "StartTrack" (mover)))) (game "Yahoudieh" (players 2) (equipment { ("BackgammonBoard" { (track "Track1" {7..12} P1 directed:True) (track "Track2" {18..13} P2 directed:True)}) (dice d:6 num:2) (piece "Disc" Each (forEach Die if:("DieNotUsed") (if ("IsOffBoard" "SiteToMoveOnTrack") "RemoveAPiece" (move (from) (to "SiteToMoveOnTrack"))))) (map "StartTrack" {(pair P1 7) (pair P2 18)})}) (rules (start { (place Stack "Disc1" (sites {7..9}) count:2) (place Stack "Disc1" (sites {10..12}) count:3) (place Stack "Disc2" (sites {13..15}) count:3) (place Stack "Disc2" (sites {16..18}) count:2)}) phases:{ (phase "UnStacking" (play ("RollEachNewTurnMove" (forEach Die if:("DieNotUsed") (or (if ("PieceFullStacked" "SiteToSelect") (move Select (from ("SiteToSelect")) (then (and (if (= 3 (size Stack at:(last To))) ("UnstackHalf") ("UnstackFull")) ("ReplayNotAllDiceUsed"))))) (if ("PieceHalfStacked" "SiteToSelect") (move Select (from ("SiteToSelect")) (then (and ("UnstackFull") ("ReplayNotAllDiceUsed"))))))))) (nextPhase Mover (all Sites (sites Occupied by:Mover) if:(not ("PieceStacked" (site)))) "Stacking")) (phase "Stacking" (play ("RollEachNewTurnMove" (forEach Die if:("DieNotUsed") (or (if ("PieceUnstacked" "SiteToSelect") (move Select (from ("SiteToSelect")) (then (and { (if (= 3 (size Stack at:(last To))) ("UnstackHalf") ("Stack")) ("ReplayNotAllDiceUsed")})))) (if ("PieceHalfStacked" "SiteToSelect") (move Select (from ("SiteToSelect")) (then (and ("Stack") ("ReplayNotAllDiceUsed"))))))))) (nextPhase Mover (all Sites (sites Occupied by:Mover) if:(not ("PieceUnstacked" (site)))) "BearingOff")) (phase "BearingOff" (play (do (if (or (all DiceEqual) ("NewTurn")) (roll)) next:(forEach Piece top:True) (then ("ReplayNotAllDiceUsed")))) (end ("EscapeWin")))})) END
Construct a Ludii game based on the following description 2x7 board. Seven counters in each hole. Sowing occurs in an anti-clockwise direction. When the final counter falls into an occupied hole, the contents of that hole are picked up and sowing continues. If the final counter falls into a hole containing one or three counters, the player captures those counters, plus any counters in the hole in the opposite row, as well as the contents of any holes in an unbroken sequence following the one in which the final counter which also contain two or four counters.When the final counter falls into an empty hole, the turn ends. Play continues until all of the pieces are captured. The player who captured the most counters wins. ###
(define "PiecesOwnedBy" (+ (count in:(sites Mover)) (count Cell at:(handSite #1)))) (define "NoPieceOnBoard" (>= 1 (count Pieces All in:(sites Board)))) (define "Columns" 7) (game "La'b Akila" (players 2) (equipment { (mancalaBoard 2 "Columns" store:None (track "TrackCCW" "0,E,N,W" loop:True)) (piece "Seed" Shared) (hand Each) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start (set Count 7 to:(sites Track))) (play (move Select (from (sites Mover) if:(is Occupied (from))) (then (sow if:True apply:(if (or (= 2 (count at:(to))) (= 4 (count at:(to)))) (and (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))) (if (!= 0 (count at:("OppositePitTwoRows" (to)))) (fromTo (from ("OppositePitTwoRows" (to))) (to (handSite Mover)) count:(count at:("OppositePitTwoRows" (to))))))) backtracking:(or (= 2 (count at:(to))) (= 4 (count at:(to)))))))) (end ("MancalaByScoreWhen" ("NoPieceOnBoard"))))) END
Construct a Ludii game based on the following description Two rows of ten holes Four counters in each hole First play must be from the rightmost hole. The player has to open the game with one of the four rightmost holes. ###
(define "PiecesOwnedBy" (+ (count Cell at:(handSite #1)) (count in:(sites #1 "Home")))) (define "Sow" (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover #1)) if:(> (count at:(from)) 0)) (then (sow apply:(if (and { (is In (to) (sites Mover "Home")) (= (count at:(to)) 1) (> (count at:("OppositePit" (to))) 0)}) (and (fromTo (from ("OppositePit" (to))) (to (handSite Mover)) count:(count at:("OppositePit" (to)))) (fromTo (from (to)) (to (handSite Mover)) count:1)) (if (> (count at:(to)) 1) (moveAgain))))))) (define "Columns" 10) (game "Dabuda" (players 2) (equipment { (mancalaBoard 2 "Columns" store:None (track "Track" "0,E,N,W" loop:True)) (regions "Home" P1 (sites Bottom)) (regions "Home" P2 (sites Top)) (regions "RightMost" P1 (sites {6..9})) (regions "RightMost" P2 (sites {10..13})) (piece "Seed" Shared) (hand Each)}) (rules (start (set Count 4 to:(sites Track))) phases:{ (phase "Rightmost" (play ("Sow" "RightMost")) (nextPhase (= (count Turns) 2) "HomePhase")) (phase "HomePhase" (play ("Sow" "Home")))} (end ("MancalaByScoreWhen" (no Moves Mover))))) END
Construct a Ludii game based on the following description Three concentric squares with lines connecting the midpoints of the squares. Nine pieces per player. Players alternate turns placing one of their pieces on an empty space. If a player places three of their pieces along one of the straight lines, they take another turn. Once all of the pieces are on the board, players take turns moving a piece to an empty space on the board. When a player creates a line of three in this phase, the player removes one of the opponent's pieces, and receives another turn. The player who reduces the opponent to two pieces wins. ###
(define "IfLine3MoveAgainPlacement" (then (if (and (is Line 3) ("HandOccupied" Mover)) (moveAgain)))) (game "Nerenchi Keliya" (players 2) (equipment { ("NineMensMorrisBoard") (hand Each) (piece "Marker" Each ("StepToEmpty" ~ (then ("ReplayIfLine3"))))}) (rules (start (place "Marker" "Hand" count:9)) phases:{ (phase "Placement" (play (move (from (handSite Mover)) (to (sites Empty)) "IfLine3MoveAgainPlacement")) (nextPhase (and ("HandEmpty" P1) ("HandEmpty" P2)) "Movement")) (phase "Movement" (play (forEach Piece)) (nextPhase Mover (is Line 3) "Capture")) (phase "Capture" (play ("RemoveAnyEnemyPiece" (then (moveAgain)))) (nextPhase Mover "Movement"))} (end (forEach Player if:(<= (count Pieces Player) 2) (result Player Loss))))) END
Construct a Ludii game based on the following description 2x6 board. Four counters in each hole. Play begins with a stylised move. One player takes the four counters in their leftmost hole and places them into the next hole, moving in an anti-clockwise direction. They then take the four counters in the next hole, and place them in the following holes. This continues until the entire board has an alternation pattern of a hole with eight counters followed by one with zero counters. The player then sows beginning from the final hole with eight counters they created. When the final counter of a sowing lands in a hole with counters, the player picks up these counters and sowing continues. When the final counter falls into an empty hole, the turn ends. At any time during the sowing a hole is made to contain four counters, they are captured by the player who is sowing, except when it is the final hole of a sowing, in which case they are picked up and sowing continues. If a player cannot play, they must pass their turn and may resume play when they are next able. When all of the counters have been captured, the player who captured the most counters wins. ###
(define "PiecesOwnedBy" (count Cell at:(handSite #1))) (define "NextHole" ("NextSiteOnTrack" #2 from:#1 "Track")) (game "Gabata (Oromo)" (players 2) (equipment { (mancalaBoard 2 6 store:None (track "Track" "0,E,N,W" loop:True)) (piece "Seed" Shared) (hand Each) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start (set Count 4 to:(sites Track))) phases:{ (phase "Opening1" (play (move Select (from (if ("SameTurn") (var "Replay") 0)) (then (sow numPerHole:4 apply:(and (moveAgain) (if (is Occupied ("NextHole" (to) 1)) (set Var "Replay" ("NextHole" (to) 1)) (set Var "Replay" Undefined))))))) (nextPhase (= Undefined (var "Replay")) "Opening2")) (phase "Opening2" (play (move Select (from (if (and ("SameTurn") (!= Undefined (var "Replay"))) (var "Replay") 6)) (then (do (set Var "NumSowed" (count at:(last To))) next:(sow apply:(if (< 1 (count at:(to))) (and (moveAgain) (set Var "Replay" (to))))) (then (and (forEach Site (sites Track from:(last From) to:(trackSite Move from:(last From) "Track" steps:(- (var "NumSowed") 1))) (if (= 4 (count at:(site))) (fromTo (from (site)) (to (handSite Mover)) count:4))) (set Var "NumSowed" 0))))))) (nextPhase (not (is Next Prev)) "Sowing")) (phase "Sowing" (play (move Select (from (if (and ("SameTurn") (!= Undefined (var "Replay"))) (sites {(var "Replay")}) (sites Mover)) if:(is Occupied (from))) (then (do (set Var "NumSowed" (count at:(last To))) next:(sow apply:(if (< 1 (count at:(to))) (and (moveAgain) (set Var "Replay" (to))))) (then (and (forEach Site (sites Track from:(last From) to:(trackSite Move from:(last From) "Track" steps:(- (var "NumSowed") 1))) (if (= 4 (count at:(site))) (fromTo (from (site)) (to (handSite Mover)) count:4))) (set Var "NumSowed" 0))))))))} (end ("MancalaByScoreWhen" ("NoPieceOnBoard"))))) END
Describe the mechanics of the following Ludii game (game "Snailtrail" (players 2) (equipment { (board (rectangle 7 7)) (piece "Pawn" Each (move Step (to if:(is Empty (to))) (then (moveAgain)))) (piece "Square" Neutral)}) (rules (start { (place "Pawn1" {"A1"}) (place "Pawn2" {"G7"})}) (play (if (is Even (count Moves)) (forEach Piece) (move Add (piece "Square0") (to (last From))))) (end ("BlockWin")))) ###
Each player has a pawn, that can move to any neighboring cell. After moving, the player places a block to the cell he came from. First player who cannot move loses. The game is played on a 7x7 board. END
Describe the mechanics of the following Ludii game (define "Centre" (sites {0..3})) (define "TakeBall" (if ("IsPieceAt" "Ball" Shared 32) (and (remove 32) (add (piece (id "Ball" #1)) (to 32))) (if ("IsPieceAt" "Ball" Shared 33) (and (remove 33) (add (piece (id "Ball" #1)) (to 33))) (and (remove 34) (add (piece (id "Ball" #1)) (to 34)))))) (define "NextSitePrev" (if (is Prev P1) ("NextSite" from:(where "Marker" Prev) "Track1") (if (is Prev P2) ("NextSite" from:(where "Marker" Prev) "Track2") (if (is Prev P3) ("NextSite" from:(where "Marker" Prev) "Track3") ("NextSite" from:(where "Marker" Prev) "Track4"))))) (define "NextSite" ("NextSiteOnTrack" 1 #1 #2)) (game "Aime" (players 4) (equipment { (board (merge { (concentric {4 4 4 4 4 4 4 4}) (shift -7 7 (square 1)) (shift -6 7 (square 1)) (shift -7 6 (square 1))}) { (track "Track1" {28 24 20 16 12 8 4 0} P1 directed:True) (track "Track2" {29 25 21 17 13 9 5 1} P2 directed:True) (track "Track3" {30 26 22 18 14 10 6 2} P3 directed:True) (track "Track4" {31 27 23 19 15 11 7 3} P4 directed:True)} use:Vertex) (piece "Marker" Each) (piece "Stick" Shared) (piece "Ball" Each) (piece "Ball" Shared) (hand Each size:2)}) (rules (start { (place "Marker1" 28) (place "Marker2" 29) (place "Marker3" 30) (place "Marker4" 31) (place "Ball" (sites {32..34}))}) phases:{ (phase "Hiding" (play (move Add (piece (id "Stick" Shared)) (to Cell (sites Hand Mover)) (then (set Hidden Cell at:(last To) to:Next)))) (nextPhase "Guessing")) (phase "Guessing" (play (move Select (from Cell (sites Hand Prev)) (then (and (if (is Empty (last To)) (and (fromTo (from (where "Marker" Prev)) (to ("NextSitePrev"))) (if (not (is In ("NextSitePrev") ("Centre"))) (set NextPlayer (player (prev))) ("TakeBall" Prev))) (and { (moveAgain) (fromTo (from (where "Marker" Mover)) (to ("NextSite" from:(where "Marker" Mover)))) (if (is In ("NextSite" from:(where "Marker" Mover)) ("Centre")) ("TakeBall" Mover))})) (remove Cell (sites Hand Prev)))))) (nextPhase "Hiding"))} (end (if (!= (- (count Players) (count Active)) (count Sites in:(difference ("Centre") (sites Empty)))) { (if (and (is Active P1) (is In (where "Marker" P1) ("Centre"))) (result P1 Win)) (if (and (is Active P2) (is In (where "Marker" P2) ("Centre"))) (result P2 Win)) (if (and (is Active P3) (is In (where "Marker" P3) ("Centre"))) (result P3 Win)) (if (and (is Active P4) (is In (where "Marker" P4) ("Centre"))) (result P4 Win))})))) ###
Seven concentric circles. Three points outside the circles. The center contains a circle, the market. There are three balls, placed near the board. Each player plays with one piece, which begins in the outermost point. The first player holds something in their hand, and asks the second player to guess which hand it is in. If the guessing player guesses correctly, they move their piece to the next point, or to the next ring of the spiral toward the market. If the guessing player guesses incorrectly, the player holding the object moves one space forward. The guessing player now takes the object, and asks the next player to guess which hand the object is in, and so on. When a player reaches the market, they take one of the three balls next to the board. The player who fails to collect a ball loses. END
Construct a Ludii game based on the following description OBJECT OF THE GAME The last player to make a move wins. FRIENDLY AND ENEMY CONNECTIONS A connection, i.e. an orthogonal adjacency between two checkers, is friendly if the two checkers are the same color and enemy if the two checkers are oppositely colored. CHECKER VALUE A checker’s value is its number of friendly connections minus its number of enemy connections. MOVES A checker’s value must increase when it‘s moved. Move a checker to an unoccupied, orthogonally adjacent square. There is no capturing in Jostle, only jostling. The game is played on a 10x10 square board. ###
(define "Score" (+ (results from:(sites {(from)}) to:(sites Around #1 Orthogonal) (if (= (from) (to)) 0 (if ("IsFriendAt" (to)) 1 (if ("IsEnemyAt" (to)) -1 0)))))) (game "Jostle" (players 2) (equipment { (board (square 10)) (piece "Marker" Each (move Step Orthogonal (to if:(and (is Empty (to)) (< ("Score" (from)) ("Score" (to)))))))}) (rules (start { (place "Marker1" (sites {23 25 27 32 34 36 43 47 52 63 72 74 76 65 67 56})) (place "Marker2" (sites {22 24 26 33 35 37 42 46 53 57 62 64 66 73 75 77}))}) (play (forEach Piece)) (end ("BlockWin")))) END
Describe the mechanics of the following Ludii game (define "HasMadeACapture" (is Triggered "CaptureMade" Next)) (define "CaptureSurroundedPiece" (enclose (from (last To)) Orthogonal (between if:("IsEnemyAt" (between)) (apply (and (trigger "CaptureMade" Next) (remove (between))))))) (game "Atari Go" (players 2) (equipment { (board (square 19) use:Vertex) (piece "Marker" Each)}) (rules (play (do (move Add (to (sites Empty)) (then ("CaptureSurroundedPiece"))) ifAfterwards:("HasFreedom" Orthogonal))) (end (if "HasMadeACapture" (result Mover Win))))) ###
The rules are identical to Go, except the winning condition is to be the first to capture a stone. The game is played on a 19x19 board. END
Modify the Ludii game according to the following option changes: The game starts with 2 counters. -> The game starts with 4 counters. (define "KalahCount" (count at:(mapEntry #1))) (define "PiecesOwnedByP2" (+ {(count at:(mapEntry P2)) (count in:(sites P2)) (count in:(sites P1))})) (define "PiecesOwnedByP1" (+ {(count at:(mapEntry P1)) (count in:(sites P1)) (count in:(sites P2))})) (game "Aw-li On-nam Ot-tjin" (players 2) (equipment { (mancalaBoard 2 9 (track "Track" "1,E,N,W" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 FirstSite) (pair P2 LastSite)}) (piece "Seed" Shared)}) (rules (start (set Count 2 to:(sites Track))) (play (move Select (from (sites Mover) if:(> (count at:(from)) 1)) (then (sow if:(= (count at:(to)) 2) apply:(fromTo (from (to)) (to (mapEntry (mover))) count:(count at:(to))))))) (end (if (no Moves Mover) { ("DrawIfNoMoves" Next) (if (is Mover P1) (byScore { (score P1 ("KalahCount" P1)) (score P2 "PiecesOwnedByP1")})) (if (is Mover P2) (byScore { (score P1 "PiecesOwnedByP2") (score P2 ("KalahCount" P2))}))})))) ###
(define "KalahCount" (count at:(mapEntry #1))) (define "PiecesOwnedByP2" (+ {(count at:(mapEntry P2)) (count in:(sites P2)) (count in:(sites P1))})) (define "PiecesOwnedByP1" (+ {(count at:(mapEntry P1)) (count in:(sites P1)) (count in:(sites P2))})) (game "Aw-li On-nam Ot-tjin" (players 2) (equipment { (mancalaBoard 2 9 (track "Track" "1,E,N,W" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 FirstSite) (pair P2 LastSite)}) (piece "Seed" Shared)}) (rules (start (set Count 4 to:(sites Track))) (play (move Select (from (sites Mover) if:(> (count at:(from)) 1)) (then (sow if:(= (count at:(to)) 4) apply:(fromTo (from (to)) (to (mapEntry (mover))) count:(count at:(to))))))) (end (if (no Moves Mover) { ("DrawIfNoMoves" Next) (if (is Mover P1) (byScore { (score P1 ("KalahCount" P1)) (score P2 "PiecesOwnedByP1")})) (if (is Mover P2) (byScore { (score P1 "PiecesOwnedByP2") (score P2 ("KalahCount" P2))}))})))) END
Construct a global Ludii definition which fulfills the following requirements. Defines a sequence of hop move in all the orthogonal directions over an enemy to an empty site from the last ``to'' location of the previous move. ###
(define "HopOrthogonalSequenceCaptureAgain" (move Hop (from (last To)) Orthogonal (between #1 #2 if:(and (not (is In (between) (sites ToClear))) ("IsEnemyAt" (between))) (apply (remove (between) #3))) (to if:(is Empty (to))) (then (if (can Move (hop (from (last To)) Orthogonal (between #1 #2 if:(and (not (is In (between) (sites ToClear))) ("IsEnemyAt" (between)))) (to if:(is Empty (to))))) (moveAgain))))) END
What does the following global Ludii definition do? (define "EscapeWin" (if (no Pieces Mover) (result Mover Win))) ###
Checks if the mover has no pieces and makes it win. This ludemeplex can be used only in an ending condition. END
Construct a Ludii game based on the following description Each player's six pieces are set up on their respective triangle. A piece is moved one space in any direction per turn onto an empty point along the lines of the board. A piece captures an enemy piece by hopping over it as in draughts. Only one piece may be used to move or capture per turn. Players alternate their turns throughout the game. Capturing is optional but pieces can promote. ###
(game "Felli" (players 2) (equipment { (board (graph vertices:{ {0 0} {2 0} {4 0} {1 1} {2 1} {3 1} {2 2} {1 3} {2 3} {3 3} {0 4} {2 4} {4 4}} edges:{ {0 1} {0 3} {1 2} {1 4} {2 5} {3 4} {3 6} {4 5} {4 6} {5 6} {6 7} {6 8} {6 9} {7 8} {7 10} {8 9} {8 11} {9 12} {10 11} {11 12}}) use:Vertex) (piece "Counter" Each) (piece "DoubleCounter" Each) (regions P1 (intersection (sites Corners) (sites Bottom))) (regions P2 (intersection (sites Corners) (sites Top)))}) (rules (start { (place "Counter1" (expand (sites Bottom))) (place "Counter2" (expand (sites Top)))}) (play (or { (forEach Piece "Counter" ("HopCapture") (then ("PromoteIfReach" (sites Next) "DoubleCounter"))) (forEach Piece "Counter" ("StepToEmpty") (then ("PromoteIfReach" (sites Next) "DoubleCounter"))) (forEach Piece "DoubleCounter" (move Slide)) (forEach Piece "DoubleCounter" ("HopCapture"))})) (end ("NoMoves" Loss)))) END
Describe the mechanics of the following Ludii game (define "NextHoleFrom" (trackSite Move from:#1 steps:#2)) (game "Lelac" (players 2) (equipment { (board (concentric {0 10}) (track "Track" {0..9} loop:True) use:Vertex) (piece "Square" Shared) (dice d:6 num:1) (regions P1 (expand (sites Bottom) steps:2)) (regions P2 (expand (sites Top) steps:2))}) (rules (start (set Count 1 to:(sites Board))) (play ("RollMove" (move (from (if ("SameTurn") (sites {(last From)}) (forEach (sites Mover) if:(is Occupied (site))))) (to ("NextHoleFrom" (from) (count Pips))) (then (if (is Occupied (last From)) (moveAgain)))))) (end (forEach Player if:(all Sites (sites Player) if:(and (is Next Player) (is Empty (site)))) (result Player Loss))))) ###
The game is played on a board with ten round pits arranged in a circle. Each player owns the semicircle closest to him. The game requires ten seeds and one standard six-faced die. At the start of the game, each pit contains one seed. During their turn, a player rolls a die. He then chooses one of his nonempty pits to sow. They take one seed from the sown pit, and move it counterclockwise according to the die value rolled. Then, they must roll to move each remaining seed from the sown pit. The turn only ends once the sown pit is empty. So, for example, if a player chooses to sow a pit with 4 seeds after his initial roll, 3 additional rolls will be needed. A player wins when all ten seeds are on their part of the board at the end of their turn. END
Construct a Ludii game based on the following description Three rows of four holes; the central two holes in the middle row are stores. Each player owns the hole in the central row to their left. Ten counters in each hole. Players sow from one of their holes, sowing first into the hole from which the counters were lifted, in an anti-clockwise direction. When the final counter lands in a hole containing two counters, these counters are captured. The player captures like this seven times. The eighth captures happens when the final counter falls into a hole containing one counter; the next capture from a hole containing three; the next from a hole containing five; then repeating the pattern of one, three, five for the rest of the game. The player who captures the most counters wins. The number of counters to have in the hole to capture in the initial captures before the sequence is 2. The number of initial captures before the sequence is 7. ###
(define "UpdateNumCaptureTwo" (set Value Mover (+ 1 (value Player Mover)))) (define "NumCountersToCapture" (if (is In 2 ("NumToCapture")) (+ 1 2) (if (is In 1 ("NumToCapture")) 2 (if (is In 3 ("NumToCapture")) 4 6)))) (define "UpdateNumToCapture" (if (is Mover P1) (and (forget Value "NumToCaptureP1" All) (if (is In 2 ("NumToCapture")) (remember Value "NumToCaptureP1" 1) (if (is In 1 ("NumToCapture")) (remember Value "NumToCaptureP1" 3) (if (is In 5 ("NumToCapture")) (remember Value "NumToCaptureP1" 1) (remember Value "NumToCaptureP1" 5))))) (and (forget Value "NumToCaptureP2" All) (if (is In 2 ("NumToCapture")) (remember Value "NumToCaptureP2" 1) (if (is In 1 ("NumToCapture")) (remember Value "NumToCaptureP2" 3) (if (is In 5 ("NumToCapture")) (remember Value "NumToCaptureP2" 1) (remember Value "NumToCaptureP2" 5))))))) (define "NumToCapture" (if (is Mover P1) (sites (values Remembered "NumToCaptureP1")) (sites (values Remembered "NumToCaptureP2")))) (define "PiecesOwnedBy" (count at:(mapEntry #1))) (define "Columns" 4) (game "The Concentration Game" (players 2) (equipment { (mancalaBoard 3 "Columns" store:None (track "Track" "0,E,N,W,S2" loop:True)) (piece "Seed" Shared) (regions P1 (union (sites {4}) (sites Bottom))) (regions P2 (union (sites {7}) (sites Top))) (map {(pair P1 5) (pair P2 6)})}) (rules (start { (set Count 10 to:(sites Outer)) (set RememberValue "NumToCaptureP1" 2) (set RememberValue "NumToCaptureP2" 2) (set RememberValue "NumCaptureTwoP1" 0) (set RememberValue "NumCaptureTwoP2" 0)}) (play (move Select (from (sites Mover) if:(< 1 (count at:(from)))) (then (sow if:(= (count at:(to)) ("NumCountersToCapture")) apply:(and (fromTo (from (to)) (to (mapEntry (mover))) count:(count at:(to))) (if (< (value Player Mover) 5) ("UpdateNumCaptureTwo") ("UpdateNumToCapture"))) origin:True)))) (end ("MancalaByScoreWhen" (no Moves Next))))) END
Construct a global Ludii definition which fulfills the following requirements. Checks if a friend is on a site. ###
(define "IsFriendAt" (is Friend (who at:#1 #2))) END
Construct a Ludii game based on the following description 8x8 checkered board. One player plays as four sheep (white pieces), which begin on the four dark squares on one side of the board. The other player plays as one wolf (black piece), which can be placed on any dark space on the board. Players alternate turns moving a piece to an empty adjacent dark square on the board. The sheep move forward only but the wolf may also move backward. The goal of the sheep is to block the wolf from being able to move, the goal of the wolf is to move beyond the line of sheep. ###
(define "WolfBeyondSheepRow" (= 0 (count Sites in:(forEach (sites Occupied by:P2) if:(<= (row of:(site)) (row of:(where "Wolf" P1))))))) (game "Wolf und Schaaf" (players 2) (equipment { (board (square 8)) (piece "Sheep" P2 N ("StepToEmpty" (directions {FR FL}))) (piece "Wolf" P1 "StepDiagonalToEmpty") (hand P1)}) (rules (start { (place "Wolf1" (handSite P1)) (place "Sheep2" {"A1" "C1" "E1" "G1"})}) phases:{ (phase "Placement" P1 (play (move (from (handSite P1)) (to (intersection (sites Phase 0) (sites Empty))))) (nextPhase "Movement")) ("PhaseMovePiece" "Movement")} (end { (if (and (no Moves P1) (is Mover P1)) (result P2 Win)) (if ("WolfBeyondSheepRow") (result P1 Win))}))) END
Construct a Ludii game based on the following description The game is played on a board with twelve points on either side. The points form a continuous track in a horseshoe shape; each player progresses in opposite directions (one from their bottom right to the top right, the other from their bottom left to their top left. Each player has 15 pieces. Each player's fifteen pieces begin on the first point of their track. Players move according to the number on each die by moving one piece the value on one die then another piece the value on the other die, or by moving one piece the value of one die and then the value of the other. If doubles are rolled, the player must play the number on each die twice. A piece cannot land on a space occupied by one of the opponent's pieces. A player must first move a single one of their pieces around the board and onto one of the final six points of their track before moving any of the other pieces. When all of the player's pieces are on the final six points, they may be borne off the board. The player who bears off all of their pieces wins. The winning player's score equals the number of the opponent's pieces which are left on the board. Play continues until one player's score reaches 31. ###
(games (subgame "MughrabiehSubgame" result:(score Mover))) END
Describe the mechanics of the following Ludii game (define "AllPiecesOnCentre" (and (= 1 (count Sites in:(sites Occupied by:#1 top:False))) (is In (centrePoint) (sites Occupied by:#1 top:False)))) (define "IsSpecialThrow" (is In ("ThrowValue") (sites {10 25 30}))) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" #2 #1)) (define "ThrowValue" (mapEntry "Throw" (count Pips))) (game "Pasit" (players 4) (equipment { ("PachisiBoard" { (track "Track1" "8,S,E,N,11,E,N,W,53,N,W,S,42,W,S,E,8,S,E1,N8" P1 directed:True) (track "Track2" "42,W,S,E,8,S,E,N,11,E,N,W,53,N,W,S,42,W,S1,E8" P2 directed:True) (track "Track3" "53,N,W,S,42,W,S,E,8,S,E,N,11,E,N,W,53,N,W1,S8" P3 directed:True) (track "Track4" "11,E,N,W,53,N,W,S,42,W,S,E,8,S,E,N,11,E,N1,W8" P4 directed:True)}) (hand Each) ("StickDice" 6) (piece "Pawn" Each (if ("IsOffBoard" ("SiteToMoveOnTrack" from:(from) ("ThrowValue"))) (move (from (from) level:(level)) (to (centrePoint))) (move (from (from) level:(level)) (to ("SiteToMoveOnTrack" from:(from) ("ThrowValue")) if:True (apply (if (and (not (is In (to) (sites "SafeSites"))) ("IsEnemyAt" (to))) (forEach Level (to) FromTop (fromTo (from (to) level:(level)) (to (handSite (who at:(to) level:(level)))))))))))) (map "Throw" {(pair 0 6) (pair 1 10) (pair 2 2) (pair 3 3) (pair 4 5) (pair 5 25) (pair 6 12)}) (map "Entry" {(pair P1 8) (pair P2 42) (pair P3 53) (pair P4 11)}) (regions "SafeSites" (sites {63 65 15 47 84 86 38 3}))}) (rules (start { (place Stack "Pawn1" (handSite P1) count:4) (place Stack "Pawn2" (handSite P2) count:4) (place Stack "Pawn3" (handSite P3) count:4) (place Stack "Pawn4" (handSite P4) count:4)}) phases:{ (phase "Opening" (play ("RollMove" (if ("IsSpecialThrow") (move (from (handSite Mover)) (to (mapEntry "Entry" Mover))) (move Pass) (then (and (if (!= 1 (value Player Mover)) (moveAgain)) (set Value Mover (+ 1 (value Player Mover)))))))) (nextPhase Mover (= 2 (value Player Mover)) "Moving")) (phase "Moving" (play ("RollMove" (or (if (and (is Occupied (handSite Mover)) ("IsSpecialThrow")) (move (from (handSite Mover)) (to (mapEntry "Entry" Mover)))) (forEach Piece)))))} (end (if ("AllPiecesOnCentre" Mover) (result Mover Win))))) ###
Four 3x8 rectangles, arranged in a cross-shaped board. the fourth square, counting from the outer corners, in the outer rows of each arm are marked. Four pieces per player. Six cowrie shells are used as dice. The value of the throws is as follows: one mouth up = 10; two mouths up = 2, three mouths up = 3; four mouths up = 5; five mouths up = 25; six mouths up = 12; all mouths down = 6. On the first turn, players get three throws, and enter a piece for every throw of 10 or 25. On the top left square in their arm. Players move their pieces around the board in an anti-clockwise direction. When a piece lands on a space occupied by an opponent's piece, the opponent's piece is removed from the board and must enter again. Pieces resting on marked squares are safe from being removed from the board. When a piece completes a circuit of the board. It moves toward the central row in the player's arm, and progresses up the central row into the large square in the center of the board. The player who moves all of their pieces into the center first wine. END
Construct a Ludii game based on the following description SnipSnip is a 2-player strategy game It may be played: -- on a hex grid -- on a square grid -- on a square plus diagonal grid Goal: Largest Group (in Misere, the largest Group loses.) Definitions: A Group is a set of all the pieces that can be reached from any one of them by a series of steps, where a step means movement from one piece to another of the same color, next to it. Note: For the Diagonal-Linked Group options a step also include diagonals (double-steps that are not in the same grid direction). A site is a board intersection. 'Between' Variant: -- A Capture site is any site adjacent to two stones of opposite color in the same line (i.e. directly between them.) 'Diagonal' Variant: -- A Capture site is any site adjacent to each of two stones of opposite color, where those stones are not on the same grid-line. Play: Players take turn, starting on an empty board with White to play. On a turn 1) The mover places to an empty site that is not a Capture site. 2) Then, if possible, the mover removes one of the opponent's checkers from a Capture site that lies adjacent to the placement just made. In the case of Misere, the mover must take an additional turn after each capture. Otherwise, the next player becomes the mover. The game ends when no placement is possible. In the case of a tie, the player who would have been next to place loses. Misere: Score one negative point for each stone in your largest group of adjacent stones Capture one of the opponent's stones on the 2 sites orthogonally between your stone and a diagonally adjacent opponent's stone. Board & size: Equiversi Hexhex with edges alternating 2 and 4 ###
(define "HighlightConnections" (show Symbol "Disc.svg" Vertex ("DiagonallyConnectedDomainsOf" 2) fillColour:(colour 0 0 255 50) edgeColour:(colour 0 0 0 0) scale:1) (show Symbol "Disc.svg" Vertex ("DiagonallyConnectedDomainsOf" 1) fillColour:(colour 255 255 0 100) edgeColour:(colour 0 0 0 0) scale:1)) (define "Tri78Bug" (tri {7 8 7 10 6})) (define "Tri57Bug" (tri {5 7 5 8 5})) (define "Tri56Bug" (tri {5 6 5 7 5})) (define "Tri46Bug" (tri {4 6 4 7 4})) (define "Misere" -1) (define "Sites2RemoveBetween" (forEach of:(sites Distance (step (to if:(is Next (who at:(to))))) from:(last To) (exact 2)) (sites Between Orthogonal from:(last To) to:(site) cond:(is In (between) (sites Occupied by:#1))))) (define "SitesAllowedBetween" (difference (sites Empty) (sites (results from:(sites Occupied by:P1) to:(forEach of:(sites Distance Orthogonal from:(from) (exact 2)) (sites Between Orthogonal from:(from) to:(site) cond:(and (is In (site) (sites Occupied by:P2)) (is Empty (between))))) (to))))) (define "Sites2RemoveDiagonal" (sites (results from:(last To) to:(forEach of:(intersection "SitesAtOmniDiagonal" (sites Occupied by:#1)) (intersection { (sites Around (from) Orthogonal) (sites Around (site) Orthogonal) (sites Occupied by:#1)})) (to)))) (define "SitesAllowedDiagonal" (difference (sites Empty) (sites (results from:(sites Occupied by:P1) to:(forEach of:(intersection "SitesAtOmniDiagonal" (sites Occupied by:P2)) (intersection { (sites Around (from) Orthogonal) (sites Around (site) Orthogonal) (sites Empty)})) (to))))) (define "SetPairScores" (forEach Player (set Score (player (player)) (* #1 (/ (+ (results from:(sites Occupied by:(player (player))) to:(sites Around (from) Orthogonal if:(is In (to) (sites Occupied by:(player (player))))) 1)) 2))))) (define "SetGroupScores" (forEach Player (set Score (player (player)) (* #1 (max 0 (max (sizes Group Orthogonal of:(player)))))))) (define "SetStoneScores" (set Score P1 (* #1 (count Pieces P1)) (then (set Score P2 (* #1 (count Pieces P2)))))) (define "SetDiagonalGroupScores" (forEach Player (set Score (player (player)) (* #1 (max 0 (+ 1 (max (results from:(sites Occupied by:(player (player))) to:(from) (size Array (array (intersection (sites Distance Orthogonal (step Orthogonal (to if:(is In (to) ("DiagonallyConnectedDomainsOf" (player))))) from:(from) (min 0)) (sites Occupied by:(player (player)))))))))))))) (define "DiagonallyConnectedDomainsOf" (union (sites Occupied by:(player #1)) (sites (results from:(sites Occupied by:(player #1)) to:(intersection (sites Occupied by:(player #1)) "SitesAtOmniDiagonal") (regionSite (intersection (sites Around (from) Orthogonal) (sites Around (to) Orthogonal)) index:0))))) (define "SitesAtOmniDiagonal" (difference (difference (sites Around (sites Around (from) Orthogonal) Orthogonal) (sites (from) {{F} {F F}})) (from))) (game "SnipSnip" (players 2) (equipment { (board (tri {2 4 2 4 2}) use:Vertex) (piece "Ball" Each)}) (rules (start { (set Score Each 0)}) (play (if (= 1 (value Player Mover)) (move Remove ("Sites2RemoveDiagonal" Next) (then (and { (set Value Mover 0) (moveAgain)}))) (move Add (to ("SitesAllowedDiagonal")) (then (if (< 0 (count Pieces in:("Sites2RemoveDiagonal" Next))) (set Value Mover 1 (then (moveAgain)))))) (then ("SetGroupScores" "Misere")))) (end { (if (and (no Moves Next) (= (score P1) (score P2))) (result Next Loss)) (if (and (no Moves Next) (!= (score P1) (score P2))) (byScore))}))) END
Modify the Ludii game according to the following option changes: The game is played with 4 players. -> The game is played with 4 players. (define "NextHole" ("NextSiteOnTrack" 1 from:(to) #1)) (define "PiecesHandOwnedBy" (+ (count in:(sites #1)) (count Cell at:(handSite #1)))) (define "PiecesOwnedBy" (+ (count in:(sites #1)) (count at:(mapEntry #1)))) (game "Kpo" (players 3) (equipment { (mancalaBoard 2 6 { (track "TrackCCW" "1,E,N,W" loop:True) (track "TrackCW" "6,W,N,E" loop:True)}) (piece "Seed" Shared) (regions P1 (sites {"B1" "C1" "B2" "C2"})) (regions P2 (sites {"D1" "E1" "D2" "E2"})) (regions P3 (sites {"F1" "G1" "F2" "G2"})) (hand Each)}) (rules (start (set Count 3 to:(sites Track))) (play (or (move Select (from (sites Mover) if:(> (count at:(from)) 0)) (then (sow "TrackCCW" apply:(if (and (or (= (count at:(to)) 2) (= (count at:(to)) 3)) (!= (count at:("NextHole" "TrackCCW")) 0)) (fromTo (from ("NextHole" "TrackCCW")) (to (handSite Mover)) count:(count at:("NextHole" "TrackCCW"))))))) (move Select (from (sites Mover) if:(> (count at:(from)) 0)) (then (sow "TrackCW" apply:(if (and (or (= (count at:(to)) 2) (= (count at:(to)) 3)) (!= (count at:("NextHole" "TrackCW")) 0)) (fromTo (from ("NextHole" "TrackCW")) (to (handSite Mover)) count:(count at:("NextHole" "TrackCW"))))))))) (end (if (or { (and (no Moves P1) (no Moves P2)) (and (no Moves P1) (no Moves P3)) (and (no Moves P2) (no Moves P3))}) (byScore { (score P1 ("PiecesHandOwnedBy" P1)) (score P2 ("PiecesHandOwnedBy" P2)) (score P3 ("PiecesHandOwnedBy" P3))}))))) ###
(define "NextHole" ("NextSiteOnTrack" 1 from:(to) #1)) (define "PiecesHandOwnedBy" (+ (count in:(sites #1)) (count Cell at:(handSite #1)))) (define "PiecesOwnedBy" (+ (count in:(sites #1)) (count at:(mapEntry #1)))) (game "Kpo" (players 4) (equipment { (mancalaBoard 2 6 { (track "TrackCCW" "1,E,N,W" loop:True) (track "TrackCW" "6,W,N,E" loop:True)}) (piece "Seed" Shared) (regions P1 (sites {"B1" "C1" "D1"})) (regions P2 (sites {"E1" "F1" "G1"})) (regions P3 (sites {"G2" "F2" "E2"})) (regions P4 (sites {"B2" "C2" "D2"})) (hand Each)}) (rules (start (set Count 3 to:(sites Track))) (play (or (move Select (from (sites Mover) if:(> (count at:(from)) 0)) (then (sow "TrackCCW" apply:(if (and (or (= (count at:(to)) 2) (= (count at:(to)) 3)) (!= (count at:("NextHole" "TrackCCW")) 0)) (fromTo (from ("NextHole" "TrackCCW")) (to (handSite Mover)) count:(count at:("NextHole" "TrackCCW"))))))) (move Select (from (sites Mover) if:(> (count at:(from)) 0)) (then (sow "TrackCW" apply:(if (and (or (= (count at:(to)) 2) (= (count at:(to)) 3)) (!= (count at:("NextHole" "TrackCW")) 0)) (fromTo (from ("NextHole" "TrackCW")) (to (handSite Mover)) count:(count at:("NextHole" "TrackCW"))))))))) (end (if (or { (and {(no Moves P1) (no Moves P2) (no Moves P3)}) (and {(no Moves P1) (no Moves P3) (no Moves P4)}) (and {(no Moves P2) (no Moves P3) (no Moves P4)})}) (byScore { (score P1 ("PiecesHandOwnedBy" P1)) (score P2 ("PiecesHandOwnedBy" P2)) (score P3 ("PiecesHandOwnedBy" P3)) (score P4 ("PiecesHandOwnedBy" P4))}))))) END
Construct a global Ludii definition which fulfills the following requirements. Defines a step move to the forward direction according to the facing direction of the piece in the 'from' location to an empty site. ###
(define "StepForwardToEmpty" (move Step Forward (to if:(is Empty (to))))) END
Construct a global Ludii definition which fulfills the following requirements. Defines a leap move to an empty site. ###
(define "LeapToEmpty" (move Leap #1 (to if:(is Empty (to))) #2)) END
Construct a Ludii game based on the following description Three buttons and three lights. The first button toggles the first light. The second button interchanges first and second lights. The third button interchanges the second and third lights. All lights initially off. The goal is to get them all on. The game terminates when all three lights are on or after 6 steps, whichever comes first. ###
(define "SwapTwoLastLights" (swap Pieces 4 5)) (define "SwapTwoFirstLights" (swap Pieces 3 4)) (define "ToggleLight" (set State at:3 (abs (- (state at:3) 1)))) (define "SecondButton" (= (last To) 1)) (define "FirstButton" (= (last To) 0)) (define "LightOn" (= 1 (state at:(site)))) (game "Buttons And Lights" (players 1) (equipment { (board (rectangle 2 3)) (piece "Light" Shared)}) (rules (start (place "Light" (sites Top))) (play (move Select (from (sites Bottom)) (then (if ("FirstButton") ("ToggleLight") (if ("SecondButton") ("SwapTwoFirstLights") ("SwapTwoLastLights")))))) (end { (if (all Sites (sites Top) if:("LightOn")) (result Mover Win)) (if (= 4 (counter)) (result Mover Loss))}))) END
Construct a Ludii game based on the following description 8x8. Each player begins with a complement of pieces, each with their own powers of movement as follows: King (x1): may move one space in any direction; Queen (x1): moves one space diagonally, may leap two spaces diagonally on its first move over any intervening pieces; Bishop (x2): moves diagonally two spaces, jumping over any intervening pieces; Knight (x2): moves orthogonally one space and then diagonally another space, jumping over any intervening pieces; Rook (x2): moves orthogonally any distance; Pawns (x8): move forward one space or diagonally forward one space to capture. Only the Rooks' and Queens' pawns may move forward two spaces for their first move. When a Pawn reaches the row on the opposite side of the board from which it began, it must move two spaces backward to the sixth row, then to the fourth, and then to the second, and then is promoted to Queen. It cannot jump over any pieces or taken a piece during these moves. A Pawn is immune from capture on the eight rank, but not on the others while making these promotion moves. Each player must move the Rooks' Pawns and Queens' Pawn in this way, as well as the jump of the Queen, in their first four moves. There is no castling. A piece is captured when an opponent's piece moves onto its space. The King is in check when it can be taken on the opponent's next turn; it must not remain in check at the end of the player's turn. When the king cannot move out of check, it is checkmated and the opponent wins. ###
(define "SpecialStartingPawns" (sites {"A2" "D2" "H2" "A7" "H7" "E7"})) (define "CaptureForwardDiagonal" (move Step (directions {FR FL}) (to if:(and ("IsEnemyAt" (to)) (if (not (is In (to) (sites Next "Promotion"))) True (!= (what at:(to)) (id "Pawn" Next)))) (apply (remove (to)))))) (define "CaptureEnemyToPiece" (apply (if ("IsEnemyAt" (to)) (remove (to))))) (game "Welschschach" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) (piece "King_noCross" (move Step (to if:(and (not ("IsFriendAt" (to))) (if (not (is In (to) (sites Next "Promotion"))) True (not ("IsPieceAt" "Pawn" Next (to))))) ("CaptureEnemyToPiece")))) (piece "Queen" (move Step Diagonal (to if:(and (not ("IsFriendAt" (to))) (if (not (is In (to) (sites Next "Promotion"))) True (!= (what at:(to)) (id "Pawn" Next)))) ("CaptureEnemyToPiece")))) (piece "Bishop_noCross" (move Hop Diagonal (between if:True) (to if:(and (not ("IsFriendAt" (to))) (if (not (is In (to) (sites Next "Promotion"))) True (!= (what at:(to)) (id "Pawn" Next)))) ("CaptureEnemyToPiece")))) (piece "Knight" (move Leap "KnightWalk" (to if:(and (not ("IsFriendAt" (to))) (if (not (is In (to) (sites Next "Promotion"))) True (!= (what at:(to)) (id "Pawn" Next)))) "CaptureEnemyToPiece"))) (piece "Rook" (move Slide Orthogonal (to if:(and (not ("IsFriendAt" (to))) (if (not (is In (to) (sites Next "Promotion"))) True (!= (what at:(to)) (id "Pawn" Next)))) "CaptureEnemyToPiece"))) (piece "Pawn" (if (= 0 (state at:(from))) (or "StepForwardToEmpty" "CaptureForwardDiagonal" (then (if (is In (last To) (sites Mover "Promotion")) (set State at:(last To) 1)))) (move Slide Backward (between (exact 2) if:(is Empty (between))) (to if:(is Empty (to))) (then (if (is In (last To) (sites Start (piece (what at:(last To))))) (promote (last To) (piece "Queen") Mover)))))) (regions "Promotion" P1 (sites Top)) (regions "Promotion" P2 (sites Bottom))}) (rules (start { (place "Pawn1" (sites Row 1)) (place "Pawn2" (sites Row 6)) (place "Rook1" {"A1" "H1"}) (place "Knight1" {"B1" "G1"}) (place "Bishop_noCross1" {"C1" "F1"}) (place "Queen1" coord:"D1") (place "King_noCross1" coord:"E1") (place "Rook2" {"A8" "H8"}) (place "Knight2" {"B8" "G8"}) (place "Bishop_noCross2" {"C8" "F8"}) (place "Queen2" coord:"E8") (place "King_noCross2" coord:"D8")}) phases:{ (phase "Opening" (play (or { (forEach Piece "Queen" (if (is In (from) (sites Start (piece (what at:(from))))) (move Hop Diagonal (between (exact 1) if:True) (to if:(and (not ("IsFriendAt" (to))) (if (not (is In (to) (sites Next "Promotion"))) True (!= (what at:(to)) (id "Pawn" Next)))) ("CaptureEnemyToPiece")))) Mover) (forEach Piece "Pawn" (if (is In (from) (intersection ("SpecialStartingPawns") (sites Start (piece (what at:(from)))))) ("DoubleStepForwardToEmpty")) Mover)})) (nextPhase (= 8 (count Moves)) "Playing")) (phase "Playing" (play (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King_noCross" Mover)))))} (end ("Checkmate" "King_noCross")))) END
Construct a Ludii game based on the following description White player takes a red piece and places a white piece on top of it, placing the stack before them. Black player takes a white piece and places a black piece on top of it, placing the stack before them. Red player takes a black piece and places a red piece on top of it, placing the stack before them. Starting with White, players take turns placing a piece of their colour on an empty space of the board until the victory condition is reached. The aim of the game is to create a 5-in-a-row containing both and only both colours of your stack. ###
(game "Yavalade" (players 3) (equipment { (board (rotate 90 (hex 5))) (piece "Marker" Each)}) (rules (play (move Add (to (sites Empty)))) (end { (if (is Line 5 whats:{1 3}) (result P1 Win)) (if (is Line 5 whats:{1 2}) (result P2 Win)) (if (is Line 5 whats:{2 3}) (result P3 Win))}))) END