prompt
stringlengths
71
4.65k
completion
stringlengths
34
5.1k
Modify the Ludii game according to the following option changes: The game involves 2 players. -> The game involves 4 players. (define "SiteToMoveOnTrack" ("NextSiteOnTrack" #1)) (define "ThrowValue" (mapEntry "Throw" (count Pips))) (game "Paradis" (players 2) (equipment { (board (concentric {2 2 2 2 2 2 2 2 2 2}) { (track "Track1" {18 16 14 12 10 8 6 4 2 0 2 4 6 8 10 12 14 16 18 16 14 12 10 8 6 4 2 0 2 4 6 8 10 12 14 16 18 16 14 12 10 8 6 4 2 0 2 4 6 8 10 12 14 16} P1 directed:True) (track "Track2" {19 17 15 13 11 9 7 5 3 1 3 5 7 9 11 13 15 17 19 17 15 13 11 9 7 5 3 1 3 5 7 9 11 13 15 17 19 17 15 13 11 9 7 5 3 1 3 5 7 9 11 13 15 17} P2 directed:True)} use:Vertex) ("StickDice" 2) (piece "Marker" Each (move (from (from)) (to ("SiteToMoveOnTrack" ("ThrowValue")) (apply (if (or (and (= 1 ("ThrowValue")) (= (mapEntry "Center" Mover) (to))) (and (= 2 ("ThrowValue")) (or (= (mapEntry "Center" Mover) (to)) (= (mapEntry "Center" Mover) ("SiteToMoveOnTrack" 1))))) (addScore Mover 1)))))) (map "Throw" {(pair 0 2) (pair 1 0) (pair 2 1)}) (map "Center" {(pair P1 0) (pair P2 1)})}) (rules (start { (place "Marker1" 18) (place "Marker2" 19)}) (play ("RollMove" (if (!= ("ThrowValue") 0) (forEach Piece)))) (end (if (= (score Mover) 3) (result Mover Win))))) ###
(define "SiteToMoveOnTrack" ("NextSiteOnTrack" #1)) (define "ThrowValue" (mapEntry "Throw" (count Pips))) (game "Paradis" (players 4) (equipment { (board (concentric {4 4 4 4 4 4 4 4 4 4}) { (track "Track1" {36 32 28 24 20 16 12 8 4 0 4 8 12 16 20 24 28 32 36 32 28 24 20 16 12 8 4 0 4 8 12 16 20 24 28 32 36 32 28 24 20 16 12 8 4 0 4 8 12 16 20 24 28 32} P1 directed:True) (track "Track2" {37 33 29 25 21 17 13 9 5 1 5 9 13 17 21 25 29 33 37 33 29 25 21 17 13 9 5 1 5 9 13 17 21 25 29 33 37 33 29 25 21 17 13 9 5 1 5 9 13 17 21 25 29 33} P2 directed:True) (track "Track3" {38 34 30 26 22 18 14 10 6 2 6 10 14 18 22 26 30 34 38 34 30 26 22 18 14 10 6 2 6 10 14 18 22 26 30 34 38 34 30 26 22 18 14 10 6 2 6 10 14 18 22 26 30 34} P3 directed:True) (track "Track4" {39 35 31 27 23 19 15 11 7 3 7 11 15 19 23 27 31 35 39 35 31 27 23 19 15 11 7 3 7 11 15 19 23 27 31 35 39 35 31 27 23 19 15 11 7 3 7 11 15 19 23 27 31 35} P4 directed:True)} use:Vertex) ("StickDice" 2) (piece "Marker" Each (move (from (from)) (to ("SiteToMoveOnTrack" ("ThrowValue")) (apply (if (or (and (= 1 ("ThrowValue")) (= (mapEntry "Center" Mover) (to))) (and (= 2 ("ThrowValue")) (or (= (mapEntry "Center" Mover) (to)) (= (mapEntry "Center" Mover) ("SiteToMoveOnTrack" 1))))) (addScore Mover 1)))))) (map "Throw" {(pair 0 2) (pair 1 0) (pair 2 1)}) (map "Center" {(pair P1 0) (pair P2 1) (pair P3 2) (pair P4 3)})}) (rules (start { (place "Marker1" 36) (place "Marker2" 37) (place "Marker3" 38) (place "Marker4" 39)}) (play ("RollMove" (if (!= ("ThrowValue") 0) (forEach Piece)))) (end (if (= (score Mover) 3) (result Mover Win))))) END
Construct a Ludii game based on the following description Colour edges of the graph, by selecting them, until they form a path that passes through every vertex exactly once and returns to its starting point. ###
(game "Hamiltonian Maze" (players 1) (equipment { (board (graph vertices:{ {0 0} {2 0} {4 0} {6 0} {8 0} {10 0} {2 2} {4 2} {6 2} {8 2} {10 2} {0 4} {2 4} {6 4} {8 4} {10 4} {0 6} {2 6} {4 6} {6 6} {8 6} {10 6} {0 8} {2 8} {4 8} {6 8} {8 8} {10 8} {0 10} {2 10} {6 10} {8 10} {10 10}} edges:{{0 1} {0 11} {1 6} {6 7} {7 8} {2 7} {2 3} {8 9} {3 8} {3 4} {9 10} {4 9} {4 5} {5 10} {6 12} {11 12} {7 18} {12 13} {8 13} {13 14} {14 15} {9 14} {15 10} {11 16} {16 17} {12 17} {17 18} {13 19} {18 19} {19 20} {20 14} {20 21} {15 21} {22 16} {22 23} {23 24} {18 24} {24 25} {25 26} {19 25} {27 26} {21 27} {22 28} {29 28} {23 29} {29 30} {25 30} {30 31} {31 32} {27 32}}) use:Vertex)}) (rules (play (move Add (to Edge (sites Empty Edge)))) (end { (if (is Path Edge Mover length:(exact (count Sites "Board")) closed:True) (result Mover Win)) (if (is Path Edge Mover length:(max (count Moves)) closed:True) (result Mover Loss))}))) END
Construct a Ludii game based on the following description Played on an 8x8 board. 16 pieces per player, lined up in the second and third rows. A piece can move forwards, straight ahead or diagonally, or sideways to an orthogonally adjacent field if that field is empty, and capture opponents' pieces by jumping left, right, or forwards. When they reach the opposite side, they become a king, which may move in all directions (up, down, left, right, or diagonally), as long as the path is clear of pieces, and can jump opponents' pieces from any distance orthogonally. Captures must be taken if possible, and the maximum number of jumps must be made. Multiple captures cannot be made by moving 180 degrees from the previous jump. Pieces can be promoted to king mid-jump. Winning is achieved by capturing all of the other player's pieces or by blocking them so they cannot move. The rules come from Schmidt. ###
(define "IsUnpromoted" ("IsPieceAt" "Counter" Mover (last To))) (define "HopMan" ("HopCapture" (from #1) (directions {Forward Rightward Leftward}) #2)) (define "PromotedHopOrthogonalSequenceCapture" ("HopCapture" #1 #2 (then ("ReplayIfCanMove" ("HopCapture" (from (last To)) #2))))) (game "Tama" (players 2) ("DraughtsEquipment" (square 8)) (rules (start { (place "Counter1" (union (sites Row 1) (sites Row 2))) (place "Counter2" (union (sites Row 5) (sites Row 6)))}) (play (if "SameTurn" (if "IsUnpromoted" (max Moves ("HopMan" (last To) (then ("ReplayIfCanMove" ("HopMan" (last To)) ("PromoteIfReach" (sites Next) "DoubleCounter"))))) (max Moves ("PromotedHopOrthogonalSequenceCapture" (from (last To)) (difference Orthogonal OppositeDirection)))) (priority { (max Moves (or { (forEach Piece "Counter" ("HopMan" (from) (then ("ReplayIfCanMove" ("HopMan" (last To)) ("PromoteIfReach" (sites Next) "DoubleCounter"))))) (forEach Piece "DoubleCounter" ("PromotedHopOrthogonalSequenceCapture" (from) Orthogonal))})) (or (forEach Piece "Counter" ("StepToEmpty" (directions {Forwards Rightward Leftward})) (then ("PromoteIfReach" (sites Next) "DoubleCounter"))) (forEach Piece "DoubleCounter" ("StepToEmpty")))}))) (end ("CaptureAll" Next)))) END
Construct a Ludii game based on the following description Goal: Connect all three edge colors with a single group of connected stones of your own color. (As in 'Y') Turns alternate. The player seeking to connect with the darker color starts. On each turn the current player places one stone of each color (friendly stone first) onto an empty intersection of the board. Hex 4-5 Board (48) ###
(define "EdgesOfSide" (intersection (sites Outer Edge) (forEach of:(difference #1 (sites Corners Vertex)) (sites Incident Edge of:Vertex at:(site))))) (define "BoardColour" (colour 215 203 170)) (define "P2Colour" (colour White)) (define "P1Colour" (colour DarkGreen)) (define "AddPieceOf" (move Add (piece #1) (to (sites Empty)) #2)) (define "Side3" (union (sites Side NW) (sites Side SW))) (define "Side2" (union (sites Side SE) (sites Side S))) (define "Side1" (union (sites Side NE) (sites Side N))) (game "Bipartisan Y" (players 2) (equipment { (board (tri Limping 4) use:Vertex) (piece "Disc" Each) (piece "Counter" Neutral maxState:2)}) (rules (play (if ("SameTurn") ("AddPieceOf" (next) ~) ("AddPieceOf" (mover) (then (moveAgain))))) (end { (if (and (= 1 (who at:(last To))) (is Connected 3 {"Side1" "Side2" "Side3"})) (result P1 Win)) (if (and (= 2 (who at:(last To))) (is Connected 3 {"Side1" "Side2" "Side3"})) (result P2 Win))}))) END
Describe the mechanics of the following Ludii game (define "Move" (if ("IsEndTrack" ("SiteToMoveOnTrack" from:(from) ("ThrowValue"))) (move (from (from)) (to (mapEntry "Start" Mover)) (then (fromTo (from (handSite ("HandOpponent"))) (to (handSite ("HandTeam")))))) (move (from (from)) (to ("SiteToMoveOnTrack" from:(from) ("ThrowValue")) if:True (apply (if ("IsEnemyAt" (to)) (and (fromTo (from (to)) (to (mapEntry "Start" (who at:(to))))) (fromTo (from (handSite ("HandOpponent"))) (to (handSite ("HandTeam")))))))) (then (if (= (last To) (mapEntry "Opposite" Mover)) (and (fromTo (from (last To)) (to (mapEntry "Start" Mover))) (fromTo (from (handSite ("HandTeam"))) (to (handSite ("HandOpponent")))))))))) (define "HandOpponent" (if (or (is Mover P1) (is Mover P2)) 3 1)) (define "HandTeam" (if (or (is Mover P1) (is Mover P2)) 1 3)) (define "ReplayThrow" (or (= ("ThrowValue") 5) (= ("ThrowValue") 10))) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" #2 #1)) (define "ThrowValue" (mapEntry "Throw" (count Pips))) (game "Zohn Ahl" (players 4) (equipment { (board (graph vertices:{ {0 0} {1 0.4} {2 0.4} {3 0.4} {4 0} {5 0} {6 0.4} {7 0.4} {8 0.4} {9 0} {4 1} {5 1} {-6 3} {-5.6 4} {-5.6 5} {-5.6 6} {-6 7} {-6 8} {-5 7} {-5 8} {-5.6 9} {-5.6 10} {-5.6 11} {-6 12} {0 15} {1 14.6} {2 14.6} {3 14.6} {4 15} {5 15} {6 14.6} {7 14.6} {8 14.6} {9 15} {4 14} {5 14} {15 3} {14.6 4} {14.6 5} {14.6 6} {15 7} {15 8} {14 7} {14 8} {14.6 9} {14.6 10} {14.6 11} {15 12}} edges:{ {0 12} {23 24} {33 47} {36 9} {4 10} {5 11} {16 18} {17 19} {28 34} {35 29} {43 41} {42 40}}) { (track "Track1" "5,6,7,8,9,36,37,38,39,40,41,44,45,46,47,33,32,31,30,29,28,27,26,25,24,23,22,21,20,17,16,15,14,13,12,0,1,2,3,End" P1 directed:True) (track "Track2" "5,6,7,8,9,36,37,38,39,40,41,44,45,46,47,33,32,31,30,29,28,27,26,25,24,23,22,21,20,17,16,15,14,13,12,0,1,2,3,End" P2 directed:True) (track "Track3" "4,3,2,1,0,12,13,14,15,16,17,20,21,22,23,24,25,26,27,28,29,30,31,32,33,47,46,45,44,41,40,39,38,37,36,9,8,7,6,End" P3 directed:True) (track "Track4" "4,3,2,1,0,12,13,14,15,16,17,20,21,22,23,24,25,26,27,28,29,30,31,32,33,47,46,45,44,41,40,39,38,37,36,9,8,7,6,End" P4 directed:True)} use:Vertex) (piece "Stick" P1 ("Move")) (piece "Stick" P3 ("Move")) (piece "Stick" Neutral) ("StickDice" 4) (hand P1) (hand P3) (map "Throw" {(pair 0 10) (pair 1 1) (pair 2 2) (pair 3 3) (pair 4 5)}) (map "Opposite" {(pair P1 29) (pair P2 29) (pair P3 28) (pair P4 28)}) (map "Start" {(pair P1 5) (pair P2 5) (pair P3 4) (pair P4 4)})}) (rules (start { (set Team 1 {P1 P2}) (set Team 2 {P3 P4}) (place "Stick1" 5) (place "Stick3" 4) (place "Stick0" (handSite P1) count:10) (place "Stick0" (handSite P3) count:10)}) (play ("RollMove" (if (or (is Mover P1) (is Mover P2)) (forEach Piece P1) (forEach Piece P3)) (then (if ("ReplayThrow") (moveAgain))))) (end (if (is Empty (handSite ("HandOpponent"))) (result TeamMover Win))))) ###
The board is roughly rectangular. There are six points on either side, with each side divided in half by two short parallel lines, the rivers. There are four arcs in the corners of the \ Each team has 10 scoring sticks. END
Construct a Ludii game based on the following description 2x3 board. Three counters in each hole. Players sow from any one of their holes. Sowing can occur in the following directions: From the leftmost hole, clockwise; from the rightmost hole, anti-clockwise; from the center hole, the player may choose either direction. If the final counter falls into a hole in the opponent's row containing one counter, making it now contain two, these are taken. If the holes before them also contain two, in an unbroken sequence, they may all be captured. Single counters cannot be sown. When neither player can move, the single counters in each player's rows are taken by the player belonging to those rows. The player with the most counters wins. ###
(define "PiecesOwnedBy" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (define "Sow" (move Select (from #1 if:(> (count at:(from)) 1)) (then (sow #2 if:(and (= (count at:(to)) 2) (is In (to) (sites Next))) apply:(fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))) backtracking:True)))) (game "Um el Tuweisat" (players 2) (equipment { (mancalaBoard 2 3 store:None { (track "TrackCCW" "0,E,N,W" loop:True) (track "TrackCW" "2,W,N,E" loop:True)}) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map "RightHole" {(pair P1 2) (pair P2 3)}) (map "CenterHole" {(pair P1 1) (pair P2 4)}) (map "LeftHole" {(pair P1 0) (pair P2 5)}) (piece "Seed" Shared) (hand Each)}) (rules (start (set Count 3 to:(sites Track))) (play (or { ("Sow" (mapEntry "RightHole" (mover)) "TrackCCW") ("Sow" (mapEntry "LeftHole" (mover)) "TrackCW") ("Sow" (mapEntry "CenterHole" (mover)) "TrackCCW") ("Sow" (mapEntry "CenterHole" (mover)) "TrackCW")})) (end ("MancalaByScoreWhen" (and (no Moves P1) (no Moves P2)))))) END
What does the following global Ludii definition do? (define "PhaseMovePiece" (phase #1 (play (forEach Piece)) #2)) ###
Defines a phase to move each piece according to the move ludeme associated with each piece. END
Construct a Ludii game based on the following description 5x5 grid, with six spaces extending from the central row; the final three of this extension rendered as rectangles rather than squares (Cairo, Medina, and Mecca, in that order). The central square of the grid is marked with a circle (the Minaret). Any number of players. Three pieces per player, a father, a mother, and an angel. Six sticks, black on one side and white on the other, used as dice. The throws are as follows: Five of any color plus one of the other color (known as \ The game has 4 players. ###
(define "Move" (if (!= 0 #1) (or { (if (is In (from) (sites Track "FirstTrack")) (move (from (from) level:(level)) (to ("SiteToMoveOnTrack" "FirstTrack" #1))) ("CaptureMove" "FirstTrack")) (if (is In (from) (sites Track "SecondTrack")) (move (from (from) level:(level)) (to ("SiteToMoveOnTrack" "SecondTrack" #1)) ("CaptureMove" "SecondTrack"))) ("EnterToMinaret") ("ExitFromMinaret") ("GoToStep1") ("GoToStep2") ("GoToStep3") #2 ("PrepareLastStep") ("LastSirMove" ("Step3") ("Cairo")) ("LastSirMove" ("Cairo") ("Medina")) ("LastSirMove" ("Medina") ("Mecca"))}))) (define "CaptureMove" (then (forEach Site (sites Track Mover #1 from:("NextSite" (last From) #1) to:(last To)) (forEach Level (site) FromTop (if ("IsEnemyAt" (site) level:(level)) (fromTo (from (site) level:(level)) (to (if (= (site) (where "Father" (who at:(site) level:(level)))) ("StartFather") (if (= (site) (where "Mother" (who at:(site) level:(level)))) ("StartMother") ("StartAngel")))))))))) (define "GoToStep3Angel" ("SirMove" ("GroundAway") ("Step1"))) (define "GoToStep3" ("SirMove" ("Step2") ("Step3"))) (define "GoToStep2" ("SirMove" ("Step1") ("Step2"))) (define "GoToStep1" ("SirMove" ("Ground") ("Step1"))) (define "ExitFromMinaret" ("SirMove" ("Minaret") ("ExitMinaret"))) (define "EnterToMinaret" ("SirMove" ("EnterMinaret") ("Minaret"))) (define "NextSite" ("NextSiteOnTrack" 1 from:#1 #2)) (define "SirMove" (if (and ("Sir") (= (from) #1)) (move (from (from) level:(level)) (to #2)))) (define "LastSirMove" (if (and { ("Sir") (= (from) #1) (= 2 (state at:(from) level:(level)))}) (move (from (from) level:(level)) (to #2 (apply (set State at:(from) level:(level) 0)))))) (define "PrepareLastStep" (if (and { ("Sir") (is In (from) (sites {("Step3") ("Medina") ("Cairo")})) (< (state at:(from) level:(level)) 2)}) (move (from (from) level:(level)) (to (from) (apply (set State at:(to) level:(level) (+ 1 (state at:(to) level:(level))))))))) (define "Sir" (= "ThrowValue" 1)) (define "ExtraThrowValue" (mapEntry "ExtraThrow" (count Pips))) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" #2 #1)) (define "ThrowValue" (mapEntry "Throw" (count Pips))) (define "AllPiecesInMecca" (and { (= ("Mecca") (where "Angel" Mover)) (= ("Mecca") (where "Father" Mover)) (= ("Mecca") (where "Mother" Mover))})) (define "StartMother" 7) (define "StartAngel" 10) (define "StartFather" 13) (define "Mecca" 28) (define "Medina" 29) (define "Cairo" 30) (define "Step3" 16) (define "Step2" 17) (define "Step1" 2) (define "Ground" 23) (define "GroundAway" 24) (define "ExitMinaret" 6) (define "EnterMinaret" 12) (define "Minaret" 9) (game "Siryu (Race)" (players 4) (equipment { (board (merge { (rectangle 5 2) (shift 2 -3 (scale 1.2 1 (rectangle 8 1))) (shift 3.2 0 (rectangle 5 2)) (shift 1.6 -6 (scale 2 1 (rectangle 3 1)))}) { (track "FirstTrack" "13,S,E1,N,E1,S1" directed:True) (track "SecondTrack" "6,S1,E1,N,E1,S" directed:True)}) ("StickDice" 6) (map "Throw" {(pair 0 6) (pair 1 1) (pair 2 0) (pair 3 0) (pair 4 0) (pair 5 1) (pair 6 6)}) (map "ExtraThrow" {(pair 0 1) (pair 1 1) (pair 2 0) (pair 3 0) (pair 4 0) (pair 5 1) (pair 6 3)}) (piece "Father" Each ("Move" ("ThrowValue"))) (piece "Angel" Each ("Move" (* 2 ("ThrowValue")) ("GoToStep3Angel"))) (piece "Mother" Each ("Move" ("ThrowValue")))}) (rules (start { (place Stack "Father1" "StartFather") (place Stack "Angel1" "StartAngel") (place Stack "Mother1" "StartMother") (place Stack "Father2" "StartFather") (place Stack "Angel2" "StartAngel") (place Stack "Mother2" "StartMother") (place Stack "Father3" "StartFather") (place Stack "Angel3" "StartAngel") (place Stack "Mother3" "StartMother") (place Stack "Father4" "StartFather") (place Stack "Angel4" "StartAngel") (place Stack "Mother4" "StartMother")}) (play ("RollMove" (forEach Piece) (then (if (!= 0 ("ExtraThrowValue")) (and (if (= 3 ("ExtraThrowValue")) (if (<= (var) 0) (set Var 2) (set Var (+ 2 (var))))) (moveAgain)) (if (> (var) 0) (and (set Var (- (var) 1)) (moveAgain))))))) (end (if ("AllPiecesInMecca") (result Mover Win))))) END
Construct a Ludii game based on the following description DEFINITION: A group is a maximal set of orthogonally adjacent like-colored pieces. GAMEPLAY: On your turn, flip an enemy group. OBJECTIVE: Eliminate the enemy pieces. An 8x8 board is currently selected. No heuristic is used. ###
(define "FlipGroupAndCalculateDifference" (do (add (to (sites Group at:(last From) Orthogonal) (apply (remove (to))))) next:(and (set Score P1 (- (count Groups Orthogonal if:(= (id P1) (who at:(to)))) (count Groups Orthogonal if:(= (id P2) (who at:(to)))))) (set Score P2 (- (count Groups Orthogonal if:(= (id P2) (who at:(to)))) (count Groups Orthogonal if:(= (id P1) (who at:(to))))))))) (define "FlipGroupAndCountEnemy" (do (add (to (sites Group at:(last From) Orthogonal) (apply (remove (to))))) next:(and (set Score P1 (* -1 (count Groups Orthogonal if:(= (id P2) (who at:(to)))))) (set Score P2 (* -1 (count Groups Orthogonal if:(= (id P1) (who at:(to))))))))) (define "FlipGroupAndCountFriendly" (do (add (to (sites Group at:(last From) Orthogonal) (apply (remove (to))))) next:(and (set Score P1 (count Groups Orthogonal if:(= (id P1) (who at:(to))))) (set Score P2 (count Groups Orthogonal if:(= (id P2) (who at:(to)))))))) (define "FlipGroup" (add (to (sites Group at:(last From) Orthogonal) (apply (remove (to)))))) (game "Paintbucket" (players 2) (equipment { (board (square 8)) (tile "Square" Each)}) (rules (start { (place "Square1" (sites Phase 0)) (place "Square2" (sites Phase 1))}) (play (move Select (from (sites Occupied by:Next)) (then ("FlipGroup")))) (end ("CaptureAll" Next Loss)))) END
Construct a Ludii game based on the following description 2x4 board, rendered as holes in the sand. Six counters per hole. A player picks up all of the counters in one of the holes in their row and sows them in an anti-clockwise direction. When the final counter lands in an empty hole, the contents of the following hole are picked up and the sowing continues. When the final counter lands in a hole in the opponent's row causing it to contain six counters, these counters are captured. Play continues until one player has no counters in their holes, and the opponent wins. ###
(define "NoCounters" (all Sites (sites #1) if:(= 0 (count at:(site))))) (define "NextHole" ("NextSiteOnTrack" 1 from:#1 "Track")) (define "PlayFromLastHole" (last To afterConsequence:True)) (define "Columns" 4) (game "Boukerourou" (players 2) (equipment { (mancalaBoard 2 "Columns" store:None (track "Track" "0,E,N,W" loop:True)) (piece "Seed" Shared) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start (set Count 6 to:(sites Track))) (play (move Select (from (if ("SameTurn") (sites {("NextHole" ("PlayFromLastHole"))}) (sites Mover)) if:(> (count at:(from)) 0)) (then (sow apply:(if (and (= 1 (count at:(to))) (is Occupied ("NextHole" (to)))) (moveAgain) (if (and (is In (to) (sites Next)) (= 6 (count at:(to)))) (remove (to)))))))) (end (forEach Player if:("NoCounters" Player) (result Player Loss))))) END
Construct a Ludii game based on the following description 5x5 board. Markings in the central square, each corner square, and the central square of each side. Black plays with thirteen pieces, white plays with ten. Black places the first piece on the central square, then players alternate turns placing a piece on their own half of the board. When all of the pieces are placed, players alternate turns moving pieces on space orthogonally. A piece is captured when it is surrounded on two opposite sides by opponent's pieces. Black wins if it can block white from being able to move. White wins if it is impossible for black to block them. ###
(game "Gala" (players 2) (equipment { (board (square 5)) (hand Each) (regions P1 (expand (sites Bottom) steps:2)) (regions P2 (expand (sites Top) steps:2)) (regions "MarkedCells" (union { (sites Centre) (sites Corners) (intersection (sites Outer) (sites Row (row of:(centrePoint)))) (intersection (sites Outer) (sites Column (column of:(centrePoint))))})) (piece "Marker" Each ("StepOrthogonalToEmpty"))}) (rules (start { (place "Marker1" (handSite P1) count:10) (place "Marker2" (handSite P2) count:12) (place "Marker2" (centrePoint))}) phases:{ (phase "Placement" (play (move (from (handSite Mover)) (to (intersection (sites Empty) (sites Mover))))) (nextPhase (and ("HandEmpty" P1) ("HandEmpty" P2)) "Movement")) (phase "Movement" (play (forEach Piece (then ("CustodialCapture")))) (end { (if (no Moves P1) (result P2 Win)) (if (< (count Pieces P2) 2) (result P1 Win))}))})) END
Modify the Ludii game according to the following option changes: A board with side lengths 5 and 6 is currently selected -> A board with side lengths 7 and 8 is currently selected (define "Remove" (forEach Group (if (all Sites (sites) if:(= 0 (count Sites in:(difference (intersection (sites Occupied by:Mover) (sites Direction from:(site) stop:(is Occupied (to)) stopIncluded:True)) (sites))))) (remove (sites))))) (define "Move" (move Add (to (forEach (sites Empty) if:(> (count Pieces Mover in:(sites LineOfSight at:(site))) 0))) #1)) (game "Meridians" (players 2) (equipment { (board (dual (hex Prism 6 5)) use:Vertex) (piece "Disc" Each)}) (rules phases:{ (phase "Opening" (play (move Add (to (if (< 0 (count Sites in:(sites Occupied by:Mover))) (forEach (sites Empty) if:(and (> (count Pieces Mover in:(sites LineOfSight at:(site))) 0) (= (count Sites in:(sites Around (site) Own)) 0))) (sites Empty))))) (nextPhase (= 4 (count Moves)) "Play")) (phase "Play" (play (if (can Move ("Move" ~)) ("Move" (then ("Remove"))) (move Pass (then ("Remove"))))))} (end (if (and (< 4 (count Moves)) (or (= 0 (count Sites in:(sites Occupied by:P1))) (= 0 (count Sites in:(sites Occupied by:P2))))) (result Mover Loss))))) ###
(define "Remove" (forEach Group (if (all Sites (sites) if:(= 0 (count Sites in:(difference (intersection (sites Occupied by:Mover) (sites Direction from:(site) stop:(is Occupied (to)) stopIncluded:True)) (sites))))) (remove (sites))))) (define "Move" (move Add (to (forEach (sites Empty) if:(> (count Pieces Mover in:(sites LineOfSight at:(site))) 0))) #1)) (game "Meridians" (players 2) (equipment { (board (dual (hex Prism 8 7)) use:Vertex) (piece "Disc" Each)}) (rules phases:{ (phase "Opening" (play (move Add (to (if (< 0 (count Sites in:(sites Occupied by:Mover))) (forEach (sites Empty) if:(and (> (count Pieces Mover in:(sites LineOfSight at:(site))) 0) (= (count Sites in:(sites Around (site) Own)) 0))) (sites Empty))))) (nextPhase (= 4 (count Moves)) "Play")) (phase "Play" (play (if (can Move ("Move" ~)) ("Move" (then ("Remove"))) (move Pass (then ("Remove"))))))} (end (if (and (< 4 (count Moves)) (or (= 0 (count Sites in:(sites Occupied by:P1))) (= 0 (count Sites in:(sites Occupied by:P2))))) (result Mover Loss))))) END
Modify the Ludii game according to the following option changes: The pieces follow a track describing by Murray. -> The pieces follow a longer track than the description of Finkel. (define "RemoveAPiece" (move Remove (from))) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" (count Pips))) (game "Royal Game of Ur" (players 2) (equipment { (board (hole (hole (rectangle 3 8) (poly { {4 0} {4 1} {6 1} {6 0}})) (poly { {4 2} {4 3} {6 3} {6 2}})) {(track "Track1" "20,3,W,N1,E6,S,E,N,W,S1,W,S1,E,End" P1 directed:True) (track "Track2" "21,17,W,S1,E6,N,E,S,W,N1,W,N1,E,End" P2 directed:True)}) ("StickDice" 4) (hand Each) (regions "Replay" (sites {"A1" "A3" "D2" "G1" "G3"})) (piece "UrPiece" Each (if ("IsEndTrack" "SiteToMoveOnTrack") "RemoveAPiece" (if ("IsNotOffBoard" "SiteToMoveOnTrack") (if (or (is Empty "SiteToMoveOnTrack") (and (not ("IsFriendAt" "SiteToMoveOnTrack")) (not (is In "SiteToMoveOnTrack" (sites "Replay"))))) (move (from) (to "SiteToMoveOnTrack" ("HittingCapture" (handSite Next))) (then ("ReplayInMovingOn" (sites "Replay"))))))))}) (rules (start { (place "UrPiece1" (handSite P1) count:7) (place "UrPiece2" (handSite P2) count:7)}) (play ("RollMove" (if (!= (count Pips) 0) (or (forEach Piece) (forEach Piece container:(mover)))))) (end ("EscapeWin")))) ###
(define "RemoveAPiece" (move Remove (from))) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" (count Pips))) (game "Royal Game of Ur" (players 2) (equipment { (board (hole (hole (rectangle 3 8) (poly { {4 0} {4 1} {6 1} {6 0}})) (poly { {4 2} {4 3} {6 3} {6 2}})) {(track "Track1" "20,3,W,N1,E6,N,E,S,W,End" P1 directed:True) (track "Track2" "21,17,W,S1,E6,S,E,N,W,End" P2 directed:True)}) ("StickDice" 4) (hand Each) (regions "Replay" (sites {"A1" "A3" "D2" "G1" "G3"})) (piece "UrPiece" Each (if ("IsEndTrack" "SiteToMoveOnTrack") "RemoveAPiece" (if ("IsNotOffBoard" "SiteToMoveOnTrack") (if (or (is Empty "SiteToMoveOnTrack") (and (not ("IsFriendAt" "SiteToMoveOnTrack")) (not (is In "SiteToMoveOnTrack" (sites "Replay"))))) (move (from) (to "SiteToMoveOnTrack" ("HittingCapture" (handSite Next))) (then ("ReplayInMovingOn" (sites "Replay"))))))))}) (rules (start { (place "UrPiece1" (handSite P1) count:7) (place "UrPiece2" (handSite P2) count:7)}) (play ("RollMove" (if (!= (count Pips) 0) (or (forEach Piece) (forEach Piece container:(mover)))))) (end ("EscapeWin")))) END
Construct a Ludii game based on the following description 6x6 board. Each player has twelve sticks. One player's sticks are without bark to distinguish them. Players placing their sticks in empty spaces, filling the central four first. Once all of the sticks have been placed, the players may move their sticks orthogonally one space. If a player can bring three of their sticks in a row, they may then remove one of the opponent's sticks during either phase of the game. During the movement phase, if a player has a row of four pieces and moves one away, leaving a row of three spaces, this also allows the player to capture an opponent's piece. The player who can no longer play loses. ###
(define "CheckLine3LastFrom" (if (and (!= (last From) (ahead (last From) #1)) (= (mover) (who at:(ahead (last From) #1)))) (if (is Line 3 Orthogonal through:(ahead (last From) #1) exact:True) (and (moveAgain) (addScore Mover 1))))) (define "RemoveEnemyPiece" (move Remove (sites Occupied by:Next container:"Board") (then (and (set Score Mover (- (score Mover) 1)) (if (< 1 (score Mover)) (moveAgain)))))) (define "IfLine3MoveAgain" (then (if (is Line 3 Orthogonal exact:True) (and (moveAgain) (addScore Mover 1))))) (define "AddPieceTo" (move (from (handSite Mover)) #1 #2)) (define "FreeCentreSites" (to (forEach (sites Centre) if:(is Empty (site))))) (define "IfCentreFull" (= (count Moves) 4)) (game "Dala" (players 2) (equipment { (board (square 6)) (hand Each) (piece "Stick" Each (if (is Line 4 Orthogonal through:(from) exact:True) ("StepToEmpty" Orthogonal (then (and { ("CheckLine3LastFrom" N) ("CheckLine3LastFrom" S) ("CheckLine3LastFrom" E) ("CheckLine3LastFrom" W)}))) ("StepToEmpty" Orthogonal "IfLine3MoveAgain")))}) (rules (start (place "Stick" "Hand" count:12)) phases:{ (phase "PlacementCenter" (play ("AddPieceTo" "FreeCentreSites")) (nextPhase "IfCentreFull" "Placement")) (phase "Placement" (play (if (!= 0 (score Mover)) "RemoveEnemyPiece" ("AddPieceTo" (to (sites Empty)) "IfLine3MoveAgain"))) (nextPhase ("HandEmpty" P2) "Movement")) (phase "Movement" (play (if (!= 0 (score Mover)) "RemoveEnemyPiece" (forEach Piece))) (end ("HavingLessPiecesLoss" Next 2)))})) END
Construct a Ludii game based on the following description Each stone must move to any adjacent(orthogonal or diagonal) cell, which is occupied by an enemy stone. This stone is captured by replacement. After that, all adjacent enemy stones (orthogonal or diagonal) are converted to friendly ones. There are fewer and fewer stones on the board as the game proceeds, which is a major difference with Othello and Ataxx. The player which has more stones, after there is no valid move left, wins the game. ###
(game "Crusade" (players 2) (equipment { (board (square 8)) (piece "Ball" Each ("StepToEnemy" ~ (then (forEach Site (sites Around (last To)) (if ("IsEnemyAt" (site)) (and (remove (site)) (add (piece (id "Ball" Mover)) (to (site)))))))))}) (rules (start { (place "Ball1" (sites Phase 1)) (place "Ball2" (sites Phase 0))}) (play (forEach Piece)) (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 This game is played on a hexagonal board made up of hexagonal squares, usually 6 squares per side, although other sizes are possible. Initially the board is empty and black pieces are placed in turns until one player passes. The player who passed becomes Black. The other player becomes White and takes the next turn. Play continues, with each player in turn placing pieces of their colour on unoccupied squares on the board. White wins if they manage to connect two opposite sides of the board. Black wins if they manage to connect three non-adjacent sides of the board. To avoid ties, if a player meets the opponent's goal with their pieces, they lose the game. The game is played on a board with 6 hexes per side. You cannot place stones on the edge in the opening phase. ###
(define "IsPlayingPhase" (= 1 (var))) (define "BlackVC" (or ("IsSidesConnected" S NW (sites Side NE)) ("IsSidesConnected" N SW (sites Side SE)))) (define "WhiteVC" (or { ("IsSidesConnected" S N) ("IsSidesConnected" SW NE) ("IsSidesConnected" SE NW)})) (define "IsSidesConnected" (is Connected {(sites Side #1) (sites Side #2) #3})) (game "Unlur" (players 2) (equipment { (board (hex 6)) (piece "Disc" Each)}) (rules phases:{ (phase "Opening" (play (or (move Add (piece (id "Disc" P2)) (to (intersection (sites Empty) (sites Inner)))) (move Pass (then (if (is Mover P1) (swap Players P1 P2 (then (note "Player 1 is now Black. Player 2 is now White." to:All))) (note "Player 1 remains White. Player 2 remains Black." to:All) (then (do (set NextPlayer (player 1)) next:(set Var 1)))))))) (nextPhase ("IsPlayingPhase") "Playing")) (phase "Playing" (play (move Add (to (sites Empty)))))} (end { (if (and {("IsPlayingPhase") (= (id P1) (mover)) ("BlackVC") (not ("WhiteVC"))}) (result P1 Loss)) (if (and {("IsPlayingPhase") (= (id P2) (mover)) ("WhiteVC") (not ("BlackVC"))}) (result P2 Loss)) (if (and {("IsPlayingPhase") (= (id P1) (mover)) ("WhiteVC")}) (result P1 Win)) (if (and {("IsPlayingPhase") (= (id P2) (mover)) ("BlackVC")}) (result P2 Win))}))) END
Construct a Ludii game based on the following description Four 3x8 rectangles, arranged in a cross. In the outer rows of each arm, the third square from the outer corners is marked with an X. In two opposite arms, the bottom left corner is marked with \ ###
(define "Move" (or { (if (and { (>= 0 (var "EnteredPiece")) (is Occupied (handSite Mover)) ("Bange")}) (move (from (handSite Mover)) (to (mapEntry "DefaultEntry" Mover)) (then (set Var "EnteredPiece" 1)))) (if (and { (>= 0 (var "EnteredPiece")) (is Occupied (handSite Mover)) ("Dust")}) (move (from (handSite Mover)) (to (mapEntry "DefaultEntry" Mover)) (then (set Var "EnteredPiece" 1)))) (if (and { (>= 0 (var "EnteredPiece")) (is Occupied (handSite Mover)) ("Dust")}) (move (from (handSite Mover)) (to (mapEntry "XEntry" Mover)))) (forEach Piece)})) (define "Dust" (= ("ThrowValue") 11)) (define "Bange" (= ("ThrowValue") 25)) (define "IsSpecialThrow" (is In ("ThrowValue") (sites {12 25 11 6}))) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" #2 #1)) (define "ThrowValue" (mapEntry "Throw" (count Pips))) (game "Bargese" (players 2) (equipment { ("PachisiBoard" { (track "Track1" "26,W,S,E,8,S,E,N,11,E,N,W,53,N,W,S,42,W,S1,E7,End" P1 directed:True) (track "Track2" "27,E,N,W,53,N,W,S,42,W,S,E,8,S,E,N,11,E,N1,W7,End" P2 directed:True)}) (hand Each) ("StickDice" 6) (piece "Pawn" Each (if (and { (>= 0 (var "EnteredPiece")) ("IsEndTrack" ("SiteToMoveOnTrack" from:(from) 1)) (or ("Bange") ("Dust"))}) (move Remove (from) level:(level) (then (set Var "EnteredPiece" 1))) (if (and (>= 0 (var "EnteredPiece")) ("IsEndTrack" ("SiteToMoveOnTrack" from:(from) 2))) (move (from (from)) (to ("SiteToMoveOnTrack" from:(from) 1))) (move (from (from) level:(level)) (to ("SiteToMoveOnTrack" from:(from) (if (< 0 (var "EnteredPiece")) (- ("ThrowValue") 1) ("ThrowValue"))) if:(not (and (is In (to) (sites "SafeSites")) ("IsEnemyAt" (to)))) ("HittingStackCapture" (handSite (who at:(to) level:(level))))) (then (set Var "EnteredPiece" 0)))))) (map "Throw" {(pair 0 6) (pair 1 11) (pair 2 2) (pair 3 3) (pair 4 4) (pair 5 25) (pair 6 12)}) (map "DefaultEntry" {(pair P1 26) (pair P2 27)}) (map "XEntry" {(pair P1 2) (pair P2 48)}) (regions "SafeSites" (sites {60 62 16 48 87 89 37 2}))}) (rules (start { (place Stack "Pawn1" (handSite P1) count:4) (place Stack "Pawn2" (handSite P2) count:4)}) (play (do (if (>= 0 (var "EnteredPiece")) (roll)) next:(if (can Move ("Move")) ("Move") (move Pass (then (set Var "EnteredPiece" 0)))) (then (if ("IsSpecialThrow") (moveAgain))))) (end ("EscapeWin")))) END
Construct a Ludii game based on the following description Play occurs on a 3x3 grid. One player places an X, the other places an O and players take turns placing their marks in the grid, losing is they make three in a row of their colour. ###
(game "Tic-Tac-Toe Misere" (players 2) (equipment { (board (square 3)) (piece "Disc" P1) (piece "Cross" P2)}) (rules (play (move Add (to (sites Empty)))) (end (if (is Line 3) (result Next Win))))) END
Modify the Ludii game according to the following option changes: Chess rooks are added to the game. -> Chess knights are added to the game. (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)))) (game "The Pawn Game" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) ("ChessPawn" "Pawn" (or "InitialPawnMove" "EnPassant")) ("ChessRook" "Rook") (regions P1 (sites Top)) (regions P2 (sites Bottom))}) (rules (start { (place "Pawn1" (sites Row 1)) (place "Pawn2" (sites Row 6)) (place "Rook1" {"A1" "H1"}) (place "Rook2" {"A8" "H8"})}) (play (forEach Piece)) (end { ("ReachWin" (sites Mover) Mover) ("BlockWin")}))) ###
(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)))) (game "The Pawn Game" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) ("ChessPawn" "Pawn" (or "InitialPawnMove" "EnPassant")) ("ChessKnight" "Knight") (regions P1 (sites Top)) (regions P2 (sites Bottom))}) (rules (start { (place "Pawn1" (sites Row 1)) (place "Pawn2" (sites Row 6)) (place "Knight1" {"B1" "G1"}) (place "Knight2" {"B8" "G8"})}) (play (forEach Piece)) (end { ("ReachWin" (sites Mover) Mover) ("BlockWin")}))) END
What does the following global Ludii definition do? (define "IsEndTrack" (= #1 End)) ###
Checks if a site returned by a track is the ending site of the track. END
Construct a Ludii game based on the following description 4x6-28 board; 16-20 is most common, only even numbers of holes. Two counters in each hole except the leftmost on the inner row, which is left empty, and the one to its right which contains one counter. Players sow by picking up the counters in any of their holes and sowing them in an anti-clockwise direction. Sowing continues when the last counter falls into an occupied hole by picking up the counters in that hole and continuing in the same direction. When the final counter lands in an empty hole in the inner row, the counters in the opponent's hole opposite in the inner row are captured; if there are also counters in the opponent's outer row opposite, these are also captured. The player is also entitled to capture counters in any other hole on the opponent's side. The turn ends with a capture and the opponent's turn begins. Play always begins with a stylized move, where the counters are taken from the third hole from the left in the inner row, sowing and making captures as described above. Players may not sow single counters unless there are no holes on their side containing multiple counters. Play ends when one player has captured all of their opponent's counters. Each player has 16 holes per row. ###
(define "PiecesOwnedBy" (+ (count Cell at:(handSite #1)) (count in:(sites #1 "Home")))) (define "Sow" (then (sow "Track" owner:(mover) apply:(if (> (count at:(to)) 1) (moveAgain) (if (is In (to) (sites Mover "Inner")) (and { (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))) (if (> (count at:("OppositePit" (to))) 0) (fromTo (from ("OppositePit" (to))) (to (handSite Mover)) count:(count at:("OppositePit" (to))))) (if (> (count at:("OppositeOuterPit" (to))) 0) (fromTo (from ("OppositeOuterPit" (to))) (to (handSite Mover)) count:(count at:("OppositeOuterPit" (to))))) (set Pending) (moveAgain)})))))) (define "StylizedMove" (if (is Mover P1) (difference (expand (intersection (sites Row 1) (sites Left)) steps:2 E) (expand (intersection (sites Row 1) (sites Left)) steps:1 E)) (difference (expand (intersection (sites Row 2) (sites Right)) steps:2 W) (expand (intersection (sites Row 2) (sites Right)) steps:1 W)))) (define "MoveAgainAfterCapture" (and (is Pending) ("SameTurn"))) (define "Columns" 16) (game "Mefuvha" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "Track1" "0,E,N1,W" loop:True P1) (track "Track2" "32,E,N1,W" loop:True P2)}) (regions "Home" P1 (sites Track "Track1")) (regions "Home" P2 (sites Track "Track2")) (regions "Inner" P1 (difference (sites Track "Track1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "Track2") (sites Top))) (piece "Seed" Shared) (hand Each)}) (rules (start { (set Count 2 to:(difference (union (sites P1 "Home") (sites P2 "Home")) (union (expand (intersection (sites Row 1) (sites Left)) steps:1 E) (expand (intersection (sites Row 2) (sites Right)) steps:1 W)))) (set Count 1 to:(union (difference (expand (intersection (sites Row 1) (sites Left)) steps:1 E) (sites Left)) (difference (expand (intersection (sites Row 2) (sites Right)) steps:1 W) (sites Right))))}) (play (if "MoveAgainAfterCapture" (move Select (from (sites Next "Home") if:(> (count at:(from)) 0)) (then (fromTo (from (last From)) (to (handSite Mover)) count:(count at:(last From))))) (priority (move Select (from (if ("SameTurn") "LastHoleSowed" (if (< (count Turns) 3) "StylizedMove" (sites Mover "Home"))) if:(> (count at:(from)) 1)) "Sow") (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover "Home")) if:(= (count at:(from)) 1)) "Sow")))) (end ("MancalaByScoreWhen" (no Moves Mover))))) END
Construct a Ludii game based on the following description The rules are the same as for Chess, except instead of moving a piece, a player's turn may be taken by replacing a captured piece on the board on any empty space. This piece is controlled by the player who replaced it. Captured pawns cannot be placed in the first or last row. ###
(define "CaptureForwardDiagonal" (move Step (directions {FR FL}) (to if:("IsEnemyAt" (to)) (apply (add (piece (mapEntry "captured" (what at:(to)))) (to (mapEntry "where" (what at:(to))))))))) (define "EnPassant" (move Step (directions {FR FL}) (to if:"InLocationEnPassant") (then (add (piece (mapEntry "captured" (what at:(ahead (last To) Backward)))) (to (mapEntry "where" (what at:(ahead (last To) Backward)))))))) (define "InLocationEnPassant" (and (is Pending) (= (to) (value Pending)))) (define "SetEnPassantLocation" (then (set Pending (ahead (last To) Backward)))) (define "BigCastling" ("DoCastle" "King" W 2 "KingNotCheckedAndToEmpty" (then (and ("PieceHasMoved") ("DoCastle" "RookLeft" E 3 True))))) (define "SmallCastling" ("DoCastle" "King" E 2 "KingNotCheckedAndToEmpty" (then (and ("PieceHasMoved") ("DoCastle" "RookRight" W 2 True))))) (define "DoCastle" (move Slide (from (mapEntry #1 (mover))) #2 (between (exact #3) if:#4) #5)) (define "KingNotCheckedAndToEmpty" (and (is Empty (to)) (not ("IsInCheck" "King" Mover at:(to))))) (define "CaptureToPieceAndResetCounter" (apply (if ("IsEnemyAt" (to)) (add (piece (mapEntry "captured" (what at:(to)))) (to (mapEntry "where" (what at:(to)))) (then (set Counter)))))) (define "RememberPieceHasMoved" (then (if (= (state at:(last To)) 1) "PieceHasMoved"))) (define "PieceHasMoved" (set State at:(last To) 0)) (define "HasNeverMoved" (= (state at:(mapEntry #1 (mover))) 1)) (define "KingInTheInitialPlace" ("IsPieceAt" "King" Mover (mapEntry "King" (mover)))) (define "NextCanNotMove" (not (can Move (do (or { (forEach Piece Next) (move (from (sites Occupied by:Next container:"Hand" components:{"Rook" "Bishop" "Knight" "Queen"})) (to (sites Empty))) (move (from (sites Occupied by:Next container:"Hand" component:"Pawn")) (to (difference (sites Empty) (sites "LastRanks"))))}) ifAfterwards:(not ("IsInCheck" "King" Next)))))) (game "Loop Chess" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) (piece "Pawn" Each (or { (if (is In (from) (sites Start (piece (what at:(from))))) ("DoubleStepForwardToEmpty" "SetEnPassantLocation")) "StepForwardToEmpty" "CaptureForwardDiagonal" "EnPassant"} (then (and (if (is In (last To) (sites Mover "Promotion")) (moveAgain)) (set Counter))))) (piece "Rook" Each (move Slide Orthogonal (to if:("IsEnemyAt" (to)) "CaptureToPieceAndResetCounter") "RememberPieceHasMoved")) (piece "King" Each (move Step (to if:(not ("IsFriendAt" (to))) "CaptureToPieceAndResetCounter") "RememberPieceHasMoved")) (piece "Bishop" Each (move Slide Diagonal (to if:("IsEnemyAt" (to)) "CaptureToPieceAndResetCounter"))) (piece "Knight" Each (move Leap "KnightWalk" (to if:(not ("IsFriendAt" (to))) "CaptureToPieceAndResetCounter"))) (piece "Queen" Each (move Slide (to if:("IsEnemyAt" (to)) "CaptureToPieceAndResetCounter"))) (map "where" {(pair 2 64) (pair 1 70) (pair 4 65) (pair 3 71) (pair 6 66) (pair 5 72) (pair 8 67) (pair 7 73) (pair 10 68) (pair 9 74) (pair 12 69) (pair 11 75)}) (map "captured" {(pair 1 2) (pair 2 1) (pair 3 4) (pair 4 3) (pair 5 6) (pair 6 5) (pair 7 8) (pair 8 7) (pair 9 10) (pair 10 9) (pair 11 12) (pair 12 11)}) (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 "LastRanks" (union (sites Top) (sites Bottom))) (regions "Promotion" P1 (sites Top)) (regions "Promotion" P2 (sites Bottom)) (hand Each size:6)}) (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)}) (play (if "SameTurn" (move Promote (last To) (piece {"Queen" "Knight" "Bishop" "Rook"}) Mover) (do (or { (move (from (sites Occupied by:Mover container:"Hand" components:{"Rook" "Bishop" "Knight" "Queen"})) (to (sites Empty))) (move (from (sites Occupied by:Mover container:"Hand" component:"Pawn")) (to (difference (sites Empty) (sites "LastRanks")))) (forEach Piece) (if (and { "KingInTheInitialPlace" ("HasNeverMoved" "King") (not ("IsInCheck" "King" Mover))}) (or (if (and ("HasNeverMoved" "RookLeft") (can Move ("DoCastle" "RookLeft" E 3 (is Empty (to))))) "BigCastling") (if (and ("HasNeverMoved" "RookRight") (can Move ("DoCastle" "RookRight" W 2 (is Empty (to))))) "SmallCastling")))}) ifAfterwards:(not ("IsInCheck" "King" Mover))))) (end { (if (and ("IsInCheck" "King" Next) ("NextCanNotMove")) (result Mover Win)) (if (or (no Moves Mover) (= (counter) 100)) (result Mover Draw))}))) END
Construct a Ludii game based on the following description Three concentric squares, with the midpoints of their sides connected with lines. Twelve pieces per player. Players take turns placing one of their pieces on an empty point on the board. The first player to make three in a row obtains the privilege of starting the next phase after all of the stones are placed; if no one makes three in a row the last player to place a stone begins the next phase. Ones all of the stones are placed, the player who has the right to begin the next phase removes any one of the opponent's stones, and the opponent does the same with one of the player's pieces. Then, players alternate turns moving one of their pieces to an empty adjacent space. When a player place three of their pieces in a row, they remove one of the opponent's pieces. If a player moves in such a way that the opponent cannot move, the player must make an extra move to allow the opponent a place to play. A player cannot capture an opponent's piece when this extra move is made. The player who captures all but two of the opponent's pieces wins. Games are usually played in sequence, starting with the winner of the previous game, with the first player to win five games in a row being the winner. ###
(define "ResetGame" (and { (remove (sites Occupied by:All)) (add (piece (id "Marker" P1)) (to (handSite P1)) count:12) (add (piece (id "Marker" P2)) (to (handSite P2)) count:12)})) (define "RemoveEnemyPiece" (move Remove (sites Occupied by:Next container:"Board") #1)) (define "IfLine3MoveAgain" (then (if (and ("NewTurn") (is Line 3)) (moveAgain) (if (no Moves Next) (and (moveAgain) (set Pending)))))) (define "SetPlayerSecondPhase" (and (if (and (< (var) 1) (is Line 3)) (set Var #1)) (if (and ("HandEmpty" P1) ("HandEmpty" P2)) (if (< ("PlayerSecondPhase") 1) (moveAgain) (set NextPlayer (player ("PlayerSecondPhase"))))))) (define "PlayerSecondPhase" (var)) (game "Shah" (players 2) (equipment { ("NineMensMorrisBoard") (piece "Marker" Each ("StepToEmpty" ~ "IfLine3MoveAgain")) (hand Each)}) (rules (start (place "Marker" "Hand" count:12)) phases:{ (phase "Placement" (play (move (from (handSite Mover)) (to (sites Empty)) (then ("SetPlayerSecondPhase" (mover))))) (nextPhase (and ("HandEmpty" P1) ("HandEmpty" P2)) "Remove")) (phase "Remove" (play ("RemoveEnemyPiece")) (nextPhase Mover "Move")) (phase "Move" (play (if (and (not (is Pending)) "SameTurn") ("RemoveEnemyPiece" (then (if (no Moves Next) (and (moveAgain) (set Pending))))) (if (is Pending) (do (forEach Piece ("StepToEmpty")) ifAfterwards:(can Move (forEach Piece Next))) (forEach Piece)) (then (if (= 2 (count Pieces P1)) (addScore P2 1 (then (if (!= (score P2) 5) ("ResetGame")))) (if (= 2 (count Pieces P2)) (addScore P1 1 (then (if (!= (score P1) 5) ("ResetGame"))))))))) (nextPhase (= 0 (count Sites in:(sites Occupied by:All container:"Board"))) "Placement"))} (end (if (= (score Mover) 5) (result Mover Win))))) END
Construct a Ludii game based on the following description 5x5 intersecting lines, with diagonals in each square formed by the lines. Twenty pieces per player, which each player places on the points on their side of the board, as well as the two points to the left of the central space. The central spot remains empty. Players alternate turns by moving a piece to an adjacent empty spot along the lines on the board. A player may capture an opponent's piece by hopping over one adjacent piece if there is an empty spot behind it along a line on the board. The player who captures all of the opponent's pieces wins. ###
(game "Bis Gutiya" (players 2) (equipment { (board (square 5 diagonals:Solid) use:Vertex) (piece "Marker" Each (or ("StepToEmpty") ("HopCapture")))}) (rules ("BeforeAfterCentreSetup" "Marker1" "Marker2") (play (forEach Piece)) (end ("CaptureAll" Next)))) END
Construct a Ludii game based on the following description 4x6-21 board; 8 is most common, 12, 15, and 18 are also popular. Two counters in each hole in the players' outer rows. Before the game starts, players choose to make additional captures from one, two, or three holes. Sowing occurs in an anti-clockwise direction, only in the two rows belonging to the player. When the final counter lands in an occupied hole, these are picked up and sowing continues. When the final counter lands in an empty hole in the inner row, any counters in the opposite hole in the opponent's inner row are captured. If there also are counters in the opposite hole in the opponent's outer row, these are also captured, but only if there was first a capture from the inner row hole. The player then captures again, from the agreed-upon number of extra holes, chosen from any of the opponent's holes. Players cannot sow from a hole with a single counter unless there are no holes with multiple counters. Single counters can only be sown into an empty hole. Play continues until one player has captured all of the opponent's counters, thus winning the game. 3 extra captures. 8 Holes per row. ###
(define "HaveToMakeExtraCapture" (set Var 3)) (define "NumCapture" (var)) (define "NextHoleFrom" ("NextSiteOnTrack" 1 from:#1 #2)) (define "AHoleHasMoreThanOneCounter" (not (all Sites (forEach (sites Mover) if:(< 1 (count at:(site)))) if:(= 0 (count at:(site)))))) (define "NoPiece" (all Sites (sites Player "Home") if:(= 0 (count at:(site))))) (define "Columns" 8) (game "Tsoro (Additional Capture)" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "Track1" "0,E,N1,W" loop:True P1) (track "Track2" "16,E,N1,W" loop:True P2)}) (regions "Home" P1 (sites Track "Track1")) (regions "Home" P2 (sites Track "Track2")) (regions "Inner" P1 (difference (sites Track "Track1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "Track2") (sites Top))) (piece "Seed" Shared)}) (rules (start (set Count 2 to:(union (sites Top) (sites Bottom)))) (play (if (< 0 ("NumCapture")) (move Remove (forEach (sites Next) if:(< 0 (count at:(site)))) (then (and (if (< 1 ("NumCapture")) (moveAgain)) (set Var (- ("NumCapture") 1))))) (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover "Home")) if:(if "AHoleHasMoreThanOneCounter" (> (count at:(from)) 1) (and (= (count at:(from)) 1) (= 0 (count at:("NextHoleFrom" (from) Mover)))))) (then (sow "Track" owner:(mover) apply:(if (= (count at:(to)) 1) (if (is In (to) (sites Mover "Inner")) (if (> (count at:("OppositePit" (to))) 0) (and { (remove ("OppositePit" (to))) (if (> (count at:("OppositeOuterPit" (to))) 0) (remove ("OppositeOuterPit" (to)))) (moveAgain) ("HaveToMakeExtraCapture")}))) (moveAgain))))))) (end (forEach NonMover if:("NoPiece") (result Player Loss))))) END
Construct a Ludii game based on the following description Starting of the game, the player can select the goal of the puzzle, which can be spanning tree or caterpillar tree. This game has two versions: addition and deletion version. At the addition version, the board graph is initially uncoloured. Players take turns to colour an uncoloured edge by a common colour. After colouring some edges, if the player makes a spanning tree (or caterpillar tree), he wins. At the other version, the game starts with all the same coloured edges. At each turn, a player chooses to remove the colour of a coloured edge. After removing some coloured edges, if the player makes his desired tree (spanning or caterpillar tree), he wins. The game is played on the Graph1. The players play on Addition version. ###
(game "SpanRups" (players 1) (equipment { (board (graph vertices:{ {0 0} {0 1} {0 2} {0 3} {0 4} {1 0} {1 1} {1 2} {1 3} {1 4} {2 0} {2 1} {2 2} {2 3} {2 4} {3 0} {3 1} {3 2} {3 3} {3 4} {4 0} {4 1} {4 2} {4 3} {4 4}} edges:{ {0 1} {0 5} {0 6} {1 6} {1 2} {1 5} {2 7} {2 3} {3 8} {3 4} {3 9} {4 8} {4 9} {5 6} {5 10} {6 11} {6 7} {6 12} {7 12} {7 8} {8 13} {8 9} {9 14} {7 11} {7 13} {8 12} {10 11} {11 12} {12 13} {13 14} {10 15} {11 16} {11 17} {12 16} {12 17} {12 18} {13 17} {13 18} {14 19} {15 16} {15 20} {15 21} {16 20} {16 21} {20 21} {16 17} {17 22} {21 22} {17 18} {18 23} {22 23} {18 19} {18 24} {19 23} {19 24} {23 24}}) use:Edge) (piece "Marker" Each)}) (rules (play (move Add (to Edge (sites Empty Edge)))) (end { (if (no Moves Mover) (result Mover Loss)) (if (is SpanningTree Mover) (result Mover Win))}))) END
Modify the Ludii game according to the following option changes: The game is played on a board with 7 hexes per side. -> The game is played on a board with 8 hexes per side. (define "IsPlayingPhase" (= 1 (var))) (define "BlackVC" (or ("IsSidesConnected" S NW (sites Side NE)) ("IsSidesConnected" N SW (sites Side SE)))) (define "WhiteVC" (or { ("IsSidesConnected" S N) ("IsSidesConnected" SW NE) ("IsSidesConnected" SE NW)})) (define "IsSidesConnected" (is Connected {(sites Side #1) (sites Side #2) #3})) (game "Unlur" (players 2) (equipment { (board (hex 7)) (piece "Disc" Each)}) (rules phases:{ (phase "Opening" (play (or (move Add (piece (id "Disc" P2)) (to (intersection (sites Empty) (sites Inner)))) (move Pass (then (if (is Mover P1) (swap Players P1 P2 (then (note "Player 1 is now Black. Player 2 is now White." to:All))) (note "Player 1 remains White. Player 2 remains Black." to:All) (then (do (set NextPlayer (player 1)) next:(set Var 1)))))))) (nextPhase ("IsPlayingPhase") "Playing")) (phase "Playing" (play (move Add (to (sites Empty)))))} (end { (if (and {("IsPlayingPhase") (= (id P1) (mover)) ("BlackVC") (not ("WhiteVC"))}) (result P1 Loss)) (if (and {("IsPlayingPhase") (= (id P2) (mover)) ("WhiteVC") (not ("BlackVC"))}) (result P2 Loss)) (if (and {("IsPlayingPhase") (= (id P1) (mover)) ("WhiteVC")}) (result P1 Win)) (if (and {("IsPlayingPhase") (= (id P2) (mover)) ("BlackVC")}) (result P2 Win))}))) ###
(define "IsPlayingPhase" (= 1 (var))) (define "BlackVC" (or ("IsSidesConnected" S NW (sites Side NE)) ("IsSidesConnected" N SW (sites Side SE)))) (define "WhiteVC" (or { ("IsSidesConnected" S N) ("IsSidesConnected" SW NE) ("IsSidesConnected" SE NW)})) (define "IsSidesConnected" (is Connected {(sites Side #1) (sites Side #2) #3})) (game "Unlur" (players 2) (equipment { (board (hex 8)) (piece "Disc" Each)}) (rules phases:{ (phase "Opening" (play (or (move Add (piece (id "Disc" P2)) (to (intersection (sites Empty) (sites Inner)))) (move Pass (then (if (is Mover P1) (swap Players P1 P2 (then (note "Player 1 is now Black. Player 2 is now White." to:All))) (note "Player 1 remains White. Player 2 remains Black." to:All) (then (do (set NextPlayer (player 1)) next:(set Var 1)))))))) (nextPhase ("IsPlayingPhase") "Playing")) (phase "Playing" (play (move Add (to (sites Empty)))))} (end { (if (and {("IsPlayingPhase") (= (id P1) (mover)) ("BlackVC") (not ("WhiteVC"))}) (result P1 Loss)) (if (and {("IsPlayingPhase") (= (id P2) (mover)) ("WhiteVC") (not ("BlackVC"))}) (result P2 Loss)) (if (and {("IsPlayingPhase") (= (id P1) (mover)) ("WhiteVC")}) (result P1 Win)) (if (and {("IsPlayingPhase") (= (id P2) (mover)) ("BlackVC")}) (result P2 Win))}))) END
Construct a global Ludii definition which fulfills the following requirements. Checks if a site returned by a track is not the ending site of the track. ###
(define "IsNotEndTrack" (!= #1 End)) END
Construct a Ludii game based on the following description Use Options to select a board size. Goal: Be the last to play. Then the first player (Maroon) places a stone, after which the players alternate, taking up to two moves per turn. To move, either: 1. Add a stone to an empty space that is not in line-of-sight of any opponent's stone. -Or, 2. Slide a stone along a straight line to a new position, with the following restriction: Either -- A. The new location must have a greater number of opponent's stones adjacent to it, or -- B. The new location must have more sight-lines to opponent's stones than the old location, while keeping number of adjacent opponent's stones the same. To avoid forfeiting the game, a player must move at least once on a turn. The second move can be voluntarily skipped. The winner is last to play. The score shown is a count of the available moves at the beginning of a player's turn for use by the AI. Extra small board (39 nodes) as a filler game and for learning how to play ###
(define "Perf7" (board (dual (remove (hex "Jungle") cells:{12 25 34 41 50 57 66 75 82 91 98 107 116 123 131 144 150 161})) use:Vertex)) (define "Perf6" (board (dual (remove (hex 8) cells:{0 4 5 6 7 8 13 17 20 27 28 35 44 49 54 61 62 65 72 76 77 84 91 92 96 103 106 107 114 119 124 133 140 141 148 151 155 160 161 162 163 164 168})) use:Vertex)) (define "Perf5" (board (dual (remove (hex 7 8) cells:{0 1 2 3 4 5 6 7 8 9 10 11 12 16 17 18 19 26 27 34 38 43 50 53 60 63 64 71 76 77 82 89 92 99 108 116 123 130 131 132 136 137 138 139 140 141 142 143 144 145 146})) use:Vertex)) (define "Perf4" (board (dual (remove (hex 6) cells:{0 1 5 12 17 23 30 37 40 45 50 53 60 67 73 78 85 89 90})) use:Vertex)) (define "Perf3" (board (dual (remove (hex 5 6) cells:{0 1 2 3 4 5 6 7 11 12 13 14 21 25 30 37 42 53 63 64 65 69 70 71 72 73 74})) use:Vertex)) (define "Perf2" (board (dual (remove (hex 4 5) cells:{0 1 15 20 25 32 36 39 44})) use:Vertex)) (define "Jungle" (poly { { -3.5 -11.75} { -10.0 -5.25} { -6.75 12.0} { 1.25 14.75} { 15.25 3.25} { 14.0 -5.75}})) (define "BoardUsed" "Perf2") (define "LoSDirection" Orthogonal) (define "PassEnd" (if (and ("SameTurn") (no Moves Next)) (result Mover Win))) (define "ScoreTerritory" (and ("MPScoring" Mover Next) ("MPScoring" Next Mover))) (define "MPScoring" (set Score #1 (+ (size Array (array (sites From ("Movement" #1)))) (count Sites in:(difference ("SitesControlledBy" #1) ("SitesControlledBy" #2)))))) (define "Movement" (forEach Piece (do (and (set Var "LoSFrom" ("LoSAt" (from))) (set Var "QtyAroundFrom" ("QtyAround" (from)))) next:(move Slide "LoSDirection") ifAfterwards:(or (> ("QtyAround" (last To)) (var "QtyAroundFrom")) (and (= ("QtyAround" (last To)) (var "QtyAroundFrom")) (> ("LoSAt" (last To)) (var "LoSFrom"))))) #1)) (define "Placement" (move Add (piece (mover)) (to (difference (sites Empty) ("SitesControlledBy" Next))))) (define "SitesControlledBy" (sites (results from:(sites Occupied by:#1) to:(sites LineOfSight Empty at:(from) "LoSDirection") (to)))) (define "LoSAt" (count Pieces Next in:(sites LineOfSight Piece at:#1 "LoSDirection"))) (define "QtyAround" (count Pieces Next in:(sites Around #1 "LoSDirection"))) (game "Epoxy" (players 2) (equipment { "BoardUsed" (piece "Ball" Each (move Slide))}) (rules (start (set Score Each 0)) (play (or { ("Placement") ("Movement" Mover) (if (and (not (is Prev Next)) (< 0 (counter))) (move Pass))} (then (if (is Prev Next) (moveAgain) ("ScoreTerritory"))))) (end "PassEnd"))) END
Describe the mechanics of the following Ludii game (define "CanEscape" ("IsOffBoard" #1)) (define "AllPieceEscaped" (no Pieces Mover)) (define "Bar" (mapEntry (mover))) (define "RemoveAPiece" (move Remove (site))) (define "NextSiteFromDist6" ("NextSiteOnTrack" 6 from:#1)) (define "NextSiteFrom" ("NextSiteOnTrack" (pips) from:#1)) (game "Imperial" (players 2) (equipment { ("BackgammonBoard" ("BackgammonTracksWithBar")) (dice num:3) (map {(pair 1 19) (pair 2 6)}) (piece "Disc" Each)}) (rules (start { (place Stack "Disc1" 10 count:5) (place Stack "Disc1" 11 count:5) (place Stack "Disc1" 12 count:5) (place Stack "Disc2" 23 count:5) (place Stack "Disc2" 24 count:5) (place Stack "Disc2" 25 count:5)}) (play ("RollEachNewTurnMove" (forEach Die if:("DieNotUsed") (forEach Site (sites Occupied by:Mover) (if ("CanEscape" ("NextSiteFrom" (site))) ("RemoveAPiece") (move (from (site)) (to ("NextSiteFrom" (site)) if:("NoEnemyOrOnlyOne" (to)) ("HittingCapture" ("Bar")))))) (then ("ReplayNotAllDiceUsed"))))) (end (if ("AllPieceEscaped") (result Mover Win))))) ###
2x12 board, divided in half, where the spaces are rendered as points. Fifteen pieces per player. Three six-sided dice. 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. Pieces begin on the board, five each on the sixth, seventh, and eighth point in 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. A piece cannot move to a point that is occupied by more than one of the opponent's pieces. If a piece lands on a point occupied by a single piece belonging to the opponent, the opponent's piece is removed from the board and must enter again from the beginning of the player's track. A piece may be borne off the board when a throw is greater than the number of points left on the board. The first player to bear all of their pieces off the board wins. END
Construct a Ludii game based on the following description The game is played on a sheet of graph paper, with any set of designs traced out. It is most commonly played on rectangular board like a 6×6 square. Two players have a collection of dominoes which they place on the grid in turn. A player can place a domino either horizontally or vertically. Contrary to the related game of Domineering, the possible moves are the same for the two players, and Cram is then an impartial game. As for all impartial games, there are two possible conventions for victory: in the normal game, the first player who cannot move loses, and on the contrary, in the misere version, the first player who cannot move wins. The board has 6 rows. The board has 6 columns. The Last player to play wins. ###
(game "Cram" (players 2) (equipment { (board (rectangle 6 6)) (tile "Tile" P1 {F} numSides:4) (tile "Tile" P2 {F} numSides:4)}) (rules (play (or (move Add (piece (mover) state:0) (to (sites Empty))) (move Add (piece (mover) state:1) (to (sites Empty))))) (end ("NoMoves" Loss)))) END
Construct a Ludii game based on the following description MOVE - Stones may move to an adjacent (orthogonal or diagonal) empty cell. CAPTURE - Stones capture by jumping over an enemy stone and landing in the immediate opposite empty cell. - Captures are mandatory. - Captures are multiple and the player must choose the jumping sequence that captures more enemy stones. GOAL - A player wins when it captures all enemy stones, or when he moves his last remaining stone to the center cell. ###
(game "Jumping Beans" (players 2) (equipment { (board (square 7)) (piece "Bean" Each ("StepToEmpty"))}) (rules ("BeforeAfterCentreSetup" "Bean1" "Bean2") (play (if ("SameTurn") (max Moves ("HopCapture" (from (last To)) ~ (then ("ReplayIfCanMove" ("HopCapture" (from (last To))))))) (priority { (max Moves (forEach Piece ("HopCapture" ~ ~ (then ("ReplayIfCanMove" ("HopCapture" (from (last To)))))))) (forEach Piece)}))) (end (if (or (no Pieces Next) (and (= 1 (count Pieces Mover)) (= (centrePoint) (where "Bean" Mover)))) (result Mover Win))))) END
Construct a Ludii game based on the following description 2x6 board. 72 counters are distributed unevenly into the holes with the only rule that corresponding holes on either side of the board must contain counters. The opponent moves first, but may flip the board around if they prefer that arrangement, sacrificing the first move. Counters are sowed in an anti-clockwise direction from a hole in the player's row. If the last counter falls into a hole making it odd, these are picked up and sowing continues. If it lands in a hole making it even, these counters are captured as are the ones in the opposite hole. If the previous hole also has an even number, these and the ones in the opposite hole are captured. If the last counter falls into an empty hole, the turn ends. If a player has no counters in their holes, the opponent must give them one counter, to be placed in the leftmost hole and played from there. Play ends when the board is cleared of counters. Each player counts the number of counters they captured. The player with more counters is given a score equal to the difference in the number of counters. Another round begins again exactly as before. The game is won when a player accumulates sixty points. ###
(define "EmptyBoard" (all Sites (sites Board) if:(= 0 (count at:(site))))) (define "NoCounters" (all Sites (sites #1) if:(= 0 (count at:(site))))) (define "CorrespondingHolesHaveSeeds" (all Sites (sites Bottom) if:(if (is Empty (site)) (is Empty (+ (site) "Columns")) (is Occupied (+ (site) "Columns"))))) (define "Columns" 6) (game "Li'b al-'Aqil" (players 2) (equipment { (mancalaBoard 2 "Columns" store:None (track "Track" "0,E,N,W" loop:True)) (piece "Seed" Shared) (hand Each) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map "LeftMost" {(pair P1 0) (pair P2 11)})}) (rules (start (place "Seed" (handSite P1) count:72)) phases:{ (phase "Opening1" (play (or { (if (is Occupied Cell (handSite P1)) (forEach Value min:1 max:(count Cell at:(handSite P1)) (move (from (handSite P1)) (to (sites Board)) count:(value))) (forEach Site (sites Board) (if (is Occupied (site)) (move (from (site)) (to (sites Board) if:(!= (to) (from)))))) (then (moveAgain))) (if (and (is Empty (handSite P1)) ("CorrespondingHolesHaveSeeds")) (move Pass))})) (nextPhase (was Pass) "Opening2")) (phase "Opening2" (play (or (move Pass (then (moveAgain))) (move Swap Players P1 P2) (then (set Pending)))) (nextPhase "Sowing")) (phase "Sowing" (play (if (and ("NewTurn") ("NoCounters" Next)) (move (from (sites Mover) if:(is Occupied (from))) (to (mapEntry "LeftMost" Next))) (move Select (from (if (and (not (is Pending)) ("SameTurn")) (sites {(var "Replay")}) (sites Mover)) if:(is Occupied (from))) (then (sow if:True apply:(if (is Odd (count at:(to))) (and (moveAgain) (set Var "Replay" (to))) (and (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))) (if (is Occupied ("OppositePitTwoRows" (to))) (fromTo (from ("OppositePitTwoRows" (to))) (to (handSite Mover)) count:(count at:("OppositePitTwoRows" (to))))))) backtracking:(and (is Occupied (to)) (is Even (count at:(to))))))) (then (if ("EmptyBoard") (and (if (< (count Cell at:(handSite P1)) (count Cell at:(handSite P2))) (addScore P2 (- (count Cell at:(handSite P2)) (count Cell at:(handSite P1)))) (addScore P1 (- (count Cell at:(handSite P1)) (count Cell at:(handSite P2))))) (if (is Occupied Cell (handSite P2)) (fromTo (from (handSite P2)) (to (handSite P1)) count:(count Cell at:(handSite P2))))))))) (nextPhase ("EmptyBoard") "Opening1"))} (end (forEach Player if:(<= 60 (score Player)) (result Player Win))))) END
Construct a Ludii game based on the following description Crossway is played with a Go set. The board starts out empty. Each player takes possession of all of the stones of one color. Players take turns adding their stones to the board, one stone per turn. A player must never create a crosscut formation. Black makes the first placement of the game. If you have no more available placements, you forfeit your turn and your opponent can continue making placements until completing his goal connection. For White to win, White must form a contiguous sequence of white stones connecting the West edge to the East edge of the board. Each stone in the sequence must be connected to neighboring stones in the sequence by horizontal, vertical, or diagonal adjacencies. Likewise for Black and the North and South edges. A corner is considered to be part of both adjoining edges. Crossway makes use of the pie rule. This means Black makes the first placement, and White has the option of switching colors with Black, and claiming Black's first move as his own. If White chooses to exercise the pie rule, Black then becomes White and now makes the second placement of the game. The pie rule can only be used once and on the second move of the game. The game is played on a 19x19 board ###
(define "IsNotCut" (not (is Pattern {F R F R F} whats:{(mover) (next)}))) (game "Crossway" (players 2) (equipment { (board (square 19) use:Vertex) (piece "Marker" Each) (regions P1 {(sites Side N) (sites Side S)}) (regions P2 {(sites Side W) (sites Side E)})}) (rules (meta (swap)) (play (do (move Add (to (sites Empty))) ifAfterwards:"IsNotCut")) (end (if (is Connected All Mover) (result Mover Win))))) END
Modify the Ludii game according to the following option changes: Order 8 board -> Order 2 board Square Grid -> Hex Grid (define "BoardUsed" (square 8)) (define "StepIteration" (if (<= #2 (count Pieces Next in:(sites Around (from)))) (move (from (from)) (to (#1))))) (define "S5" (intersection (sites Empty) (sites Around ("S4")))) (define "S4" (intersection (sites Empty) (sites Around ("S3")))) (define "S3" (intersection (sites Empty) (sites Around ("S2")))) (define "S2" (intersection (sites Empty) (sites Around ("S1")))) (define "S1" (intersection (sites Empty) (sites Around (from)))) (define "StepMoves" (or { ("StepIteration" "S1" 1) ("StepIteration" "S2" 2) ("StepIteration" "S3" 3) ("StepIteration" "S4" 4) ("StepIteration" "S5" 5)})) (define "PlaceOutOfSight" (move Add (to (sites Empty) if:(not (is Within (id "Disc" Mover) in:(sites LineOfSight Piece at:(to))))) (then (addScore Mover 1)))) (game "Infuse" (players 2) (equipment { (board "BoardUsed" use:Cell) (piece "Disc" Each)}) (rules (start (set Score Each 0)) (play (if (was Pass) (or (move Pass) (priority ("PlaceOutOfSight") (forEach Piece (do ("StepMoves") ifAfterwards:(can Move (add (to (sites Empty) if:(not (is Within (id "Disc" Mover) in:(sites LineOfSight Piece at:(to))))))))))) (or { ("PlaceOutOfSight") (forEach Piece ("StepMoves")) (move Pass)}))) (end { (if (and (all Passed) (> (score Mover) (score Next))) (result Mover Win)) (if (and (all Passed) (<= (score Mover) (score Next))) (result Next Win))}))) ###
(define "BoardUsed" (hex 2)) (define "StepIteration" (if (<= #2 (count Pieces Next in:(sites Around (from)))) (move (from (from)) (to (#1))))) (define "S5" (intersection (sites Empty) (sites Around ("S4")))) (define "S4" (intersection (sites Empty) (sites Around ("S3")))) (define "S3" (intersection (sites Empty) (sites Around ("S2")))) (define "S2" (intersection (sites Empty) (sites Around ("S1")))) (define "S1" (intersection (sites Empty) (sites Around (from)))) (define "StepMoves" (or { ("StepIteration" "S1" 1) ("StepIteration" "S2" 2) ("StepIteration" "S3" 3) ("StepIteration" "S4" 4) ("StepIteration" "S5" 5)})) (define "PlaceOutOfSight" (move Add (to (sites Empty) if:(not (is Within (id "Disc" Mover) in:(sites LineOfSight Piece at:(to))))) (then (addScore Mover 1)))) (game "Infuse" (players 2) (equipment { (board "BoardUsed" use:Cell) (piece "Disc" Each)}) (rules (start (set Score Each 0)) (play (if (was Pass) (or (move Pass) (priority ("PlaceOutOfSight") (forEach Piece (do ("StepMoves") ifAfterwards:(can Move (add (to (sites Empty) if:(not (is Within (id "Disc" Mover) in:(sites LineOfSight Piece at:(to))))))))))) (or { ("PlaceOutOfSight") (forEach Piece ("StepMoves")) (move Pass)}))) (end { (if (and (all Passed) (> (score Mover) (score Next))) (result Mover Win)) (if (and (all Passed) (<= (score Mover) (score Next))) (result Next Win))}))) END
Construct a Ludii game based on the following description It is played on a board that is a grid of dots. 3x3 dots is common. Players alternate turns drawing a line between two of the dots. If a player completes a square, they receive one point and play again. The player with the most points when there are no more moves wins. The board uses a square tiling. The game is played on a 8x8 board. The first player capture half the cells wins. ###
(define "HalfBoardSize" (/ (count Cells) 2)) (define "CaptureTheCell" (claim (to Cell (site)) (then (and (addScore Mover 1) (moveAgain))))) (define "NoFreeEdge" ("NoSites" (intersection (sites Incident Edge of:Cell at:(site)) (sites Empty Edge)))) (define "CellOfLastEdge" (sites Incident Cell of:Edge at:(last To))) (game "Dots and Boxes" (players 2) (equipment {(board (square 8))}) (rules (play (move Add (to Edge (sites Empty Edge)) (then (forEach Site "CellOfLastEdge" (if "NoFreeEdge" "CaptureTheCell"))))) (end (if (> (score Mover) "HalfBoardSize") (result Mover Win))))) END
Construct a Ludii game based on the following description 2x6 board with two stores. Four counters in each hole. Play may begin from any of the player's holes. Counters are sown anti-clockwise. If the last counter falls into an empty hole or a hole in either row, making that hole contain four counters, play ends, and the four counters are taken. Also, if at any time during the sowing a hole contains four counters, the player on whose row this occurs takes those counters. Otherwise, the player lifts the counters in the hole in which the final counter lands and continues sowing. Play ends when one player can no longer move. The player with the most counters wins. ###
(define "PiecesOwnedBy" (+ (count at:(mapEntry #1)) (count in:(sites #1)))) (game "Obridje" (players 2) (equipment { (mancalaBoard 2 6 (track "Track" "1,E,N,W" loop:True)) (piece "Seed" Shared) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 FirstSite) (pair P2 LastSite)})}) (rules (start (set Count 4 to:(sites Track))) (play (move Select (from (if ("SameTurn") (sites {(var "Replay")}) (sites Mover)) if:(> (count at:(from)) 0)) (then (do (set Var "NumSowed" (count at:(last To))) next:(sow apply:(if (and (!= 4 (count at:(to))) (< 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"))) (if (= 4 (count at:(site))) (fromTo (from (site)) (to (if (is In (to) (sites P1)) (mapEntry P1) (mapEntry P2))) count:4))) (set Var "NumSowed" 0))))))) (end ("MancalaByScoreWhen" (no Moves Next))))) END
Modify the Ludii game according to the following option changes: Each row has 41 holes. -> Each row has 42 holes. (define "PiecesOwnedBy" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (define "Columns" 41) (game "En Gehe" (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 (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover)) if:(> (count at:(from)) 0)) (then (sow apply:(if (> (count at:(to)) 1) (moveAgain) (if (and (is In (to) (sites Mover)) (> (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:(count at:(to)))))))))) (end ("MancalaByScoreWhen" (no Moves Mover))))) ###
(define "PiecesOwnedBy" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (define "Columns" 42) (game "En Gehe" (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 (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover)) if:(> (count at:(from)) 0)) (then (sow apply:(if (> (count at:(to)) 1) (moveAgain) (if (and (is In (to) (sites Mover)) (> (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:(count at:(to)))))))))) (end ("MancalaByScoreWhen" (no Moves Mover))))) END
Construct a Ludii game based on the following description On a turn, the active player takes a cube that is blank or bearing his symbol from the outer ring of the grid, then adds it to the grid by pushing it into one of the rows from which it was removed. Thus, a few pieces of the grid change places each turn, and the cubes slowly go from blank to crosses and circles. Play continues until someone forms an orthogonal or diagonal line of five cubes bearing his symbol, with this person winning the game. ###
(define "Push" (move Select #1 (then (and { (push (from (last To)) #2) "CompleteLineWithPieceTaken"})))) (define "From" (from (difference (intersection (sites #1) #2) (sites {(last To)})))) (define "LastColumn" (sites Column (column of:(last To)))) (define "LastRow" (sites Row (row of:(last To)))) (define "TakeAPieceInOuterSites" (move Select (from (sites Outer) if:(or (is Mover (who at:(from))) (= (who at:(from)) 0))) (then (and (fromTo (from (last To)) (to (handSite (mover)))) (moveAgain))))) (define "CompleteLineWithPieceTaken" (if (or (= (what at:(handSite (mover))) (id "Square0")) (= (what at:(handSite (mover))) (mover))) (add (piece (mover)) (to (last To))) (add (piece (next)) (to (last To)))) (remove (handSite (mover)))) (game "Quixo" (players 2) (equipment { (board (square 5)) (piece "Disc" P1) (piece "Cross" P2) (piece "Square" Neutral) (hand Each)}) (rules (start (place "Square0" (sites Board))) (play (if "SameTurn" (or { ("Push" ("From" Left "LastRow") E) ("Push" ("From" Right "LastRow") W) ("Push" ("From" Bottom "LastColumn") N) ("Push" ("From" Top "LastColumn") S)}) "TakeAPieceInOuterSites")) (end { (if (is Line 5 throughAny:(sites LastTo) what:(next)) (result Next Win)) (if (is Line 5 throughAny:(sites LastTo) what:(mover)) (result Mover Win))}))) END
Construct a global Ludii definition which fulfills the following requirements. Defines a piece moving like a bishop in Chess. ###
(define "ChessBishop" (piece #1 Each (move Slide Diagonal (to if:("IsEnemyAt" (to)) (apply (remove (to) #2))) #3))) END
Modify the Ludii game according to the following option changes: A size 4 board is currently selected -> A size 5 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 (- 4 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 4)) (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))}))))) ###
(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 (- 5 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 5)) (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
Construct a global Ludii definition which fulfills the following requirements. If the mover is reaching a space of a region with his last movement, a player is winning. This ludemeplex can be used only in an ending condition. ###
(define "ReachWin" (if (is In (last To) #1) (result #2 Win))) END
Describe the mechanics of the following Ludii game (define "PromoteTo" (move Promote (last To) #1 Mover)) (define "KingCaptureStep" (move Step #1 (to if:"IsToEmptyOrEnemy" (apply (if ("IsEnemyAt" (to)) (remove (to) (then (set Counter)))))) #2)) (define "P12" (if (is Mover P1) #1 #2)) (define "IsToEmptyOrEnemy" (or "IsToEmpty" ("IsEnemyAt" (to)))) (define "IsToEmpty" (is In (to) (sites Empty))) (define "Directions" ("P12" (directions #1) (directions #2))) (game "Mini Hexchess" ("TwoPlayersNorthSouth") (equipment { (board (rotate 90 (hex 4))) (piece "King" Each ("KingCaptureStep" All ~)) (piece "Queen" Each ("SlideCapture" ~ ~ (then (set Counter)))) (piece "Rook" Each ("SlideCapture" Orthogonal ~ (then (set Counter)))) (piece "Bishop" Each ("SlideCapture" Diagonal ~ (then (set Counter)))) ("ChessKnight" "Knight" (then (set Counter))) (piece "Pawn" Each (or { "StepForwardToEmpty" ("StepToEnemy" ("Directions" {NNW NNE} {SSW SSE}))} (then (and (if (is In (last To) (sites Mover "PromotionZone")) (moveAgain)) (set Counter))))) (regions "PromotionZone" P1 (union (sites Side NW) (sites Side NE))) (regions "PromotionZone" P2 (union (sites Side SW) (sites Side SE))) (regions "Region-Dark" (sites Phase 2)) (regions "Region-Light" (sites Phase 1)) (regions "Region-Medium" (sites Phase 0))}) (rules (start { (place "King1" coord:"B2") (place "Rook1" coord:"B1") (place "Bishop1" coord:"A1") (place "Knight1" coord:"A2") (place "King2" coord:"F6") (place "Rook2" coord:"F7") (place "Bishop2" coord:"G7") (place "Knight2" coord:"G6") (place "Pawn1" {"A3" "B3" "C3" "C2" "C1"}) (place "Pawn2" {"E7" "E6" "E5" "F5" "G5"})}) phases:{ (phase "Movement" (play (if ("SameTurn") ("PromoteTo" (piece {"Rook" "Bishop" "Knight"})) (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King" Mover))))) (end { ("Checkmate" "King") (if (or (no Moves Mover) (= (counter) 100)) (result Mover Draw))}))})) ###
Mini Hexchess is played on a hexagonal board with each side having length 5, and each space oriented horizontally. The board has 37 spaces. Piece Movement: * Kings, Rooks, Bishops, and Knights move as in Glinski Chess. - Kings step one space in any of the 12 directions. They do not castle. - Rooks slide in any of the 6 adjacent directions. - Bishops slide in any of the 6 'diagonal' directions. - Knights move two spaces in any adjacent direction, then one space in another direction. * There are no Queens in Mini Hexchess. * Pawns can advance one space forward without capturing. Pawns can never advance more than one space. Pawns capture 'diagonally forward' (i.e., to a space ahead connected by an edge, and having the same colour). There is no en passant capture. On reaching the farthest rank in a given file, Pawns are promoted to a Rook, Bishop, or Knight. Note that a Pawn cannot be promoted to a Queen, since there are no Queens in Mini Hexchess. The game ends on a checkmate or stalemate. END
Construct a Ludii game based on the following description Played on a square grid 11x11 or larger. White goes first and places two pieces every turn, Black places four pieces per turn. White wins if they make an orthogonal line of four pieces; Black wins if they make an orthogonal line of 7 pieces. Played on a size 11 board. ###
(game "Unfair" (players 2) (equipment { (board (square 11) use:Vertex) (piece "Ball" Each)}) (rules (play (or (move Add (to (sites Empty) if:(= (id P1) (mover))) (then (if (= 0 (count MovesThisTurn)) (moveAgain)))) (move Add (to (sites Empty) if:(= (id P2) (mover))) (then (if (< (count MovesThisTurn) 3) (moveAgain)))))) (end { (if (and ((= (id P1) (mover)) (is Line 4 Orthogonal))) (result Mover Win)) (if (and ((= (id P2) (mover)) (is Line 7 Orthogonal))) (result Mover Win))}))) END
Construct a Ludii game based on the following description 2x12 board. Beginning from the leftmost hole closest to a player and proceeding in an anti-clockwise direction, the opening arrangement of counters is an alternating pattern of one empty hole, followed by two holes with three counters each. The first move for each player must be from an occupied hole in the right half of their row. Players sow in an anti-clockwise direction, but if the final counter is about to fall in a hole in the player's own row, it is instead placed in the first hole in the opponent's row. After this, players may sow from any hole in their row, provided that the final counter does not fall into an occupied hole in their row. When the final counter of a sowing lands in an occupied hole in the opponent's row, the counters there are picked up and sowing continues. When this happens, the player is allowed to drop the final counter into an occupied hole in their row, which would then be picked up and sowing would continue as before. When the final counter falls into an empty hole in the player's row, any counters in the opponent's hole opposite are captured. When the final counter falls into an empty hole in the opponent's row, the turn ends. The player who captures all of the opponent's counters wins. Players typically play to achieve five consecutive wins. ###
(define "NextHoleFrom" ("NextSiteOnTrack" #2 from:#1)) (define "NoPiece" (= (count in:(sites Player "Home")) 0)) (define "LastHoleSowed" (sites {("LastHole")})) (define "LastHole" (last To afterConsequence:True)) (define "Columns" 12) (game "Tapata" (players 2) (equipment { (mancalaBoard 2 "Columns" store:None (track "TrackCCW" "0,E,N,W" loop:True)) (piece "Seed" Shared) (regions "Home" P1 (sites Bottom)) (regions "Home" P2 (sites Top)) (regions "Right Half" P1 (intersection (sites Bottom) (expand (sites Right) steps:5))) (regions "Right Half" P2 (intersection (sites Top) (expand (sites Left) steps:5))) (map {(pair P1 0) (pair P2 23)})}) (rules (start (set Count 3 to:(sites {1 2 4 5 7 8 10 11 22 21 19 18 16 15 13 12}))) phases:{ (phase "FirstMove" (play (move Select (from (difference (sites Mover "Right Half") (sites Empty))) (then (sow apply:(if (is In (to) (sites Mover "Home")) (fromTo (from (to)) (to (mapEntry Next)))))))) (nextPhase Mover "Play")) (phase "Play" (play (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover "Home")) if:(and (> (count at:(from)) 0) (or ("SameTurn") (and ("NewTurn") (not (and (is In ("NextHoleFrom" (from) (count at:(from))) (sites Mover "Home")) (!= 0 (count at:("NextHoleFrom" (from) (count at:(from))))))))))) (then (sow apply:(if (< 1 (count at:(to))) (moveAgain) (if (and (!= 0 (count at:("OppositePit" (to)))) (is In (to) (sites Mover "Home"))) (remove ("OppositePit" (to))))))))))} (end (forEach NonMover if:("NoPiece") (result Player Loss))))) END
Construct a Ludii game based on the following description Players take turns placing one piece of their colour on empty cells; the piece they place may not be adjacent to the last piece placed by their opponent. A player wins by connecting all three board sides with a connected group of their pieces. Played on a size 11 board. The first player to connect all three sides wins. ###
(game "Tabu Y" (players 2) (equipment { (board (hex Triangle 11)) (piece "Disc")}) (rules (play (move Add (to (sites Empty) if:(not (is In (to) (sites Around (last To))))))) (end (if (is Connected 3 Sides) (result Mover Win))))) END
Construct a Ludii game based on the following description DEFINITIONS Group: like-colored stones adjacent to each other. Singletons are considered groups of size 1. Path: an empty point, or an uninterrupted straight line of empty points that have a pair of like-colored stones on both ends, which are not part of the same group. Such a pair is said to have a path. Dead group: a group in which all stones belonging to it have no path. If any stone belonging to a group has a path, the group is said to have a path. GAME PLAY (Overview) Decide which player plays as which color (Light or Dark) in any adequate way. Light goes first, then alternate turns. On each player's first turn, players place a stone of their own color on any empty point. On each player's second turn, players place another stone of their color so that their own two stones have a path. Then players take actions below on each turn, in this order. 1. Remove all opponent’s dead groups. This happens automatically in Ludii. 2. Place a stone of their own color on an empty point that is on at least one same straight line with an existing friendly stone, and no opponent's stone in between. Passing is not allowed. After the second turn, the player with no stones of their color on the board at the beginning of their turn loses. A board with side lengths 6 and 7 is currently selected ###
(define "Remove" (forEach Group (if (all Sites (sites) if:(= 0 (count Sites in:(difference (intersection (sites Occupied by:Mover) (sites Direction from:(site) stop:(is Occupied (to)) stopIncluded:True)) (sites))))) (remove (sites))))) (define "Move" (move Add (to (forEach (sites Empty) if:(> (count Pieces Mover in:(sites LineOfSight at:(site))) 0))) #1)) (game "Meridians" (players 2) (equipment { (board (dual (hex Prism 7 6)) use:Vertex) (piece "Disc" Each)}) (rules phases:{ (phase "Opening" (play (move Add (to (if (< 0 (count Sites in:(sites Occupied by:Mover))) (forEach (sites Empty) if:(and (> (count Pieces Mover in:(sites LineOfSight at:(site))) 0) (= (count Sites in:(sites Around (site) Own)) 0))) (sites Empty))))) (nextPhase (= 4 (count Moves)) "Play")) (phase "Play" (play (if (can Move ("Move" ~)) ("Move" (then ("Remove"))) (move Pass (then ("Remove"))))))} (end (if (and (< 4 (count Moves)) (or (= 0 (count Sites in:(sites Occupied by:P1))) (= 0 (count Sites in:(sites Occupied by:P2))))) (result Mover Loss))))) END
Construct a Ludii game based on the following description Each turn the current player must move, capture and drop. The current player must move one of their pieces in a straight line in any of the six hexagonal directions to land on a vacant foreign cell; any intervening cells must also be empty. The opponent who owns the landing cell becomes the candidate and the other opponent becomes the bunny. All opponents' pieces immediately adjacent to the landing cell are captured and removed from the board. The current player must make the move that captures the most pieces each turn, but may choose amongst equals. This is called the max capture rule. The moving player must then drop a bunny piece on any empty cell, unless a player has just been eliminated. The candidate becomes the next player to move. Goal: Play stops the moment any player is eliminated. The game is won by the player with the most pieces left, else is a tie between the two remaining players if they are both left with the same number of pieces. ###
(define "Bunny" (if (= (mover) 1) (if (= ("Candidate") 2) 3 2) (if (= (mover) 2) (if (= ("Candidate") 1) 3 1) (if (= ("Candidate") 1) 2 1)))) (define "Candidate" (var)) (define "GetCandidate" (set Var (mapEntry "PlayerPhase" (phase of:(last To))))) (game "Triad" (players 3) (equipment { (board (hex 5)) (piece "Marker" Each (move Slide Orthogonal (to (apply if:(!= (mover) (mapEntry "PlayerPhase" (phase of:(to)))))) (then (and { (forEach Site (sites Around (last To) Orthogonal) (if (is Enemy (what at:(site))) (remove (site)))) "GetCandidate" (moveAgain)})))) (map "PlayerPhase" {(pair 1 1) (pair 0 2) (pair 2 3)})}) (rules (start { (place "Marker1" (expand origin:(coord "A5") steps:2)) (place "Marker2" (expand origin:(coord "I9") steps:2)) (place "Marker3" (expand origin:(coord "E1") steps:2))}) (play (if "SameTurn" (move Add (piece ("Bunny")) (to (sites Empty)) (then (set NextPlayer (player "Candidate")))) (max Captures (forEach Piece)))) (end (if (or { (no Pieces P1) (no Pieces P2) (no Pieces P3)}) (byScore { (score P1 (count Pieces P1)) (score P2 (count Pieces P2)) (score P3 (count Pieces P3))}))))) END
Construct a Ludii game based on the following description Men can move one step forwards orthogonally or diagonally, or can jump an opponent's adjacent piece to capture it, in any direction. When a man ends its turn on the opposite edge of the board from its starting position, it becomes a king and may move or jump over any number of spaces in any direction. Captures are compulsory and the maximum number of jumps must be made. The first player unable to move, loses. The game is played on a 8x8 board ###
(define "IsUnpromoted" ("IsPieceAt" "Counter" Mover (last To))) (define "HopCounter" (move Hop (from #1) All (between if:(and (not (is In (between) (sites ToClear))) ("IsEnemyAt" (between))) (apply (remove (between) at:EndOfTurn))) (to if:(is Empty (to))) #2)) (game "Omnidirectional Draughts" (players 2) ("DraughtsEquipment" (square 8)) (rules (start { (place "Counter1" (expand (sites Bottom) steps: (- (/ 8 2) 2))) (place "Counter2" (expand (sites Top) steps: (- (/ 8 2) 2)))}) (play (if "SameTurn" (if "IsUnpromoted" (max Moves ("HopCounter" (last To) (then ("ReplayIfCanMove" ("HopCounter" (last To)) ("PromoteIfReach" (sites Next) "DoubleCounter"))))) (max Moves ("HopSequenceCaptureAgain" before:(count Rows) after:(count Rows) at:EndOfTurn))) (priority { (max Moves (or (forEach Piece "Counter" ("HopCounter" (from) (then ("ReplayIfCanMove" ("HopCounter" (last To)) ("PromoteIfReach" (sites Next) "DoubleCounter"))))) (forEach Piece "DoubleCounter" ("HopSequenceCapture" before:(count Rows) after:(count Rows) at:EndOfTurn)))) (or (forEach Piece "Counter" ("StepToEmpty" (directions Forwards)) (then ("PromoteIfReach" (sites Next) "DoubleCounter"))) (forEach Piece "DoubleCounter" (move Slide)))}))) (end ("BlockWin")))) END
Construct a global Ludii definition which fulfills the following requirements. Allows to remove one piece of the enemy player which is not in a line 3. ###
(define "RemoveAnyEnemyPieceNotInLine3" (move Remove (forEach (sites Occupied by:Enemy container:"Board") if:(not (is Line 3 #1 through:(site)))))) END
Describe the mechanics of the following Ludii game (define "CanMoveAnotherStone" (can Move (do (set Var #2) next:(forEach Site (difference (sites Occupied by:Mover) #1) (step (from (site)) (directions Cell from:#1 to:(var)) (to if:(and (is Empty (to)) (not (is In (to) (sites "RedDots")))))))))) (game "Tandems" (players 2) (equipment { (board (square 5)) (piece "Pawn" Each (move Step (to if:(and { (is Empty (to)) (not (is In (to) (sites "RedDots"))) ("CanMoveAnotherStone" (from) (to))})) (then (moveAgain)))) (regions "RedDots" (sites {"B2" "B4" "D2" "D4"}))}) (rules (start { (place "Pawn1" (sites Bottom)) (place "Pawn2" (sites Top))}) (play (if ("SameTurn") (forEach Site (difference (sites Occupied by:Mover) (last To)) (move Step (from (site)) ("LastDirection" Cell) (to if:(and (is Empty (to)) (not (is In (to) (sites "RedDots"))))))) (forEach Piece))) (end { (if (and (is Mover P1) (all Sites (sites Occupied by:P1) if:(is In (site) (sites Top)))) (result P1 Win)) (if (and (is Mover P2) (all Sites (sites Occupied by:P2) if:(is In (site) (sites Bottom)))) (result P2 Win))}))) ###
On each turn, each player must move two friendly stones to adjacent (diagonal or orthogonal) empty cells, both in the same direction. Stones cannot move into the restricted points on the game board. The player that first moves 5 stones to the last row wins the game. END
Modify the Ludii game according to the following option changes: The game is played on a 5x5 board -> The game is played on a 7x7 board (game "Gale" (players 2) (equipment { (board (square 5)) (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))))) ###
(game "Gale" (players 2) (equipment { (board (square 7)) (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 Played on an 8x8 board with each player having twelve pieces. Pieces move diagonally one space forward, and can capture opponent's pieces by jumping them if they are adjacent. Capturing must happen if it is possible, multiple captures are allowed, and can happen in a forward or backward direction. Once pieces reach the opposite side of the board from their starting position, they become kings and can move diagonally either forwards or backwards. A piece may become a king in the midst of a sequence of captures, and then capture as a king in the same turn. Kings may capture over any distance, leaping over all opponent's pieces in a line. The goal is to capture all of the opponent's pieces. ###
(define "JumpToPromotionZone" (is In (last To) (sites Next))) (define "IsUnpromoted" ("IsPieceAt" "Counter" Mover (last To))) (define "HopCounter" (move Hop (from #1) Diagonal (between if:(and (not (is In (between) (sites ToClear))) ("IsEnemyAt" (between))) (apply (remove (between)))) (to if:(is Empty (to))) #2)) (game "Shashki" ("TwoPlayersNorthSouth") ("DraughtsEquipment" (square 8)) (rules ("BlackCellsSetup" 3) (play (if "SameTurn" (if "IsUnpromoted" ("HopCounter" (last To) (then (if "JumpToPromotionZone" (and (promote (last To) (piece "DoubleCounter") Mover) ("ReplayIfCanMove" ("HopDiagonalSequenceCaptureAgain" before:(count Rows) after:(count Rows)))) ("ReplayIfCanMove" ("HopCounter" (last To)))))) ("HopDiagonalSequenceCaptureAgain" before:(count Rows) after:(count Rows))) (priority { (or (forEach Piece "Counter" ("HopCounter" (from) (then (if "JumpToPromotionZone" (and (promote (last To) (piece "DoubleCounter") Mover) ("ReplayIfCanMove" ("HopDiagonalSequenceCaptureAgain" before:(count Rows) after:(count Rows)))) ("ReplayIfCanMove" ("HopCounter" (last To))))))) (forEach Piece "DoubleCounter" ("HopDiagonalSequenceCapture" before:(count Rows) after:(count Rows)))) (or (forEach Piece "Counter" ("StepToEmpty" (directions {FR FL})) (then ("PromoteIfReach" (sites Next) "DoubleCounter"))) (forEach Piece "DoubleCounter" (move Slide Diagonal)))}))) (end ("CaptureAll" Next)))) END
Describe the mechanics of the following Ludii game (game "Lam Turki" (players 1) (equipment { ("StarBoard" 5) (hand Each) (piece "Marker" P1 ("HopFriendCapture"))}) (rules (start { (place "Marker" (handSite P1) count:9)}) phases:{ (phase "Placement" (play (if (is Even (count Moves)) (move (from (handSite Mover)) (to (sites Empty)) (then (moveAgain))) (forEach Piece (if (= (from) (last To)) (move Hop (between if:(or ("IsFriendAt" (between)) (is Empty (between)))) (to if:(is Empty (to)))))))) (end (if (no Moves Next) (result Mover Loss))) (nextPhase Mover (and (is Even (count Moves)) ("HandEmpty" Mover)) "Movement")) ("PhaseMovePiece" "Movement" (end { (if (= (count Pieces) 1) (result Mover Win)) (if (no Moves Next) (result Mover Loss))}))})) ###
The board is a five-pointed star. The player has nine pieces. In the first phase, the player attempts to place all the pieces on the board. The player choses a point, then moves the piece two spaces in a straight line. The piece may move through a spot occupied by another piece, but must land on an empty space. Once all of the pieces are placed in this way, the player captures a piece on the board by hopping over with with another one of the pieces to an empty space on the opposite side of the piece to be captured. The goal is to capture all of the pieces except one. END
Construct a Ludii game based on the following description Game is played on an Alquerque board with 5x5 intersecting lines and with a triangular appendage on either side. Each player has sixteen pieces, which are placed on the intersections and move along the lines to the next open intersection. Players can hop opponents pieces to capture them. Multiple captures in one turn are allowed. A player wins when they capture all of the opponent's pieces or block them from being able to move. The game is played with sixteen pieces. ###
(game "Mogul Putt'han" (players 2) (equipment { ("AlquerqueBoardWithBottomAndTopTriangles") (piece "Marker" Each (or ("HopSequenceCapture") ("StepToEmpty")))}) (rules (start { (place "Marker1" (union {(sites Row 0) (sites Row 1) (sites Row 2) (sites Row 3)})) (place "Marker2" (union {(sites Row 5) (sites Row 6) (sites Row 7) (sites Row 8)}))}) (play (if "SameTurn" (or ("HopSequenceCaptureAgain") (move Pass)) (forEach Piece))) (end ("NoMoves" Loss)))) END
Construct a Ludii game based on the following description Three concentric pentagons, with lines connecting the corners and the midpoints of each side. Fourteen pieces per player. Players alternate turns placing one of their pieces on an empty spot on the board. When all of the pieces are placed, they alternate turns moving one of their pieces to an empty adjacent spot along the lines of the board. During either phase, when a player places three of their pieces in a row, they may remove one of the opponent's pieces from the board. Pieces which are in a three-in-a-row arrangement cannot be removed from the board. The player who captures all of the opponent's pieces wins. ###
(game "Tavan Tal" (players 2) (equipment { (board (add (merge { (shift 2 2 (merge { (rectangle 1 3) (shift -1.31 0.95 (rotate 108 (rectangle 1 3))) (shift -0.81 2.49 (rotate 216 (rectangle 1 3))) (shift 1.31 0.95 (rotate -108 (rectangle 1 3))) (shift 0.81 2.49 (rotate -216 (rectangle 1 3)))})) (shift 1 1 (scale 2 (merge { (rectangle 1 3) (shift -1.31 0.95 (rotate 108 (rectangle 1 3))) (shift -0.81 2.49 (rotate 216 (rectangle 1 3))) (shift 1.31 0.95 (rotate -108 (rectangle 1 3))) (shift 0.81 2.49 (rotate -216 (rectangle 1 3)))}))) (scale 3 (merge { (rectangle 1 3) (shift -1.31 0.95 (rotate 108 (rectangle 1 3))) (shift -0.81 2.49 (rotate 216 (rectangle 1 3))) (shift 1.31 0.95 (rotate -108 (rectangle 1 3))) (shift 0.81 2.49 (rotate -216 (rectangle 1 3)))}))}) edges:{ {26 16} {16 6} {5 15} {15 25} {29 19} {19 9} {7 17} {17 27} {28 18} {18 8} {22 12} {12 2} {1 11} {11 21} {20 10} {10 0} {3 13} {13 23} {24 14} {14 4}}) use:Vertex) (hand Each) (piece "Marker" Each ("StepToEmpty" ~ (then ("ReplayIfLine3"))))}) (rules (start (place "Marker" "Hand" count:14)) phases:{ (phase "Placement" (play (if "SameTurn" ("RemoveAnyEnemyPieceNotInLine3" Orthogonal) (move (from (handSite Mover)) (to (sites Empty)) (then ("ReplayIfLine3"))))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) (phase "Movement" (play (if "SameTurn" ("RemoveAnyEnemyPieceNotInLine3" Orthogonal) (forEach Piece))))} (end ("CaptureAll" Next)))) END
Construct a global Ludii definition which fulfills the following requirements. If the mover has no legal moves, the mover is winning. This ludemeplex can be used only in an ending condition. ###
(define "MisereBlockWin" (if (no Moves Mover) (result Mover Win))) END
Construct a Ludii game based on the following description Players take turns marking any unmarked cell with no marked neighbour. Player who can’t move loses. ###
(define "NoNeighbour" ("NoSites" (sites Around (to) Orthogonal if:(is In (to) (sites Occupied by:Neutral))))) (game "Spots" (players 2) (equipment { (board (hex 5)) (piece "Marker" Neutral)}) (rules (play (move Add (piece "Marker0") (to (sites Empty) if:"NoNeighbour"))) (end ("NoMoves" Loss)))) END
Construct a Ludii game based on the following description At the beginning of the game, the first player places 4 pieces of any colour in the bottom row. These pieces will be hidden to the second player during all the game. The objective of the second player (called codebreaker) is to try to guess the pattern, in both order and color, within a specific number of tries (corresponding to the number of rows). Each guess is made by placing a row of code pegs on the board. Once placed, a feedback on his last try is provided by placing from zero to four key pegs in the small holes of the row with the guess. A black key peg is placed for each code peg from the guess which is correct in both color and position. A white key peg indicates the existence of a correct color code peg placed in the wrong position. The game is played on a 12x12 board. ###
(define "AddWhiteHint" ("AddHint" "Disc1")) (define "AddBlackHint" ("AddHint" "Disc2")) (define "AddHint" (add (piece #1) (to (regionSite ("HintPositions") index:(value))))) (define "CombinationFound" (and (= 0 (count Sites in:(intersection (sites Empty) (sites Row ("RowToCheck"))))) (= "NumColumn" (count Sites in:(forEach (sites Row ("RowToCheck")) if:("PositionAndColorOK")))))) (define "PositionAndColorOK" (= (what at:(site)) (what at:(coord row:0 column:(column of:(site)))))) (define "CombinationToFindPlaced" (= 0 (count Sites in:(intersection (sites Empty) (sites Bottom))))) (define "CombinationPlaced" (= 0 (count Sites in:(intersection (sites Empty) (sites Row ("RowToPlace")))))) (define "ColorInSolution" (is In (what at:(regionSite (sites Bottom) index:(value))) (results from:(sites Row ("RowToPlace")) to:0 (what at:(from))))) (define "RightPositionAndColor" (= (what at:(regionSite (sites Row ("RowToPlace")) index:(value))) (what at:(coord row:0 column:(value))))) (define "HintPositions" (union (sites Row (+ "RowToPlace" 1)) (sites Row (- "RowToPlace" 1)))) (define "RowToCheck" (- "TopRow" (* 3 (- ("NumTry") 1)))) (define "RowToPlace" (- "TopRow" (* 3 ("NumTry")))) (define "NumTry" (var)) (define "TopRow" (+ 2 (* 3 (- "NumRow" 1)))) (define "NumColumn" 4) (define "NumRow" 12) (game "Mastermind" (players 2) (equipment { (board (merge { (rectangle (+ 1 "NumRow") "NumColumn") (shift "NumColumn" 0.75 (repeat "NumRow" 1 step:{{1 0} {0 1}} (poly {{0 0} {0 0.5} {0.5 0.5} {0.5 0}})))}) use:Vertex) (piece "Marker1" Shared) (piece "Marker2" Shared) (piece "Marker3" Shared) (piece "Marker4" Shared) (piece "Marker5" Shared) (piece "Marker6" Shared) (piece "Marker7" Shared) (piece "Marker8" Shared) (piece "Disc1" Shared) (piece "Disc2" Shared) (hand Shared size:8)}) (rules (start { (place "Marker1" (handSite Shared)) (place "Marker2" (handSite Shared 1)) (place "Marker3" (handSite Shared 2)) (place "Marker4" (handSite Shared 3)) (place "Marker5" (handSite Shared 4)) (place "Marker6" (handSite Shared 5)) (place "Marker7" (handSite Shared 6)) (place "Marker8" (handSite Shared 7))}) phases:{ (phase "Placement" P1 (play (move (from (sites Hand Shared)) (to (intersection (sites Empty) (sites Bottom))) copy:True (then (and { (set Hidden at:(last To) to:P2) (if ("CombinationToFindPlaced") (set Var 0) (moveAgain))}))))) (phase "Finding" P2 (play (move (from (sites Hand Shared)) (to (intersection (sites Empty) (sites Row ("RowToPlace")))) copy:True (then (and (moveAgain) (if ("CombinationPlaced") (and (forEach Value min:0 max:(- "NumColumn" 1) (if ("RightPositionAndColor") ("AddBlackHint") (if ("ColorInSolution") ("AddWhiteHint")))) (set Var (+ 1 ("NumTry"))) (then (if (or ("CombinationFound") (>= "NumTry" "NumRow")) (forEach Site (sites Bottom) (set Hidden at:(site) False to:P2)))))))))) (end { (if ("CombinationFound") (result P2 Win)) (if (>= "NumTry" "NumRow") (result P1 Win))}))})) END
What does the following global Ludii definition do? (define "ForEachPlayerNoMovesLoss" (forEach Player if:(no Moves Player) (result Player Loss))) ###
Makes a player losing when this player has no moves. This ludemeplex can be used only in an ending condition. END
Construct a Ludii game based on the following description 3x3 intersecting lines, with diagonals in the square. Three pieces per player, which begin on opposite sides of the square. Players alternate turns moving one of their pieces along the lines of the board. When a player surrounds one of the opponent's pieces with two of their pieces, the opponent's piece is captured. The player who captures all of the opponent's pieces wins. ###
(game "El-Mthaltha" (players 2) (equipment { ("AlquerqueBoard" 3 3) (piece "Marker" Each ("StepToEmpty" ~ (then ("CustodialCapture" Orthogonal (max 1)))))}) (rules (start { (place "Marker1" (sites Bottom)) (place "Marker2" (sites Top))}) (play (forEach Piece)) (end ("CaptureAll" Next)))) END
Construct a Ludii game based on the following description The board consists of four rows of any number of holes. Two to twelve players, who play on two equal teams. The number of pieces per team is equal to the number of holes in one row. One team plays as pieces of camel dung, the other as sticks. The pieces begin, one in each hole, in the outer rows of the board. Eight sticks, used as dice, with a marked side and a blank side. The values of the throws are equal to the number of marked sides which land face up. A throw of 4 grants the player another throw. Pieces can only be moved for the first time with a throw of 1 or 8. One piece may move one space on a throw of 1, or eight pieces may each move one space on a throw of 8. Once a piece has made its initial move, it may move according to the throws of the sticks. The bottom team's pieces move from right to left in the home row, left to right in the next row, right to left in the third row, and then into the opponent's home row. The top team moves left to right (from their perspective) in their home row, right to left in the next row, left to right in the next row, and into the bottom player's home row. When a team's piece lands on a space in the central two rows occupied by an opponent's piece, the opponent's piece is captured. Pieces cannot be captured in the home rows. When a piece moves into the opponent's home row, they move back into the central two rows, moving in the opposite direction as before. After moving into the home row a piece can no longer be captured, even when it is in the central two rows. Play continues until both team's pieces have moved out of their home row and can no longer be captured. Players then alternate turns throwing the sticks, removing one of the opponent's pieces every time a 4 is thrown. A team wins when only their pieces are left on the board. The game involves 4 players. Each row has 20 Holes. ###
(define "Move" (if ("NeverGoInEnemyHome" (from)) (or (if (<= (var) 0) (move (from (from) if:(if ("ActivatedPiece" (from)) True ("ActivatedThrow"))) (to ("NextSiteOnTrack" ("ThrowValue") "Track") if:(if (is In (to) ("MiddleSites")) (or (is Empty (to)) (and ("IsEnemyAt" (to)) ("PieceCanBeCapture"))) (is Empty (to))) (apply ("CaptureMove"))) (then (if (not ("ActivatedPiece" (last To))) ("ActivePiece" (last To)))))) (if (or (= ("ThrowValue") 8) (> (var) 0)) (move (from (from)) (to ("NextSiteOnTrack" 1 "Track") if:(if (is In (to) ("MiddleSites")) (or (is Empty (to)) (and ("IsEnemyAt" (to)) ("PieceCanBeCapture"))) (is Empty (to))) (apply ("CaptureMove"))) (then (and (if (not ("ActivatedPiece" (last To))) ("ActivePiece" (last To))) (if (> (var) 0) (and (if (> (var) 1) (moveAgain)) (set Var (- (var) 1))) (and (set Var (- ("ThrowValue") 1)) (moveAgain))))))) (then (if (is In (last To) (if (is In (mover) (players Team1)) (sites Top) (sites Bottom))) (set State at:(last To) 2)))) (if ("MoveBackOnMiddleSites" (from)) (move (from (from)) (to ("NextSiteOnTrack" ("ThrowValue") "GoBackTrack") if:(if (is In (to) ("MiddleSites")) (not ("IsFriendAt" (to))) (is Empty (to))) (apply ("CaptureMove"))) (then (if (is In (last To) ("MiddleSites")) (set State at:(last To) 3)))) (if ("MoveOnLoop" (from)) (move (from (from)) (to ("NextSiteOnTrack" ("ThrowValue") "LoopTrack") if:(if (is In (to) ("MiddleSites")) (not ("IsFriendAt" (to))) (is Empty (to))) (apply ("CaptureMove")))))))) (define "AllPiecesOutOfHomeAndCanNotBeCaptured" (and (= 0 (count Sites in:(difference (sites Occupied by:All) ("MiddleSites")))) (= 0 (count Sites in:(forEach (sites Occupied by:All) if:(< (state at:(site)) 2)))))) (define "PieceCanBeCapture" (< (state at:(to)) 2)) (define "MoveBackOnMiddleSites" (= (state at:#1) 2)) (define "MoveOnLoop" (= (state at:#1) 3)) (define "NeverGoInEnemyHome" (< (state at:#1) 2)) (define "CaptureMove" (if ("IsEnemyAt" (to)) (remove (to)))) (define "MiddleSites" (difference (sites Board) (union (sites Top) (sites Bottom)))) (define "ActivePiece" (set State at:#1 1)) (define "ActivatedPiece" (< 0 (state at:#1))) (define "ActivatedThrow" (is In ("ThrowValue") (sites {1 8}))) (define "IsSpecialThrow" (= ("ThrowValue") 4)) (define "ThrowValue" (count Pips)) (game "Sig (Mauritania)" (players 4) (equipment { (board (rectangle 4 20) { (track "Track1" "19,W,N1,E,N1,W,N1,E" P1 directed:True) (track "Track2" "79,W,S1,E,S1,W,S1,E" P2 directed:True) (track "LoopTrack1" "40,E,S1,W" loop:True P1) (track "LoopTrack2" "20,E,N1,W" loop:True P2) (track "GoBackTrack1" "79,W,S1,E,S1,W" P1 directed:True) (track "GoBackTrack2" "19,W,N1,E,N1,W" P2 directed:True)} use:Vertex) ("StickDice" 8) (piece "Marker" P1 ("Move")) (piece "Stick" P2 ("Move"))}) (rules (start { (place "Marker1" (sites Bottom)) (place "Stick2" (sites Top)) (set Team 1 {P1 P3}) (set Team 2 {P2 P4})}) phases:{ (phase "MovingPhase" (play (do (if (<= (var) 0) (roll)) next:(if (is In (mover) (players Team1)) (forEach Piece P1) (forEach Piece P2)) (then (if ("IsSpecialThrow") (moveAgain))))) (nextPhase ("AllPiecesOutOfHomeAndCanNotBeCaptured") "RemovingPhase")) (phase "RemovingPhase" (play ("RollMove" (if (= ("ThrowValue") 4) (move Remove (sites Occupied by:Enemy))))))} (end ("CaptureAllTeam")))) END
Construct a Ludii game based on the following description 2x12 board, divided in half. Spaces on each side take the form of semi-circular sockets, into which the pieces fit. Fifteen pieces per player. Two or three dice. 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. Both players enter their pieces into the same quadrant of the board, and move pieces along a horseshoe-shaped track around the board toward the quadrant on the opposite side of the board. When a piece lands on a space occupied by a single piece of the opponent, the opponent's piece is removed from the board and must enter again as before. When all of the dice present the same number, the player receives another turn. The player to bear off all of their pieces first wins. The game involves 3 dice ###
(define "RemoveAPiece" (move Remove (from))) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" (pips))) (game "Pareia de Entrada" (players 2) (equipment { ("TableBoard" "TableTracksSameDirectionWithHands") (dice d:6 num:3) (hand Each) (piece "Disc" Each (forEach Die if:("DieNotUsed") (if ("IsOffBoard" "SiteToMoveOnTrack") "RemoveAPiece" (if ("NoEnemyOrOnlyOne" "SiteToMoveOnTrack") (move (from) (to "SiteToMoveOnTrack" ("HittingCapture" (handSite Next))))))))}) (rules (start { (place Stack "Disc1" (handSite P1) count:15) (place Stack "Disc2" (handSite P2) count:15)}) (play (do (if (or (is Pending) ("NewTurn")) (roll)) next:(or (forEach Piece top:True) (forEach Piece container:(mover) top:True) (then (and ("ReplayNotAllDiceUsed") (if (and (all DiceUsed) (all DiceEqual)) (and (set Pending) (moveAgain)))))))) (end ("EscapeWin")))) END
Construct a global Ludii definition which fulfills the following requirements. Checks if a stack has a size of 1 at a site. ###
(define "IsSingletonStack" (= 1 (size Stack at:#1))) END
Construct a global Ludii definition which fulfills the following requirements. Defines a regular start board (example: Kaooa). ###
(define "StarBoard" (board (splitCrossings (regular Star #1)) use:Vertex)) END
Describe the mechanics of the following Ludii game (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 5)) (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))))))}))})))) ###
Players take turns placing a stone of their own color on any empty cell of a hexagonal grid of hexagons (a hexhex board). The game is over when the board is full, and the player with the lower score wins. If both players have the same number of groups, your score is your number of odd-sized groups, otherwise it is simply your number of groups. The running score only shows the number of odd groups (with a minus sign in front of it, for technical reasons). Groups of odd size is marked with a red outline. A size 5 board is currently selected END
Construct a Ludii game based on the following description 6x6 board. Two or four players. Three pieces per player, which begin in opposite corners of the board. Players alternate turns moving one piece to an empty adjacent space, orthogonally or diagonally, but not backwards. The first player to place their pieces in the squares in the opposite corner where the opponent's pieces started wins. The board is a square 6x6 The game involves two players. ###
(define "SizeStart" 1) (game "Bajr" (players {(player NE) (player SW)}) (equipment { (board (square 6)) (piece "Counter" Each ("StepToEmpty" (directions {Forwards Leftward Rightward}))) (regions "Home" P1 (expand (intersection (sites Bottom) (sites Left)) steps:"SizeStart" Orthogonal)) (regions "Home" P2 (expand (intersection (sites Top) (sites Right)) steps:"SizeStart" Orthogonal)) (map {(pair P1 P2) (pair P2 P1)})}) (rules (start { (place "Counter1" (sites P1)) (place "Counter2" (sites P2))}) (play (forEach Piece)) (end ("FillWin" (sites (player (mapEntry (mover)))))))) END
Construct a Ludii game based on the following description The pieces start with each color on opposite ends of the board, with two empty holes in between. The goal is to move the pieces so that they end up on opposite sides of the board from their starting position. Pieces can only be moved forward. ###
(define "MoveOfThePiece" (or (move Hop (from) Forward (between if:("IsFriendAt" (between))) (to if:(is Empty (to)))) ("StepForwardToEmpty"))) (game "Insanity" (players 1) (equipment { (board (rectangle 1 10)) (piece "Marker1" P1 E "MoveOfThePiece") (piece "Marker2" P1 W "MoveOfThePiece")}) (rules (start { (place "Marker1" (expand (sites Left) steps:3)) (place "Marker2" (expand (sites Right) steps:3))}) (play (forEach Piece)) (end (if (is Target {2 2 2 2 0 0 1 1 1 1}) (result P1 Win))))) END
Construct a Ludii game based on the following description 4x6-21 board; 8 is most common, 12, 15, and 18 are also popular. Each player's rightmost hole is the musoro. Two counters in each hole in the players' outer rows, except each musoro which has three. Sowing occurs in an anti-clockwise direction. When the final counter lands in an occupied hole, these are picked up and sowing continues. If this final hole is one of the musoro, the player may choose to end their turn instead of continuing to sow. When the final counter lands in an empty hole in the inner row, any counters in the opposite hole in the opponent's inner row are captured. If there also are counters in the opposite hole in the opponent's outer row, these are also captured, but only if there was first a capture from the inner row hole. Players cannot sow from a hole with a single counter unless there are no holes with multiple counters. Single counters can only be sown into an empty hole. Play continues until one player has captured all of the opponent's counters, thus winning the game. 8 Holes per row. ###
(define "NextHoleFrom" ("NextSiteOnTrack" 1 from:#1 #2)) (define "AHoleHasMoreThanOneCounter" (not (all Sites (forEach (sites Mover) if:(< 1 (count at:(site)))) if:(= 0 (count at:(site)))))) (define "LastHoleSowed" (sites {(var)})) (define "NoPiece" (all Sites (sites Player "Home") if:(= 0 (count at:(site))))) (define "Columns" 8) (game "Musoro Tsoro" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "Track1" "0,E,N1,W" loop:True P1) (track "Track2" "16,E,N1,W" loop:True P2)}) (regions "Home" P1 (sites Track "Track1")) (regions "Home" P2 (sites Track "Track2")) (regions "Inner" P1 (difference (sites Track "Track1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "Track2") (sites Top))) (regions "Outer" P1 (sites Bottom)) (regions "Outer" P2 (sites Top)) (piece "Seed" Shared)}) (rules (start { (place "Seed" (intersection (sites Top) (sites Left)) counts:{3} state:2) (place "Seed" (intersection (sites Bottom) (sites Right)) counts:{3} state:1) (set Count 2 to:(union (difference (sites Top) (sites Left)) (difference (sites Bottom) (sites Right))))}) (play (or (if (and (!= 0 (state at:(var))) ("SameTurn")) (move Pass)) (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover "Home")) if:(if "AHoleHasMoreThanOneCounter" (> (count at:(from)) 1) (and (= (count at:(from)) 1) (= 0 (count at:("NextHoleFrom" (from) Mover)))))) (then (and (sow "Track" owner:(mover) apply:(if (= (count at:(to)) 1) (if (is In (to) (sites Mover "Inner")) (if (> (count at:("OppositePit" (to))) 0) (and (remove ("OppositePit" (to))) (if (> (count at:("OppositeOuterPit" (to))) 0) (remove ("OppositeOuterPit" (to))))))) (and (moveAgain) (set Var (to))))) (forEach Site (sites Board) (if (!= 0 (state at:(site))) (set State at:(site) (state at:(site)))))))))) (end (forEach NonMover if:("NoPiece") (result Player Loss))))) END
Construct a Ludii game based on the following description In this Shogi Puzzle, you have to checkmate the black Osho, using the regular rules of Shogi, with the smallest number of moves possible. ###
(define "PlaceAPawn" (do (move (from (sites Occupied by:Mover container:"Hand" component:"Fuhyo")) (to (difference (sites Empty) (sites Mover "LastRank")) if:"OnePawnPerColumn")) ifAfterwards:(not ("KingCheck" Next)))) (define "PlaceALance" (move (from (sites Occupied by:Mover container:"Hand" component:"Kyosha")) (to (difference (sites Empty) (sites Mover "LastRank"))))) (define "PlaceAKnight" (move (from (sites Occupied by:Mover container:"Hand" component:"Keima")) (to (difference (sites Empty) (sites Mover "TwoFurthestRank"))))) (define "OnePawnPerColumn" (= (count Sites in:(sites Occupied by:Mover container:"Board" component:"Fuhyo")) (count Sites in:(difference (sites Occupied by:Mover container:"Board" component:"Fuhyo") (sites Column (column of:(to))))))) (define "NextCanNotMove" (not (can Move (do (forEach Piece Next) ifAfterwards:(not ("KingCheck" Next)))))) (define "KingCheck" (is Threatened (id "Osho" #1) at:(where "Osho" #1))) (define "StepMove" (move Step #1 (to if:(not ("IsFriendAt" (to))) "CapturePiece") #2)) (define "SlideMove" (move Slide #1 (to if:("IsEnemyAt" (to)) "CapturePiece") #2)) (define "CanPromote" (then (if (or ("InPromotionZone" (last To)) ("InPromotionZone" (last From))) (moveAgain)))) (define "Promote" (move Promote (last To) (piece (mapEntry "promoted" (what at:(last To)))))) (define "InTwoFurthestRank" (is In #1 (sites Mover "TwoFurthestRank"))) (define "InLastRank" (is In #1 (sites Mover "LastRank"))) (define "InPromotionZone" (is In #1 (sites Mover "Promotion"))) (define "CapturePiece" (apply (add (piece (mapEntry "captured" (what at:(to)))) (to (mapEntry "where" (what at:(to))))))) (define "CapturePiece" (apply (add (piece (mapEntry "captured" (what at:(to)))) (to (mapEntry "where" (what at:(to))))))) (game "Shogi Puzzle" ("TwoPlayersNorthSouth") (equipment { (board (square 9)) (piece "Osho" Each ("StepMove")) (piece "Fuhyo" Each ("StepMove" Forward (then (if ("InPromotionZone" (last To)) (if ("InLastRank" (last To)) "Promote" (moveAgain)))))) (piece "Ginsho" Each ("StepMove" (directions {Forward BL BR FL FR}) "CanPromote")) (piece "Hisha" Each ("SlideMove" Orthogonal "CanPromote")) (piece "Kakugyo" Each ("SlideMove" Diagonal "CanPromote")) (piece "Keima" Each (forEach Direction Forward (to if:True (apply (forEach Direction (from (to)) (directions {FR FL}) (if (not ("IsFriendAt" (to))) (move (from) (to (apply if:("IsEnemyAt" (to)) (add (piece (mapEntry "Captured" (what at:(to)))) (to (mapEntry "Where" (what at:(to)))))))))))) (then (if ("InPromotionZone" (last To)) (if ("InTwoFurthestRank" (last To)) "Promote" (moveAgain)))))) (piece "Kyosha" Each ("SlideMove" Forward (then (if ("InPromotionZone" (last To)) (if ("InLastRank" (last To)) "Promote" (moveAgain)))))) ("ShogiGold" "Kinsho" "CapturePiece") ("ShogiGold" "Tokin" "CapturePiece") ("ShogiGold" "Narigin" "CapturePiece") (piece "Ryuo" Each (or ("SlideMove" Orthogonal) ("StepMove" Diagonal))) (piece "Ryuma" Each (or ("SlideMove" Diagonal) ("StepMove" Orthogonal))) ("ShogiGold" "Narikei" "CapturePiece") ("ShogiGold" "Narikyo" "CapturePiece") (regions "LastRankP1" P1 (sites Top)) (regions "LastRankP2" P2 (sites Bottom)) (regions "TwoFurthestRankP1" P1 (expand (sites Top))) (regions "TwoFurthestRankP2" P2 (expand (sites Bottom))) (regions "Promotion" P1 (expand (sites Top) steps:2)) (regions "Promotion" P2 (expand (sites Bottom) steps:2)) (map "where" {(pair 3 88) (pair 4 81) (pair 5 89) (pair 6 82) (pair 7 90) (pair 8 83) (pair 9 91) (pair 10 84) (pair 11 92) (pair 12 85) (pair 13 93) (pair 14 86) (pair 15 94) (pair 16 87) (pair 17 88) (pair 18 81) (pair 19 89) (pair 20 82) (pair 21 90) (pair 22 83) (pair 23 91) (pair 24 84) (pair 25 92) (pair 26 85) (pair 27 93) (pair 28 86)}) (map "captured" {(pair 3 4) (pair 4 3) (pair 5 6) (pair 6 5) (pair 7 8) (pair 8 7) (pair 9 10) (pair 10 9) (pair 11 12) (pair 12 11) (pair 13 14) (pair 14 13) (pair 15 16) (pair 16 15) (pair 17 4) (pair 18 3) (pair 19 6) (pair 20 5) (pair 21 8) (pair 22 7) (pair 23 10) (pair 24 9) (pair 25 12) (pair 26 11) (pair 27 14) (pair 28 13)}) (map "promoted" {(pair 3 17) (pair 4 18) (pair 5 19) (pair 6 20) (pair 7 21) (pair 8 22) (pair 9 23) (pair 10 24) (pair 11 25) (pair 12 26) (pair 13 27) (pair 14 28)}) (hand Each size:7)}) (rules (start { (place "Kinsho1" {"G7"}) (place "Kinsho1" 86) (place "Osho2" coord:"G9")}) (play (if "SameTurn" (or "Promote" (move Pass)) (do (or { (move (from (sites Occupied by:Mover container:"Hand" components:{"Kakugyo" "Ginsho" "Hisha" "Kinsho"})) (to (sites Empty))) "PlaceAPawn" "PlaceALance" "PlaceAKnight" (forEach Piece)}) ifAfterwards:(not ("KingCheck" Mover))))) (end { (if (and { ("KingCheck" Next) "NextCanNotMove" (<= (count Turns) 1)}) (result P1 Win)) (if (or (no Moves Next) (and (= 1 (count Turns)) (not (is Mover Next)))) (result P1 Loss))}))) END
Construct a Ludii game based on the following description 10x10 board, 20 pieces per player. 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. ###
(define "IsUnpromoted" ("IsPieceAt" "Counter" Mover (last To))) (game "International Draughts" ("TwoPlayersNorthSouth") ("DraughtsEquipment" (square 10)) (rules ("BlackCellsSetup" 4) (play (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)))}))) (end ("BlockWin")))) END
Construct a Ludii game based on the following description 3x3 intersecting lines with diagonals. Play occurs on the intersections of the lines. Players each have three pieces, initially placed on the sides closest to the player. Players move the pieces to an adjacent unoccupied intersection along the lines. The goal is to make three in a row which cannot be in the starting position. An alternate version requires the three in a row to be diagonal. ###
(define "NotAllPieceInHome" (not (all Sites (sites Occupied by:Mover) if:(is In (site) (sites Mover))))) (game "Tant Fant" (players 2) (equipment { ("AlquerqueBoard" 3) (piece "Marker" Each "StepToEmpty") (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start { (place "Marker1" (sites P1)) (place "Marker2" (sites P2))}) (play (forEach Piece)) (end (if (and "NotAllPieceInHome" (is Line 3)) (result Mover Win))))) END
Construct a Ludii game based on the following description 7x7 board. 24 pieces per player. Players alternate turns placing two pieces on the board. When all of the pieces are placed, players alternate turns moving one piece orthogonally any distance. The first player to place seven of their pieces in an orthogonal or diagonal line wins. ###
(game "Fart (7x7)" (players 2) (equipment { (board (square 7)) (piece "Marker" Each (move Slide Orthogonal)) (hand Each)}) (rules (start (place "Marker" "Hand" count:24)) phases:{ (phase "Placement" (play (move (from (handSite Mover)) (to (difference (sites Board) (centrePoint)) if:(is Empty (to))) (then (if ("NewTurn") (moveAgain))))) (nextPhase Mover (is Empty (handSite Mover)) "Move")) (phase "Move" (play (forEach Piece)))} (end (if (is Line 7) (result Mover Win))))) END
Construct a Ludii game based on the following description Players take turns placing one stone of either color on the board, until it is full. Player One wins if there is an odd number of groups with at least five pieces on the board, Player Two wins otherwise. Played on a size 5 board. Min group size 5. ###
(define "GroupCount" (+ (count Groups if:(= (who at:(to)) P1) min:5) (count Groups if:(= (who at:(to)) P2) min:5))) (game "Odd" (players 2) (equipment { (board (rotate 90 (hex 5))) (piece "Marker" Each) (hand Shared size:2)}) (rules (start { (place "Marker1" (handSite Shared)) (place "Marker2" (handSite Shared 1))}) (play (move (from (sites Hand Shared)) (to (sites Empty)) copy:True)) (end (if (is Full) (if (is Odd (+ (count Groups if:(= (who at:(to)) P1) min:5) (count Groups if:(= (who at:(to)) P2) min:5))) (result P1 Win)) (result P2 Win))))) END
Construct a Ludii game based on the following description 5x6 board, made in the sand. One player plays with twelve sticks and the other with twelve pebbles. The player with the sticks plays first. Players alternate turns placing one of their pieces on an empty space on the board. Players are not permitted to place more than two of their own pieces in an orthogonal row on the board. When all of the pieces are placed, players alternate turns moving one of their pieces orthogonally one space. When a player successfully places three of their pieces in an orthogonal row of three, the player captures one of the opponent's pieces. The player who captures all of their opponent's pieces wins. ###
(game "Wali" (players 2) (equipment { (board (rectangle 5 6)) (hand Each) (piece "Stick" P1 ("StepToEmpty" Orthogonal (then ("ReplayIfLine3" Orthogonal)))) (piece "Ball" Each ("StepToEmpty" Orthogonal (then ("ReplayIfLine3" Orthogonal))))}) (rules (start { (place "Stick1" (handSite P1) count:12) (place "Ball2" (handSite P2) count:12)}) phases:{ (phase "Placement" (play (do (move (from (handSite Mover)) (to (sites Empty))) ifAfterwards:(not (is Line 3 Orthogonal)))) (nextPhase ("HandEmpty" P2) "Movement")) (phase "Movement" (play (if "SameTurn" ("RemoveAnyEnemyPiece") (forEach Piece))))} (end ("CaptureAll" Next)))) END
Construct a Ludii game based on the following description 4x7 board. Three counters in each hole in the outer row; before beginning each player rearranges these as they wish, with the following rules: The leftmost hole in the outer row must have the most counters; Each hole must have equal to or less than the number of the counters as the hole on its left; there can be a maximum of two holes with one counter in the inner row. Initial phase: Sowing occurs in an anti-clockwise direction, and when a counter lands in an occupied hole the sowing continues. When the final counter lands in an empty hole, the turn ends. If the empty hole is in the player's inner row, counters in the opponent's inner row opposite are captured, and if there are also counters in the opponent's outer row hole opposite, these are also taken. The initial phase ends for a player when they have one counter in each hole. After this, players can only move single counters into empty holes. The player who captures all of the opponent's counters wins. ###
(define "NoPiece" (all Sites (sites Player "Home") if:(= 0 (count at:(site))))) (define "OneCounterInEachHole" (all Sites (sites Mover "Home") if:(> 2 (count at:(site))))) (define "NextHole" ("NextSiteOnTrack" #2 from:#1 "TrackCCW")) (define "MaximumOfTwoHolesInInner" (>= 2 (count Sites in:(forEach (sites Mover "Inner") if:(= 1 (count at:(site))))))) (define "EqualOrLessThanLeftHole" (all Sites (sites Mover "Home") if:(if (= (site) ("HoleOnLeft")) True (<= (count at:(site)) (count at:("HoleOnLeft")))))) (define "HoleOnLeft" (if (is Mover P1) (ahead (site) W) (ahead (site) E))) (define "LeftMostCounters" (all Sites (difference (sites Mover "Home") (mapEntry "LeftMost" Mover)) if:(> (count at:(mapEntry Mover)) (count at:(site))))) (define "Columns" 7) (game "Quiela" (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 (sites Bottom)) (regions "Outer" P2 (sites Top)) (piece "Seed" Shared) (map "LeftMost" {(pair P1 0) (pair P2 27)}) (hand Each)}) (rules (start (set Count 3 to:(union (sites P1 "Outer") (sites P2 "Outer")))) phases:{ (phase "Rearrangement" (play (or (move (from (sites Mover "Home") if:(is Occupied (from))) (to (difference (sites Mover) (from)))) (if (and {("LeftMostCounters") ("EqualOrLessThanLeftHole") ("MaximumOfTwoHolesInInner")}) (move Pass)))) (nextPhase (all Passed) "InitialPhase")) (phase "InitialPhase" (play (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover "Home")) if:(is Occupied (from))) (then (sow "TrackCCW" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover "Inner")) (if (is Occupied ("OppositePit" (to))) (and (fromTo (from ("OppositePit" (to))) (to (handSite Mover)) count:(count at:("OppositePit" (to)))) (if (is Occupied ("OppositeOuterPit" (to))) (fromTo (from ("OppositeOuterPit" (to))) (to (handSite Mover)) count:(count at:("OppositeOuterPit" (to))))))))))))) (nextPhase Mover ("OneCounterInEachHole") "MainPhase")) (phase "MainPhase" (play (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover "Home")) if:(if (< 1 (count at:(from))) True (if (= 1 (count at:(from))) (is Empty ("NextHole" (from) 1))))) (then (sow "TrackCCW" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover "Inner")) (if (is Occupied ("OppositePit" (to))) (and (fromTo (from ("OppositePit" (to))) (to (handSite Mover)) count:(count at:("OppositePit" (to)))) (if (is Occupied ("OppositeOuterPit" (to))) (fromTo (from ("OppositeOuterPit" (to))) (to (handSite Mover)) count:(count at:("OppositeOuterPit" (to))))))))))))))} (end (forEach NonMover if:("NoPiece") (result Player Loss))))) END
Construct a global Ludii definition which fulfills the following requirements. Returns the number of pieces owned by a player around a given site. ###
(define "OccupiedNbors" (count Sites in:(intersection (sites Around #1) (sites Occupied by:#2)))) END
Construct a global Ludii definition which fulfills the following requirements. Defines a hop move in all the diagonal directions over an enemy to an empty site. The enemy piece is removed. ###
(define "HopDiagonalCapture" (move Hop Diagonal (between if:("IsEnemyAt" (between)) (apply (remove (between)))) (to if:(is Empty (to))))) END
Describe the mechanics of the following Ludii game (define "PiecesOwnedBy" (+ (count at:(mapEntry #1)) (count in:(sites #1)))) (game "Kara" (players 2) (equipment { (mancalaBoard 2 3 (track "Track" "1,E,N,W" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 FirstSite) (pair P2 LastSite)}) (map "RightHole" {(pair P1 3) (pair P2 4)}) (piece "Seed" Shared)}) (rules (start (set Count 7 to:(sites Track))) (play (move Select (from (sites Mover) if:(> (count at:(from)) 0)) (then (sow if:(and (is In (count at:(to)) (sites {2 4 6})) (is In (to) (union (sites Next) (sites {(mapEntry "RightHole" (mover))})))) apply:(fromTo (from (to)) (to (mapEntry (mover))) count:(count at:(to))))))) (end ("MancalaByScoreWhen" (no Moves Mover))))) ###
Play begins with seven counters in each hole. Players begin by picking up the counters in one of their holes and sowing them anti-clockwise. If the final counter lands in an opponent's hole or the rightmost hole belonging to the player sowing, having dropped counters in the opponent's holes making them contain two, four, or six counters, the contents of those holes are captured. The player who has the most counters at the end of the game wins. END
Construct a Ludii game based on the following description Reversi is played on a hexhex-6 board with some cells removed. Pieces are double-sided, with each side distinct in some way from the other. Each side designates ownership of that pieces to a certain player when face-up. In Reversi Mode, play begins with the players taking turns placing pieces into the central six hexagons until they are full; in Othello mode, the central six hexagons are pre-filled with alternating Black and White discs. Then players may place their pieces next to an opponent's piece, as long as a straight line can be drawn between the new piece and an existing piece belonging to that player that goes through the opponent's piece. The opponent's pieces between the new piece and the old piece are then flipped and now belong to the player who just played. If a player cannot make a legal move, they pass. Play continues until the board is full or neither player can make a legal move. The player with the most pieces on the board wins. The pieces are placed on the board. ###
(define "ReverseBoundedPieces" (custodial (from (site)) (between if:(is Enemy (state at:(between))) (apply (allCombinations (add (piece "Disc0" state:(mover)) (to (site))) (flip (between))))) (to if:(is Friend (state at:(to)))))) (game "MacBeth" (players 2) (equipment { (board (remove (hex 6) cells:{7 9 11 22 24 26 28 41 43 45 47 49 62 64 66 68 79 81 83})) (piece "Disc" Neutral (flips 1 2))}) (rules phases:{ (phase "Placement" (play (move Add (piece "Disc0" state:(mover)) (to (intersection (sites Empty) (sites Centre))))) (nextPhase Mover (>= (count Moves) 5) "Playing")) (phase "Playing" (play (forEach Site (sites Empty) (append "ReverseBoundedPieces" (then (and (set Score P1 (count Sites in:(sites State 1))) (set Score P2 (count Sites in:(sites State 2)))))))))} (end (if (all Passed) (byScore))))) END
Construct a Ludii game based on the following description 5x5 intersecting lines. Two triangles on opposite sides of the square, with the apex intersecting with the midpoint of opposite sides. A line is drawn from the apex , bisecting the base, and another line bisecting this one and the opposite two sides of the triangle. Lines are drawn through the apex, extending the sides of the triangle to the midpoint of the adjacent side. Sixteen pieces per player, which begin on the points of the board closes to the player. Players alternate turns moving a piece to an empty adjacent spot orthogonally or diagonally, even when there are not lines connecting the adjacent points. A player's piece may hop over an opponent's piece to an empty space immediately on the opposite side of it to capture it. The player who occupies all of the points in the opponent's triangle wins. ###
(game "Shanzak Kammar" (players 2) (equipment { (board (add ("AlquerqueGraphWithBottomAndTopTriangles") edges:{{5 1} {1 7} {7 3} {3 9} {13 9} {7 13} {11 5} {15 11} {11 17} {7 11} {17 13} {13 19} {23 19} {23 17} {17 21} {15 21}}) use:Vertex) (piece "Marker" Each (or "StepToEmpty" "HopCapture")) (regions "Goal" P1 (expand (sites Top))) (regions "Goal" P2 (expand (sites Bottom)))}) (rules (start { (place "Marker1" (expand (sites Bottom) steps:3)) (place "Marker2" (expand (sites Top) steps:3))}) (play (forEach Piece)) (end (if (= 6 (count Pieces Mover in:(sites Mover "Goal"))) (result Mover Win))))) END
Describe the mechanics of the following Ludii game (define "StackSizeLessThan2" (< (size Stack at:("NextSiteOnTrack" (pips))) 2)) (define "Unstack" (set State at:(last To) 0)) (define "PieceStacked" (= (state at:#1) 1)) (define "RemoveAPiece" (move Remove (from))) (define "SiteToSelect" ("NextSiteOnTrack" (- (pips) 1) from:(mapEntry "StartTrack" (mover)))) (game "Doblet" (players 2) (equipment { ("TableBoard" ("TableTracksOpposite" End)) (dice d:6 num:3) (piece "Disc" Each (forEach Die if:("DieNotUsed") (if ("IsEndTrack" ("NextSiteOnTrack" (pips))) "RemoveAPiece" (move (from) (to ("NextSiteOnTrack" (pips)) if:"StackSizeLessThan2" (apply (if ("IsEnemyAt" (to)) (remove (to))))))))) (map "StartTrack" {(pair P1 0) (pair P2 12)})}) (rules (start { (place Stack "Disc1" (sites {0..5}) count:2 state:1) (place Stack "Disc2" (sites {12..17}) count:2 state:1)}) phases:{ (phase "UnStacking" (play ("RollEachNewTurnMove" (forEach Die if:("DieNotUsed") (if ("PieceStacked" "SiteToSelect") (move Select (from ("SiteToSelect")) (then (and { ("Unstack") ("ReplayNotAllDiceUsed")}))))))) (nextPhase Mover (all Sites (sites Occupied by:Mover) if:(not ("PieceStacked" (site)))) "BearingOff")) (phase "BearingOff" (play ("RollEachNewTurnMove" (forEach Piece top:True) (then (if (and (not (was Pass)) (not (all DiceUsed))) (moveAgain))))))} (end ("EscapeWin")))) ###
2x12 board, divided in half. Spaces on each side take the form of semi-circular sockets, into which the pieces fit. Twelve pieces per player. Pieces begin on one half of a player's side of the board (the half to the left of one player, and to the right of the other player), two per space, stacked on top of one another. Three dice. To begin, a player must first unstack their pieces, by rolling the number of the space on which the stack is located, and thus removing the stack, but keeping the piece on the same space. Once complete, pieces move in a track the long way around the board toward the portion where the opponent begins. 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. No more than two pieces can occupy a space at a time. When a piece lands on a space occupied by a single piece of the opponent, the opponent's piece is removed from the board. Players attempt to bear off their pieces by rolling the exact number of spaces left on the board, plus one. When unstacking the pieces in the beginning or when bearing off at the end, if the player cannot play their roll but the opponent is able, the opponent may use the roll. The first player to bear off all of their pieces wins. END
Construct a global Ludii definition which fulfills the following requirements. Defines a piece moving like a king in Chess (castling is not described in this ludemeplex). ###
(define "ChessKing" (piece #1 Each (move Step (to if:(not ("IsFriendAt" (to))) (apply (if ("IsEnemyAt" (to)) (remove (to) #2)))) #3))) END
Construct a Ludii game based on the following description The two players, Red and Blue, alternately place tokens on the intersections of the board until each has placed fifteen. Thereafter they alternate turns sliding a single token along a line to an adjacent vertex. A player who occupies the three vertices of any triangle has formed a mill and may relocate one enemy token. Occupying the four vertices of a square (forming a double mill) allows the player to relocate two enemy tokens. No more than two tokens may be relocated in a single turn, even if a player completes a mill and double mill with the same move. The winner is the first player to occupy all six vertices of either any neutral hexagon or one of his/her own color. A win can be achieved during either the placement or movement phases of the game. ###
(define "NextPlayerHasLost" (is Triggered "Lose" Next)) (define "NextPlayerLose" (trigger "Lose" Next)) (define "AllCellOfLastVertex" (sites Incident Cell of:Vertex at:(last To))) (define "PlaceAPiece" (move (from (handSite Mover)) (to (sites Empty)))) (define "MoveAnEnemyPiece" (move (from (sites Occupied by:Next container:"Board")) (to (sites Empty) (apply if:"OneMoreToMove" (moveAgain))))) (define "CellFilled" (= (count Sites in:(intersection "AllVerticesOfCell" (sites Occupied by:Mover))) (count Sites in:"AllVerticesOfCell"))) (define "SquareFilled" (= 4 (count Sites in:"AllVerticesOfCell"))) (define "HexFilled" (= 6 (count Sites in:"AllVerticesOfCell"))) (define "AllVerticesOfCell" (sites Incident Vertex of:Cell at:(site))) (define "TwoPieceToMove" (set Pending)) (define "OneMoreToMove" (is Pending)) (game "Kensington" (players 2) (equipment { (board (rotate 90 (tiling T3464 2)) use:Vertex) (hand Each) (piece "Marker" Each "StepToEmpty") (regions "HexA" P1 (sites Cell "E4")) (regions "HexB" P1 (sites Cell "I4")) (regions "HexA" P2 (sites Cell "E12")) (regions "HexB" P2 (sites Cell "I12")) (regions "HexNeutral1" (sites Cell "C8")) (regions "HexNeutral2" (sites Cell "G8")) (regions "HexNeutral3" (sites Cell "K8"))}) (rules (start (place "Marker" "Hand" count:15)) (play (if "SameTurn" "MoveAnEnemyPiece" (if ("HandEmpty" Mover) (forEach Piece) "PlaceAPiece" (then (forEach Site "AllCellOfLastVertex" (if "CellFilled" (if "HexFilled" (if (or { (= "AllVerticesOfCell" (sites Mover "HexA")) (= "AllVerticesOfCell" (sites Mover "HexB")) (= "AllVerticesOfCell" (sites "HexNeutral1")) (= "AllVerticesOfCell" (sites "HexNeutral2")) (= "AllVerticesOfCell" (sites "HexNeutral3"))}) "NextPlayerLose") (and (if "SquareFilled" "TwoPieceToMove") (moveAgain))))))))) (end (if "NextPlayerHasLost" (result Mover Win))))) END
Construct a global Ludii definition which fulfills the following requirements. Defines a pachisi board. ###
(define "PachisiBoard" (board (add (hole ("CrossGraph" 3 19) (poly {{8 8} {8 11} {11 11} {11 8}})) cells:{ { 8 28 48 68 69 70 71 51 31 11 10 9}}) #1)) END
Construct a Ludii game based on the following description Each player has his own board, set up so that the opponent cannot see it. The referee has a board of his own on which he plays the moves of both players. He can see both player's boards. To make a move, a player plays a stone on his own board. The referee then checks on his board whether the move is legal and informs both players about the tried move. How exactly the referee comments on the move depends on the rule variant. As long as a player tries to play an illegal move, it's still his turn and he may try another move. After the player has made a legal move, the referee copies the move to his own board. Then, it's the other player's turn. The game is played on a 9x9 board ###
(define "MadeALegalMove" (do (add (to (last To)) (then (and { "CaptureSurroundedPiece" (set Hidden at:(last To) to:Next) (note player:Mover "has moved") (note player:Next "to play")}))) ifAfterwards:("HasFreedom" Orthogonal))) (define "NotEmpty" (not (is In (last To) (sites Empty)))) (define "IllegalMove" (and { (note player:Mover "made an illegal move") (note player:Mover "to play") (moveAgain)})) (define "CaptureSurroundedPiece" (enclose (from (last To)) Orthogonal (between if:("IsEnemyAt" (between)) (apply (and (addScore Mover 1) (remove (between))))))) (game "Phantom Go" (players 2) (equipment { (board (square 9) use:Vertex) (piece "Marker" Each)}) (rules (play (or (move Select (from (union (sites Empty) (sites Hidden to:Mover))) (then (priority { (if ("NotEmpty") ("IllegalMove")) ("MadeALegalMove") ("IllegalMove")}))) (move Pass))) (end (if (all Passed) (byScore { (score P1 (+ (score P1) (size Territory P1))) (score P2 (+ (score P2) (size Territory P2)))}))))) END
Construct a Ludii game based on the following description 4x12-24 (only even numbers allowed) board. Play begins with two counters in the outer row of each players' holes and two counter in each of the four holes on the right hand side of both players' inner row of holes. Player picks up contents of any hole containing two or more counters and sows them anti-clockwise. If the final counter of the sowing falls into an empty hole, the turn is over. If the last counter falls into an occupied hole, sowing continues by picking up the counters in that hole and continuing in the same direction. If the last counter falls into an occupied hole in the player's inner row, and the opponent's two holes opposite it are occupied, these are captured and sowing continues using these counters beginning at the next hole after the one which caused the capture. Play ends when one player cannot move; i.e. when they have only single counters in holes or all their counters have been captured. Each player has 12 holes. The player can sow from any hole with one or more seeds. ###
(define "PiecesOwnedBy" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (define "MoveAgainAfterCapture" (is Pending)) (define "PlayFromNextHole" (sites {(value Pending)})) (define "NextHole" ("NextSiteOnTrack" 1 from:(to) "Track")) (define "Columns" 12) (game "Hus (Damara)" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "Track1" "0,E,N1,W" loop:True P1) (track "Track2" "24,E,N1,W" loop:True P2)}) (regions "Home" P1 (sites Track "Track1")) (regions "Home" P2 (sites Track "Track2")) (regions "Inner" P1 (difference (sites Track "Track1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "Track2") (sites Top))) (regions "Outer" P1 (sites Bottom)) (regions "Outer" P2 (sites Top)) (piece "Seed" Shared) (hand Each)}) (rules (start (set Count 2 to:(union { (expand (intersection (sites Row 1) (sites Right)) steps:3 W) (expand (intersection (sites Row 2) (sites Left)) steps:3 E) (sites P1 "Outer") (sites P2 "Outer")}))) (play (move Select (from (if ("SameTurn") (if "MoveAgainAfterCapture" "PlayFromNextHole" "LastHoleSowed") (sites Mover "Home")) if:(> (count at:(from)) 0)) (then (sow "Track" owner:(mover) apply:(if (> (count at:(to)) 1) (if (and { (is In (to) (sites Mover "Inner")) (> (count at:("OppositePit" (to))) 0) (> (count at:("OppositeOuterPit" (to))) 0)}) (and { (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))) (fromTo (from ("OppositePit" (to))) (to (handSite Mover)) count:(count at:("OppositePit" (to)))) (fromTo (from ("OppositeOuterPit" (to))) (to (handSite Mover)) count:(count at:("OppositeOuterPit" (to)))) (if (> (count at:"NextHole") 1) (and (set Pending "NextHole") (moveAgain)))}) (moveAgain))))))) (end ("MancalaByScoreWhen" (no Moves Mover))))) END
Construct a Ludii game based on the following description 2x6 board. Four counters in each hole. Sowing occurs in a clockwise direction when starting from the three holes on the left of the board, and in an anti-clockwise direction when starting from the three holes on the right. Sowing ends when the final counter is dropped, regardless of whether the hole is occupied or not. When the final counter is dropped into a hole containing three counters, thus making it contain four, the hole is captured. This can only be done if the hole is one of the end holes on either side of either row, or the penultimate holes on either side of the opponent's row. Sowing is not allowed from a captured hole. When no player is able to move, the player with the most counters in their captured holes wins. ###
(define "PiecesOwnedBy" (count in:(forEach (sites Board) if:(= (id #1) (state at:(site)))))) (game "Qelat (Beni Amir-Mensa)" (players 2) (equipment { (mancalaBoard 2 6 store:None { (track "TrackCCW" "0,E,N,W" loop:True) (track "TrackCW" "5,W,N,E" loop:True)}) (piece "Seed" Shared) (regions "Left" P1 (intersection (expand (sites Left) steps:2) (sites Bottom))) (regions "Left" P2 (intersection (expand (sites Right) steps:2) (sites Top))) (regions "Right" P1 (intersection (expand (sites Right) steps:2) (sites Bottom))) (regions "Right" P2 (intersection (expand (sites Left) steps:2) (sites Top)))}) (rules (start (set Count 4 to:(sites Track))) (play (or (move Select (from (sites Mover "Left") if:(and (= 0 (state at:(from))) (is Occupied (from)))) (then (sow "TrackCW" apply:(if (and { (is In (to) (union (expand (sites Right)) (expand (sites Left)))) (= 4 (count at:(to))) (= 0 (state at:(to)))}) (set State at:(to) (mover)))))) (move Select (from (sites Mover "Right") if:(and (= 0 (state at:(from))) (is Occupied (from)))) (then (sow "TrackCCW" apply:(if (and { (is In (to) (union (expand (sites Right)) (expand (sites Left)))) (= 4 (count at:(to))) (= 0 (state at:(to)))}) (set State at:(to) (mover)))))))) (end ("MancalaByScoreWhen" (and (no Moves P1) (no Moves P2)))))) END
Describe the mechanics of the following Ludii game (game "Shatranj (Iraq)" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) ("ChessKing" "King_noCross") (piece "Ferz_noCross" (or ("SlideCapture") ("LeapCapture" "KnightWalk"))) (piece "Elephant" (move Slide Diagonal (between if:(or (is In (between) (sites Around (from))) (is Empty (between)))) (to if:(and (not ("IsPieceAt" "Elephant" Next (to))) ("IsEnemyAt" (to))) (apply if:(not (is In (to) (sites Around (from)))) (if ("IsEnemyAt" (to)) (remove (to))))))) ("ChessKnight" "Knight") ("ChessRook" "Rook") ("ChessPawn" "Pawn" ~ (then ("PromoteIfReach" (sites Mover "Promotion") "Ferz_noCross"))) (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:"D8") (place "King_noCross2" coord:"E8")}) (play (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King_noCross" Mover)))) (end { ("Checkmate" "King_noCross") (if (no Moves Mover) (result Mover Loss))}))) ###
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, or like the Asb. 2 x Rukh (rook): Any number of spaces orthogonally. No castling. 2 x Pil (elephant): Any distance diagonally, jumping over the first. Cannot capture another Pil. 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. Promoted to Fers when reaching the eighth rank. An opponent's piece is captured by moving a player's own piece onto a space occupied by the opponent's piece. When a Shah can be captured on the next turn by an opponent's piece, it is in check. The Shah 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. Stalemate results in a win for that player causing it. END
Construct a global Ludii definition which fulfills the following requirements. Checks if only one single group with pieces owned by a player exists. This ludemeplex can be used only in an ending condition. ###
(define "SingleGroupWin" (if ("IsSingleGroup" #1 #2) (result #1 Win))) END
Describe the mechanics of the following Ludii game (define "SquareGraphics" (graphics { (board Style Go) (piece Background image:"square.svg" edgeColour:(colour 100 100 100 255)) (piece Foreground image:"cross.svg" edgeColour:(colour 100 100 100 255)) (piece Colour strokeColour:(colour 100 100 100 255)) (piece Scale .26) (show Piece Value CornerLeft valueOutline:True scale:1.5)})) (define "HexGraphics" (graphics { (board Colour OuterEdges (colour Black)) (board Colour InnerEdges (colour Black)) (board StyleThickness OuterEdges 1.5) (board StyleThickness InnerEdges 0.4) (board StyleThickness InnerVertices 0.4) (board StyleThickness OuterVertices 0.4) (board Colour Symbols (colour Black)) (player Colour P1 (colour Black)) (player Colour P2 (colour LightOrange)) (region Colour (sites Occupied by:P1) (colour 60 120 170 120)) (region Colour (sites Occupied by:P2) (colour 195 195 200 120)) (show Piece Value Middle valueOutline:False scale:.8)})) (define "SetNewGroupValue" (forEach Site (sites Group at:(last To) All) (set Value at:(site) (count Sites in:(sites Group at:(last To) All))))) (define "ToToSites" (to (difference (sites Empty) (forEach of:(sites Occupied by:Mover) (if (>= (value Piece at:(site)) (score Mover)) (sites Around (site) All)))))) (game "Ecosys" (players 2) (equipment { ((board (square Square 9) use:Vertex)) (piece "Disc" Each)}) (rules (start (set Score Each 0)) (play (move Add ("ToToSites") (then (and ("SetNewGroupValue") (set Score Mover (size Array (sizes Group All Mover))))))) (end ("NoMoves" Loss)))) ###
With the board empty, Black starts. Players take turns in alternation, placing a stone on to an empty cell. However, a stone must not be placed next to a group that already has the same (or more) stones as there are friendly groups. The game is lost by the first player forced to place a stone next to a friendly group that has as many (or more) stones as there are friendly groups. 9 Square END
Modify the Ludii game according to the following option changes: The game is played on a 4x4 board -> The game is played on a 6x6 board The version of the game played with 3 players. -> The version of the game played with 4 players. (game "Omega" (players 3) (equipment { (board (hex 4)) (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))) (score P3 (* (sizes Group P3)))}))))) ###
(game "Omega" (players 4) (equipment { (board (hex 6)) (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))) (score P3 (* (sizes Group P3))) (score P4 (* (sizes Group P4)))}))))) END
Construct a global Ludii definition which fulfills the following requirements. Defines two players, P1 moving in direction to the north and P2 moving in direction to the south. ###
(define "TwoPlayersNorthSouth" (players {(player N) (player S)})) END
Describe the mechanics of the following Ludii game (game "Ahtarah Guti" (players 2) (equipment { ("AlquerqueBoardWithBottomAndTopTriangles") (piece "Marker" Each (or ("HopSequenceCapture") ("StepToEmpty")))}) (rules (start { (place "Marker1" (union {(sites Row 0) (sites Row 1) (sites Row 2) (sites Row 3) (sites {13 14})})) (place "Marker2" (union {(sites Row 5) (sites Row 6) (sites Row 7) (sites Row 8) (sites {10 11})}))}) (play (if "SameTurn" (or ("HopSequenceCaptureAgain") (move Pass)) (forEach Piece))) (end ("CaptureAll" Next)))) ###
5x5 intersecting lines, with diagonals in each quadrant. Two triangles, the apexes of which intersect with the square at the midpoint of opposite sides. One line bisecting the base of the triangle, and another bisecting this line. Eighteen pieces per player, each side arranged on one side of the board, with the central point empty and the player's pieces on the points to the right of it. Players alternate turns moving one of their pieces to an empty point. A piece may jump an opponent's piece to capture it. Multiple captures are allowed. The player who captures all of the opponent's pieces wins. END
Describe the mechanics of the following Ludii game (define "SiteToMoveOnTrack" ("NextSiteOnTrack" (count Pips))) (game "Had" (players 2) (equipment { (board (rectangle 3 14) { (track "Track1" "0,E,N1,W,N1,E" P1 directed:True) (track "Track2" "41,W,S1,E,S1,W" P2 directed:True)}) (dice d:4 num:2) (piece "Marker" Each (if ("IsOffBoard" ("SiteToMoveOnTrack")) (move Remove (from)) (move (from) (to ("SiteToMoveOnTrack") if:(is Empty (to))))))}) (rules (start { (place "Marker1" (sites Bottom)) (place "Marker2" (sites Top))}) (play ("RollMove" (forEach Piece))) (end (if (no Pieces Mover) (result Mover Win))))) ###
3x14 board. Fourteen pieces per player, placed in the outer rows of the board. Two knucklebones used as dice. Players move their pieces according to the throws of the knucklebones. Pieces move in a boustrophedon path along the board. The first player to remove their pieces from the board wins. END
Construct a global Ludii definition which fulfills the following requirements. Checks if an enemy is on a site. ###
(define "IsEnemyAt" (is Enemy (who at:#1 #2))) END
Construct a Ludii game based on the following description 4x8=20 holes, with an even number per row. One counter in each hole, except the right-hand end row of the inner row. Sowing occurs in an anti-clockwise direction, only into an empty hole. When a counter lands in a hole in the inner row and the opponent's opposite inner row hole is empty, the contents of the opponent's opposite outer row hole are captured. The player who captures all of the opponent's pieces wins. ###
(define "NextHoleFrom" ("NextSiteOnTrack" 1 from:#1)) (define "NoPiece" (all Sites (sites Player "Home") if:(= 0 (count at:(site))))) (define "Columns" 8) (game "Sute" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "Track1" "0,E,N1,W" loop:True P1) (track "Track2" "16,E,N1,W" loop:True P2)}) (regions "Home" P1 (sites Track "Track1")) (regions "Home" P2 (sites Track "Track2")) (regions "Inner" P1 (difference (sites Track "Track1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "Track2") (sites Top))) (piece "Seed" Shared)}) (rules (start (set Count 1 to:(difference (union (sites P1 "Home") (sites P2 "Home")) (union (intersection (sites Right) (sites Row 1)) (intersection (sites Left) (sites Row 2)))))) (play (move Select (from (sites Mover "Home") if:(and (> (count at:(from)) 0) (= 0 (count at:("NextHoleFrom" (from)))))) (then (sow "Track" owner:(mover) apply:(if (and (= (count at:("OppositePit" (to))) 0) (is In (to) (sites Mover "Inner"))) (remove ("OppositeOuterPit" (to)))))))) (end (forEach NonMover if:("NoPiece") (result Player Loss))))) END
Modify the Ludii game according to the following option changes: 5x5 Square -> 6x6 Square (define "KnightVector" (sites (from) {{F R F L F} {F L F R F}})) (define "UnconfinedStiesOf" (forEach (sites Board) if:(!= Infinity (count Steps Adjacent (step Adjacent (to if:(or (is Empty (to)) (is #1 (who at:(to)))))) (site) (sites Outer))))) (define "SetScoreOf" (set Score #1 (- 0 (count Sites in:(difference (sites Occupied by:#1) ("UnconfinedStiesOf" #1)))))) (define "MakeSwap" (if (is Empty ("SwapSite" 1)) (fromTo (from ("SwapSite" 0)) (to ("SwapSite" 1))) (if (is Empty ("SwapSite" 0)) (fromTo (from ("SwapSite" 1)) (to ("SwapSite" 0))) (set Var "Piece1" ("SwapPiece" 1) (then (add (piece ("SwapPiece" 0)) (to ("SwapSite" 1) (apply (remove (to)))) (then (add (piece (var "Piece1")) (to ("SwapSite" 0) (apply (remove (to)))))))))) (then (and { ("SetScoreOf" Mover) ("SetScoreOf" Next) (forget Value All) (if (and ("NewTurn") (< -1 (counter))) (moveAgain))})))) (define "SwapPiece" (what at:("SwapSite" #1) level:(topLevel at:("SwapSite" #1)))) (define "SwapSite" (arrayValue (values Remembered) index:#1)) (define "Placement" (move Select (from #1 if:(> 2 (count Stack at:(from)))) (to "KnightVector" if:(and { (is In (to) (sites Occupied by:Mover top:True)) (= 2 (count Sites in:("SwapSites" (to) (from)))) (or (= 1 (count Sites in:(intersection ("SwapSites" (to) (from)) (sites Occupied by:Mover top:True)))) (= 1 (count Sites in:(intersection ("SwapSites" (to) (from)) (sites Occupied by:Next top:True)))))})) (then (and { (add (piece (id "Disc" Mover)) (to (last From)) stack:True) (forEach Site ("SwapSites" (last To) (last From)) (remember Value (site)))})))) (define "SwapSites" (intersection (sites Around #1 Adjacent) (sites Around #2 Adjacent))) (game "Veloop (Square)" (players 2) (equipment { (board (renumber (rotate 90 (square Square 5))) use:Cell) (piece "Disc" Each)}) (rules (start { (place "Disc1" {7}) (place "Disc2" {12})}) (play (priority ("Placement" (sites Empty)) ("Placement" (sites Occupied by:Next)) (then ("MakeSwap")))) (end (if (!= 0 (+ (score P1) (score P2))) (byScore))))) ###
(define "KnightVector" (sites (from) {{F R F L F} {F L F R F}})) (define "UnconfinedStiesOf" (forEach (sites Board) if:(!= Infinity (count Steps Adjacent (step Adjacent (to if:(or (is Empty (to)) (is #1 (who at:(to)))))) (site) (sites Outer))))) (define "SetScoreOf" (set Score #1 (- 0 (count Sites in:(difference (sites Occupied by:#1) ("UnconfinedStiesOf" #1)))))) (define "MakeSwap" (if (is Empty ("SwapSite" 1)) (fromTo (from ("SwapSite" 0)) (to ("SwapSite" 1))) (if (is Empty ("SwapSite" 0)) (fromTo (from ("SwapSite" 1)) (to ("SwapSite" 0))) (set Var "Piece1" ("SwapPiece" 1) (then (add (piece ("SwapPiece" 0)) (to ("SwapSite" 1) (apply (remove (to)))) (then (add (piece (var "Piece1")) (to ("SwapSite" 0) (apply (remove (to)))))))))) (then (and { ("SetScoreOf" Mover) ("SetScoreOf" Next) (forget Value All) (if (and ("NewTurn") (< -1 (counter))) (moveAgain))})))) (define "SwapPiece" (what at:("SwapSite" #1) level:(topLevel at:("SwapSite" #1)))) (define "SwapSite" (arrayValue (values Remembered) index:#1)) (define "Placement" (move Select (from #1 if:(> 2 (count Stack at:(from)))) (to "KnightVector" if:(and { (is In (to) (sites Occupied by:Mover top:True)) (= 2 (count Sites in:("SwapSites" (to) (from)))) (or (= 1 (count Sites in:(intersection ("SwapSites" (to) (from)) (sites Occupied by:Mover top:True)))) (= 1 (count Sites in:(intersection ("SwapSites" (to) (from)) (sites Occupied by:Next top:True)))))})) (then (and { (add (piece (id "Disc" Mover)) (to (last From)) stack:True) (forEach Site ("SwapSites" (last To) (last From)) (remember Value (site)))})))) (define "SwapSites" (intersection (sites Around #1 Adjacent) (sites Around #2 Adjacent))) (game "Veloop (Square)" (players 2) (equipment { (board (renumber (rotate 90 (square Square 6))) use:Cell) (piece "Disc" Each)}) (rules (start { (place "Disc1" {15}) (place "Disc2" {21})}) (play (priority ("Placement" (sites Empty)) ("Placement" (sites Occupied by:Next)) (then ("MakeSwap")))) (end (if (!= 0 (+ (score P1) (score P2))) (byScore))))) END
Construct a Ludii game based on the following description Numbers from 1 to 9 have to be placed in the squares such that each row, column, cage has each number appearing only once, and the numbers in each cage add up to the assigned number. ###
(game "Killer Sudoku" (players 1) (equipment { (board (square 9) (values Cell (range 1 9))) (hints { (hint {0 9 18 27} 27) (hint {1 10} 8) (hint {2 11} 16) (hint {3 12 13 22} 10) (hint {4 5 6} 13) (hint {7 8} 17) (hint {14 15} 15) (hint {16 17 25 26} 14) (hint {19 20 29} 6) (hint {21 30 39} 20) (hint {31 40 49} 17) (hint {23 24 32} 20) (hint {28 37 38} 13) (hint {33 34} 6) (hint {35 44} 12) (hint {36 45} 6) (hint {46 47} 14) (hint {48 56 57} 9) (hint {41 50 59} 8) (hint {42 43 52} 17) (hint {51 60 61} 20) (hint {53 62 71 80} 15) (hint {54 55 63 64} 25) (hint {58 67 68 77} 22) (hint {65 66} 17) (hint {69 78} 4) (hint {70 79} 16) (hint {72 73} 3) (hint {74 75 76} 15)}) (regions {Columns Rows SubGrids}) (regions "RegionHint" HintRegions)}) (rules (play (satisfy { (is Sum "RegionHint" (hint)) (all Different)})) (end (if (is Solved) (result P1 Win))))) END
Construct a global Ludii definition which fulfills the following requirements. Defines a Three Men's Morris board. ###
(define "ThreeMensMorrisBoard" (board ("AlquerqueGraph" 3 3) use:Vertex)) END