[ { "prompt": "Construct a Ludii game based on the following description\n5x5 board, played on intersections, with lines forming a diamond shape connecting the midpoints of the edges of the board. One player plays with two tiger pieces, placed on the midpoints of two opposite sides. The other player plays with twenty goats, divided into four stacks of five, placed on the next adjacent spot to the tigers on the diamond. The goats move first. Goats may move one at a time to any adjacent vacant spot. The tiger may move in the same manner, but also may capture a piece by hopping over it. Multiple captures can be made on the same turn with subsequent hops, but only the top goat in a stack is captured when a tiger leaps over it. The goal of the goats is to surround the tigers so they cannot move; the goal of the tigers is to capture all the goats. Initially, the tigers are placed at opposite sites of the top and the bottom of the board. Played on a board with the diagonals forming a diamond. The tiger can jump a sequence of pieces to capture.\n\n###\n\n", "completion": "(game \"Bagh Guti\" (players 2) (equipment { (board (makeFaces (remove (square 5 diagonals:Alternating) edges:{ { {0 0} {1 1}} { {1 1} {2 2}} { {2 2} {3 3}} { {3 3} {4 4}} { {4 0} {3 1}} { {3 1} {2 2}} { {2 2} {1 3}} { {1 3} {0 4}}})) use:Vertex) (piece \"Goat\" P1 \"StepToEmpty\") (piece \"Tiger\" P2 (or (\"StepToEmpty\") (\"HopSequenceCapture\")))}) (rules (start { (place Stack \"Goat1\" (sites {\"B2\" \"D2\" \"B4\" \"D4\"}) counts:{5 5 5 5}) (place \"Tiger2\" (sites {\"C1\" \"C5\"}))}) (play (if (\"SameTurn\") (or (move Pass) (\"HopSequenceCaptureAgain\")) (forEach Piece top:True))) (end (\"NoMovesP2NoPiecesP1\")))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a hop move in the specified directions (by default Adjacent) over an enemy counter to an empty site. The enemy counter is removed.\n\n###\n\n", "completion": "(define \"HopOnlyCounters\" (move Hop #1 #2 (between if:(\"IsPieceAt\" \"Counter\" Next (between)) (apply (remove (between)))) (to if:(is Empty (to))) #3)) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nMove again if the last `to' position just made a line of 3.\n\n###\n\n", "completion": "(define \"ReplayIfLine3\" (if (is Line 3 #1 #2) (moveAgain))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nChecks if an enemy is on a site. \n\n###\n\n", "completion": "(define \"IsEnemyAt\" (is Enemy (who at:#1 #2))) END" }, { "prompt": "Construct a Ludii game based on the following description\n3x3 intersecting lines, with diagonals. Three pieces per player. Players alternate turns placing a piece on an empty spot on the board. Once all of the pieces are placed, the players alternate turns moving a piece to an empty adjacent spot along the lines. The first player to place three pieces in a line wins. \n\n###\n\n", "completion": "(game \"Liu Tsi\" (players 2) (equipment { (\"AlquerqueBoard\" 3 3) (hand Each) (piece \"Marker\" Each \"StepToEmpty\")}) (rules (start (place \"Marker\" \"Hand\" count:3)) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase (\"HandEmpty\" P2) \"Movement\")) (\"PhaseMovePiece\" \"Movement\")} (end (\"Line3Win\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\n7x7 board. 24 pieces per player. Pieces begin in the rows closest to the player, and the three spaces to the right of the central space. Players alternate turns moving a piece orthogonally any distance. A player may capture an opponent's adjacent piece by hopping over it in an orthogonal direction to an empty space immediately on the opposite side of the opponent's piece. Multiple captures are allowed. The player who captures all of the opponent's pieces wins. \n\n###\n\n", "completion": "(game \"Zuz Mel (7x7)\" (players 2) (equipment { (board (square 7)) (piece \"Marker\" Each (or (\"HopOrthogonalSequenceCapture\") (move Slide Orthogonal)))}) (rules (start { (place \"Marker1\" (union (expand (sites Bottom) steps:2) (sites {\"F4\" \"G4\" \"E4\"}))) (place \"Marker2\" (union (expand (sites Top) steps:2) (sites {\"A4\" \"B4\" \"C4\"})))}) (play (if \"SameTurn\" (or (\"HopSequenceCaptureAgain\") (move Pass)) (forEach Piece))) (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nTwo players have a collection of dominoes which they place on the grid in turn, covering up squares. One player places tiles vertically, while the other places them horizontally. The first player who cannot move loses. The game is played by 2 players The board has 6 rows. The board has 10 columns. The Last player to play wins.\n\n###\n\n", "completion": "(game \"Pentomino\" (players 2) (equipment { (board (rectangle 6 10)) (tile \"Z\" Shared {F R F F L F}) (tile \"Y\" Shared {F R F R R F R F F}) (tile \"X\" Shared {F L F L L F F L L F R F}) (tile \"W\" Shared {F L F R F L F}) (tile \"V\" Shared {F F R F F}) (tile \"U\" Shared {F L F F L F}) (tile \"T\" Shared {F F R F R R F F}) (tile \"P\" Shared {F F R F R F}) (tile \"N\" Shared {F R F L F F}) (tile \"L\" Shared {F R F F F}) (tile \"I\" Shared {F F F F}) (tile \"F\" Shared {F L F L L F L F R F}) (hand Shared size:12)}) (rules (start { (place \"F\" (handSite Shared 0)) (place \"I\" (handSite Shared 1)) (place \"L\" (handSite Shared 2)) (place \"N\" (handSite Shared 3)) (place \"P\" (handSite Shared 4)) (place \"T\" (handSite Shared 5)) (place \"U\" (handSite Shared 6)) (place \"V\" (handSite Shared 7)) (place \"W\" (handSite Shared 8)) (place \"X\" (handSite Shared 9)) (place \"Y\" (handSite Shared 10)) (place \"Z\" (handSite Shared 11))}) (play (move (from (sites Hand Shared)) (to (sites Empty)))) (end (\"NoMoves\" Loss)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nCross-shaped board, with any number of squares in the arm with a central square, and a number of pieces per player equal to the number of spaces in two arms. Three squares in each arm with six pieces per player is common. Players alternate turns placing pieces on the board. Players may not place pieces in the central space. When the pieces are placed, players alternate turns move a piece to am empty adjacent square, or hopping over an adjacent opponent's piece or an unbroken line of opponent's pieces with an empty space behind it. The player who captures all of the opponent's pieces wins.\n The game is played on a cross board of arm size of 3.\n\n###\n\n", "completion": "(define \"NumInitPiece\" 6) (define \"ArmSize\" 3) (game \"Laram Wali\" (players 2) (equipment { (\"CrossBoard\" \"ArmSize\" (* 3 \"ArmSize\") use:Cell) (hand Each) (piece \"Marker\" Each (or (\"StepOrthogonalToEmpty\") (move Hop Orthogonal (between (range 1 \"NumInitPiece\") if:(\"IsEnemyAt\" (between)) (apply (remove (between)))) (to if:(is Empty (to))))))}) (rules (start (place \"Marker\" \"Hand\" count:\"NumInitPiece\")) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (difference (sites Empty) (expand (sites Centre) steps:(- (/ \"ArmSize\" 2) (if (is Even \"ArmSize\") 1 0))))))) (nextPhase (\"HandEmpty\" P2) \"Movement\")) (\"PhaseMovePiece\" \"Movement\")} (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a step move to all the orthogonal directions to an empty site.\n\n###\n\n", "completion": "(define \"StepOrthogonalToEmpty\" (move Step Orthogonal (to if:(is Empty (to))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nPlayed on a Alquerque board. -> Played on a board with no diagonal.\n(game \"Bagh Guti\" (players 2) (equipment { (\"AlquerqueBoard\" 5 5) (piece \"Goat\" P1 \"StepToEmpty\") (piece \"Tiger\" P2 (or (\"StepToEmpty\") (\"HopSequenceCapture\")))}) (rules (start { (place Stack \"Goat1\" (sites {\"B2\" \"D2\" \"B4\" \"D4\"}) counts:{5 5 5 5}) (place \"Tiger2\" (sites {\"C1\" \"C5\"}))}) (play (if (\"SameTurn\") (or (move Pass) (\"HopSequenceCaptureAgain\")) (forEach Piece top:True))) (end (\"NoMovesP2NoPiecesP1\"))))\n\n###\n\n", "completion": "(game \"Bagh Guti\" (players 2) (equipment { (board (square 5) use:Vertex) (piece \"Goat\" P1 \"StepToEmpty\") (piece \"Tiger\" P2 (or (\"StepToEmpty\") (\"HopSequenceCapture\")))}) (rules (start { (place Stack \"Goat1\" (sites {\"B2\" \"D2\" \"B4\" \"D4\"}) counts:{5 5 5 5}) (place \"Tiger2\" (sites {\"C1\" \"C5\"}))}) (play (if (\"SameTurn\") (or (move Pass) (\"HopSequenceCaptureAgain\")) (forEach Piece top:True))) (end (\"NoMovesP2NoPiecesP1\")))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nChecks if only one single group with pieces owned by a player exists.\n\n###\n\n", "completion": "(define \"IsSingleGroup\" (= 1 (count Groups #2 if:(= (who at:(to)) #1)))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nChecks if only one single group with pieces owned by a player exists. This ludemeplex can be used only in an ending condition.\n\n###\n\n", "completion": "(define \"SingleGroupWin\" (if (\"IsSingleGroup\" #1 #2) (result #1 Win))) END" }, { "prompt": "Construct a Ludii game based on the following description\n19x19 intersecting lines. The central, as well as every third spot, in a square with the corners at the fourth point from the corners of the board, are marked. Players alternate turns placing a piece on the board on one of the marked spaces. When all of the marked spaces have been occupied, players may place a piece on any empty spot on the board. If a player surrounds one or more of the opponent's pieces orthogonally, they capture the opponent's pieces. The edge of the board can be included in such an enclosure. A group of pieces which contain two empty or more enclosures cannot be captured by the opponent. Pieces cannot be placed in an enclosure. When no further pieces can be placed, the players count the number of their pieces on the board and the number of empty spaces they enclose, and the player with the higher score wins. \n\n###\n\n", "completion": "(define \"CaptureSurroundedPiece\" (enclose (from (last To)) Orthogonal (between if:(\"IsEnemyAt\" (between)) (apply (and (addScore Mover 1) (remove (between))))) numException:1)) (game \"Patok\" (players 2) (equipment { (board (square 19) use:Vertex) (piece \"Marker\" Each) (regions \"MarkedSites\" (sites {\"D4\" \"D7\" \"D10\" \"D13\" \"D16\" \"G4\" \"G16\" \"J4\" \"J10\" \"J16\" \"M4\" \"M16\" \"P4\" \"P7\" \"P10\" \"P13\" \"P16\"}))}) (rules phases:{ (phase \"MarkedPlacement\" (play (move Add (to (intersection (sites Empty) (sites \"MarkedSites\"))))) (nextPhase (= 0 (count Sites in:(intersection (sites \"MarkedSites\") (sites Empty)))) \"Playing\")) (phase \"Playing\" (play (do (move Add (to (sites Empty)) (then \"CaptureSurroundedPiece\")) ifAfterwards:(\"HasFreedom\" Orthogonal))) (end (if (no Moves Next) (byScore { (score P1 (+ (score P1) (size Territory P1))) (score P2 (+ (score P2) (size Territory P2)))}))))})) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayers take turns placing a piece of theirs at an empty cell. When all pieces have been placed, players take turns moving one of their pieces. The pieces move like the equivalent Chess pieces but do not capture. Any piece can hop over an adjacent enemy piece to an empty cell beyond (without capturing it). First to make a line of 3 of their pieces, at any time, wins the game. \n\n###\n\n", "completion": "(define \"HopOpponent\" (move Hop (between if:(\"IsEnemyAt\" (between))) (to if:(is Empty (to))))) (define \"FromHand\" (from (sites Occupied by:Mover container:(mover)))) (game \"Tic-Tac-Chess\" (players 2) (equipment { (board (square 3)) (hand Each size:3) (piece \"Queen\" Each (or (\"HopOpponent\") (move Slide All))) (piece \"King\" Each (or (\"HopOpponent\") (\"StepToEmpty\"))) (piece \"Rook\" Each (or (\"HopOpponent\") (move Slide Orthogonal)))}) (rules (start { (place \"Queen\" \"Hand\") (place \"King\" \"Hand\") (place \"Rook\" \"Hand\")}) phases:{ (phase \"Placement\" (play (move (\"FromHand\") (to (sites Empty)))) (nextPhase (\"HandEmpty\" P2) \"Movement\")) (\"PhaseMovePiece\" \"Movement\")} (end (\"Line3Win\" Mover)))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nMove again if the last `to' position is on a specified region.\n\n###\n\n", "completion": "(define \"ReplayInMovingOn\" (if (is In (last To) #1) (moveAgain))) END" }, { "prompt": "What does the following global Ludii definition do?\n(define \"HopStackEnemyCaptureTop\" (move Hop #1 #2 (between if:(\"IsEnemyAt\" (between)) (apply (fromTo (from (between)) (to)))) (to if:(and (is In (from) (sites Occupied by:Mover)) (is Empty (to)))) stack:True #3))\n\n###\n\n", "completion": "Defines a hop move in all the directions specified (by default Adjacent) over a stack with on top an enemy to an empty site. The enemy piece is moved to the top of the jumping stack. END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6 board with two stores. Play begins with four counters in each hole. A move begins from any of a player's holes, sowing happens anti-clockwise. Move ends if the last counter falls into an empty hole. If it lands in a hole with counters, these are picked up and sowing continues, unless the sowing makes the last hole contain four counters, in which case these are captured and the sowing continues from the next hole. When both players have too few counters to play, each one makes one move with one of their counters and then adds all of the counters on their side of the board to the store. The player with the most counters in the store wins. \n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (+ (count at:(mapEntry #1)) (count in:(sites #1)))) (define \"PlayFromNextHole\" (sites {(\"NextHoleFrom\" (last From afterConsequence:True))})) (define \"NextHoleFrom\" (\"NextSiteOnTrack\" 1 from:#1)) (game \"Meusueb\" (players 2) (equipment { (mancalaBoard 2 6 (track \"Track\" \"1,E,N,W\" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 FirstSite) (pair P2 LastSite)}) (piece \"Seed\" Shared)}) (rules (start (set Count 4 to:(sites Track))) (play (move Select (from (if \"SameTurn\" (if (is Pending) \"PlayFromNextHole\" \"LastHoleSowed\") (sites Mover)) if:(> (count at:(from)) 0)) (then (sow apply:(if (= (count at:(to)) 4) (and (fromTo (from (to)) (to (mapEntry (mover))) count:(count at:(to))) (if (> (count at:(trackSite Move from:(to) steps:1)) 0) (and (moveAgain) (set Pending)))) (if (> (count at:(to)) 1) (moveAgain))))))) (end (\"MancalaByScoreWhen\" (no Moves Mover))))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a custodial capture in all the directions specified (by default Adjacent) to capture a specific piece type owned by the next player. The piece is removed.\n\n###\n\n", "completion": "(define \"CustodialCapturePieceType\" (custodial (from (last To)) #2 (between #3 if:(\"IsPieceAt\" #1 Next (between)) (apply (remove (between)))) (to if:(\"IsFriendAt\" (to))) #4)) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"Hex\" (players 2) (equipment { (board (hex Diamond 11)) (piece \"Marker\" Each) (regions P1 {(sites Side NE) (sites Side SW)}) (regions P2 {(sites Side NW) (sites Side SE)})}) (rules (meta (swap)) (play (move Add (to (sites Empty)))) (end (if (is Connected Mover) (result Mover Win)))))\n\n###\n\n", "completion": "Players take turns placing a piece of their colour at an empty cell, and win by connecting their board sides with a chain of their pieces. The game is played on a 11x11 board. The game uses the swap rule. The first player to connect their two sides wins. END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a hop move in all the directions specified (by default Adjacent) over an enemy to an empty site. The enemy piece is removed.\n\n###\n\n", "completion": "(define \"HopCapture\" (move Hop #1 #2 (between if:(\"IsEnemyAt\" (between)) (apply (remove (between)))) (to if:(is Empty (to))) #3)) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"PowerfulPieceOnColumnHasBeenRemoved\" (if (and (is In (to) (sites Corners)) (< (count Sites in:(sites Occupied by:Mover component:\"Boat\")) 2)) True (if (and (or (= (column of:(to)) 1) (= (column of:(to)) 6)) (< (count Sites in:(sites Occupied by:Mover component:\"Knight\")) 2)) True (if (and (or (= (column of:(to)) 2) (= (column of:(to)) 5)) (< (count Sites in:(sites Occupied by:Mover component:\"Elephant\")) 2)) True (if (and (or (and (is Mover P1) (= (column of:(to)) 3)) (and (is Mover P2) (= (column of:(to)) 4))) (< (count Sites in:(sites Occupied by:Mover component:\"Ferz_noCross\")) 1)) True False))))) (define \"PromotedPiece\" (if (is In (last To) (sites Corners)) (id \"Boat\" Mover) (if (or (= (column of:(last To)) 1) (= (column of:(last To)) 6)) (id \"Knight\" Mover) (if (or (= (column of:(last To)) 2) (= (column of:(last To)) 5)) (id \"Elephant\" Mover) (if (or (and (is Mover P2) (= (column of:(last To)) 4)) (and (is Mover P1) (= (column of:(last To)) 3))) (id \"Ferz_noCross\" Mover) (id \"King_noCross\" Mover)))))) (define \"PieceHasMoved\" (set State at:#1 0)) (define \"RememberPieceHasMoved\" (then (if (= (state at:(last To)) 1) (\"PieceHasMoved\" (last To))))) (define \"StepForwardToEmpty\" (move Step Forward (to if:(and (or (not (is In (to) (sites Mover \"Promotion\"))) (and (is In (to) (sites Mover \"Promotion\")) (\"PowerfulPieceOnColumnHasBeenRemoved\"))) (is Empty (to)))))) (define \"CaptureForwardDiagonal\" (move Step (directions {FR FL}) (to if:(and (or (not (is In (to) (sites Mover \"Promotion\"))) (and (is In (to) (sites Mover \"Promotion\")) (\"PowerfulPieceOnColumnHasBeenRemoved\"))) (\"IsEnemyAt\" (to))) (apply (remove (to)))))) (define \"CaptureToPiece\" (apply (remove (to)))) (game \"Parsi Chess\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (piece \"Pawn\" Each (or { (if (is In (from) (sites Start (piece (what at:(from))))) (if (= 1 (state at:(ahead (from) Backward))) (\"DoubleStepForwardToEmpty\"))) \"StepForwardToEmpty\" \"CaptureForwardDiagonal\"} (then (if (is In (last To) (sites Mover \"Promotion\")) (promote (last To) (piece \"PromotedPiece\")))))) (\"ChessRook\" \"Boat\" ~ \"RememberPieceHasMoved\") (piece \"King_noCross\" Each (or (\"StepToNotFriend\") (if (!= (value Player Mover) (mover)) (\"LeapToEmpty\" \"KnightWalk\" (then (set Value Mover (mover))))) \"RememberPieceHasMoved\")) (\"ChessBishop\" \"Elephant\") (\"ChessKnight\" \"Knight\") (\"ChessQueen\" \"Ferz_noCross\" ~ \"RememberPieceHasMoved\") (regions \"Promotion\" P1 (sites Top)) (regions \"Promotion\" P2 (sites Bottom))}) (rules (start { (place \"Pawn1\" (sites Row 1)) (place \"Pawn2\" (sites Row 6)) (place \"Boat1\" {\"A1\" \"H1\"} state:1) (place \"Knight1\" {\"B1\" \"G1\"}) (place \"Elephant1\" {\"C1\" \"F1\"}) (place \"Ferz_noCross1\" coord:\"D1\" state:1) (place \"King_noCross1\" coord:\"E1\" state:1) (place \"Boat2\" {\"A8\" \"H8\"} state:1) (place \"Knight2\" {\"B8\" \"G8\"}) (place \"Elephant2\" {\"C8\" \"F8\"}) (place \"Ferz_noCross2\" coord:\"E8\" state:1) (place \"King_noCross2\" coord:\"D8\" state:1)}) (play (do (forEach Piece) ifAfterwards:(and (can Move (forEach Piece Next)) (not (\"IsInCheck\" \"King_noCross\" Mover))) (then (if (!= (next) (value Player Next)) (if (\"IsInCheck\" \"King_noCross\" Next) (set Value Next (next))))))) (end { (\"Checkmate\" \"King_noCross\") (if (= 1 (count Pieces Next)) (result Mover Draw))})))\n\n###\n\n", "completion": "8x8 board, marked as in Chaturanga. Pieces move according to specialized moves, as follows: Pawns (x8): can move one space forward, or one space diagonally to capture. The pawns in front of the Raja, Vizier, or Chariot may move two spaces on their first move, but only if the piece which began on the space behind them remains on that spot. Chariot (or Boat): any number of spaces orthogonally; Elephant (x2): can move any number of spaces diagonally; Horse (2): moves in any direction, one space orthogonally with one space forward diagonally; Vizier (x1): can move any number of spaces orthogonally or diagonally; Raja (x1): can move one space orthogonally or diagonally, but can also move like the horse once in the game, if it has not yet been checked. It cannot take a piece with this move. The pieces are arranged as in Chess, except the Vizier is place to the left of the Raja on both sides. Players capture pieces by moving onto a space occupied by an opponent's piece. When a Pawn reaches the opposite edge of the board from where it started, it may be promoted to the more powerful piece that begins the game in that position, but only if one of these belonging to the player has already been captured. If this has not happened, the pawn cannot move to the final row. When promoted to a Horse, the piece may immediately make a Horse's move. When a player can capture the opponent's Raja on the next turn, the Raja is in Check, the opponent's next move must free the Raja from Check. If the opponent cannot, it is Checkmate and the player wins. If a player captures all of the opponent's pieces aside from the Raja, it is a draw, or Boorj. When both players are left with only a Raja, it is a draw. Players are not allowed to stalemate the opponent. Perpetual check is not allowed, a player must make another move if such a state is entered. END" }, { "prompt": "What does the following global Ludii definition do?\n(define \"IsEndTrack\" (= #1 End))\n\n###\n\n", "completion": "Checks if a site returned by a track is the ending site of the track. END" }, { "prompt": "Construct a Ludii game based on the following description\nSeven holes, arranged in a circle. Four counters in each hole. Sowing occurs in an anti-clockwise direction. When the final counter lands in a hole, the contents of the next hole are picked up and sowing continues with those counters. When the hole from which this new sowing would occur is empty, the counters in the next hole are captured and the turn ends. The next player begins to sow from the next available hole with counters after the last one played by the opponent. Play continues until no further captures can be made, and the player with the most counters wins. \n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (count Cell at:(handSite #1))) (define \"LastHole\" (last To afterConsequence:True)) (define \"NextHoleFrom\" (\"NextSiteOnTrack\" #2 from:#1)) (game \"Sat Gol\" (players 2) (equipment { (board (concentric {7}) (track \"Track\" {0 1 3 5 6 4 2} loop:True) use:Vertex) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 4 to:(sites Board))) (play (move Select (from (if (\"SameTurn\") (sites {(\"NextHoleFrom\" (\"LastHole\") 1)}) (if (= 0 (count Moves)) (sites Board) (sites {(var)}))) if:(> (count at:(from)) 0)) (then (sow apply:(if (!= 0 (count at:(\"NextHoleFrom\" (to) 1))) (moveAgain) (and (if (!= 0 (count at:(\"NextHoleFrom\" (to) 2))) (fromTo (from (\"NextHoleFrom\" (to) 2)) (to (handSite Mover)) count:(count at:(\"NextHoleFrom\" (to) 2)))) (if (!= 0 (count at:(\"NextHoleFrom\" (to) 3))) (set Var (\"NextHoleFrom\" (to) 3)) (if (!= 0 (count at:(\"NextHoleFrom\" (to) 4))) (set Var (\"NextHoleFrom\" (to) 4)) (if (!= 0 (count at:(\"NextHoleFrom\" (to) 5))) (set Var (\"NextHoleFrom\" (to) 5)) (if (!= 0 (count at:(\"NextHoleFrom\" (to) 6))) (set Var (\"NextHoleFrom\" (to) 6)) (set Pending))))))))))) (end (\"MancalaByScoreWhen\" (is Pending))))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nAllows to remove one piece of the enemy player.\n\n###\n\n", "completion": "(define \"RemoveAnyEnemyPiece\" (move Remove (sites Occupied by:Enemy container:\"Board\") #1)) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a hop move in all the diagonal directions over an enemy to an empty site. The enemy piece is removed.\n\n###\n\n", "completion": "(define \"HopDiagonalCapture\" (move Hop Diagonal (between if:(\"IsEnemyAt\" (between)) (apply (remove (between)))) (to if:(is Empty (to))))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines the most popular backgammon tracks in using the hands of the players.\n\n###\n\n", "completion": "(define \"BackgammonTracksWithHands\" { (track \"Track1\" {26 12..7 5..0 13..18 20..25 #1} P1 directed:True) (track \"Track2\" {27 25..20 18..13 0..5 7..12 #1} P2 directed:True)}) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nChecks if the board is empty. This ludemeplex is not working for games involving stacks.\n\n###\n\n", "completion": "(define \"NoPieceOnBoard\" (all Sites (sites Board) if:(= 0 (count at:(site))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nStones are placed on the ground to make a square with ten spaces per side, the spaces between the stones being the place where the pieces are played. One piece per player. Three sticks used as dice, one side flat, the other round. One of the sticks is notched on the round side. Throws are as follows: All flat sides up = 5; all round sides up = 10; one flat and two round, with no notches up = 1, two flat and one round, with no notches up = 3, two flat or two round, with notches up = 15. Pieces begin in one corner of the board. Players may move in opposite directions around the board, or in the same direction. When players move in the same direction, they may send the opponent's piece back to the beginning if they land on their spot. When the opponent is sent back to the beginning, they may then choose their direction of play. When players are moving in opposite directions, the opponent's piece may not be sent to start. The first player to travel around the board and land in the starting space wins. The game has 2 players.\n\n###\n\n", "completion": "(define \"MoveOn\" (if (\"IsNotOffBoard\" #1) (if (or (is Empty #1) (and (\"IsEnemyAt\" #1) (or (= (value Player Mover) (value Player (who at:#1))) (\"IsOffBoard\" (value Player Mover))))) (move (from (from) level:(level)) (to #1 \"CaptureEnemyPiece\"))) #2)) (define \"CaptureEnemyPiece\" (apply if:(\"IsEnemyAt\" (to)) (and (fromTo (from (to)) (to \"Goal\")) (set Value (player (who at:(to))) Off)))) (define \"Goal\" 0) (define \"RememberSelectedTrack\" (then (if (\"IsOffBoard\" (value Player Mover)) #1))) (define \"SelectCCW\" (set Value Mover 2)) (define \"SelectCW\" (set Value Mover 1)) (define \"SiteToMoveOnTrackCCW\" (\"NextSiteOnTrack\" (\"ThrowValue\") \"TrackCCW\")) (define \"SiteToMoveOnTrackCW\" (\"NextSiteOnTrack\" (\"ThrowValue\") \"TrackCW\")) (define \"SiteToMoveOnSelectedTrack\" (if (= (value Player Mover) 2) (\"NextSiteOnTrack\" (\"ThrowValue\") \"TrackCCW\") (\"NextSiteOnTrack\" (\"ThrowValue\") \"TrackCW\"))) (define \"ThrowValue\" (mapEntry \"ThrowDiceValue\" (count Pips))) (game \"Tugi-Epfe\" (players 2) (equipment { (board (merge { (rectangle 1 11) (rectangle 11 1) (shift 0 10 (rectangle 1 11)) (shift 10 0 (rectangle 11 1))}) { (track \"TrackCW\" {0 10..19 20..29 39..30 9..0} directed:True) (track \"TrackCCW\" {0..9 30..39 29..20 19..10 0} directed:True)} use:Edge) (dice d:2 facesByDie:{{0 10} {0 1} {0 1}} num:3) (map \"ThrowDiceValue\" { (pair 0 5) (pair 12 5) (pair 2 1) (pair 1 3) (pair 10 15) (pair 11 15)}) (piece \"Horse\" Each (if (\"IsOffBoard\" (value Player Mover)) (or (\"MoveOn\" (\"SiteToMoveOnTrackCW\") (\"RememberSelectedTrack\" (\"SelectCW\"))) (\"MoveOn\" (\"SiteToMoveOnTrackCCW\") (\"RememberSelectedTrack\" (\"SelectCCW\")))) (\"MoveOn\" \"SiteToMoveOnSelectedTrack\"))) (regions \"AllSites\" (sites Board))}) (rules (start (place Stack items:{\"Horse2\" \"Horse1\"} 0)) (play (\"RollMove\" (forEach Piece) (then (if (= (last To) (\"Goal\")) (remove (last To)))))) (end (\"EscapeWin\")))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nChecks if a level is at the top of a stack.\n\n###\n\n", "completion": "(define \"IsTopLevel\" (= (topLevel at:#1) (level))) END" }, { "prompt": "What does the following global Ludii definition do?\n(define \"LastHoleSowed\" (sites {(last To afterConsequence:True)}))\n\n###\n\n", "completion": "Returns a region of one site corresponding to the last `to' position after applying the consequences. In the mancala games, this site is the last hole in which a seed was sowed. END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nChecks if a piece #1 owned by #2 is at a site #3.\n\n###\n\n", "completion": "(define \"IsPieceAt\" (= (what at:#3 #4) (id #1 #2))) END" }, { "prompt": "Construct a Ludii game based on the following description\nSix or more players, even number of players, played on two teams. The board consists of twenty kernels of corn, spaced evenly in a line. If there are ten to fourteen players, the board is expanded to 25 kernels. If there are more than sixteen players, it is expanded to 30. A circle is drawn in the central space; this is the \\ The game has 6 players.\n\n###\n\n", "completion": "(define \"CapturedPiecesFollowCapturingPiece\" (forEach Level (last From) FromTop (if (\"CapturedPiece\" (state at:(last From) level:(level))) (fromTo (from (last From) level:(level)) (to (last To)))))) (define \"RebirthCapturingPiece\" (add (piece (id \"Stick\" Mover)) (to (handSite Mover)))) (define \"RemoveCapturedPieces\" (forEach Level (last From) FromTop (if (\"CapturedPiece\" (state at:(last From) level:(level))) (remove (last From) level:(level))))) (define \"CaptureMove\" (forEach Level (last To) FromTop (and (if (\"IsEnemyAt\" (last To) level:(level)) (\"SetCapturePiece\" at:(last To) level:(level))) (if (\"IsFriendAt\" (last To) level:(level)) (\"SetCapturingPiece\" at:(last To) level:(level)))))) (define \"AtLeastAnEnemyPieceThere\" (is In #1 (sites Occupied by:Enemy top:False))) (define \"FreePiece\" (= 0 #1)) (define \"CapturedPiece\" (= 2 #1)) (define \"CapturingPiece\" (= 1 #1)) (define \"UnsetCapturingPieces\" (forEach Level (last From) FromTop (if (\"IsFriendAt\" (last From) level:(level)) (\"UnsetCapturingPiece\" at:(last From) level:(level))))) (define \"UnsetCapturingPiece\" (set State #1 #2 0)) (define \"SetCapturingPiece\" (set State #1 #2 1)) (define \"SetCapturePiece\" (set State #1 #2 2)) (define \"NoPieceOnBoard\" (< (count Pieces Mover in:(sites Board)) 1)) (define \"FireSites\" (sites Centre)) (define \"ThrowValue\" (count Pips)) (game \"A K'aak'il\" (players 6) (equipment { (board (rectangle 1 20) { (track \"Track1\" {19 0..18} P1 directed:True) (track \"Track2\" {20 0..18} P2 directed:True) (track \"Track3\" {21 0..18} P3 directed:True) (track \"Track4\" {22 18..0} P4 directed:True) (track \"Track5\" {23 18..0} P5 directed:True) (track \"Track6\" {24 18..0} P6 directed:True) (track \"CaptureTrack1\" {18..0} P1 directed:True) (track \"CaptureTrack2\" {18..0} P2 directed:True) (track \"CaptureTrack3\" {18..0} P3 directed:True) (track \"CaptureTrack4\" {0..18} P4 directed:True) (track \"CaptureTrack5\" {0..18} P5 directed:True) (track \"CaptureTrack6\" {0..18} P6 directed:True)} use:Edge) (regions \"AllSites\" (sites Board Vertex)) (piece \"Stick\" Each (forEach Value (values Remembered \"Throws\") (or (if (\"FreePiece\" (state at:(from) level:(level))) (if (\"IsOffBoard\" (\"NextSiteOnTrack\" (value) from:(from) \"Track\")) (move (from (from) level:(level)) (to (handSite Mover) (apply (forget Value \"Throws\" (value))))) (move (from (from) level:(level) if:(if (is In (from) (sites Hand Mover)) (\"NoPieceOnBoard\") True)) (to (\"NextSiteOnTrack\" (value) from:(from) \"Track\") (apply (forget Value \"Throws\" (value)))) (then (if (\"AtLeastAnEnemyPieceThere\" (last To)) (\"CaptureMove\")))))) (if (\"CapturingPiece\" (state at:(from) level:(level))) (if (\"IsOffBoard\" (\"NextSiteOnTrack\" (value) from:(from) \"CaptureTrack\")) (do (forget Value \"Throws\" (value)) next:(move Remove (from) level:(level) (then (and { (\"UnsetCapturingPieces\") (\"RemoveCapturedPieces\") (\"RebirthCapturingPiece\")})))) (move (from (from) level:(level)) (to (\"NextSiteOnTrack\" (value) from:(from) \"CaptureTrack\") (apply (forget Value \"Throws\" (value)))) (then (and (\"CapturedPiecesFollowCapturingPiece\") (\"UnsetCapturingPieces\"))))))))) (\"StickDice\" 4) (hand Each)}) (rules (start { (set Team 1 {P1 P2 P3}) (set Team 2 {P4 P5 P6}) (place Stack \"Stick1\" (handSite P1) count:5) (place Stack \"Stick2\" (handSite P2) count:5) (place Stack \"Stick3\" (handSite P3) count:5) (place Stack \"Stick4\" (handSite P4) count:5) (place Stack \"Stick5\" (handSite P5) count:5) (place Stack \"Stick6\" (handSite P6) count:5)}) phases:{ (phase \"ThrowPhase\" (play (\"RollMove\" (move Pass (then (if (not (no Pieces Mover)) (and { (if (!= 0 (\"ThrowValue\")) (do (remember Value \"Throws\" (\"ThrowValue\")) ifAfterwards:(can Move (or (forEach Piece container:(mover)) (forEach Piece))))) (moveAgain) (if (\"SameTurn\") (set Pending))})))))) (nextPhase (is Pending) \"MovePhase\")) (phase \"MovePhase\" (play (or (forEach Piece) (forEach Piece container:(mover)) (then (and (if (< 0 (size Array (values Remembered \"Throws\"))) (moveAgain)) (forEach Site (\"FireSites\") (if (is Occupied (site)) (forEach Level (site) FromTop (remove (site) level:(level))))))))) (nextPhase (= 0 (size Array (values Remembered \"Throws\"))) \"ThrowPhase\"))} (end (\"CaptureAllTeam\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\nA square, with diagonals and lines connecting the midpoints. Two triangles on opposite sides of the triangle. One player plays as three galgos, which are placed on the three points of one of the triangles. The other player plays as one hare, which begins on the point between two of the galgos. The hare may move in any direction along the lines on the board, but must move to the central point of the board on its first move. The galgos may move forward orthogonally or diagonally; they may never move horizontally and may only move backwards if the galgo which starts on the apex of the triangle has moved and the piece to move backwards has not yet moved. If the galgos block the hare from being able to move, they win, if the hare moves past the galgos it wins. \n\n###\n\n", "completion": "(define \"PieceHasMoved\" (if (= (state at:(last To)) 1) (set State at:(last To) 0))) (game \"La Liebre Perseguida\" (players 2) (equipment { (board (rotate 90 (\"ThreeMensMorrisGraphWithLeftAndRightTriangles\")) use:Vertex) (piece \"Hare\" P1 (\"StepToEmpty\" Orthogonal)) (piece \"Rabbit\" P2 N (or (if (= (state at:(from)) 1) (move Step Backwards (to if:(and (is In (to) (sites Bottom)) (is Empty (to)))) (then \"PieceHasMoved\"))) (\"StepToEmpty\" Forwards (then \"PieceHasMoved\")))) (regions \"Home\" P2 (sites {\"B1\" \"C2\" \"A2\"})) (regions \"Home\" P1 (sites {\"B2\"}))}) (rules (start { (place \"Hare1\" (sites P1)) (place \"Rabbit2\" (sites P2) state:1)}) (play (forEach Piece)) (end { (if (no Moves P1) (result P2 Win)) (if (is In (where \"Hare\" P1) (sites P2)) (result P1 Win))}))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nTwo players occupy home regions on opposite sides, four home regions are empty. -> Two players occupy three regions each, alternating around board, i.e. all six home regions start full.\nThe game is played on a board of size 1. -> The game is played on a board of size 2.\n(define \"Dim\" 1) (define \"HopSequence\" (\"Hop\" #1 (then (if (can Move (\"Hop\" (last To))) (moveAgain))))) (define \"Hop\" (move Hop (from #1) (between if:(is Occupied (between))) (to if:(and (\"IsEmptyAndNotVisited\" (to)) (or (not (\"FromIsOnTheRegionToFill\" #1)) (\"ToIsOnTheRegionToFill\" (to))))) #2)) (define \"ToIsOnTheRegionToFill\" (is In #1 (sites (player (mapEntry (mover)))))) (define \"FromIsOnTheRegionToFill\" (is In #1 (sites (player (mapEntry (mover)))))) (game \"Chinese Checkers\" (players 2) (equipment { (board (hex Star (\"Dim\"))) (piece \"Marker\" Each) (regions \"Home\" P1 (expand origin:(coord row:0 column:(\"Dim\")) steps:(- (\"Dim\") 1))) (regions \"Home\" P2 (expand origin:(coord row:(* (\"Dim\") 4) column:(* (\"Dim\") 3)) steps:(- (\"Dim\") 1))) (map {(pair 1 2) (pair 2 1)})}) (rules (start { (place \"Marker1\" (sites P1)) (place \"Marker2\" (sites P2))}) phases:{ (phase \"Movement\" (play (forEach Piece (or (\"HopSequence\" (from)) (move Step (to if:(and (is Empty (to)) (or (not (\"FromIsOnTheRegionToFill\" (from))) (\"ToIsOnTheRegionToFill\" (to))))))))) (nextPhase (is Mover (next)) \"MultiJump\")) (phase \"MultiJump\" (play (or (\"HopSequence\" (last To)) (move Pass))) (nextPhase (not (is Mover (next))) \"Movement\"))} (end (\"FillWin\" (sites (player (mapEntry (mover))))))))\n\n###\n\n", "completion": "(define \"Dim\" 2) (define \"HopSequence\" (\"Hop\" #1 (then (if (can Move (\"Hop\" (last To))) (moveAgain))))) (define \"Hop\" (move Hop (from #1) (between if:(is Occupied (between))) (to if:(and (\"IsEmptyAndNotVisited\" (to)) (or (not (\"FromIsOnTheRegionToFill\" #1)) (\"ToIsOnTheRegionToFill\" (to))))) #2)) (define \"ToIsOnTheRegionToFill\" (is In #1 (sites (player (mapEntry (mover)))))) (define \"FromIsOnTheRegionToFill\" (is In #1 (sites (player (mapEntry (mover)))))) (game \"Chinese Checkers\" (players 2) (equipment { (board (hex Star (\"Dim\"))) (piece \"Marker\" Each) (regions \"Home\" P1 (union { (expand origin:(coord row:0 column:(\"Dim\")) steps:(- (\"Dim\") 1)) (expand origin:(coord row:(* (\"Dim\") 3) column:(* (\"Dim\") 4)) steps:(- (\"Dim\") 1)) (expand origin:(coord row:(* (\"Dim\") 3) column:(\"Dim\")) steps:(- (\"Dim\") 1))})) (regions \"Home\" P2 (union { (expand origin:(coord row:(\"Dim\") column:(* (\"Dim\") 3)) steps:(- (\"Dim\") 1)) (expand origin:(coord row:(* (\"Dim\") 4) column:(* (\"Dim\") 3)) steps:(- (\"Dim\") 1)) (expand origin:(coord row:(\"Dim\") column:0) steps:(- (\"Dim\") 1))})) (map {(pair 1 2) (pair 2 1)})}) (rules (start { (place \"Marker1\" (sites P1)) (place \"Marker2\" (sites P2))}) phases:{ (phase \"Movement\" (play (forEach Piece (or (\"HopSequence\" (from)) (move Step (to if:(and (is Empty (to)) (or (not (\"FromIsOnTheRegionToFill\" (from))) (\"ToIsOnTheRegionToFill\" (to))))))))) (nextPhase (is Mover (next)) \"MultiJump\")) (phase \"MultiJump\" (play (or (\"HopSequence\" (last To)) (move Pass))) (nextPhase (not (is Mover (next))) \"Movement\"))} (end (\"FillWin\" (sites (player (mapEntry (mover)))))))) END" }, { "prompt": "What does the following global Ludii definition do?\n(define \"ChessQueen\" (piece #1 Each (move Slide (to if:(\"IsEnemyAt\" (to)) (apply (remove (to) #2))) #3)))\n\n###\n\n", "completion": "Defines a piece moving like a queen in Chess. END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"Natt Klab ash-Shawk\" (players 2) (equipment { (board (square 5)) (piece \"Marker\" Each (or (\"StepOrthogonalToEmpty\") (\"HopOrthogonalCapture\")))}) (rules (start { (place \"Marker1\" (union {(expand (sites Bottom)) (sites {\"D3\" \"E3\"})})) (place \"Marker2\" (union {(sites {\"A3\" \"B3\"}) (expand (sites Top))}))}) (play (forEach Piece)) (end (\"CaptureAll\" Next))))\n\n###\n\n", "completion": "5x5 board, the central square marked with an X. Twelve pieces per player. Pieces begin the game on the first two rows in front of the player, and in the two squares to the player's right in the central row. Players alternate turns moving a piece orthogonally to an adjacent empty space. Players may capture an opponent's piece by hopping over it. The player who captures all of the opponent's pieces wins. END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a rectangular graph with Alquerque-style alternating diagonals with four triangle extension on each side.\n\n###\n\n", "completion": "(define \"AlquerqueGraphWithFourTriangles\" (merge { (shift 2 2 (square 5 diagonals:Alternating)) (shift 2 0 (wedge 3)) (shift 5 3 (rotate 90 (wedge 3))) (shift 2 6 (rotate 180 (wedge 3))) (shift -1 3 (rotate 270 (wedge 3)))})) END" }, { "prompt": "What does the following global Ludii definition do?\n(define \"AlquerqueBoardWithBottomAndTopTriangles\" (board (\"AlquerqueGraphWithBottomAndTopTriangles\") use:Vertex))\n\n###\n\n", "completion": "Defines a rectangular board with Alquerque-style alternating diagonals with a triangle extension at the bottom and another at the top. END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines table tracks following the same direction for each player but starting from opposite corners.\n\n###\n\n", "completion": "(define \"TableTracksSameDirectionOppositeCorners\" { (track \"Track1\" {11..0 12..23 #1} P1 directed:True) (track \"Track2\" {12..23 11..0 #1} P2 directed:True)}) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayed on a Chaupar board. Two players. Four pieces per player. Seven cowries, used as dice. The throws are as follows: one face up = 10; two faces up = 2; three faces up = 3; four faces up = 4; five faces up = 25; six faces up = 36; seven faces up = 14; all faces down = 7. Players start from opposite ends of the board. In this game, the divisions of the arms of the board are ignored; each arm is considered one space, and the spaces between the arms are also considered a space, making eight total spaces. Players sit opposite each other, and the point in front of them is the starting point for that player. Play proceeds in an anti-clockwise direction. When one player's piece lands on a space occupied by an opponent's piece, the opponent's piece is captured. A player wins by capturing all of the opponent's pieces. 6 faces up = 36.\n\n###\n\n", "completion": "(define \"DieNotUsed\" (!= (pips) 0)) (define \"ThrowValue\" (mapEntry \"ThrowDiceValue\" (count Pips))) (game \"Udat Pagada\" (players 2) (equipment { (board (add (add (hole (merge (shift 0 8 (rectangle 4 20)) (shift 8 0 (rectangle 20 4))) (poly {{8 8} {8 11} {11 11} {11 8}})) cells:{ { 8 28 48 68 69 70 71 51 31 11 10 9}}) vertices:{{9.5 4} {15 4} {15 9.5} {15 15} {9.5 15} {4 15} {4 9.5} {4 4}}) { (track \"Track\" {144..151} loop:True)} use:Vertex) (\"StickDice\" 7) (piece \"Pawn\" Each (move (from (from) level:(level)) (to (\"NextSiteOnTrack\" (\"ThrowValue\") from:(from) \"Track\") (apply (if (\"IsEnemyAt\" (to)) (forEach Level (to) FromTop (remove (to) level:(level)))))))) (hand Each) (map \"Throw\" {(pair 0 7) (pair 1 10) (pair 2 2) (pair 3 3) (pair 4 4) (pair 5 25) (pair 6 36) (pair 7 14)}) (map \"Entry\" {(pair P1 144) (pair P2 148)})}) (rules (start { (place Stack \"Pawn1\" (handSite P1) count:4) (place Stack \"Pawn2\" (handSite P2) count:4)}) (play (\"RollMove\" (or (if (is Occupied (handSite Mover)) (move (from (handSite Mover)) (to (\"NextSiteOnTrack\" (- (\"ThrowValue\") 1) from:(mapEntry \"Entry\" Mover) \"Track\") (apply (if (\"IsEnemyAt\" (to)) (forEach Level (to) FromTop (remove (to) level:(level)))))))) (forEach Piece)))) (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nChecks if a site returned by a track is not the ending site of the track. \n\n###\n\n", "completion": "(define \"IsNotEndTrack\" (!= #1 End)) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a step move to all the directions specified (adjacent by default) to an empty site.\n\n###\n\n", "completion": "(define \"StepToEmpty\" (move Step #1 (to if:(is Empty (to))) #2)) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a rectangular board with Alquerque-style alternating diagonals with four triangle extensions on each side.\n\n###\n\n", "completion": "(define \"AlquerqueBoardWithFourTriangles\" (board (\"AlquerqueGraphWithFourTriangles\") use:Vertex)) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nChecks if a player has a less or equal number of pieces and lose. This ludemeplex can be used only in an ending condition.\n\n###\n\n", "completion": "(define \"HavingLessPiecesLoss\" (if (<= (count Pieces #1) #2) (result #1 Loss))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a leap move to an empty site.\n\n###\n\n", "completion": "(define \"LeapToEmpty\" (move Leap #1 (to if:(is Empty (to))) #2)) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"Move\" (if (\"Double1\") (\"Double1Move\") (if (\"DoubleOfAnother\") (\"DoubleOfAnotherMove\") (if (\"ConsecutiveNumber\") (\"ConsecutiveNumberMove\") (\"NonConsecutiveNumber\"))))) (define \"NonConsecutiveNumber\" (forEach Site (sites Occupied by:Mover top:False) (forEach Level (site) (or (if (!= (var) (\"Die1\")) (\"MoveAPiece\" (\"Die1\") (\"ReplayConsequences\" (\"Die1\")))) (if (!= (var) (\"Die2\")) (\"MoveAPiece\" (\"Die2\") (\"ReplayConsequences\" (\"Die2\")))))))) (define \"ConsecutiveNumberMove\" (forEach Site (sites Occupied by:Mover top:False) (forEach Level (site) (or (if (!= (var) (- (count Pips) 1)) (or (\"MoveAPiece\" (\"LowerDie\")) (\"MoveAPiece\" (- (count Pips) 1)) (\"ReplayConsequences\" (- (count Pips) 1)))) (if (!= (var) (count Pips)) (\"MoveAPiece\" (count Pips) (\"ReplayConsequences\" (count Pips)))))))) (define \"DoubleOfAnotherMove\" (forEach Site (sites Occupied by:Mover top:False) (forEach Level (site) (or (if (<= (var) 0) (\"MoveAPiece\" (\"Die1\"))) (\"MoveAPiece\" (count Pips) (\"ReplayConsequences\" 1)))))) (define \"ReplayConsequences\" (then (if (\"NotReplayMove\") (and (moveAgain) (set Var #1)) (set Var 0)))) (define \"NotReplayMove\" (<= (var) 0)) (define \"MoveAPiece\" (move (from (site) level:(level)) (to (\"TrackMove\" from:(site) \"Track\" #1)) #2)) (define \"Double1Move\" (forEach Site (sites Occupied by:Mover top:False) (forEach Level (site) (if (\"IsFriendAt\" (site) level:(level)) (move Remove (site) level:(level)))))) (define \"TrackMove\" (\"NextSiteOnTrack\" #3 #1 #2)) (define \"ConsecutiveNumber\" (or (= (\"Die1\") (- (\"Die2\") 1)) (= (\"Die1\") (+ (\"Die2\") 1)))) (define \"DoubleOfAnother\" (= (\"Die1\") (\"Die2\"))) (define \"Double1\" (and (= 2 (count Pips)) (is AnyDie 1))) (define \"LowerDie\" (if (< (\"Die1\") (\"Die2\")) (\"Die1\") (\"Die2\"))) (define \"Die2\" (face 17)) (define \"Die1\" (face 16)) (game \"Tsun K'i\" (players 2) (equipment { (board (scale 10 2 (rectangle 8 2)) { (track \"Track1\" \"1,N,W,S,N,E1,S\" P1 directed:True) (track \"Track2\" \"14,S,E,N,S,W1,N\" P2 directed:True)}) (piece \"Stick\" Each) (dice d:6 num:2) (regions \"Exit\" P1 (sites {\"B1\" \"B2\"})) (regions \"Exit\" P2 (sites {\"A7\" \"A8\"}))}) (rules (start { (place Stack \"Stick1\" (sites {\"B1\" \"B2\"}) count:8) (place Stack \"Stick2\" (sites {\"A7\" \"A8\"}) count:8)}) (play (do (if (\"NotReplayMove\") (roll)) next:(if (can Move (\"Move\")) (\"Move\") (move Pass (then (set Var 0)))) (then (if (and (is In (last To) (sites Mover \"Exit\")) (not (is In (last From) (sites Mover \"Exit\")))) (remove (last To) level:(last LevelTo)))))) (end (\"EscapeWin\"))))\n\n###\n\n", "completion": "2x8 board, with rectangular spaces. Sixteen pieces per player, eight each placed on the two rectangles to each player's left. Each player moves their pieces in an anti-clockwise direction. Two six-sided dice. When a player rolls two 1s, they lose a piece. When a player rolls doubles of another number, the player may move two pieces the full total of the roll, or one piece only moves half the total roll. When consecutive numbers are rolled, the player may move one piece the total of the two dice and the second piece the value of the lower die, or may move one piece the total of the die and another piece the total of the dice minus 1. When the roll is two non-consecutive numbers, the player moves the values of the individual dice. The first player to move their pieces around the board and back to the starting position wins. END" }, { "prompt": "What does the following global Ludii definition do?\n(define \"AlquerqueBoard\" (board (\"AlquerqueGraph\" #1 #2) use:Vertex))\n\n###\n\n", "completion": "Defines a rectangular board with Alquerque-style alternating diagonals. END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game starts with 25 pieces by player. -> The game starts with 26 pieces by player.\n(game \"Challis Ghutia (Titagarh)\" (\"TwoPlayersNorthSouth\") (equipment { (\"AlquerqueBoard\" 9 9) (piece \"Marker\" Each (or (\"StepToEmpty\") (\"HopCapture\")))}) (rules (start { (place \"Marker1\" (union (expand (sites Bottom) steps:1) (expand origin:(coord \"I3\") steps:6 W))) (place \"Marker2\" (union (expand (sites Top) steps:1) (expand origin:(coord \"A7\") steps:6 E)))}) (play (forEach Piece)) (end (\"CaptureAll\" Next))))\n\n###\n\n", "completion": "(game \"Challis Ghutia (Titagarh)\" (\"TwoPlayersNorthSouth\") (equipment { (\"AlquerqueBoard\" 9 9) (piece \"Marker\" Each (or (\"StepToEmpty\") (\"HopCapture\")))}) (rules (start { (place \"Marker1\" (union (expand (sites Bottom) steps:1) (expand origin:(coord \"I3\") steps:7 W))) (place \"Marker2\" (union (expand (sites Top) steps:1) (expand origin:(coord \"A7\") steps:7 E)))}) (play (forEach Piece)) (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nGoal: Most territory, counted when one player cannot make a required placement.\n \n Definitions:\n -- Site Power: For a given player, each site's power is equal to the amount by which the adjacent friendly pieces exceed the amount of all the rest of the adjacent pieces. If a site is occupied, the piece at the site is also counted as an adjacent piece.\n -- Territory: A player's 'Territory' is all the sites where he has positive power, plus all the sites he occupies where no other player has positive power.\n -- Uncontrolled site: An empty site which is not part of any player's territory is called an 'uncontrolled site'.\n \n Play:\n Turns alternate starting with White.\n To begin the turn, a player places a piece on an empty site.\n -- The piece must be placed on a site the mover controls, if possible.\n -- If this placement is not possible, the piece is placed onto an uncontrolled site.\n -- If placement is still not possible, the game ends.\n \n After the initial placement, the player is allowed to make bonus step moves using any combination of his pieces in any order, other than the one just placed. \n -- The total number of steps must not exceed the power of the placement site before placement. \n -- These step moves are all optional. \n -- Unused bonus moves may not be saved for use in future turns.\n \n Jumping over other pieces is not allowed.\n ------------------------------------------\n The game can optionally be played with multiple players.\n This application shows the territories with player-coloured rings. Three Players Board & size: Equiversi Hexhex with edges alternating 3 and 5\n\n###\n\n", "completion": "(define \"Show3456\" \"Show345\" (show Symbol \"Disc.svg\" P6 Vertex (\"PlayerTerritory\" 6) edgeColour:(colour Magenta) scale:1.0)) (define \"Show345\" \"Show34\" (show Symbol \"Disc.svg\" P5 Vertex (\"PlayerTerritory\" 5) edgeColour:(colour Blue) scale:1.0)) (define \"Show34\" \"Show3\" (show Symbol \"Disc.svg\" P4 Vertex (\"PlayerTerritory\" 4) edgeColour:(colour Green) scale:1.0)) (define \"Show3\" (show Symbol \"Disc.svg\" P3 Vertex (\"PlayerTerritory\" 3) edgeColour:(colour Red) scale:1.0)) (define \"Tri78Bug\" (tri {7 8 7 10 6})) (define \"Tri57Bug\" (tri {5 7 5 8 5})) (define \"Tri56Bug\" (tri {5 6 5 7 5})) (define \"Tri46Bug\" (tri {4 6 4 7 4})) (define \"EndCondition\" (or (no Moves Next) (all Passed))) (define \"MoveUntilDone\" (or (move Pass (then (\"SetScores\"))) (do (set Value Mover (- (value Player Mover) 1)) next:(forEach Piece (move Step (from if:(!= (from) (var \"PlacedPiece\"))) Orthogonal (to if:(is Empty (to))) (then (if (>= 0 (value Player Mover)) (\"SetScores\") (moveAgain)))))))) (define \"MoveAddPriority\" (priority (move Add (to (#1) (apply (set Var \"PlacedPiece\" (to))))) (move Add (to (#2) (apply (set Var \"PlacedPiece\" (to))))) (then (set Value Mover (max 0 (- (\"SitePowerPlayerAt\" (mover) (last To)) 1)) (then (if (>= 0 (value Player Mover)) (\"SetScores\") (and (\"SetScores\") (moveAgain)))))))) (define \"SetScores\" (forEach Player (set Score (player (player)) (max 0 (size Array (array (\"PlayerTerritory\" (player)))))))) (define \"PlayerTerritory\" (forEach (sites Board) if:(or (< 0 (\"SitePowerPlayerAt\" #1 (site))) (and { (= #1 (who at:(site))) (is In (site) (\"SiteUntontrolledOccupiedBy\" #1))})))) (define \"SiteUntontrolledOccupiedBy\" (difference (sites Occupied by:(player #1)) (sites (results from:(difference (sites Occupied by:All) (sites Occupied by:(player #1))) to:(sites Around (from) if:(and (= #1 (who at:(to))) (< 0 (\"SitePowerPlayerAt\" (who at:(from)) (to))))) (to))))) (define \"SitesUncontrolledEmpty\" (difference (sites Empty) (sites (results from:(difference (sites Board) (sites Empty)) to:(sites Around (from) if:(and (is Empty (to)) (< 0 (\"SitePowerPlayerAt\" (who at:(from)) (to))))) (to))))) (define \"PlacementSites\" (forEach (sites Empty) if:(< 0 (\"SitePowerPlayerAt\" (mover) (site))))) (define \"SitePowerPlayerAt\" (- (* 2 (count Pieces of:#1 in:(sites Around #2 Orthogonal includeSelf:True))) (count Pieces All in:(sites Around #2 Orthogonal includeSelf:True)))) (define \"SameTurn\" (is Prev Mover)) (game \"Parry\" (players 3) (equipment { (board (tri {3 5 3 5 3}) use:Vertex) (piece \"Ball\" Each)}) (rules (meta (no Repeat PositionalInTurn)) (start { (set Score Each 1)}) (play (if \"SameTurn\" (\"MoveUntilDone\") (\"MoveAddPriority\" \"PlacementSites\" \"SitesUncontrolledEmpty\"))) (end { (if (and { \"EndCondition\" (= 2 3) (= (score P1) (score P2)) (= (id P1) (what at:(var \"PlacedPiece\")))}) (result P1 Win)) (if (and { \"EndCondition\" (= 2 3) (= (score P1) (score P2)) (!= (id P1) (what at:(var \"PlacedPiece\")))}) (result P2 Win)) (if \"EndCondition\" (byScore))}))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines starting rules placing one counter on each black cell of a square board (e.g. Starting rules of Draughts).\n\n###\n\n", "completion": "(define \"BlackCellsSetup\" (start { (place \"Counter1\" (difference (expand (sites Bottom) steps:(- #1 1)) (sites Phase 1))) (place \"Counter2\" (difference (expand (sites Top) steps:(- #1 1)) (sites Phase 1)))})) END" }, { "prompt": "What does the following global Ludii definition do?\n(define \"EscapeWin\" (if (no Pieces Mover) (result Mover Win)))\n\n###\n\n", "completion": "Checks if the mover has no pieces and makes it win. This ludemeplex can be used only in an ending condition. END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nChecks if the previous mover is the same player than the current mover, consequently this is the same turn.\n\n###\n\n", "completion": "(define \"SameTurn\" (is Prev Mover)) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a sequence of hop move in all the adjacent directions over an enemy to an empty site. \n\n###\n\n", "completion": "(define \"HopSequenceCapture\" (move Hop (between #1 #2 if:(\"IsEnemyAt\" (between)) (apply (remove (between) #3))) (to if:(is Empty (to))) (then (if (can Move (hop (from (last To)) (between #1 #2 if:(and (not (is In (between) (sites ToClear))) (\"IsEnemyAt\" (between)))) (to if:(is Empty (to))))) (moveAgain))))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines two opposite table tracks and using hand sites.\n\n###\n\n", "completion": "(define \"TableTracksOppositeWithHands2\" { (track \"Track1\" {24 11..0 12..23 #1} P1 directed:True) (track \"Track2\" {25 23..12 0..11 #1} P2 directed:True)}) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines backgammon tracks following the same direction for each player but starting from opposite corners in using the bar of the board.\n\n###\n\n", "completion": "(define \"BackgammonTracksSameDirectionOppositeCornersWithBars2\" { (track \"Track1\" {6 25..20 18..13 0..5 7..12 #1} P1 directed:True) (track \"Track2\" {19 0..5 7..12 25..20 18..13 #1} P2 directed:True)}) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nA size 3 board is currently selected -> A size 4 board is currently selected\n(define \"UpdateScore\" (do (set Var \"CutOff\" 0) next:(do (while (and (= 0 (- (count Groups if:(= (id P1) (who at:(to))) min:(var \"CutOff\")) (count Groups if:(= (id P2) (who at:(to))) min:(var \"CutOff\")))) (!= 0 (+ (count Groups if:(= (id P1) (who at:(to))) min:(var \"CutOff\")) (count Groups if:(= (id P2) (who at:(to))) min:(var \"CutOff\"))))) (set Var \"CutOff\" (+ 1 (var \"CutOff\")))) next:(and (set Score P1 (count Groups if:(= (id P1) (who at:(to))) min:(var \"CutOff\"))) (set Score P2 (count Groups if:(= (id P2) (who at:(to))) min:(var \"CutOff\"))))))) (game \"Yoin\" (players 2) (equipment { (board (hex 3)) (piece \"Disc\" Each)}) (rules (meta (swap)) (play (move Add (to (sites Empty)) (then (if (is Full) (\"UpdateScore\"))))) (end (if (is Full) {(if (< (score P1) (score P2)) (result P1 Win)) (if (> (score P1) (score P2)) (result P2 Win))}))))\n\n###\n\n", "completion": "(define \"UpdateScore\" (do (set Var \"CutOff\" 0) next:(do (while (and (= 0 (- (count Groups if:(= (id P1) (who at:(to))) min:(var \"CutOff\")) (count Groups if:(= (id P2) (who at:(to))) min:(var \"CutOff\")))) (!= 0 (+ (count Groups if:(= (id P1) (who at:(to))) min:(var \"CutOff\")) (count Groups if:(= (id P2) (who at:(to))) min:(var \"CutOff\"))))) (set Var \"CutOff\" (+ 1 (var \"CutOff\")))) next:(and (set Score P1 (count Groups if:(= (id P1) (who at:(to))) min:(var \"CutOff\"))) (set Score P2 (count Groups if:(= (id P2) (who at:(to))) min:(var \"CutOff\"))))))) (game \"Yoin\" (players 2) (equipment { (board (hex 4)) (piece \"Disc\" Each)}) (rules (meta (swap)) (play (move Add (to (sites Empty)) (then (if (is Full) (\"UpdateScore\"))))) (end (if (is Full) {(if (< (score P1) (score P2)) (result P1 Win)) (if (> (score P1) (score P2)) (result P2 Win))})))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nChecks if a site returned by a track is off board. \n\n###\n\n", "completion": "(define \"IsOffBoard\" (= #1 Off)) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6, 8, or 12 holes. Four counters in each hole. Play begins from a player's righthand hole and counters are sown clockwise. After this, a player may begin sowing from any hole in their row. When the final counter falls into an occupied hole, the counters in that hole are picked up and sowing continues. If the final counter falls into an empty hole, the turn ends; if this hole is in the player's own row, the contents of the opponent's hole are captured if they contain one, two, four, or more counters. If it contains three counters, one of the opponent's counters is taken and placed into the hole where sowing ended, so that each now has two counters. These holes cannot be sown from for the rest of the game and are owned by the player whose turn created them. Play ends when one player can no longer play. The opponent then takes all of the counters in their own row, and each player takes the counters that have accumulated in their captured holes. The player with the most counters wins. Each player has 6 holes.\n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (count Cell at:(handSite #1))) (define \"APlayerCanNotMove\" (and (not (is Next Mover)) (or (all Sites (sites P1) if:(or (!= 0 (state at:(site))) (is Empty (site)))) (all Sites (sites P2) if:(or (!= 0 (state at:(site))) (is Empty (site))))))) (define \"Columns\" 6) (game \"Leyla Gobale (Somaliland)\" (players 2) (equipment { (mancalaBoard 2 6 store:None (track \"Track\" \"5,W,N,E\" loop:True)) (piece \"Seed\" Shared) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (hand Each)}) (rules (start (set Count 4 to:(sites Track))) (play (or { (move Select (from (if (= 0 (count Moves)) (sites {5}) (if (\"SameTurn\") (sites {(var \"Replay\")}) (sites Mover))) if:(and (is Occupied (from)) (= 0 (state at:(from))))) (then (sow apply:(if (< 1 (count at:(to))) (if (= 0 (state at:(to))) (and (moveAgain) (set Var \"Replay\" (to)))) (if (is In (to) (sites Mover)) (if (!= 3 (count at:(\"OppositePitTwoRows\" (to)))) (if (!= 0 (count at:(\"OppositePitTwoRows\" (to)))) (fromTo (from (\"OppositePitTwoRows\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePitTwoRows\" (to))))) (and { (fromTo (from (\"OppositePitTwoRows\" (to))) (to (to)) count:1) (set State at:(to) (mover)) (set State at:(\"OppositePitTwoRows\" (to)) (mover))})))))))} (then (if (\"APlayerCanNotMove\") (and { (forEach Site (sites P1) (if (= 0 (state at:(site))) (fromTo (from (site)) (to (handSite P1)) count:(count at:(site))))) (forEach Site (sites P2) (if (= 0 (state at:(site))) (fromTo (from (site)) (to (handSite P2)) count:(count at:(site))))) (forEach Site (sites Board) (if (= (state at:(site)) P1) (fromTo (from (site)) (to (handSite P1)) count:(count at:(site))) (if (= (state at:(site)) P2) (fromTo (from (site)) (to (handSite P2)) count:(count at:(site))))))}))))) (end (\"MancalaByScoreWhen\" (\"NoPieceOnBoard\"))))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nReturns the number of steps between the last `from' location and the last `to' location.\n\n###\n\n", "completion": "(define \"LastDistance\" (count Steps #1 (last From) (last To))) END" }, { "prompt": "What does the following global Ludii definition do?\n(define \"AlquerqueGraphWithBottomAndTopTriangles\" (merge { (square 5 diagonals:Alternating) (shift 0 4 (rotate 180 (wedge 3))) (shift 0 -2 (wedge 3))}))\n\n###\n\n", "completion": "Defines a rectangular graph with Alquerque-style alternating diagonals with a triangle extension at the bottom and another at the top. END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"StepMoveOnThePalace\" (move Step #1 (to if:(and (is In (to) (sites Mover \"Palace\")) (not (\"IsFriendAt\" (to)))) (apply (remove (to)))))) (define \"JiangSameColumnWithNoPieceBetween\" (if (= (column of:(where \"Jiang\" P1)) (column of:(where \"Jiang\" P2))) (not (\"NoSites\" (forEach (sites Direction from:(where \"Jiang\" P1) N stop:(= (to) (where \"Jiang\" P2))) if:(is Occupied (site))))) True)) (game \"MiniXiangqi\" (\"TwoPlayersNorthSouth\") (equipment { (board (rectangle 7 7) use:Vertex) (piece \"Jiang\" Each (\"StepMoveOnThePalace\" Orthogonal)) (piece \"Ma\" Each (forEach Direction Orthogonal (to if:(is Empty (to)) (apply (forEach Direction (from (to)) (directions {FR FL} of:All) (if (not (\"IsFriendAt\" (to))) (move (from) (to (apply if:(\"IsEnemyAt\" (to)) (remove (to))))))))))) (piece \"Ju\" Each (\"SlideCapture\" Orthogonal)) (piece \"Pao\" Each (or (move Slide Orthogonal) (move Hop Orthogonal (between before:(count Rows) after:(count Rows) if:(is Occupied (between))) (to if:(is Empty (to)) (apply if:(\"IsEnemyAt\" (to)) (remove (to))))))) (piece \"Zu\" Each (\"StepToNotFriend\" (directions {Forward Rightward Leftward}))) (regions \"PalaceP1\" P1 { 2..4 9..11 16..18}) (regions \"PalaceP2\" P2 { 30..32 37..39 44..46})}) (rules (start { (place \"Jiang1\" coord:\"D1\") (place \"Ma1\" {\"C1\" \"E1\"}) (place \"Ju1\" {\"A1\" \"G1\"}) (place \"Pao1\" {\"B1\" \"F1\"}) (place \"Zu1\" {\"A2\" \"C2\" \"D2\" \"E2\" \"G2\"}) (place \"Jiang2\" coord:\"D7\") (place \"Ma2\" {\"C7\" \"E7\"}) (place \"Ju2\" {\"A7\" \"G7\"}) (place \"Pao2\" {\"B7\" \"F7\"}) (place \"Zu2\" {\"A6\" \"C6\" \"D6\" \"E6\" \"G6\"})}) (play (do (forEach Piece) ifAfterwards:(and (\"JiangSameColumnWithNoPieceBetween\") (not (\"IsInCheck\" \"Jiang\" Mover))))) (end { (\"Checkmate\" \"Jiang\") (\"BlockWin\")})))\n\n###\n\n", "completion": "The rules for pieces are the same as regular Xiangqi, except pawns start with the ability to move sideways. END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nEach row has 4 holes. -> Each row has 6 holes.\n(define \"NextHoleFrom\" (\"NextSiteOnTrack\" #2 from:#1)) (define \"RightMost\" (trackSite FirstSite from:(trackSite FirstSite if:(not (is Mover (who at:(to))))) if:(is Mover (who at:(to))))) (define \"Columns\" 4) (game \"Mwendo\" (players 4) (equipment { (mancalaBoard 4 \"Columns\" store:None (track \"Track\" \"4,N,E,S,W\" loop:True)) (piece \"Seed\" Each) (regions P1 (sites {0..2})) (regions P2 (sites {3 7 11})) (regions P3 (sites {15..13})) (regions P4 (sites {12 8 4}))}) (rules (start { (place \"Seed1\" (sites P1) counts:{3}) (place \"Seed2\" (sites P2) counts:{3}) (place \"Seed3\" (sites P3) counts:{3}) (place \"Seed4\" (sites P4) counts:{3})}) (play (if (!= 1 (count Pieces Mover)) (or (move Select (from (\"RightMost\")) (then (sow numPerHole:(if (is Empty (to)) 2 1) sowEffect:(if (and (!= (mover) (what at:(to))) (is Occupied (to))) (and (remove (to) count:(count at:(to))) (add (piece (id \"Seed\" Mover)) (to (to)) count:(count at:(to))))) apply:(if (= 2 (count at:(to))) (moveAgain))))) (if (\"NewTurn\") (move (from (\"RightMost\")) (to (\"NextHoleFrom\" (\"RightMost\") 1) (apply (if (and (!= (mover) (what at:(to))) (is Occupied (to))) (and (remove (to) count:(count at:(to))) (add (piece (id \"Seed\" Mover)) (to (to)) count:(count at:(to))))))) count:(count at:(\"RightMost\"))))) (move (from (\"RightMost\")) (to (trackSite FirstSite from:(from) if:(\"IsEnemyAt\" (to))) (apply (and (remove (to) count:(count at:(to))) (add (piece (id \"Seed\" Mover)) (to (to)) count:(count at:(to))))))))) (end (forEach NonMover if:(no Pieces Player) (result Player Loss)))))\n\n###\n\n", "completion": "(define \"NextHoleFrom\" (\"NextSiteOnTrack\" #2 from:#1)) (define \"RightMost\" (trackSite FirstSite from:(trackSite FirstSite if:(not (is Mover (who at:(to))))) if:(is Mover (who at:(to))))) (define \"Columns\" 6) (game \"Mwendo\" (players 4) (equipment { (mancalaBoard 4 \"Columns\" store:None (track \"Track\" \"6,N,E,S,W\" loop:True)) (piece \"Seed\" Each) (regions P1 (sites {0..3})) (regions P2 (sites {4 5 11 17})) (regions P3 (sites {23..20})) (regions P4 (sites {19 18 12 6}))}) (rules (start { (place \"Seed1\" (sites P1) counts:{3}) (place \"Seed2\" (sites P2) counts:{3}) (place \"Seed3\" (sites P3) counts:{3}) (place \"Seed4\" (sites P4) counts:{3})}) (play (if (!= 1 (count Pieces Mover)) (or (move Select (from (\"RightMost\")) (then (sow numPerHole:(if (is Empty (to)) 2 1) sowEffect:(if (and (!= (mover) (what at:(to))) (is Occupied (to))) (and (remove (to) count:(count at:(to))) (add (piece (id \"Seed\" Mover)) (to (to)) count:(count at:(to))))) apply:(if (= 2 (count at:(to))) (moveAgain))))) (if (\"NewTurn\") (move (from (\"RightMost\")) (to (\"NextHoleFrom\" (\"RightMost\") 1) (apply (if (and (!= (mover) (what at:(to))) (is Occupied (to))) (and (remove (to) count:(count at:(to))) (add (piece (id \"Seed\" Mover)) (to (to)) count:(count at:(to))))))) count:(count at:(\"RightMost\"))))) (move (from (\"RightMost\")) (to (trackSite FirstSite from:(from) if:(\"IsEnemyAt\" (to))) (apply (and (remove (to) count:(count at:(to))) (add (piece (id \"Seed\" Mover)) (to (to)) count:(count at:(to))))))))) (end (forEach NonMover if:(no Pieces Player) (result Player Loss))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n5x5 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 two sides of the triangle. One player plays as twenty people, stacked five each in the four points where the diagonals cross in each quadrant. The other player plays as two tigers, which are placed on the midpoints of the sides without triangles. Players alternate turns moving one piece to an adjacent spot along the lines of the board. The tiger may hop over one of the people to an empty point on the opposite side immediately adjacent to it along the lines of the board. When the tiger hops over one of the stacks, it captures only one of the people. The tigers win by capturing all the people, the people win by blocking the tigers from being able to move. \n\n###\n\n", "completion": "(game \"Mao Naga Tiger Game\" (players 2) (equipment { (\"AlquerqueBoardWithBottomAndTopTriangles\") (piece \"Human\" P1 \"StepToEmpty\") (piece \"Tiger\" P2 (or \"StepToEmpty\" \"HopCapture\"))}) (rules (start { (place Stack \"Human1\" (sites {\"B4\" \"B6\" \"D4\" \"D6\"}) count:5) (place \"Tiger2\" (sites {\"A5\" \"E5\"}))}) (play (forEach Piece top:True)) (end (\"NoMovesP2NoPiecesP1\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\n9x9 intersecting lines, with diagonals drawn in the large square. Forty pieces per player, arranged on the points closest to the player and to the right of the central spot, with the central spot remaining empty. Players alternate turns moving their pieces forward along the lines of the board. They cannot move sideways or backwards, except to capture. A piece may capture an adjacent opponent's piece by hopping over it to an empty spot immediately on the opposite side of the opponent's piece, along the lines of the board. When a player's piece reaches the line on the opposite side of the board from which it started, it is promoted to Sultan, and it may move in all directions along the lines of the board and over any unobstructed distance. The player who captures all of the opponent's pieces wins.\n \n\n###\n\n", "completion": "(game \"Crand\" (\"TwoPlayersNorthSouth\") (equipment { (board (add (square 9) edges:{ {0 10} {10 20} {20 30} {30 40} {40 50} {50 60} {60 70} {70 80} {72 64} {64 56} {56 48} {48 40} {40 32} {32 24} {16 24} {16 8}}) use:Vertex) (piece \"Counter\" Each (or (\"StepToEmpty\" (difference Forwards Diagonal)) \"HopCapture\" (then (\"PromoteIfReach\" (sites Next) \"DoubleCounter\")))) (piece \"DoubleCounter\" Each (or (move Slide) \"HopCapture\")) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start { (place \"Counter1\" (union (sites {41..44}) (expand (sites Bottom) steps:3))) (place \"Counter2\" (union (sites {36..39}) (expand (sites Top) steps:3)))}) (play (forEach Piece)) (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a piece moving like a pawn in Chess (En Passant, Initial double step moves and promotion are not described in this ludemeplex).\n\n###\n\n", "completion": "(define \"ChessPawn\" (piece #1 Each (or { \"StepForwardToEmpty\" (\"StepToEnemy\" (directions {FR FL})) #2} #3))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"StepMoveOnThePalace\" (move Step #1 (to if:(and (is In (to) (sites Mover \"Palace\")) (not (\"IsFriendAt\" (to)))) (apply if:(\"IsEnemyAt\" (to)) (add (piece (mapEntry \"captured\" (what at:(to)))) (to Cell (mapEntry \"where\" (what at:(to))))))))) (define \"EnemyCannotMove\" (not (can Move (do (or { (forEach Piece Next) (move (from (sites Occupied by:Next container:\"Hand\" components:{\"Ma\" \"Ju\" \"Pao\" \"Zu\"})) (to (sites Empty))) (move (from (sites Occupied by:Next container:\"Hand\" component:\"Shi\")) (to (intersection (sites Empty) (sites Next \"PalaceShi\")))) (move (from (sites Occupied by:Next container:\"Hand\" component:\"Xiang\")) (to (intersection (sites Empty) (sites Next \"Home\"))))}) ifAfterwards:(not (\"IsInCheck\" \"Jiang\" Next)))))) (define \"JiangSameColumnWithNoPieceBetween\" (if (= (column of:(where \"Jiang\" P1)) (column of:(where \"Jiang\" P2))) (not (\"NoSites\" (forEach (sites Direction from:(where \"Jiang\" P1) N stop:(= (to) (where \"Jiang\" P2))) if:(is Occupied (site))))) True)) (game \"Loop Xiangqi\" (\"TwoPlayersNorthSouth\") (equipment { (board (rectangle 10 9) use:Vertex) (piece \"Shi\" Each (\"StepMoveOnThePalace\" Diagonal)) (piece \"Xiang\" Each (move Slide Diagonal (between (exact 2) if:(and { (is In (between) (sites Mover \"Home\")) (is Empty (between))})) (to if:(\"IsEnemyAt\" (to)) (apply (if (\"IsEnemyAt\" (to)) (add (piece (mapEntry \"captured\" (what at:(to)))) (to Cell (mapEntry \"where\" (what at:(to)))))))))) (piece \"Ma\" Each (forEach Direction Orthogonal (to if:(is Empty (to)) (apply (forEach Direction (from (to)) (directions {FR FL} of:All) (if (not (\"IsFriendAt\" (to))) (move (from) (to (apply if:(\"IsEnemyAt\" (to)) (add (piece (mapEntry \"captured\" (what at:(to)))) (to Cell (mapEntry \"where\" (what at:(to)))))))))))))) (piece \"Ju\" Each (move Slide Orthogonal (to if:(\"IsEnemyAt\" (to)) (apply (if (\"IsEnemyAt\" (to)) (add (piece (mapEntry \"captured\" (what at:(to)))) (to Cell (mapEntry \"where\" (what at:(to)))))))))) (piece \"Pao\" Each (or (move Slide Orthogonal) (move Hop Orthogonal (between before:(count Rows) after:(count Rows) if:(is Occupied (between))) (to if:(is Empty (to)) (apply if:(\"IsEnemyAt\" (to)) (add (piece (mapEntry \"captured\" (what at:(to)))) (to Cell (mapEntry \"where\" (what at:(to)))))))))) (piece \"Zu\" Each (move Step (if (is In (from) (sites Mover \"Home\")) Forward (directions {Forward Rightward Leftward})) (to (apply if:(\"IsEnemyAt\" (to)) (add (piece (mapEntry \"captured\" (what at:(to)))) (to Cell (mapEntry \"where\" (what at:(to))))))))) (piece \"Jiang\" Each (\"StepMoveOnThePalace\" Orthogonal)) (regions \"PalaceP1\" P1 { 3..5 12..14 21..23}) (regions \"PalaceP2\" P2 { 66..68 75..77 84..86}) (regions \"Home\" P1 (expand (sites Bottom) steps:4)) (regions \"Home\" P2 (expand (sites Top) steps:4)) (map \"where\" {(pair 2 90) (pair 1 96) (pair 4 91) (pair 3 97) (pair 6 92) (pair 5 98) (pair 8 93) (pair 7 99) (pair 10 94) (pair 9 100) (pair 12 95) (pair 11 101)}) (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)}) (regions \"PalaceShiP1\" P1 { 3 5 13 21 23}) (regions \"PalaceShiP2\" P2 { 66 68 76 84 86}) (hand Each size:6)}) (rules (start { (place \"Jiang1\" coord:\"E1\") (place \"Shi1\" {\"D1\" \"F1\"}) (place \"Xiang1\" {\"C1\" \"G1\"}) (place \"Ma1\" {\"B1\" \"H1\"}) (place \"Ju1\" {\"A1\" \"I1\"}) (place \"Pao1\" {\"B3\" \"H3\"}) (place \"Zu1\" {\"A4\" \"C4\" \"E4\" \"G4\" \"I4\"}) (place \"Jiang2\" coord:\"E10\") (place \"Shi2\" {\"D10\" \"F10\"}) (place \"Xiang2\" {\"C10\" \"G10\"}) (place \"Ma2\" {\"B10\" \"H10\"}) (place \"Ju2\" {\"A10\" \"I10\"}) (place \"Pao2\" {\"B8\" \"H8\"}) (place \"Zu2\" {\"A7\" \"C7\" \"E7\" \"G7\" \"I7\"})}) (play (do (or { (forEach Piece) (move (from (sites Occupied by:Mover container:\"Hand\" components:{\"Ma\" \"Ju\" \"Pao\" \"Zu\"})) (to (sites Empty))) (move (from (sites Occupied by:Mover container:\"Hand\" component:\"Shi\")) (to (intersection (sites Empty) (sites Mover \"PalaceShi\")))) (move (from (sites Occupied by:Mover container:\"Hand\" component:\"Xiang\")) (to (intersection (sites Empty) (sites Mover \"Home\"))))}) ifAfterwards:(and (\"JiangSameColumnWithNoPieceBetween\") (not (\"IsInCheck\" \"Jiang\" Mover))))) (end { (if (and (\"IsInCheck\" \"Jiang\" Next) (\"EnemyCannotMove\")) (result Mover Win)) (\"BlockWin\")})))\n\n###\n\n", "completion": "The rules are the same as for Xiangqi, 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 Shi can only be placed on positions where they could normally reach. Captured Xiang can only be placed on the controlling players side of the river. END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe score is currently updated after each move, but the parity of group sizes is not marked on the stones. -> The score is currently updated only when the board is full, and the parity of group sizes is not marked on the stones. (This makes the AI stronger.)\nA size 3 board is currently selected -> A size 4 board is currently selected\n(define \"UpdateScoreMover\" (and (set Score Mover 0) (forEach Group Orthogonal if:(is Mover (who at:(to))) (if (is Odd (count Sites in:(sites))) (addScore Mover -1) (addScore Mover -2))))) (define \"MarkEvenGroups\" (forEach Group Orthogonal if:(is Mover (who at:(to))) (if (is Odd (count Sites in:(sites))) (forEach Site (sites) (set State at:(site) 0)) (forEach Site (sites) (set State at:(site) 1))))) (define \"UpdateScoreMoverAndMarkEvenGroups\" (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) 0))) (and (addScore Mover -2) (forEach Site (sites) (set State at:(site) 1))))))) (game \"Elea\" (players 2) (equipment { (board (hex 3)) (piece \"Disc\" Each)}) (rules (meta (swap)) (play (move Add (to (sites Empty)) (then (\"UpdateScoreMover\")))) (end (if (is Full) (byScore)))))\n\n###\n\n", "completion": "(define \"UpdateScoreMover\" (and (set Score Mover 0) (forEach Group Orthogonal if:(is Mover (who at:(to))) (if (is Odd (count Sites in:(sites))) (addScore Mover -1) (addScore Mover -2))))) (define \"MarkEvenGroups\" (forEach Group Orthogonal if:(is Mover (who at:(to))) (if (is Odd (count Sites in:(sites))) (forEach Site (sites) (set State at:(site) 0)) (forEach Site (sites) (set State at:(site) 1))))) (define \"UpdateScoreMoverAndMarkEvenGroups\" (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) 0))) (and (addScore Mover -2) (forEach Site (sites) (set State at:(site) 1))))))) (game \"Elea\" (players 2) (equipment { (board (hex 4)) (piece \"Disc\" Each)}) (rules (meta (swap)) (play (move Add (to (sites Empty)) (then (if (or (= 1 (count Sites in:(sites Empty))) (is Full)) (\"UpdateScoreMover\"))))) (end (if (is Full) (byScore))))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a slide move to capture an enemy piece.\n\n###\n\n", "completion": "(define \"SlideCapture\" (move Slide #1 #2 (to if:(\"IsEnemyAt\" (to)) (apply (remove (to) #3))) #4)) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a graphics turtle walk to build a large L piece.\n\n###\n\n", "completion": "(define \"LWalk\" { {L F R F F} {R F L F F}}) END" }, { "prompt": "Construct a Ludii game based on the following description\nGoal: To Win, connect the groups of stones at opposite edges.\n \n On your turn place up to 4 stones.\n \n Restriction:\n You may not place a stone diagonally from another stone of your color, UNLESS the stone is connected through orthogonal links after you have placed your next stone in the same turn. \n \n If you place in the wrong sequence use the Undo button to go back.\n \n Do not select the stone to reverse the move as this limits your options to move elsewhere. \n That option is just there as a work-around for the Ludii system.\n \n There are 2 versions:\n 1. Placing pieces on any empty spaces allowed in the above rules.\n 2. Restricting successive placements in the turn to locations around the previous placement.\n This keeps all the pieces played in one turn, as a group. Both the pieces must be placed together (touching) and leave all crosscuts connected Order 7 Board\n\n###\n\n", "completion": "(define \"Order\" 7) (define \"Goal\" (or (is Connected at:(regionSite (sites Column Cell 0) index:0) Orthogonal { (sites Column (+ \"Order\" 1)) (sites Column 0)}) (is Connected at:(regionSite (sites Row Cell 0) index:0) Orthogonal { (sites Row (+ \"Order\" 1)) (sites Row 0)}))) (define \"GamePlay\" (if (\"NewTurn\") (do (\"Placements\") ifAfterwards:(or { \"NoCrosscuts\" (can Move (do (\"TouchingPlacements\") ifAfterwards:(\"NoCrosscuts\")))}) (then (moveAgain))) (do (\"TouchingPlacements\") ifAfterwards:(\"NoCrosscuts\") (then (forget Value All))))) (define \"NoCrosscuts\" (= (size Array (sizes Group Orthogonal Mover)) (size Array (sizes Group All Mover)))) (define \"Placements\" (or { (move Add (piece (id \"Square\" Mover)) (to (sites Empty)) (then (if (\"NewTurn\") (remember Value (last To))))) (move Select (from Edge (sites Board Edge) if:(no Pieces All in:(sites Incident Cell of:Edge at:(from)))) (then (forEach Site (sites Incident Cell of:Edge at:(last From)) (and (add (piece (id \"Square\" Mover)) (to (site))) (if (\"NewTurn\") (remember Value (site))))))) (if (\"SameTurn\") (move Pass))})) (define \"TouchingPlacements\" (or { (move Add (piece (id \"Square\" Mover)) (to Cell \"EmptyCellsAroundPiecesPlaced\")) (move Select (from Edge (forEach of:\"EmptyCellsAroundPiecesPlaced\" (sites Incident Edge of:Cell at:(site))) if:(no Pieces All in:(sites Incident Cell of:Edge at:(from)))) (then (add (piece (id \"Square\" Mover)) (to Cell (sites Incident Cell of:Edge at:(last From))))))})) (define \"EmptyCellsAroundPiecesPlaced\" (intersection (sites Around (sites (values Remembered)) Orthogonal) (sites Empty))) (game \"Allemande\" (players 2) (equipment { (board (remove (square (+ 2 \"Order\")) cells:{0 (+ \"Order\" 1) (* (+ \"Order\" 2) (+ \"Order\" 1)) (- (^ (+ \"Order\" 2) 2) 1)}) use:Cell) (regions \"EW\" P1 (union (sites Column (+ \"Order\" 1)) (sites Column 0))) (regions \"NS\" P2 (union (sites Row (+ \"Order\" 1)) (sites Row 0))) (piece \"Square\" Each) (hand Each size:4)}) (rules (start { (place \"Square1\" (union (sites Column (+ \"Order\" 1)) (sites Column 0))) (place \"Square2\" (union (sites Row (+ \"Order\" 1)) (sites Row 0)))}) (play \"GamePlay\") (end (if \"Goal\" (result Mover Win))))) END" }, { "prompt": "What does the following global Ludii definition do?\n(define \"PhaseMovePiece\" (phase #1 (play (forEach Piece)) #2))\n\n###\n\n", "completion": "Defines a phase to move each piece according to the move ludeme associated with each piece. END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a rectangular graph with Alquerque-style alternating diagonals.\n\n###\n\n", "completion": "(define \"AlquerqueGraph\" (rectangle #1 #2 diagonals:Alternating)) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayed on a 7x7 board. Each player has 11 pieces. they move diagonally one space or can capture opposing pieces by jumping. When captured, a piece is placed underneath the capturing piece, creating columns. When columns are captured, only the piece at the top of the column is taken. Columns are controlled by the player whose piece is on top of the column. When a piece or column reaches the opposite side of the board they become promoted to officer and can move backwards. A player wins by capturing all of the opponent's pieces. The game is played in a Chess board.\n\n###\n\n", "completion": "(define \"IsUnpromoted\" (\"IsPieceAt\" \"Counter\" Mover (last To) level:(topLevel at:(last To)))) (define \"Hop\" (\"HopStackEnemyCaptureTop\" #1 ~ (then (if (can Move (\"HopStackEnemyCaptureTop\" (from (last To)) #1)) (moveAgain))))) (game \"Lasca\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 7)) (piece \"Counter\" Each) (piece \"CounterStar\" Each) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start { (place \"Counter1\" (difference (expand (sites Bottom) steps:2) (sites Phase 1))) (place \"Counter2\" (difference (expand (sites Top) steps:2) (sites Phase 1)))}) (play (if \"SameTurn\" (if \"IsUnpromoted\" (\"HopStackEnemyCaptureTop\" (from (last To)) (directions {FR FL}) (then (\"PromoteIfReach\" (sites Next) \"CounterStar\" (if (can Move (\"HopStackEnemyCaptureTop\" (from (last To)) (directions {FR FL}))) (moveAgain))))) (\"HopStackEnemyCaptureTop\" (from (last To)) Diagonal (then (if (can Move (\"HopStackEnemyCaptureTop\" (from (last To)) Diagonal)) (moveAgain))))) (priority { (or { (forEach Piece \"Counter\" (\"Hop\" (directions {FR FL})) top:True (then (\"PromoteIfReach\" (sites Next) \"CounterStar\"))) (forEach Piece \"CounterStar\" (\"Hop\" Diagonal) top:True)}) (or { (forEach Piece \"Counter\" (\"StepStackToEmpty\" (directions {FR FL})) top:True (then (\"PromoteIfReach\" (sites Next) \"CounterStar\"))) (forEach Piece \"CounterStar\" (\"StepStackToEmpty\" Diagonal) top:True)})}))) (end (\"BlockWin\")))) END" }, { "prompt": "What does the following global Ludii definition do?\n(define \"HandOccupied\" (not (all Sites (sites Hand #1) if:(= 0 (count Cell at:(site))))))\n\n###\n\n", "completion": "Checks if at least a site in a specific hand is not empty. This ludemeplex is working only for non stacking games. END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nChecks if a site returned by a track is not off board. \n\n###\n\n", "completion": "(define \"IsNotOffBoard\" (!= #1 Off)) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines an intervene capture in all the directions specified (by default Adjacent). The enemy piece is removed.\n\n###\n\n", "completion": "(define \"InterveneCapture\" (intervene (from (last To)) #1 (to if:(\"IsEnemyAt\" (to)) (apply (remove (to)))) #2)) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a rectangular board with Alquerque-style alternating diagonals with eight triangle extensions.\n\n###\n\n", "completion": "(define \"AlquerqueBoardWithEightTriangles\" (board (merge { (shift 2 2 (square 5 diagonals:Alternating)) (shift 2 0 (wedge 3)) (shift 5 3 (rotate 90 (wedge 3))) (shift 2 6 (rotate 180 (wedge 3))) (shift -1 3 (rotate 270 (wedge 3))) (shift 0.65 1.15 (scale 0.5 (rotate -45 (wedge 3)))) (shift 5.35 1.15 (scale 0.5 (rotate 45 (wedge 3)))) (shift 5.35 5.85 (scale 0.5 (rotate 135 (wedge 3)))) (shift 0.65 5.85 (scale 0.5 (rotate -135 (wedge 3))))}) use:Vertex)) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nChecks if a specific piece type reached a region and makes a player is wining. This ludemeplex can be used only in an ending condition.\n\n###\n\n", "completion": "(define \"PieceTypeReachWin\" (if (is Within (id #1) in:#2) (result #3 Win))) END" }, { "prompt": "What does the following global Ludii definition do?\n(define \"StickDice\" (dice d:2 from:0 num:#1))\n\n###\n\n", "completion": "Defines a specified number of D2 dice with values 0 and 1. END" }, { "prompt": "Construct a Ludii game based on the following description\nPlay starts with black. On his turn a player may either drop a stone of his color or remove a dead enemy group. Players may only legally drop stones adjacent to at least one of their stones already on the board. For boards sized 11x11 and smaller a group is considered dead if any stone within it meets the following criteria.\n \n a)The stone has no empty points orthogonally adjacent\n b)The stone has at least one enemy stone adjacent\n \nFor boards larger than 11x11 only the first criterion applies when determining if a group is dead. You may never remove your own dead groups. If a player has no legal move on his turn he must pass. Passing is otherwise not permitted. The player to remove all opposing groups from the board wins. A size 13 board is currently selected\n\n###\n\n", "completion": "(define \"Remove\" (move Select (from (sites Occupied by:Enemy) if:(\"SomeSite\" (sites Group at:(from)) (and (= 0 (count Sites in:(sites Around (site) Empty Orthogonal))) (if (>= 11 13) (< 0 (count Sites in:(sites Around (site) Own Orthogonal))) True)))) (then (forEach Site (sites Group at:(last From) Orthogonal) (remove (site)))))) (define \"Place\" (move Add (to (sites Around (sites Occupied by:Mover) Empty Orthogonal)))) (define \"SomeSite\" (not (all Sites #1 if:(not #2)))) (game \"Rampart\" (players 2) (equipment { (board (square 13) use:Vertex) (piece \"Disc\" Each)}) (rules (start { (place \"Disc1\" (forEach (sites Phase 0) if:(and { (is Even (row of:(site))) (!= 0 (% (site) 4)) (= 0 (% (row of:(site)) 4))}))) (place \"Disc2\" (forEach (sites Phase 0) if:(and { (is Even (row of:(site))) (!= 0 (% (site) 4)) (= 2 (% (row of:(site)) 4))})))}) (play (or (\"Place\") (\"Remove\"))) (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Construct a Ludii game based on the following description\n4x8 board. Four counters in each of the holes in each player's inner row. Sowing occurs in an anti-clockwise direction, with the first counter being sown into the hole from which the counters were picked up. When the final counter lands in an empty hole, the player's turn ends. When the final counter lands in an occupied hole in the inner row, the player captures the counters in the opponent's opposite inner row hole, and continues sowing with these counters and the counters in the hole where the final counter was dropped.. When the final counter lands in an occupied hole but a capture is not possible, these counters are picked up and sowing continues. Play continues until one player can no longer play, and the opponent wins. \n\n###\n\n", "completion": "(define \"Columns\" 8) (game \"Kisolo (Lali)\" (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) (hand Each)}) (rules (start (set Count 4 to:(union (sites P1 \"Inner\") (sites P2 \"Inner\")))) (play (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(< 1 (count at:(from)))) (then (sow \"Track\" owner:(mover) apply:(if (> (count at:(to)) 1) (and (moveAgain) (if (and (!= (count at:(\"OppositePit\" (to))) 0) (is In (to) (sites Mover \"Inner\"))) (fromTo (from (\"OppositePit\" (to))) (to (to)) count:(count at:(\"OppositePit\" (to))))))) origin:True)))) (end (if (and (!= (next) (mover)) (no Moves Next)) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6 board with a store on either end. Four counters in each hole. Players take turns sowing in an anti-clockwise direction from one of the holes in their row. Counters are captured when the final counter of a sowing is dropped into a hole in the opponent's row containing one or two counters, making it contain two or three counters. If the previous hole also contains two or three counters, they are also captured, in an unbroken line until a hole with a different number of counters is reached. If, while sowing, the hole from which the sowing originated is reached, this hole is skipped and sowing continues. If a player has no counters in their holes, the opponent must play so as to place counters in their row. The player who captures 25 counters first wins. \n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (+ (count at:(mapEntry #1)) (count in:(sites #1)))) (game \"Uril\" (players 2) (equipment { (mancalaBoard 2 6 (track \"Track\" \"1,E,N,W\" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 FirstSite) (pair P2 LastSite)}) (piece \"Seed\" Shared)}) (rules (start (set Count 4 to:(sites Track))) (play (do (move Select (from (sites Mover) if:(< 0 (count at:(from)))) (then (sow if:(and (is In (to) (sites Next)) (or (= (count at:(to)) 2) (= (count at:(to)) 3))) apply:(fromTo (from (to)) (to (mapEntry (mover))) count:(count at:(to))) includeSelf:False backtracking:True))) ifAfterwards:(< 0 (count in:(sites Next))))) (end (forEach Player if:(>= (count at:(mapEntry Player)) 25) (result Player Win))))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines backgammon tracks following the same direction for each player in using the bar of the board.\n\n###\n\n", "completion": "(define \"BackgammonTracksSameDirectionWithBar\" { (track \"Track1\" {6 0..5 7..12 25..20 18..13 #1} P1 directed:True) (track \"Track2\" {19 0..5 7..12 25..20 18..13 #1} P2 directed:True)}) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines the original Lasca graph.\n\n###\n\n", "completion": "(define \"LascaGraph\" (graph vertices:{ {0 0} {2 0} {4 0} {6 0} {1 1} {3 1} {5 1} {0 2} {2 2} {4 2} {6 2} {1 3} {3 3} {5 3} {0 4} {2 4} {4 4} {6 4} {1 5} {3 5} {5 5} {0 6} {2 6} {4 6} {6 6}} edges:{ {0 4} {1 4} {1 5} {2 5} {2 6} {3 6} {4 7} {4 8} {5 8} {5 9} {6 9} {6 10} {7 11} {8 11} {8 12} {9 12} {9 13} {10 13} {11 14} {11 15} {12 15} {12 16} {13 16} {13 17} {14 18} {15 18} {15 19} {16 19} {16 20} {17 20} {18 21} {18 22} {19 22} {19 23} {20 23} {20 24}})) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nAllows to remove one piece of the enemy player which is not in a line 3.\n\n###\n\n", "completion": "(define \"RemoveAnyEnemyPieceNotInLine3\" (move Remove (forEach (sites Occupied by:Enemy container:\"Board\") if:(not (is Line 3 #1 through:(site)))))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a rectangular graph with Alquerque-style alternating diagonals with a triangle extension at the bottom.\n\n###\n\n", "completion": "(define \"AlquerqueGraphWithBottomTriangle\" (merge (shift 0 2 (square 5 diagonals:Alternating)) (wedge 3))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a sequence of hop move in all the orthogonal directions over an enemy to an empty site from the last ``to'' location of the previous move. \n\n###\n\n", "completion": "(define \"HopOrthogonalSequenceCaptureAgain\" (move Hop (from (last To)) Orthogonal (between #1 #2 if:(and (not (is In (between) (sites ToClear))) (\"IsEnemyAt\" (between))) (apply (remove (between) #3))) (to if:(is Empty (to))) (then (if (can Move (hop (from (last To)) Orthogonal (between #1 #2 if:(and (not (is In (between) (sites ToClear))) (\"IsEnemyAt\" (between)))) (to if:(is Empty (to))))) (moveAgain))))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines two opposite table tracks.\n\n###\n\n", "completion": "(define \"TableTracksOpposite2\" { (track \"Track1\" {11..0 12..23 #1} P1 directed:True) (track \"Track2\" {23..12 0..11 #1} P2 directed:True)}) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a hop move in all the directions specified (by default Adjacent) over an enemy to an empty site at any distance. The enemy piece is removed.\n\n###\n\n", "completion": "(define \"HopCaptureDistance\" (move Hop #1 #2 (between before:(count Rows) #3 after:(count Rows) if:(\"IsEnemyAt\" (between)) (apply (remove (between)))) (to if:(is Empty (to))) #4)) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a surround capture in all the directions specified (by default Adjacent). The enemy piece is removed.\n\n###\n\n", "completion": "(define \"SurroundCapture\" (surround (from (last To)) #1 (between #2 if:(\"IsEnemyAt\" (between)) (apply (remove (between)))) (to if:(\"IsFriendAt\" (to))) #3)) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayers take turns placing a stone of their own color on any empty cell of a hexagonal grid of hexagons (a hexhex board). \n The game is over when the board is full, and the player with the lower score wins. \n Your score is 1 point per odd-sized group and 2 points even-sized group.\n \n In this implementation, you get -1 per odd-sized group and -2 per even-sized group, so the winner will be the player with the higher score. The score is currently updated after each move, and groups of even size are marked with a red outline. A size 5 board is currently selected\n\n###\n\n", "completion": "(define \"UpdateScoreMover\" (and (set Score Mover 0) (forEach Group Orthogonal if:(is Mover (who at:(to))) (if (is Odd (count Sites in:(sites))) (addScore Mover -1) (addScore Mover -2))))) (define \"MarkEvenGroups\" (forEach Group Orthogonal if:(is Mover (who at:(to))) (if (is Odd (count Sites in:(sites))) (forEach Site (sites) (set State at:(site) 0)) (forEach Site (sites) (set State at:(site) 1))))) (define \"UpdateScoreMoverAndMarkEvenGroups\" (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) 0))) (and (addScore Mover -2) (forEach Site (sites) (set State at:(site) 1))))))) (game \"Elea\" (players 2) (equipment { (board (hex 5)) (piece \"Disc\" Each)}) (rules (meta (swap)) (play (move Add (to (sites Empty)) (then (\"UpdateScoreMoverAndMarkEvenGroups\")))) (end (if (is Full) (byScore))))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a custodial capture in all the directions specified (by default Adjacent) to capture an enemy piece. The enemy piece is removed.\n\n###\n\n", "completion": "(define \"CustodialCapture\" (custodial (from (last To)) #1 (between #2 if:(\"IsEnemyAt\" (between)) (apply (remove (between)))) (to if:(\"IsFriendAt\" (to))) #3)) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nChecks if the next player has no legal moves and the next player loses and checks if a specific player has no pieces to lose. This ludemeplex can be used only in an ending condition.\n\n###\n\n", "completion": "(define \"NoMovesLossAndNoPiecesPlayerLoss\" { (\"NoMoves\" Loss) (if (no Pieces #1) (result #1 Win))}) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\n3 players. -> 12 players.\n(define \"PostActionUpdate\" (if (> (score Mover) 1) (and (addScore Mover -1) (moveAgain)))) (define \"Pass\" (move Pass (then (addScore Mover 1)))) (define \"Upgrade\" (move Select (from) (to) (then (and (if (< (state at:(last To)) 100) (set State at:(last To) (+ 1 (state at:(last To))))) \"PostActionUpdate\")))) (define \"Trade\" (move Select (from) (to (intersection (sites Occupied by:Enemy container:\"Board\") (sites Distance from:(from) (range 1 (state at:(from)))))) (then (and (addScore (player (who at:(last To))) 1) \"PostActionUpdate\")))) (define \"Shoot\" (move Select (from) (to (intersection (sites Occupied by:Enemy container:\"Board\") (sites Distance from:(from) (range 1 (state at:(from)))))) (then (and (if (= (value Piece at:(last To)) 1) (remove (last To)) (set Value at:(last To) (- (value Piece at:(last To)) 1))) \"PostActionUpdate\")))) (define \"Move\" (\"StepToEmpty\" ~ (then \"PostActionUpdate\"))) (game \"Tank Tactics\" (players 3) (equipment { (board (rectangle 5 10)) (hand Each) (piece \"Tank\" Each (or {\"Move\" \"Shoot\" \"Trade\" \"Upgrade\"}) maxState:100)}) (rules (meta (passEnd NoEnd)) (start { (set Score Each 1) (place \"Tank1\" (handSite P1) state:2 value:3) (place \"Tank2\" (handSite P2) state:2 value:3) (place \"Tank3\" (handSite P3) state:2 value:3)}) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (phase \"Movement\" (play (or (forEach Piece) \"Pass\")))} (end (forEach NonMover if:(no Pieces Player) (result Player Loss)))))\n\n###\n\n", "completion": "(define \"PostActionUpdate\" (if (> (score Mover) 1) (and (addScore Mover -1) (moveAgain)))) (define \"Pass\" (move Pass (then (addScore Mover 1)))) (define \"Upgrade\" (move Select (from) (to) (then (and (if (< (state at:(last To)) 100) (set State at:(last To) (+ 1 (state at:(last To))))) \"PostActionUpdate\")))) (define \"Trade\" (move Select (from) (to (intersection (sites Occupied by:Enemy container:\"Board\") (sites Distance from:(from) (range 1 (state at:(from)))))) (then (and (addScore (player (who at:(last To))) 1) \"PostActionUpdate\")))) (define \"Shoot\" (move Select (from) (to (intersection (sites Occupied by:Enemy container:\"Board\") (sites Distance from:(from) (range 1 (state at:(from)))))) (then (and (if (= (value Piece at:(last To)) 1) (remove (last To)) (set Value at:(last To) (- (value Piece at:(last To)) 1))) \"PostActionUpdate\")))) (define \"Move\" (\"StepToEmpty\" ~ (then \"PostActionUpdate\"))) (game \"Tank Tactics\" (players 12) (equipment { (board (rectangle 5 10)) (hand Each) (piece \"Tank\" Each (or {\"Move\" \"Shoot\" \"Trade\" \"Upgrade\"}) maxState:100)}) (rules (meta (passEnd NoEnd)) (start { (set Score Each 1) (place \"Tank1\" (handSite P1) state:2 value:3) (place \"Tank2\" (handSite P2) state:2 value:3) (place \"Tank3\" (handSite P3) state:2 value:3) (place \"Tank4\" (handSite P4) state:2 value:3) (place \"Tank5\" (handSite P5) state:2 value:3) (place \"Tank6\" (handSite P6) state:2 value:3) (place \"Tank7\" (handSite P7) state:2 value:3) (place \"Tank8\" (handSite P8) state:2 value:3) (place \"Tank9\" (handSite P9) state:2 value:3) (place \"Tank10\" (handSite P10) state:2 value:3) (place \"Tank11\" (handSite P11) state:2 value:3) (place \"Tank12\" (handSite P12) state:2 value:3)}) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (phase \"Movement\" (play (or (forEach Piece) \"Pass\")))} (end (forEach NonMover if:(no Pieces Player) (result Player Loss))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6 board. Four counters per hole. Each player's rightmost hole is their \\ Each row has 6 holes. Each hole has initially 4 seeds.\n\n###\n\n", "completion": "(define \"NoOwnedHoleWithMoreThanOneSeed\" (all Sites (sites #1) if:(>= 1 (count at:(site))))) (define \"NoOwnedHoleWithMoreThanOneSeedExceptHogon\" (all Sites (difference (sites #1) (mapEntry \"Hogon\" #1)) if:(>= 1 (count at:(site))))) (define \"IsOlderPlayer\" (is Mover P1)) (game \"Koro\" (players 2) (equipment { (mancalaBoard 2 6 store:None (track \"Track\" \"0,E,N,W\" loop:True)) (piece \"Seed\" Shared) (hand Each) (map \"Hogon\" {(pair P1 5) (pair P2 6)}) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start (set Count 4 to:(sites Track))) (play (if (<= 14 (count at:(mapEntry \"Hogon\" Mover))) (move Select (from (mapEntry \"Hogon\" Mover)) (then (sow))) (if (\"NoOwnedHoleWithMoreThanOneSeedExceptHogon\" Mover) (if (\"IsOlderPlayer\") (move Pass) (do (if (\"NoOwnedHoleWithMoreThanOneSeedExceptHogon\" Next) (forEach Site (difference (sites Next) (mapEntry \"Hogon\" Next)) (if (is Occupied (site)) (fromTo (from (site)) (to (mapEntry \"Hogon\" Mover)))))) next:(move Select (from (mapEntry \"Hogon\" Mover) if:(< 1 (count at:(from)))) (then (sow))))) (move Select (from (difference (sites Mover) (mapEntry \"Hogon\" Mover)) if:(< 1 (count at:(from)))) (then (sow)))))) (end (forEach Player if:(\"NoOwnedHoleWithMoreThanOneSeed\" Player) (result Player Loss))))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a step move of a full stack to all the directions specified (adjacent by default) to an empty site.\n\n###\n\n", "completion": "(define \"StepStackToEmpty\" (move Step #1 (to if:(and (is In (from) (sites Occupied by:Mover)) (is Empty (to)))) stack:True #2)) END" }, { "prompt": "Construct a Ludii game based on the following description\n5x5 square. Nine squares are marked: the four central squares of each side, the central square of the board, and the squares which are diagonally between them. Two or four players; each player begins on one of the marked outer squares, beginning on opposite sides if two are playing. Players use one or two cowries as pieces. Four or five cowries are used as dice, with the value of the throw equalling the number of mouths which land face up. Players proceed in a clockwise direction around the board, until they reach the space before the one in which they began, moving to the marked square to the right of the direction of play, and proceeding around the inner square of spaces in an anti-clockwise direction, until arriving at the central space. When a player's piece lands on a space occupied by the opposing player, the opponent's piece is sent back to the starting point. The first player to bring all their pieces to the central square wins. The game involves 4 players. The game involves 2 pieces per player. The game involves 4 dice.\n\n###\n\n", "completion": "(define \"NumInitPiece\" 2) (define \"StartingPoint\" (mapEntry #1)) (define \"Goal\" 12) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" (\"ThrowValue\"))) (define \"ThrowValue\" (count Pips)) (game \"Gavalata\" (players 4) (equipment { (board (square 5) { (track \"Track1\" \"2,W,N,E,S,W1,N3,W2,S2,E1,N1\" P1 directed:True) (track \"Track2\" \"22,E,S,W,N,E1,S3,E2,N2,W1,S1\" P2 directed:True) (track \"Track3\" \"14,S,W,N,E,S1,W3,S2,E2,N1,W1\" P3 directed:True) (track \"Track4\" \"10,N,E,S,W,N1,E3,N2,W2,S1,E1\" P4 directed:True)}) (\"StickDice\" 4) (piece \"Paddle\" Each (if (\"IsNotOffBoard\" \"SiteToMoveOnTrack\") (move (from (from) level:(level)) (to \"SiteToMoveOnTrack\" (\"HittingCapture\" (\"StartingPoint\" (who at:(to)))))) (then (if (= \"Goal\" (last To)) (remove (last To)))))) (map {(pair 1 \"C1\") (pair 2 \"C5\") (pair 3 \"E3\") (pair 4 \"A3\")})}) (rules (start { (place Stack \"Paddle1\" (\"StartingPoint\" 1) count:\"NumInitPiece\") (place Stack \"Paddle2\" (\"StartingPoint\" 2) count:\"NumInitPiece\") (place Stack \"Paddle3\" (\"StartingPoint\" 3) count:\"NumInitPiece\") (place Stack \"Paddle4\" (\"StartingPoint\" 4) count:\"NumInitPiece\")}) (play (\"RollMove\" (if (!= 0 (\"ThrowValue\")) (forEach Piece) (move Pass)))) (end (\"EscapeWin\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\n4x10-12 board (even numbers only). One counter in each hole, except for the third hole from the left of the inner row, which contains two, and the rightmost hole of the inner row, which is empty. Play must begin from the hole containing two counters. Sowing occurs in an anti-clockwise direction. When the final counter lands in an occupied hole. These are picked up and sowing continues. When the final counter falls in an empty hole, the contents of the hole in the opponent's inner row opposite this hole are captured; if there are also counters in the opponent's outer row, these are also captured, along with the contents of any other two holes on the opponent's side of the board. Single counters can be moved only when there are no holes with multiple counters and they may only be moved to an empty hole. The player who captures all of the opponent's counters wins. Each player has 10 holes by row.\n\n###\n\n", "completion": "(define \"NextSite\" (\"NextSiteOnTrack\" 1 #1)) (define \"Columns\" 10) (game \"Spreta\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"0,E,N1,W\" loop:True P1) (track \"Track2\" \"20,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 { (set Count 1 to:(union { (sites P1 \"Outer\") (sites P2 \"Outer\") (difference (sites P1 \"Inner\") (sites { 12 19})) (difference (sites P2 \"Inner\") (sites { 27 20}))})) (set Count 2 to:(sites { 12 27}))}) phases:{ (phase \"Opening\" (play (move Select (from (sites Mover) if:(= 2 (count at:(from)))) (then (sow \"Track\" owner:(mover))))) (nextPhase Mover \"Playing\")) (phase \"Playing\" (play (if (or (= 1 (var \"ExtraCapture\")) (= 2 (var \"ExtraCapture\"))) (move Remove (difference (sites Next \"Home\") (sites Empty)) count:(count at:(to)) (then (if (= 1 (var \"ExtraCapture\")) (and (moveAgain) (set Var \"ExtraCapture\" 2)) (set Var \"ExtraCapture\" 0)))) (priority { (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover)) if:(< 1 (count at:(from)))) (then (sow \"Track\" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover \"Inner\")) (and { (if (> (count at:(\"OppositePit\" (to))) 0) (remove (\"OppositePit\" (to)) count:(count at:(\"OppositePit\" (to))))) (if (> (count at:(\"OppositeOuterPit\" (to))) 0) (remove (\"OppositeOuterPit\" (to)) count:(count at:(\"OppositeOuterPit\" (to))))) (set Var \"ExtraCapture\" 1) (moveAgain)})))))) (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover)) if:(and (= 1 (count at:(from))) (= 0 (count at:(\"NextSite\" from:(from)))))) (then (sow \"Track\" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover \"Inner\")) (and { (if (> (count at:(\"OppositePit\" (to))) 0) (remove (\"OppositePit\" (to)) count:(count at:(\"OppositePit\" (to))))) (if (> (count at:(\"OppositeOuterPit\" (to))) 0) (remove (\"OppositeOuterPit\" (to)) count:(count at:(\"OppositeOuterPit\" (to))))) (set Var \"ExtraCapture\" 1) (moveAgain)}))))))}))))} (end (if (all Sites (sites Next \"Home\") if:(= 0 (count at:(site)))) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nDefinitions\n A group is a stone along with all other stones one could reach from it through a series of steps between adjacent stones of its color.\n \n The size of a group is the number of stones in it.\n \n Play\n Black plays first, then turns alternate. On your turn, place a stone of your color on an empty cell. When the board is full, the winner is determined as follows:\n \n (1) Let n equal 0.\n (2) The player with fewer groups bigger than n stones wins.\n (3) If no winner is found, increase n by 1 and go back to (2).\n \n The pie rule is used in order to make the game fair. This means White will have the option, on their first turn only, to swap sides with their opponent instead of making a regular move. A size 7 board is currently selected The score is currently updated only when the board is full. (This makes the AI stronger.)\n\n###\n\n", "completion": "(define \"UpdateScore\" (do (set Var \"CutOff\" 0) next:(do (while (and (= 0 (- (count Groups if:(= (id P1) (who at:(to))) min:(var \"CutOff\")) (count Groups if:(= (id P2) (who at:(to))) min:(var \"CutOff\")))) (!= 0 (+ (count Groups if:(= (id P1) (who at:(to))) min:(var \"CutOff\")) (count Groups if:(= (id P2) (who at:(to))) min:(var \"CutOff\"))))) (set Var \"CutOff\" (+ 1 (var \"CutOff\")))) next:(and (set Score P1 (count Groups if:(= (id P1) (who at:(to))) min:(var \"CutOff\"))) (set Score P2 (count Groups if:(= (id P2) (who at:(to))) min:(var \"CutOff\"))))))) (game \"Yoin\" (players 2) (equipment { (board (hex 7)) (piece \"Disc\" Each)}) (rules (meta (swap)) (play (move Add (to (sites Empty)) (then (if (is Full) (\"UpdateScore\"))))) (end (if (is Full) {(if (< (score P1) (score P2)) (result P1 Win)) (if (> (score P1) (score P2)) (result P2 Win))})))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe board is a square with diagonals drawn, with the bottom side of the square marked with an X. Two pieces per player, which begin on opposite corners of the square, one player on the side with the X and the other to the opposite side. Players alternate turns moving one of their pieces along the lines of the board to an empty adjacent point. Players cannot move along the line marked with an X. When one player cannot move, the opponent wins. \n\n###\n\n", "completion": "(game \"Co Chan Cho\" (players 2) (equipment { (board (square 2 diagonals:Solid) use:Vertex) (piece \"Disc\" Each (move Step (to if:(and { (or { (and (!= (from) (coord \"A1\")) (!= (from) (coord \"C1\"))) (and (= (from) (coord \"C1\")) (!= (to) (coord \"A1\"))) (and (= (from) (coord \"A1\")) (!= (to) (coord \"C1\")))}) (is Empty (to))}))))}) (rules (start { (place \"Disc1\" (sites Top)) (place \"Disc2\" (sites Bottom))}) (play (forEach Piece)) (end (\"NoMoves\" Loss)))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines the most popular backgammon tracks.\n\n###\n\n", "completion": "(define \"BackgammonTracks\" { (track \"Track1\" {12..7 5..0 13..18 20..25 #1} P1 directed:True) (track \"Track2\" {25..20 18..13 0..5 7..12 #1} P2 directed:True)}) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe board has 1 row. -> The board has 2 rows.\nThe board has 2 columns. -> The board has 3 columns.\n(game \"Pentomino\" (players 2) (equipment { (board (rectangle 1 2)) (tile \"Z\" Shared {F R F F L F}) (tile \"Y\" Shared {F R F R R F R F F}) (tile \"X\" Shared {F L F L L F F L L F R F}) (tile \"W\" Shared {F L F R F L F}) (tile \"V\" Shared {F F R F F}) (tile \"U\" Shared {F L F F L F}) (tile \"T\" Shared {F F R F R R F F}) (tile \"P\" Shared {F F R F R F}) (tile \"N\" Shared {F R F L F F}) (tile \"L\" Shared {F R F F F}) (tile \"I\" Shared {F F F F}) (tile \"F\" Shared {F L F L L F L F R F}) (hand Shared size:12)}) (rules (start { (place \"F\" (handSite Shared 0)) (place \"I\" (handSite Shared 1)) (place \"L\" (handSite Shared 2)) (place \"N\" (handSite Shared 3)) (place \"P\" (handSite Shared 4)) (place \"T\" (handSite Shared 5)) (place \"U\" (handSite Shared 6)) (place \"V\" (handSite Shared 7)) (place \"W\" (handSite Shared 8)) (place \"X\" (handSite Shared 9)) (place \"Y\" (handSite Shared 10)) (place \"Z\" (handSite Shared 11))}) (play (move (from (sites Hand Shared)) (to (sites Empty)))) (end (\"NoMoves\" Loss))))\n\n###\n\n", "completion": "(game \"Pentomino\" (players 2) (equipment { (board (rectangle 2 3)) (tile \"Z\" Shared {F R F F L F}) (tile \"Y\" Shared {F R F R R F R F F}) (tile \"X\" Shared {F L F L L F F L L F R F}) (tile \"W\" Shared {F L F R F L F}) (tile \"V\" Shared {F F R F F}) (tile \"U\" Shared {F L F F L F}) (tile \"T\" Shared {F F R F R R F F}) (tile \"P\" Shared {F F R F R F}) (tile \"N\" Shared {F R F L F F}) (tile \"L\" Shared {F R F F F}) (tile \"I\" Shared {F F F F}) (tile \"F\" Shared {F L F L L F L F R F}) (hand Shared size:12)}) (rules (start { (place \"F\" (handSite Shared 0)) (place \"I\" (handSite Shared 1)) (place \"L\" (handSite Shared 2)) (place \"N\" (handSite Shared 3)) (place \"P\" (handSite Shared 4)) (place \"T\" (handSite Shared 5)) (place \"U\" (handSite Shared 6)) (place \"V\" (handSite Shared 7)) (place \"W\" (handSite Shared 8)) (place \"X\" (handSite Shared 9)) (place \"Y\" (handSite Shared 10)) (place \"Z\" (handSite Shared 11))}) (play (move (from (sites Hand Shared)) (to (sites Empty)))) (end (\"NoMoves\" Loss)))) END" }, { "prompt": "Construct a Ludii game based on the following description\n4x8 board. The fifth hole from the left in the inner row is rectangular, the rest are circular. 64 counters. Play begins with one counter in each hole in the inner row. Players take turns placing their remaining counters on the board in their inner rows. When they place a counter, they capture the hole facing it in the opponent's inner row, and sows the counters from either the leftmost or the rightmost hole of the player's inner row, sowing along the inner row. However, if the capture occurs from the rightmost, leftmost, or the next hole adjacent to each in the inner row, the captured pieces must be placed in the leftmost or rightmost hole, whichever is closer. The player may choose which hole to place captured counters in when captures are made from the central four holes in the inner row. The player must capture if possible, if not possible they place a counter into any of the holes in their inner row, pick up the contents of that hole, and sow in either direction. While sowing, if the final counter falls into an occupied hole and the opponent's hole opposite it has counters, the counters in the opponent's hole are captured. If the final counter falls into an occupied hole and the hole opposite it is empty, the counters are picked up and sowing continues in the same direction. If the final counter falls into an empty hole, the turn ends. If during this phase, the opponent's inner row is cleared of counters, the player wins. If all of the counters have been introduced and both players still have counters in their inner row, play proceeds to a second phase. Second Phase: Counters are picked up from any hole on the player's side and sown in either direction. The same capture, sowing, and victory rules apply as before. Captures, however, can only be made on subsequent sowings if there was a capture in the first round of a sowing. \n\n###\n\n", "completion": "(define \"SowingPhase2\" (move Select (from (sites Mover) if:(is Occupied (from))) (then (sow #1 owner:(mover) apply:(if (< 1 (count at:(to))) (and { (moveAgain) (set Var \"Replay\" (to)) (set Var \"Direction\" #2)})))))) (define \"Sowing\" (sow #1 owner:(mover) apply:(if (is In (to) (sites Mover \"Inner\")) (if (is Occupied (\"OppositePit\" (to))) (and { (moveAgain) (set Pending) (if (is In (to) (expand (sites Right))) (set Value Mover 2) (if (is In (to) (expand (sites Left))) (set Value Mover 1) (set Value Mover 0)))}) (if (< 1 (count at:(to))) (and { (moveAgain) (set Var \"Replay\" (to)) (set Var \"Direction\" #2)}))) (if (< 1 (count at:(to))) (and { (moveAgain) (set Var \"Replay\" (to)) (set Var \"Direction\" #2)}))))) (define \"NoPiecesInInner\" (all Sites (sites #1 \"Inner\") if:(= 0 (count at:(site))))) (define \"Columns\" 8) (game \"Bao Kiswahili (DR Congo)\" (players 2) (equipment { (mancalaBoard 4 8 store:None { (track \"TrackCCW1\" \"0,E,N1,W\" loop:True P1) (track \"TrackCCW2\" \"16,E,N1,W\" loop:True P2) (track \"TrackCW1\" \"7,W,N1,E\" loop:True P1) (track \"TrackCW2\" \"23,W,N1,E\" loop:True P2)}) (piece \"Seed\" Shared) (hand Each) (regions \"Home\" P1 (expand (sites Bottom))) (regions \"Home\" P2 (expand (sites Top))) (regions \"Inner\" P1 (sites Row 1)) (regions \"Inner\" P2 (sites Row 2)) (map \"LeftMostInner\" {(pair P1 8) (pair P2 23)}) (map \"RightMostInner\" {(pair P1 15) (pair P2 16)}) (map \"AdjacentLeftMostInner\" {(pair P1 9) (pair P2 22)}) (map \"AdjacentRightMostInner\" {(pair P1 14) (pair P2 17)})}) (rules (start { (set Count 24 at:(handSite P1)) (set Count 24 at:(handSite P2)) (set Count 1 to:(union (sites Row 1) (sites Row 2)))}) phases:{ (phase \"Placement\" (play (if (\"SameTurn\") (if (is Pending) (or (if (or (= 1 (value Player Mover)) (= 0 (value Player Mover))) (do (fromTo (from (\"OppositePit\" (last To afterConsequence:True))) (to (mapEntry \"LeftMostInner\" Mover)) count:(count at:(\"OppositePit\" (last To afterConsequence:True)))) next:(move Select (from (mapEntry \"LeftMostInner\" Mover)) (then (\"Sowing\" \"TrackCW\" 1))))) (if (or (= 2 (value Player Mover)) (= 0 (value Player Mover))) (do (fromTo (from (\"OppositePit\" (last To afterConsequence:True))) (to (mapEntry \"RightMostInner\" Mover)) count:(count at:(\"OppositePit\" (last To afterConsequence:True)))) next:(move Select (from (mapEntry \"RightMostInner\" Mover)) (then (\"Sowing\" \"TrackCCW\" 2)))))) (or (if (or (= (var \"Direction\") 1) (= (var \"Direction\") 3)) (move Select (from (var \"Replay\")) (then (\"Sowing\" \"TrackCW\" 1)))) (if (or (= (var \"Direction\") 2) (= (var \"Direction\") 3)) (move Select (from (var \"Replay\")) (then (\"Sowing\" \"TrackCCW\" 2)))))) (if (is Occupied (handSite Mover)) (priority { (move (from (handSite Mover)) (to (sites Mover \"Inner\") if:(is Occupied (\"OppositePit\" (to)))) count:1 (then (and { (moveAgain) (set Pending) (if (is In (last To) (expand (sites Right))) (set Value Mover 2) (if (is In (last To) (expand (sites Left))) (set Value Mover 1) (set Value Mover 0)))}))) (move (from (handSite Mover)) (to (sites Mover \"Inner\")) count:1 (then (and { (moveAgain) (set Var \"Replay\" (last To)) (set Var \"Direction\" 3)})))}) (or (\"SowingPhase2\" \"TrackCW\" 1) (\"SowingPhase2\" \"TrackCCW\" 2))))))} (end (forEach Player if:(\"NoPiecesInInner\" Player) (result Player Loss))))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nChecks if no enemy or only one in a stack game.\n\n###\n\n", "completion": "(define \"NoEnemyOrOnlyOne\" (or (not (\"IsEnemyAt\" #1)) (\"IsSingletonStack\" #1))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines the most popular backgammon tracks in using the bar of the board.\n\n###\n\n", "completion": "(define \"BackgammonTracksWithBar\" { (track \"Track1\" {6 12..7 5..0 13..18 20..25 #1} P1 directed:True) (track \"Track2\" {19 25..20 18..13 0..5 7..12 #1} P2 directed:True)}) END" }, { "prompt": "Construct a Ludii game based on the following description\nA square is drawn, with diagonals. Three pieces per player. Players alternate turns placing a piece on the board. The corners or the square, the central point, and the midpoint of each side of the square are playing sites. When a player forms a line with their three pieces, they win. \n\n###\n\n", "completion": "(game \"Nzengue (Small)\" (players 2) (equipment { (board (add (remove (remove (square 3 diagonals:Solid) vertices:{8 9 3 4}) edges:{{7 4} {4 1} {3 4} {4 5}}) edges:{{6 4} {4 8} {4 2} {4 0}}) use:Vertex) (piece \"Marker\" Each) (hand Each)}) (rules (start (place \"Marker\" \"Hand\" count:3)) (play (move (from (handSite Mover)) (to (sites Empty)))) (end (\"Line3Win\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\n5x5 intersecting lines, forming a grid. Diagonals in each of the quadrants. Twelve pieces per player, which begin on the points closest to the player, and the two points to the right of the center point. Players alternate turns moving a piece to an empty adjacent point along the lines of the board. A player may hop over an adjacent opponent's pieces to an empty space immediately on the opposite side of it along the lines of the board to capture it. Multiple captures are allowed. A player wins if they capture all of their opponent's pieces, or reduces the opponent to one piece and blocks them from being able to move. \n\n###\n\n", "completion": "(game \"Tsukkalavde\" (players 2) (equipment { (\"AlquerqueBoard\" 5 5) (piece \"Marker\" Each (or (\"HopSequenceCapture\") (\"StepToEmpty\")))}) (rules (start { (place \"Marker1\" (union (expand (sites Bottom)) (sites {\"D3\" \"E3\"}))) (place \"Marker2\" (union (expand (sites Top)) (sites {\"A3\" \"B3\"})))}) (play (if \"SameTurn\" (or (\"HopSequenceCaptureAgain\") (move Pass)) (forEach Piece))) (end (if (and (no Moves Next) (>= 1 (count Pieces Next))) (result Mover Win))))) END" }, { "prompt": "What does the following global Ludii definition do?\n(define \"BottomTopSetup\" (start { (place #2 (expand (sites Bottom) steps:(- #1 1))) (place #3 (expand (sites Top) steps:(- #1 1)))}))\n\n###\n\n", "completion": "Defines starting rules placing one piece on each cell of the bottom and the top rows of the board (e.g. Starting rules of Breakthrough). END" }, { "prompt": "Construct a Ludii game based on the following description\n8x8 board, with diagonals in every square. Pieces have special moves, as follows: Raja (king), moves one square in any direction, but on the first move, it may jump two squares or move as a knight, with the exception that it cannot jump two squares diagonally; Mantri (minister), moves orthogonally or diagonally any number of spaces; Gajah (x2); move diagonally any distance; Kuda (horse) x2, moves orthogonally one space then diagonal one space from there, jumping over any intervening pieces; Ter/Chemor (chariot) x2, moves orthogonally any distance; B\u00eddaq (pawn) x8: moves one square forward or one square forward diagonally to capture. May move two spaces forward orthogonally if it is that piece's first move. Upon reaching the opposite edge of the board, the B\u00eddaq moves in the opposite direction, reversing again if it reaches the opposite edge. The Mantri is placed to the right of the Raja at the beginning of play. Castling occurs in two moves, the rook moving to the king and then the king jumping over the rook. Pieces are captured by moving onto a space occupied by an opponent's piece. If the Raja can be captured on its next turn, it is in check. The Raja cannot be in check at the end of its turn. When this is unavoidable, it is checkmate and the opponent wins.\n \n\n###\n\n", "completion": "(define \"RememberKingMoved\" (set State at:#1 1)) (define \"KingMovedBefore\" (= 1 (state at:#1))) (define \"RookMovedBefore\" (= 1 (state at:#1))) (define \"RememberRookMoved\" (set State at:#1 1)) (define \"KingSites\" (sites {\"E8\" \"D1\"})) (define \"SitesNextToKing\" (sites {\"C1\" \"E1\" \"D8\" \"F8\"})) (game \"Tepong\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (piece \"King_noCross\" Each (or (\"StepToNotFriend\" ~ (then (if (not (\"KingMovedBefore\" (last To))) (\"RememberKingMoved\" (last To))))) (if (not (\"KingMovedBefore\" (from))) (or { (move Hop Orthogonal (between (exact 2) if:True) (to if:(not (\"IsFriendAt\" (to))) (apply (if (\"IsEnemyAt\" (to)) (remove (to)))))) (\"LeapCapture\" \"KnightWalk\") (if (is In (from) (\"KingSites\")) (or (if (and { (is Empty (ahead (from) steps:2 W)) (\"IsPieceAt\" \"Rook\" Mover (ahead (from) W)) (not (\"RookMovedBefore\" (ahead (from) W)))}) (move (from) (to (ahead (from) steps:2 W)))) (if (and { (is Empty (ahead (from) steps:2 E)) (\"IsPieceAt\" \"Rook\" Mover (ahead (from) E)) (not (\"RookMovedBefore\" (ahead (from) E)))}) (move (from) (to (ahead (from) steps:2 E))))))} (then (\"RememberKingMoved\" (last To))))))) (\"ChessQueen\" \"Queen\") (\"ChessBishop\" \"Bishop_noCross\") (\"ChessKnight\" \"Knight\") (\"ChessRook\" \"Rook\" ~ (then (if (and (not (\"RookMovedBefore\" (last To))) (not (is In (last To) (\"SitesNextToKing\")))) (\"RememberRookMoved\" (last To))))) (piece \"Pawn\" Each (or { (if (and (= 0 (state at:(last To))) (is In (from) (sites Start (piece (what at:(from)))))) (\"DoubleStepForwardToEmpty\")) (\"StepToEmpty\" (if (= 1 (state at:(from))) Backward Forward)) (\"StepToEnemy\" (if (= 1 (state at:(from))) (directions {BR BL}) (directions {FR FL})))} (then (if (is In (last To) (union (sites Bottom) (sites Top))) (if (= 0 (state at:(last To))) (set State at:(last To) 1) (set State at:(last To) 2))))))}) (rules (start { (place \"Pawn1\" (sites Row 1)) (place \"Pawn2\" (sites Row 6)) (place \"Rook1\" {\"A1\" \"H1\"}) (place \"Knight1\" {\"B1\" \"G1\"}) (place \"Bishop_noCross1\" {\"C1\" \"F1\"}) (place \"King_noCross1\" coord:\"D1\") (place \"Queen1\" coord:\"E1\") (place \"Rook2\" {\"A8\" \"H8\"}) (place \"Knight2\" {\"B8\" \"G8\"}) (place \"Bishop_noCross2\" {\"C8\" \"F8\"}) (place \"King_noCross2\" coord:\"E8\") (place \"Queen2\" coord:\"D8\")}) (play (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King_noCross\" Mover)))) (end (\"Checkmate\" \"King_noCross\")))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines the original Lasca board.\n\n###\n\n", "completion": "(define \"LascaBoard\" (board (\"LascaGraph\") use:Vertex)) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6 board. Four counters in each hole. Play begins with a stylized move. One player takes one counter from their rightmost hole, and holds it in their hand. They then take one counter from the next hole, moving in an anti-clockwise direction, and place it in the next hole. They then take a counter from the next hole after that, and placing it in the next hole, continuing until there is an alternating pattern of a hole with five counters followed by a hole with three counters. Upon reaching the original hole, one counter is dropping in it, and then one counter in the following hole, thus capturing the counters in this hole. Players then alternate turns, sowing in an anti-clockwise direction. When the final counter of a sowing lands in an occupied hole, these counters are picked up and the sowing continues. During sowing, the contents of any hole made to contain four counters are captured by the player in whose row the hole is located, except when this is the final counter of a sowing, in which case the player who is sowing captures these counters. When the sowing ends in an empty hole, the turn ends. Play continues until one player cannot move, and the other player captures the remaining counters. A second round is played, each player placing four counters into each hole starting from the rightmost hole in their row. The player with more counters gains a hole from their opponent for every four extra balls they've captured. If an opponent has three extra after counting in such a way, they also gain a hole, but not if there are one or two extra. Play continues in several rounds like this until one player captures all the holes.\n \n\n###\n\n", "completion": "(define \"APlayerCanNotMove\" (and (not (is Next Mover)) (or (all Sites (sites (values Remembered \"OwnedP1\")) if:(is Empty (site))) (all Sites (sites (values Remembered \"OwnedP2\")) if:(is Empty (site)))))) (define \"RemmemberOwnedHoles\" (if (is Mover P1) (remember Value \"OwnedP1\" #1) (remember Value \"OwnedP2\" #1))) (define \"RightMostEmpty\" (trackSite FirstSite \"TrackCW\" from:(mapEntry \"RightMost\" Mover) if:(is Empty (to)))) (define \"OwnedHoles\" (if (is Mover P1) (sites (values Remembered \"OwnedP1\")) (sites (values Remembered \"OwnedP2\")))) (define \"NextHole\" (\"NextSiteOnTrack\" #2 from:#1 \"Track\")) (game \"Lamosh\" (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) (hand Each) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map \"RightMost\" {(pair P1 5) (pair P2 6)})}) (rules (start { (set Count 4 to:(sites Track)) (set RememberValue \"OwnedP1\" (sites Bottom)) (set RememberValue \"OwnedP2\" (sites Top))}) phases:{ (phase \"Opening1\" (play (move (from (if (\"SameTurn\") (var \"Replay\") 11)) (to (\"NextHole\" (from) 1)) (then (if (!= (\"NextHole\" (last To) 1) 11) (and (moveAgain) (set Var \"Replay\" (\"NextHole\" (last To) 1))) ( (fromTo (from 11) (to (handSite Mover)) count:(count at:11))))))) (nextPhase (not (is Next Mover)) \"Sowing\")) (phase \"Sowing\" (play (or { (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (\"OwnedHoles\")) if:(is Occupied (from))) (then (do (set Var \"NumSowed\" (count at:(last To))) next:(sow \"TrackCCW\" apply:(if (= 4 (count at:(to))) (fromTo (from (to)) (to (handSite Mover)) count:4) (if (< 1 (count at:(to))) (and (moveAgain) (set Var \"Replay\" (to)))))) (then (and (forEach Site (sites Track from:(last From) to:(trackSite Move from:(last From) \"Track\" steps:(- (var \"NumSowed\") 1))) (if (= 4 (count at:(site))) (fromTo (from (site)) (to (if (is In (to) (sites (values Remembered \"OwnedP1\"))) (handSite P1) (handSite P2))) count:4))) (set Var \"NumSowed\" 0))))))} (then (if (\"APlayerCanNotMove\") (and { (if (no Moves P1) (forEach Site (sites Board) (if (is Occupied (site)) (fromTo (from (site)) (to (handSite P1)) count:(count at:(site))))) (forEach Site (sites Board) (if (is Occupied (site)) (fromTo (from (site)) (to (handSite P2)) count:(count at:(site)))))) (forget Value \"OwnedP1\" All) (forget Value \"OwnedP2\" All)}))))) (end (if (\"NoPieceOnBoard\") { (if (> 3 (count Cell at:(handSite P1))) (result P2 Win)) (if (> 3 (count Cell at:(handSite P2))) (result P1 Win))})) (nextPhase (\"NoPieceOnBoard\") \"BetweenRounds\")) (phase \"BetweenRounds\" (play (if (<= 3 (count Cell at:(handSite Mover))) (move (from (handSite Mover)) (to (\"RightMostEmpty\")) count:(if (>= (count Cell at:(handSite Mover)) 4) 4 3) (then (\"RemmemberOwnedHoles\" (last To)))))) (nextPhase (all Passed) \"Sowing\"))})) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines two players, P1 moving in direction to the north and P2 moving in direction to the south.\n\n###\n\n", "completion": "(define \"TwoPlayersNorthSouth\" (players {(player N) (player S)})) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nChecks if a group of pieces has some liberties around it. The specified directions (by default Adjacent) are the directions between the elements of the group.\n\n###\n\n", "completion": "(define \"HasFreedom\" (> (count Liberties #1) 0)) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nEnds a mancala game when a condition is verified in computing the score of each player thanks to a ludemeplex called \"PiecesOwnedBy\" taking in input the role of P1 or P2. This ludemeplex can be used only in an ending condition.\n\n###\n\n", "completion": "(define \"MancalaByScoreWhen\" (if #1 (byScore { (score P1 (\"PiecesOwnedBy\" P1)) (score P2 (\"PiecesOwnedBy\" P2))}))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nChecks if this is new turn, i.e. the current move is not the previous mover.\n\n###\n\n", "completion": "(define \"NewTurn\" (not (is Prev Mover))) END" }, { "prompt": "Construct a Ludii game based on the following description\n5x5 intersecting lines with diagonals drawn in the quadrants. One player plays as one hunter, placed in the central spot. The other player plays as twelve birds, which are placed in the two rows closest to the player and the two spots on the right hand side in the central row. The hunter may move in any direction along the lines of the board. The hunter may capture birds by hopping over them to an empty spot on the opposite side along the lines of the board. The birds may move forward orthogonally or diagonally. The birds win by blocking the hunter from being able to move; the hunter wins by capturing all of the birds or when it is no longer possible for the birds to capture the hunter. \n\n###\n\n", "completion": "(game \"El Cazador\" (players {(player S) (player N)}) (equipment { (\"AlquerqueBoard\" 5 5) (piece \"Human\" P1 (or (\"HopCapture\") (\"StepToEmpty\"))) (piece \"Hen\" P2 (\"StepToEmpty\" (directions {Rightward Leftward Forwards})))}) (rules (start { (place \"Human1\" (centrePoint)) (place \"Hen2\" (union {(expand (sites Bottom)) (sites {\"D3\" \"E3\"})}))}) (play (forEach Piece)) (end (\"NoMovesP1NoPiecesP2\")))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"Y\" (players 2) (equipment { (board (hex Triangle 11)) (piece \"Disc\")}) (rules (play (move Add (to (sites Empty)))) (end (if (is Connected 3 Sides) (result Mover Win)))))\n\n###\n\n", "completion": "Players take turns placing a piece of their colour on an empty cell. 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. END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6 board. Play begins with four counters in each hole. A player picks up the contents of any of their holes and sowing them in an anti-clockwise direction, picking up the contents of the last hole in which his counters fall, and continuing sowing. This continues until the last counter falls in an empty hole. Then it is the other player's turn. A hole is captured when the last ball is dropped into an opponent's hole containing three counters, making it four. A player cannot then take from one of these holes that they have captured. Therefore, the player cannot begin a turn from their own captured hole nor can they continue sowing from it. If the last counter of a sowing falls into an opponent's captured hole, nothing happens on the first instance, but every time after that, one of those counters are removed from the board and placed in the store, and the sowing ends. Ownership of a hole continues even if it becomes empty. When a player cannot move (i.e., there are no counters in their holes except any that are in captured holes), the opponent continues to move until the player is able to move. Play continues until all counters are either placed in the store or in captured holes and thus cannot be moved. Players then count their pieces by placing four in each hole, and the player who has more than their original number takes ownership of one of the opponent's holes for every four counters more than the original number that have been taken. If no player took four more than the original, the player with three extra gets the hole, if each player has two extra the weaker player is given the two extra counters. Play then begins again as before. The game ends when one player owns all of the counters, and thus all of the holes. \n\n###\n\n", "completion": "(define \"RemmemberOwnedHoles\" (if (is Mover P1) (remember Value \"OwnedP1\" #1) (remember Value \"OwnedP2\" #1))) (define \"NoFreePiece\" (no Pieces in:(forEach (sites Board) if:(and (not (is In (site) (values Remembered \"CapturedP1\"))) (not (is In (site) (values Remembered \"CapturedP2\"))))))) (define \"CapturedHole\" (if (= #1 P1) (is In #2 (values Remembered \"CapturedP1\")) (is In #2 (values Remembered \"CapturedP2\")))) (define \"CapturedByOpponent\" (if (= #1 P1) (is In #2 (values Remembered \"CapturedP2\")) (is In #2 (values Remembered \"CapturedP1\")))) (define \"PossibleSowFrom\" (if (is Mover P1) (not (is In (from) (values Remembered \"CapturedP2\"))) (not (is In (from) (values Remembered \"CapturedP1\"))))) (define \"OwnedHoles\" (if (is Mover P1) (sites (values Remembered \"OwnedP1\")) (sites (values Remembered \"OwnedP2\")))) (define \"NextHole\" (\"NextSiteOnTrack\" #2 from:#1 \"Track\")) (game \"Awagagae\" (players 2) (equipment { (mancalaBoard 2 6 store:None (track \"Track\" \"0,E,N,W\" loop:True)) (piece \"Seed\" Shared) (hand Each) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start { (set RememberValue \"OwnedP1\" (sites Bottom)) (set RememberValue \"OwnedP2\" (sites Top)) (set Count 4 to:(sites Track))}) phases: { (phase \"Sowing\" (play (or { (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (\"OwnedHoles\")) if:(and (\"PossibleSowFrom\") (< 0 (count at:(from))))) (then (sow \"Track\" apply:(if (not (\"CapturedHole\" (mover) (to))) (if (and (is In (to) (sites Next)) (= (count at:(to)) 4)) (if (is Mover P1) (remember Value \"CapturedP1\" (to)) (remember Value \"CapturedP2\" (to))) (if (\"CapturedByOpponent\" (mover) (to)) (fromTo (from (to)) (to (handSite Next)) count:1) (if (> (count at:(to)) 1) (moveAgain))))))))} (then (if (\"NoFreePiece\") (and { (forEach Site (sites Board) (if (and (is In (site) (values Remembered \"CapturedP1\")) (is Occupied (site))) (fromTo (from (site)) (to (handSite P1)) count:(count at:(site))))) (forEach Site (sites Board) (if (and (is In (site) (values Remembered \"CapturedP2\")) (is Occupied (site))) (fromTo (from (site)) (to (handSite P2)) count:(count at:(site))))) (forget Value \"OwnedP1\" All) (forget Value \"OwnedP2\" All) (forget Value \"CapturedP1\" All) (forget Value \"CapturedP2\" All)}))))) (end (if (\"NoPieceOnBoard\") { (if (= 0 (count Cell at:(handSite P1))) (result P2 Win)) (if (= 0 (count Cell at:(handSite P2))) (result P1 Win))})) (nextPhase (\"NoPieceOnBoard\") \"BetweenRounds\")) (phase \"BetweenRounds\" (play (if (<= 4 (count Cell at:(handSite Mover))) (move (from (handSite Mover)) (to (if (all Sites (sites Mover) if:(is Occupied (site))) (sites Next) (sites Mover)) if:(is Empty (to))) count:4 (then (and (\"RemmemberOwnedHoles\" (last To)) (if (and (> 4 (count Cell at:(handSite P1))) (> 4 (count Cell at:(handSite P2)))) (and { (fromTo (from Cell (handSite P1)) (to (sites Empty)) count:(count Cell at:(handSite P1))) (fromTo (from Cell (handSite P2)) (to (sites Empty)) count:(count Cell at:(handSite P2))) (if (= 3 (count Cell at:(handSite P1))) (remember Value \"OwnedP1\" (regionSite (sites Empty) index:0)) (remember Value \"OwnedP2\" (regionSite (sites Empty) index:0)))}))))))) (nextPhase (and (is Empty (handSite P1)) (is Empty (handSite P2))) \"Sowing\"))})) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a piece moving like a king in Chess (castling is not described in this ludemeplex).\n\n###\n\n", "completion": "(define \"ChessKing\" (piece #1 Each (move Step (to if:(not (\"IsFriendAt\" (to))) (apply (if (\"IsEnemyAt\" (to)) (remove (to) #2)))) #3))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a graphics turtle walk to get the locations where can move a Chess giraffe.\n\n###\n\n", "completion": "(define \"GiraffeWalk\" { {F F F R F F} {F F F L F F}}) END" }, { "prompt": "What does the following global Ludii definition do?\n(define \"StepBackwardToEmpty\" (move Step Backward (to if:(is Empty (to)))))\n\n###\n\n", "completion": "Defines a step move to the backward direction according to the facing direction of the piece in the 'from' location to an empty site. END" }, { "prompt": "Construct a Ludii game based on the following description\n5x5 intersecting lines, with diagonals drawn in each quadrant. Eleven pieces per player, which begin on the two rows closest to the player, with the eleventh on the outer spot of the middle of to the left of the player. Players alternate turns moving a piece to an empty adjacent spot along the lines. A piece may capture an opponent's piece next to it by hopping over it to an empty spot immediately on the opposite side of the opponent's piece along the lines of the board. The player who captures all of the opponent's pieces wins. \n\n###\n\n", "completion": "(game \"Sumi Naga Game (War)\" (players 2) (equipment { (\"AlquerqueBoard\" 5 5) (piece \"Marker\" Each (or (\"StepToEmpty\") (\"HopSequenceCapture\")))}) (rules (start { (place \"Marker1\" (union (expand (sites Bottom)) (sites {\"A3\"}))) (place \"Marker2\" (union (expand (sites Top)) (sites {\"E3\"})))}) (play (forEach Piece)) (end (\"CaptureAll\" Next)))) END" }, { "prompt": "What does the following global Ludii definition do?\n(define \"OppositePit\" (if (is Mover P1) (+ #1 \"Columns\") (- #1 \"Columns\")))\n\n###\n\n", "completion": "Returns the index of the opposite pit on a mancala board. This ludemeplex is working only if the description is defining \"Columns\" as the number of holes of the board. END" }, { "prompt": "Construct a Ludii game based on the following description\n8x8 Draughts board. Twelve pieces per player, arranged on the three rows closest to the players. Players alternate turns moving a piece forward diagonally to an adjacent empty space. Pieces capture an opponent's piece by hopping over it to an empty space on the opposite side of it, in a forward direction only. Captures are mandatory, and the maximum number of captures is required. Kings are made when a piece reaches the opposite edge of the board from where it started. Kings may move one space diagonally in either direction, and capture rules are the same as for pieces, except when different capturing routes are available with the same number of captures, the one which takes the most kings must be taken. In addition, if a sequence of captures can be made by a king or a regular piece, it must be made with the king. Kings cannot be captured by regular pieces. The first player to force the opponent to capture all of their pieces wins. \n\n###\n\n", "completion": "(define \"IsUnpromoted\" (\"IsPieceAt\" \"Counter\" Mover (last To))) (game \"Coc-Inbert\" (players 2) (\"DraughtsEquipment\" (square 8)) (rules (\"BlackCellsSetup\" 3) (play (if \"SameTurn\" (if \"IsUnpromoted\" (max Moves (\"HopOnlyCounters\" (from (last To)) (directions {FR FL}) (then (\"PromoteIfReach\" (sites Next) \"DoubleCounter\" (\"ReplayIfCanMove\" (\"HopOnlyCounters\" (from (last To)) (directions {FR FL}))))))) (max Moves (\"HopDiagonalSequenceCaptureAgain\"))) (priority { (max Moves (priority { (forEach Piece \"DoubleCounter\" (\"HopDiagonalSequenceCapture\")) (forEach Piece \"Counter\" (\"HopOnlyCounters\" (from) (directions {FR FL}) (then (\"PromoteIfReach\" (sites Next) \"DoubleCounter\" (\"ReplayIfCanMove\" (\"HopOnlyCounters\" (from (last To)) (directions {FR FL})))))))})) (or (forEach Piece \"Counter\" (\"StepToEmpty\" (directions {FR FL})) (then (\"PromoteIfReach\" (sites Next) \"DoubleCounter\"))) (forEach Piece \"DoubleCounter\" \"StepDiagonalToEmpty\"))}))) (end (forEach Player if:(no Pieces Player) (result Player Win))))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nIf the mover has 3 pieces aligned, the mover is winning. This ludemeplex can be used only in an ending condition.\n\n###\n\n", "completion": "(define \"Line3Win\" (if (is Line 3 #1) (result Mover Win))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe dogs moves forward. -> The dogs moves in any direction.\n(game \"Komikan\" (players 2) (equipment { (board (merge (scale 2 (square 5 diagonals:Alternating)) (graph vertices:{ {4 8} {3 9} {4 9} {5 9} {2 10} {3 10} {4 10} {5 10} {6 10} {1 11} {3 11} {4 11} {5 11} {7 11}} edges:{ {0 1} {0 2} {0 3} {1 4} {1 5} {1 2} {2 6} {2 3} {3 7} {3 8} {4 9} {4 5} {5 10} {5 6} {6 11} {6 7} {7 12} {7 8} {8 13} {9 10} {10 11} {11 12} {12 13}})) use:Vertex) (piece \"MountainLion\" P1 (if \"SameTurn\" (or (move Pass) (\"HopSequenceCaptureAgain\")) (or (\"HopSequenceCapture\") \"StepToEmpty\"))) (piece \"Dog\" P2 N \"StepForwardToEmpty\")}) (rules (start { (place \"Dog2\" (union (expand (sites Bottom)) (sites {\"A3\" \"I3\"}))) (place \"MountainLion1\" (coord \"E7\"))}) (play (forEach Piece)) (end { (if (no Pieces P2) (result P1 Win)) (if (no Moves P1) (result P2 Win)) (if (no Moves P2) (result Mover Draw))})))\n\n###\n\n", "completion": "(game \"Komikan\" (players 2) (equipment { (board (merge (scale 2 (square 5 diagonals:Alternating)) (graph vertices:{ {4 8} {3 9} {4 9} {5 9} {2 10} {3 10} {4 10} {5 10} {6 10} {1 11} {3 11} {4 11} {5 11} {7 11}} edges:{ {0 1} {0 2} {0 3} {1 4} {1 5} {1 2} {2 6} {2 3} {3 7} {3 8} {4 9} {4 5} {5 10} {5 6} {6 11} {6 7} {7 12} {7 8} {8 13} {9 10} {10 11} {11 12} {12 13}})) use:Vertex) (piece \"MountainLion\" P1 (if \"SameTurn\" (or (move Pass) (\"HopSequenceCaptureAgain\")) (or (\"HopSequenceCapture\") \"StepToEmpty\"))) (piece \"Dog\" P2 N \"StepToEmpty\")}) (rules (start { (place \"Dog2\" (union (expand (sites Bottom)) (sites {\"A3\" \"I3\"}))) (place \"MountainLion1\" (coord \"E7\"))}) (play (forEach Piece)) (end { (if (no Pieces P2) (result P1 Win)) (if (no Moves P1) (result P2 Win)) (if (no Moves P2) (result Mover Draw))}))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a step move to all the forwards directions according to the facing direction \n\n###\n\n", "completion": "(define \"StepForwardsToEmpty\" (move Step Forwards (to if:(is Empty (to))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"Line3D\" (!= 0 (count Sites in:(forEach (expand (sites Bottom) steps:(- 3 1)) if:(all Sites (sites {(site) (ahead (site) steps:4 N) (ahead (site) steps:8 N)}) if:(= (mover) (who at:(site)))))))) (game \"3D Tic-Tac-Toe\" (players 2) (equipment { (board (rectangle (+ (^ 3 2) (- 3 1)) 3)) (piece \"Disc\" P1) (piece \"Cross\" P2) (piece \"Dot\" Neutral)}) (rules (start (place \"Dot0\" (union {(sites Row 3) (sites Row 7)}))) (play (move Add (to (sites Empty)))) (end { (if (is Line 3) (result Mover Win)) (if \"Line3D\" (result Mover Win))})))\n\n###\n\n", "completion": "Play occurs on a 4x4x4 grid. One player places an X, the other places an O and players take turns placing their marks in the grid, attempting to get four in a row of their color. For the lines between levels, the diagonals are not taken in account. The game is played on a 3x3x3 board. END" }, { "prompt": "Construct a Ludii game based on the following description\nStarting with white, each player places a marble on an empty space or platform (2x2 arrangement of marbles). A player wins by making a line of L pieces of their colour orthogonally or diagonally (where L is the layer size) but loses by making a line of L-1 of their colour beforehand (without also making a line of L). Two players. 4x4 square pyramidal board.\n\n###\n\n", "completion": "(game \"Spava\" (players 2) (equipment { (board (square 4 pyramidal:True) use:Vertex) (piece \"Ball\" Each)}) (rules (play (move Add (to (sites Empty) if:(is Flat)))) (end { (if (is Line (- (count Rows) (layer of:(last To))) SameLayer) (result Mover Win)) (if (is Line (- (- (count Rows) (layer of:(last To))) 1) SameLayer) (result Mover Loss))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nSeven players. Heptagonal board, with seven semi-circular socket as spaces on each side. Seven pieces per player, which begin on the leftmost spot on their side. Players are as follows: Saturn = black; Jupiter = green; Mars = red; the sun = yellow; Venus = purple; Mercury = multi-colored; the moon is white. Pieces move in an anti-clockwise direction around the board. Three seven-sided die. 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. When a piece lands on a space with a single piece belonging to an opponent, the opponent's piece is removed from the board. Play continues until one player remains, who becomes the winner. \n\n###\n\n", "completion": "(define \"NotEnemyOrOnlyOne\" (or (and (\"IsEnemyAt\" (to)) (= (topLevel at:(to)) 0)) (not (\"IsEnemyAt\" (to))))) (define \"DieNotUsed\" (!= (pips) 0)) (game \"Tablas Astronomias\" (players 7) (equipment { (board (concentric {49}) { (track \"Track\" {48 46 44 42 40 38 36 34 32 30 28 26 24 22 20 18 16 14 12 10 8 6 4 2 0 1 3 5 7 9 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47} loop:True)} use:Vertex) (dice d:7 num:3) (piece \"Disc\" Each)}) (rules (start { (place Stack \"Disc1\" 14 count:7) (place Stack \"Disc2\" 0 count:7) (place Stack \"Disc3\" 13 count:7) (place Stack \"Disc4\" 27 count:7) (place Stack \"Disc5\" 41 count:7) (place Stack \"Disc6\" 42 count:7) (place Stack \"Disc7\" 28 count:7)}) (play (\"RollEachNewTurnMove\" (forEach Die if:(\"DieNotUsed\") (forEach Site (sites Occupied by:Mover) (move (from (site)) (to (\"NextSiteOnTrack\" (pips) from:(site)) if:(\"NotEnemyOrOnlyOne\") (apply if:(\"IsEnemyAt\" (to)) (remove (to)))))) (then (\"ReplayNotAllDiceUsed\"))))) (end (forEach NonMover if:(no Pieces Player) (result Player Loss))))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a piece moving like a bishop in Chess.\n\n###\n\n", "completion": "(define \"ChessBishop\" (piece #1 Each (move Slide Diagonal (to if:(\"IsEnemyAt\" (to)) (apply (remove (to) #2))) #3))) END" }, { "prompt": "What does the following global Ludii definition do?\n(define \"HopCaptureDistanceNotAlreadyHopped\" (move Hop #1 #2 (between before:(count Rows) after:(count Rows) if:(and (not (is In (between) (sites ToClear))) (\"IsEnemyAt\" (between))) (apply (remove (between)))) (to if:(is Empty (to))) #3))\n\n###\n\n", "completion": "Defines a hop move in the specified directions over an enemy to an empty site at any distance. The enemy pieces are removed and you can not hop a piece you already hopped during your turn. END" }, { "prompt": "What does the following global Ludii definition do?\n(define \"EncloseCapture\" (enclose (from (last To)) #1 (between if:(\"IsEnemyAt\" (between)) (apply (remove (between)))) #2))\n\n###\n\n", "completion": "Defines a enclose capture by all the directions specified (by default Adjacent). The enemy pieces are removed. END" }, { "prompt": "What does the following global Ludii definition do?\n(define \"DominoWalk\" { {F R F R F L F L F R F R F}})\n\n###\n\n", "completion": "Defines a graphics turtle walk to build a domino as a large piece. END" }, { "prompt": "What does the following global Ludii definition do?\n(define \"HopStackEnemyCaptureTopDistance\" (move Hop #1 #2 (between before:(count Rows) after:(count Rows) if:(\"IsEnemyAt\" (between)) (apply (fromTo (from (between)) (to)))) (to if:(and (is In (from) (sites Occupied by:Mover)) (is Empty (to)))) stack:True #3))\n\n###\n\n", "completion": "Defines a hop move in all the directions specified (by default Adjacent) over a stack with on top an enemy to an empty site at any distance. The enemy piece is moved to the top of the jumping stack. END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines the capture of an enemy piece returning to a site. This ludemeplex can be used only as an effect.\n\n###\n\n", "completion": "(define \"HittingCapture\" (apply if:(\"IsEnemyAt\" (to)) (fromTo (from (to)) (to #1)))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a piece moving like a rook in Chess.\n\n###\n\n", "completion": "(define \"ChessRook\" (piece #1 Each (move Slide Orthogonal (to if:(\"IsEnemyAt\" (to)) (apply (remove (to) #2))) #3))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nChecks if the next player has no legal moves and the next player loses and checks if a specific player has less or equal than a number of pieces to lose. This ludemeplex can be used only in an ending condition.\n\n###\n\n", "completion": "(define \"NoMovesLossAndLessNumPiecesPlayerLoss\" { (\"NoMoves\" Loss) (if (<= (count Pieces #1) #2) (result #1 Loss))}) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nMove again if all the dice are not used when using the ludeme (forEach Die ...).\n\n###\n\n", "completion": "(define \"ReplayNotAllDiceUsed\" (if (not (all DiceUsed)) (moveAgain))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"San-Noku-Narabe\" (players 2) (equipment { (board (square 3) use:Vertex) (hand Each) (piece \"Marker\" Each (move (from) (to (sites Empty))))}) (rules (start (place \"Marker\" \"Hand\" count:3)) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase (\"HandEmpty\" P2) \"Movement\")) (\"PhaseMovePiece\" \"Movement\")} (end (\"Line3Win\" Orthogonal))))\n\n###\n\n", "completion": "3x3 intersecting lines. Three pieces per player. Players alternate turns placing a piece on an empty spot on the board. Once all of the pieces are placed, players move a piece to any empty spot on the board. The first player to make an orthogonal row of three along the lines of the board wins. END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines backgammon tracks following the same direction for each player in using the hands of the players.\n\n###\n\n", "completion": "(define \"BackgammonTracksSameDirectionWithHands\" { (track \"Track1\" {26 25..20 18..13 0..5 7..12 #1} P1 directed:True) (track \"Track2\" {27 25..20 18..13 0..5 7..12 #1} P2 directed:True)}) END" }, { "prompt": "Construct a Ludii game based on the following description\nThree concentric squares, the midpoints of the squares connected with lines. Nine pieces per player. Players alternate turns placing a piece on an empty spot on the board. When all of the pieces are placed, the players alternate turns moving a piece to an empty adjacent spot along the lines. During either phase, when a player places three of their pieces in a row along the lines, the player removes any one of the opponent's pieces. The player who reduces the opponent to two pieces wins. \n\n###\n\n", "completion": "(game \"Triodi\" (players 2) (equipment { (\"NineMensMorrisBoard\") (hand Each) (piece \"Marker\" Each (\"StepToEmpty\" ~ (then (\"ReplayIfLine3\" Orthogonal exact:True))))}) (rules (start (place \"Marker\" \"Hand\" count:9)) phases:{ (phase \"Placement\" (play (if \"SameTurn\" \"RemoveAnyEnemyPiece\" (move (from (handSite Mover)) (to (sites Empty)) (then (\"ReplayIfLine3\" Orthogonal exact:True))))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (phase \"Movement\" (play (if \"SameTurn\" \"RemoveAnyEnemyPiece\" (forEach Piece))))} (end (\"HavingLessPiecesLoss\" Next 2)))) END" }, { "prompt": "Construct a Ludii game based on the following description\n8x8 board, marked as in Chaturanga. Pieces move according to specialized moves, as follows: Pawns (x8): can move one space forward and capture one space forward diagonally; Elephant (or Chariot or Boat) (x2): can move any number of spaces orthogonally; Elephant (or Camel) (x2): can move any number of spaces diagonally; Horse (2): moves in any direction, one space orthogonally with one space forward diagonally; Vizier (x1): can move any number of spaces orthogonally or diagonally; Raja (x1): can move one space orthogonally or diagonally, but can also move like the horse on its first move, if it has not yet been checked. The pieces are arranged as in Chess, except the Vizier is place to the left of the Raja on both sides. Players capture pieces by moving onto a space occupied by an opponent's piece. When a pawn reaches the opposite edge of the board from where it started, it may be promoted to the more powerful piece that begins the game in that position, but only if one of these belonging to the player has already been captured. If this has not happened, the pawn cannot move to the final row. When a player can capture the opponent's Raja on the next turn, the Raja is in Check, the opponent's next move must free the Raja from check. If the opponent cannot, it is checkmate and the player wins. If a player captures all of the opponent's pieces aside from the Raja and pawns, it is declared a half-win, or Burd. When both players are left with only a Raja, it is a draw. Players are not allowed to stalemate the opponent. If check is given 70 times in succession, the game is a draw. \n\n###\n\n", "completion": "(define \"PromotePiece\" (if (is In (last To) (sites Mover \"Promotion\")) (if (is In (last To) (sites Corners)) (promote (last To) (piece (id \"Boat\" Mover))) (if (or (= (column of:(last To)) 1) (= (column of:(last To)) 6)) (promote (last To) (piece (id \"Horse\" Mover))) (if (or (= (column of:(last To)) 2) (= (column of:(last To)) 5)) (promote (last To) (piece (id \"Elephant\" Mover))) (if (or (= (column of:(last To)) 3) (= (column of:(last To)) 4)) (promote (last To) (piece (id \"Queen\" Mover))))))))) (define \"PowerfulPieceOnColumnHasBeenRemoved\" (if (and (is In (to) (sites Corners)) (< (count Sites in:(sites Occupied by:Mover component:\"Boat\")) 2)) True (if (and (or (= (column of:(to)) 1) (= (column of:(to)) 6)) (< (count Sites in:(sites Occupied by:Mover component:\"Horse\")) 2)) True (if (and (or (= (column of:(to)) 2) (= (column of:(to)) 5)) (< (count Sites in:(sites Occupied by:Mover component:\"Elephant\")) 2)) True (if (and (or (= (column of:(to)) 3) (= (column of:(to)) 4)) (< (count Sites in:(sites Occupied by:Mover component:\"Ferz_noCross\")) 1)) True False))))) (define \"RememberPieceHasMoved\" (then (if (= (state at:(last To)) 1) \"PieceHasMoved\"))) (define \"PieceHasMoved\" (set State at:(last To) 0)) (define \"HasNeverMoved\" (= (state at:(from)) 1)) (game \"Hindustani Chess\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (piece \"Pawn\" Each (move Step Forward (to if:(and (or (not (is In (to) (sites Mover \"Promotion\"))) (and (is In (to) (sites Mover \"Promotion\")) (\"PowerfulPieceOnColumnHasBeenRemoved\"))) (not (\"IsFriendAt\" (to)))) (apply (remove (to)))) (then (\"PromotePiece\")))) (\"ChessRook\" \"Boat\") (piece \"King_noCross\" Each (or (\"StepToNotFriend\") (if (and (not (\"IsInCheck\" \"King_noCross\" Mover)) \"HasNeverMoved\") (\"LeapCapture\" \"KnightWalk\")) \"RememberPieceHasMoved\")) (\"ChessBishop\" \"Elephant\") (\"ChessKnight\" \"Horse\") (\"ChessQueen\" \"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 \"Boat1\" {\"A1\" \"H1\"}) (place \"Horse1\" {\"B1\" \"G1\"}) (place \"Elephant1\" {\"C1\" \"F1\"}) (place \"Ferz_noCross1\" coord:\"D1\") (place \"King_noCross1\" coord:\"E1\" state:1) (place \"Boat2\" {\"A8\" \"H8\"}) (place \"Horse2\" {\"B8\" \"G8\"}) (place \"Elephant2\" {\"C8\" \"F8\"}) (place \"Ferz_noCross2\" coord:\"E8\") (place \"King_noCross2\" coord:\"D8\" state:1)}) (play (do (forEach Piece) ifAfterwards:(and (not (no Moves Next)) (not (\"IsInCheck\" \"King_noCross\" Mover))))) (end { (\"Checkmate\" \"King_noCross\") (if (= (count Pieces Next) 1) (result Mover Draw)) (if (= (count Pieces Next) (+ 1 (count Sites in:(sites Occupied by:Next component:\"Pawn\")))) (result Mover Draw))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe board has nine vertical lines and ten horizontal rows, and the pieces are placed on the intersections of these lines. Centred along the back lines of each side is a three by three square with diagonals known as the palace. Pieces have special movement values: Janggun (general): May move one spot along the lines within the palace but cannot leave it. Sa (guards): Same movement as the Janggun. Ma (horses): Move one spot forward orthogonally and then one forward diagonally. Sang (elephants): Move one spot orthogonally forward then two spots diagonally forward. A Ma and Sang can be switched in the initial setup. Cha (chariots): Move like a rook in Chess, but also diagonally within the palace. Po (cannons): Jump over exactly one piece, over any distance horizontally or vertically, but cannot jump over or capture another cannon. Byeong/Jol (soldiers): Move and capture one point forward or sideways. Play continues until Woetong (checkmate) of the Janggun. \n\n###\n\n", "completion": "(define \"PawnMove\" (move Step (directions {Forward Rightward Leftward}) (to if:(not (\"IsFriendAt\" (to))) (apply (remove (to)))))) (define \"NotAFriendAndNotNextPo\" (and (not (\"IsPieceAt\" \"Po\" Next (to))) (not (\"IsFriendAt\" (to))))) (define \"NotEmptyAndNotAnotherPo\" (and { (not (\"IsPieceAt\" \"Po\" P1 (between))) (not (\"IsPieceAt\" \"Po\" P2 (between))) (is Occupied (between))})) (define \"EnemyCannotMove\" (not (can Move (do (forEach Piece Next) ifAfterwards:(not \"GeneralEnemyCheck\"))))) (define \"GeneralEnemyCheck\" (is Threatened (if (is Next P2) (id \"Cho2\") (id \"Han1\")))) (define \"SinceOnTurn\" (= (var) 0)) (define \"ResetCounter\" (set Var 0)) (define \"InitCounter\" (if (!= (var) 1) (set Var 1) (set Var 0))) (define \"GeneralSameColumnWithNoPieceBetween\" (if (= (column of:(where \"Han\" P1)) (column of:(where \"Cho\" P2))) (\"NoSites\" (forEach (sites Direction from:(where \"Han\" P1) N stop:(= (to) (where \"Cho\" P2))) if:(is Occupied (site)))) False)) (define \"GeneralNotCheck\" (not (is Threatened (if (is Mover P2) (id \"Cho2\") (id \"Han1\"))))) (define \"ThePalaces\" (union (sites P1 \"Palace\") (sites P2 \"Palace\"))) (define \"StepMoveOnThePlace\" (move Step (if (is In (from) (sites Mover \"PalaceOrtho\")) Orthogonal All) (to if:(and (is In (to) (sites Mover \"Palace\")) (not (\"IsFriendAt\" (to)))) (apply (remove (to)))))) (game \"Janggi\" (players 2) (equipment { (board (rectangle 10 9) use:Vertex) (piece \"Han\" P1 \"StepMoveOnThePlace\") (piece \"Cho\" P2 \"StepMoveOnThePlace\") (piece \"Sa\" Each \"StepMoveOnThePlace\") (piece \"Sang\" Each (forEach Direction Orthogonal (to if:(is Empty (to)) (apply (forEach Direction (from (to)) (directions {FR FL} of:All) (between (exact 2) if:(is Empty (between))) (if (not (\"IsFriendAt\" (to))) (move (from) (to (apply if:(\"IsEnemyAt\" (to)) (remove (to))))))))))) (piece \"Ma\" Each (forEach Direction Orthogonal (to if:(is Empty (to)) (apply (forEach Direction (from (to)) (directions {FR FL} of:All) (if (not (\"IsFriendAt\" (to))) (move (from) (to (apply if:(\"IsEnemyAt\" (to)) (remove (to))))))))))) (piece \"Cha\" Each (or { (\"SlideCapture\" Orthogonal) (if (is In (from) \"ThePalaces\") (move Slide Diagonal (between (max 2) if:(and (is Empty (between)) (is In (between) \"ThePalaces\"))) (to if:(\"IsEnemyAt\" (to)) (apply (remove (to))))))})) (piece \"Po\" Each (or { (move Hop Orthogonal (between before:(count Rows) after:(count Rows) if:\"NotEmptyAndNotAnotherPo\") (to if:(is Empty (to)) (apply if:\"NotAFriendAndNotNextPo\" (remove (to))))) (move Hop Orthogonal (between before:(count Rows) after:(count Rows) if:\"NotEmptyAndNotAnotherPo\") (to if:(is Empty (to)))) (if (is In (from) \"ThePalaces\") (move Hop Diagonal (between if:\"NotEmptyAndNotAnotherPo\") (to if:(and \"NotAFriendAndNotNextPo\" (is In (to) \"ThePalaces\")) (apply (remove (to))))))})) (piece \"Byeong\" P1 N \"PawnMove\") (piece \"Jol\" P2 S \"PawnMove\") (regions \"PalaceP1\" P1 { 3..5 12..14 21..23}) (regions \"PalaceOrthoP1\" P1 { 4 12 14 22}) (regions \"PalaceP2\" P2 { 66..68 75..77 84..86}) (regions \"PalaceOrthoP2\" P2 { 67 75 77 85})}) (rules (start { (place \"Han1\" coord:\"E2\") (place \"Sa1\" {\"D1\" \"F1\"}) (place \"Sang1\" {\"C1\" \"G1\"}) (place \"Ma1\" {\"B1\" \"H1\"}) (place \"Cha1\" {\"A1\" \"I1\"}) (place \"Po1\" {\"B3\" \"H3\"}) (place \"Byeong1\" {\"A4\" \"C4\" \"E4\" \"G4\" \"I4\"}) (place \"Cho2\" coord:\"E9\") (place \"Sa2\" {\"D10\" \"F10\"}) (place \"Sang2\" {\"C10\" \"G10\"}) (place \"Ma2\" {\"B10\" \"H10\"}) (place \"Cha2\" {\"A10\" \"I10\"}) (place \"Po2\" {\"B8\" \"H8\"}) (place \"Jol2\" {\"A7\" \"C7\" \"E7\" \"G7\" \"I7\"})}) (play (do (forEach Piece) ifAfterwards:\"GeneralNotCheck\" (then (if \"GeneralSameColumnWithNoPieceBetween\" \"InitCounter\" \"ResetCounter\")))) (end { (if (and (\"GeneralEnemyCheck\") (\"EnemyCannotMove\")) (result Mover Win)) (if (and (\"GeneralSameColumnWithNoPieceBetween\") (\"SinceOnTurn\")) (result Mover Draw))}))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game is played on a cross board of arm size of 1. -> The game is played on a cross board of arm size of 2.\n(define \"NumInitPiece\" 2) (define \"ArmSize\" 1) (game \"Laram Wali\" (players 2) (equipment { (\"CrossBoard\" \"ArmSize\" (* 3 \"ArmSize\") use:Cell) (hand Each) (piece \"Marker\" Each (or (\"StepOrthogonalToEmpty\") (move Hop Orthogonal (between (range 1 \"NumInitPiece\") if:(\"IsEnemyAt\" (between)) (apply (remove (between)))) (to if:(is Empty (to))))))}) (rules (start (place \"Marker\" \"Hand\" count:\"NumInitPiece\")) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (difference (sites Empty) (expand (sites Centre) steps:(- (/ \"ArmSize\" 2) (if (is Even \"ArmSize\") 1 0))))))) (nextPhase (\"HandEmpty\" P2) \"Movement\")) (\"PhaseMovePiece\" \"Movement\")} (end (\"CaptureAll\" Next))))\n\n###\n\n", "completion": "(define \"NumInitPiece\" 4) (define \"ArmSize\" 2) (game \"Laram Wali\" (players 2) (equipment { (\"CrossBoard\" \"ArmSize\" (* 3 \"ArmSize\") use:Cell) (hand Each) (piece \"Marker\" Each (or (\"StepOrthogonalToEmpty\") (move Hop Orthogonal (between (range 1 \"NumInitPiece\") if:(\"IsEnemyAt\" (between)) (apply (remove (between)))) (to if:(is Empty (to))))))}) (rules (start (place \"Marker\" \"Hand\" count:\"NumInitPiece\")) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (difference (sites Empty) (expand (sites Centre) steps:(- (/ \"ArmSize\" 2) (if (is Even \"ArmSize\") 1 0))))))) (nextPhase (\"HandEmpty\" P2) \"Movement\")) (\"PhaseMovePiece\" \"Movement\")} (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Construct a Ludii game based on the following description\n9x9 board played on the intersections, diagonals for the four quadrants of the board. Forty pieces per player, one playing as white, the other as red, arranged on opposite sides of the board, each player's pieces taking up the first through fourth ranks of spaces, plus their right half of the fifth rank. 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. \n\n###\n\n", "completion": "(game \"Ram Tir\" (players 2) (equipment { (board (add (square 9) edges:{ {0 10} {10 20} {20 30} {30 40} {40 50} {50 60} {60 70} {70 80} {8 16} {16 24} {24 32} {32 40} {40 48} {48 56} {56 64} {64 72} {4 12} {12 20} {20 28} {28 36} {36 46} {46 56} {56 66} {66 76} {76 68} {68 60} {60 52} {52 44} {44 34} {34 24} {24 14} {14 4}}) use:Vertex) (piece \"Marker\" Each (or (\"HopCapture\") (\"StepToEmpty\"))) (hand P2)}) (rules (start { (place \"Marker1\" (difference (expand (sites Bottom) steps:4) (sites {36..40}))) (place \"Marker2\" (difference (expand (sites Top) steps:4) (sites {40..44})))}) (play (forEach Piece)) (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"AuthorisedToLaunch\" (= (var \"NonPawnPieceCapture\") 1)) (define \"CastingAndMovingPieces\" (or (forEach Piece) (if (and (\"HasNeverMoved\" \"King\") (not (\"IsInCheck\" \"King\" Mover (forEach Piece)))) (or (if (and (\"HasNeverMoved\" \"RookLeft\") (can Move (\"CastleRook\" \"RookLeft\" E 3 (is Empty (to))))) \"BigCastling\") (if (and (\"HasNeverMoved\" \"RookRight\") (can Move (\"CastleRook\" \"RookRight\" W 2 (is Empty (to))))) \"SmallCastling\"))))) (define \"CaptureForwardDiagonal\" (move Step (directions {FR FL}) (to if:(\"IsEnemyAt\" (to)) (apply (and (if (and (not (\"AuthorisedToLaunch\")) (!= (id \"Pawn\" Next) (what at:(to)))) (set Var \"NonPawnPieceCapture\" 1)) (remove (to))))))) (define \"EnPassant\" (move Step (directions {FR FL}) (to if:\"InLocationEnPassant\") (then (and (if (and (not (\"AuthorisedToLaunch\")) (!= (id \"Pawn\" Next) (what at:(ahead (last To) Backward)))) (set Var \"NonPawnPieceCapture\" 1)) (remove (ahead (last To) Backward)))))) (define \"InLocationEnPassant\" (and (is Pending) (= (to) (value Pending)))) (define \"SetEnPassantLocation\" (then (set Pending (ahead (last To) Backward)))) (define \"BigCastling\" (\"DecideToCastle\" \"King\" W 2 \"KingNotCheckedAndToEmpty\" (then (\"CastleRook\" \"RookLeft\" E 3 True)))) (define \"SmallCastling\" (\"DecideToCastle\" \"King\" E 2 \"KingNotCheckedAndToEmpty\" (then (\"CastleRook\" \"RookRight\" W 2 True)))) (define \"CastleRook\" (slide (from (mapEntry #1 (mover))) #2 (between (exact #3) if:#4) (to if:True (apply (\"PieceHasMoved\" (from)))))) (define \"DecideToCastle\" (move Slide (from (mapEntry #1 (mover))) #2 (between (exact #3) if:#4) (to if:True (apply (\"PieceHasMoved\" (from)))) #5)) (define \"KingNotCheckedAndToEmpty\" (and (is Empty (to)) (not (is Threatened (id \"King\" Mover) at:(to) (forEach Piece))))) (define \"CaptureToPieceAndResetCounter\" (apply (if (\"IsEnemyAt\" (to)) (and (if (and (not (\"AuthorisedToLaunch\")) (!= (id \"Pawn\" Next) (what at:(to)))) (set Var \"NonPawnPieceCapture\" 1)) (remove (to) (then (set Counter))))))) (define \"RememberPieceHasMoved\" (then (if (= (state at:(last To)) 1) (\"PieceHasMoved\" (last To))))) (define \"PieceHasMoved\" (set State at:#1 0)) (define \"HasNeverMoved\" (= (state at:(mapEntry #1 (mover))) 1)) (define \"NextCanNotMove\" (not (can Move (do (forEach Piece Next) ifAfterwards:(not (\"IsInCheck\" \"King\" Next (\"CastingAndMovingPieces\"))))))) (game \"Stratomic\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 10)) (piece \"Pawn\" Each (or { (if (is In (from) (sites Start (piece (what at:(from))))) (\"DoubleStepForwardToEmpty\" \"SetEnPassantLocation\")) \"StepForwardToEmpty\" \"CaptureForwardDiagonal\" \"EnPassant\"} (then (and (\"ReplayInMovingOn\" (sites Mover \"Promotion\")) (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\"))) (piece \"NuclearBomb\" Each (move Step (to if:(not (\"IsFriendAt\" (to))) \"CaptureToPieceAndResetCounter\"))) (map \"King\" {(pair 1 \"F2\") (pair 2 \"E9\")}) (map \"RookLeft\" {(pair 1 \"A2\") (pair 2 \"J9\")}) (map \"RookRight\" {(pair 1 \"J2\") (pair 2 \"A9\")}) (regions \"Promotion\" P1 (sites Row 8)) (regions \"Promotion\" P2 (sites Row 1))}) (rules (start { (place \"Pawn1\" (sites Row 2)) (place \"Pawn2\" (sites Row 7)) (place \"NuclearBomb1\" (sites {\"A2\" \"J2\"})) (place \"Rook1\" {\"B2\" \"I2\"} state:1) (place \"Knight1\" {\"C2\" \"H2\"}) (place \"Bishop1\" {\"D2\" \"G2\"}) (place \"Queen1\" coord:\"E2\") (place \"King1\" coord:\"F2\" state:1) (place \"NuclearBomb2\" (sites {\"A9\" \"J9\"})) (place \"Rook2\" {\"B9\" \"I9\"} state:1) (place \"Knight2\" {\"C9\" \"H9\"}) (place \"Bishop2\" {\"D9\" \"G9\"}) (place \"Queen2\" coord:\"F9\") (place \"King2\" coord:\"E9\" state:1)}) (play (if \"SameTurn\" (move Promote (last To) (piece {\"Queen\" \"Knight\" \"Bishop\" \"Rook\" \"NuclearBomb\"}) Mover) (do (or (if (\"AuthorisedToLaunch\") (move Select (from (sites Occupied by:Mover component:\"NuclearBomb\") if:(not (is Threatened (id \"NuclearBomb\" Mover) at:(from) (forEach Piece)))) (to (sites Board)) (then (and (forEach Site (sites Around (last To) includeSelf:True) (if (and {(is Occupied (site)) (!= (what at:(site)) (id \"King\" P1)) (!= (what at:(site)) (id \"King\" P2))}) (remove (site)))) (remove (last From)))))) (\"CastingAndMovingPieces\")) ifAfterwards:(not (\"IsInCheck\" \"King\" Mover (\"CastingAndMovingPieces\")))))) (end { (if (and (\"IsInCheck\" \"King\" Next (\"CastingAndMovingPieces\")) (\"NextCanNotMove\")) (result Mover Win)) (if (or (no Moves Mover) (= (counter) 99)) (result Mover Draw))})))\n\n###\n\n", "completion": "The standard conventions of chess apply, including normal castling and en passant. Pawns promote on the 9th ranks and may promote to missile. The missile moves and captures as a chess king: one step in any direction. It may be captured like any other piece.\n \n Missile launches\n A player can launch a missile at any time to any board square, occupied or not. The launched missile \\ END" }, { "prompt": "Construct a Ludii game based on the following description\nPaintscape is a game for two players \u2013 Black and White \u2013 played on the squares (cells/faces) of a square grid with 8 squares per side (e.g. a Chess board). \n You also need a large supply of black and white stones and 5 distinguishable (e.g. by color) shared sets of 12 tiles. That is, each of the 5 sets contain 12 tiles, for 60 tiles in total.\n \n Setup:\n Before play begins, all 60 tiles and 2 white and 2 black stones are distributed randomly on the 64 squares of the board.\n A short balancing phase then ensues:\n \n One player swaps the position of any number of stones with a tile. That is, for 0, 1, 2, 3, or 4 of the stones, swap its position with any tile.\n When all stones have been swapped, or the swapping player passes, indicating that they do not wish to swap any more stones, the other player choses to play first as Black or second as White in the proper playing phase.\n (To show the button for swapping in Ludii, you might have to click the three dots next to the pass button.)\n \n The balancing phase can be skipped by new players, or you can agree on a fixed setup for the 4 initial stones.\n \n Play:\n In this phase (the proper playing phase), players take turns, starting with Black, placing stones of their own color.\n On your turn, place a stone of your color on a square adjacent to one of your stones already on the board.\n You may not place a stone on a square occupied by a stone. I.e. the square you place at must be empty or only occupied by a tile.\n Stones placed on tiles normally just stack on top of them, however:\n If a placement makes you have a stone on half of the tiles of a certain color, remove all tiles of that color along with the stones stacked on top of them (regardless of whether they're friendly or enemy).\n \n The goal:\n You win if you remove 3 of the 5 colors. The balance protocol is currently in force.\n\n###\n\n", "completion": "(define \"BalanceProtocol\" (phase \"Swapping\" (play (or (move Pass (then (set Var \"Passed\" 1))) (move Select (from (sites Board) if:(and (!= 3 (who at:(from))) (not (is In (from) (values Remembered))))) (to (sites Board) if:(= 3 (who at:(to)))) (then (and { (remember Value (last To)) (\"Swap\") (if (!= 3 (size Array (values Remembered))) (moveAgain))}))))) (nextPhase (or (= 1 (var \"Passed\")) (= 4 (size Array (values Remembered)))) \"Choose\")) (phase \"Choose\" (play (or (move Swap Players P1 P2 (then (set NextPlayer (player 1)))) (move Pass))) (nextPhase \"Play\"))) (define \"Swap\" (do (add (piece (who at:(last From))) (to (last To) (apply (do (set Var \"StateToBeAtLastFrom\" (state at:(to))) next:(remove (to)))))) next:(add (piece 3 state:(var \"StateToBeAtLastFrom\")) (to (last From) (apply (remove (to))))))) (game \"Paintscape\" (players 2) (equipment { (board (square 8)) (piece \"Disc\" Each) (piece \"Square\" Shared maxState:5)}) (rules (start { (place Random (sites Empty) {\"Disc1\" \"Disc2\"} count:2) (place Random (sites Empty) {\"Square\"} count:12 state:1) (place Random (sites Empty) {\"Square\"} count:12 state:2) (place Random (sites Empty) {\"Square\"} count:12 state:3) (place Random (sites Empty) {\"Square\"} count:12 state:4) (place Random (sites Empty) {\"Square\"} count:12 state:5)}) phases:{ (\"BalanceProtocol\") (phase \"Play\" (play (move Add (to (sites Around (sites Occupied by:Mover) Orthogonal) if:(not (or (= (mover) (who at:(to))) (= (next) (who at:(to)))))) stack:True (then (if (and (= 3 (who at:(last To) level:0)) (= 6 (count Sites in:(forEach (sites Occupied by:Mover) if:(= (state at:(last To) level:0) (state at:(site) level:0)))))) (and (remove (forEach (sites Board) if:(= (state at:(last To) level:0) (state at:(site) level:0))) count:2) (addScore Mover 1)))))))} (end (if (or (= 3 (score P1)) (= 3 (score P2))) (byScore))))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines two opposite table tracks.\n\n###\n\n", "completion": "(define \"TableTracksOpposite\" { (track \"Track1\" {0..11 23..12 #1} P1 directed:True) (track \"Track2\" {12..23 11..0 #1} P2 directed:True)}) END" }, { "prompt": "What does the following global Ludii definition do?\n(define \"NoMovesP2NoPiecesP1\" { (if (no Moves P2) (result P1 Win)) (if (no Pieces P1) (result P2 Win))})\n\n###\n\n", "completion": "Checks if P2 has no moves and P1 wins and checks if P1 has no pieces and P2 wins. This ludemeplex can be used only in an ending condition. END" }, { "prompt": "Construct a Ludii game based on the following description\n8x8 board. The pieces move as follows, with the number per player: 1 x Negus (king): moves one space orthogonally or diagonally. 1 x Ferz (counselor): One square diagonally. 2 x Der (castle): Any number of spaces orthogonally. 2 x S\u00e4b\u00e4 (man): Three squares diagonally, jumping over the first two. 2 x F\u00e4r\u00e4s (horse): Moves as a chess knight. 8 x M\u00e9d\u00e9q: Moves one space forward orthogonally; one space forward diagonally to capture. No en passant. Promoted to Ferz when reaching the eighth rank. No castling, except in the opening phase. In the opening phase, players play simultaneously at will, with no turn structure, until the first piece is captured, at which point turns alternate for the main phase of the game. Castling is allowed during the opening phase, and pawns may move any distance forward. If only a player's Negus remains, the opponent must checkmate it in ten moves or less, or the game is a stalemate. The player who checkmates the king wins. \n\n###\n\n", "completion": "(game \"Santaraj\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (hand Each size:5) (\"ChessKing\" \"King_noCross\") (\"ChessRook\" \"Castle\") (piece \"Ferz_noCross\" Each (move Hop Diagonal (between (exact 2) if:True) (to if:(not (\"IsFriendAt\" (to))) (apply (if (\"IsEnemyAt\" (to)) (remove (to))))))) (\"ChessKnight\" \"Knight\") (\"ChessPawn\" \"Pawn\" ~ (then (\"PromoteIfReach\" (sites Mover \"Promotion\") \"Queen\"))) (piece \"Queen\" Each (\"StepToNotFriend\" Diagonal)) (regions \"Promotion\" P1 (sites Top)) (regions \"Promotion\" P2 (sites Bottom))}) (rules (start { (place \"Pawn1\" (sites Row 1)) (place \"Pawn2\" (sites Row 6)) (place \"Castle1\" {\"A1\" \"H1\"}) (place \"Knight1\" {\"B1\" \"G1\"}) (place \"Ferz_noCross1\" {\"C1\" \"F1\"}) (place \"Queen1\" coord:\"D1\") (place \"King_noCross1\" coord:\"E1\") (place \"Castle2\" {\"A8\" \"H8\"}) (place \"Knight2\" {\"B8\" \"G8\"}) (place \"Ferz_noCross2\" {\"C8\" \"F8\"}) (place \"Queen2\" coord:\"D8\") (place \"King_noCross2\" coord:\"E8\")}) (play (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King_noCross\" Mover)) (then (if (and (> (count Pieces P1) 1) (> (count Pieces P2) 1)) (set Counter))))) (end { (\"Checkmate\" \"King_noCross\") (if (and (or (= (count Pieces P1) 1) (= (count Pieces P2) 1)) (= (counter) 20)) (result Mover Draw))}))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a step move to all the rotational directions to an empty site.\n\n###\n\n", "completion": "(define \"StepRotationalToEmpty\" (move Step Rotational (to if:(is Empty (to))))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines all the equipment used in most of the draught games.\n\n###\n\n", "completion": "(define \"DraughtsEquipment\" (equipment { (board #1 #2) (piece \"Counter\" P1 N) (piece \"Counter\" P2 S) (piece \"DoubleCounter\" Each) (regions P1 (sites Bottom)) (regions P2 (sites Top)) #3})) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"IsUnpromoted\" (\"IsPieceAt\" \"Counter\" Mover (last To))) (game \"Diagonal Draughts\" (players 2) (\"DraughtsEquipment\" (square 10)) (rules (start { (place \"Counter1\" (difference (expand (intersection (sites Right) (sites Bottom)) steps:8 Orthogonal) (sites Phase 1))) (place \"Counter2\" (difference (expand (intersection (sites Left) (sites Top)) steps:8 Orthogonal) (sites Phase 1)))}) (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\" Diagonal) (then (\"PromoteIfReach\" (sites Next) \"DoubleCounter\"))) (forEach Piece \"DoubleCounter\" (move Slide Diagonal)))}))) (end (\"BlockWin\"))))\n\n###\n\n", "completion": "10x10 board, 20 pieces per player, arranged on the dark squares, leaving the diagonal from bottom left to top right empty, with each player's pieces on opposite sides of it. 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.\n END" }, { "prompt": "Construct a Ludii game based on the following description\nBide is a strategy game for 2 to 6 players on a hexhex-5 board that is initially empty. Players take turns by placing stones of their color on the hexagonal cells. At the beginning of your turn you are given a new stone. You can either play it, or bide. If you bide, set the stone aside and your turn ends immediately. The stone remains in your hand. If you play the new stone while having at least one stone in your hand, you may release, meaning you would play every stone in your hand in succession. If a player releases, all players must release on their next turn, including playing their stone for that turn. Stones when placed create shock waves, pushing all adjacent stones one space radially outward from the placement. If there are multiple connected stones adjacent to the placed stone, positioned directly in line of the shock wave, they all move one space. If this movement causes a stone to bump into another stone directly in line of the shock wave, that stone also gets pushed one space. Becoming adjacent along a different grid line than the shockwave does not count. However stones cannot be pushed past the edge of the board. Lines that are full between the edges and the placed stone cannot move. Players eventually score points when all cells are filled up with stones. Each stone is worth points equal to its distance from the edge, starting at zero. Groups consist of connected adjacent like colored stones. The player with the highest scoring group wins. If tied, remove the outermost ring of stones and rescore, repeating this process until there is a winner. Two Players Order 5, Hex Grid\n\n###\n\n", "completion": "(define \"HS\" .094) (define \"Adj\" Orthogonal) (define \"CascadeScoring\" (and { (set Score All 0) (\"ScoreLargestGroupsInsideRegionWithFactor\" (sites Empty) 10000000) (\"ScoreLargestGroupsInsideRegionWithFactor\" (sites \"R0x\") 100000) (\"ScoreLargestGroupsInsideRegionWithFactor\" (sites \"R1x\") 1000) (\"ScoreLargestGroupsInsideRegionWithFactor\" (sites \"R2x\") 10) (\"ScoreLargestGroupsInsideRegionWithFactor\" (sites \"R3x\") 1)})) (define \"ScoreLargestGroupsInsideRegionWithFactor\" (forEach Player (do (\"AssignPieceValues\") next:(if (< 0 (count Sites in:(\"ScoreSites\" #1))) (do (forEach Group \"Adj\" if:(and { (is In (to) (\"ScoreSites\" #1))}) (remember Value \"PlayerGroups\" (+ (results from:(sites) to:(from) (value Piece at:(from)))))) next:(addScore (player (player)) (* #2 (max (values Remembered \"PlayerGroups\"))) (then (forget Value \"PlayerGroups\" All)))))))) (define \"ScoreSites\" (intersection (difference (sites Board) #1) (sites Occupied by:(player (player))))) (define \"AssignPieceValues\" (and { (\"AssignValueOfNextTo\" 1 \"R0x\") (\"AssignValueOfNextTo\" 2 \"R1x\") (\"AssignValueOfNextTo\" 3 \"R2x\") (\"AssignValueOfNextTo\" 4 \"R3x\") (\"AssignValueOfNextTo\" 5 \"R4x\")})) (define \"AssignValueOfNextTo\" (forEach Site (sites Around (sites #2) \"Adj\" if:(= (player) (who at:(to)))) (set Value at:(site) #1))) (define \"BideMoveX\" (move Propose \"Bide\" (then (add (to (handSite Mover)) stack:True)))) (define \"BideMove\" (do (add (to (handSite Mover)) stack:True) next:(move Pass))) (define \"Release\" (if (is Empty (handSite Mover)) (move Add (to (intersection (sites Board) (sites Empty)))) (\"ReleaseFromPool\") (then (and { (remember Value \"Released\" (mover) unique:True) (\"ResolveShockWave\")})))) (define \"ReleaseFromPool\" (move (from (handSite Mover)) (to (sites Empty)) (then (moveAgain)))) (define \"ResolveShockWave\" (set Var \"LF\" (last To) (then (and { (\"PushFromTowards\" (var \"LF\") (ahead (var \"LF\") NNE)) (\"PushFromTowards\" (var \"LF\") (ahead (var \"LF\") E)) (\"PushFromTowards\" (var \"LF\") (ahead (var \"LF\") SSE)) (\"PushFromTowards\" (var \"LF\") (ahead (var \"LF\") SSW)) (\"PushFromTowards\" (var \"LF\") (ahead (var \"LF\") W)) (\"PushFromTowards\" (var \"LF\") (ahead (var \"LF\") NNW))})))) (define \"PushFromTowards\" (if (and (!= #1 #2) (not (is Empty #2))) (set Var \"AnchorSite\" (\"AnchorSiteFromToward\" #1 #2) (then (forEach Site (\"ShockPushSitesFromTowards\" #1 #2) (if (is Empty (site)) (remove (ahead (site) (directions Vertex from:#1 to:#2))) (add (piece (who at:(site))) (to (ahead (site) (directions Vertex from:#1 to:#2)) (apply (remove (to)))))) (then (remove (#2)))))))) (define \"ShockPushSitesFromTowards\" (difference (\"Sites2FirstDoubleEmptySiteFromToward\" #1 #2) (if (or { (= -1 (var \"AnchorSite\")) (is Empty (var \"AnchorSite\")) (= #1 (var \"AnchorSite\"))}) (sites {#1}) (\"Sites2FirstEmptySiteToward\" (var \"AnchorSite\") #1)))) (define \"AnchorSiteFromToward\" (regionSite (forEach (\"Sites2FirstDoubleEmptySiteFromToward\" #1 #2) if:(= (site) (ahead (site) (directions Vertex from:#1 to:#2)))) index:0)) (define \"Sites2FirstEmptySiteToward\" (sites Direction from:#1 (directions Vertex from:#1 to:#2) included:True stop:(is Empty (to)) stopIncluded:True distance:Infinity)) (define \"Sites2FirstDoubleEmptySiteFromToward\" (sites Direction from:#1 (directions Vertex from:#1 to:#2) stop:(and (is Empty (to)) (is Empty (ahead (to) (directions Vertex from:#1 to:#2)))) stopIncluded:True distance:Infinity)) (game \"Bide\" (players 2) (equipment { (board (tri Hexagon 5) use:Vertex) (hand Each size:1) (piece \"Disc\" Each) (regions \"R0x\" (sites Outer)) (regions \"R1x\" (sites Around (sites \"R0x\") \"Adj\" includeSelf:True)) (regions \"R2x\" (sites Around (sites \"R1x\") \"Adj\" includeSelf:True)) (regions \"R3x\" (sites Around (sites \"R2x\") \"Adj\" includeSelf:True)) (regions \"R4x\" (sites Around (sites \"R3x\") \"Adj\" includeSelf:True)) (regions \"R5x\" (sites Around (sites \"R4x\") \"Adj\" includeSelf:True))}) (rules (meta (passEnd NoEnd)) (play (if (or (is Prev Mover) (and (< 0 (size Array (values Remembered \"Released\"))) (> 2 (size Array (values Remembered \"Released\"))))) (\"Release\") (or (\"BideMove\") (or (\"ReleaseFromPool\") (move Add (to (intersection (sites Board) (sites Empty)))) (then \"ResolveShockWave\")) (then (forget Value \"Released\" All))) (then (\"CascadeScoring\")))) (end (if (= 0 (count Sites in:(intersection (sites Board) (sites Empty)))) (byScore))))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a hop move in diagonal over an enemy to an empty site. The enemy pieces are removed at the end of the turn and you can not hop a piece you already hopped during your turn.\n\n###\n\n", "completion": "(define \"HopInternationalDraughtsStyle\" (move Hop #1 Diagonal (between if:(and (not (is In (between) (sites ToClear))) (\"IsEnemyAt\" (between))) (apply (remove (between) at:EndOfTurn))) (to if:(is Empty (to))) #2)) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a sequence of hop move in all the diagonal directions over an enemy to an empty site from the last ``to'' location of the previous move. \n\n###\n\n", "completion": "(define \"HopDiagonalSequenceCaptureAgain\" (move Hop (from (last To)) Diagonal (between #1 #2 if:(and (not (is In (between) (sites ToClear))) (\"IsEnemyAt\" (between))) (apply (remove (between) #3))) (to if:(is Empty (to))) (then (if (can Move (hop (from (last To)) Diagonal (between #1 #2 if:(and (not (is In (between) (sites ToClear))) (\"IsEnemyAt\" (between)))) (to if:(is Empty (to))))) (moveAgain))))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a sequence of hop move in all the orthogonal directions over an enemy to an empty site. \n\n###\n\n", "completion": "(define \"HopOrthogonalSequenceCapture\" (move Hop Orthogonal (between #1 #2 if:(\"IsEnemyAt\" (between)) (apply (remove (between) #3))) (to if:(is Empty (to))) (then (if (can Move (hop (from (last To)) Orthogonal (between #1 #2 if:(and (not (is In (between) (sites ToClear))) (\"IsEnemyAt\" (between)))) (to if:(is Empty (to))))) (moveAgain))))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a hop move in all the directions specified (by default Adjacent) over a friend to an empty site. The friend piece is removed.\n\n###\n\n", "completion": "(define \"HopFriendCapture\" (move Hop #1 #2 (between if:(\"IsFriendAt\" (between)) (apply (remove (between)))) (to if:(is Empty (to))) #3)) END" }, { "prompt": "Construct a Ludii game based on the following description\nOne player has 12 dogs, the other one lion. The dogs may move one space forward, the lion may move one space in any direction, and may also hop over a dog to capture it. The lion may make multiple hops in one turn. The goal of the dogs is to block the lion from moving; the lion's goal is to capture all the dogs. The dogs moves forwards.\n\n###\n\n", "completion": "(game \"Komikan\" (players 2) (equipment { (board (merge (scale 2 (square 5 diagonals:Alternating)) (graph vertices:{ {4 8} {3 9} {4 9} {5 9} {2 10} {3 10} {4 10} {5 10} {6 10} {1 11} {3 11} {4 11} {5 11} {7 11}} edges:{ {0 1} {0 2} {0 3} {1 4} {1 5} {1 2} {2 6} {2 3} {3 7} {3 8} {4 9} {4 5} {5 10} {5 6} {6 11} {6 7} {7 12} {7 8} {8 13} {9 10} {10 11} {11 12} {12 13}})) use:Vertex) (piece \"MountainLion\" P1 (if \"SameTurn\" (or (move Pass) (\"HopSequenceCaptureAgain\")) (or (\"HopSequenceCapture\") \"StepToEmpty\"))) (piece \"Dog\" P2 N \"StepForwardsToEmpty\")}) (rules (start { (place \"Dog2\" (union (expand (sites Bottom)) (sites {\"A3\" \"I3\"}))) (place \"MountainLion1\" (coord \"E7\"))}) (play (forEach Piece)) (end { (if (no Pieces P2) (result P1 Win)) (if (no Moves P1) (result P2 Win)) (if (no Moves P2) (result Mover Draw))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nOne player takes the Odd role, and the other player takes the even role. Initially, the board graph is coloured with a neutral colour. Players take turns removing colour from a coloured edge. The odd player gets a score of each turn, which is equal to the cost of the last removed edge. Play ends when the coloured graph has no cycle. If the odd player has odd score he wins, otherwise, the second player wins. The game is played on the Graph1.\n\n###\n\n", "completion": "(game \"OddEvenTree\" (players 2) (equipment { (board (graph vertices:{ {0 0} {3 0} {1 1} {4 1} {0 3} {3 3} {1 4} {4 4}} edges:{{0 1} {0 2} {0 4} {1 3} {1 5} {2 3} {2 6} {4 5} {4 6} {6 7} {5 7} {3 7}}) use:Edge) (piece \"Marker\" Neutral)}) (rules (start { (set Neutral Edge (sites Board Edge)) (set Cost 1 Edge at:0) (set Cost 2 Edge at:1) (set Cost 3 Edge at:2) (set Cost 1 Edge at:3) (set Cost 2 Edge at:4) (set Cost 3 Edge at:5) (set Cost 1 Edge at:6) (set Cost 2 Edge at:7) (set Cost 3 Edge at:8) (set Cost 3 Edge at:9) (set Cost 1 Edge at:10) (set Cost 2 Edge at:11) (set Score P2 (cost Edge in:(sites Board Edge)))}) (play (move Remove (sites Occupied by:Neutral on:Edge) (then (and (remove Edge (last To)) (addScore {P1 P2} {(cost Edge at:(last To)) (- 0 (cost Edge at:(last To)))}))))) (end (if (is Tree Neutral) (if (is Odd (score P1)) (result P1 Win)) (result P2 Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nFour 3x8 rectangles, arranged in a cross shape around a large central square space. Squares marked with \\ \n\n###\n\n", "completion": "(define \"Move\" (if (\"IsEndTrack\" (\"SiteToMoveOnTrack\" from:(from) #1)) (move Remove (from) level:(level)) (move (from (from) level:(level)) (to (\"SiteToMoveOnTrack\" from:(from) #1) if:(not (and (is In (to) (sites \"SafeSites\")) (\"IsEnemyAt\" (to)))) (\"HittingStackCapture\" (handSite (who at:(to) level:(level)))))))) (define \"StopThrow\" (is In (\"ThrowValue\") (sites {2 3 4}))) (define \"IsSpecialThrow\" (is In (\"ThrowValue\") (sites {10 25}))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" #2 #1)) (define \"ThrowValue\" (mapEntry \"Throw\" (count Pips))) (game \"Sokkattan\" (players 4) (equipment { (\"PachisiBoard\" { (track \"Track1\" \"96,9,S,E,N,11,E,N,W,53,N,W,S,42,W,S,E,8,S,E1,N7,End\" P1 directed:True) (track \"Track2\" \"96,26,W,S,E,8,S,E,N,11,E,N,W,53,N,W,S,42,W,S1,E7,End\" P2 directed:True) (track \"Track3\" \"96,52,N,W,S,42,W,S,E,8,S,E,N,11,E,N,W,53,N,W1,S7,End\" P3 directed:True) (track \"Track4\" \"96,27,E,N,W,53,N,W,S,42,W,S,E,8,S,E,N,11,E,N1,W7,End\" P4 directed:True)}) (hand Each) (\"StickDice\" 6) (piece \"Pawn\" Each (\"Move\" (\"ThrowValue\"))) (regions \"SafeSites\" (sites {67 63 65 23 38 3 82 84 86 30 47 15})) (map \"Throw\" {(pair 0 6) (pair 1 10) (pair 2 2) (pair 3 3) (pair 4 4) (pair 5 25) (pair 6 12)}) (map \"Entry\" {(pair P1 67) (pair P2 23) (pair P3 82) (pair P4 30)})}) (rules (start { (set Team 1 {P1 P3}) (set Team 2 {P2 P4}) (place Stack \"Pawn1\" (handSite P1) count:3) (place Stack \"Pawn2\" (handSite P2) count:3) (place Stack \"Pawn3\" (handSite P3) count:3) (place Stack \"Pawn4\" (handSite P4) count:3)}) (play (\"RollMove\" (if (= (var \"ExtraOne\") 1) (priority { (if (is Occupied (handSite Mover)) (move (from (handSite Mover)) (to (mapEntry \"Entry\" Mover)))) (forEach Piece (\"Move\" 1))} (then (and (moveAgain) (set Var \"ExtraOne\" 0)))) (or (if (and (is Occupied (handSite Mover)) (\"IsSpecialThrow\")) (move (from (handSite Mover)) (to (mapEntry \"Entry\" Mover)))) (forEach Piece))) (then (if (not (\"StopThrow\")) (and (if (\"IsSpecialThrow\") (set Var \"ExtraOne\" 1)) (moveAgain)))))) (end (\"EscapeTeamWin\")))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nChecks if all pieces on the board owned by the mover are in a region.\n\n###\n\n", "completion": "(define \"AllOwnedPiecesIn\" (all Sites (sites Occupied by:Mover) if:(is In (site) #1))) END" }, { "prompt": "What does the following global Ludii definition do?\n(define \"RollMove\" (do (roll) next:#1 #2))\n\n###\n\n", "completion": "Roll dice before to compute the legal moves. END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayers alternate turns placing one of their pieces on the board. The first person to make a line of four, but without first making a line of three, wins. \n\n###\n\n", "completion": "(game \"Squava\" (players 2) (equipment { (board (square 5)) (piece \"Marker\" Each)}) (rules (meta (swap)) (play (move Add (to (sites Empty)))) (end { (if (is Line 4) (result Mover Win)) (if (is Line 3) (result Mover Loss))}))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a rectangular board with Alquerque-style alternating diagonals with a triangle extension at the bottom.\n\n###\n\n", "completion": "(define \"AlquerqueBoardWithBottomTriangle\" (board (\"AlquerqueGraphWithBottomTriangle\") use:Vertex)) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe board begins empty. One player plays as black, the other as white. The black player begins by placing a piece on one of the intersections on the board. Players alternate turns placing a piece on the board. A player may pass at any time. A piece or a group of pieces are captured when they are completely surrounded on all sides on adjacent intersections by the opposing player. Stones cannot be placed to recreate a previous position. The game ends when both players pass consecutively. Players total the number of intersections their pieces occupy or surround. The player with the highest total wins. For more info on this version please google Hexagonal Go. Hex Grid - Standard Order 6 board\n\n###\n\n", "completion": "(define \"HexHex\" (board (tri Hexagon 6) use:Vertex)) (define \"BoardUsed\" \"HexHex\") (define \"Connection\" Orthogonal) (define \"CaptureSurroundedPiece\" (enclose (from (last To)) Orthogonal (between if:(\"IsEnemyAt\" (between)) (apply (and (addScore Mover 1) (remove (between))))))) (game \"HexGo\" (players 2) (equipment { \"BoardUsed\" (piece \"Ball\" P1) (piece \"Ball\" P2)}) (rules (meta (no Repeat)) (play (or (do (move Add (to (sites Empty)) (then \"CaptureSurroundedPiece\")) ifAfterwards:(\"HasFreedom\" Orthogonal)) (move Pass))) (end (if (all Passed) (byScore { (score P1 (+ (score P1) (size Territory P1))) (score P2 (+ (score P2) (size Territory P2)))}))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\n2 players involved with one piece per player. -> 3 players involved.\n(define \"MoveOnTrack\" (if (is In (from) (sites Track #2 #1)) (forEach Value (values Remembered \"Throws\") (or (if (\"IsOffBoard\" (\"NextSiteFrom\" (from) #1 (value))) (do (forget Value \"Throws\" (value)) next:(move Remove (from) level:(level)))) (move (from (from) level:(level)) (to (\"NextSiteFrom\" (from) #1 (value)) if:(\"NoEnemyOrOnlyOne\" (to)) (apply (and (if (\"IsEnemyAt\" (to)) (fromTo (from (to)) (to (handSite (who at:(to)))))) (forget Value \"Throws\" (value))))) (then (if (and (!= (last From) (handSite Mover)) (is Occupied (last From))) (forEach Level (last From) FromTop (fromTo (from (last From) level:(level)) (to (last To))))))) (then (if (!= 0 (size Array (values Remembered \"Throws\"))) (moveAgain))))))) (define \"Move\" (or (forEach Piece top:True) (forEach Piece container:(mover) top:True))) (define \"NextSiteFrom\" (\"NextSiteOnTrack\" #3 from:#1 #2)) (define \"SpecialThrows\" (is In (\"ThrowValue\") (sites {4 5}))) (define \"ThrowValue\" (mapEntry \"Throw\" (count Pips))) (game \"Nyout\" (players 2) (equipment { (board (concentric {1 -4 -4 20}) { (track \"Track1\" {29 9..28} P1 directed:True) (track \"Track2\" {30 9..28} P2 directed:True) (track \"HorizontalTrack\" {13 5 1 0 3 7 23..28} directed:True) (track \"VerticalTrack\" {18 6 2 0 4 8 28} directed:True)} use:Vertex) (piece \"Counter\" Each (or { (\"MoveOnTrack\" \"Track\" Mover) (\"MoveOnTrack\" \"HorizontalTrack\") (\"MoveOnTrack\" \"VerticalTrack\")})) (dice d:2 from:0 num:4) (hand Each) (map \"Throw\" {(pair 0 4) (pair 1 3) (pair 2 2) (pair 3 1) (pair 4 5)})}) (rules (start { (set Team 1 {P1}) (set Team 2 {P2}) (place Stack \"Counter1\" (handSite P1) count:1) (place Stack \"Counter2\" (handSite P2) count:1)}) phases:{ (phase \"Throwing\" (play (\"RollMove\" (move Pass (then (remember Value \"Throws\" (\"ThrowValue\")))) (then (moveAgain)))) (nextPhase Mover (not (\"SpecialThrows\")) \"Moving\")) (phase \"Moving\" (play (if (can Move (\"Move\")) (\"Move\") (move Pass (then (forget Value \"Throws\" All))))) (nextPhase Mover (= 0 (size Array (values Remembered \"Throws\"))) \"Throwing\"))} (end (\"EscapeTeamWin\"))))\n\n###\n\n", "completion": "(define \"MoveOnTrack\" (if (is In (from) (sites Track #2 #1)) (forEach Value (values Remembered \"Throws\") (or (if (\"IsOffBoard\" (\"NextSiteFrom\" (from) #1 (value))) (do (forget Value \"Throws\" (value)) next:(move Remove (from) level:(level)))) (move (from (from) level:(level)) (to (\"NextSiteFrom\" (from) #1 (value)) if:(\"NoEnemyOrOnlyOne\" (to)) (apply (and (if (\"IsEnemyAt\" (to)) (fromTo (from (to)) (to (handSite (who at:(to)))))) (forget Value \"Throws\" (value))))) (then (if (and (!= (last From) (handSite Mover)) (is Occupied (last From))) (forEach Level (last From) FromTop (fromTo (from (last From) level:(level)) (to (last To))))))) (then (if (!= 0 (size Array (values Remembered \"Throws\"))) (moveAgain))))))) (define \"Move\" (or (forEach Piece top:True) (forEach Piece container:(mover) top:True))) (define \"NextSiteFrom\" (\"NextSiteOnTrack\" #3 from:#1 #2)) (define \"SpecialThrows\" (is In (\"ThrowValue\") (sites {4 5}))) (define \"ThrowValue\" (mapEntry \"Throw\" (count Pips))) (game \"Nyout\" (players 3) (equipment { (board (concentric {1 -4 -4 20}) { (track \"Track1\" {29 9..28} P1 directed:True) (track \"Track2\" {30 9..28} P2 directed:True) (track \"Track3\" {31 9..28} P3 directed:True) (track \"HorizontalTrack\" {13 5 1 0 3 7 23..28} directed:True) (track \"VerticalTrack\" {18 6 2 0 4 8 28} directed:True)} use:Vertex) (piece \"Counter\" Each (or { (\"MoveOnTrack\" \"Track\" Mover) (\"MoveOnTrack\" \"HorizontalTrack\") (\"MoveOnTrack\" \"VerticalTrack\")})) (dice d:2 from:0 num:4) (hand Each) (map \"Throw\" {(pair 0 4) (pair 1 3) (pair 2 2) (pair 3 1) (pair 4 5)})}) (rules (start { (set Team 1 {P1}) (set Team 2 {P2}) (set Team 3 {P3}) (place Stack \"Counter1\" (handSite P1) count:3) (place Stack \"Counter2\" (handSite P2) count:3) (place Stack \"Counter3\" (handSite P3) count:3)}) phases:{ (phase \"Throwing\" (play (\"RollMove\" (move Pass (then (remember Value \"Throws\" (\"ThrowValue\")))) (then (moveAgain)))) (nextPhase Mover (not (\"SpecialThrows\")) \"Moving\")) (phase \"Moving\" (play (if (can Move (\"Move\")) (\"Move\") (move Pass (then (forget Value \"Throws\" All))))) (nextPhase Mover (= 0 (size Array (values Remembered \"Throws\"))) \"Throwing\"))} (end (\"EscapeTeamWin\")))) END" }, { "prompt": "What does the following global Ludii definition do?\n(define \"BackgammonBoard\" (board (rectangle 2 13) #1 use:Vertex))\n\n###\n\n", "completion": "Defines a backgammon board (without the style). END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nChecks if a stack has a size of 1 at a site or if the site is empty.\n\n###\n\n", "completion": "(define \"IsEmptyOrSingletonStack\" (= (topLevel at:#1) 0)) END" }, { "prompt": "Construct a Ludii game based on the following description\n4x6-16 board. Number of counters per player is four times the number of holes in a row minus two. Counters are distributed only in the outer row, with two counters in each hole, except the hole on the far left which contains the rest. The counters are then redistributed so that there is one in every hole, except the one on the extreme left in the inner and outer hole. The one on the left in the inner hole remains empty and the one in the outer row retains the same number initially placed there. Play begins from any of the player's holes, sowing anti-clockwise. When the final counter lands in an occupied hole, these are picked up and sowing continues, unless a capture can be made. Captures are made when the final counter falls into an occupied hole in the inner row, and the opponent's hole opposite contains counters. If it is, they are captured, and if the hole in to outer row opposite also contains counters, these are also captured. These are then sown from the hole following the one from which the capture occurred. If the final counter falls into an empty hole, the turn is over. Single counters cannot be sown. Play ends when one player cannot move. Each row has 6 holes.\n\n###\n\n", "completion": "(define \"Columns\" 6) (game \"Muvalavala (Quioco)\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"0,E,N1,W\" loop:True P1) (track \"Track2\" \"12,E,N1,W\" loop:True P2)}) (piece \"Seed\" Shared) (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))}) (rules (start { (set Count 1 to:(union { (difference (sites P1 \"Home\") (sites Left)) (difference (sites P2 \"Home\") (sites Right))})) (set Count (- (- (* 4 \"Columns\") 2) (* 2 (- \"Columns\" 1))) to:(union (intersection (sites Left) (sites P1 \"Outer\")) (intersection (sites Right) (sites P2 \"Outer\"))))}) (play (move Select (from (if (\"SameTurn\") (\"LastHoleSowed\") (sites Mover \"Home\")) if:(> (count at:(from)) 1)) (then (sow \"Track\" owner:(mover) apply:(if (and { (> (count at:(to)) 1) (is In (to) (sites Mover \"Inner\")) (> (count at:(\"OppositePit\" (to))) 0)}) (and { (fromTo (from (\"OppositePit\" (to))) (to (to)) count:(count at:(\"OppositePit\" (to)))) (if (> (count at:(\"OppositeOuterPit\" (to))) 0) (fromTo (from (\"OppositeOuterPit\" (to))) (to (to)) count:(count at:(\"OppositeOuterPit\" (to))))) (sow (to) count:(+ (count at:(\"OppositePit\" (to))) (count at:(\"OppositeOuterPit\" (to)))) \"Track\" owner:(mover))}) (if (> (count at:(to)) 1) (moveAgain))))))) (end (\"BlockWin\")))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"Alquerque de Tres\" (players 2) (equipment { (\"AlquerqueBoard\" 3 3) (hand Each) (piece \"Marker\" Each)}) (rules (start (place \"Marker\" \"Hand\" count:3)) (play (move (from (handSite Mover)) (to (sites Empty)))) (end (\"Line3Win\"))))\n\n###\n\n", "completion": "3x3 intersecting lines, with diagonal lines of the board. Three pieces per player. players alternate turns placing a piece on one of the empty spots. The player who places their pieces in a line wins. END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a table board (without the style).\n\n###\n\n", "completion": "(define \"TableBoard\" (board (merge { (rectangle 1 6) (shift 7 0 (rectangle 1 6)) (shift 0 6 (rectangle 1 6)) (shift 7 6 (rectangle 1 6))}) #1 use:Vertex)) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe rules are similar to Hex.\n \n Players take turns placing their pieces on one space on the board, with the goal of connecting the opposite sides of the board corresponding to the color of their pieces with a line of pieces.\n \n However, in the first turn, P1 places a piece of their colour as first move. Then, players alternate placing two pieces of their colour per turn. No swap rule is needed. The game is played on a 11x11 board. The game does not use the swap rule. The first player to connect their two sides wins.\n\n###\n\n", "completion": "(game \"Esa Hex\" (players 2) (equipment { (board (hex Diamond 11)) (piece \"Marker\" Each) (regions P1 {(sites Side NE) (sites Side SW)}) (regions P2 {(sites Side NW) (sites Side SE)})}) (rules phases:{ (phase \"Opening\" P1 (play (move Add (to (sites Empty)))) (nextPhase \"Playing\")) (phase \"Playing\" (play (move Add (to (sites Empty)) (then (if (= 0 (count MovesThisTurn)) (moveAgain))))))} (end (if (is Connected Mover) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x5 board. Five counters in each hole. Players take turns sowing in an anti-clockwise direction. When the final counter lands in a hole, the player picks up the contents of the next hole following this one, and continues sowing. If the player cannot pick up any counters from this hole, the players captures any counters from the hole after the empty hole, and the turn ends. Whenever any holes in the player's row contain four counters, they are captured by the player. Play continues until all of the counters have been captured. A new round begins. The players count their captured counters. If the difference between the two players' captured counters is greater than five, for each multiple of five in the difference a hole on the player with fewer counters' side is eliminated from play, and the excess counters that equal a multiple of five are placed aside for use in further rounds if necessary. When the difference is less than five, and when dealing with the remaining pieces after the multiples of five are dealt with, The following scenarios apply. When one player has one counter and the other has four, the player with one will give their stone to the one with four, but the player who has one counter will receive one counter from the hole from which sowing begins at the beginning of each player's turn. When one player has two counters and the other has three, the player with two gives these counters to the other player. With these five, the player creates a \\ \n\n###\n\n", "completion": "(define \"DifferenceCapturedStone\" (abs (- (count Cell at:(handSite P1)) (count Cell at:(handSite P2))))) (define \"OneSeedOnBoard\" (= 1 (count Pieces All in:(union (sites Top) (sites Bottom))))) (define \"PlayableSites\" (sites (values Remembered \"Playable\"))) (define \"PlayFromNextLastHole\" (sites {(\"NextHoleFrom\" (last To afterConsequence:True) \"Track\" 1)})) (define \"NextHoleFrom\" (\"NextSiteOnTrack\" #3 from:#1 #2 #3)) (game \"Khutka Boia\" (players 2) (equipment { (mancalaBoard 2 5 store:None (track \"Track\" \"0,E,N,W\" loop:True)) (piece \"Seed\" Shared) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (hand Each)}) (rules (start { (set Count 5 to:(sites Track)) (set RememberValue \"Playable\" (union (sites Top) (sites Bottom)))}) phases:{ (phase \"Sowing\" (play (or { (or { (move Select (from (if (\"SameTurn\") \"PlayFromNextLastHole\" (sites Mover)) if:(and (is Occupied (from)) (is In (from) (\"PlayableSites\")))) (then (do (if (= 1 (value Player Next)) (fromTo (from (last From)) (to (handSite Mover)) count:1)) next:(sow (last From) apply:(if (is Occupied (\"NextHoleFrom\" (to) \"Track\" 1)) (moveAgain) (if (is Occupied (\"NextHoleFrom\" (to) \"Track\" 2)) (fromTo (from (\"NextHoleFrom\" (to) \"Track\" 2)) (to (handSite Mover)) count:(count at:(\"NextHoleFrom\" (to) \"Track\" 2))))) skipIf:(not (is In (to) (\"PlayableSites\")))))))} (then (and { (forEach Player (forEach Site (sites Player) (if (= 4 (count at:(site))) (fromTo (from (site)) (to (handSite Player)) count:4)))) (forEach Site (sites P1) (if (and (is Occupied (site)) (= 1 (state at:(site)))) (and (fromTo (from (site)) (to (handSite Player)) count:(count at:(site))) (set State at:(site) 1)))) (forEach Site (sites P2) (if (and (is Occupied (site)) (= 2 (state at:(site)))) (and (fromTo (from (site)) (to (handSite Player)) count:(count at:(site))) (set State at:(site) 2))))})))} (then (if (\"OneSeedOnBoard\") (and { (forEach Site (sites P1) (fromTo (from (site)) (to (handSite P1)) count:(count at:(site)))) (forEach Site (sites P2) (fromTo (from (site)) (to (handSite P2)) count:(count at:(site)))) (forEach Site (sites Board) (if (!= 0 (state at:(site))) (set State at:(site) 0))) (set Value P1 0) (set Value P2 0) (forget Value \"Playable\" All)}))))) (end (if (\"NoPieceOnBoard\") { (if (= 0 (count Cell at:(handSite P1))) (result P2 Win)) (if (= 0 (count Cell at:(handSite P2))) (result P1 Win))})) (nextPhase (\"NoPieceOnBoard\") \"BetweenRounds\")) (phase \"BetweenRounds\" (play (if (not (all Sites (sites Mover) if:(is Occupied (site)))) (if (<= 5 (count Cell at:(handSite Mover))) (move (from (handSite Mover)) (to (sites Mover) if:(is Empty (to))) count:5 (then (remember Value \"Playable\" (last To))))))) (nextPhase (all Passed) \"DecisionForNextRound\")) (phase \"DecisionForNextRound\" (play (if (> 5 (\"DifferenceCapturedStone\")) (do (if (= 1 (count Cell at:(handSite P1))) (and (set Value P1 1) (fromTo (from (handSite P1)) (to (handSite P2)) count:1)) (if (= 1 (count Cell at:(handSite P2))) (and (set Value P2 1) (fromTo (from (handSite P2)) (to (handSite P1)) count:1)) (if (= 2 (count Cell at:(handSite P2))) (set Var \"Bha\" 1) (if (= 2 (count Cell at:(handSite P1))) (set Var \"Bha\" 2))))) next:(if (= (var \"Bha\") P1) (move Select (from (intersection (union (sites Left) (sites Right)) (sites P1))) (then (and (set State at:(last To) 1) (set Var \"Bha\" 0)))) (if (= (var \"Bha\") P2) (move Select (from (intersection (union (sites Left) (sites Right)) (sites P2))) (then (and (set State at:(last To) 2) (set Var \"Bha\" 0)))) (move Pass)))) (move Pass))) (nextPhase \"Sowing\"))})) END" }, { "prompt": "Construct a Ludii game based on the following description\nSame rules as Six Men's Morris. \n\n###\n\n", "completion": "(game \"Symbol S.2\" (players 2) (equipment { (board (graph vertices:{ {1 0} {2 0} {0 1} {1 1} {2 1} {3 1} {0 2} {1 2} {2 2} {3 2} {1 3} {2 3}} edges:{ {0 2} {0 3} {3 2} {3 4} {1 4} {4 5} {1 5} {3 7} {4 8} {6 7} {7 8} {8 9} {6 10} {11 9} {10 7} {11 8}}) use:Vertex) (hand Each) (piece \"Marker\" Each (\"StepToEmpty\" ~ (then (\"ReplayIfLine3\"))))}) (rules (start (place \"Marker\" \"Hand\" count:4)) phases:{ (phase \"Placement\" (play (if \"SameTurn\" \"RemoveAnyEnemyPiece\" (move (from (handSite Mover)) (to (sites Empty)) (then (\"ReplayIfLine3\"))))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (phase \"Movement\" (play (if \"SameTurn\" \"RemoveAnyEnemyPiece\" (forEach Piece))))} (end (\"HavingLessPiecesLoss\" Next 2)))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThree players. -> Four players.\n2x2 square pyramidal board. -> 3x3 square pyramidal board.\n(game \"Spava\" (players 3) (equipment { (board (square 2 pyramidal:True) use:Vertex) (piece \"Ball\" Each)}) (rules (play (move Add (to (sites Empty) if:(is Flat)))) (end { (if (is Line (- (count Rows) (layer of:(last To))) SameLayer) (result Mover Win)) (if (is Line (- (- (count Rows) (layer of:(last To))) 1) SameLayer) (result Mover Loss))})))\n\n###\n\n", "completion": "(game \"Spava\" (players 4) (equipment { (board (square 3 pyramidal:True) use:Vertex) (piece \"Ball\" Each)}) (rules (play (move Add (to (sites Empty) if:(is Flat)))) (end { (if (is Line (- (count Rows) (layer of:(last To))) SameLayer) (result Mover Win)) (if (is Line (- (- (count Rows) (layer of:(last To))) 1) SameLayer) (result Mover Loss))}))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a Three Men's Morris board.\n\n###\n\n", "completion": "(define \"ThreeMensMorrisBoard\" (board (\"AlquerqueGraph\" 3 3) use:Vertex)) END" }, { "prompt": "Construct a Ludii game based on the following description\nCheckers-Breakthrough is played on a 8 \u00d7 8 checkers board with checkers pieces. The initial board setup and basic piece movements are the same as in checkers. A checker piece can move either onto a diagonally forward adjacent empty square or jump over a diagonally adjacent opponent piece (possibly repeatedly). Unlike checkers, however, jumps are not mandatory and jumped-over pieces are not captured. The first player to reach the opponent\u2019s backrank wins (thus no king promotions). \n\n###\n\n", "completion": "(define \"ReachedTarget\" (is In (last To) (sites Mover))) (define \"HopMan\" (move Hop (from #1) (directions {FR FL}) (between if:(\"IsEnemyAt\" (between))) (to if:(is Empty (to))) #2)) (game \"Breakthrough Checkers\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (piece \"Counter\" P1 N) (piece \"Counter\" P2 S) (regions P1 (sites Top)) (regions P2 (sites Bottom))}) (rules (start { (place \"Counter1\" (difference (expand (sites Bottom) steps:2) (sites Phase 1))) (place \"Counter2\" (difference (expand (sites Top) steps:2) (sites Phase 1)))}) (play (if \"SameTurn\" (or (\"HopMan\" (last To) (then (\"ReplayIfCanMove\" (\"HopMan\" (last To))))) (move Pass)) (or (forEach Piece \"Counter\" (\"HopMan\" (from) (then (\"ReplayIfCanMove\" (\"HopMan\" (last To)))))) (forEach Piece \"Counter\" (\"StepToEmpty\" (directions {FR FL})))))) (end (if \"ReachedTarget\" (result Mover Win))))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nIf the mover has no legal moves, the mover is winning. This ludemeplex can be used only in an ending condition.\n\n###\n\n", "completion": "(define \"MisereBlockWin\" (if (no Moves Mover) (result Mover Win))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a step move to the forward direction according to the facing direction of the piece in the 'from' location to an empty site.\n\n###\n\n", "completion": "(define \"StepForwardToEmpty\" (move Step Forward (to if:(is Empty (to))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"T'uk T'uk\" (players 2) (equipment { (board (square 6)) (piece \"Marker\" Each (move Slide Orthogonal))}) (rules (start { (place \"Marker1\" (sites Bottom)) (place \"Marker2\" (sites Top))}) (play (forEach Piece)) (end (\"BlockWin\"))))\n\n###\n\n", "completion": "Square grid of 36, 64, 100, or 144 squares. Each player has one piece lined up in each square on opposite sides of the square. Players may move their piece forward or backwards orthogonally any distance. The player who blocks the opponent from being able to move wins. The board is 6x6. END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a regular start board (example: Kaooa).\n\n###\n\n", "completion": "(define \"StarBoard\" (board (splitCrossings (regular Star #1)) use:Vertex)) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game is played on a 10x10 board. -> The game is played on a 14x14 board.\n(game \"Hex\" (players 2) (equipment { (board (hex Diamond 10)) (piece \"Marker\" Each) (regions P1 {(sites Side NE) (sites Side SW)}) (regions P2 {(sites Side NW) (sites Side SE)})}) (rules (meta (swap)) (play (move Add (to (sites Empty)))) (end (if (is Connected Mover) (result Mover Win)))))\n\n###\n\n", "completion": "(game \"Hex\" (players 2) (equipment { (board (hex Diamond 14)) (piece \"Marker\" Each) (regions P1 {(sites Side NE) (sites Side SW)}) (regions P2 {(sites Side NW) (sites Side SE)})}) (rules (meta (swap)) (play (move Add (to (sites Empty)))) (end (if (is Connected Mover) (result Mover Win))))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a move from a region to any empty sites or sites occupied by a larger pieces on the board. This ludemeplex involves stacks and the size of the piece are related to the indexes of the pieces (in the hypothesis that each player has the same number of pieces). Some graphic metadata will be needed to scale the pieces according to this.\n\n###\n\n", "completion": "(define \"MoveToEmptyOrOccupiedByLargerPiece\" (move (from #1) (to (sites Board) if:(and (!= (from) (to)) (or (is Empty (to)) (< (- (what at:(from) level:(topLevel at:(from))) (who at:(from) level:(topLevel at:(from)))) (- (what at:(to) level:(topLevel at:(to))) (who at:(to) level:(topLevel at:(to)))))))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"MoveOne\" (if (can Move (\"Slide\" 1)) (\"Slide\" 1) (move Select (from) (then (moveAgain))))) (define \"MoveTwo\" (if (can Move (\"Slide\" 2)) (\"Slide\" 2) (if (can Move (\"Slide\" 1)) (\"Slide\" 1 (\"MoveAgainIsJumpEnemy\")) (move Select (from) (then (moveAgain)))))) (define \"MoveThree\" (if (can Move (\"Slide\" 3)) (\"Slide\" 3) (if (can Move (\"Slide\" 2)) (\"Slide\" 2 (\"MoveAgainIsJumpEnemy\")) (if (can Move (\"Slide\" 1)) (\"Slide\" 1 (\"MoveAgainIsJumpEnemy\")) (move Select (from) (then (moveAgain))))))) (define \"Slide\" (move Slide (\"Direction\" (from)) (between (exact #1)) (to if:(is Empty (to))) #2)) (define \"MoveAgainIsJumpEnemy\" (then (if (\"IsEnemyAt\" (ahead (last To) (\"Direction\" (last To)))) (moveAgain)))) (define \"Direction\" (if (= 1 (value Piece at:#1)) Forward Backward)) (game \"Squadro\" (players {(player E) (player S)}) (equipment { (board (remove (square 7) vertices:{0 6 42 48}) use:Vertex) (piece \"Minus\" Each (if (= 3 (state at:(from))) \"MoveThree\" (if (= 2 (state at:(from))) \"MoveTwo\" \"MoveOne\"))) (regions \"Home\" P1 (sites Left)) (regions \"Home\" P2 (sites Top)) (regions \"OppositeHome\" P1 (sites Right)) (regions \"OppositeHome\" P2 (sites Bottom)) (map { (pair 39 1) (pair 32 3) (pair 25 2) (pair 18 3) (pair 11 1) (pair 0 3) (pair 1 1) (pair 2 2) (pair 3 1) (pair 4 3)})}) (rules (start { (place \"Minus1\" coord:\"A2\" state:3 value:1) (place \"Minus1\" coord:\"A3\" state:1 value:1) (place \"Minus1\" coord:\"A4\" state:2 value:1) (place \"Minus1\" coord:\"A5\" state:1 value:1) (place \"Minus1\" coord:\"A6\" state:3 value:1) (place \"Minus2\" coord:\"B7\" state:1 value:1) (place \"Minus2\" coord:\"C7\" state:3 value:1) (place \"Minus2\" coord:\"D7\" state:2 value:1) (place \"Minus2\" coord:\"E7\" state:3 value:1) (place \"Minus2\" coord:\"F7\" state:1 value:1)}) (play (if (\"SameTurn\") (move Hop (from (last To)) (between (range 1 (count Columns)) if:(\"IsEnemyAt\" (between)) (apply (fromTo (from (between)) (to (if (is Mover P1) (coord row:(if (= (value Piece at:(between)) 1) (- (count Rows) 1) 0) column:(column of:(between))) (coord row:(row of:(between)) column:(if (= (value Piece at:(between)) 1) 0 (- (count Columns) 1)))))))) (to if:(is Empty (to)))) (forEach Piece) (then (if (is In (last To) (sites Mover \"OppositeHome\")) (and (set Value at:(last To) 2) (set State at:(last To) (mapEntry (last To)))) (if (and (!= (last From) (last To)) (is In (last To) (sites Mover \"Home\"))) (remove (last To))))))) (end (if (= (count Pieces Mover) 1) (result Mover Win)))))\n\n###\n\n", "completion": "Each player starts with their five pieces in troughs on their side of the game board, with players sitting perpendicular to one another. When you move a piece, you move it a distance based on the strength indicated in the trough that you're leaving. Once the piece has made its way across the board, you move it back based on the strength on the other side. If you pass over an opposing piece while moving, then that opposing piece must return to its last departing base and your moving piece advances one cell further than where the opposing piece was.\n \n To win Squadro, you need to be the first player to make a return trip with four of your five pieces. END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a sequence of hop move in all the diagonal directions over an enemy to an empty site. \n\n###\n\n", "completion": "(define \"HopDiagonalSequenceCapture\" (move Hop Diagonal (between #1 #2 if:(\"IsEnemyAt\" (between)) (apply (remove (between) #3))) (to if:(is Empty (to))) (then (if (can Move (hop (from (last To)) Diagonal (between #1 #2 if:(and (not (is In (between) (sites ToClear))) (\"IsEnemyAt\" (between)))) (to if:(is Empty (to))))) (moveAgain))))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nReturns the index of the opposite pit on a two rows mancala board. This ludemeplex is working only if the description is defining \"Columns\" as the number of holes of the board.\n\n###\n\n", "completion": "(define \"OppositePitTwoRows\" (if (is In #1 (sites Bottom)) (+ #1 \"Columns\") (- #1 \"Columns\"))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"PiecesOwnedBy\" (+ (count at:(mapEntry #1)) (count in:(sites #1)))) (define \"Columns\" 6) (game \"Kalah\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" (track \"Track\" \"0,ESE,E,ENE,WNW,N,W\" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 LastSite) (pair P2 FirstSite)}) (piece \"Seed\" Shared)}) (rules (start (set Count 4 to:(union (sites P1) (sites P2)))) (play (move Select (from (sites Mover) if:(> (count at:(from)) 0)) (then (sow apply:(if (= (to) (mapEntry (mover))) (moveAgain) (if (and { (is In (to) (sites Mover)) (= (count at:(to)) 1) (> (count at:(\"OppositePit\" (to))) 0)}) (and (fromTo (from (to)) (to (mapEntry (mover))) count:(count at:(to))) (fromTo (from (\"OppositePit\" (to))) (to (mapEntry (mover))) count:(count at:(\"OppositePit\" (to))))))) skipIf:(= (to) (mapEntry (next))))))) (end (\"MancalaByScoreWhen\" (no Moves Mover)))))\n\n###\n\n", "completion": "The board has two rows of six holes with a larger hole on either end. Play begins with four seeds in each hole. Each player controls the row nearest them. Seeds are sown consecutively in a counterclockwise pattern including the player's own larger hole but not the opponent's. If the last seed is placed in an opponent's empty hole, that seed and any opposite are captured and put in the player's larger hole. If the last seed falls in the larger hole, the player gets another turn. When one player has no seeds in any of their holes, the game ends. The other player captures all of the other seeds, and the player with the most captured seeds wins. END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a sequence of hop move in all the rotational directions over an enemy to an empty site from the last ``to'' location of the previous move. \n\n###\n\n", "completion": "(define \"HopRotationalSequenceCaptureAgain\" (move Hop (from (last To)) Rotational (between #1 #2 if:(and (not (is In (between) (sites ToClear))) (\"IsEnemyAt\" (between))) (apply (remove (between) #3))) (to if:(is Empty (to))) (then (if (can Move (hop (from (last To)) Rotational (between #1 #2 if:(and (not (is In (between) (sites ToClear))) (\"IsEnemyAt\" (between)))) (to if:(is Empty (to))))) (moveAgain))))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nReturns the direction between the last `from' location and the last `to' location.\n\n###\n\n", "completion": "(define \"LastDirection\" (directions #1 from:(last From) to:(last To))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nIf the next player is checkmate, the mover is winning. This ludemeplex can be used only in an ending condition.\n\n###\n\n", "completion": "(define \"Checkmate\" (if (and (\"IsInCheck\" #1 Next) (not (can Move (do (forEach Piece Next) ifAfterwards:(not (\"IsInCheck\" #1 Next)))))) (result Mover Win))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThree concentric squares, with lines connecting the midpoints of the sides. Nine pieces per player. Players alternate turns placing a piece on the board. When a player places three of their pieces in a line of three along one of the lines on the board, they capture one of the opponent's pieces. When all of the pieces have been placed, players alternate turns moving one of their pieces to an adjacent empty spot on the board. Players cannot capture one of their opponent's pieces which is in a three-in-a-row alignment. The player who either captures seven of their opponent's pieces or blocks the opponent from being able to move wins. \n\n###\n\n", "completion": "(define \"RemoveEnemyPiece\" (if (can Move (\"RemoveAnyEnemyPieceNotInLine3\" Orthogonal)) (\"RemoveAnyEnemyPieceNotInLine3\" Orthogonal) (\"RemoveAnyEnemyPiece\"))) (game \"La Chascona\" (players 2) (equipment { (\"NineMensMorrisBoard\") (hand Each) (piece \"Marker\" Each (\"StepToEmpty\" ~ (then (\"ReplayIfLine3\" Orthogonal exact:True))))}) (rules (start (place \"Marker\" \"Hand\" count:9)) phases:{ (phase \"Placement\" (play (if \"SameTurn\" \"RemoveEnemyPiece\" (move (from (handSite Mover)) (to (sites Empty)) (then (\"ReplayIfLine3\" Orthogonal exact:True))))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (phase \"Movement\" (play (if \"SameTurn\" \"RemoveEnemyPiece\" (forEach Piece))))} (end (if (or (no Moves Next) (<= (count Pieces Next) 2)) (result Mover Win))))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines backgammon tracks following the same direction for each player but starting from opposite corners.\n\n###\n\n", "completion": "(define \"BackgammonTracksSameDirectionOppositeCorners\" { (track \"Track1\" {0..5 7..12 25..20 18..13 #1} P1 directed:True) (track \"Track2\" {25..20 18..13 0..5 7..12 #1} P2 directed:True)}) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6 board. Four counters in each hole. Players draw lots to see who goes first. Players pick up the counters in any of the holes in their row and sow them in an anti-clockwise direction. If the last counter falls into a hole that is occupied, the player picks up the contents of this hole and continues to sow. When the last counter falls into an empty hole, the play ends. Capturing occurs when the last counter falls into a hole on the opponent's side of the board containing three counters, increasing it to four. This hole then belongs to the player who captured it. A player cannot pick up counters from this hole, and the opponent can only do so if the last counter of their sowing falls there, in which case the opponent takes one counter from it, along with the final counter. The captured hole remains in the ownership of the person who captured it. If it remains empty and the opponent drops their last counter into this hole, the last counter is removed. If a player cannot move, they pass, but the opponent may continue to make moves. The player could then resume play if the opponent's moves create a possibility for a move. Play ends when there are no more counters available to move. Each player owns the counters in their captured holes or which they have removed from the board. A second round is played, each player placing four counters into each hole starting from the rightmost hole in their row. The player with more counters gains a hole from their opponent for every four extra balls they've captured. If an opponent has three extra after counting in such a way, they also gain a hole, but not if there are one or two extra. Play continues in several rounds like this until one player takes all the counters. Each row has 6 holes.\n\n###\n\n", "completion": "(define \"RememberOwnedHolesRandom\" (if (< 50 (value Random (range 1 100))) (remember Value \"OwnedP1\" #1) (remember Value \"OwnedP2\" #1))) (define \"NextHole\" (\"NextSiteOnTrack\" #3 from:#1 #2)) (define \"SitesMarkedBy\" (forEach (sites Board) if:(= #1 (state at:(site))))) (define \"RightMostEmpty\" (trackSite FirstSite \"TrackCW\" from:(mapEntry \"RightMost\" Mover) if:(is Empty (to)))) (define \"OnlyPiecesInMarked\" (all Sites (forEach (sites Board) if:(= 0 (state at:(site)))) if:(= 0 (count at:(site))))) (define \"RemmemberOwnedHoles\" (if (is Mover P1) (remember Value \"OwnedP1\" #1) (remember Value \"OwnedP2\" #1))) (define \"OwnedHoles\" (if (is Mover P1) (sites (values Remembered \"OwnedP1\")) (sites (values Remembered \"OwnedP2\")))) (game \"Gabata (Shoa I)\" (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) (hand Each) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map \"RightMost\" {(pair P1 5) (pair P2 6)})}) (rules (start { (set RememberValue \"OwnedP1\" (sites Bottom)) (set RememberValue \"OwnedP2\" (sites Top)) (set Count 4 to:(sites Track))}) phases:{ (phase \"Sowing\" (play (or { (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (\"OwnedHoles\")) if:(and (< 0 (count at:(from))) (= 0 (state at:(from))))) (then (sow \"TrackCCW\" apply:(if (and (= 0 (state at:(to))) (= 4 (count at:(to)))) (set State at:(to) (mover)) (if (< 1 (count at:(to))) (if (= 0 (state at:(to))) (and (moveAgain) (set Var \"Replay\" (to))) (if (!= (mover) (state at:(to))) (and (fromTo (from (to)) (to (handSite Mover)) count:(min 2 (count at:(to)))) (set State at:(to) (state at:(to)))))))))))} (then (if (\"OnlyPiecesInMarked\") (and { (forEach Site (\"SitesMarkedBy\" 1) (fromTo (from (site)) (to (handSite P1)) count:(count at:(site)))) (forEach Site (\"SitesMarkedBy\" 2) (fromTo (from (site)) (to (handSite P2)) count:(count at:(site)))) (forget Value \"OwnedP1\" All) (forget Value \"OwnedP2\" All) (set Var \"Round\" (+ 1 (var \"Round\")))}))))) (end (if (\"NoPieceOnBoard\") { (if (>= 1 (count Cell at:(handSite P1))) (result P2 Win)) (if (>= 1 (count Cell at:(handSite P2))) (result P1 Win))})) (nextPhase (\"NoPieceOnBoard\") \"BetweenRounds\")) (phase \"BetweenRounds\" (play (if (<= 4 (count Cell at:(handSite Mover))) (move (from (handSite Mover)) (to (\"RightMostEmpty\")) count:4 (then (and { (\"RemmemberOwnedHoles\" (last To)) (if (<= 4 (count Cell at:(handSite Mover))) (moveAgain) (if (= 3 (count Cell at:(handSite Mover))) (and { (fromTo (from (handSite Mover)) (to (\"RightMostEmpty\")) count:3) (fromTo (from (handSite Next)) (to (\"RightMostEmpty\")) count:1) (\"RemmemberOwnedHoles\" (\"RightMostEmpty\"))}) (if (= 2 (count Cell at:(handSite Mover))) (and { (fromTo (from (handSite Mover)) (to (\"RightMostEmpty\")) count:2) (fromTo (from (handSite Next)) (to (\"RightMostEmpty\")) count:2) (\"RememberOwnedHolesRandom\" (\"RightMostEmpty\"))}))))}))) (then (if (and (is Empty (handSite P1)) (is Empty (handSite P2))) (and (if (is Even (var \"Round\")) (set NextPlayer (player 2)) (set NextPlayer (player 1))) (set Pending)))))) (nextPhase (and (is Empty (handSite P1)) (is Empty (handSite P2))) \"Sowing\"))})) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game has 3 players. -> The game has 4 players.\n(define \"MoveOn\" (if (\"IsNotOffBoard\" #1) (if (or (is Empty #1) (and (\"IsEnemyAt\" #1) (or (= (value Player Mover) (value Player (who at:#1))) (\"IsOffBoard\" (value Player Mover))))) (move (from (from) level:(level)) (to #1 \"CaptureEnemyPiece\"))) #2)) (define \"CaptureEnemyPiece\" (apply if:(\"IsEnemyAt\" (to)) (and (fromTo (from (to)) (to \"Goal\")) (set Value (player (who at:(to))) Off)))) (define \"Goal\" 0) (define \"RememberSelectedTrack\" (then (if (\"IsOffBoard\" (value Player Mover)) #1))) (define \"SelectCCW\" (set Value Mover 2)) (define \"SelectCW\" (set Value Mover 1)) (define \"SiteToMoveOnTrackCCW\" (\"NextSiteOnTrack\" (\"ThrowValue\") \"TrackCCW\")) (define \"SiteToMoveOnTrackCW\" (\"NextSiteOnTrack\" (\"ThrowValue\") \"TrackCW\")) (define \"SiteToMoveOnSelectedTrack\" (if (= (value Player Mover) 2) (\"NextSiteOnTrack\" (\"ThrowValue\") \"TrackCCW\") (\"NextSiteOnTrack\" (\"ThrowValue\") \"TrackCW\"))) (define \"ThrowValue\" (mapEntry \"ThrowDiceValue\" (count Pips))) (game \"Tugi-Epfe\" (players 3) (equipment { (board (merge { (rectangle 1 11) (rectangle 11 1) (shift 0 10 (rectangle 1 11)) (shift 10 0 (rectangle 11 1))}) { (track \"TrackCW\" {0 10..19 20..29 39..30 9..0} directed:True) (track \"TrackCCW\" {0..9 30..39 29..20 19..10 0} directed:True)} use:Edge) (dice d:2 facesByDie:{{0 10} {0 1} {0 1}} num:3) (map \"ThrowDiceValue\" { (pair 0 5) (pair 12 5) (pair 2 1) (pair 1 3) (pair 10 15) (pair 11 15)}) (piece \"Horse\" Each (if (\"IsOffBoard\" (value Player Mover)) (or (\"MoveOn\" (\"SiteToMoveOnTrackCW\") (\"RememberSelectedTrack\" (\"SelectCW\"))) (\"MoveOn\" (\"SiteToMoveOnTrackCCW\") (\"RememberSelectedTrack\" (\"SelectCCW\")))) (\"MoveOn\" \"SiteToMoveOnSelectedTrack\"))) (regions \"AllSites\" (sites Board))}) (rules (start (place Stack items:{\"Horse3\" \"Horse2\" \"Horse1\"} 0)) (play (\"RollMove\" (forEach Piece) (then (if (= (last To) (\"Goal\")) (remove (last To)))))) (end (\"EscapeWin\"))))\n\n###\n\n", "completion": "(define \"MoveOn\" (if (\"IsNotOffBoard\" #1) (if (or (is Empty #1) (and (\"IsEnemyAt\" #1) (or (= (value Player Mover) (value Player (who at:#1))) (\"IsOffBoard\" (value Player Mover))))) (move (from (from) level:(level)) (to #1 \"CaptureEnemyPiece\"))) #2)) (define \"CaptureEnemyPiece\" (apply if:(\"IsEnemyAt\" (to)) (and (fromTo (from (to)) (to \"Goal\")) (set Value (player (who at:(to))) Off)))) (define \"Goal\" 0) (define \"RememberSelectedTrack\" (then (if (\"IsOffBoard\" (value Player Mover)) #1))) (define \"SelectCCW\" (set Value Mover 2)) (define \"SelectCW\" (set Value Mover 1)) (define \"SiteToMoveOnTrackCCW\" (\"NextSiteOnTrack\" (\"ThrowValue\") \"TrackCCW\")) (define \"SiteToMoveOnTrackCW\" (\"NextSiteOnTrack\" (\"ThrowValue\") \"TrackCW\")) (define \"SiteToMoveOnSelectedTrack\" (if (= (value Player Mover) 2) (\"NextSiteOnTrack\" (\"ThrowValue\") \"TrackCCW\") (\"NextSiteOnTrack\" (\"ThrowValue\") \"TrackCW\"))) (define \"ThrowValue\" (mapEntry \"ThrowDiceValue\" (count Pips))) (game \"Tugi-Epfe\" (players 4) (equipment { (board (merge { (rectangle 1 11) (rectangle 11 1) (shift 0 10 (rectangle 1 11)) (shift 10 0 (rectangle 11 1))}) { (track \"TrackCW\" {0 10..19 20..29 39..30 9..0} directed:True) (track \"TrackCCW\" {0..9 30..39 29..20 19..10 0} directed:True)} use:Edge) (dice d:2 facesByDie:{{0 10} {0 1} {0 1}} num:3) (map \"ThrowDiceValue\" { (pair 0 5) (pair 12 5) (pair 2 1) (pair 1 3) (pair 10 15) (pair 11 15)}) (piece \"Horse\" Each (if (\"IsOffBoard\" (value Player Mover)) (or (\"MoveOn\" (\"SiteToMoveOnTrackCW\") (\"RememberSelectedTrack\" (\"SelectCW\"))) (\"MoveOn\" (\"SiteToMoveOnTrackCCW\") (\"RememberSelectedTrack\" (\"SelectCCW\")))) (\"MoveOn\" \"SiteToMoveOnSelectedTrack\"))) (regions \"AllSites\" (sites Board))}) (rules (start (place Stack items:{\"Horse4\" \"Horse3\" \"Horse2\" \"Horse1\"} 0)) (play (\"RollMove\" (forEach Piece) (then (if (= (last To) (\"Goal\")) (remove (last To)))))) (end (\"EscapeWin\")))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nChecks if a site is phase 1.\n\n###\n\n", "completion": "(define \"IsPhaseOne\" (= 1 (phase of:#1))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe game can be played by two, three, four, or six people. It is played on a board that is shaped like a six-pointed star with 121 holes for the pieces. Each point of the star has ten colored spheres and the goal of the game is to move all of one's pieces into the opposite point of the star. Players can move a piece to one adjacent hole, or can jump either their own or opponent's pieces. This does not result in capturing, and jumping is not mandatory. When fewer than six people play, players can play with only one color of pieces, but if two or three people play they can use more than one color, but each player must use an equal number of pieces. Six players occupy home regions (standard game). The game is played on a board of size 4.\n\n###\n\n", "completion": "(define \"Dim\" 4) (define \"HopSequence\" (\"Hop\" #1 (then (if (can Move (\"Hop\" (last To))) (moveAgain))))) (define \"Hop\" (move Hop (from #1) (between if:(is Occupied (between))) (to if:(and (\"IsEmptyAndNotVisited\" (to)) (or (not (\"FromIsOnTheRegionToFill\" #1)) (\"ToIsOnTheRegionToFill\" (to))))) #2)) (define \"ToIsOnTheRegionToFill\" (is In #1 (sites (player (mapEntry (mover)))))) (define \"FromIsOnTheRegionToFill\" (is In #1 (sites (player (mapEntry (mover)))))) (game \"Chinese Checkers\" (players 6) (equipment { (board (hex Star (\"Dim\"))) (piece \"Marker\" Each) (regions \"Home\" P1 (expand origin:(coord row:0 column:(\"Dim\")) steps:(- (\"Dim\") 1))) (regions \"Home\" P2 (expand origin:(coord row:(\"Dim\") column:(* (\"Dim\") 3)) steps:(- (\"Dim\") 1))) (regions \"Home\" P3 (expand origin:(coord row:(* (\"Dim\") 3) column:(* (\"Dim\") 4)) steps:(- (\"Dim\") 1))) (regions \"Home\" P4 (expand origin:(coord row:(* (\"Dim\") 4) column:(* (\"Dim\") 3)) steps:(- (\"Dim\") 1))) (regions \"Home\" P5 (expand origin:(coord row:(* (\"Dim\") 3) column:(\"Dim\")) steps:(- (\"Dim\") 1))) (regions \"Home\" P6 (expand origin:(coord row:(\"Dim\") column:0) steps:(- (\"Dim\") 1))) (map {(pair 1 4) (pair 2 5) (pair 3 6) (pair 4 1) (pair 5 2) (pair 6 3)})}) (rules (start { (place \"Marker1\" (sites P1)) (place \"Marker2\" (sites P2)) (place \"Marker3\" (sites P3)) (place \"Marker4\" (sites P4)) (place \"Marker5\" (sites P5)) (place \"Marker6\" (sites P6))}) phases:{ (phase \"Movement\" (play (forEach Piece (or (\"HopSequence\" (from)) (move Step (to if:(and (is Empty (to)) (or (not (\"FromIsOnTheRegionToFill\" (from))) (\"ToIsOnTheRegionToFill\" (to))))))))) (nextPhase (is Mover (next)) \"MultiJump\")) (phase \"MultiJump\" (play (or (\"HopSequence\" (last To)) (move Pass))) (nextPhase (not (is Mover (next))) \"Movement\"))} (end (\"FillWin\" (sites (player (mapEntry (mover)))))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nOrder 5 Board -> Order 9 Board\n(define \"Order\" 5) (define \"Goal\" (or (is Connected at:(regionSite (sites Column Cell 0) index:0) Orthogonal { (sites Column (+ \"Order\" 1)) (sites Column 0)}) (is Connected at:(regionSite (sites Row Cell 0) index:0) Orthogonal { (sites Row (+ \"Order\" 1)) (sites Row 0)}))) (define \"GamePlay\" (if (\"NewTurn\") (do (\"Placements\") ifAfterwards:(or { \"NoCrosscuts\" (can Move (do (\"TouchingPlacements\") ifAfterwards:(\"NoCrosscuts\")))}) (then (moveAgain))) (do (\"TouchingPlacements\") ifAfterwards:(\"NoCrosscuts\") (then (forget Value All))))) (define \"NoCrosscuts\" (= (size Array (sizes Group Orthogonal Mover)) (size Array (sizes Group All Mover)))) (define \"Placements\" (or { (move Add (piece (id \"Square\" Mover)) (to (sites Empty)) (then (if (\"NewTurn\") (remember Value (last To))))) (move Select (from Edge (sites Board Edge) if:(no Pieces All in:(sites Incident Cell of:Edge at:(from)))) (then (forEach Site (sites Incident Cell of:Edge at:(last From)) (and (add (piece (id \"Square\" Mover)) (to (site))) (if (\"NewTurn\") (remember Value (site))))))) (if (\"SameTurn\") (move Pass))})) (define \"TouchingPlacements\" (or { (move Add (piece (id \"Square\" Mover)) (to Cell \"EmptyCellsAroundPiecesPlaced\")) (move Select (from Edge (forEach of:\"EmptyCellsAroundPiecesPlaced\" (sites Incident Edge of:Cell at:(site))) if:(no Pieces All in:(sites Incident Cell of:Edge at:(from)))) (then (add (piece (id \"Square\" Mover)) (to Cell (sites Incident Cell of:Edge at:(last From))))))})) (define \"EmptyCellsAroundPiecesPlaced\" (intersection (sites Around (sites (values Remembered)) Orthogonal) (sites Empty))) (game \"Allemande\" (players 2) (equipment { (board (remove (square (+ 2 \"Order\")) cells:{0 (+ \"Order\" 1) (* (+ \"Order\" 2) (+ \"Order\" 1)) (- (^ (+ \"Order\" 2) 2) 1)}) use:Cell) (regions \"EW\" P1 (union (sites Column (+ \"Order\" 1)) (sites Column 0))) (regions \"NS\" P2 (union (sites Row (+ \"Order\" 1)) (sites Row 0))) (piece \"Square\" Each) (hand Each size:4)}) (rules (start { (place \"Square1\" (union (sites Column (+ \"Order\" 1)) (sites Column 0))) (place \"Square2\" (union (sites Row (+ \"Order\" 1)) (sites Row 0)))}) (play \"GamePlay\") (end (if \"Goal\" (result Mover Win)))))\n\n###\n\n", "completion": "(define \"Order\" 9) (define \"Goal\" (or (is Connected at:(regionSite (sites Column Cell 0) index:0) Orthogonal { (sites Column (+ \"Order\" 1)) (sites Column 0)}) (is Connected at:(regionSite (sites Row Cell 0) index:0) Orthogonal { (sites Row (+ \"Order\" 1)) (sites Row 0)}))) (define \"GamePlay\" (if (\"NewTurn\") (do (\"Placements\") ifAfterwards:(or { \"NoCrosscuts\" (can Move (do (\"TouchingPlacements\") ifAfterwards:(\"NoCrosscuts\")))}) (then (moveAgain))) (do (\"TouchingPlacements\") ifAfterwards:(\"NoCrosscuts\") (then (forget Value All))))) (define \"NoCrosscuts\" (= (size Array (sizes Group Orthogonal Mover)) (size Array (sizes Group All Mover)))) (define \"Placements\" (or { (move Add (piece (id \"Square\" Mover)) (to (sites Empty)) (then (if (\"NewTurn\") (remember Value (last To))))) (move Select (from Edge (sites Board Edge) if:(no Pieces All in:(sites Incident Cell of:Edge at:(from)))) (then (forEach Site (sites Incident Cell of:Edge at:(last From)) (and (add (piece (id \"Square\" Mover)) (to (site))) (if (\"NewTurn\") (remember Value (site))))))) (if (\"SameTurn\") (move Pass))})) (define \"TouchingPlacements\" (or { (move Add (piece (id \"Square\" Mover)) (to Cell \"EmptyCellsAroundPiecesPlaced\")) (move Select (from Edge (forEach of:\"EmptyCellsAroundPiecesPlaced\" (sites Incident Edge of:Cell at:(site))) if:(no Pieces All in:(sites Incident Cell of:Edge at:(from)))) (then (add (piece (id \"Square\" Mover)) (to Cell (sites Incident Cell of:Edge at:(last From))))))})) (define \"EmptyCellsAroundPiecesPlaced\" (intersection (sites Around (sites (values Remembered)) Orthogonal) (sites Empty))) (game \"Allemande\" (players 2) (equipment { (board (remove (square (+ 2 \"Order\")) cells:{0 (+ \"Order\" 1) (* (+ \"Order\" 2) (+ \"Order\" 1)) (- (^ (+ \"Order\" 2) 2) 1)}) use:Cell) (regions \"EW\" P1 (union (sites Column (+ \"Order\" 1)) (sites Column 0))) (regions \"NS\" P2 (union (sites Row (+ \"Order\" 1)) (sites Row 0))) (piece \"Square\" Each) (hand Each size:4)}) (rules (start { (place \"Square1\" (union (sites Column (+ \"Order\" 1)) (sites Column 0))) (place \"Square2\" (union (sites Row (+ \"Order\" 1)) (sites Row 0)))}) (play \"GamePlay\") (end (if \"Goal\" (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nSpiral shaped board. Up to six players. Each player has six round pieces and two lions. The rules are describing with the Kendall ruleset.\n\n###\n\n", "completion": "(define \"LetInLion\" (move (from (handSite Mover 1)) (to \"Entry\"))) (define \"HaveLionToPlace\" (is Occupied (handSite Mover 1))) (define \"EntryEmptyOrOccupiedByEnemy\" (not (\"IsFriendAt\" \"Entry\"))) (define \"LetInDisc\" (move (from (handSite Mover)) (to \"Entry\"))) (define \"HaveDiscToPlace\" (is Occupied (handSite Mover))) (define \"EntryEmpty\" (is Empty \"Entry\")) (define \"LionMoveOn\" (if (and (\"IsNotOffBoard\" (\"SiteToMoveOnTrackForLion\" #1)) (\"IsNotEndTrack\" (\"SiteToMoveOnTrackForLion\" #1))) (if (not (\"IsFriendAt\" (trackSite Move #1 steps:(mul (count Pips) 2)))) (move (from) (to (trackSite Move #1 steps:(mul (count Pips) 2))))))) (define \"AdvanceOn\" (if (\"IsNotOffBoard\" (\"SiteToMoveOnTrack\" #1)) (if (is In (\"SiteToMoveOnTrack\" #1) (sites Empty)) (move (from) (to (\"SiteToMoveOnTrack\" #1)))))) (define \"PromoteToLion\" (then (and (remove (last To)) (add (piece (id \"Lion\" Mover)) (to (handSite Mover 1)))))) (define \"PieceNowMoveToTheEntry\" (then (and (remove (last To)) (add (piece (id \"Marker\" Mover)) (to 0))))) (define \"EntryReachedFromInside\" (\"IsEndTrack\" (\"NextSiteOnTrack\" (count Pips) \"OppositeTrack\"))) (define \"EmptyCentralSpaceReached\" (and (\"IsEndTrack\" (\"SiteToMoveOnTrack\")) (is Empty \"BeginOuterTrack\"))) (define \"SiteToMoveOnTrackForLion\" (\"NextSiteOnTrack\" (* (count Pips) 2) #1)) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" (count Pips) #1)) (define \"BeginOuterTrack\" 0) (define \"EndInnerTrack\" 1) (define \"Entry\" 87) (game \"Mehen\" (players 2) (equipment { (board (spiral turns:5 sites:88) { (track \"NormalTrack\" {\"Entry\"..\"EndInnerTrack\" End} directed:True) (track \"OppositeTrack\" {\"BeginOuterTrack\"..\"Entry\" End} directed:True)} use:Vertex) (\"StickDice\" 4) (hand Each size:2) (piece \"Disc\" Each (if (\"EmptyCentralSpaceReached\") (move Select (from) (\"PieceNowMoveToTheEntry\")) (\"AdvanceOn\" \"NormalTrack\"))) (piece \"Marker\" Each (if (\"EntryReachedFromInside\") (move Select (from) (\"PromoteToLion\")) (\"AdvanceOn\" \"OppositeTrack\"))) (piece \"Lion\" Each (or (\"LionMoveOn\" \"OppositeTrack\") (\"LionMoveOn\" \"NormalTrack\")))}) (rules (start { (place \"Disc1\" (handSite P1) count:6) (place \"Disc2\" (handSite P2) count:6)}) (play (\"RollMove\" (or { (if (and { (= (count Pips) 1) (\"EntryEmpty\") (\"HaveDiscToPlace\")}) (\"LetInDisc\")) (if (and { (= (count Pips) 1) (\"EntryEmptyOrOccupiedByEnemy\") (\"HaveLionToPlace\")}) (\"LetInLion\")) (forEach Piece)}))) (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nPlayed on a size 3 board. -> Played on a size 4 board.\n(game \"Y\" (players 2) (equipment { (board (hex Triangle 3)) (piece \"Disc\")}) (rules (play (move Add (to (sites Empty)))) (end (if (is Connected 3 Sides) (result Mover Win)))))\n\n###\n\n", "completion": "(game \"Y\" (players 2) (equipment { (board (hex Triangle 4)) (piece \"Disc\")}) (rules (play (move Add (to (sites Empty)))) (end (if (is Connected 3 Sides) (result Mover Win))))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nChecks if a player has no legal moves and the game ends in a draw.\n\n###\n\n", "completion": "(define \"DrawIfNoMoves\" (if (no Moves #1) (result Mover Draw))) END" }, { "prompt": "What does the following global Ludii definition do?\n(define \"HopOrthogonalCapture\" (move Hop Orthogonal (between if:(\"IsEnemyAt\" (between)) (apply (remove (between)))) (to if:(is Empty (to)))))\n\n###\n\n", "completion": "Defines a hop move in all the orthogonal directions over an enemy to an empty site. The enemy piece is removed. END" }, { "prompt": "Construct a Ludii game based on the following description\nLike regular Chess, but player wins, if any of his pieces reach the last rank of the enemy. Check still applies, but Checkmate only forces to pass. \n\n###\n\n", "completion": "(define \"InitialPawnMove\" (if (is In (from) (sites Start (piece (what at:(from))))) (\"DoubleStepForwardToEmpty\" \"SetEnPassantLocation\"))) (define \"EnPassant\" (move Step (directions {FR FL}) (to if:\"InLocationEnPassant\") (then (remove (ahead (last To) Backward))))) (define \"InLocationEnPassant\" (and (is Pending) (= (to) (value Pending)))) (define \"SetEnPassantLocation\" (then (set Pending (ahead (last To) Backward)))) (define \"Castling\" (if (and (\"HasNeverMoved\" \"King\") (not (\"IsInCheck\" \"King\" Mover))) (or (if (and (\"HasNeverMoved\" \"RookLeft\") (can Move (\"CastleRook\" \"RookLeft\" E 3 (is Empty (to))))) \"BigCastling\") (if (and (\"HasNeverMoved\" \"RookRight\") (can Move (\"CastleRook\" \"RookRight\" W 2 (is Empty (to))))) \"SmallCastling\")))) (define \"BigCastling\" (\"DecideToCastle\" \"King\" W 2 \"KingNotCheckedAndToEmpty\" (then (\"CastleRook\" \"RookLeft\" E 3 True)))) (define \"SmallCastling\" (\"DecideToCastle\" \"King\" E 2 \"KingNotCheckedAndToEmpty\" (then (\"CastleRook\" \"RookRight\" W 2 True)))) (define \"CastleRook\" (slide (from (mapEntry #1 (mover))) #2 (between (exact #3) if:#4) (to if:True (apply (\"PieceHasMoved\" (from)))))) (define \"DecideToCastle\" (move Slide (from (mapEntry #1 (mover))) #2 (between (exact #3) if:#4) (to if:True (apply (\"PieceHasMoved\" (from)))) #5)) (define \"KingNotCheckedAndToEmpty\" (and (is Empty (to)) (not (\"IsInCheck\" \"King\" Mover at:(to))))) (define \"RememberPieceHasMoved\" (then (if (= (state at:(last To)) 1) (\"PieceHasMoved\" (last To))))) (define \"PieceHasMoved\" (set State at:#1 0)) (define \"HasNeverMoved\" (= (state at:(mapEntry #1 (mover))) 1)) (game \"Reach Chess\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (\"ChessPawn\" \"Pawn\" (or \"InitialPawnMove\" \"EnPassant\") (then (and (if (is In (last To) (sites Mover \"Promotion\")) (moveAgain)) (set Counter)))) (\"ChessRook\" \"Rook\" (then (set Counter)) (\"RememberPieceHasMoved\")) (\"ChessKing\" \"King\" (then (set Counter)) (\"RememberPieceHasMoved\")) (\"ChessBishop\" \"Bishop\" (then (set Counter))) (\"ChessKnight\" \"Knight\" (then (set Counter))) (\"ChessQueen\" \"Queen\" (then (set Counter))) (map \"King\" {(pair 1 \"E1\") (pair 2 \"E8\")}) (map \"RookLeft\" {(pair 1 \"A1\") (pair 2 \"A8\")}) (map \"RookRight\" {(pair 1 \"H1\") (pair 2 \"H8\")}) (regions \"Promotion\" P1 (sites Top)) (regions \"Promotion\" P2 (sites Bottom))}) (rules (start { (place \"Pawn1\" (sites Row 1)) (place \"Pawn2\" (sites Row 6)) (place \"Rook1\" {\"A1\" \"H1\"} state:1) (place \"Knight1\" {\"B1\" \"G1\"}) (place \"Bishop1\" {\"C1\" \"F1\"}) (place \"Queen1\" coord:\"D1\") (place \"King1\" coord:\"E1\" state:1) (place \"Rook2\" {\"A8\" \"H8\"} state:1) (place \"Knight2\" {\"B8\" \"G8\"}) (place \"Bishop2\" {\"C8\" \"F8\"}) (place \"Queen2\" coord:\"D8\") (place \"King2\" coord:\"E8\" state:1)}) (play (if \"SameTurn\" (move Promote (last To) (piece {\"Queen\" \"Knight\" \"Bishop\" \"Rook\"}) Mover) (do (or (forEach Piece) (\"Castling\")) ifAfterwards:(not (\"IsInCheck\" \"King\" Mover))))) (end (if (is Connected Mover) (result Mover Win))))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a piece moving like a knight in Chess.\n\n###\n\n", "completion": "(define \"ChessKnight\" (piece #1 Each (\"LeapCapture\" \"KnightWalk\" #2 #3))) END" }, { "prompt": "Construct a Ludii game based on the following description\n5x5 board, marked with an X in the central square and the midpoints of the outer circuit of spaces. Four players. Four pieces per player. Four seeds, with one white side and one dark side, used as dice. The values of the throws are equal to the number of white sides up, except when no white sides are up the throw equals 8. Throws of 1, 4, and 8 grant the player another throw. Players make all of the throws in their turn first, and then move the values of the throws individually. A player cannot subdivide the value of a single throw between pieces, but may move more than one piece in a turn if they have multiple throws, moving a piece the value of an entire throw. Pieces may only enter the board with a throw of 1. When a player has no pieces on the board, throws made before a throw of 1 do not count and cannot be played. Pieces enter on the marked square on the outer track of the square in front of the player. Pieces move anticlockwise around the outer squares of the board until they reach the square just before the square from which they started, then moving to the inner track and moving clockwise, and then onto the central square. Multiple pieces may occupy the same square. If a player's piece lands on a spot occupied by an opponent's piece, the opponent's piece is removed from the board and must be entered again. If the opponent has multiple pieces on this spot, they all are sent to the beginning. Sending an opponent's piece off the board grants the player another throw. Pieces on marked squares cannot be sent off the board. If a player has two pieces on the marked square on the opposite side of the board from the one in which they begin, the player may declare these as a twin which then play as one piece. Twins move half the value of a throw, rounding down. Twins may only be sent off the board by another twin. Twins may not send back to start a single piece belonging to an opponent. When sent off the board, the twins enter the board again as single pieces. When the twin reaches the central space, it becomes two single pieces again. When all of a player's pieces are in the central square, they may begin bearing them off. A throw of 1 is required to bear a piece off. The player who bears off all their pieces first wins. \n\n###\n\n", "completion": "(define \"Move\" (if (or (\"NewTurn\") (\"HasToThrowAgain\")) (\"RollMove\" (move Pass (then (and { (if (\"ReplayThrow\") (\"GetAnotherThrow\")) (if (not (\"NoPieceInTheBoard\")) (remember Value \"Throw\") (if (or (= (\"Throw\") 1) (is In 1 (values Remembered))) (remember Value \"Throw\"))) (moveAgain)})))) (or (forEach Value (values Remembered) (or (if (and (\"HandOccupied\" Mover) (= 1 (value))) (move (from (handSite Mover)) (to (\"StartPos\") (apply if:True (forget Value (value)))))) (forEach Piece) (then (if (!= 0 (size Array (values Remembered))) (moveAgain))))) (if (and { (= (size Stack at:(\"OppositeStartPos\")) 2) (= (who at:(\"OppositeStartPos\") level:0) Mover) (= (who at:(\"OppositeStartPos\") level:1) Mover)}) (move Select (from (\"OppositeStartPos\")) (then (and { (remove (\"OppositeStartPos\") count:2) (add (piece (id \"DoubleCounter\" Mover)) (to (\"OppositeStartPos\")) (then (set Value at:(\"OppositeStartPos\") 2))) (moveAgain)}))))))) (define \"AllPieceInCentre\" (all Sites (sites Occupied by:Mover) if:(is In (site) (sites Centre)))) (define \"CounterPlayer\" (if (= #1 P1) (id \"Counter\" P1) (if (= #1 P2) (id \"Counter\" P2) (if (= #1 P3) (id \"Counter\" P3) (id \"Counter\" P4))))) (define \"NoPieceInTheBoard\" (all Sites (sites Occupied by:Mover) if:(not (is In (site) (sites Board))))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" #1)) (define \"ForgetAllUselessThrows\" (forEach Value (values Remembered) (forget Value (value)))) (define \"GetAnotherThrow\" (set Pending)) (define \"HasToThrowAgain\" (is Pending)) (define \"OppositeStartPos\" (mapEntry \"OppositeStart\" (mover))) (define \"StartPos\" (mapEntry \"Start\" (mover))) (define \"Throw\" (if (= 0 (count Pips)) 8 (count Pips))) (define \"ReplayThrow\" (or { (= (\"Throw\") 1) (= (\"Throw\") 4) (= (\"Throw\") 8)})) (game \"Thaayam\" (players 4) (equipment { (board (square 5) { (track \"Track1\" \"2,E,N,W,S,E1,N3,E2,S2,W1,N1\" P1 directed:True) (track \"Track2\" \"14,N,W,S,E,N1,W3,N2,E2,S1,W1\" P2 directed:True) (track \"Track3\" \"22,W,S,E,N,W1,S3,W2,N2,E1,S1\" P3 directed:True) (track \"Track4\" \"10,S,E,N,W,S1,E3,S2,W2,N1,E1\" P4 directed:True)}) (hand Each) (regions \"MarkedCells\" (union { (sites Centre) (intersection (sites Outer) (sites Row (row of:(centrePoint)))) (intersection (sites Outer) (sites Column (column of:(centrePoint))))})) (piece \"Counter\" Each (or (if (\"IsNotOffBoard\" (\"SiteToMoveOnTrack\" (value))) (move (from (from) level:(level)) (to (\"SiteToMoveOnTrack\" (value)) (apply if:True (and (if (and { (\"IsEnemyAt\" (to)) (= (value Piece at:(to)) 1) (not (is In (to) (sites \"MarkedCells\")))}) (fromTo (from (to)) (to (handSite (who at:(to))) (apply if:True (and (set Pending) (moveAgain)))) count:(size Stack at:(to)) stack:True)) (forget Value (value))))))) (if (and (= 1 (value)) (\"AllPieceInCentre\")) (move (from (from) level:(level)) (to (handSite Mover) (apply if:True (forget Value (value)))) (then (remove (last To))))))) (piece \"DoubleCounter\" Each (if (and (> (/ (value) 2) 0) (\"IsNotOffBoard\" (\"SiteToMoveOnTrack\" (/ (value) 2)))) (move (from (from) level:(level)) (to (\"SiteToMoveOnTrack\" (/ (value) 2)) (apply if:True (and (if (and { (\"IsEnemyAt\" (to)) (= (value Piece at:(to)) 2) (not (is In (to) (sites \"MarkedCells\")))}) (and { (remove (to)) (add (piece (\"CounterPlayer\" (who at:(to)))) (to (handSite (who at:(to)))) count:2 stack:True) (set Pending) (moveAgain)})) (forget Value (value))))) (then (if (= (centrePoint) (last To)) (and (remove (last To)) (add (piece (\"CounterPlayer\" (who at:(last To)))) (to ((last To))) count:2 stack:True))))))) (\"StickDice\" 4) (map \"Start\" {(pair P1 2) (pair P2 14) (pair P3 22) (pair P4 10)}) (map \"OppositeStart\" {(pair P1 22) (pair P2 10) (pair P3 2) (pair P4 14)})}) (rules (start { (place Stack \"Counter1\" (handSite P1) count:4 value:1) (place Stack \"Counter2\" (handSite P2) count:4 value:1) (place Stack \"Counter3\" (handSite P3) count:4 value:1) (place Stack \"Counter4\" (handSite P4) count:4 value:1)}) (play (if (can Move (\"Move\")) (\"Move\") (move Pass (then \"ForgetAllUselessThrows\")))) (end (\"EscapeWin\")))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"GoalReached\" (\"AllOwnedPiecesIn\" (sites \"Sanctuaries\"))) (define \"HopSequence\" (\"Hop\" #1 (then (if (and (not (is In (last To) (sites \"Sanctuaries\"))) (can Move (\"Hop\" (last To)))) (moveAgain))))) (define \"Hop\" (move Hop (from #1) (between if:(is Occupied (between))) (to if:(\"IsEmptyAndNotVisited\" (to))) #2)) (game \"Conspirateurs\" (players 2) (equipment { (board (square 17)) (piece \"Pawn\" Each) (hand Each) (regions \"Secret Meeting Place\" (sites {106..114 123..131 140..148 157..165 174..182})) (regions \"Sanctuaries\" (sites {\"A1\" \"B1\" \"D1\" \"F1\" \"H1\" \"J1\" \"L1\" \"N1\" \"P1\" \"Q1\" \"A2\" \"Q2\" \"A4\" \"Q4\" \"A6\" \"Q6\" \"A8\" \"Q8\" \"A9\" \"Q9\" \"A10\" \"Q10\" \"A12\" \"Q12\" \"A14\" \"Q14\" \"A16\" \"Q16\" \"A17\" \"B17\" \"D17\" \"F17\" \"H17\" \"I17\" \"J17\" \"L17\" \"L17\" \"N17\" \"P17\" \"Q17\"}))}) (rules (start { (place \"Pawn1\" (handSite P1) count:21) (place \"Pawn2\" (handSite P2) count:21)}) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (forEach (sites \"Secret Meeting Place\") if:(is Empty (site)))))) (nextPhase (and (\"HandEmpty\" P1) (\"HandEmpty\" P2)) \"Movement\")) (phase \"Movement\" (play (if \"SameTurn\" (or (\"HopSequence\" (last To)) (move Pass)) (forEach Piece (if (not (is In (from) (sites \"Sanctuaries\"))) (or (\"HopSequence\" (from)) \"StepToEmpty\"))))) (end (if \"GoalReached\" (result Mover Win))))}))\n\n###\n\n", "completion": "Play begins with an empty board. Black goes first. Players alternate turns. The game proceeds in two phases: Drop phase: Players place one cone per turn on any vacant cell on the special 9\u00d75 centre area of the board. Players may not move a cone until all their cones have been placed. After the drop phase is completed, the conspirateurs scatter to hide in sanctuaries. A sanctuary may hold at most one man. The first to bring all his conspirateurs to sanctuary wins the game. Move phase: If a conspirateur starts the turn already on a sanctuary then it can\u2019t move. Players move one man per turn to a vacant point one step in any direction orthogonally or diagonally, or players may leap over an adjacent man (friend or foe; and whether the jumpee is on a sanctuary or not) and land on the vacant point immediately beyond. Multiple leaps are allowed in a single turn: a man may continue to leap in any direction as long as there are jumps to be made, and may stop jumping at any point (leaps are not compulsory). A jumped man is not captured (there is no capturing in Conspirateurs). GAME END The game ends when a player brings all her conspirateurs to shelter holes (sanctuaries), thus winning the game END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nIf the mover is filling all the spaces of a region with his pieces, the mover is winning. This ludemeplex can be used only in an ending condition.\n\n###\n\n", "completion": "(define \"FillWin\" (if (= (sites Occupied by:Mover) #1) (result Mover Win))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlay begins in the central row and continues from left to right, then down the furthest row from right to left, then on the closest row from left to right. Played using three dice; throws can be used singly or combined but could not be divided. No second throw with doubles or triples. More than one piece of the same player can occupy one point, Single pieces can be removed from the board when the opponent lands on it; it must then be re-entered to the board before the player can move their other pieces. The goal is to bear off all of the player's pieces, which can be done one they are all in the closest row. The rules are describing with the Murray ruleset.\n\n###\n\n", "completion": "(define \"PieceMove\" (forEach Die combined:True if:(and (!= (pips) 0) (\"IsNotOffBoard\" (\"SiteToMoveOnTrack\" #2))) (if (\"IsEndTrack\" (\"SiteToMoveOnTrack\" #2)) (\"RemoveAPiece\" #1) (move (from #1) (to (\"SiteToMoveOnTrack\" #2) if:(not (and (\"IsEnemyAt\" (to)) (> (count at:(to)) 1))) (apply if:(and (\"IsEnemyAt\" (to)) (= (count at:(to)) 1)) (fromTo (from (to)) (to (handSite Next 1))))))))) (define \"RemoveAPiece\" (move Select (from #1) (then (if (= (count at:(last To)) 1) (remove (last To)) (set Count at:(last To) (- (count at:(last To)) 1)))))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" (pips) from:#1)) (game \"XII Scripta\" (players 2) (equipment { (board (add (merge (rectangle 3 6) (shift 7 0 (rectangle 3 6))) edges:{{5 18} {11 24} {17 30}}) { (track \"Track1\" \"36,6,E,N1,W,0,E,End\" P1 directed:True) (track \"Track2\" \"38,6,E,S1,W,12,E,End\" P2 directed:True)} use:Vertex) (dice num:3) (hand Each size:2) (piece \"Disc\" Each (\"PieceMove\" (from) (from)))}) (rules (start { (place \"Disc1\" (handSite P1) count:15) (place \"Disc2\" (handSite P2) count:15)}) (play (\"RollEachNewTurnMove\" (if (!= (what at:(handSite Mover 1)) 0) (\"PieceMove\" (handSite Mover 1) (handSite Mover)) (or (forEach Piece) (forEach Piece container:(mover))) (then (if (can Move (if (!= (what at:(handSite Mover 1)) 0) (\"PieceMove\" (handSite Mover 1) (handSite Mover)) (or (forEach Piece) (forEach Piece container:(mover))))) (moveAgain)))))) (end (\"EscapeWin\")))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nChecks if a site is phase 0.\n\n###\n\n", "completion": "(define \"IsPhaseZero\" (= 0 (phase of:#1))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a hop move in all the directions specified (by default Adjacent) over any occupied site to an empty site.\n\n###\n\n", "completion": "(define \"HopAllPiecesToEmpty\" (move Hop #1 #2 (between #3 if:(is Occupied (between))) (to if:(is Empty (to))) #4)) END" }, { "prompt": "What does the following global Ludii definition do?\n(define \"ThreeMensMorrisGraphWithLeftAndRightTriangles\" (merge { (rectangle 3 3 diagonals:Alternating) (shift 1.5 0.5 (rotate -90 (wedge 2))) (shift -1.5 0.5 (rotate 90 (wedge 2)))}))\n\n###\n\n", "completion": "Defines a Three Men's Morris graph with two triangle extensions at the left and right. END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines backgammon tracks following the same direction for each player but starting from opposite corners in using the bar of the board.\n\n###\n\n", "completion": "(define \"BackgammonTracksSameDirectionOppositeCornersWithBars\" { (track \"Track1\" {6 13..18 20..25 12..7 5..0} P1 directed:True) (track \"Track2\" {19 12..7 5..0 13..18 20..25} P2 directed:True)}) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a forward slide move to empty sites at distance 2.\n\n###\n\n", "completion": "(define \"DoubleStepForwardToEmpty\" (move Slide Forward (between (exact 2) if:(is Empty (between))) (to if:(is Empty (to))) #1)) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nReturns the next site on a track.\n\n###\n\n", "completion": "(define \"NextSiteOnTrack\" (trackSite Move #2 #3 steps:#1)) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game is played on a 10x10 board. -> The game is played on a 14x14 board.\n(game \"Esa Hex\" (players 2) (equipment { (board (hex Diamond 10)) (piece \"Marker\" Each) (regions P1 {(sites Side NE) (sites Side SW)}) (regions P2 {(sites Side NW) (sites Side SE)})}) (rules phases:{ (phase \"Opening\" P1 (play (move Add (to (sites Empty)))) (nextPhase \"Playing\")) (phase \"Playing\" (play (move Add (to (sites Empty)) (then (if (= 0 (count MovesThisTurn)) (moveAgain))))))} (end (if (is Connected Mover) (result Mover Win)))))\n\n###\n\n", "completion": "(game \"Esa Hex\" (players 2) (equipment { (board (hex Diamond 14)) (piece \"Marker\" Each) (regions P1 {(sites Side NE) (sites Side SW)}) (regions P2 {(sites Side NW) (sites Side SE)})}) (rules phases:{ (phase \"Opening\" P1 (play (move Add (to (sites Empty)))) (nextPhase \"Playing\")) (phase \"Playing\" (play (move Add (to (sites Empty)) (then (if (= 0 (count MovesThisTurn)) (moveAgain))))))} (end (if (is Connected Mover) (result Mover Win))))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nChecks if all the enemies have no piece and makes the current team to win. This ludemeplex can be used only in an ending condition.\n\n###\n\n", "completion": "(define \"CaptureAllTeam\" (if (no Pieces Enemy) (result TeamMover Win))) END" }, { "prompt": "Construct a Ludii game based on the following description\nMOVES - A move consists of either:\n - A growth, i.e., a drop of a stone on an empty adjacent (orthogonal or diagonal) to friendly cell;\n - An orthogonal or diagonal slide of a stone already on board (like a chess Queen) to an empty cell;\n - A drop of a stone on any empty cell.\n - Any opponent adjacent stones to the new piece (either through growth or slide) are flipped to the moving player's colour. Notice that the third option (simple drop) do not flip the colour of adjacent stones.\n \n GOAL - Wins the player with most stones when the board is filled. \n\n###\n\n", "completion": "(game \"Quad Wrangle\" (players 2) (equipment { (board (square 8)) (piece \"Ball\" Each (move Slide (then (forEach Site (sites Around (last To)) (if (\"IsEnemyAt\" (site)) (and (remove (site)) (add (piece (id \"Ball\" Mover)) (to (site)))))))))}) (rules (start { (place \"Ball1\" (difference (union (sites Top) (sites Right)) (union {(sites Left) (sites Bottom) (intersection (sites Top) (sites Right))}))) (place \"Ball2\" (difference (union (sites Bottom) (sites Left)) (union {(sites Right) (sites Top) (intersection (sites Bottom) (sites Left))})))}) (play (or { (move Add (to (sites Around (sites Occupied by:Mover) Empty)) (then (forEach Site (sites Around (last To)) (if (\"IsEnemyAt\" (site)) (and (remove (site)) (add (piece (id \"Ball\" Mover)) (to (site)))))))) (forEach Piece) (move Add (to (difference (sites Empty) (sites Around (sites Occupied by:Mover) Empty))))})) (end (if (is Full) (byScore { (score P1 (count Pieces P1)) (score P2 (count Pieces P2))}))))) END" }, { "prompt": "What does the following global Ludii definition do?\n(define \"OppositeOuterPit\" (if (is Mover P1) (+ #1 (* \"Columns\" 2)) (- #1 (* \"Columns\" 2))))\n\n###\n\n", "completion": "Returns the index of the outer opposite pit on a mancala board with four rows. This ludemeplex is working only if the description is defining \"Columns\" as the number of holes of the board. END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a circle board defined with 40 stones, with a gap after each 10 stones. The board is playable on the edges.\n\n###\n\n", "completion": "(define \"FortyStonesWithFourGapsBoard\" (board (add (remove (concentric {44}) vertices:{43 21 0 22}) edges:{{20 18} {0 1} {19 21} {38 39}}) #1 use:Edge)) END" }, { "prompt": "Construct a Ludii game based on the following description\nTwo triangles, which form a six-pointed star, with lines connecting the corner of one triangle with the corner of the other triangle which is opposite it. Nine pieces per player. Players alternate turns placing a piece on an empty point on the board. Players cannot place a piece in the central point during this phase. When all of the pieces are placed, players alternate turns moving a piece to an empty adjacent point on the board. During either phase, when a player places three of their pieces in a row, they remove one of the opponent's pieces. When three pieces are in a three-in-a-row pattern, they cannot be removed. The player who removes all of the opponent's pieces from the board wins. \n\n###\n\n", "completion": "(game \"Jeson Zam\" (players 2) (equipment { (board (add (remove (add (merge { (rotate 30 (tri 2)) (shift 0.2 0 (rotate -30 (tri 2)))}) vertices:{{0.6 0.3}}) edges:{{0 2} {0 1} {1 2} {3 5} {5 4} {4 3}}) vertices:{ {0.6 0.625} {0.915 0.3} {0.285 0.3} {0.6 -0.01} {0.285 0.1725} {0.285 0.4375} {0.915 0.4375} {0.915 0.1725} {0.75 0.075} {0.45 0.075} {0.75 0.535} {0.45 0.535}} edges:{ {1 13} {13 17} {17 7} {7 2} {2 12} {12 9} {9 11} {11 0} {5 13} {13 8} {8 14} {14 4} {1 14} {14 15} {15 10} {10 0} {5 7} {7 18} {18 12} {12 3} {3 11} {11 16} {16 10} {10 4} {0 16} {16 6} {6 17} {17 5} {4 15} {15 6} {6 18} {18 2} {3 9} {9 6} {6 8} {8 1}}) use:Vertex) (hand Each) (piece \"Marker\" Each (\"StepToEmpty\" ~ (then (\"ReplayIfLine3\"))))}) (rules (start (place \"Marker\" \"Hand\" count:9)) phases:{ (phase \"Placement\" (play (if \"SameTurn\" (\"RemoveAnyEnemyPieceNotInLine3\" Orthogonal) (move (from (handSite Mover)) (to (difference (sites Empty) (sites Centre))) (then (\"ReplayIfLine3\"))))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (phase \"Movement\" (play (if \"SameTurn\" (\"RemoveAnyEnemyPieceNotInLine3\" Orthogonal) (forEach Piece))))} (end (\"CaptureAll\" Next)))) END" }, { "prompt": "What does the following global Ludii definition do?\n(define \"IsInCheck\" (is Threatened (id #1 #2) #3))\n\n###\n\n", "completion": "Checks if a specific piece is threatened by any other enemy piece. END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nMove again if the player can do the move specified.\n\n###\n\n", "completion": "(define \"ReplayIfCanMove\" (if (can Move #1) (moveAgain) #2)) END" }, { "prompt": "Construct a Ludii game based on the following description\n10x10 board, with red and white checkered squares. Twenty pieces per player, which are arranged on the first four ranks closest to the player. Pieces move diagonally one space forward. Pieces may capture an opponent's piece by hopping over it diagonally to an empty adjacent square immediately on the other side of it. Pieces cannot capture in a backwards direction. The maximum number of pieces must be captured. If a player does not capture the maximum number of pieces, the other player may huff this piece, removing it from play. When a piece reaches the opposite edge of the board from where it started, it is promoted to king. Kings may move any distance diagonally, in a forward or backward direction. The player who captures all of their opponent's pieces wins. \n\n###\n\n", "completion": "(define \"IsUnpromoted\" (\"IsPieceAt\" \"Counter\" Mover (last To))) (game \"Dum Blas\" (\"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" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a step move to all the directions specified (adjacent by default) to a site occupied by an enemy piece or an empty site. The enemy piece is removed.\n\n###\n\n", "completion": "(define \"StepToNotFriend\" (move Step #1 (to if:(not (\"IsFriendAt\" (to))) (apply (remove (to)))) #2)) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a pachisi board.\n\n###\n\n", "completion": "(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" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nChecks if all the sites in a specific hand are empty. This ludemeplex is working only for non stacking games.\n\n###\n\n", "completion": "(define \"HandEmpty\" (all Sites (sites Hand #1) if:(= 0 (count Cell at:(site))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nTwenty small circles arranged in a large circle, with a cross of nine more circles in the center of the large circle. The central circle and the circles where the crosses meet the larger circle are larger than the others. Two players play with either one or four pieces each. Four stick dice with a white and a black side, with the following values for the throws: four white sides up = 4; four black sides up = 5; three white sides up = 3, two white sides up = 2, one white side up = 1. Throws of 4 and 5 allow the player another throw, pieces being moved after all of the player's throws. Pieces enter the board on the spot to the left of the topmost position of the circle, and proceed around the circle in an anti-clockwise direction. If a piece lands on one of the spaces where the central cross meets the circle, the piece may proceed along the cross to the opposite side on the next turn. A piece may not turn and move along a cross if it does not land on the end of the cross at the end of a throw. Pieces proceed to the topmost space, and move off the board by throwing one or more than required to land on this space. When a player lands on the same spot as one of their own pieces, these may be moved together as one piece. When a player lands on an opponent's piece, the opponent's piece is sent back to the start. The first player to remove all of their pieces from the board wins. 2 players involved with four pieces per player.\n\n###\n\n", "completion": "(define \"MoveOnTrack\" (if (is In (from) (sites Track #2 #1)) (forEach Value (values Remembered \"Throws\") (or (if (\"IsOffBoard\" (\"NextSiteFrom\" (from) #1 (value))) (do (forget Value \"Throws\" (value)) next:(move Remove (from) level:(level)))) (move (from (from) level:(level)) (to (\"NextSiteFrom\" (from) #1 (value)) if:(\"NoEnemyOrOnlyOne\" (to)) (apply (and (if (\"IsEnemyAt\" (to)) (fromTo (from (to)) (to (handSite (who at:(to)))))) (forget Value \"Throws\" (value))))) (then (if (and (!= (last From) (handSite Mover)) (is Occupied (last From))) (forEach Level (last From) FromTop (fromTo (from (last From) level:(level)) (to (last To))))))) (then (if (!= 0 (size Array (values Remembered \"Throws\"))) (moveAgain))))))) (define \"Move\" (or (forEach Piece top:True) (forEach Piece container:(mover) top:True))) (define \"NextSiteFrom\" (\"NextSiteOnTrack\" #3 from:#1 #2)) (define \"SpecialThrows\" (is In (\"ThrowValue\") (sites {4 5}))) (define \"ThrowValue\" (mapEntry \"Throw\" (count Pips))) (game \"Nyout\" (players 2) (equipment { (board (concentric {1 -4 -4 20}) { (track \"Track1\" {29 9..28} P1 directed:True) (track \"Track2\" {30 9..28} P2 directed:True) (track \"HorizontalTrack\" {13 5 1 0 3 7 23..28} directed:True) (track \"VerticalTrack\" {18 6 2 0 4 8 28} directed:True)} use:Vertex) (piece \"Counter\" Each (or { (\"MoveOnTrack\" \"Track\" Mover) (\"MoveOnTrack\" \"HorizontalTrack\") (\"MoveOnTrack\" \"VerticalTrack\")})) (dice d:2 from:0 num:4) (hand Each) (map \"Throw\" {(pair 0 4) (pair 1 3) (pair 2 2) (pair 3 1) (pair 4 5)})}) (rules (start { (set Team 1 {P1}) (set Team 2 {P2}) (place Stack \"Counter1\" (handSite P1) count:4) (place Stack \"Counter2\" (handSite P2) count:4)}) phases:{ (phase \"Throwing\" (play (\"RollMove\" (move Pass (then (remember Value \"Throws\" (\"ThrowValue\")))) (then (moveAgain)))) (nextPhase Mover (not (\"SpecialThrows\")) \"Moving\")) (phase \"Moving\" (play (if (can Move (\"Move\")) (\"Move\") (move Pass (then (forget Value \"Throws\" All))))) (nextPhase Mover (= 0 (size Array (values Remembered \"Throws\"))) \"Throwing\"))} (end (\"EscapeTeamWin\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\nDROP - On each turn, each player picks any stone of either color, and changes its color. Then, like in Othello, flips all stones of the other color that are between that stone and the next of same color, in any orthogonal or diagonal direction.\n \n GOAL - One player wins if it is able to make an horizontal 8 in-a-row of stones of any color. The other player wins by making a vertical 8 in-a-row.\n \n If, after a move, there are one horizontal and one vertical 8 in-a-row, the player that made the move losses. \n\n###\n\n", "completion": "(define \"VerticalLine\" (!= 0 (count Sites in:(forEach (sites Row 0) if:(or (all Sites (sites Column (column of:(site))) if:(= 1 (state at:(site)))) (all Sites (sites Column (column of:(site))) if:(= 2 (state at:(site))))))))) (define \"HorizontalLine\" (!= 0 (count Sites in:(forEach (sites Column 0) if:(or (all Sites (sites Row (row of:(site))) if:(= 1 (state at:(site)))) (all Sites (sites Row (row of:(site))) if:(= 2 (state at:(site))))))))) (define \"ReverseBoundedPieces\" (custodial (from (last To)) Adjacent (between if:(!= (state at:(between)) (state at:(last To))) (apply (allCombinations (add (piece \"Disc0\" state:(mover)) (to (last To))) (flip (between))))) (to if:(= (state at:(to)) (state at:(last To)))))) (game \"Minefield\" (players 2) (equipment { (board (square 8)) (piece \"Disc\" Neutral (flips 1 2))}) (rules (start { (place \"Disc0\" (sites Phase 0) state:1) (place \"Disc0\" (sites Phase 1) state:2)}) (play (move Select (from (sites Board)) (then (flip (last To) (then (\"ReverseBoundedPieces\")))))) (end { (if (and (\"HorizontalLine\") (\"VerticalLine\")) (result Mover Loss)) (if (\"HorizontalLine\") (result P1 Win)) (if (\"VerticalLine\") (result P2 Win))}))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a hop move in all the rotational directions over an enemy to an empty site. The enemy piece is removed.\n\n###\n\n", "completion": "(define \"HopRotationalCapture\" (move Hop Rotational (between if:(\"IsEnemyAt\" (between)) (apply (remove (between)))) (to if:(is Empty (to))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nFour 3x8 rectangles, arranged in a cross shape around large central square. Four players. Four pieces per player. Two rectangular four-sided die, each marked as follows: 0, 1, 2, 4. When the throw is 0 and 1, the throw is called Tayam, when it is 0 and 4 it is called Sonal. Pieces enter the board from the central square onto the central row of their arm of the board, proceed down the central row, and then in an anti-clockwise direction around the circumference of the board, and back up the central row of their arm of the board, having to enter the central square with an exact throw. The first counter of each player must be entered with a throw of Tayam. After this, pieces may be entered with a throw of 1, 5, or Sonal, each of which enter the piece on the first square of the central row of their arm. These three throws also grant the player another throw. The throws made after entering a piece are made at once, and then the pieces moved afterward, the undivided value of each throw being used to move a piece. When a piece lands on a space occupied by an opponent's piece, the opponent's piece is sent back to start. If the opponent has two pieces on such a space, they both are sent back to start, but both may reenter the board with a single throw of 1, 5, or Sonal. The first player to place all of their pieces in the central square wins. \n\n###\n\n", "completion": "(define \"Sonal\" (or (and (= 0 (\"Die1\")) (= 4 (\"Die2\"))) (and (= 4 (\"Die1\")) (= 0 (\"Die2\"))))) (define \"Tayam\" (or (and (= 0 (\"Die1\")) (= 1 (\"Die2\"))) (and (= 1 (\"Die1\")) (= 0 (\"Die2\"))))) (define \"Die2\" (face 102)) (define \"Die1\" (face 101)) (define \"IsSpecialThrow\" (is In (\"ThrowValue\") (sites {1 5}))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" #2 #1)) (define \"ThrowValue\" (count Pips)) (game \"Tayam Sonalu\" (players 4) (equipment { (\"PachisiBoard\" { (track \"Track1\" \"96,9,S,E,N,11,E,N,W,53,N,W,S,42,W,S,E,8,S,E1,N7,End\" P1 directed:True) (track \"Track2\" \"96,26,W,S,E,8,S,E,N,11,E,N,W,53,N,W,S,42,W,S1,E7,End\" P2 directed:True) (track \"Track3\" \"96,52,N,W,S,42,W,S,E,8,S,E,N,11,E,N,W,53,N,W1,S7,End\" P3 directed:True) (track \"Track4\" \"96,27,E,N,W,53,N,W,S,42,W,S,E,8,S,E,N,11,E,N1,W7,End\" P4 directed:True)}) (hand Each) (dice d:4 faces:{0 1 2 4} num:2) (piece \"Pawn\" Each (if (\"IsEndTrack\" (\"SiteToMoveOnTrack\" from:(from) (\"ThrowValue\"))) (move Remove (from) level:(level)) (move (from (from) level:(level)) (to (\"SiteToMoveOnTrack\" from:(from) (\"ThrowValue\")) if:True (apply (if (\"IsEnemyAt\" (to)) (if (\"IsSingletonStack\" (to)) (forEach Level (to) FromTop (fromTo (from (to) level:(level)) (to (centrePoint)))) (forEach Level (to) FromTop (fromTo (from (to) level:(level)) (to (handSite (who at:(to) level:(level))))))))))))) (map \"Start\" {(pair P1 9) (pair P2 26) (pair P3 52) (pair P4 27)})}) (rules (start { (place Stack \"Pawn1\" (handSite P1) count:4) (place Stack \"Pawn2\" (handSite P2) count:4) (place Stack \"Pawn3\" (handSite P3) count:4) (place Stack \"Pawn4\" (handSite P4) count:4)}) (play (\"RollMove\" (if (!= 0 (\"ThrowValue\")) (or (if (and (is Occupied (handSite Mover)) (or (and (= Undefined (value Player Mover)) (\"Tayam\")) (and (= 1 (value Player Mover)) (or (\"IsSpecialThrow\") (\"Sonal\"))))) (move (from (handSite Mover)) (to (mapEntry \"Start\" Mover)) (then (if (= Undefined (value Player Mover)) (set Value Mover 1))))) (forEach Piece))) (then (if (and (not (no Pieces Mover)) (or (\"IsSpecialThrow\") (\"Sonal\"))) (moveAgain))))) (end (\"EscapeWin\")))) END" }, { "prompt": "What does the following global Ludii definition do?\n(define \"PromoteIfReach\" (if (is In (last To) #1) (promote (last To) (piece #2) Mover) #3))\n\n###\n\n", "completion": "Promote the last piece moving if this piece reached a region. END" }, { "prompt": "Construct a Ludii game based on the following description\n2x4 board with two stores on either end, the store on a player's right belonging to them. Four counters per hole, five in each store. Players sow in the direction of their choosing from one of the holes in their row, not from the stores, on each turn, sowing also into the stores. If the next hole has counters, these are picked up and sowing continues with these counters. When this next hole is empty, the counters in the next hole after that are captured and the turn ends. If there are a series of alternating empty holes and holes with counters, the counters in these holes are captured until two empty or full holes are reached. When the point of the game is reached that play cannot continue, the players claim the counters in their holes, and a new game begins. The players refill their holes, beginning with their store, which receives five counters, and four in each other. Holes are only filled with exactly four counters, any extra are set aside. If a player cannot fill any of their holes with counters, these holes are eliminated from play. Play continues in this way until one player captures all of the counters or the other player cannot fill any holes. \n\n###\n\n", "completion": "(define \"AllRowsEmpty\" (all Sites (union (sites (values Remembered \"OwnedP1\")) (sites (values Remembered \"OwnedP2\"))) if:(is Empty (site)))) (define \"CaptureMove\" (if (is Occupied (\"NextHoleFrom\" (to) #1 1)) (and (moveAgain) #2) (and (if (is Occupied (\"NextHoleFrom\" (to) #1 2)) (and (fromTo (from (\"NextHoleFrom\" (to) #1 2)) (to (mapEntry Mover)) count:(count at:(\"NextHoleFrom\" (to) #1 2))) (if (and (is Empty (\"NextHoleFrom\" (to) #1 3)) (is Occupied (\"NextHoleFrom\" (to) #1 4))) (and (fromTo (from (\"NextHoleFrom\" (to) #1 4)) (to (mapEntry Mover)) count:(count at:(\"NextHoleFrom\" (to) #1 4))) (if (and (is Empty (\"NextHoleFrom\" (to) #1 5)) (is Occupied (\"NextHoleFrom\" (to) #1 6))) (and (fromTo (from (\"NextHoleFrom\" (to) #1 6)) (to (mapEntry Mover)) count:(count at:(\"NextHoleFrom\" (to) #1 6))) (if (and (is Empty (\"NextHoleFrom\" (to) #1 7)) (is Occupied (\"NextHoleFrom\" (to) #1 8))) (fromTo (from (\"NextHoleFrom\" (to) #1 8)) (to (mapEntry Mover)) count:(count at:(\"NextHoleFrom\" (to) #1 8)))))))))) (set Var \"Direction\" 0)))) (define \"RemmemberOwnedHoles\" (if (is Mover P1) (remember Value \"OwnedP1\" #1) (remember Value \"OwnedP2\" #1))) (define \"OwnedHoles\" (if (is Mover P1) (sites (values Remembered \"OwnedP1\")) (sites (values Remembered \"OwnedP2\")))) (define \"PiecesOwnedBy\" (+ (count at:(mapEntry #1)) (count in:(sites #1)))) (define \"NextHoleFrom\" (\"NextSiteOnTrack\" #3 from:#1 #2)) (game \"Bay Khom\" (players 2) (equipment { (mancalaBoard 2 4 { (track \"TrackCW\" \"0,5,E,9,4,W\" loop:True) (track \"TrackCCW\" \"0,1,E,9,8,W\" loop:True)}) (piece \"Seed\" Shared) (map {(pair P1 LastSite) (pair P2 FirstSite)}) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (hand Each)}) (rules (start { (set Count 4 to:(union (sites P1) (sites P2))) (set Count 5 at:(mapEntry 1)) (set Count 5 at:(mapEntry 2)) (set RememberValue \"OwnedP1\" (sites Bottom)) (set RememberValue \"OwnedP2\" (sites Top))}) phases:{ (phase \"Sowing\" (play (or (if (or (<= (var \"Direction\") 0) (= (var \"Direction\") 1)) (move Select (from (if (\"SameTurn\") (\"LastHoleSowed\") (\"OwnedHoles\")) if:(is Occupied (from))) (then (sow \"TrackCW\" apply:(\"CaptureMove\" \"TrackCW\" (set Var \"Direction\" 1)))))) (if (or (<= (var \"Direction\") 0) (= (var \"Direction\") 2)) (move Select (from (if (\"SameTurn\") (\"LastHoleSowed\") (\"OwnedHoles\")) if:(is Occupied (from))) (then (sow \"TrackCCW\" apply:(\"CaptureMove\" \"TrackCCW\" (set Var \"Direction\" 2)))))) (then (if (\"AllRowsEmpty\") (and { (forEach Site (sites P1) (fromTo (from (site)) (to (handSite P1)) count:(count at:(site)))) (if (is Occupied (mapEntry P1)) (fromTo (from (mapEntry P1)) (to (handSite P1)) count:(count at:(mapEntry P1)))) (forEach Site (sites P2) (fromTo (from (site)) (to (handSite P2)) count:(count at:(site)))) (if (is Occupied (mapEntry P2)) (fromTo (from (mapEntry P2)) (to (handSite P2)) count:(count at:(mapEntry P2)))) (forget Value \"OwnedP1\" All) (forget Value \"OwnedP2\" All)}))))) (end (if (\"NoPieceOnBoard\") { (if (> 9 (count Cell at:(handSite P1))) (result P2 Win)) (if (> 9 (count Cell at:(handSite P2))) (result P1 Win))})) (nextPhase (\"NoPieceOnBoard\") \"BetweenRounds\")) (phase \"BetweenRounds\" (play (if (is Empty (mapEntry Mover)) (move (from (handSite Mover)) (to (mapEntry Mover)) count:5) (if (<= 4 (count Cell at:(handSite Mover))) (move (from (handSite Mover)) (to (sites Mover) if:(is Empty (to))) count:4 (then (\"RemmemberOwnedHoles\" (last To))))))) (nextPhase (all Passed) \"Sowing\"))})) END" }, { "prompt": "What does the following global Ludii definition do?\n(define \"BlockWin\" (if (no Moves Next) (result Mover Win)))\n\n###\n\n", "completion": "If the next player has no legal moves, the mover is winning. This ludemeplex can be used only in an ending condition. END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"PostActionUpdate\" (if (> (score Mover) 1) (and (addScore Mover -1) (moveAgain)))) (define \"Pass\" (move Pass (then (addScore Mover 1)))) (define \"Upgrade\" (move Select (from) (to) (then (and (if (< (state at:(last To)) 100) (set State at:(last To) (+ 1 (state at:(last To))))) \"PostActionUpdate\")))) (define \"Trade\" (move Select (from) (to (intersection (sites Occupied by:Enemy container:\"Board\") (sites Distance from:(from) (range 1 (state at:(from)))))) (then (and (addScore (player (who at:(last To))) 1) \"PostActionUpdate\")))) (define \"Shoot\" (move Select (from) (to (intersection (sites Occupied by:Enemy container:\"Board\") (sites Distance from:(from) (range 1 (state at:(from)))))) (then (and (if (= (value Piece at:(last To)) 1) (remove (last To)) (set Value at:(last To) (- (value Piece at:(last To)) 1))) \"PostActionUpdate\")))) (define \"Move\" (\"StepToEmpty\" ~ (then \"PostActionUpdate\"))) (game \"Tank Tactics\" (players 2) (equipment { (board (rectangle 5 10)) (hand Each) (piece \"Tank\" Each (or {\"Move\" \"Shoot\" \"Trade\" \"Upgrade\"}) maxState:100)}) (rules (meta (passEnd NoEnd)) (start { (set Score Each 1) (place \"Tank1\" (handSite P1) state:2 value:3) (place \"Tank2\" (handSite P2) state:2 value:3)}) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (phase \"Movement\" (play (or (forEach Piece) \"Pass\")))} (end (forEach NonMover if:(no Pieces Player) (result Player Loss)))))\n\n###\n\n", "completion": "Each player controls a tank with three health and an initial shooting range of two spaces. \n Each player gains one action point at the start of their turn. \n Players may use an action point during their turn to perform one of four actions:\n - Move their tank to an adjacent space.\n - Shoot at another tank within shooting range, deducting one point of health.\n - Trade with another tank within shooting range, increasing the owning players action points by one.\n - Increase the shooting range of their tank by one space.\n Players can pass to conserve action points between turns.\n A player loses if their tank reaches zero health. 2 players. The game is played on a 5x10 board. END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines two opposite table tracks and using hand sites.\n\n###\n\n", "completion": "(define \"TableTracksOppositeWithHands\" { (track \"Track1\" {24 0..11 23..12 #1} P1 directed:True) (track \"Track2\" {25 12..23 11..0 #1} P2 directed:True)}) END" }, { "prompt": "What does the following global Ludii definition do?\n(define \"ForEachPlayerNoPiecesLoss\" (forEach Player if:(no Pieces Player) (result Player Loss)))\n\n###\n\n", "completion": "Makes a player losing when this player has no pieces. This ludemeplex can be used only in an ending condition. END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayed on a standard Backgammon board. Six pieces per player. Pieces begin the game, one on each point on the left half of the player's side of the board. Pieces move in an anti-clockwise direction for both players. Two six-sided dice are rolled. When a 6 is rolled, the player moves two pieces six places. If this is on the player's first turn it must be the two pieces furthest to the left. If a 1 is rolled, the player moves one piece one spot. If doubles are rolled, the player moves twice the normal roll, and plays again. When one player is reduced to a single piece, it moves only to a consecutive corner space with the roll of each 1, or two corner spaces with the roll of each 6, doubling still applies. The first player to capture all of the opponent's pieces wins. \n\n###\n\n", "completion": "(define \"MoveAPiece\" (or (move (from) (to (\"NextSiteOnTrack\" #1) if:(and (not (\"IsFriendAt\" (to))) (if (>= (count Turns) 2) True (if (and (or (= 6 #1) (= 12 #1)) (!= 0 (count in:(sites Mover)))) (is In (from) (sites Mover)) True))) (apply if:(\"IsEnemyAt\" (to)) (remove (to))))) (if (= 1 (count Pieces Mover)) (move (from) (to (\"NextSiteOnTrack\" (if (= #1 12) 4 (if (= #1 6) 2 #1)) \"CornerTrack\") if:(not (\"IsFriendAt\" (to))) (apply if:(\"IsEnemyAt\" (to)) (remove (to)))))))) (define \"WithDie6\" (if (all DiceEqual) 12 6)) (define \"WithDie1\" (if (all DiceEqual) 2 1)) (define \"WithDie6Again\" (value Pending)) (define \"UsedADie6\" (is Pending)) (define \"UseADie6\" (set Pending (if (all DiceEqual) 12 6))) (define \"DieIs1\" (= 1 (pips))) (define \"AnyDieIs6Or1\" (or (is AnyDie 6) (is AnyDie 1))) (define \"DieIs6Or1\" (or (= 6 (pips)) (= 1 (pips)))) (game \"Ad elta stelpur\" (players 2) (equipment { (board (rectangle 2 13) { (track \"NormalTrack\" {0..5 7..12 25..20 18..13} loop:True) (track \"CornerTrack\" {0 5 7 12 25 20 18 13} loop:True)} use:Vertex) (regions \"LeftMost\" P1 {0 1}) (regions \"LeftMost\" P2 {24 25}) (dice num:2) (piece \"Disc\" Each)}) (rules (start { (place \"Disc1\" {0..5}) (place \"Disc2\" {20..25})}) (play (do (if (\"NewTurn\") (roll) (if (and (not (\"UsedADie6\")) (not (\"AnyDieIs6Or1\"))) (roll))) next:(if (\"UsedADie6\") (forEach Piece (\"MoveAPiece\" (\"WithDie6Again\"))) (forEach Die if:(\"DieIs6Or1\") (if (\"DieIs1\") (forEach Piece (\"MoveAPiece\" (\"WithDie1\"))) (forEach Piece (\"MoveAPiece\" (\"WithDie6\")) (then (and (\"UseADie6\") (moveAgain)))))) (then (if (or (\"AnyDieIs6Or1\") (all DiceEqual)) (moveAgain)))))) (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a sequence of hop move in all the rotational directions over an enemy to an empty site. \n\n###\n\n", "completion": "(define \"HopRotationalSequenceCapture\" (move Hop Rotational (between #1 #2 if:(\"IsEnemyAt\" (between)) (apply (remove (between) #3))) (to if:(is Empty (to))) (then (if (can Move (hop (from (last To)) Rotational (between #1 #2 if:(and (not (is In (between) (sites ToClear))) (\"IsEnemyAt\" (between)))) (to if:(is Empty (to))))) (moveAgain))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"Challis Ghutia (Titagarh)\" (\"TwoPlayersNorthSouth\") (equipment { (\"AlquerqueBoard\" 9 9) (piece \"Marker\" Each (or (\"StepToEmpty\") (\"HopCapture\")))}) (rules (start { (place \"Marker1\" (union (expand (sites Bottom) steps:1) (expand origin:(coord \"I3\") steps:5 W))) (place \"Marker2\" (union (expand (sites Top) steps:1) (expand origin:(coord \"A7\") steps:5 E)))}) (play (forEach Piece)) (end (\"CaptureAll\" Next))))\n\n###\n\n", "completion": "9x9 board played on the intersections, with diagonals for each 3x3 square. Typically played with 24 pieces, but any number up to 40 is possible. Pieces are arranged on the spots in the rows closest to the player, with those unable to fill a row placed on the right points of the next available row. 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. The game starts with 24 pieces by player. END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a nine men's morris board.\n\n###\n\n", "completion": "(define \"NineMensMorrisBoard\" (board (concentric Square rings:3) use:Vertex)) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nChecks if a player has no piece and lose. This ludemeplex can be used only in an ending condition.\n\n###\n\n", "completion": "(define \"CaptureAll\" (if (no Pieces #1) (result #1 Loss))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nChecks if a friend is on a site. \n\n###\n\n", "completion": "(define \"IsFriendAt\" (is Friend (who at:#1 #2))) END" }, { "prompt": "Construct a Ludii game based on the following description\nEvery turn, the current player places a piece of their colour on any empty vertex of the graph. If the last coloured vertex has no adjacent vertex with the same colour, the player gets one point. The game is over, when both players passed their turn or there is no empty vertex. Finally, the player with the highest score wins. \n \n\n###\n\n", "completion": "(game \"Two-Colour\" (players 2) (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:Vertex) (piece \"Marker\" Each)}) (rules (play (or (move Add (to (sites Empty)) (then (if (= 1 (size Group at:(last To))) (addScore Mover 1)))) (move Pass))) (end (if (all Passed) (byScore))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nA size 5 board is currently selected -> A size 7 board is currently selected\n(define \"Remove\" (move Select (from (sites Occupied by:Enemy) if:(\"SomeSite\" (sites Group at:(from)) (and (= 0 (count Sites in:(sites Around (site) Empty Orthogonal))) (if (>= 11 5) (< 0 (count Sites in:(sites Around (site) Own Orthogonal))) True)))) (then (forEach Site (sites Group at:(last From) Orthogonal) (remove (site)))))) (define \"Place\" (move Add (to (sites Around (sites Occupied by:Mover) Empty Orthogonal)))) (define \"SomeSite\" (not (all Sites #1 if:(not #2)))) (game \"Rampart\" (players 2) (equipment { (board (square 5) use:Vertex) (piece \"Disc\" Each)}) (rules (start { (place \"Disc1\" (forEach (sites Phase 0) if:(and { (is Even (row of:(site))) (!= 0 (% (site) 4)) (= 0 (% (row of:(site)) 4))}))) (place \"Disc2\" (forEach (sites Phase 0) if:(and { (is Even (row of:(site))) (!= 0 (% (site) 4)) (= 2 (% (row of:(site)) 4))})))}) (play (or (\"Place\") (\"Remove\"))) (end (\"CaptureAll\" Next))))\n\n###\n\n", "completion": "(define \"Remove\" (move Select (from (sites Occupied by:Enemy) if:(\"SomeSite\" (sites Group at:(from)) (and (= 0 (count Sites in:(sites Around (site) Empty Orthogonal))) (if (>= 11 7) (< 0 (count Sites in:(sites Around (site) Own Orthogonal))) True)))) (then (forEach Site (sites Group at:(last From) Orthogonal) (remove (site)))))) (define \"Place\" (move Add (to (sites Around (sites Occupied by:Mover) Empty Orthogonal)))) (define \"SomeSite\" (not (all Sites #1 if:(not #2)))) (game \"Rampart\" (players 2) (equipment { (board (square 7) use:Vertex) (piece \"Disc\" Each)}) (rules (start { (place \"Disc1\" (forEach (sites Phase 0) if:(and { (is Even (row of:(site))) (!= 0 (% (site) 4)) (= 0 (% (row of:(site)) 4))}))) (place \"Disc2\" (forEach (sites Phase 0) if:(and { (is Even (row of:(site))) (!= 0 (% (site) 4)) (= 2 (% (row of:(site)) 4))})))}) (play (or (\"Place\") (\"Remove\"))) (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a leap move to empty or enemy sites. The enemy pieces are removed.\n\n###\n\n", "completion": "(define \"LeapCapture\" (move Leap #1 (to if:(not (\"IsFriendAt\" (to))) (apply (if (\"IsEnemyAt\" (to)) (remove (to) #2)))) #3)) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a step move to all the directions specified (adjacent by default) to a site occupied by an enemy piece. The enemy piece is removed.\n\n###\n\n", "completion": "(define \"StepToEnemy\" (move Step #1 (to if:(\"IsEnemyAt\" (to)) (apply (remove (to)))) #2)) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nChecks if a stack has a size of 1 at a site.\n\n###\n\n", "completion": "(define \"IsSingletonStack\" (= 1 (size Stack at:#1))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe game begins with an empty Diamond board. Black moves first, then turns alternate. (To offset any advantage Black has in moving first, the pie rule is used: White can choose to switch sides after Black's first move, playing from then on as Black. White has this option only after Black's first move.) \n \n The game is executed in two phases:\n \n 1) Placement phase. Players take turns placing one of their pieces on any open point on the board. No placements result in a capture in this phase. A player can win the game in this phase if they are able to occupy all four corners of a board square; otherwise, play proceeds to the Movement phase once all 24 pieces have been placed.\n \n 2) Movement phase. For their turn, a player may either:\n - move one of their pieces along a straight line to an adjacent empty point; or,\n - remove a neutral piece from the board\u2014but only if no white or black piece is adjacent to it.\n \n Capturing moves are possible in the Movement phase. If the points of a triangle contain exactly one white and one black piece, either player can capture the opponent piece by occupying the remaining open point (\\ \n\n###\n\n", "completion": "(define \"TrianglesWithCaptures\" (forEach (sites Incident Cell of:Vertex at:(last To)) if:(and { (\"IsATriangle\") (\"TwoFriendPieces\") (\"OneEnemyPiece\")}))) (define \"ReplaceEnemyPieceByNeutral\" (and (remove (site)) (add (piece (id \"Disc\" Neutral)) (to (site))))) (define \"OneEnemyPiece\" (= 1 (count Sites in:(forEach (sites Incident Vertex of:Cell at:(site)) if:(is Next (who at:(site))))))) (define \"TwoFriendPieces\" (= 2 (count Sites in:(forEach (sites Incident Vertex of:Cell at:(site)) if:(is Mover (who at:(site))))))) (define \"IsATriangle\" (= 3 (count Sites in:(sites Incident Vertex of:Cell at:(site))))) (define \"SquareFilled\" (= 4 (count Sites in:(forEach (\"AllVerticesOfCell\") if:(is Mover (who at:(site))))))) (define \"AllVerticesOfCell\" (sites Incident Vertex of:Cell at:(site))) (game \"Diamond\" (players 2) (equipment { (board (rotate 90 (tiling T33434 3)) use:Vertex) (piece \"Disc\" Each (\"StepToEmpty\" ~ (then (if (= 1 (count Sites in:(\"TrianglesWithCaptures\"))) (forEach Site (sites Incident Cell of:Vertex at:(last To)) (if (and { (\"IsATriangle\") (\"TwoFriendPieces\") (\"OneEnemyPiece\")}) (and (forEach Site (forEach (sites Incident Vertex of:Cell at:(site)) if:(is Next (who at:(site)))) (\"ReplaceEnemyPieceByNeutral\")) (set Counter)))))))) (piece \"Disc\" Neutral) (hand Each) (regions P1 {(sites Side W) (sites Side E)}) (regions P2 {(sites Side N) (sites Side S)})}) (rules (meta (swap)) (start (place \"Disc\" \"Hand\" count:12)) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (sites Empty)) (then (and (forEach Site (sites Incident Cell of:Vertex at:(last To)) (if (\"SquareFilled\") (trigger \"Win\" Mover))) (set Counter))))) (nextPhase Mover (is Empty (handSite Mover)) \"Movement\")) (phase \"Movement\" (play (or (forEach Piece) (move Remove (sites Occupied by:Neutral)))))} (end { (if (is Triggered \"Win\" Mover) (result Mover Win)) (if (or (no Moves Mover) (= (counter) 49)) (result Mover Draw))}))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nEach row has 6 holes. -> Each row has 8 holes.\n(define \"LeftMost\" (trackSite FirstSite from:(trackSite FirstSite if:(not (is Mover (who at:(to))))) if:(is Mover (who at:(to))))) (define \"NextHoleFrom\" (\"NextSiteOnTrack\" #3 from:#1 #2)) (define \"Columns\" 6) (game \"Chiana wa Kunja\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None (track \"Track\" \"0,E,23,W\" loop:True)) (piece \"Seed\" Each) (hand Shared)}) (rules (start { (place \"Seed1\" (sites Bottom) counts:{4}) (place \"Seed2\" (sites Top) counts:{4})}) (play (or (move Select (from (\"LeftMost\")) (then (do (and (forEach Site (sites Track \"Track\" from:(last From) to:(trackSite Move from:(last From) steps:(count at:(last From)))) (if (!= (mover) (who at:(site))) (and (remove (site) count:(count at:(site))) (add (piece (id \"Seed\" Mover)) (to Cell (handSite Shared)) count:(count at:(site)))))) (set Var \"NumSowed\" (count at:(last From)))) next:(sow) (then (and { (if (< 1 (var \"NumSowed\")) (if (and (= 1 (count at:(\"NextHoleFrom\" (last From) \"Track\" (var \"NumSowed\")))) (= 2 (count at:(\"NextHoleFrom\" (last From) \"Track\" (- (var \"NumSowed\") 1))))) (moveAgain))) (if (!= 0 (what Cell at:(handSite Shared))) (fromTo (from Cell (handSite Shared)) (to (last From)) count:(count Cell at:(handSite Shared)))) (set Var \"NumSowed\" 0)}))))) (if (and (= 1 (count Pieces Mover)) (is Empty (\"NextHoleFrom\" (from) \"Track\" 1))) (move (from (\"LeftMost\")) (to (\"NextHoleFrom\" (from) \"Track\" 2) (apply (and (remove (to) count:(count at:(to))) (add (piece (id \"Seed\" Mover)) (to (to)) count:(count at:(to)))))))))) (end (\"BlockWin\"))))\n\n###\n\n", "completion": "(define \"LeftMost\" (trackSite FirstSite from:(trackSite FirstSite if:(not (is Mover (who at:(to))))) if:(is Mover (who at:(to))))) (define \"NextHoleFrom\" (\"NextSiteOnTrack\" #3 from:#1 #2)) (define \"Columns\" 8) (game \"Chiana wa Kunja\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None (track \"Track\" \"0,E,31,W\" loop:True)) (piece \"Seed\" Each) (hand Shared)}) (rules (start { (place \"Seed1\" (sites Bottom) counts:{4}) (place \"Seed2\" (sites Top) counts:{4})}) (play (or (move Select (from (\"LeftMost\")) (then (do (and (forEach Site (sites Track \"Track\" from:(last From) to:(trackSite Move from:(last From) steps:(count at:(last From)))) (if (!= (mover) (who at:(site))) (and (remove (site) count:(count at:(site))) (add (piece (id \"Seed\" Mover)) (to Cell (handSite Shared)) count:(count at:(site)))))) (set Var \"NumSowed\" (count at:(last From)))) next:(sow) (then (and { (if (< 1 (var \"NumSowed\")) (if (and (= 1 (count at:(\"NextHoleFrom\" (last From) \"Track\" (var \"NumSowed\")))) (= 2 (count at:(\"NextHoleFrom\" (last From) \"Track\" (- (var \"NumSowed\") 1))))) (moveAgain))) (if (!= 0 (what Cell at:(handSite Shared))) (fromTo (from Cell (handSite Shared)) (to (last From)) count:(count Cell at:(handSite Shared)))) (set Var \"NumSowed\" 0)}))))) (if (and (= 1 (count Pieces Mover)) (is Empty (\"NextHoleFrom\" (from) \"Track\" 1))) (move (from (\"LeftMost\")) (to (\"NextHoleFrom\" (from) \"Track\" 2) (apply (and (remove (to) count:(count at:(to))) (add (piece (id \"Seed\" Mover)) (to (to)) count:(count at:(to)))))))))) (end (\"BlockWin\")))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nChecks if a site is empty and not visited so far in the same turn.\n\n###\n\n", "completion": "(define \"IsEmptyAndNotVisited\" (and (is Empty #1) (not (is Visited #1)))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nRoll dice at each new turn before to compute the legal moves.\n\n###\n\n", "completion": "(define \"RollEachNewTurnMove\" (do (if (\"NewTurn\") (roll)) next:#1 #2)) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a sequence of hop move in all the adjacent directions over an enemy to an empty site from the last ``to'' location of the previous move. \n\n###\n\n", "completion": "(define \"HopSequenceCaptureAgain\" (move Hop (from (last To)) (between #1 #2 if:(and (not (is In (between) (sites ToClear))) (\"IsEnemyAt\" (between))) (apply (remove (between) #3))) (to if:(is Empty (to))) (then (if (can Move (hop (from (last To)) (between #1 #2 if:(and (not (is In (between) (sites ToClear))) (\"IsEnemyAt\" (between)))) (to if:(is Empty (to))))) (moveAgain))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nBuffalos move one step forward to a free space. Dogs move like a chess queen but cannot capture. The villager moves like a chess king, and can capture buffalos. Dogs and the villager cannot enter the top or bottom rows of the board. Buffalos start, and win by reaching the top row. They lose if they cannot move anymore. \n\n###\n\n", "completion": "(define \"ToCenter\" (and (not (is In (to) (sites Top))) (not (is In (to) (sites Bottom))))) (game \"Bison\" (players 2) (equipment { (board (rectangle 7 11)) (piece \"Bull\" P1 (\"StepForwardToEmpty\")) (piece \"Colonel\" P2 (move Step Adjacent (to if: (and \"ToCenter\" (not (\"IsFriendAt\" (to)))) (apply (if (\"IsEnemyAt\" (to)) (remove (to))))))) (piece \"Dog\" P2 (move Slide (between if:(and \"ToCenter\" (is Empty (to))))))}) (rules (start { (place \"Bull1\" (sites Bottom)) (place \"Colonel2\" {\"F6\"}) (place \"Dog2\" {\"D6\" \"E6\" \"G6\" \"H6\"})}) (play (forEach Piece)) (end { (\"ReachWin\" (sites Top) P1) (\"BlockWin\")}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nOne player plays as the tigers (five in number), the other as the sheep (fifteen in number). They take turns placing the pieces on the intersections of the lines. When all of the player's pieces are on the board, the piece may move to any adjacent intersection along the connecting lines. The tiger hops over a sheep to capture it. The goal of the tiger is to capture all of the sheep; the sheep try to prevent all of the tigers from moving. \n\n###\n\n", "completion": "(define \"BigHop\" (move Hop (between (exact #1) if:#2 (apply (remove (between)))) (to if:(is Empty (to))))) (game \"Merimueng-rimueng-do\" (players 2) (equipment { (board (scale 1.4 1 (remove (scale 1 2 (wedge 5 6)) edges:{{0 1} {0 6}} vertices:{24 19})) use:Vertex) (hand Each) (piece \"Tiger\" P1 (or { (\"HopCapture\") (\"StepToEmpty\") (\"BigHop\" 3 (and (!= (row of:(between)) (row of:(from))) (\"IsEnemyAt\" (between)))) (\"BigHop\" 4 (\"IsEnemyAt\" (between)))})) (piece \"Sheep\" P2 \"StepToEmpty\")}) (rules (start { (place \"Tiger1\" (handSite P1) count:5) (place \"Sheep2\" (handSite P2) count:15)}) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (\"PhaseMovePiece\" \"Movement\" (end (\"NoMovesLossAndNoPiecesPlayerLoss\" P2)))})) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a Three Men's Morris board with two triangle extensions at the left and right.\n\n###\n\n", "completion": "(define \"ThreeMensMorrisBoardWithLeftAndRightTriangles\" (board (\"ThreeMensMorrisGraphWithLeftAndRightTriangles\") use:Vertex)) END" }, { "prompt": "Construct a Ludii game based on the following description\nFlower Shop is played on a hexhex board and uses the 12* placement protocol, that is: barring the first player's first placement, which must be a single piece, players make two placements in a turn. There are two types of pieces: impartial *stalks* (green) and partial *flowers* (pink and yellow). A maximal set of connected stalks is called a *plant*.\n \n Rules\n There are two placement restrictions:\n 1. Each flower may be adjacent to no more than one stalk and no other flowers.\n 2. Each plant can only be adjacent to at most one colour of flowers.\n \n The game ends when no legal placements can be made. The *worth* of each plant is the number of stalks in it times the number of flowers adjacent to it. The *score* of each player is the total worth of all the plants adjacent to his flowers. Highest score wins. In case of equal scores, no player wins.\n \n (Description taken - but slightly adapted - from mindsports.nl.) \n\n###\n\n", "completion": "(define \"Score\" (+ (results from:(intersection (sites Occupied by:#1) (sites Around (sites Occupied by:Neutral) Orthogonal)) to:1 (* (to) (size Group at:(+ (results from:(intersection (sites Around (from) Orthogonal) (sites Occupied by:Neutral)) to:1 (* (from) (to)))) Orthogonal if:(= (id \"Disc0\") (what at:(to)))))))) (game \"Flower Shop\" (players 2) (equipment { (board (hex 7)) (tile \"Hex\" Each) (piece \"Disc\" Neutral)}) (rules (play (do (or (move Add (piece (mover)) (to (sites Empty) if:(= 0 (count Sites in:(intersection (sites Occupied by:All component:\"Hex\") (sites Around (to) Orthogonal)))))) (move Add (piece \"Disc0\") (to (sites Empty)))) ifAfterwards:(and (all Sites (sites Occupied by:All component:\"Hex\") if:(> 2 (count Sites in:(intersection (sites Around (site) Orthogonal) (sites Occupied by:Neutral))))) (all Sites (sites Occupied by:Neutral) if:(not (and (< 0 (count Sites in:(sites Around (sites Group at:(site)) Own Orthogonal))) (< 0 (count Sites in:(sites Around (sites Group at:(site)) Enemy Orthogonal))))))) (then (if (= 1 (% (+ 1 (count Moves)) 2)) (moveAgain))))) (end (if (all Passed) (byScore { (score P1 (\"Score\" P1)) (score P2 (\"Score\" P2))}))))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a graphics turtle walk to get the locations where can move a Chess knight.\n\n###\n\n", "completion": "(define \"KnightWalk\" { {F F R F} {F F L F}}) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nEach hole has initially 5 seeds. -> Each hole has initially 6 seeds.\n(define \"NoOwnedHoleWithMoreThanOneSeed\" (all Sites (sites #1) if:(>= 1 (count at:(site))))) (define \"NoOwnedHoleWithMoreThanOneSeedExceptHogon\" (all Sites (difference (sites #1) (mapEntry \"Hogon\" #1)) if:(>= 1 (count at:(site))))) (define \"IsOlderPlayer\" (is Mover P1)) (game \"Koro\" (players 2) (equipment { (mancalaBoard 2 6 store:None (track \"Track\" \"0,E,N,W\" loop:True)) (piece \"Seed\" Shared) (hand Each) (map \"Hogon\" {(pair P1 5) (pair P2 6)}) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start (set Count 5 to:(sites Track))) (play (if (<= 15 (count at:(mapEntry \"Hogon\" Mover))) (move Select (from (mapEntry \"Hogon\" Mover)) (then (sow))) (if (\"NoOwnedHoleWithMoreThanOneSeedExceptHogon\" Mover) (if (\"IsOlderPlayer\") (move Pass) (do (if (\"NoOwnedHoleWithMoreThanOneSeedExceptHogon\" Next) (forEach Site (difference (sites Next) (mapEntry \"Hogon\" Next)) (if (is Occupied (site)) (fromTo (from (site)) (to (mapEntry \"Hogon\" Mover)))))) next:(move Select (from (mapEntry \"Hogon\" Mover) if:(< 1 (count at:(from)))) (then (sow))))) (move Select (from (difference (sites Mover) (mapEntry \"Hogon\" Mover)) if:(< 1 (count at:(from)))) (then (sow)))))) (end (forEach Player if:(\"NoOwnedHoleWithMoreThanOneSeed\" Player) (result Player Loss)))))\n\n###\n\n", "completion": "(define \"NoOwnedHoleWithMoreThanOneSeed\" (all Sites (sites #1) if:(>= 1 (count at:(site))))) (define \"NoOwnedHoleWithMoreThanOneSeedExceptHogon\" (all Sites (difference (sites #1) (mapEntry \"Hogon\" #1)) if:(>= 1 (count at:(site))))) (define \"IsOlderPlayer\" (is Mover P1)) (game \"Koro\" (players 2) (equipment { (mancalaBoard 2 6 store:None (track \"Track\" \"0,E,N,W\" loop:True)) (piece \"Seed\" Shared) (hand Each) (map \"Hogon\" {(pair P1 5) (pair P2 6)}) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start (set Count 6 to:(sites Track))) (play (if (<= 16 (count at:(mapEntry \"Hogon\" Mover))) (move Select (from (mapEntry \"Hogon\" Mover)) (then (sow))) (if (\"NoOwnedHoleWithMoreThanOneSeedExceptHogon\" Mover) (if (\"IsOlderPlayer\") (move Pass) (do (if (\"NoOwnedHoleWithMoreThanOneSeedExceptHogon\" Next) (forEach Site (difference (sites Next) (mapEntry \"Hogon\" Next)) (if (is Occupied (site)) (fromTo (from (site)) (to (mapEntry \"Hogon\" Mover)))))) next:(move Select (from (mapEntry \"Hogon\" Mover) if:(< 1 (count at:(from)))) (then (sow))))) (move Select (from (difference (sites Mover) (mapEntry \"Hogon\" Mover)) if:(< 1 (count at:(from)))) (then (sow)))))) (end (forEach Player if:(\"NoOwnedHoleWithMoreThanOneSeed\" Player) (result Player Loss))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayed on 5x5 grid including diagonals and pieces are played on the intersections of the lines. One player has four tigers, placed on the corners, and the other has up to 20 goats, placed on the board on a free space. Tigers and goats can move to an adjacent intersection along the lines on the board. Tigers may capture goats by hopping over them. The game ends when tigers have captured all of the goats or the goats block the tigers from being able to move. The objective of the player 2 is to capture all the tigers.\n\n###\n\n", "completion": "(game \"Baghchal\" (players 2) (equipment { (\"AlquerqueBoard\" 5 5) (hand P1) (piece \"Goat\" P1 \"StepToEmpty\") (piece \"Tiger\" P2 (or \"HopCapture\" \"StepToEmpty\"))}) (rules (start { (place \"Tiger2\" (sites Corners)) (place \"Goat1\" (handSite P1) count:20)}) phases:{ (phase \"Placement\" P1 (play (move (from (handSite P1)) (to (sites Empty)))) (nextPhase (\"HandEmpty\" P1))) (\"PhaseMovePiece\" \"Movement\")} (end (\"NoMovesLossAndLessNumPiecesPlayerLoss\" P1 0)))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x12 board, divided in half, where the spaces are rendered as points. Fifteen pieces per player. Pieces begin on the leftmost point on their opponent's side of the board. Two six-sided 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. When doubles are thrown, the player plays the throw twice. Each player progresses in a clockwise direction around the board, to bear off upon reaching the final point on the opponent's side of the board. One piece must reach the opposite quadrant of the board from where it entered before the player may place more than one piece on a point. When a piece lands on a point occupied by a single opponent's piece, the opponent's piece is removed from the board and must enter the board again. When all of the player's pieces have entered the opposite quadrant from the one in which they entered, they may begin to bear off. The first player to bear off all their pieces wins. \n\n###\n\n", "completion": "(define \"Bar\" (mapEntry #1)) (define \"AllPieceInOpponentSide\" (\"AllOwnedPiecesIn\" (sites Mover \"OppositeQuadrant\"))) (define \"PieceInOpponentQuadrantOrNoPieceInTheBoard\" (or { (all Sites (difference (sites Board) \"StartPos\") if:(!= (who at:(site)) (mover))) (is Occupied (\"Bar\" (mover))) (< (size Stack at:(\"StartPos\")) 14) (not (all Sites (sites Mover \"OppositeQuadrant\") if:(!= (who at:(site)) (mover))))})) (define \"CanEscape\" (\"IsOffBoard\" #1)) (define \"AllPieceEscaped\" (no Pieces Mover)) (define \"RemoveAPiece\" (move Remove (site))) (define \"NextSiteFromDistDoubleDice\" (\"NextSiteOnTrack\" (/ (count Pips) 2) from:#1)) (define \"StartPos\" (\"NextSiteOnTrack\" 1 from:(\"Bar\" (mover)))) (define \"NextSiteFrom\" (\"NextSiteOnTrack\" (pips) from:#1)) (game \"Jacquet\" (players 2) (equipment { (\"BackgammonBoard\" \"BackgammonTracksSameDirectionOppositeCornersWithBars\") (dice num:2) (piece \"Disc\" Each) (map {(pair 1 6) (pair 2 19)}) (regions \"Home\" P1 { 13..18}) (regions \"Home\" P2 { 12..7}) (regions \"OppositeQuadrant\" P1 { 0..5}) (regions \"OppositeQuadrant\" P2 { 20..25})}) (rules (start { (place Stack \"Disc1\" 13 count:15) (place Stack \"Disc2\" 12 count:15)}) (play (\"RollEachNewTurnMove\" (forEach Die replayDouble:True if:(\"DieNotUsed\") (forEach Site (sites Occupied by:Mover) (if (and (\"CanEscape\" (\"NextSiteFrom\" (site))) (\"AllPieceInOpponentSide\")) (\"RemoveAPiece\") (if (if (!= (site) \"StartPos\") True (\"PieceInOpponentQuadrantOrNoPieceInTheBoard\")) (move (from (site)) (to (\"NextSiteFrom\" (site)) if:(\"NoEnemyOrOnlyOne\" (to)) (\"HittingCapture\" (\"Bar\" (next)))))))) (then (\"ReplayNotAllDiceUsed\"))))) (end (if (\"AllPieceEscaped\") (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nOne player has red pegs, the other player blue pegs. The player who can get all his color pegs pressed down first wins the game. Each player can press his opponent's color pegs. At any time during the game, if it becomes impossible to press a peg next to the last one pressed the game finishes. The player with the most of his own color pegs pressed down is the winner. \n\n###\n\n", "completion": "(define \"AllSitesWithoutOwnedPiece\" (difference (sites Board) (union (sites P1) (sites P2)))) (game \"Press Ups\" (players 2) (equipment { (board (square 7)) (piece \"Disc\" Each) (piece \"Disc\" Neutral) (regions P1 (difference (union (sites Bottom) (sites Top)) (union (sites Right) (sites Left)))) (regions P2 (difference (union (sites Right) (sites Left)) (union (sites Bottom) (sites Top))))}) (rules (start { (place \"Disc1\" (sites P1)) (place \"Disc2\" (sites P2)) (place \"Disc0\" \"AllSitesWithoutOwnedPiece\")}) phases:{ (phase \"Init\" (play (move Select (from \"AllSitesWithoutOwnedPiece\") (then (remove (last To))))) (nextPhase \"Remove\")) (phase \"Remove\" (play (move Select (from (sites Around (last To)) if:(is Occupied (from))) (then (remove (last To))))))} (end { (\"CaptureAll\" P1) (\"CaptureAll\" P2) (if (no Moves Next) (byScore { (score P1 (count Pieces P1)) (score P2 (count Pieces P2))}))}))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a regular cross board tilled by squares (example: Pachisi).\n\n###\n\n", "completion": "(define \"CrossBoard\" (board (\"CrossGraph\" #1 #2 #4) #3)) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nChecks if a die is not used when using the ludeme (forEach Die ...).\n\n###\n\n", "completion": "(define \"DieNotUsed\" (!= (pips) 0)) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe goal is to capture the black queen with the white pieces. \n\n###\n\n", "completion": "(game \"Capture the Queen\" (players 2) (equipment { (board (square 8)) (piece \"Queen\" Each (\"SlideCapture\"))}) (rules (start { (place \"Queen2\" coord:\"D8\") (place \"Queen1\" {\"B1\" \"C1\" \"E1\" \"F1\"})}) (play (forEach Piece)) (end { (\"CaptureAll\" P2) (if (= (count Moves) 100) (result P2 Win))}))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"NextHoleFrom\" (\"NextSiteOnTrack\" #2 from:#1)) (define \"RightMost\" (trackSite FirstSite from:(trackSite FirstSite if:(not (is Mover (who at:(to))))) if:(is Mover (who at:(to))))) (define \"Columns\" 10) (game \"Mwendo\" (players 4) (equipment { (mancalaBoard 4 \"Columns\" store:None (track \"Track\" \"10,N,E,S,W\" loop:True)) (piece \"Seed\" Each) (regions P1 (sites {0..5})) (regions P2 (sites {6..9 19 29})) (regions P3 (sites {39..34})) (regions P4 (sites {33..30 20 10}))}) (rules (start { (place \"Seed1\" (sites P1) counts:{3}) (place \"Seed2\" (sites P2) counts:{3}) (place \"Seed3\" (sites P3) counts:{3}) (place \"Seed4\" (sites P4) counts:{3})}) (play (if (!= 1 (count Pieces Mover)) (or (move Select (from (\"RightMost\")) (then (sow numPerHole:(if (is Empty (to)) 2 1) sowEffect:(if (and (!= (mover) (what at:(to))) (is Occupied (to))) (and (remove (to) count:(count at:(to))) (add (piece (id \"Seed\" Mover)) (to (to)) count:(count at:(to))))) apply:(if (= 2 (count at:(to))) (moveAgain))))) (if (\"NewTurn\") (move (from (\"RightMost\")) (to (\"NextHoleFrom\" (\"RightMost\") 1) (apply (if (and (!= (mover) (what at:(to))) (is Occupied (to))) (and (remove (to) count:(count at:(to))) (add (piece (id \"Seed\" Mover)) (to (to)) count:(count at:(to))))))) count:(count at:(\"RightMost\"))))) (move (from (\"RightMost\")) (to (trackSite FirstSite from:(from) if:(\"IsEnemyAt\" (to))) (apply (and (remove (to) count:(count at:(to))) (add (piece (id \"Seed\" Mover)) (to (to)) count:(count at:(to))))))))) (end (forEach NonMover if:(no Pieces Player) (result Player Loss)))))\n\n###\n\n", "completion": "4x4-16 board, played only along the perimeter. Three counters per hole. Any number of players. Holes are distributed equally among the players. Sowing occurs in a clockwise direction. Counters are sown one per occupied hole, two per empty hole. Each player owns the holes in which their counters are located at the beginning of their turn, and they must sow from the rightmost hole. If the final counter of a sowing falls into an empty hole, the player sows again from the rightmost hole. Alternatively, a player may place all of the counters from the rightmost counter into the next hole, but this cannot be done after a move. When counters fall into holes belonging to an opponent, these hole and the counters in it are captured by the player, but remain in play. When a player has a single counter and empty holes in from of it, this counter leaps to the next hole occupied by the opponent. The player who captures all of the opponent's holes wins. Each row has 10 holes. END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines two table tracks following the same directions and using hand sites.\n\n###\n\n", "completion": "(define \"TableTracksSameDirectionWithHands\" { (track \"Track1\" {24 0..5 6..11 23..18 17..12 #1} P1 directed:True) (track \"Track2\" {25 0..5 6..11 23..18 17..12 #1} P2 directed:True)}) END" }, { "prompt": "Construct a Ludii game based on the following description\nTwo isosceles triangles, which meet at the apices with the height of each triangle drawn and a line perpendicular to it in each triangle at its midpoint intersecting with the sides. Another line, bisected by the point where the spices of the triangles meet, with a shot line extending down on either end of the line, and a matching short line next to it at either end. Eight pieces per player, lined up with six on the two rows of the triangle closest to the player and two on the ends of the short lines to the left of the player. Players alternate turns moving a piece to an empty adjacent spot along the lines of the board. A piece can capture an opponent's piece by hopping over it to an empty adjacent point immediately on the opposite side of the opponent's piece along the lines on the board. The player who captures all of the opponent's pieces wins. \n\n###\n\n", "completion": "(game \"Kaua Dorki\" (players 2) (equipment { (board (merge { (scale 1 2 (wedge 3)) (shift 0 4 (rotate 180 (scale 1 2 (wedge 3)))) (shift 0 4 (rectangle 1 5))}) use:Vertex) (piece \"Marker\" Each (or (\"HopCapture\") (\"StepToEmpty\")))}) (rules (start { (place \"Marker1\" (expand (union (sites Bottom) (sites {\"A3\"})))) (place \"Marker2\" (expand (union (sites Top) (sites {\"E3\"}))))}) (play (forEach Piece)) (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Construct a Ludii game based on the following description\n14x14 board. 32 pieces per player. Pieces move as follows: King (x1): Moves any distance orthogonally or diagonally; Crown Prince (x1): moves up to six spaces orthogonally or diagonally; Minister (x1): moves up to six spaces orthogonally or diagonally; Military leader (x1): moves up to six spaces orthogonally or diagonally; Elephant (x2): moves forward orthogonally up to five spaces with the possibility of then moving one space backward diagonally; Cart (x2): moves any distance orthogonally; Horse (x4): moves one space orthogonally and then one space diagonally, leaping over any intervening pieces; Machinist (x4): moves forward orthogonally up to four spaces, forward diagonally one space, or backward orthogonally one space; Archer (x4): moves forward orthogonally up to three spaces, forward diagonally one space, or backward orthogonally one space; Spearmen (x4): moves forward orthogonally up to two spaces, forward diagonally one space, or backward orthogonally one space; Swordsmen (x4): forward one space orthogonally or diagonally or backward one space orthogonally. Players place their pieces on their half of the board in any arrangement they wish. When a piece moves to a space occupied by an opponent's piece, the opponent's piece is captured. If the King can be captured by the opponent on their next turn, it is in check and must not be in check at the end of the player's turn. If this is not possible, the player loses. \n\n###\n\n", "completion": "(game \"Chaturanga (14x14)\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 14)) (\"ChessQueen\" \"King\") (piece \"Prince\" Each (\"SlideCapture\" ~ (between (max 6) if:(is Empty (between))))) (piece \"Bishop\" Each (\"SlideCapture\" ~ (between (max 6) if:(is Empty (between))))) (piece \"Queen\" Each (\"SlideCapture\" ~ (between (max 6) if:(is Empty (between))))) (piece \"Elephant\" Each (or { (\"SlideCapture\" Forward (between (max 5) if:(is Empty (between)))) (\"StepToNotFriend\" (directions {BR BL})) (forEach Direction Forward (between (range 1 5)) (to if:(is Empty (to)) (apply (and { (move (from) (to (sites To (step (from (to)) (if (is Mover P1) (directions {SW SE}) (directions {NW NE})) (to if:(not (\"IsFriendAt\" (to))) (apply (if (\"IsEnemyAt\" (to)) (remove (to)))))))))}))))})) (\"ChessRook\" \"Rook\") (\"ChessKnight\" \"Horse\") (piece \"Wrench\" Each (or (\"SlideCapture\" Forward (between (max 4) if:(is Empty (between)))) (\"StepToNotFriend\" (directions {FR FL Backward})))) (piece \"Archer\" Each (or (\"SlideCapture\" Forward (between (max 3) if:(is Empty (between)))) (\"StepToNotFriend\" (directions {FR FL Backward})))) (piece \"Spear\" Each (or (\"SlideCapture\" Forward (between (max 2) if:(is Empty (between)))) (\"StepToNotFriend\" (directions {FR FL Backward})))) (piece \"Sword\" Each (\"StepToNotFriend\" (directions {Forward FR FL Backward}))) (hand Each size:11) (regions P1 (expand (sites Bottom) steps:6)) (regions P2 (expand (sites Top) steps:6))}) (rules (start { (place \"King1\" (handSite P1)) (place \"King2\" (handSite P2)) (place \"Prince1\" (handSite P1 1)) (place \"Prince2\" (handSite P2 1)) (place \"Bishop1\" (handSite P1 2)) (place \"Bishop2\" (handSite P2 2)) (place \"Queen1\" (handSite P1 3)) (place \"Queen2\" (handSite P2 3)) (place \"Elephant1\" (handSite P1 4)) (place \"Elephant2\" (handSite P2 4)) (place \"Rook1\" (handSite P1 5) count:2) (place \"Rook2\" (handSite P2 5) count:2) (place \"Horse1\" (handSite P1 6) count:4) (place \"Horse2\" (handSite P2 6) count:4) (place \"Wrench1\" (handSite P1 7) count:4) (place \"Wrench2\" (handSite P2 7) count:4) (place \"Archer1\" (handSite P1 8) count:4) (place \"Archer2\" (handSite P2 8) count:4) (place \"Spear1\" (handSite P1 9) count:4) (place \"Spear1\" (handSite P2 9) count:4) (place \"Sword1\" (handSite P1 10) count:4) (place \"Sword2\" (handSite P2 10) count:4)}) phases:{ (phase \"Placement\" (play (move (from (sites Hand Mover) if:(is Occupied (from))) (to (intersection (sites Empty) (sites Mover))))) (nextPhase Mover (all Sites (sites Hand Mover) if:(is Empty (site))) \"Play\")) (phase \"Play\" (play (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King\" Mover)))))} (end (\"Checkmate\" \"King\")))) END" }, { "prompt": "What does the following global Ludii definition do?\n(define \"KintsBoard\" (board (add (merge { (shift -1.25 -0.34 (rotate 30 (rectangle 6 1))) (rectangle 1 5) (rectangle 5 1) (shift 0 6 (rectangle 5 1)) (shift 0 10 (rectangle 1 5)) (shift 7 0 (rectangle 1 5)) (shift 7 10 (rectangle 1 5)) (shift 11 0 (rectangle 5 1)) (shift 11 6 (rectangle 5 1)) (shift 12.25 5.33 (rotate 30 (rectangle 6 1)))}) edges:{{13 14} {22 28} {37 36} {9 23}}) #1 use:Vertex))\n\n###\n\n", "completion": "Defines a rectangular board with some arcs used in some native american games such as Kints. END" }, { "prompt": "Construct a Ludii game based on the following description\n2x4 board with two stores on the ends. Six counters in each hole. Instead of owning the row of holes closest to them, players own the holes on the left half of the board. Play begins from any of the player's holes, sowing in either direction. When the last counter is sown, making the hole contain two or four counters, these are captured. If the adjacent holes also contain two or four counters, these are also captured. If the last counter falls into a hole, making it contain a number other than two or four, and adjacent holes contain two or four, the counters from only one of these adjacent holes may be captured. Play ends when each player is reduced to one counter. A second round begins with each player placing six counters in as many of their holes as they can, returning surplus to the store. Play continues as before. Rounds are played until one player loses all their counters. \n\n###\n\n", "completion": "(define \"OneSingleCounterPerPlayer\" (and (>= 1 (count Pieces All in:(sites P1))) (>= 1 (count Pieces All in:(sites P2))))) (define \"NoPieceOnBoard\" (no Pieces All in:(union (sites Top) (sites Bottom)))) (define \"LastHole\" (last To afterConsequence:True)) (define \"EastHoleExist\" (!= (to) (\"EastHole\"))) (define \"EastHole\" (ahead (to) E)) (define \"WestHoleExist\" (!= (to) (\"WestHole\"))) (define \"WestHole\" (ahead (to) W)) (game \"Gifia\" (players 2) (equipment { (mancalaBoard 2 4 { (track \"TrackCCW\" \"1,E,N,W\" loop:True) (track \"TrackCW\" \"4,W,N,E\" loop:True)}) (regions P1 (difference (expand (sites Left) steps:2) (sites Left))) (regions P2 (difference (expand (sites Right) steps:2) (sites Right))) (map {(pair P1 FirstSite) (pair P2 LastSite)}) (piece \"Seed\" Shared)}) (rules (start (set Count 6 to:(sites Track))) phases:{ (phase \"Sowing\" (play (if (\"SameTurn\") (or (move (from (ahead (\"LastHole\") W)) (to (mapEntry Mover)) count:(count at:(ahead (\"LastHole\") W))) (move (from (ahead (\"LastHole\") E)) (to (mapEntry Mover)) count:(count at:(ahead (\"LastHole\") E)))) (or (move Select (from (sites Mover) if:(is Occupied (from))) (then (sow \"TrackCCW\" apply:(if (or (= 2 (count at:(to))) (= 4 (count at:(to)))) (and { (fromTo (from (to)) (to (mapEntry Mover)) count:(count at:(to))) (if (\"WestHoleExist\") (if (or (= 2 (count at:(\"WestHole\"))) (= 4 (count at:(\"WestHole\")))) (fromTo (from (\"WestHole\")) (to (mapEntry Mover)) count:(count at:(\"WestHole\"))))) (if (\"EastHoleExist\") (if (or (= 2 (count at:(\"EastHole\"))) (= 4 (count at:(\"EastHole\")))) (fromTo (from (\"EastHole\")) (to (mapEntry Mover)) count:(count at:(\"EastHole\")))))}) (if (and (if (\"WestHoleExist\") (if (or (= 2 (count at:(\"WestHole\"))) (= 4 (count at:(\"WestHole\")))) False)) (if (\"EastHoleExist\") (if (or (= 2 (count at:(\"EastHole\"))) (= 4 (count at:(\"EastHole\")))) False))) (moveAgain)))))) (move Select (from (sites Mover) if:(is Occupied (from))) (then (sow \"TrackCW\" apply:(if (or (= 2 (count at:(to))) (= 4 (count at:(to)))) (and { (fromTo (from (to)) (to (mapEntry Mover)) count:(count at:(to))) (if (\"WestHoleExist\") (if (or (= 2 (count at:(\"WestHole\"))) (= 4 (count at:(\"WestHole\")))) (fromTo (from (\"WestHole\")) (to (mapEntry Mover)) count:(count at:(\"WestHole\"))))) (if (\"EastHoleExist\") (if (or (= 2 (count at:(\"EastHole\"))) (= 4 (count at:(\"EastHole\")))) (fromTo (from (\"EastHole\")) (to (mapEntry Mover)) count:(count at:(\"EastHole\")))))}) (if (and (if (\"WestHoleExist\") (if (or (= 2 (count at:(\"WestHole\"))) (= 4 (count at:(\"WestHole\")))) False)) (if (\"EastHoleExist\") (if (or (= 2 (count at:(\"EastHole\"))) (= 4 (count at:(\"EastHole\")))) False))) (moveAgain))))))) (then (if (\"OneSingleCounterPerPlayer\") (and (forEach Site (sites P1) (fromTo (from (site)) (to (mapEntry P1)) count:(count at:(site)))) (forEach Site (sites P2) (fromTo (from (site)) (to (mapEntry P2)) count:(count at:(site))))))))) (end (if (\"NoPieceOnBoard\") { (if (> 6 (count at:(mapEntry P1))) (result P2 Win)) (if (> 6 (count at:(mapEntry P2))) (result P1 Win))})) (nextPhase (\"NoPieceOnBoard\") \"BetweenRounds\")) (phase \"BetweenRounds\" (play (if (not (all Sites (sites Mover) if:(is Occupied (site)))) (if (<= 6 (count at:(mapEntry Mover))) (move (from (mapEntry Mover)) (to (sites Mover) if:(is Empty (to))) count:6)))) (nextPhase (all Passed) \"Sowing\"))})) END" }, { "prompt": "What does the following global Ludii definition do?\n(define \"CrossGraph\" (merge (shift 0 (/ (- #2 #1) 2) (rectangle #1 #2 #3)) (shift (/ (- #2 #1) 2) 0 (rectangle #2 #1 #3))))\n\n###\n\n", "completion": "Defines a regular cross graph tilled by squares (example: Pachisi). END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nOrder 3 board -> Order 4 board\n(define \"HexHex\" (board (tri Hexagon 3) use:Vertex)) (define \"BoardUsed\" \"HexHex\") (define \"Connection\" Orthogonal) (define \"CaptureSurroundedPiece\" (enclose (from (last To)) Orthogonal (between if:(\"IsEnemyAt\" (between)) (apply (and (addScore Mover 1) (remove (between))))))) (game \"HexGo\" (players 2) (equipment { \"BoardUsed\" (piece \"Ball\" P1) (piece \"Ball\" P2)}) (rules (meta (no Repeat)) (play (or (do (move Add (to (sites Empty)) (then \"CaptureSurroundedPiece\")) ifAfterwards:(\"HasFreedom\" Orthogonal)) (move Pass))) (end (if (all Passed) (byScore { (score P1 (+ (score P1) (size Territory P1))) (score P2 (+ (score P2) (size Territory P2)))})))))\n\n###\n\n", "completion": "(define \"HexHex\" (board (tri Hexagon 4) use:Vertex)) (define \"BoardUsed\" \"HexHex\") (define \"Connection\" Orthogonal) (define \"CaptureSurroundedPiece\" (enclose (from (last To)) Orthogonal (between if:(\"IsEnemyAt\" (between)) (apply (and (addScore Mover 1) (remove (between))))))) (game \"HexGo\" (players 2) (equipment { \"BoardUsed\" (piece \"Ball\" P1) (piece \"Ball\" P2)}) (rules (meta (no Repeat)) (play (or (do (move Add (to (sites Empty)) (then \"CaptureSurroundedPiece\")) ifAfterwards:(\"HasFreedom\" Orthogonal)) (move Pass))) (end (if (all Passed) (byScore { (score P1 (+ (score P1) (size Territory P1))) (score P2 (+ (score P2) (size Territory P2)))}))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nEach player has 8 holes. -> Each player has 12 holes.\n(define \"PiecesOwnedBy\" (count Cell at:(handSite #1))) (define \"APlayerCanNotMove\" (and (not (is Next Mover)) (or (all Sites (sites P1) if:(or (!= 0 (state at:(site))) (is Empty (site)))) (all Sites (sites P2) if:(or (!= 0 (state at:(site))) (is Empty (site))))))) (define \"Columns\" 6) (game \"Leyla Gobale (Somaliland)\" (players 2) (equipment { (mancalaBoard 2 8 store:None (track \"Track\" \"7,W,N,E\" loop:True)) (piece \"Seed\" Shared) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (hand Each)}) (rules (start (set Count 4 to:(sites Track))) (play (or { (move Select (from (if (= 0 (count Moves)) (sites {5}) (if (\"SameTurn\") (sites {(var \"Replay\")}) (sites Mover))) if:(and (is Occupied (from)) (= 0 (state at:(from))))) (then (sow apply:(if (< 1 (count at:(to))) (if (= 0 (state at:(to))) (and (moveAgain) (set Var \"Replay\" (to)))) (if (is In (to) (sites Mover)) (if (!= 3 (count at:(\"OppositePitTwoRows\" (to)))) (if (!= 0 (count at:(\"OppositePitTwoRows\" (to)))) (fromTo (from (\"OppositePitTwoRows\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePitTwoRows\" (to))))) (and { (fromTo (from (\"OppositePitTwoRows\" (to))) (to (to)) count:1) (set State at:(to) (mover)) (set State at:(\"OppositePitTwoRows\" (to)) (mover))})))))))} (then (if (\"APlayerCanNotMove\") (and { (forEach Site (sites P1) (if (= 0 (state at:(site))) (fromTo (from (site)) (to (handSite P1)) count:(count at:(site))))) (forEach Site (sites P2) (if (= 0 (state at:(site))) (fromTo (from (site)) (to (handSite P2)) count:(count at:(site))))) (forEach Site (sites Board) (if (= (state at:(site)) P1) (fromTo (from (site)) (to (handSite P1)) count:(count at:(site))) (if (= (state at:(site)) P2) (fromTo (from (site)) (to (handSite P2)) count:(count at:(site))))))}))))) (end (\"MancalaByScoreWhen\" (\"NoPieceOnBoard\")))))\n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (count Cell at:(handSite #1))) (define \"APlayerCanNotMove\" (and (not (is Next Mover)) (or (all Sites (sites P1) if:(or (!= 0 (state at:(site))) (is Empty (site)))) (all Sites (sites P2) if:(or (!= 0 (state at:(site))) (is Empty (site))))))) (define \"Columns\" 6) (game \"Leyla Gobale (Somaliland)\" (players 2) (equipment { (mancalaBoard 2 12 store:None (track \"Track\" \"11,W,N,E\" loop:True)) (piece \"Seed\" Shared) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (hand Each)}) (rules (start (set Count 4 to:(sites Track))) (play (or { (move Select (from (if (= 0 (count Moves)) (sites {5}) (if (\"SameTurn\") (sites {(var \"Replay\")}) (sites Mover))) if:(and (is Occupied (from)) (= 0 (state at:(from))))) (then (sow apply:(if (< 1 (count at:(to))) (if (= 0 (state at:(to))) (and (moveAgain) (set Var \"Replay\" (to)))) (if (is In (to) (sites Mover)) (if (!= 3 (count at:(\"OppositePitTwoRows\" (to)))) (if (!= 0 (count at:(\"OppositePitTwoRows\" (to)))) (fromTo (from (\"OppositePitTwoRows\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePitTwoRows\" (to))))) (and { (fromTo (from (\"OppositePitTwoRows\" (to))) (to (to)) count:1) (set State at:(to) (mover)) (set State at:(\"OppositePitTwoRows\" (to)) (mover))})))))))} (then (if (\"APlayerCanNotMove\") (and { (forEach Site (sites P1) (if (= 0 (state at:(site))) (fromTo (from (site)) (to (handSite P1)) count:(count at:(site))))) (forEach Site (sites P2) (if (= 0 (state at:(site))) (fromTo (from (site)) (to (handSite P2)) count:(count at:(site))))) (forEach Site (sites Board) (if (= (state at:(site)) P1) (fromTo (from (site)) (to (handSite P1)) count:(count at:(site))) (if (= (state at:(site)) P2) (fromTo (from (site)) (to (handSite P2)) count:(count at:(site))))))}))))) (end (\"MancalaByScoreWhen\" (\"NoPieceOnBoard\"))))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nReturns the number of pieces owned by a player around a given site.\n\n###\n\n", "completion": "(define \"OccupiedNbors\" (count Sites in:(intersection (sites Around #1) (sites Occupied by:#2)))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines starting rules placing one counter on each white cell of a square board (e.g. Starting rules of Draughts).\n\n###\n\n", "completion": "(define \"WhiteCellsSetup\" (start { (place \"Counter1\" (difference (expand (sites Bottom) steps:(- #1 1)) (sites Phase 0))) (place \"Counter2\" (difference (expand (sites Top) steps:(- #1 1)) (sites Phase 0)))})) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayed on a board with 12 points per side, divided in half. Play occurs only in the top right quadrant of the board. Fifteen pieces per player. Two six-sided dice. A double throw grants the player another throw. Players enter their pieces according to the throws of the dice, and they must use the entire value of a die to place or to move a piece. When all of a player's pieces are on the board, they may bear off their pieces with throws equal to the number of remaining spaces, plus one. If a piece lands on a point with a single piece belonging to the opponent, the opponent's piece is removed from the board and must re-enter. The player who bears off all their pieces first wins. \n\n###\n\n", "completion": "(define \"NextSiteFrom\" (\"NextSiteOnTrack\" #2 from:#1)) (game \"Paumecary\" (players 2) (equipment { (\"BackgammonBoard\" { (track \"Track1\" {26..20 End} P1 directed:True) (track \"Track2\" {27 25..20 End} P2 directed:True)}) (dice d:6 num:2) (piece \"Disc\" Each (or (forEach Die replayDouble:True if:(\"DieNotUsed\") (move (from (from)) (to (\"NextSiteFrom\" (from) (pips)) if:(\"NoEnemyOrOnlyOne\" (to)) (\"HittingCapture\" (handSite Next)))) (then (\"ReplayNotAllDiceUsed\"))) (if (is Empty (handSite Mover)) (forEach Die replayDouble:True if:(and (\"DieNotUsed\") (\"IsEndTrack\" (\"NextSiteFrom\" (from) (pips)))) (move Remove (from)) (then (\"ReplayNotAllDiceUsed\")))))) (hand Each)}) (rules (start { (place Stack \"Disc1\" (handSite P1) count:15) (place Stack \"Disc2\" (handSite P2) count:15)}) (play (\"RollEachNewTurnMove\" (or (forEach Piece) (forEach Piece container:(mover))))) (end (\"EscapeWin\")))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nEach row has 7 holes. -> Each row has 8 holes.\n(define \"Columns\" 7) (game \"Muvalavala (Quioco)\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"0,E,N1,W\" loop:True P1) (track \"Track2\" \"14,E,N1,W\" loop:True P2)}) (piece \"Seed\" Shared) (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))}) (rules (start { (set Count 1 to:(union { (difference (sites P1 \"Home\") (sites Left)) (difference (sites P2 \"Home\") (sites Right))})) (set Count (- (- (* 4 \"Columns\") 2) (* 2 (- \"Columns\" 1))) to:(union (intersection (sites Left) (sites P1 \"Outer\")) (intersection (sites Right) (sites P2 \"Outer\"))))}) (play (move Select (from (if (\"SameTurn\") (\"LastHoleSowed\") (sites Mover \"Home\")) if:(> (count at:(from)) 1)) (then (sow \"Track\" owner:(mover) apply:(if (and { (> (count at:(to)) 1) (is In (to) (sites Mover \"Inner\")) (> (count at:(\"OppositePit\" (to))) 0)}) (and { (fromTo (from (\"OppositePit\" (to))) (to (to)) count:(count at:(\"OppositePit\" (to)))) (if (> (count at:(\"OppositeOuterPit\" (to))) 0) (fromTo (from (\"OppositeOuterPit\" (to))) (to (to)) count:(count at:(\"OppositeOuterPit\" (to))))) (sow (to) count:(+ (count at:(\"OppositePit\" (to))) (count at:(\"OppositeOuterPit\" (to)))) \"Track\" owner:(mover))}) (if (> (count at:(to)) 1) (moveAgain))))))) (end (\"BlockWin\"))))\n\n###\n\n", "completion": "(define \"Columns\" 8) (game \"Muvalavala (Quioco)\" (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)}) (piece \"Seed\" Shared) (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))}) (rules (start { (set Count 1 to:(union { (difference (sites P1 \"Home\") (sites Left)) (difference (sites P2 \"Home\") (sites Right))})) (set Count (- (- (* 4 \"Columns\") 2) (* 2 (- \"Columns\" 1))) to:(union (intersection (sites Left) (sites P1 \"Outer\")) (intersection (sites Right) (sites P2 \"Outer\"))))}) (play (move Select (from (if (\"SameTurn\") (\"LastHoleSowed\") (sites Mover \"Home\")) if:(> (count at:(from)) 1)) (then (sow \"Track\" owner:(mover) apply:(if (and { (> (count at:(to)) 1) (is In (to) (sites Mover \"Inner\")) (> (count at:(\"OppositePit\" (to))) 0)}) (and { (fromTo (from (\"OppositePit\" (to))) (to (to)) count:(count at:(\"OppositePit\" (to)))) (if (> (count at:(\"OppositeOuterPit\" (to))) 0) (fromTo (from (\"OppositeOuterPit\" (to))) (to (to)) count:(count at:(\"OppositeOuterPit\" (to))))) (sow (to) count:(+ (count at:(\"OppositePit\" (to))) (count at:(\"OppositeOuterPit\" (to)))) \"Track\" owner:(mover))}) (if (> (count at:(to)) 1) (moveAgain))))))) (end (\"BlockWin\")))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nMakes a player losing when this player has no moves. This ludemeplex can be used only in an ending condition.\n\n###\n\n", "completion": "(define \"ForEachNonMoverNoMovesLoss\" (forEach NonMover if:(no Moves Player) (result Player Loss))) END" }, { "prompt": "What does the following global Ludii definition do?\n(define \"StepDiagonalToEmpty\" (move Step Diagonal (to if:(is Empty (to)))))\n\n###\n\n", "completion": "Defines a step move to all the diagonal directions to an empty site. END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nIf 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.\n\n###\n\n", "completion": "(define \"ReachWin\" (if (is In (last To) #1) (result #2 Win))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a graphics turtle walk to build a large T piece.\n\n###\n\n", "completion": "(define \"TWalk\" { {F F F L F R R F F}}) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nChecks if the team has no pieces and makes it win. This ludemeplex can be used only in an ending condition.\n\n###\n\n", "completion": "(define \"EscapeTeamWin\" (if (no Pieces TeamMover) (result TeamMover Win))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines a piece moving like a gold in Shogi. The effect of the capture have to be defined.\n\n###\n\n", "completion": "(define \"ShogiGold\" (piece #1 Each (move Step (directions {Forward Backward Rightward Leftward FL FR}) (to if:(not (\"IsFriendAt\" (to))) #2) #3))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines the capture of a stack with an enemy piece at the top returning to a site. This ludemeplex can be used only as an effect.\n\n###\n\n", "completion": "(define \"HittingStackCapture\" (apply (if (\"IsEnemyAt\" (to)) (forEach Level (to) FromTop (fromTo (from (to) level:(level)) (to #1)))))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nChecks if P1 has no moves and P2 wins and checks if P2 has no pieces and P1 wins. This ludemeplex can be used only in an ending condition.\n\n###\n\n", "completion": "(define \"NoMovesP1NoPiecesP2\" { (if (no Moves P1) (result P2 Win)) (if (no Pieces P2) (result P1 Win))}) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nChecks if a region has no sites.\n\n###\n\n", "completion": "(define \"NoSites\" (= (count Sites in:#1) 0)) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe board is 8x8. -> The board is 10x10.\n(game \"T'uk T'uk\" (players 2) (equipment { (board (square 8)) (piece \"Marker\" Each (move Slide Orthogonal))}) (rules (start { (place \"Marker1\" (sites Bottom)) (place \"Marker2\" (sites Top))}) (play (forEach Piece)) (end (\"BlockWin\"))))\n\n###\n\n", "completion": "(game \"T'uk T'uk\" (players 2) (equipment { (board (square 10)) (piece \"Marker\" Each (move Slide Orthogonal))}) (rules (start { (place \"Marker1\" (sites Bottom)) (place \"Marker2\" (sites Top))}) (play (forEach Piece)) (end (\"BlockWin\")))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nChecks if the next player has no legal moves and apply a specific result to the next player. This ludemeplex can be used only in an ending condition.\n\n###\n\n", "completion": "(define \"NoMoves\" (if (no Moves Next) (result Next #1))) END" }, { "prompt": "Construct a global Ludii definition which fulfills the following requirements.\nDefines starting rules placing one piece on each site before and after the centre (e.g. Starting rules of Zamma).\n\n###\n\n", "completion": "(define \"BeforeAfterCentreSetup\" (start { (place #1 (forEach (sites Board) if:(< (site) (centrePoint)))) (place #2 (forEach (sites Board) if:(> (site) (centrePoint))))})) END" }, { "prompt": "Construct a Ludii game based on the following description\n4-row board, of any number of holes. Only the outer rows are used. Four counters in each hole in the outer row. Sowing occurs in an anti-clockwise direction. Players do not own rows, instead, over the course of their sowing, their counters are always grouped together, and sowing must occur from the rearmost counter in the player's series. If, after sowing, a player's series has one counter in the foremost hole and two in the next hole behind it, the player sows again from the rearmost hole. If the player overtakes the opponent's series, the player captures any counters in the opponent's series and places all of them in the hole immediately behind the player's series, now becoming the rearmost hole. If the rearmost hole contains a single counter, it is moved into the next hole which then becomes the rearmost hole for the next turn. If a player is reduced to a single counter, it can be moved two holes on the player's turn. The player who successfully captures all of the opponent's counters wins. Each row has 16 holes.\n\n###\n\n", "completion": "(define \"LeftMost\" (trackSite FirstSite from:(trackSite FirstSite if:(not (is Mover (who at:(to))))) if:(is Mover (who at:(to))))) (define \"NextHoleFrom\" (\"NextSiteOnTrack\" #3 from:#1 #2)) (define \"Columns\" 16) (game \"Chiana wa Kunja\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None (track \"Track\" \"0,E,63,W\" loop:True)) (piece \"Seed\" Each) (hand Shared)}) (rules (start { (place \"Seed1\" (sites Bottom) counts:{4}) (place \"Seed2\" (sites Top) counts:{4})}) (play (or (move Select (from (\"LeftMost\")) (then (do (and (forEach Site (sites Track \"Track\" from:(last From) to:(trackSite Move from:(last From) steps:(count at:(last From)))) (if (!= (mover) (who at:(site))) (and (remove (site) count:(count at:(site))) (add (piece (id \"Seed\" Mover)) (to Cell (handSite Shared)) count:(count at:(site)))))) (set Var \"NumSowed\" (count at:(last From)))) next:(sow) (then (and { (if (< 1 (var \"NumSowed\")) (if (and (= 1 (count at:(\"NextHoleFrom\" (last From) \"Track\" (var \"NumSowed\")))) (= 2 (count at:(\"NextHoleFrom\" (last From) \"Track\" (- (var \"NumSowed\") 1))))) (moveAgain))) (if (!= 0 (what Cell at:(handSite Shared))) (fromTo (from Cell (handSite Shared)) (to (last From)) count:(count Cell at:(handSite Shared)))) (set Var \"NumSowed\" 0)}))))) (if (and (= 1 (count Pieces Mover)) (is Empty (\"NextHoleFrom\" (from) \"Track\" 1))) (move (from (\"LeftMost\")) (to (\"NextHoleFrom\" (from) \"Track\" 2) (apply (and (remove (to) count:(count at:(to))) (add (piece (id \"Seed\" Mover)) (to (to)) count:(count at:(to)))))))))) (end (\"BlockWin\")))) END" }, { "prompt": "What does the following global Ludii definition do?\n(define \"ForEachPlayerNoMovesLoss\" (forEach Player if:(no Moves Player) (result Player Loss)))\n\n###\n\n", "completion": "Makes a player losing when this player has no moves. This ludemeplex can be used only in an ending condition. END" } ]