[ { "prompt": "Construct a Ludii game based on the following description\nPlayed on a Tables board with sockets for the pieces instead of points. Fifteen pieces per player. Three six-sided dice. Players move according to the number on each die by moving one piece the value on one die, another piece the value on another die, and another piece the value on the final die, by moving one piece the value of two of the die subsequently, and a second piece the value of the remaining die, or one piece the value of each die subsequently. Pieces begin off the board. Players must enter all of their pieces onto one half of the board (one player entering in the quadrant to their right and the other player's entering into the quadrant on their left), according to the throws of the dice. Once a player has entered all of their pieces, they move through all of the quadrants of the board toward the quadrant where the opponent entered their pieces. A piece landing on a space with a single opponent's piece sends the opponent's piece back to start, and it must be reentered. Once players enter all of their pieces into the final quadrant, they may bear off their pieces. They can do so by rolling a 6 to move from the sixth point, and so on down to 1. Throughout the game, a player must use the maximum number of moves presented by the dice. The first player to remove all of their pieces wins.\n \n\n###\n\n", "completion": "(define \"AllPiecesInLastQuadrant\" (\"AllOwnedPiecesIn\" (sites Mover \"LastQuadrant\"))) (define \"NextSiteFrom\" (\"NextSiteOnTrack\" #2 from:#1)) (game \"Buffa de Baldrac\" (players 2) (equipment { (\"TableBoard\" (\"TableTracksOpposite\" End)) (dice d:6 num:3) (piece \"Disc\" Each (or (forEach Die combined:True if:(and (\"DieNotUsed\") (<= 0 (\"NextSiteFrom\" (from) (pips)))) (move (from (from)) (to (\"NextSiteFrom\" (from) (pips)) if:(\"NoEnemyOrOnlyOne\" (to)) (\"HittingCapture\" (handSite Next)))) (then (\"ReplayNotAllDiceUsed\"))) (if (\"AllPiecesInLastQuadrant\") (forEach Die combined:True if:(and (\"DieNotUsed\") (\"IsEndTrack\" (\"NextSiteFrom\" (from) (pips)))) (move Remove (from)) (then (\"ReplayNotAllDiceUsed\")))))) (regions \"FirstQuadrant\" P1 (sites {0..5})) (regions \"FirstQuadrant\" P2 (sites {12..17})) (regions \"LastQuadrant\" P1 (sites {12..17})) (regions \"LastQuadrant\" P2 (sites {0..5})) (map \"StartTrack\" {(pair P1 0) (pair P2 12)}) (hand Each)}) (rules (start { (place Stack \"Disc1\" (handSite P1) count:15) (place Stack \"Disc2\" (handSite P2) count:15)}) (play (max Moves (\"RollEachNewTurnMove\" (if (is Occupied (handSite Mover)) (forEach Die combined:True if:(and (\"DieNotUsed\") (is In (\"NextSiteFrom\" (mapEntry \"StartTrack\" (mover)) (- (pips) 1)) (sites Mover \"FirstQuadrant\"))) (move (from (handSite Mover)) (to (\"NextSiteFrom\" (mapEntry \"StartTrack\" (mover)) (- (pips) 1)) if:(\"NoEnemyOrOnlyOne\" (to)))) (then (\"ReplayNotAllDiceUsed\"))) (forEach Piece top:True))))) (end (\"EscapeWin\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\nA square, with diagonals, but one side of the square has been removed. Two pieces per player. Players alternate turns placing a piece on an empty spot on the board. When the pieces are placed, players alternate turns moving one of their pieces to an empty adjacent spot along the lines. The player who blocks the other from being able to move wins. \n\n###\n\n", "completion": "(game \"Do Guti\" (players 2) (equipment { (board (add (remove (\"AlquerqueGraph\" 3 3) vertices:{1 3 5 7}) edges:{{3 0} {0 1} {1 4}}) use:Vertex) (hand Each) (piece \"Disc\" Each \"StepToEmpty\")}) (rules (start (place \"Disc\" \"Hand\" count:2)) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (\"PhaseMovePiece\" \"Movement\")} (end (\"NoMoves\" Loss)))) 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": "Modify the Ludii game according to the following option changes:\nA 3x3 board is currently selected. -> A 4x4 board is currently selected.\n(game \"Compart\" (players 2) (equipment { (board (square 3) use:Vertex) (piece \"Marker\" Each)}) (rules (meta (swap)) (play (move Add (to (sites Empty) if:(not (is In (to) (sites (values Remembered)))) (apply (addScore Mover 1))) (then (do (forEach Site (sites Group at:(last To) if:(not (is Enemy (who at:(to))))) (remember Value (site))) next:(if (< 0 (count Sites in:(difference (sites Empty) (sites (values Remembered))))) (moveAgain) (forget Value All)))))) (end (if (is Full) { (if (= (score P1) (score P2)) (result Mover Win)) (if True (byScore misere:True))}))))\n\n###\n\n", "completion": "(game \"Compart\" (players 2) (equipment { (board (square 4) use:Vertex) (piece \"Marker\" Each)}) (rules (meta (swap)) (play (move Add (to (sites Empty) if:(not (is In (to) (sites (values Remembered)))) (apply (addScore Mover 1))) (then (do (forEach Site (sites Group at:(last To) if:(not (is Enemy (who at:(to))))) (remember Value (site))) next:(if (< 0 (count Sites in:(difference (sites Empty) (sites (values Remembered))))) (moveAgain) (forget Value All)))))) (end (if (is Full) { (if (= (score P1) (score P2)) (result Mover Win)) (if True (byScore misere:True))})))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThree concentric squares with lines connecting their midpoints. Nine pieces per player. Players alternate turns placing pieces on the board or moving one piece on the board to an adjacent empty spot. The first player to get three of their pieces in a row wins. \n\n###\n\n", "completion": "(game \"Sujjua\" (players 2) (equipment { (\"NineMensMorrisBoard\") (piece \"Marker\" Each (\"StepToEmpty\" Orthogonal)) (hand Each)}) (rules (start (place \"Marker\" \"Hand\" count:9)) (play (or (if (\"HandOccupied\" Mover) (move (from (handSite Mover)) (to (sites Empty)))) (forEach Piece))) (end (\"Line3Win\" Orthogonal)))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe players play on LastEdgeR-B version. -> The players play on LastEdgeR-G-B version.\n(game \"LastEdge\" (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} {1 6} {1 2} {2 7} {2 3} {3 8} {3 4} {4 9} {5 6} {5 10} {6 11} {6 7} {7 12} {7 8} {8 13} {8 9} {9 14} {10 11} {11 12} {12 13} {13 14} {10 15} {11 16} {12 17} {13 18} {14 19} {15 16} {15 20} {16 21} {20 21} {16 17} {17 22} {21 22} {17 18} {18 23} {22 23} {18 19} {19 24} {23 24}}) use:Vertex) (piece \"Disc\" Each) (piece \"Marker\" Shared)}) (rules (start { (set P1 Edge (sites {0..9 34 35 36})) (set P2 Edge (difference (sites Board Edge) (sites {0..9 34 35 36})))}) (play (forEach Site (sites Board) (if (< 0 (count Sites in:(sites Incident Edge of:Vertex at:(to) Mover))) (move Add (to (intersection (sites Empty) (sites {(to)}))) (then (forEach Site (sites Incident Edge of:Vertex at:(last To)) (remove Edge (to)))))))) (end (\"BlockWin\"))))\n\n###\n\n", "completion": "(game \"LastEdge\" (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} {1 6} {1 2} {2 7} {2 3} {3 8} {3 4} {4 9} {5 6} {5 10} {6 11} {6 7} {7 12} {7 8} {8 13} {8 9} {9 14} {10 11} {11 12} {12 13} {13 14} {10 15} {11 16} {12 17} {13 18} {14 19} {15 16} {15 20} {16 21} {20 21} {16 17} {17 22} {21 22} {17 18} {18 23} {22 23} {18 19} {19 24} {23 24}}) use:Vertex) (piece \"Disc\" Each) (piece \"Marker\" Shared)}) (rules (start { (set P1 Edge (sites {0..5 13..20})) (set P2 Edge (sites {9..12 23..30})) (set Shared Edge (difference (sites Board Edge) (union (sites {0..5 13..20}) (sites {9..12 23..30}))))}) (play (forEach Site (sites Board) (if (> (count Sites in:(difference (sites Incident Edge of:Vertex at:(to) All) (sites Incident Edge of:Vertex at:(to) Next))) 0) (move Add (to (intersection (sites Empty) (sites {(to)}))) (then (forEach Site (sites Incident Edge of:Vertex at:(last To)) (remove Edge (to)))))))) (end (\"BlockWin\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\nTwo rows of five holes arranged in a circle around four stores in the center. Each player has five holes on one half of the circle. Ten counters in each hole. Players sow from their holes, and can choose to sow any number of counters, but must leave at least one in the starting hole. Sowing occurs in an anti-clockwise direction. If sowing ends in a hole making its contents an odd number of counters, they are captured, but not more than nine. If the sowing ends and the last counter makes the contents of a hole an even number and the next hole has an odd number of counters, the contents of the odd hole are taken, but not more than nine. In both situations, if there is an unbroken sequence of holes with an odd number of counters, these are all taken, but not more than nine from each. \n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (count at:(mapEntry #1))) (define \"NextHoleFrom\" (\"NextSiteOnTrack\" 1 from:#1 #2)) (game \"Okwe (Achalla)\" (players 2) (equipment { (board (add (concentric {10}) vertices:{{0.45 0.45} {-0.45 -0.45} {0.45 -0.45} {-0.45 0.45}}) (track \"Track\" {0 2 4 6 8 9 7 5 3 1} loop:True) use:Vertex) (regions P1 (sites {0..4})) (regions P2 (sites {5..9})) (map {(pair P1 11) (pair P2 10)}) (piece \"Seed\" Shared)}) (rules (start (set Count 10 to:(sites Track))) (play (forEach Site (forEach (sites Mover) if:(< 1 (count at:(site)))) (forEach Value min:2 max:(count at:(site)) (do (set Var (value)) next:(move Select (from (site)) (then (sow count:(var) if:True apply:(if (and (<= (count at:(to)) 9) (is Odd (count at:(to)))) (fromTo (from (to)) (to (mapEntry (mover))) count:(count at:(to))) (if (and (<= (count at:(\"NextHoleFrom\" (to))) 9) (is Odd (count at:(\"NextHoleFrom\" (to))))) (fromTo (from (\"NextHoleFrom\" (to))) (to (mapEntry (mover))) count:(count at:(\"NextHoleFrom\" (to)))))) origin:True backtracking:(and (<= (count at:(to)) 9) (is Odd (count at:(to))))))))))) (end (\"MancalaByScoreWhen\" (and (no Moves P1) (no Moves P2)))))) 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\nFour 3x8 rectangles, arranged in a cross shape with a large square space in the center. The outer corners of each square are marked with a cross, as are the third and sixth space from the same corner. Four players, playing on two teams. Four pieces per player. The pieces are red, green, yellow, and black. Players start with one piece on the sixth and seventh space of the central row in their arm, and two pieces on the third space in the outer row of their arm, to the right. Two rectangular four-sided dice, with the following throws: 1, 3, 4, 6. Players use the throw of a die to move a piece; they may therefore may move two pieces each the value of one of the dice, or one piece twice, using the value of each dice. Play moves down the central track of the player's arm, around the outer perimeter of the board in an anti-clockwise direction, and back up the central row of the player's arm, proceeding into the large central square. When a player's piece moves into a space occupied by an opponent's piece, the opponent's piece is sent to the central square, from which it must begin again. A player cannot move into their central row, approaching the end of the track, unless two of their team member's pieces have moved past the player's own pieces. If two or more of the team member's pieces remain behind the player's own pieces, the player's pieces may not advance past the final three spaces in the left hand track of their home arm of the board. Neither they, nor any of the team's pieces, can proceed until two of the team member's pieces are placed, by exact throws, on the left inner corner of the arm of the player wishing to advance. These two pieces must then proceed together; i.e., only on double throws of the dice, with the exception that a double they cannot be used if it would cause them to land on a space occupied by a team member waiting to move. Once a double throw is successfully made and both pieces moved, the waiting pieces may proceed up the central row. When players cannot move the throws, they pass their turn. Players must move into the central square with an exact throw. The first team to place all of their pieces in the central square wins. \n\n###\n\n", "completion": "(define \"PawnPiece\" (if (= #1 1) (id \"Pawn\" P1) (if (= #1 2) (id \"Pawn\" P2) (if (= #1 3) (id \"Pawn\" P3) (id \"Pawn\" P4))))) (define \"Centre\" 96) (define \"SetValueAlly\" (if (is Mover P1) (set Value P3 #1) (if (is Mover P3) (set Value P1 #1) (if (is Mover P2) (set Value P4 #1) (set Value P2 #1))))) (define \"ValueAlly\" (if (is Mover P1) (value Player P3) (if (is Mover P3) (value Player P1) (if (is Mover P2) (value Player P4) (value Player P2))))) (define \"RightCentralAlly\" (if (is Mover P1) (sites P3 \"RightCentral\") (if (is Mover P3) (sites P1 \"RightCentral\") (if (is Mover P2) (sites P4 \"RightCentral\") (sites P2 \"RightCentral\"))))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" #2 #1)) (game \"Pahada Keliya\" (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)}) (dice d:4 faces:{1 3 4 6} num:2) (piece \"Pawn\" Each (forEach Die if:(\"DieNotUsed\") (if (\"IsEndTrack\" (\"SiteToMoveOnTrack\" from:(from) (pips))) (move Remove (from) level:(level)) (move (from (from) level:(level)) (to (\"SiteToMoveOnTrack\" from:(from) (pips)) if:(if (not (is In (to) (sites Mover \"CentralRow\"))) True (if (or (is In (from) (sites Mover \"CentralRow\")) (= (from) (\"Centre\"))) True (<= 1 (value Player Mover)))) (apply (if (\"IsEnemyAt\" (to)) (forEach Level (to) FromTop (and { (if (= 1 (state at:(to) level:(level))) (\"SetValueAlly\" (- (\"ValueAlly\") 1))) (remove (to) level:(level)) (add (piece (\"PawnPiece\" (who at:(to) level:(level)))) (to (centrePoint)))}))))) (then (if (and (= 0 (state at:(last To) level:(last LevelTo))) (is In (last To) (\"RightCentralAlly\"))) (and (set State at:(last To) 1) (\"SetValueAlly\" (+ 1 (\"ValueAlly\")))))))) (then (\"ReplayNotAllDiceUsed\")))) (regions \"CentralRow\" P1 (sites Direction from:55 N included:True distance:7)) (regions \"CentralRow\" P2 (sites Direction from:19 E included:True distance:7)) (regions \"CentralRow\" P3 (sites Direction from:94 S included:True distance:7)) (regions \"CentralRow\" P4 (sites Direction from:34 W included:True distance:7)) (regions \"RightCentral\" P1 (sites Direction from:56 N included:True distance:7)) (regions \"RightCentral\" P2 (sites Direction from:0 E included:True distance:7)) (regions \"RightCentral\" P3 (sites Direction from:93 S included:True distance:7)) (regions \"RightCentral\" P4 (sites Direction from:50 W included:True distance:7))}) (rules (start { (set Team 1 {P1 P3}) (set Team 2 {P2 P4}) (place Stack \"Pawn1\" 61) (place Stack \"Pawn1\" 58) (place Stack \"Pawn1\" 62 count:2) (place Stack \"Pawn2\" 21) (place Stack \"Pawn2\" 20) (place Stack \"Pawn2\" 2 count:2) (place Stack \"Pawn3\" 88) (place Stack \"Pawn3\" 91) (place Stack \"Pawn3\" 87 count:2) (place Stack \"Pawn4\" 32) (place Stack \"Pawn4\" 33) (place Stack \"Pawn4\" 48 count:2)}) (play (\"RollEachNewTurnMove\" (forEach Piece))) (end (\"EscapeTeamWin\")))) 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.\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": "Modify the Ludii game according to the following option changes:\nThe game is played on a 9x9 board -> The game is played on a 13x13 board\n(define \"IsNotCut\" (not (is Pattern {F R F R F} whats:{(mover) (next)}))) (game \"Crossway\" (players 2) (equipment { (board (square 9) use:Vertex) (piece \"Marker\" Each) (regions P1 {(sites Side N) (sites Side S)}) (regions P2 {(sites Side W) (sites Side E)})}) (rules (meta (swap)) (play (do (move Add (to (sites Empty))) ifAfterwards:\"IsNotCut\")) (end (if (is Connected All Mover) (result Mover Win)))))\n\n###\n\n", "completion": "(define \"IsNotCut\" (not (is Pattern {F R F R F} whats:{(mover) (next)}))) (game \"Crossway\" (players 2) (equipment { (board (square 13) use:Vertex) (piece \"Marker\" Each) (regions P1 {(sites Side N) (sites Side S)}) (regions P2 {(sites Side W) (sites Side E)})}) (rules (meta (swap)) (play (do (move Add (to (sites Empty))) ifAfterwards:\"IsNotCut\")) (end (if (is Connected All Mover) (result Mover Win))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"El Zorro\" (\"TwoPlayersNorthSouth\") (equipment { (\"CrossBoard\" 3 7 use:Vertex diagonals:Alternating) (piece \"Fox\" P1 (or (\"HopCapture\") \"StepToEmpty\")) (piece \"Hen\" P2 (\"StepToEmpty\" (directions {Rightward Leftward Forwards})))}) (rules (start { (place \"Hen2\" (union (sites Top) (expand (sites Row 4)))) (place \"Fox1\" (intersection (union (sites Column 4) (sites Column 2)) (sites Bottom)))}) (play (forEach Piece)) (end { (if (all Sites (expand (sites Bottom) steps:2) if:(= (who at:(site)) P2)) (result P2 Win)) (if (no Pieces P2) (result P1 Win))})))\n\n###\n\n", "completion": "Five squares which are each divided with lines connecting the midpoints of their sides and diagonals. The five squares are arranged in a cross-shaped board. One player plays as two foxes the other as twenty hens. The hens begin on the twenty spaces on one half of the board, the foxes on the bottom two corners of the square on the opposite arm of the cross. The foxes may move in any direction, and hop over a hen to an empty space immediately adjacent on the opposite side of the hen along the lines of the board to capture. The hens may not move backward. The foxes win by capturing all the hens, the hens win by occupying all of the spaces in the square of the arm of the cross opposite from where they began. END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"Kotu Ellima\" (players 2) (equipment { (\"AlquerqueBoardWithFourTriangles\") (piece \"Marker\" Each (or (\"HopCapture\") (\"StepToEmpty\")))}) (rules (start { (place \"Marker1\" (union {(expand (sites Bottom) steps:2) (expand (sites Right) steps:3) (sites {\"F3\" \"G3\" \"E4\" \"F4\" \"F6\" \"F7\" \"G7\"})})) (place \"Marker2\" (union {(expand (sites Top) steps:2) (expand (sites Left) steps:3) (sites {\"C3\" \"D3\" \"D4\" \"D6\" \"E6\" \"D7\" \"C7\"})}))}) (play (forEach Piece)) (end (\"NoMoves\" Loss))))\n\n###\n\n", "completion": "From the starting position, each player takes turns moving one piece to an adjacent point connected to its current position by a line. Captures are made by hopping over an adjacent piece. The player who captures all the opponent's pieces wins. 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": "Construct a Ludii game based on the following description\nStart with a tile of each colour placed next to each other. Players take turns adding a tile of their colour touching at least one existing tile. Win by making a line of four (or more) of your colour, but lose by making a line of three of your colour beforehand. The game uses hexagonal tiles.\n\n###\n\n", "completion": "(define \"NumTiles\" 24) (game \"Bravalath\" (players 2) (equipment { (boardless Hexagonal) (tile \"Hex\" Each numSides:6)}) (rules (start { (place \"Hex1\" (centrePoint)) (place \"Hex2\" (ahead (centrePoint) E))}) (play (move Add (to (sites Playable) if:(<= 1 (count Sites in:(sites Around (to) NotEmpty)))))) (end { (if (is Line 4) (result Mover Win)) (if (is Line 3) (result Mover Loss))}))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"CanMoveANewShip\" (not (all Sites (difference (expand origin:(mapEntry \"Port\" P1)) (mapEntry \"Port\" Mover)) if:(is Occupied (site))))) (define \"CapturingPortNotAttacked\" (> 3 (count Sites in:(forEach (sites LineOfSight at:(if (is Mover P1) (mapEntry \"Port\" P2) (mapEntry \"Port\" P1))) if:(if (is Mover P1) (= (who at:(site)) P1) (= (who at:(site)) P2)))))) (define \"AttackByAtLeast3\" (<= 3 (count Sites in:(forEach (sites LineOfSight at:(site)) if:(= (who at:(site)) Mover))))) (game \"Archimedes\" (players 2) (equipment { (board (square 8)) (piece \"Ball\" Each (move Slide (between if:(and (is Empty (between)) (!= (between) (mapEntry \"Port\" Mover)))))) (map \"Port\" {(pair P1 \"H8\") (pair P2 \"A1\")}) (hand Each)}) (rules (start { (place \"Ball1\" (difference (expand origin:(mapEntry \"Port\" P1) steps:4 Orthogonal) (sites {\"D8\" \"H4\" \"H8\"}))) (place \"Ball2\" (difference (expand origin:(mapEntry \"Port\" P2) steps:4 Orthogonal) (sites {\"A5\" \"A1\" \"E1\"})))}) (play (if (\"SameTurn\") (move Slide (from (mapEntry \"Port\" Mover))) (or (forEach Piece (then (forEach Site (sites Occupied by:Next) (if (\"AttackByAtLeast3\") (fromTo (from (site)) (to (handSite Next))))))) (if (and { (is Occupied (handSite Mover)) (is Empty (mapEntry \"Port\" Mover)) (\"CanMoveANewShip\")}) (move (from (handSite Mover)) (to (mapEntry \"Port\" Mover)) (then (moveAgain))))))) (end (if (and (\"IsFriendAt\" (if (is Mover P1) (mapEntry \"Port\" P2) (mapEntry \"Port\" P1))) (\"CapturingPortNotAttacked\")) (result Mover Win)))))\n\n###\n\n", "completion": "MOVING\n Each player moves one ship each turn. A ship moves any number of empty squares in a straight line, either vertically, horizontally, or diagonally (that is, like a chess queen). However, a ship may never end its turn in its home port.\n \n DESTROYING SHIPS\n Two opposing ships \\ 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. Sticks are used to play, (five per player), and are played in the spaces between corn kernels. Dice are also corn kernels, with one side marked with a black dot. Four dice are used, the value of a move determined by the number of black dots that land face up. Each player has two throws on their turn, and moves after the second throw. The throws both must be used, and can be used in any order. Each team's home is the side of the board to their left. Each team moves toward the opposite end of the track, and then back to home. All of the players on one team play in succession, and then the players on the other team play next. Players enter the men on their throws and move along the track. Each player may have only one piece on the board at a time. When a player reaches the team's home field, the piece may be re-entered. Reaching the home field does not require an exact throw, and if one throw brings a player home, they may use the second throw to enter it again. If a piece lands on that of an opponent, it is captured. Pieces are allowed to move forward or backward if the move captures a piece. The captures piece is placed on top of the piece that captured it, and the stack now moves toward the capturing player's home space. If the player successfully carries the captured piece to the team's home space, the piece is permanently captured and removed from play. If the opposing side lands on the same space as the stack, they are stacked with the opponent's piece, and the opponent begins carrying the stack to the opposing team's side. Any pieces captured belonging to the team which brings them back to their home are returned to their players. Pieces belonging to the same team may occupy the same space with no consequence for the game. When one team has no more counters left to enter, the winner is the team that captured most of the opposing team's pieces.\n 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 \"ThrowValue\" (count Pips)) (game \"Aj Sina'anil\" (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))) (or (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 (and (is In (from) (sites Board)) (\"IsNotOffBoard\" (\"NextSiteOnTrack\" (value) from:(from) \"CaptureTrack\"))) (if (\"AtLeastAnEnemyPieceThere\" (\"NextSiteOnTrack\" (value) from:(from) \"CaptureTrack\")) (move (from (from) level:(level)) (to (\"NextSiteOnTrack\" (value) from:(from) \"CaptureTrack\") (apply (forget Value \"Throws\" (value)))) (then (\"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 (if (< 0 (size Array (values Remembered \"Throws\"))) (moveAgain))))) (nextPhase (= 0 (size Array (values Remembered \"Throws\"))) \"ThrowPhase\"))} (end (\"CaptureAllTeam\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\n3x3 intersecting lines, with diagonals drawn in the square. Three pieces per player, which begin on the three points on opposite sides of the board. Players alternate turns moving a piece to an empty adjacent spot along the lines of the board. The first player to place three of their pieces in a row along one of the lines which is not one of the sides of the square, wins. \n\n###\n\n", "completion": "(game \"T'mbl\" (players 2) (equipment { (board (square 3 diagonals:Alternating) use:Vertex) (piece \"Marker\" Each (\"StepToEmpty\"))}) (rules (start { (place \"Marker1\" (sites Top)) (place \"Marker2\" (sites Bottom))}) (play (forEach Piece)) (end (if (and (is In (centrePoint) (sites Occupied by:Mover)) (is Line 3)) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nOverview:\n In Seesaw the players (North and South) command opposing armies with soldiers that can promote. Your army starts out as a single soldier and your promotion area evolves as you deploy more soldiers. Every time a soldier promotes it grows - first into a 2-stack, then a 3-stack, and so on. \n \n The central idea of Seesaw is the 2-fold significance of stack-size: \n (i) Odd-sized stacks move forwards, and even-sized stacks move backwards, and \n (ii) on any given turn, a stack can take as many steps as it likes from 1 up to its size. \n \n This results in soldiers seesawing up and down the board as their strength increases to the point where the game is forced to conclude in one side completely eliminating the other.\n \n How to play:\n On your turn, you must either make a stack-move, or place a new stack. \n \n 1. Placing a new stack: \n A newly placed stack will always be of size 1. You may only place a stack on an empty cell next to a cell of your color. These cells are promotion cells, and each cell you place a new stack on automatically turns into a promotion cell of your color.\n \n 2. Stackmoves:\n You only ever move one stack per turn, but that stack may be able to move several steps or capture several enemy stacks, depending on its size.\n The number of steps a stack may take is the number of pieces in it, i.e. its size.\n \n 2.1 Non-capturing moves: On turns where you do not have to capture an enemy (see below) all the steps a stack takes is either constrained to the 3 upward directions or to the 3 downward directions, depending on the size and the owner of the stack. South's forward directions are the 3 upward directions, and North's forward directions are the 3 downward directions.\n \n 2.2 Capturing moves: If one or more of your stacks can reach an enemy by lifting the restraint on direction, you must capture such a reachable enemy by replacement. If that stack did not spend all its steps reaching the captured enemy, you can, before you end your turn, spend the left-over steps by making a non-capturing move. However, if yet an enemy is in range immediately after you have captured (counting only the steps left over), you must capture again.\n \n 3. Promoting: Your odd-sized stacks promote when they end up on a promotion cell belonging to your opponent at the end of your turn. Your even-sized stacks promote when they end up on a promotion cell belonging to you at the end of your turn.\n \n The object of Seesaw is to capture all your opponent's soldiers. More precisely: If, at the end of your turn, your opponent has no stacks on the board, you have won the game. A base 4 board is currently selected\n\n###\n\n", "completion": "(define \"CaptureRange\" (if (> (var) 1) (intersection (sites Around (intersection (\"Reachable\" (var)) (sites Around (sites Occupied by:Enemy component:\"Disc\")))) (sites Occupied by:Enemy component:\"Disc\")) (intersection (sites Around (from)) (sites Occupied by:Enemy component:\"Disc\")))) (define \"Reachable\" (sites Distance (step (to if:(= 0 (\"StackSize\" (to))))) from:(from) (range 1 (- #1 1)))) (define \"Promote\" (if (\"Promotes\" (last To)) (add (piece (id \"Disc\" Mover)) (to (last To)) stack:True))) (define \"Promotes\" (= (+ (* 1 (% (\"StackSize\" #1) 2)) (% (mover) (- 3 (% (\"StackSize\" #1) 2)))) (* (who at:#1 level:0) (count Stack at:#1 if:(or (= (id \"Hex\" Next) (what at:(to) level:(level))) (= (id \"Hex\" Mover) (what at:(to) level:(level)))))))) (define \"StepsTaken\" (count Steps (step (to if:(or (= (last To) (to)) (= 0 (\"StackSize\" (to)))))) (last From) (last To))) (define \"EmptyInRange\" (if (is Odd (\"StackSize\" (from))) (sites Distance (step Forwards (to if:(= 0 (\"StackSize\" (to))))) from:(from) (range 1 (var))) (sites Distance (step Backwards (to if:(= 0 (\"StackSize\" (to))))) from:(from) (range 1 (var))))) (define \"StackSize\" (count Stack at:#1 if:(or (\"IsPieceAt\" \"Disc\" Next (to) level:(level)) (\"IsPieceAt\" \"Disc\" Mover (to) level:(level))))) (define \"Capture\" (do (if (= 0 (count MovesThisTurn)) (\"ResetMoveCount\")) next:(move (from if:(= (* (from) (if (< 0 (count MovesThisTurn)) 1 0)) (* (last To) (if (< 0 (count MovesThisTurn)) 1 0)))) (to (\"CaptureRange\") (apply (remove (to) count:(\"StackSize\" (to))))) count:(\"StackSize\" (from)) stack:True))) (define \"DeductMoves\" (set Var (- (var) (\"StepsTaken\")) #1)) (define \"ResetMoveCount\" (set Var (\"StackSize\" (from)))) (define \"Step\" (do (if (= 0 (count MovesThisTurn)) (\"ResetMoveCount\")) next:(move (from if:(= (* (from) (if (< 0 (count MovesThisTurn)) 1 0)) (* (last To) (if (< 0 (count MovesThisTurn)) 1 0)))) (to (\"EmptyInRange\")) count:(\"StackSize\" (from)) stack:True))) (define \"Deploy\" (move Add (piece (id \"Hex\" Mover)) (to (sites Around (sites Occupied by:Mover component:\"Hex\" top:False)) if:(is Empty (to))) (then (add (piece (id \"Disc\" Mover)) (to (last To)) stack:True)))) (game \"Seesaw\" (\"TwoPlayersNorthSouth\") (equipment { (board (rotate 30 (hex 4))) (piece \"Disc\" Each) (tile \"Hex\" Each)}) (rules (start { (place Stack \"Hex1\" 0) (place Stack \"Disc1\" 0) (place Stack \"Hex2\" (* 4 (* 3 (- 4 1)))) (place Stack \"Disc2\" (* 4 (* 3 (- 4 1))))}) (play (if (can Move (forEach Piece \"Disc\" (\"Capture\") top:True)) (forEach Piece \"Disc\" (\"Capture\") top:True (then (\"DeductMoves\" (then (if (< 0 (var)) (moveAgain) (\"Promote\")))))) (if (< 0 (count MovesThisTurn)) (or (forEach Piece \"Disc\" (\"Step\") top:True) (move Pass) (then (\"Promote\"))) (or (forEach Piece \"Disc\" (\"Step\") top:True (then (\"Promote\"))) (\"Deploy\"))))) (end (if (= 0 (count Sites in:(sites Occupied by:Next component:\"Disc\"))) (result Next Loss))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n4x8 board. Four pieces in each of the holes in the inner two rows. Sowing occurs in an anti-clockwise direction. Single counters cannot be sown. When the final counter of a sowing falls into an occupied hole, these counters are picked up and the sowing continues. If this hole is in the player's inner row, the counters in the opponent's opposite holes in both rows are captured. Both the inner and outer opposite holes must contain counters for a capture to occur. Play continues with the captured counters, and the player sows these beginning with the next hole after the last one on the player's side from which they picked up holes. Captures cannot be made on the first move. Clockwise sowing can begin from the following holes only if it will allow a capture to occur: the rightmost and leftmost holes of the outer row, the second from the right and second from the left holes in the inner row. Direction can be changed in the middle of a turn if the final counter lands in one of these holes and a clockwise move will result in a capture. When no capture is available, the player must resume in an anti-clockwise direction. When the final counter falls into an empty hole, the turn ends. \n\n###\n\n", "completion": "(define \"NextHoleFrom\" (\"NextSiteOnTrack\" #3 from:#1 #2)) (define \"Columns\" 8) (game \"Kubuguza\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" 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)}) (regions \"Home\" P1 (sites Track \"TrackCCW1\")) (regions \"Home\" P2 (sites Track \"TrackCCW2\")) (regions \"Inner\" P1 (difference (sites Track \"TrackCCW1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"TrackCCW2\") (sites Top))) (regions \"HolesCW\" P1 (sites {15 8 1 6})) (regions \"HolesCW\" P2 (sites {16 23 25 30})) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 3 to:(union (sites P1 \"Inner\") (sites P2 \"Inner\")))) (play (or (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (sites Mover \"Home\")) if:(> (count at:(from)) 1)) (then (sow \"TrackCCW\" owner:(mover) apply:(if (< 1 (count at:(to))) (and (if (and { (> (count Turns) 2) (is In (to) (sites Mover \"Inner\")) (is Occupied (\"OppositeOuterPit\" (to))) (is Occupied (\"OppositePit\" (to)))}) (and { (fromTo (from (\"OppositeOuterPit\" (to))) (to (last From)) count:(count at:(\"OppositeOuterPit\" (to)))) (fromTo (from (\"OppositePit\" (to))) (to (last From)) count:(count at:(\"OppositePit\" (to)))) (set Var \"Replay\" (last From))}) (set Var \"Replay\" (to))) (moveAgain)))))) (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (sites Mover \"HolesCW\")) if:(and { (> (count at:(from)) 1) (is In (from) (sites Mover \"HolesCW\")) (if (is In (\"NextHoleFrom\" (from) \"TrackCW\" (count at:(from))) (sites Mover \"Inner\")) (and (is Occupied (\"OppositeOuterPit\" (\"NextHoleFrom\" (from) \"TrackCW\" (count at:(from))))) (is Occupied (\"OppositePit\" (\"NextHoleFrom\" (from) \"TrackCW\" (count at:(from)))))) False)})) (then (sow \"TrackCW\" owner:(mover) apply:(if (< 1 (count at:(to))) (and (if (and { (> (count Turns) 2) (is In (to) (sites Mover \"Inner\")) (is Occupied (\"OppositeOuterPit\" (to))) (is Occupied (\"OppositePit\" (to)))}) (and { (fromTo (from (\"OppositeOuterPit\" (to))) (to (last From)) count:(count at:(\"OppositeOuterPit\" (to)))) (fromTo (from (\"OppositePit\" (to))) (to (last From)) count:(count at:(\"OppositePit\" (to)))) (set Var \"Replay\" (last From))}) (set Var \"Replay\" (to))) (moveAgain)))))))) (end (\"ForEachPlayerNoMovesLoss\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayed on a board of three concentric squares, with a line bisecting the perimeters of each square on each side, but not extending inside the perimeter of the central square. Play occurs on the intersections of the lines and the corners of the squares. Each player has nine pieces. Play begins with each player placing pieces on empty points. If they make three in a row along the lines, they can remove one of the opponent's pieces. They cannot remove an opponent's piece that is in a three-in-a-row formation. Once all pieces are placed, players take turns moving pieces one spot to an adjacent point along the lines. If a player makes three in a row, an opponent's piece is removed as in the first phase of the game. The game is won when the opponent is reduced to two pieces. A player may also win by blocking their opponent from being able to move.\n \n\n###\n\n", "completion": "(game \"Mylna\" (players 2) (equipment { (\"NineMensMorrisBoard\") (piece \"Marker\" Each (\"StepToEmpty\" Orthogonal (then (\"ReplayIfLine3\" Orthogonal)))) (hand Each)}) (rules (start (place \"Marker\" \"Hand\" count:9)) phases:{ (phase \"Placement\" (play (if \"SameTurn\" (\"RemoveAnyEnemyPieceNotInLine3\" Orthogonal) (move (from (handSite Mover)) (to (sites Empty)) (then (\"ReplayIfLine3\" Orthogonal))))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (phase \"Movement\" (play (if \"SameTurn\" (\"RemoveAnyEnemyPieceNotInLine3\" Orthogonal) (forEach Piece))))} (end { (\"HavingLessPiecesLoss\" Next 2) (\"BlockWin\")}))) END" }, { "prompt": "Construct a Ludii game based on the following description\n8x8 checkered board, the dark spaces placed so that the bottom right corner is a dark space. Twelve pieces per player, placed on the dark spaces of the first three rows closest to the players. Players alternate turns moving a piece forward diagonally to an empty space. Pieces may capture an opponent's piece by hopping over it to an empty adjacent space. Captures are compulsory, multiple captures are possible, the maximum capture possible is not required. When a piece reaches the opposite edge of the board from where it started, it stops moving (if in a capture sequence), becomes a king, and the turn ends. Kings may move any distance diagonally forward or backward, and may capture any number of opponent's pieces it leaps over. The player who captures all of the opponent's pieces wins.\n \n\n###\n\n", "completion": "(define \"IsUnpromoted\" (\"IsPieceAt\" \"Counter\" Mover (last To))) (define \"HopDiagonalDoubleCounter\" (\"HopCaptureDistance\" (from) Diagonal (range 1 (count Rows)) (then (\"ReplayIfCanMove\" (\"HopCaptureDistance\" (from (last To)) Diagonal (range 1 (count Rows))))))) (define \"HopDiagonalCounter\" (\"HopCapture\" (from) Diagonal (then (\"PromoteIfReach\" (sites Next) \"DoubleCounter\" (\"ReplayIfCanMove\" (\"HopCapture\" (from (last To)) Diagonal)))))) (game \"Damenspiel\" (\"TwoPlayersNorthSouth\") (\"DraughtsEquipment\" (square 8)) (rules (\"WhiteCellsSetup\" 3) (play (if (\"SameTurn\") (if (\"IsUnpromoted\") (\"HopCapture\" (from (last To)) Diagonal (then (\"PromoteIfReach\" (sites Next) \"DoubleCounter\" (\"ReplayIfCanMove\" (\"HopCapture\" (from (last To)) Diagonal))))) (\"HopCaptureDistance\" (from (last To)) Diagonal (range 1 (count Rows)) (then (\"ReplayIfCanMove\" (\"HopCaptureDistance\" (from (last To)) Diagonal (range 1 (count Rows))))))) (priority { (or (forEach Piece \"Counter\" \"HopDiagonalCounter\") (forEach Piece \"DoubleCounter\" \"HopDiagonalDoubleCounter\")) (or (forEach Piece \"Counter\" (\"StepToEmpty\" (directions {FR FL}) (then (\"PromoteIfReach\" (sites Next) \"DoubleCounter\")))) (forEach Piece \"DoubleCounter\" (move Slide Diagonal)))}))) (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Construct a Ludii game based on the following description\n3x3 board, without the outer edges of the square. Three pieces per player. Players alternate turns placing the pieces on an empty space on the board. When all of the pieces have been placed, players move pieces to an adjacent empty space on the board. the first player to place all three of their pieces in an orthogonal or diagonal line wins. \n\n###\n\n", "completion": "(game \"Tuk Tak\" (players 2) (equipment { (board (square 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": "Modify the Ludii game according to the following option changes:\nOrder 3 board -> Order 4 board\nSquare 2N grid w/even nodes, no center -> Square 2N grid w/even nodes, no center\nHighly tactical. Control a site with a surplus of 1 on lines of sight. -> Tactical. Control a site with a surplus of 2 on lines of sight.\n(define \"ColourBackground\" (colour 135 170 130)) (define \"SquareDiagonal\" (board (square 6) use:Vertex)) (define \"SquareGrid\" (board (square 6) use:Vertex)) (define \"Hex2Limp\" (board (dual (hex (/ 6 2) (+ 2 (/ 6 2)))) use:Vertex)) (define \"BoardUsed\" \"SquareDiagonal\") (define \"LoSDirection\" All) (define \"MoveTwiceThenScore\" (if (is Prev Next) (moveAgain) (and (\"ScoreFor\" Mover) (\"ScoreFor\" Next)))) (define \"IsControlledBy\" (<= (+ 1 (count Pieces in:(difference (sites LineOfSight Piece at:#2 \"LoSDirection\") (sites Occupied by:Neutral)))) (* 2 (count Pieces #1 in:(sites LineOfSight Piece at:#2 \"LoSDirection\"))))) (define \"ScoreFor\" (set Score #1 (+ (results from:(forEach (difference (difference (sites Board) (sites Occupied by:#1)) (sites Occupied by:Neutral)) if:(\"IsControlledBy\" #1 (site))) to:(from) (if (is Empty (to)) 1 2))))) (game \"Double-Move Situ\" (players 2) (equipment { \"BoardUsed\" (piece \"Counter\" P1) (piece \"Counter\" P2) (piece \"X\" Neutral) (piece \"Counter\" Neutral)}) (rules (meta (passEnd NoEnd)) (play (if (and (= -1 (var \"DoubleTurnPhase\")) (= 1 (mover))) (or (move Pass) (move Add (piece \"X0\") (to (sites Empty)) (then (if (> 2 (count Pieces in:(sites Occupied by:Neutral))) (moveAgain))))) (or { (move Add (to (sites Empty) if:(not (\"IsControlledBy\" Next (to)))) (then (if (= -1 (var \"DoubleTurnPhase\")) (set Var \"DoubleTurnPhase\" 1) (\"MoveTwiceThenScore\")))) (move Remove (forEach (sites Occupied by:Next) if:(\"IsControlledBy\" Mover (site))) (then (\"MoveTwiceThenScore\")))}) (then (if (no Moves Next) (and (\"ScoreFor\" Mover) (\"ScoreFor\" Next)))))) (end (if (no Moves Mover) (result Mover Loss)))))\n\n###\n\n", "completion": "(define \"ColourBackground\" (colour 135 170 130)) (define \"SquareDiagonal\" (board (square 8) use:Vertex)) (define \"SquareGrid\" (board (square 8) use:Vertex)) (define \"Hex2Limp\" (board (dual (hex (/ 8 2) (+ 2 (/ 8 2)))) use:Vertex)) (define \"BoardUsed\" \"SquareGrid\") (define \"LoSDirection\" Orthogonal) (define \"MoveTwiceThenScore\" (if (is Prev Next) (moveAgain) (and (\"ScoreFor\" Mover) (\"ScoreFor\" Next)))) (define \"IsControlledBy\" (<= (+ 2 (count Pieces in:(difference (sites LineOfSight Piece at:#2 \"LoSDirection\") (sites Occupied by:Neutral)))) (* 2 (count Pieces #1 in:(sites LineOfSight Piece at:#2 \"LoSDirection\"))))) (define \"ScoreFor\" (set Score #1 (+ (results from:(forEach (difference (difference (sites Board) (sites Occupied by:#1)) (sites Occupied by:Neutral)) if:(\"IsControlledBy\" #1 (site))) to:(from) (if (is Empty (to)) 1 2))))) (game \"Double-Move Situ\" (players 2) (equipment { \"BoardUsed\" (piece \"Counter\" P1) (piece \"Counter\" P2) (piece \"X\" Neutral) (piece \"Counter\" Neutral)}) (rules (meta (passEnd NoEnd)) (play (if (and (= -1 (var \"DoubleTurnPhase\")) (= 1 (mover))) (or (move Pass) (move Add (piece \"X0\") (to (sites Empty)) (then (if (> 2 (count Pieces in:(sites Occupied by:Neutral))) (moveAgain))))) (or { (move Add (to (sites Empty) if:(not (\"IsControlledBy\" Next (to)))) (then (if (= -1 (var \"DoubleTurnPhase\")) (set Var \"DoubleTurnPhase\" 1) (\"MoveTwiceThenScore\")))) (move Remove (forEach (sites Occupied by:Next) if:(\"IsControlledBy\" Mover (site))) (then (\"MoveTwiceThenScore\")))}) (then (if (no Moves Next) (and (\"ScoreFor\" Mover) (\"ScoreFor\" Next)))))) (end (if (no Moves Mover) (result Mover Loss))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n7x7 board, with diagonals in the square formed by the central 3x3 lines. 24 pieces per player. Black plays first. Players alternate turns placing a piece on one of the empty spots on the board. The first stone must be placed in the central spot. They attempt to orthogonally surround an empty point with four of their pieces, making a square. When all of the pieces are placed, players alternate turns removing one of their opponent's pieces from the board. They then move one of their pieces along the lines of the board to the place left vacant by the piece they removed. When a player makes a new square, they may remove another of the opponent's pieces from the board. Pieces that are in a square around an empty point may not be captured, and captures are not made in the placement phase. The player who captures all of the opponent's pieces wins. \n\n###\n\n", "completion": "(define \"HowManySquareSurroundedEmptyPoint\" (count Sites in:(forEach (sites Around (last To)) if:(if (is Empty (site)) (or (\"SurroundedDirections\" N S W E) (\"SurroundedDirections\" NE SE SW NW)))))) (define \"SurroundedDirections\" (and { (is In (last To) (sites {(ahead (site) #1) (ahead (site) #2) (ahead (site) #3) (ahead (site) #4)})) (is Mover (who at:(ahead (site) #1))) (is Mover (who at:(ahead (site) #2))) (is Mover (who at:(ahead (site) #3))) (is Mover (who at:(ahead (site) #4)))})) (game \"Fang\" (players 2) (equipment { (board (add (square 7) edges:{{16 24} {24 32} {30 24} {24 18}}) use:Vertex) (piece \"Marker\" Each (\"StepToEmpty\" ~ (then (if (> (\"HowManySquareSurroundedEmptyPoint\") 0) (and (set Value Mover \"HowManySquareSurroundedEmptyPoint\") (moveAgain)))))) (hand Each)}) (rules (start (place \"Marker\" \"Hand\" count:24)) phases:{ (phase \"FirstPlacement\" P1 (play (move (from (handSite Mover)) (to (sites Centre)))) (nextPhase \"Placement\")) (phase \"Placement\" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover (\"HandEmpty\" Mover) \"Playing\")) (phase \"Playing\" (play (if (\"SameTurn\") (move Remove (sites Occupied by:Next) (then (if (> (value Player Mover) 1) (and (moveAgain) (set Value Mover (- (value Player Mover) 1))) (set Value Mover 0)))) (forEach Piece))))} (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayed on an 8x8 board with pieces with specialized moves: Pawns (8): can move one space forward; Rooks (2): can move any number of spaces orthogonally; Bishops (2): can move any number of spaces diagonally; Knight (2): moves in any direction, one space orthogonally with one space forward diagonally; Queens (1): can move any number of spaces orthogonally or diagonally; Kings (1): can move one space orthogonally or diagonally. Players capture pieces by moving onto a space occupied by an opponent's piece. Player wins when they checkmate the other player's king. \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 \"Chess\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (\"ChessPawn\" \"Pawn\" (or \"InitialPawnMove\" \"EnPassant\") (then (and (\"ReplayInMovingOn\" (sites Mover \"Promotion\")) (set Counter)))) (\"ChessRook\" \"Rook\" (then (set Counter)) (\"RememberPieceHasMoved\")) (\"ChessKing\" \"King\" (then (set Counter)) (\"RememberPieceHasMoved\")) (\"ChessBishop\" \"Bishop\" (then (set Counter))) (\"ChessKnight\" \"Knight\" (then (set Counter))) (\"ChessQueen\" \"Queen\" (then (set Counter))) (map \"King\" {(pair 1 \"E1\") (pair 2 \"E8\")}) (map \"RookLeft\" {(pair 1 \"A1\") (pair 2 \"A8\")}) (map \"RookRight\" {(pair 1 \"H1\") (pair 2 \"H8\")}) (regions \"Promotion\" P1 (sites Top)) (regions \"Promotion\" P2 (sites Bottom))}) (rules (start { (place \"Pawn1\" (sites Row 1)) (place \"Pawn2\" (sites Row 6)) (place \"Rook1\" {\"A1\" \"H1\"} state:1) (place \"Knight1\" {\"B1\" \"G1\"}) (place \"Bishop1\" {\"C1\" \"F1\"}) (place \"Queen1\" coord:\"D1\") (place \"King1\" coord:\"E1\" state:1) (place \"Rook2\" {\"A8\" \"H8\"} state:1) (place \"Knight2\" {\"B8\" \"G8\"}) (place \"Bishop2\" {\"C8\" \"F8\"}) (place \"Queen2\" coord:\"D8\") (place \"King2\" coord:\"E8\" state:1)}) (play (if \"SameTurn\" (move Promote (last To) (piece {\"Queen\" \"Knight\" \"Bishop\" \"Rook\"}) Mover) (do (or (forEach Piece) (\"Castling\")) ifAfterwards:(not (\"IsInCheck\" \"King\" Mover))))) (end { (\"Checkmate\" \"King\") (if (or (no Moves Mover) (= (counter) 99)) (result Mover Draw))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nEach side has a line of pawns. The pawns move as in chess i.e. The pawn moves forwards one square (optionally two squares on its first move) and captures diagonally forwards one square by replacing the opponent\u2019s piece. The rule of En Passant is also allowed. White goes first. The first person to reach the other side is the winner. You also win if it is your opponent\u2019s move and they have no moves left.\n In Ludii, options are also available to add each of the five other Chess piece types. In the variant with the king piece, if you capture the opponent king, you win as well. The game is played with only pawns.\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)))) (game \"The Pawn Game\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (\"ChessPawn\" \"Pawn\" (or \"InitialPawnMove\" \"EnPassant\")) (regions P1 (sites Top)) (regions P2 (sites Bottom))}) (rules (start { (place \"Pawn1\" (sites Row 1)) (place \"Pawn2\" (sites Row 6))}) (play (forEach Piece)) (end { (\"ReachWin\" (sites Mover) Mover) (\"BlockWin\")}))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe board has 13 holes. -> The board is an Alquerque board.\n(game \"Picaria\" (players 2) (equipment { (board (square 3 diagonals:Solid) use:Vertex) (hand Each) (piece \"Marker\" Each (\"StepToEmpty\" All))}) (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\" All))))\n\n###\n\n", "completion": "(game \"Picaria\" (players 2) (equipment { (\"AlquerqueBoard\" 3 3) (hand Each) (piece \"Marker\" Each (\"StepToEmpty\" All))}) (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\" All)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe game starts in drawing a ground line and several line segments such that each line segment is connected to the ground. Any number of segments may meet at a point, and thus there may be multiple paths to ground. Every turn, the current player selects any line segment to be removed. Every line segment no longer connected to the ground by any path falls. The first player who is unable to move loses. In addition to the standard Hackenbush, there are two variants; HackenbushR-B and HackenbushR-G-B. For the Hackenbush version, all the lines are in the same colour (green). At each turn, the current player selects a coloured line to be removed, also removing any other line segments that become disconnected from the ground as a result. The game is over when there are no green edges in the graph. The second version is the Red-Blue version; HackenbushR-B. There is one red player, and one blue player. The players can remove only edges of their own colour. The last version is HackenbushR-G-B; there is a graph with red, green, and blue edges. Players may remove edges of their own colour, as well as the shared colour. For all the versions of Hackenbush, if the current player has no move, then the opposing player wins. The game is played on the Graph1. The players play on Hackenbush version.\n\n###\n\n", "completion": "(define \"Ground\" (sites Bottom)) (define \"NotConnectedToTheGround\" (= 0 (count Sites in:(intersection (\"Ground\") (sites Group Edge at:(site) if:(is Occupied (to))))))) (define \"RemoveCutBranch\" (forEach Site (sites Group Edge at:(site)) (remove Edge (site)))) (game \"Hackenbush\" (players 2) (equipment { (board (graph vertices:{ {0 0} {2 0} {4 0} {6 0} {8 0} {10 0} {15 0} {4 2} {4 4} {6 4} {3 5} {4 6} {10 2} {10 4} {8 4} {12 5} {10 6}} edges:{ {0 1} {1 2} {2 3} {4 3} {4 5} {6 5} {2 7} {7 8} {7 9} {8 10} {8 11} {5 12} {12 14} {12 13} {13 15} {13 16}}) use:Edge) (piece \"Marker\" Each) (piece \"Disc\" Shared) (piece \"Cross\" Neutral) (regions All (expand (sites Bottom)))}) (rules (start { (set Neutral Edge (\"Ground\")) (set Shared Edge (difference (sites Board Edge) (sites {0..5})))}) (play (move Remove (sites Occupied by:Shared) (then (forEach Site (sites Incident Edge of:Edge at:(last To)) (if (\"NotConnectedToTheGround\") (\"RemoveCutBranch\")))))) (end (if (no Moves Mover) (result Next Win))))) 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 game is played on a 10x10 board. -> The game is played on a 14x14 board.\nThe board is a diamond tiling by square. -> The board is a diamond tiling by triangle.\nThe connection between two stones is using all the orthogonal directions. -> The connection between two stones is using all the directions.\n(game \"Diagonal Hex\" (players 2) (equipment { (board (square 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 Orthogonal Mover) (result Mover Win)))))\n\n###\n\n", "completion": "(game \"Diagonal Hex\" (players 2) (equipment { (board (tri 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 All Mover) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n5x5 intersecting lines, with diagonals drawn in the four quadrants of the board. Two triangles, their apices intersecting the main board at opposite midpoints. The bast of the triangle is bisected by a line drawn from the apex, and this line is bisected and intersects with the other two sides of the triangle. one player plays as two tigers, which start on the central point. The other player has 23 sheep, eight of which start on the board, on the points immediately adjacent to the tigers. Pieces move one space along the lines to an empty adjacent spot. The tigers may capture an unbroken line of sheep in one direction, provided there is an unoccupied space at the opposite end of the line. The player with the sheep replaces any captured sheep from those remaining in their hand. The tigers win when they capture all of the sheep; the sheep win when they block the tigers from being able to move. \n\n###\n\n", "completion": "(define \"BigHop\" (move Hop (between (range 1 9) if:#1 (apply (remove (between)))) (to if:(is Empty (to))))) (game \"Merimueng-rimueng\" (players 2) (equipment { (\"AlquerqueBoardWithBottomAndTopTriangles\") (hand P2) (piece \"Tiger\" P1 (or { (\"StepToEmpty\") (\"BigHop\" (\"IsEnemyAt\" (between)))})) (piece \"Sheep\" P2 \"StepToEmpty\")}) (rules (start { (place \"Sheep2\" (difference (expand (sites Centre)) (centrePoint))) (place Stack \"Sheep2\" (handSite P2) count:15) (place Stack \"Tiger1\" (sites Centre) counts:{2})}) phases:{ (phase \"Movement\" (play (forEach Piece top:True)) (end (\"NoMovesP1NoPiecesP2\")) (nextPhase (and (\"HandOccupied\" P2) (< (count Sites in:(sites Occupied by:P2 container:\"Board\")) 8)) \"Placement\")) (phase \"Placement\" (play (move (from (handSite Mover)) (to (sites Empty)) (then (moveAgain)))) (nextPhase (or (\"HandEmpty\" P2) (= (count Sites in:(sites Occupied by:P2 container:\"Board\")) 8)) \"Movement\"))})) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe board consists of three intersecting lines, with diagonals drawn in the square formed. On opposite ends of the square, the central line is extended beyond the square and lines drawn from the adjacent corners to the end of this line, forming two triangles at opposite ends. One player takes the part of three white towers, the other the part of a single black army piece. First the army moves their piece, then the towers move one of their pieces, play alternating thereafter until the game is ended. A tower piece may move one step along a marked line in any forward or sideways direction. Tower pieces cannot move backwards, diagonally or otherwise, towards the end of the board from which they started. The army may move one step in any direction along a marked line. The army wins by passing the towers and reaching the end of the board from which they started. The towers win by trapping the army so that it cannot move in its turn. The towers can move in sideway and forwards (including diagonal and orthogonal forward). The army can move in all the directions. The army can not move. The game is played according to the rules of Lucas with the pieces already on the board. \n\n###\n\n", "completion": "(game \"Jeu Militaire\" (players 2) (equipment { (board (rotate 90 (\"ThreeMensMorrisGraphWithLeftAndRightTriangles\")) use:Vertex) (piece \"Pawn\" P1 (\"StepToEmpty\")) (piece \"Pawn\" P2 N (\"StepToEmpty\" (directions {Forwards Rightward Leftward}))) (regions \"Home\" P2 (sites {\"B1\" \"C2\" \"A2\"})) (regions \"Home\" P1 (sites {\"B2\"}))}) (rules (start { (place \"Pawn1\" (sites P1)) (place \"Pawn2\" (sites P2))}) (play (forEach Piece)) (end { (if (no Moves P1) (result P2 Win)) (if (is In (where \"Pawn\" P1) (sites P2)) (result P1 Win))}))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nPlayed on a size 8 board. -> Played on a size 9 board.\n(game \"Fivalath\" (players 2) (equipment { (board (square 8) use:Vertex) (piece \"Ball\" Each)}) (rules (play (move Add (to (sites Empty)))) (end { (if (is Line 5 All) (result Mover Win)) (if (is Line 4 All) (result Mover Loss))})))\n\n###\n\n", "completion": "(game \"Fivalath\" (players 2) (equipment { (board (square 9) use:Vertex) (piece \"Ball\" Each)}) (rules (play (move Add (to (sites Empty)))) (end { (if (is Line 5 All) (result Mover Win)) (if (is Line 4 All) (result Mover Loss))}))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"OneRowIsEmpty\" (or (all Sites (sites P1) if:(= 0 (count at:(site)))) (all Sites (sites P2) if:(= 0 (count at:(site)))))) (define \"PiecesOwnedBy\" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (define \"NextHoleFrom\" (\"NextSiteOnTrack\" #2 from:#1)) (define \"Columns\" 6) (game \"Tap Urdy\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" store:None (track \"Track\" \"5,W,N,E\" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (hand Each) (piece \"Seed\" Shared)}) (rules (start (set Count 4 to:(sites Track))) (play (move Select (from (if (\"SameTurn\") (\"LastHoleSowed\") (sites Next)) if:(< 0 (count at:(from)))) (then (sow apply:(if (and (!= (count at:(\"NextHoleFrom\" (to) 1)) 0) (> (count at:(to)) 1)) (moveAgain) (if (and (= (count at:(\"NextHoleFrom\" (to) 1)) 0) (> (count at:(to)) 1)) (fromTo (from (\"NextHoleFrom\" (to) 2)) (to (handSite (mover))) count:(count at:(\"NextHoleFrom\" (to) 2))))))))) (end (\"MancalaByScoreWhen\" (\"OneRowIsEmpty\")))))\n\n###\n\n", "completion": "2x6 board. Four counters in each hole. Players sow counters in a clockwise directions from one of the holes in their opponent's row. When the final counter lands in an occupied hole, the contents of that hole are picked up and sowing continues, unless the next hole is empty, in which case the contents of the next hole after the empty hole are captured. When the final counter falls in an empty hole, the turn ends. Play continues until all of the holes are empty in one of the rows. The player who captured the most counters wins. END" }, { "prompt": "Construct a Ludii game based on the following description\nEach player starts the game with four pieces:\n \n - a Lion (king) in the center of the home row\n - a Giraffe (rook) to the right of the king\n - an Elephant (bishop) to the left of the king\n - a Chick (pawn) in front of the king\n \n Each piece moves as in standard shogi, but is limited to moving one square per turn. If the Chick advances to reach the final rank, it promotes to a Hen, which can move one square any way except diagonally backwards (like the gold general in shogi).\n \n As in shogi, if a Hen is captured, it may only be dropped back into play as a Chick. However, standard restrictions on where one may drop a Chick, such as not being allowed to give immediate checkmate, have two Chicks on a file, or drop the Chick on the final rank, do not apply. A chick dropped on the final rank, however, does not promote (and may make no further moves until it is recaptured).\n \n If the players play the same position three turns in a row, the game is a draw. \n\n###\n\n", "completion": "(define \"Promote\" (move Promote (last To) (piece (id \"Chicken\" Mover)))) (define \"InLastRank\" (is In #1 (sites Mover \"LastRank\"))) (define \"StepMove\" (move Step #1 (to if:(not (\"IsFriendAt\" (to))) \"CapturePiece\") #2)) (define \"CapturePiece\" (apply (if (\"IsEnemyAt\" (to)) (if (\"IsPieceAt\" \"Lion\" Next (to)) (remove (to)) (add (piece (mapEntry \"Captured\" (what at:(to)))) (to (mapEntry \"Where\" (what at:(to))))))))) (game \"Let's Catch the Lion\" (\"TwoPlayersNorthSouth\") (equipment { (board (rectangle 4 3)) (tile \"Giraffe\" Each (\"StepMove\" Orthogonal)) (tile \"Elephant\" Each (\"StepMove\" Diagonal)) (tile \"Chick\" Each (\"StepMove\" Forward (then (if (\"InLastRank\" (last To)) (\"Promote\"))))) (tile \"Chicken\" Each (\"StepMove\" (directions {Forward Backward Rightward Leftward FL FR}))) (tile \"Lion\" Each (\"StepMove\" Adjacent)) (map \"Captured\" { (pair (id \"Giraffe\" P1) (id \"Giraffe\" P2)) (pair (id \"Giraffe\" P2) (id \"Giraffe\" P1)) (pair (id \"Elephant\" P1) (id \"Elephant\" P2)) (pair (id \"Elephant\" P2) (id \"Elephant\" P1)) (pair (id \"Chick\" P1) (id \"Chick\" P2)) (pair (id \"Chick\" P2) (id \"Chick\" P1)) (pair (id \"Chicken\" P1) (id \"Chick\" P2)) (pair (id \"Chicken\" P2) (id \"Chick\" P1))}) (map \"Where\" { (pair (id \"Giraffe\" P1) (handSite P2)) (pair (id \"Giraffe\" P2) (handSite P1)) (pair (id \"Elephant\" P1) (handSite P2 1)) (pair (id \"Elephant\" P2) (handSite P1 1)) (pair (id \"Chick\" P1) (handSite P2 2)) (pair (id \"Chick\" P2) (handSite P1 2)) (pair (id \"Chicken\" P1) (handSite P2 2)) (pair (id \"Chicken\" P2) (handSite P1 2))}) (regions \"LastRank\" P1 (sites Top)) (regions \"LastRank\" P2 (sites Bottom)) (hand Each size:3)}) (rules (start { (place \"Giraffe1\" coord:\"C1\") (place \"Giraffe2\" coord:\"A4\") (place \"Chick1\" coord:\"B2\") (place \"Chick2\" coord:\"B3\") (place \"Lion1\" coord:\"B1\") (place \"Lion2\" coord:\"B4\") (place \"Elephant1\" coord:\"A1\") (place \"Elephant2\" coord:\"C4\")}) (play (or (move (from (sites Occupied by:Mover container:\"Hand\" components:{\"Giraffe\" \"Chick\" \"Elephant\"})) (to (sites Empty))) (forEach Piece))) (end { (if (is Cycle) (result Mover Draw)) (if (or (\"IsOffBoard\" (where \"Lion\" Next)) (is In (where \"Lion\" Mover) (sites Mover \"LastRank\"))) (result Mover Win))}))) 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 Ludii game based on the following description\n5x5 holes. Twelve pieces per player, which begin in the two rows closest to each player and in the two holes to the right of the central hole. The central hole remains empty. \n \n Players alternate turns moving a piece to an empty adjacent hole sideways or forward diagonally or orthogonally. Unpromoted pieces cannot move or capture backwards. A player may capture an opponent's piece by hopping over it to an empty space immediately on the opposite side of it, in one of the allowed directions. \n \n The huff rules applies: when a player does not make a capture that they should, the opponent removes the piece that should have captured. \n \n When a piece reaches a corner space on the opposite side of the board from where it starts, it is promoted to Dama. The Dama can move and capture any distance orthogonally or diagonally, and may also move backwards. \n \n The player who captures all of the opponent's pieces wins. \n\n###\n\n", "completion": "(define \"ShouldCapturedButMoved\" (and (is In (last From) (\"SitesWithPossibleCaptureInPreviousTurn\")) (is In (last From) (sites Empty)))) (define \"HuffOnePieceOf\" (move Select (from #1 if:(is Occupied (from))) (then (and { (remove (last To)) (moveAgain) (set Value Prev 0)})))) (define \"SitesWithPossibleCaptureInPreviousTurn\" (sites Pending)) (define \"RememberSiteWithPossibleCapture\" (set Pending (sites From (or (forEach Piece \"Disc\" (\"HopDisc\")) (forEach Piece \"DiscDouble\" (\"HopCaptureDistance\" ~ All)))))) (define \"DidNotCaptured\" (= (value Player Prev) 1)) (define \"HasNotCaptured\" (set Value Mover 1)) (define \"HasCaptured\" (set Value Mover 0)) (define \"HopDiscDouble\" (\"HopCaptureDistance\" ~ All ~ (then (\"HasCaptured\")))) (define \"HopDisc\" (\"HopCapture\" ~ (directions {Rightward Leftward Forwards} of:All) (then (and (\"PromoteIfReach\" (sites Next) \"DiscDouble\") (\"HasCaptured\"))))) (game \"La Dama\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 5) use:Vertex) (piece \"Disc\" Each (or (\"HopDisc\") (\"StepToEmpty\" (directions {Rightward Leftward Forwards} of:All) (then (\"HasNotCaptured\"))) (then (\"PromoteIfReach\" (sites Next) \"DiscDouble\")))) (piece \"DiscDouble\" Each (or (\"HopDiscDouble\") (move Slide All (then (\"HasNotCaptured\"))))) (regions P1 (intersection (sites Corners) (sites Bottom))) (regions P2 (intersection (sites Corners) (sites Top)))}) (rules (start { (place \"Disc1\" (union {(expand (sites Bottom)) (sites {\"D3\" \"E3\"})})) (place \"Disc2\" (union {(sites {\"A3\" \"B3\"}) (expand (sites Top))}))}) (play (or (if (\"DidNotCaptured\") (or (if (\"ShouldCapturedButMoved\") (\"HuffOnePieceOf\" (last To))) (\"HuffOnePieceOf\" (\"SitesWithPossibleCaptureInPreviousTurn\")))) (do (\"RememberSiteWithPossibleCapture\") next:(forEach Piece)))) (end (\"CaptureAll\" Mover)))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"CommanderOfWasCapture\" (is Triggered \"CommanderCaptured\" #1)) (define \"CaptureCommandeOf\" (trigger \"CommanderCaptured\" #1)) (define \"CommanderOfWasCapture\" (is Triggered \"CommanderCaptured\" #1)) (define \"CaptureCommandeOf\" (trigger \"CommanderCaptured\" #1)) (define \"StepOrChangeDirection\" (or (move Step #1 (to if:(not (\"IsFriendAt\" (to))) (apply \"RemovePiece\")) #2) (move Set Rotation))) (define \"SlideOrChangeDirection\" (or (move Slide #1 (between #2) (to if:(\"IsEnemyAt\" (to)) (apply \"RemovePiece\"))) (move Set Rotation))) (define \"RemovePiece\" (remove (to))) (game \"Ploy\" (players 2) (equipment { (board (square 9) use:Vertex) (piece \"Commander\" Each (\"StepOrChangeDirection\" (directions {FR FL BL BR} of:All))) (piece \"Shield\" Each (\"StepOrChangeDirection\" (directions Forward of:All) (then (moveAgain)))) (piece \"LanceW\" Each (\"SlideOrChangeDirection\" (directions Forwards of:All) (max 3))) (piece \"LanceY\" Each (\"SlideOrChangeDirection\" (directions {FR FL Backward} of:All) (max 3))) (piece \"LanceT\" Each (\"SlideOrChangeDirection\" (directions {Forward Rightward Leftward} of:All) (max 3))) (piece \"ProbeI\" Each (\"SlideOrChangeDirection\" (directions {Forward Backward} of:All) (max 2))) (piece \"ProbeMinV\" Each (\"SlideOrChangeDirection\" (directions {Forward FR} of:All) (max 2))) (piece \"ProbeBigV\" Each (\"SlideOrChangeDirection\" (directions {FR FL} of:All) (max 2)))}) (rules (start { (place \"Commander1\" coord:\"E1\" rotation:0) (place \"Shield1\" {\"D3\" \"E3\" \"F3\"} rotation:0) (place \"ProbeI1\" coord:\"E2\" rotation:0) (place \"ProbeBigV1\" {\"D2\" \"F2\"} rotation:0) (place \"ProbeMinV1\" coord:\"C2\" rotation:0) (place \"ProbeMinV1\" coord:\"G2\" rotation:7) (place \"LanceW1\" {\"D1\" \"F1\"} rotation:0) (place \"LanceY1\" {\"C1\" \"G1\"} rotation:0) (place \"LanceT1\" {\"B1\" \"H1\"} rotation:0) (place \"Commander2\" coord:\"E9\" rotation:4) (place \"Shield2\" {\"D7\" \"E7\" \"F7\"} rotation:4) (place \"ProbeI2\" coord:\"E8\" rotation:4) (place \"ProbeBigV2\" {\"D8\" \"F8\"} rotation:4) (place \"ProbeMinV2\" coord:\"C8\" rotation:3) (place \"ProbeMinV2\" coord:\"G8\" rotation:4) (place \"LanceW2\" {\"D9\" \"F9\"} rotation:4) (place \"LanceY2\" {\"C9\" \"G9\"} rotation:4) (place \"LanceT2\" {\"B9\" \"H9\"} rotation:4)}) (play (if \"SameTurn\" (or (move Set Rotation (to (last To))) (move Pass)) (forEach Piece))) (end (if (or (\"IsOffBoard\" (where \"Commander\" Next)) (= (count Pieces Next) 1)) (result Mover Win)))))\n\n###\n\n", "completion": "The goal is to capture the enemy Commander, or reduce the opponent army to a single Commander. Each piece has an indicator which determines at which directions the piece can move. This can be altered by rotating the piece 45 degrees= to the left or right. Rotating the piece costs a move. Each player has 3 Shields, 5 Probes, 6 Lances, and one Commander. The Shield moves one step and has only one movement freedom at any time. The Probe slides two steps and has two freedoms. The Lance slides three steps and has three freedoms. The Commander has four, but can only move one step. A player must either make a direction move or a motion move. The three Shields are the only pieces that can perform a direction move immediately after a motion move. Capture occurs by displacement. The two players version of Ploy. END" }, { "prompt": "Construct a Ludii game based on the following description\n5x5 intersecting lines with diagonals drawn in the four quadrants. Twelve pieces per player. which begin on two rows closest to the player and the two spaces in the central row on the player's right. Players alternate turns moving a piece to an empty adjacent point on the board, along the lines in a forward or sideways direction. A player may capture an opponent's piece by hopping over it to an empty space on immediately on the opposite side of it along the lines on the board. Captures are compulsory, and if the opponent realizes that the player did not make a possible capture, the opponent immediately captures the player's piece that could have captured but didn't. Regular pieces cannot capture backwards. When a piece reaches the farthest row on the opposite side of the board from where they started, it is promoted to a king, which can move and capture any distance along the lines of the board. The player who captures all of their opponent's pieces wins. \n\n###\n\n", "completion": "(define \"ShouldCapturedButMoved\" (and (is In (last From) (\"SitesWithPossibleCaptureInPreviousTurn\")) (is In (last From) (sites Empty)))) (define \"HuffOnePieceOf\" (move Select (from #1 if:(is Occupied (from))) (then (and { (remove (last To)) (moveAgain) (set Value Prev 0)})))) (define \"SitesWithPossibleCaptureInPreviousTurn\" (sites Pending)) (define \"RememberSiteWithPossibleCapture\" (set Pending (sites From (or (forEach Piece \"Counter\" (\"HopCounter\")) (forEach Piece \"DoubleCounter\" (\"HopCaptureDistance\")))))) (define \"DidNotCaptured\" (= (value Player Prev) 1)) (define \"HasNotCaptured\" (set Value Mover 1)) (define \"HasCaptured\" (set Value Mover 0)) (define \"HopCounter\" (\"HopCapture\" ~ (directions {Forwards Rightward Leftward}) (then (and (\"PromoteIfReach\" (sites Next) \"DoubleCounter\") (\"HasCaptured\"))))) (game \"Dama (Alquerque)\" (\"TwoPlayersNorthSouth\") (equipment { (\"AlquerqueBoard\" 5 5) (piece \"Counter\" Each (or (\"HopCounter\") (\"StepToEmpty\" (directions {Forwards Rightward Leftward}) (then (\"HasNotCaptured\"))) (then (\"PromoteIfReach\" (sites Next) \"DoubleCounter\")))) (piece \"DoubleCounter\" Each (or (\"HopCaptureDistance\" ~ ~ ~ (then (\"HasCaptured\"))) (move Slide (then (\"HasNotCaptured\"))))) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start { (place \"Counter1\" (union {(expand (sites Bottom)) (sites {\"D3\" \"E3\"})})) (place \"Counter2\" (union {(sites {\"A3\" \"B3\"}) (expand (sites Top))}))}) (play (or (if (\"DidNotCaptured\") (or (if (\"ShouldCapturedButMoved\") (\"HuffOnePieceOf\" (last To))) (\"HuffOnePieceOf\" (\"SitesWithPossibleCaptureInPreviousTurn\")))) (do (\"RememberSiteWithPossibleCapture\") next:(forEach Piece)))) (end (\"CaptureAll\" Mover)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nEach turn you must move one of your stacks, in a straight line orthogonally or diagonally, a distance exactly equal to the size of that stack.\n If it lands on an empty space, the stack grows by 1.\n If it lands on an enemy, the enemy is removed and your stack shrinks down to size 1.\n It is not legal to land on a friendly stack.\n Jumping over stacks is allowed.\n Stacks may also jump off the board, removing themselves from the game. \n Passing is not allowed.\n \n Definitions for crown and king: In this implementation, the king-stack will have a red stroke color. This red ring is the crown. Which stack has the crown is determined like this: After your move, if there is, among your stacks, a unique stack of the biggest size, the crown will be on that stack. There is no other way the crown can change heads. The piece with a crown on it is the king.\n \n Goal: If the enemy king is removed from the game, you win.\n \n Note: In this implementation, jumping off the board is only possible if the stack can reach exactly 1 row or column beyond the perimeter. But it seems to always be the case that it is possible to jump off the board when a stack is big enough. Please let Michael know if you encounter a scenario where a piece is stuck. This should not be allowed according to the rules of the game. \n\n###\n\n", "completion": "(define \"Move\" (or (\"MoveToEmpty\") (\"Capture\") #1)) (define \"Capture\" (move (from) (to (sites Around (from) Enemy distance:(size Stack at:(from))) (apply (and { (if (= 1 (state at:(to))) (set Var \"MoverHasWon\" 1)) (set Var (state at:(from))) (remove (to) count:(size Stack at:(to)))}))) count:(size Stack at:(from)) stack:True (then (if (< 1 (size Stack at:(last To))) (and (remove (last To) count:(- (size Stack at:(last To)) 1)) (set State at:(last To) (var))))))) (define \"MoveToEmpty\" (move (from) (to (sites Around (from) Empty distance:(size Stack at:(from))) (apply (if (and { (= 1 (state at:(from))) (is In (to) (sites Outer))}) (set Var \"MoverHasLost\" 1)))) count:(size Stack at:(from)) stack:True (then (add (to (last To) level:0) stack:True)))) (define \"UpdateKing\" (if (= 1 (count Sites in:(forEach (sites Occupied by:Mover) if:(= (size Stack at:(site)) (max (results from:(sites Occupied by:Mover) to:0 (size Stack at:(from)))))))) (forEach Piece (if (= (size Stack at:(from)) (max (results from:(sites Occupied by:Mover) to:0 (size Stack at:(from))))) (set State at:(from) 1) (set State at:(from) 0)) Mover top:True))) (game \"Lielow\" (players 2) (equipment { (board (square 10)) (piece \"Disc\" Each)}) (rules (start { (place \"Disc1\" (difference (difference (expand (sites Bottom) steps:2) (expand (sites Bottom) steps:1)) (sites Outer))) (place \"Disc2\" (difference (difference (expand (sites Top) steps:2) (expand (sites Top) steps:1)) (sites Outer)))}) (play (forEach Piece (\"Move\") Mover top:True (then (do (remove (sites Outer) count:(size Stack at:(last To))) next:(\"UpdateKing\"))))) (end { (if (= 1 (var \"MoverHasLost\")) (result Mover Loss)) (if (= 1 (var \"MoverHasWon\")) (result Mover Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\n5x6 board. Each player has twelve pieces. Players alternate placing their pieces until they are all placed on the board. Players cannot make a row of three pieces in the placement phase. Once the pieces are all on the board, they may be moved one space orthogonally. The goal is to make a line of three, which allows the player to capture one of the opponent's pieces. In the case that a move creates two lines of three, only one capture is made. The player who captures the most pieces wins. Matches are typically played to a score of ten, with a player scoring one point by winning a game, and two points for winning without any of their pieces being captured. \n\n###\n\n", "completion": "(define \"NoLine3\" (not (is Line 3 Orthogonal))) (game \"Dra\" (players 2) (equipment { (board (rectangle 5 6)) (hand Each) (piece \"Marker\" Each (\"StepToEmpty\" Orthogonal (then (\"ReplayIfLine3\" Orthogonal exact:True))))}) (rules (start (place \"Marker\" \"Hand\" count:12)) phases:{ (phase \"Placement\" (play (do (move (from (handSite Mover)) (to (sites Empty))) ifAfterwards:\"NoLine3\")) (nextPhase (\"HandEmpty\" P2) \"Movement\")) (phase \"Movement\" (play (if \"SameTurn\" \"RemoveAnyEnemyPiece\" (forEach Piece))) (end (\"HavingLessPiecesLoss\" Next 2)))})) END" }, { "prompt": "Construct a Ludii game based on the following description\nOmny is played on the cells of any hexagonal grid where some or all of the cells are designated star cells. Players take turns placing a stone of one's own color on an empty cell. A group is a set of connected stones of the same color. A cut of a group X is any set of connected cells (empty or occupied by either player) including no stones in X. You win by making a group such that none of its cuts include more than half the cells of the board. For serious play it is advised to play with a balance rule in force.\n \n In Mis\u00e8re Omny you lose if you make a group whose cuts each contain no more than half of the star cells. A hex board is currently selected A size 7 board is currently selected The currently selected star cells are all the cells on the board. The pie rule is currently in force The standard win condition is currently selected.\n\n###\n\n", "completion": "(define \"StarCells\" (sites Board)) (game \"Omny\" (players 2) (equipment { (board (hex 7)) (piece \"Disc\" Each)}) (rules (play (if (= 1 (var)) (or (move Swap Players P1 P2) (move Add (to (sites Empty)) (then (set Var 0)))) (move Add (to (sites Empty)) (then (if (= 1 (count Moves)) (set Var 1)))))) (end (if (>= (count Sites in:(\"StarCells\")) (max (results from:(difference (sites Board) (sites Group at:(last To))) to:2 (* (to) (count Sites in:(intersection (\"StarCells\") (sites Group at:(from) if:(not (is In (to) (sites Group at:(last To))))))))))) (result Mover Win))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nEach row has 9 holes. -> Each row has 10 holes.\n(define \"AllSitesNoMoreThanOne\" (all Sites (sites Mover \"Home\") if:(>= 1 (count at:(site))))) (define \"SecondToRightInnerRow\" (if (is Mover P1) (intersection (sites Mover \"Inner\") (difference (expand (sites Right)) (sites Right))) (intersection (sites Mover \"Inner\") (difference (expand (sites Left)) (sites Left))))) (define \"RightMostHole\" (if (is Mover P1) (intersection (sites Mover \"Outer\") (sites Right)) (intersection (sites Mover \"Outer\") (sites Left)))) (define \"NextHole\" (\"NextSiteOnTrack\" #2 from:#1 \"Track\")) (define \"NoPiece\" (all Sites (sites Player) if:(= 0 (count at:(site))))) (define \"Columns\" 9) (game \"Njombwa (One Counter)\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"0,E,N1,W\" loop:True P1) (track \"Track2\" \"18,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:(sites Board))) phases:{ (phase \"Opening1\" (play (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (\"RightMostHole\")) if:(> (count at:(from)) 0)) (then (sow \"Track\" owner:(mover) apply:(if (and (not (is In (\"NextHole\" (to) 1) (\"RightMostHole\"))) (< 1 (count at:(to)))) (moveAgain)))))) (nextPhase Mover (not (is Next Mover)) \"Opening2\")) (phase \"Opening2\" (play (move (from (sites Mover \"Home\") if:(is In (\"NextHole\" (from) 1) (\"RightMostHole\"))) (to (\"RightMostHole\")) count:2)) (nextPhase Mover \"Opening3\")) (phase \"Opening3\" (play (move Remove (\"SecondToRightInnerRow\"))) (nextPhase Mover \"Sowing\")) (phase \"Sowing\" (play (if (\"AllSitesNoMoreThanOne\") (move Select (from (sites Mover \"Home\") if:(and (is Occupied (from)) (is Empty (\"NextHole\" (from) 1)))) (then (sow \"Track\" owner:(mover)))) (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(> (count at:(from)) 1)) (then (sow \"Track\" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (and (is In (to) (sites Mover \"Inner\")) (is Occupied (\"OppositePit\" (to)))) (and (remove (\"OppositePit\" (to))) (if (is Occupied (\"OppositeOuterPit\" (to))) (remove (\"OppositeOuterPit\" (to)))))))))))))} (end (forEach NonMover if:(\"NoPiece\") (result Player Loss)))))\n\n###\n\n", "completion": "(define \"AllSitesNoMoreThanOne\" (all Sites (sites Mover \"Home\") if:(>= 1 (count at:(site))))) (define \"SecondToRightInnerRow\" (if (is Mover P1) (intersection (sites Mover \"Inner\") (difference (expand (sites Right)) (sites Right))) (intersection (sites Mover \"Inner\") (difference (expand (sites Left)) (sites Left))))) (define \"RightMostHole\" (if (is Mover P1) (intersection (sites Mover \"Outer\") (sites Right)) (intersection (sites Mover \"Outer\") (sites Left)))) (define \"NextHole\" (\"NextSiteOnTrack\" #2 from:#1 \"Track\")) (define \"NoPiece\" (all Sites (sites Player) if:(= 0 (count at:(site))))) (define \"Columns\" 10) (game \"Njombwa (One Counter)\" (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:(sites Board))) phases:{ (phase \"Opening1\" (play (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (\"RightMostHole\")) if:(> (count at:(from)) 0)) (then (sow \"Track\" owner:(mover) apply:(if (and (not (is In (\"NextHole\" (to) 1) (\"RightMostHole\"))) (< 1 (count at:(to)))) (moveAgain)))))) (nextPhase Mover (not (is Next Mover)) \"Opening2\")) (phase \"Opening2\" (play (move (from (sites Mover \"Home\") if:(is In (\"NextHole\" (from) 1) (\"RightMostHole\"))) (to (\"RightMostHole\")) count:2)) (nextPhase Mover \"Opening3\")) (phase \"Opening3\" (play (move Remove (\"SecondToRightInnerRow\"))) (nextPhase Mover \"Sowing\")) (phase \"Sowing\" (play (if (\"AllSitesNoMoreThanOne\") (move Select (from (sites Mover \"Home\") if:(and (is Occupied (from)) (is Empty (\"NextHole\" (from) 1)))) (then (sow \"Track\" owner:(mover)))) (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(> (count at:(from)) 1)) (then (sow \"Track\" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (and (is In (to) (sites Mover \"Inner\")) (is Occupied (\"OppositePit\" (to)))) (and (remove (\"OppositePit\" (to))) (if (is Occupied (\"OppositeOuterPit\" (to))) (remove (\"OppositeOuterPit\" (to)))))))))))))} (end (forEach NonMover if:(\"NoPiece\") (result Player Loss))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"EagleMovement\" (sites To (if (and (\"IsNotOffBoard\" (ahead (from) #1)) (not (\"IsFriendAt\" (ahead (from) #1)))) (or (fromTo (from) (to (ahead (from) #1))) (slide (from (ahead (from) #1)) #2 (to if:(\"IsEnemyAt\" (to)))))))) (define \"RhinoMovement\" (sites To (if (\"IsNotOffBoard\" (ahead (from) #1)) (slide (from (ahead (from) #1)) #2 (to if:(\"IsEnemyAt\" (to))))))) (define \"PromotedPiece\" (if (is In (last To) (sites Corners)) (id \"Rook\" Mover) (if (or (= (column of:(last To)) 1) (= (column of:(last To)) 10)) (id \"Lion\" Mover) (if (or (= (column of:(last To)) 2) (= (column of:(last To)) 9)) (id \"Rhino\" Mover) (if (or (= (column of:(last To)) 3) (= (column of:(last To)) 8)) (id \"Giraffe\" Mover) (if (or (= (column of:(last To)) 4) (= (column of:(last To)) 7)) (id \"Crocodile\" Mover) (id \"Eagle\" Mover))))))) (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 \"Grande Acedrex\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 12)) (\"ChessPawn\" \"Pawn\" ~ (then (if (is In (last To) (sites Mover \"Promotion\")) (promote (last To) (piece \"PromotedPiece\"))))) (\"ChessBishop\" \"Crocodile\") (piece \"Eagle\" Each (move (from) (to (union { (\"EagleMovement\" NW (directions {N W})) (\"EagleMovement\" NE (directions {N E})) (\"EagleMovement\" SW (directions {S W})) (\"EagleMovement\" SE (directions {E S}))}) (apply if:(\"IsEnemyAt\" (to)) (remove (to)))))) (piece \"Rhino\" Each (move (from) (to (union { (\"RhinoMovement\" N (directions {NE NW})) (\"RhinoMovement\" W (directions {NW SW})) (\"RhinoMovement\" S (directions {SW SE})) (\"RhinoMovement\" E (directions {SE NE}))}) (apply if:(\"IsEnemyAt\" (to)) (remove (to)))))) (piece \"Giraffe\" Each (\"LeapCapture\" \"GiraffeWalk\")) (\"ChessRook\" \"Rook\") (piece \"Lion\" Each (\"LeapCapture\" { {F F F}})) (piece \"King\" Each (or (\"StepToNotFriend\") (if \"HasNeverMoved\" (move Hop Forwards (between if:True) (to if:(not (\"IsFriendAt\" (to))) (apply (if (\"IsEnemyAt\" (to)) (remove (to))))))) \"RememberPieceHasMoved\")) (regions \"Promotion\" P1 (sites Top)) (regions \"Promotion\" P2 (sites Bottom))}) (rules (start { (place \"Pawn1\" (sites Row 3)) (place \"Rook1\" (sites {\"A1\" \"L1\"})) (place \"Lion1\" (sites {\"B1\" \"K1\"})) (place \"Rhino1\" (sites {\"C1\" \"J1\"})) (place \"Giraffe1\" (sites {\"D1\" \"I1\"})) (place \"Crocodile1\" (sites {\"E1\" \"H1\"})) (place \"Eagle1\" coord:\"F1\") (place \"King1\" coord:\"G1\" state:1) (place \"Pawn2\" (sites Row 8)) (place \"Rook2\" (sites {\"A12\" \"L12\"})) (place \"Lion2\" (sites {\"B12\" \"K12\"})) (place \"Rhino2\" (sites {\"C12\" \"J12\"})) (place \"Giraffe2\" (sites {\"D12\" \"I12\"})) (place \"Crocodile2\" (sites {\"E12\" \"H12\"})) (place \"Eagle2\" coord:\"F12\") (place \"King2\" coord:\"G12\" state:1)}) (play (do (or { (forEach Piece \"Pawn\") (forEach Piece \"King\") (forEach Piece \"Rook\") (forEach Piece \"Lion\") (forEach Piece \"Giraffe\") (forEach Piece \"Eagle\") (forEach Piece \"Crocodile\") (forEach Piece \"Rhino\")}) ifAfterwards:(not (\"IsInCheck\" \"King\" Mover)))) (end (\"Checkmate\" \"King\"))))\n\n###\n\n", "completion": "12x12 checkered board. Each player begins with 24 pieces with special moves: King (x1): Moves one space orthogonally or diagonally or may jump over one space forward orthogonally or diagonally on its first move; Aanca (x2): Moves diagonally one and one space orthogonally in the same direction, and may continue moving in that same direction any distance; Crocodile (x2): moves diagonally any distance; Giraffe (x2): moves two spaces diagonally and then one orthogonally in the same direction, jumping over any intervening pieces; Rhinoceros (x2): moves diagonally one space and then one orthogonally in the same directions, jumping over any intervening pieces, and then may continue along the diagonal in the same direction; Lion (x2); jumps orthogonally three spaces away. Rook (x2): moves any distance orthogonally; Pawns (12): move forward orthogonally one pace or diagonally one space to capture. When they reach the opposite edge of the board, they are promoted to the piece which began in that space. If this is the King's space, it is promoted to Aanca. The opening position is for white: Rook, Lion, Rhinoceros, Giraffe, Crocodile, Aanca, King, Crocodile, Giraffe, Rhinoceros, Lion, Rook. This is mirrored for black so that the kings face each other. The pawns begin on the fourth row. Pieces are captured when a piece lands on a space occupied by the opposing player. The goal is to checkmate the King. When the King can be captured on the opponent's next turn, it is in check. The player must remove the King from check on their next turn. If the King cannot move out of check, it is checkmated and the opponent wins. The rules of Alfonso X without dice. END" }, { "prompt": "Construct a Ludii game based on the following description\nStarting with the runner player, players alternate moving one of their checker tokens. Each token moves in one orthogonal direction only.\n \n Runner tokens move vertically from the first rank, either by moving into an adjacent empty space or by jumping over an adjacent opponent token into an empty space and capturing the jumped token.\n \n Blocker tokens move horizontally in a similar manner - the left tokens always move toward the right and the right tokens always move towards the left.\n \n In the standard/introductory game, played on an 8x8 board, captures are mandatory and multiple capture are possible with maximum capture sequences having priority. In tournament games, played on a 10 x 10 board, captures are optional.\n \n Blocker tokens may not jump over or capture other blocker tokens.\n \n The game ends when a runner token reaches the last rank or the runner player cannot move.\n \n Two games should be played, with players swapping roles. At the end of each game, the runner player scores the rank/row of each of his or her remaining tokens on the board. The player with the highest score after two games wins the match. 8 x 8 board Forced captures\n\n###\n\n", "completion": "(define \"HopCounter\" (move Hop (from #1) #2 (between if:(and (not (is In (between) (sites ToClear))) (\"IsEnemyAt\" (between))) (apply (remove (between) at:EndOfTurn))) (to if:(is Empty (to))) #3)) (game \"Gauntlet\" (players {(player N) (player W)}) (equipment { (board (square 8)) (piece \"Counter\" Each) (piece \"DoubleCounter\" Each) (regions \"RunnerGoal\" P1 (difference (sites Top) (sites Corners))) (regions \"RunnerGoalRed\" Neutral (intersection (difference (sites Top) (sites Corners)) (sites Phase 0))) (regions \"RunnerGoalPink\" Neutral (intersection (difference (sites Top) (sites Corners)) (sites Phase 1)))}) (rules (start { (place \"Counter1\" (difference (sites Bottom) (sites Corners))) (place \"DoubleCounter2\" (difference (sites Left) (sites Corners))) (place \"Counter2\" (difference (sites Right) (sites Corners)))}) (play (priority { (max Moves (or (forEach Piece \"Counter\" (\"HopCounter\" (from) Forward (then (if (can Move (\"HopCounter\" (last To) Forward)) (moveAgain))))) (forEach Piece \"DoubleCounter\" (\"HopCounter\" (from) Backward (then (if (can Move (\"HopCounter\" (last To) Backward)) (moveAgain))))))) (or (forEach Piece \"Counter\" (move Step (directions Forward) (to if:(is Empty (to))))) (forEach Piece \"DoubleCounter\" (move Step (directions Backward) (to if:(is Empty (to))))))})) (end { (if (no Moves Next) (result Next Loss)) (if (is In (last To) (sites Mover)) (result Mover Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nBlack plays first, then turns alternate. On his turn, a player must place a stone of his color on an empty point of the board. At the end of a turn, all groups on the board (both friendly and enemy) must have at least one liberty. Otherwise the player's move is illegal. Whoever can't make a move on his turn loses. The game is played on 9x9 board.\n\n###\n\n", "completion": "(define \"NoCapture\" (not (can Move (\"EncloseCapture\" Orthogonal)))) (game \"NoGo\" (players 2) (equipment { (board (square 9) use:Vertex) (piece \"Marker\" Each)}) (rules (play (do (move Add (to (sites Empty))) ifAfterwards:(and (\"HasFreedom\" Orthogonal) \"NoCapture\"))) (end (\"NoMoves\" Loss)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe player must insert numbers so that the sums of lines in all three directions equal the same number. Numbers cannot be repeated. \n\n###\n\n", "completion": "(game \"Magic Hexagon\" (players 1) (equipment { (board (hex 3) (values Cell (range 1 19))) (regions { (sites {0 1 2}) (sites {3 4 5 6}) (sites {7 8 9 10 11}) (sites {12 13 14 15}) (sites {16 17 18}) (sites {2 6 11}) (sites {1 5 10 15}) (sites {0 4 9 14 18}) (sites {3 8 13 17}) (sites {7 12 16}) (sites {0 3 7}) (sites {1 4 8 12}) (sites {2 5 9 13 16}) (sites {6 10 14 17}) (sites {11 15 18})}) (regions HintRegions)}) (rules (play (satisfy { (all Different (sites Board)) (is Sum 38)})) (end (if (is Solved) (result P1 Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nOn your turn you have to options:\n \u2022 Noncapturing move: Step kingwise away from the center of the line you are stepping along.\n \u2022 Capturing move: Capture queenwise any enemy not farther away from the center of the line you are moving along.\n \n Only if you have no moves may you pass. The game is over when only one player has pieces left. That player is the winner. A 6x6 board is currently selected\n\n###\n\n", "completion": "(define \"Capture\" (move (from) (to (intersection (sites Occupied by:Next) (sites Direction from:(from) (directions {#1 #2}) stop:(is Occupied (to)) stopIncluded:True)) if:(not (> (min (count Sites in:(sites Direction from:(from) #1)) (count Sites in:(sites Direction from:(from) #2))) (min (count Sites in:(sites Direction from:(to) #1)) (count Sites in:(sites Direction from:(to) #2))))) (apply (remove (to)))))) (define \"Step\" (move Step (from) (to if:(and { (is Empty (to)) (or { (and (or (= (from) (+ (to) 6)) (= (from) (- (to) 6))) (\"Outward\" N S)) (and (or (= (from) (+ (to) 1)) (= (from) (- (to) 1))) (\"Outward\" E W)) (and (or (= (from) (+ (to) (+ 6 1))) (= (from) (- (to) (+ 6 1)))) (\"Outward\" SW NE)) (and (or (= (from) (+ (to) (- 6 1))) (= (from) (- (to) (- 6 1)))) (\"Outward\" SE NW))})})))) (define \"Outward\" (< (max (count Sites in:(sites Direction from:(from) #1)) (count Sites in:(sites Direction from:(from) #2))) (max (count Sites in:(sites Direction from:(to) #1)) (count Sites in:(sites Direction from:(to) #2))))) (game \"Zola\" (players 2) (equipment { (board (square 6)) (piece \"Disc\" Each)}) (rules (start { (place \"Disc1\" (sites Phase 0)) (place \"Disc2\" (sites Phase 1))}) (play (forEach Piece (or { (\"Capture\" N S) (\"Capture\" NE SW) (\"Capture\" E W) (\"Capture\" SE NW) (\"Step\")}))) (end (if (or (no Pieces P1) (no Pieces P2)) (result Mover Win))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"MoveTo\" (forEach Site (sites Occupied by:Mover) (if (\"CanEscape\" #1) (\"RemoveAPiece\") (move (from (site)) (to #1 if:(\"NoEnemyOrOnlyOne\" (to)) (\"HittingCapture\" (\"Bar\"))))))) (define \"CanEscape\" (\"IsOffBoard\" #1)) (define \"AllPieceEscaped\" (no Pieces Mover)) (define \"Bar\" (mapEntry (mover))) (define \"RemoveAPiece\" (move Remove (site))) (define \"NextSiteFromDist6\" (\"NextSiteOnTrack\" 6 from:#1)) (define \"NextSiteFrom\" (\"NextSiteOnTrack\" (pips) from:#1)) (game \"Baralie\" (players 2) (equipment { (\"BackgammonBoard\" \"BackgammonTracksSameDirectionWithBar\") (dice num:2) (map {(pair 1 19) (pair 2 6)}) (piece \"Disc\" Each)}) (rules (start { (place Stack \"Disc1\" 12 count:15) (place Stack \"Disc2\" 11 count:14) (place Stack \"Disc2\" 10)}) (play (\"RollEachNewTurnMove\" (if (all DiceUsed) (\"MoveTo\" (\"NextSiteFromDist6\" (site))) (forEach Die if:(\"DieNotUsed\") (\"MoveTo\" (\"NextSiteFrom\" (site))) (then (moveAgain)))))) (end (if (\"AllPieceEscaped\") (result Mover Win)))))\n\n###\n\n", "completion": "2x12 board, divided in half, where the spaces are rendered as points. Fifteen pieces per player. Two six-sided dice. Both players begin on the same side of the board, one player with fifteen pieces on the rightmost point, the other player with fourteen pieces on the point behind it, and one on the point behind that. 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. On each throw the player also plays a throw of 6 in addition to the throw presented by the dice. Pieces move in an anti-clockwise direction around the board. A piece cannot move to a point that is occupied by more than one of the opponent's pieces. If a piece lands on a point occupied by a single piece belonging to the opponent, the opponent's piece is removed from the board and must enter again from the leftmost point in the row where the pieces began. A piece may be borne off the board when a throw is greater than the number of points left on the board. The first player to bear all of their pieces off the board wins. END" }, { "prompt": "Construct a Ludii game based on the following description\nThe board is a track of any number of spaces, made in the sand. Any number of players, playing with one piece. One piece is the hyena. Four nut shells are used as dice, with the following throws: four of all the same side = 20; two of the same side = 2; any other throw = 0. The first player to reach the end of the track then plays as the hyena. The hyena moves twice the value of the throw. When the hyena overtakes a player's piece, it is removed from the board and the player loses. The game involves 8 players. The track is composed of 100 spaces\n\n###\n\n", "completion": "(define \"SetHyenaPlayer\" (and (add (piece \"Hyena\") (to 0) stack:True) (set Var (id Mover)))) (define \"HyenaPlayer\" (var)) (define \"SiteHyenaToMove\" (\"SiteToMoveOnTrack\" from:(where \"Hyena\" Shared) (* 2 (\"ThrowValue\")))) (define \"SiteToMove\" (if (= (from) (handSite Mover)) (\"SiteToMoveOnTrack\" from:0 (- (\"ThrowValue\") 1)) (\"SiteToMoveOnTrack\" from:(from) (\"ThrowValue\")))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" #2 #1)) (define \"ThrowValue\" (mapEntry \"Throw\" (count Pips))) (game \"Nama\" (players 8) (equipment { (board (rectangle 100 1) (track \"Track\" {0..99} directed:True)) (hand Each) (hand Shared) (piece \"Marker\" Each (if (\"IsOffBoard\" (\"SiteToMove\")) (move Remove (from) level:(level) (then (if (\"IsOffBoard\" (where \"Hyena\" Shared)) (\"SetHyenaPlayer\")))) (move (from (from) level:(level)) (to (\"SiteToMove\")) stack:True))) (piece \"Hyena\" Shared) (\"StickDice\" 4) (map \"Throw\" {(pair 0 0) (pair 1 0) (pair 2 2) (pair 3 0) (pair 4 20)})}) (rules (start (place \"Marker\" \"Hand\")) (play (\"RollMove\" (if (< 0 (\"ThrowValue\")) (if (= (\"HyenaPlayer\") (id Mover)) (if (\"IsOffBoard\" (\"SiteHyenaToMove\")) (move Remove (where \"Hyena\" Shared) (then (forEach Site (sites Board) (if (is Occupied (site)) (remove (site) count:(size Stack at:(site))))))) (move (from (where \"Hyena\" Shared)) (to (\"SiteHyenaToMove\")) (then (forEach Value min:1 max:(- (* 2 (\"ThrowValue\")) 1) (if (is Occupied (\"SiteToMoveOnTrack\" from:(last From) (value))) (remove (\"SiteToMoveOnTrack\" from:(last From) (value)) count:(size Stack at:(\"SiteToMoveOnTrack\" from:(last From) (value))))))))) (or (forEach Piece) (forEach Piece container:(mover))))))) (end { (forEach Player if:(and { (> (\"HyenaPlayer\") 0) (!= (player) (\"HyenaPlayer\")) (\"IsOffBoard\" (where \"Hyena\" Shared))}) (result Player Loss)) (if (and (= (id Mover) (\"HyenaPlayer\")) (\"IsOffBoard\" (where \"Hyena\" Shared))) (result Mover Win)) (forEach Player if:(and (!= (player) (\"HyenaPlayer\")) (no Pieces of:(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 Ludii game based on the following description\nA player can move a piece to any empty adjacent cell of the same color; so, on an open board, six moves are possible. Throughout the game, a player's pieces are restricted to cells of the same color.\n \n A captured piece is immediately removed from the game.\n \n A player captures a regular enemy piece by surrounding it on three sides.\n A player captures an enemy captain by surrounding it on three sides, with the caveat that one of the surrounding pieces must be a captain. (Three regular pieces are insufficient and the enemy captain would be unaffected.)\n An enemy piece on the edge of the board can be captured by surrounding it on two sides, with the caveat that one of the surrounding pieces must be a captain. (Two regular pieces are insufficient.)\n If a piece (regular or captain) is moved to a cell already surrounded by three enemy pieces, it is instantly captured, unless the move itself performed a capture.\n \n A player wins the game by reducing the opponent to two pieces. \n\n###\n\n", "completion": "(define \"PieceMove\" (move Step (to if:(and (is Empty (to)) (= (phase of:(from)) (phase of:(to))))) (then (and { (\"SuicideSurrounded\") (\"SurroundedEnemyOnOuterEdge\") (\"SurroundedThrall\") (\"SurroundedJarl\")})))) (define \"SuicideSurrounded\" (if (not (can Move (or { (\"SurroundedEnemyOnOuterEdge\") (\"SurroundedThrall\") (\"SurroundedJarl\")}))) (if (\"SiteSurrounded\") (remove (last To))))) (define \"SiteSurrounded\" (= 3 (count Sites in:(intersection (sites Around (last To) Orthogonal) (sites Occupied by:Next))))) (define \"SurroundedEnemyOnOuterEdge\" (\"Surrounded\" if:(and { (is In (between) (sites Outer)) (\"IsPhaseZero\" (between)) (\"IsEnemyAt\" (between))}) with:(piece (id \"Jarl\" Mover)))) (define \"SurroundedJarl\" (\"Surrounded\" if:(and (or (not (is In (between) (sites Outer))) (and (is In (between) (sites Outer)) (\"IsPhaseOne\" (between)))) (\"IsPieceAt\" \"Jarl\" Next (between))) with:(piece (id \"Jarl\" Mover)))) (define \"SurroundedThrall\" (\"Surrounded\" if:(and (or (not (is In (between) (sites Outer))) (and (is In (between) (sites Outer)) (\"IsPhaseOne\" (between)))) (\"IsPieceAt\" \"Thrall\" Next (between))))) (define \"Surrounded\" (surround (from (last To)) Orthogonal (between #1 (apply (remove (between)))) (to if:(\"IsFriendAt\" (to))) #2)) (game \"Bizingo\" (players 2) (equipment { (board (remove (tri 13) cells:{ 0 1 13 25 11 12 24 36 165..168})) (piece \"Thrall\" Each (\"PieceMove\")) (piece \"Jarl\" Each (\"PieceMove\"))}) (rules (start { (place \"Thrall1\" (sites {32..36 53..58 72 74..76 78})) (place \"Jarl1\" (sites {73 77})) (place \"Thrall2\" (sites {137..139 126..129 113..117 98 100 101 103})) (place \"Jarl2\" (sites {99 102}))}) (play (forEach Piece)) (end (forEach Player if:(<= (count Pieces Player) 2) (result Player Loss))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x7 board, with two stores. Seven counters in each hole. Players sow from any hole on their side of the board, in a clockwise direction, and sow into the store on their left, but not the one on the right. When the final counter of a sowing lands in an occupied hole that is not the store, the player picks up these counters and continues sowing. When then final counter lands in an empty hole, the turn ends. When the final counter lands in the store, the turn ends. Play continues until all of the counters are in the stores, and the player with the most counters in their store wins. \n\n###\n\n", "completion": "(define \"NotMoverStore\" (!= (to) (mapEntry Mover))) (define \"PiecesOwnedBy\" (count at:(mapEntry #1))) (game \"Chungcajon\" (players 2) (equipment { (mancalaBoard 2 7 { (track \"Track1\" \"7,W,WNW,ENE,E\" loop:True P1) (track \"Track2\" \"8,E,ESE,WSW,W\" loop:True P2)}) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 FirstSite) (pair P2 LastSite)}) (piece \"Seed\" Shared)}) (rules (start (set Count 7 to:(union (sites P1) (sites P2)))) (play (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover)) if:(> (count at:(from)) 0)) (then (sow \"Track\" owner:(mover) if:(and (> (count at:(to)) 1) (\"NotMoverStore\")) apply:(moveAgain))))) (end (\"MancalaByScoreWhen\" (all Sites (union (sites P1) (sites P2)) if:(= 0 (count at:(site)))))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayers take turns placing their pieces on one empty space on the board, with the goal of making a line with stones connected diagonally of at least length 4. The length of the line is 4 or more. The game is played on a 11x11 board. The board is a diamond tiling by hexagon. The game uses the swap rule. The first player to connect their two sides wins. The connection between two stones is using all the diagonal directions.\n\n###\n\n", "completion": "(game \"Broken Line\" (players 2) (equipment { (board (hex Diamond 11)) (piece \"Marker\" Each)}) (rules (meta (swap)) (play (move Add (to (sites Empty)))) (end (if (is Line 4 Diagonal) (result Mover Win))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\n12 Holes per row. -> 15 Holes per row.\n(define \"NextHoleFrom\" (\"NextSiteOnTrack\" 1 from:#1 #2)) (define \"AHoleHasMoreThanOneCounter\" (not (all Sites (forEach (sites Mover) if:(< 1 (count at:(site)))) if:(= 0 (count at:(site)))))) (define \"LastHoleSowed\" (sites {(var)})) (define \"NoPiece\" (all Sites (sites Player \"Home\") if:(= 0 (count at:(site))))) (define \"Columns\" 12) (game \"Musoro Tsoro\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"0,E,N1,W\" loop:True P1) (track \"Track2\" \"24,E,N1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"Track1\")) (regions \"Home\" P2 (sites Track \"Track2\")) (regions \"Inner\" P1 (difference (sites Track \"Track1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"Track2\") (sites Top))) (regions \"Outer\" P1 (sites Bottom)) (regions \"Outer\" P2 (sites Top)) (piece \"Seed\" Shared)}) (rules (start { (place \"Seed\" (intersection (sites Top) (sites Left)) counts:{3} state:2) (place \"Seed\" (intersection (sites Bottom) (sites Right)) counts:{3} state:1) (set Count 2 to:(union (difference (sites Top) (sites Left)) (difference (sites Bottom) (sites Right))))}) (play (or (if (and (!= 0 (state at:(var))) (\"SameTurn\")) (move Pass)) (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(if \"AHoleHasMoreThanOneCounter\" (> (count at:(from)) 1) (and (= (count at:(from)) 1) (= 0 (count at:(\"NextHoleFrom\" (from) Mover)))))) (then (and (sow \"Track\" owner:(mover) apply:(if (= (count at:(to)) 1) (if (is In (to) (sites Mover \"Inner\")) (if (> (count at:(\"OppositePit\" (to))) 0) (and (remove (\"OppositePit\" (to))) (if (> (count at:(\"OppositeOuterPit\" (to))) 0) (remove (\"OppositeOuterPit\" (to))))))) (and (moveAgain) (set Var (to))))) (forEach Site (sites Board) (if (!= 0 (state at:(site))) (set State at:(site) (state at:(site)))))))))) (end (forEach NonMover if:(\"NoPiece\") (result Player Loss)))))\n\n###\n\n", "completion": "(define \"NextHoleFrom\" (\"NextSiteOnTrack\" 1 from:#1 #2)) (define \"AHoleHasMoreThanOneCounter\" (not (all Sites (forEach (sites Mover) if:(< 1 (count at:(site)))) if:(= 0 (count at:(site)))))) (define \"LastHoleSowed\" (sites {(var)})) (define \"NoPiece\" (all Sites (sites Player \"Home\") if:(= 0 (count at:(site))))) (define \"Columns\" 15) (game \"Musoro Tsoro\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"0,E,N1,W\" loop:True P1) (track \"Track2\" \"30,E,N1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"Track1\")) (regions \"Home\" P2 (sites Track \"Track2\")) (regions \"Inner\" P1 (difference (sites Track \"Track1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"Track2\") (sites Top))) (regions \"Outer\" P1 (sites Bottom)) (regions \"Outer\" P2 (sites Top)) (piece \"Seed\" Shared)}) (rules (start { (place \"Seed\" (intersection (sites Top) (sites Left)) counts:{3} state:2) (place \"Seed\" (intersection (sites Bottom) (sites Right)) counts:{3} state:1) (set Count 2 to:(union (difference (sites Top) (sites Left)) (difference (sites Bottom) (sites Right))))}) (play (or (if (and (!= 0 (state at:(var))) (\"SameTurn\")) (move Pass)) (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(if \"AHoleHasMoreThanOneCounter\" (> (count at:(from)) 1) (and (= (count at:(from)) 1) (= 0 (count at:(\"NextHoleFrom\" (from) Mover)))))) (then (and (sow \"Track\" owner:(mover) apply:(if (= (count at:(to)) 1) (if (is In (to) (sites Mover \"Inner\")) (if (> (count at:(\"OppositePit\" (to))) 0) (and (remove (\"OppositePit\" (to))) (if (> (count at:(\"OppositeOuterPit\" (to))) 0) (remove (\"OppositeOuterPit\" (to))))))) (and (moveAgain) (set Var (to))))) (forEach Site (sites Board) (if (!= 0 (state at:(site))) (set State at:(site) (state at:(site)))))))))) (end (forEach NonMover if:(\"NoPiece\") (result Player Loss))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe length of the line is 3 or more. -> The length of the line is 5 or more.\nThe game is played on a 10x10 board. -> The game is played on a 14x14 board.\nThe board is a diamond tiling by square. -> The board is a diamond tiling by triangle.\nThe connection between two stones is using all the orthogonal directions. -> The connection between two stones is using all the directions.\n(game \"Broken Line\" (players 2) (equipment { (board (square Diamond 10)) (piece \"Marker\" Each)}) (rules (meta (swap)) (play (move Add (to (sites Empty)))) (end (if (is Line 3 Orthogonal) (result Mover Win)))))\n\n###\n\n", "completion": "(game \"Broken Line\" (players 2) (equipment { (board (tri Diamond 14)) (piece \"Marker\" Each)}) (rules (meta (swap)) (play (move Add (to (sites Empty)))) (end (if (is Line 5 All) (result Mover Win))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"MoveIn\" (forEach Piece (move Select (from) (to (sites Around (from)) if:(\"EmptyWithEnemyIn\" #1 #2)) (then (and \"MoveThePiece\" (directional (from #3) #4 \"RemoveEnemyPiece\")))) #5)) (define \"MoveAgain\" (then (if (can Move (\"CaptureFromLast\" (last To))) (moveAgain)))) (define \"CaptureFromLast\" (or (\"MoveAgainIn\" #1 (to) SameDirection (last To) (\"LastDirection\" Vertex)) (\"MoveAgainIn\" #1 (from) OppositeDirection (last From) (directions Vertex from:(last To) to:(last From))))) (define \"MoveAgainIn\" (move Select (from #1) (to (sites Around #1) if:(\"EmptyButNotVisitedWithEnemyIn\" #2 #3)) (then (and { \"MoveThePiece\" (directional (from #4) #5 \"RemoveEnemyPiece\") (if (can Move (or (\"CaptureAgainIn\" #1 (to) SameDirection) (\"CaptureAgainIn\" #1 (from) OppositeDirection))) (moveAgain))})))) (define \"MoveThePiece\" (fromTo (from (last From)) (to (last To)))) (define \"RemoveEnemyPiece\" (to if:(\"IsEnemyAt\" (to)) (apply (remove (to))))) (define \"EmptyWithEnemyIn\" (and (is Empty (to)) (\"IsEnemyAt\" (ahead #1 #2)))) (define \"EmptyButNotVisitedWithEnemyIn\" (and { (not (is Visited (to))) (is Empty (to)) (\"IsEnemyAt\" (ahead #1 #2))})) (define \"CaptureAgainIn\" (move Select (from #1) (to (sites Around #1) if:(and { (not (is Visited (to))) (is Empty (to)) (\"IsEnemyAt\" (ahead #2 #3))})))) (game \"Vela\" (players 2) (equipment { (\"AlquerqueBoard\" 5 9) (piece \"Marker\" Each)}) (rules (start { (place \"Marker1\" (union (expand (sites Bottom)) (sites {\"B3\" \"D3\" \"G3\" \"I3\"}))) (place \"Marker2\" (union (sites {\"A3\" \"C3\" \"F3\" \"H3\"}) (expand (sites Top))))}) phases:{ (phase \"CapturingFirstPhase\" (play (priority { (if (is Mover P1) (or (\"MoveIn\" (to) SameDirection (last To) (\"LastDirection\" Vertex)) (\"MoveIn\" (from) OppositeDirection (last From) (directions Vertex from:(last To) to:(last From))))) (forEach Piece \"StepToEmpty\")})) (nextPhase (<= (count Pieces P2) 5) \"FanoronaPhase\")) (phase \"FanoronaPhase\" (play (if \"SameTurn\" (or (if (is Occupied (last To)) (\"CaptureFromLast\" (last To)) (\"CaptureFromLast\" (last From))) (move Pass)) (priority { (or (\"MoveIn\" (to) SameDirection (last To) (\"LastDirection\" Vertex) \"MoveAgain\") (\"MoveIn\" (from) OppositeDirection (last From) (directions Vertex from:(last To) to:(last From)) \"MoveAgain\")) (forEach Piece \"StepToEmpty\")}))) (end (if (no Pieces Mover) (result Next Win))))}))\n\n###\n\n", "completion": "9x5 intersecting lines with diagonals in each square formed by 3x3 intersecting lines. Each player has 22 pieces, starting on the intersections of the lines except in the centre position, placed on opposite rows of the board, but alternating in the central row. Pieces move to an adjacent intersection along the lines. In the first phase of play, one player cannot capture until they have been reduced to five pieces. The opponent may only capture, according to the following rules, but only one piece at a time is captured, even when multiple would normally be allowed. When the one player is reduced to five pieces, play continues as follows. Players must capture pieces when possible. Capturing is accomplished by moving to an adjacent intersection to an opposing piece in the continuing direction of the capturing stones movement, or by moving away from an adjacent opposing pieces in such a direction. When an opponent's piece is captured, all other of the opponent's pieces in that line are also captured. Multiple captures can be made, but cannot be done by moving twice in the same direction. Multiple captures are optional. A player wins by capturing all of the other player's pieces. END" }, { "prompt": "Construct a Ludii game based on the following description\nTURNS - At each turn, each player slides (vertically or horizontally) a stone into the only empty cell.\n \n GOAL - Wins the player who made the last move. \n\n###\n\n", "completion": "(game \"Lewthwaite's Game\" (players 2) (equipment { (board (square 5) use:Vertex) (piece \"Ball\" Each (move Slide))}) (rules (start { (place \"Ball1\" (sites Phase 1)) (place \"Ball2\" (difference (sites Phase 0) (sites Centre)))}) (play (forEach Piece)) (end (\"BlockWin\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\n4x8 board. Two counters in each hole. Opening play: Players rearrange their counters so that there are four counters in each hole of their outer row. If they play with the second array, they take turns sowing from each of the holes with four counters, beginning with the rightmost hole, placing two in the first hole and one in each of the following. Main phase: Play begins from any hole on the player's side of the board with counters in it. Singletons cannot move. Sowing happens in an anti-clockwise direction. If the last counter lands in an empty hole, the turn is over. For capturing: Holes are in 'opposition' when one player has the front row hole occupied and the opponent has both of the holes opposite it occupied. If the last hole in a sowing is in opposition, the player takes the counters in both of the opponent's holes and places them in the empty hole from which the player lifted the counters. The player then sows the captured counters from this hole. Further captures in the sowing can occur in the same way. However, each player has two hole from which clockwise plays can be made: the leftmost hole in the outer row and the second from the left in the inner row. Clockwise moves can only be made from these holes if they immediately lead to a capture. When the captured counters are sown, starting from the same hole, they can also be sown clockwise if they lead to a capture. If they cannot lead to a capture, they are sown anti-clockwise. Another alternative the player has is that, if the player plays clockwise from one of these holes and therefore makes a capture, the captured counters may be placed in the hole and left there, and the player may play instead from the other hole from which clockwise captures are allowed in a clockwise direction, if it leads to a capture. The player may continue playing from this hole as above until the possibilities to move are exhausted, and then may move from any hole in an anti-clockwise direction. Multiple captures can only be made in a clockwise direction from these holes if it is made on the first sowing of the turn. Otherwise, only one clockwise capture can be made and sowing must proceed in an anti-clockwise direction. If the last counter lands on a hole that is occupied but not in opposition, these counters are picked up and sowing continues. Play ends when one player captures all the opponent's counters or one player cannot play. The player who cannot play loses. A player may also win by capturing the counters from both of the opponent's end holes in the inner row in a single turn.\n \n\n###\n\n", "completion": "(define \"RightMostWithFour\" (trackSite FirstSite Mover \"TrackCW\" from:(if (= (value Player Mover) Undefined) (mapEntry \"RightMost\" Mover) (value Player Mover)) if:(= 4 (count at:(to))))) (define \"NextHole\" (\"NextSiteOnTrack\" #3 from:#1 #2)) (define \"OuterPhaseOppositePit\" (if (is Mover P1) (+ (to) (* 3 (\"Columns\"))) (- (to) (* (\"Columns\") 3)))) (define \"Columns\" 8) (game \"Ikibuguzo (Opening 2)\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" 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\" \"24,E,S1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"TrackCCW1\")) (regions \"Home\" P2 (sites Track \"TrackCCW2\")) (regions \"Inner\" P1 (difference (sites Track \"TrackCCW1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"TrackCCW2\") (sites Top))) (map \"RightMost\" {(pair P1 7) (pair P2 24)}) (map \"LeftMostOuter\" {(pair P1 0) (pair P2 31)}) (map \"SecondLeftInner\" {(pair P1 9) (pair P2 22)}) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 4 to:(union (sites Bottom) (sites Top)))) phases:{ (phase \"FirstMove\" (play (move (from (\"RightMostWithFour\")) (to (\"NextHole\" (from) \"TrackCCW\" 1)) count:2 (then (and { (fromTo (from (last From)) (to (\"NextHole\" (last From) \"TrackCCW\" 2)) count:1) (fromTo (from (last From)) (to (\"NextHole\" (last From) \"TrackCCW\" 3)) count:1) (set Value Mover (last From))})))) (nextPhase Mover (= (last From) (mapEntry \"LeftMostOuter\" Mover)) \"MainPhase\")) (phase \"MainPhase\" (play (or (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (sites {(mapEntry \"LeftMostOuter\" Mover) (mapEntry \"SecondLeftInner\" Mover)})) if:(and { if:(if (\"SameTurn\") (< 0 (count at:(from))) (< 1 (count at:(from)))) (is In (from) (sites {(mapEntry \"LeftMostOuter\" Mover) (mapEntry \"SecondLeftInner\" Mover)})) (is In (\"NextHole\" (from) \"TrackCW\" (count at:(from))) (sites Mover \"Inner\")) (is Occupied (\"OppositePit\" (\"NextHole\" (from) \"TrackCW\" (count at:(from))))) (is Occupied (\"OppositeOuterPit\" (\"NextHole\" (from) \"TrackCW\" (count at:(from)))))})) (then (sow \"TrackCW\" owner:(mover) apply: (if (< 1 (count at:(to))) (and (moveAgain) (if (and { (is Occupied (\"OppositePit\" (to))) (is Occupied (\"OppositeOuterPit\" (to))) (is In (to) (sites Mover \"Inner\"))}) (and { (fromTo (from (\"OppositePit\" (to))) (to (last From)) count:(count at:(\"OppositePit\" (to)))) (fromTo (from (\"OppositeOuterPit\" (to))) (to (last From)) count:(count at:(\"OppositeOuterPit\" (to)))) (set Var \"Replay\" (from))}) (set Var \"Replay\" (to)))))))) (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (sites Mover)) if:(if (\"SameTurn\") (< 0 (count at:(from))) (< 1 (count at:(from))))) (then (sow \"TrackCCW\" owner:(mover) apply: (if (< 1 (count at:(to))) (and (moveAgain) (if (and { (is Occupied (\"OppositePit\" (to))) (is Occupied (\"OppositeOuterPit\" (to))) (is In (to) (sites Mover \"Inner\"))}) (and { (fromTo (from (\"OppositePit\" (to))) (to (last From)) count:(count at:(\"OppositePit\" (to)))) (fromTo (from (\"OppositeOuterPit\" (to))) (to (last From)) count:(count at:(\"OppositeOuterPit\" (to)))) (set Var \"Replay\" (from))}) (set Var \"Replay\" (to)))))))))) (end (\"BlockWin\")))})) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe board is a five-pointed star. The player has nine pieces. The player attempts to place all the pieces on the board. The player choses a point, then moves the piece two spaces in a straight line. The piece may move through a spot occupied by another piece, but must land on an empty space. The player wins by successfully placing all nine pieces.\n \n\n###\n\n", "completion": "(game \"Nao Gutiya Baithaneka\" (players 1) (equipment { (\"StarBoard\" 5) (hand Each) (piece \"Marker\" P1 (\"HopFriendCapture\"))}) (rules (start (place \"Marker\" (handSite P1) count:9)) (play (if (is Even (count Moves)) (move (from (handSite Mover)) (to (sites Empty)) (then (moveAgain))) (forEach Piece (if (= (from) (last To)) (move Hop (between if:(or (\"IsFriendAt\" (between)) (is Empty (between)))) (to if:(is Empty (to)))))))) (end { (if (and (is Even (count Moves)) (\"HandEmpty\" Mover)) (result Mover Win)) (if (no Moves Next) (result Mover Loss))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\n4x13 board. Thirteen pieces per player, arranged on the outer rows of the board. Played with six sticks which function as dice. Pieces move according to the throws of the dice. Play progresses from left to right in the player's home row, and then from right to left in the second row, left to right in the third row, and then right to left in the opponent's row. A throw of 1 is required for each piece to being moving it. When a player's piece lands on a space occupied by a piece belonging to the opponent, the opponent's piece is captured. The player who captures all of the opponent's pieces wins. \n\n###\n\n", "completion": "(define \"AllPieceInOpponentHome\" (and (= (count Sites in:(difference (sites Occupied by:P1) (sites P2))) 0) (= (count Sites in:(difference (sites Occupied by:P2) (sites P1))) 0))) (define \"CaptureEnemyPiece\" (apply if:(\"IsEnemyAt\" (to)) (remove (to)))) (define \"InactivePiece\" (= (state at:(from)) 1)) (define \"ActivatedPiece\" (= (state at:(from)) 0)) (define \"ActivatePiece\" (if (= (state at:(last To)) 1) (set State at:(last To) 0))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" (count Pips))) (game \"Sig (Tozeur)\" (players 2) (equipment { (board (rectangle 4 13) { (track \"Track1\" \"0,E,N1,W,N1,E,N1,W\" P1 directed:True) (track \"Track2\" \"51,W,S1,E,S1,W,S1,E\" P2 directed:True)} use:Vertex) (piece \"Stick\" Each (if (or (\"ActivatedPiece\") (and (= (count Pips) 1) (\"InactivePiece\"))) (if (\"IsNotOffBoard\" \"SiteToMoveOnTrack\") (if (or (is In \"SiteToMoveOnTrack\" (sites Empty)) (\"IsEnemyAt\" \"SiteToMoveOnTrack\")) (move (from) (to \"SiteToMoveOnTrack\" \"CaptureEnemyPiece\"))) (then (\"ActivatePiece\"))))) (regions \"AllSites\" (sites Board)) (\"StickDice\" 6) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start { (place \"Stick1\" (sites Bottom) state:1) (place \"Stick2\" (sites Top) state:1)}) (play (\"RollMove\" (forEach Piece))) (end { (\"CaptureAll\" Next) (if (\"AllPieceInOpponentHome\") (result Mover Draw))}))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"StoreStateRemoved\" (set Value Mover (state at:(last To)))) (define \"LastStateRemove\" (value Player Mover)) (game \"Greater Loss\" (players 2) (equipment { (board (square 4)) (piece \"Disc\" Each)}) (rules (start { (place \"Disc1\" {\"A1\"} state:1) (place \"Disc1\" {\"B1\"} state:2) (place \"Disc1\" {\"C1\"} state:3) (place \"Disc1\" {\"D1\"} state:4) (place \"Disc1\" {\"A2\"} state:5) (place \"Disc1\" {\"B2\"} state:6) (place \"Disc1\" {\"C2\"} state:7) (place \"Disc1\" {\"D2\"} state:8) (place \"Disc2\" {\"A3\"} state:5) (place \"Disc2\" {\"B3\"} state:6) (place \"Disc2\" {\"C3\"} state:7) (place \"Disc2\" {\"D3\"} state:8) (place \"Disc2\" {\"A4\"} state:1) (place \"Disc2\" {\"B4\"} state:2) (place \"Disc2\" {\"C4\"} state:3) (place \"Disc2\" {\"D4\"} state:4)}) (play (move Select (from (forEach (sites Occupied by:Mover) if:(> (state at:(site)) (\"LastStateRemove\")))) (then (and (\"StoreStateRemoved\") (remove (last To)))))) (end (if (= 0 (count Sites in:(forEach (sites Occupied by:Mover) if:(= 8 (state at:(site)))))) (result Mover Loss)))))\n\n###\n\n", "completion": "Players take turns removing a piece of their colour whose number is higher than the last piece they removed (free choice of first piece). The player who removes their highest numbered piece loses. END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nBoard & size: Hexhex with edges alternating 2 and 4 -> Board & size: Hexhex with edges alternating 6 and 8\nMust place next to 1-2 friendly pieces, -> Must place next to exactly one friendly piece,\nbut not next to enemy pieces. -> but not next to pieces that already have more than 1 neighbor.\n(define \"ScoreUpdate\" (if (> (* 2 (size Group at:(last To))) (score Mover)) (if (> (* 2 (size Group at:(last To))) (score Next)) (set Score Mover (+ 1 (* 2 (size Group at:(last To))))) (set Score Mover (* 2 (size Group at:(last To))))))) (define \"SitesTooDense\" (forEach (sites Occupied by:Mover) if:(<= 6 (count Pieces Mover in:(sites Around (site)))))) (game \"RootZone\" (players 2) (equipment { (board (tri {2 4 2 4 2}) use:Vertex) (piece \"Disc\" Each) (piece \"Disc\" Neutral)}) (rules (play (if (= -1 (counter)) (or (move Pass) (move Add (piece \"Disc0\") (to (sites Board)))) (or { (if (= 1 (counter)) (move Select (from (sites Occupied by:Enemy)) (then (remove (last To) (then (add (to (last To)))))))) (move Pass) (move Add (to (difference (union (sites Outer) (sites Around (sites Occupied by:Mover))) (union { (sites Around (sites Occupied by:Enemy)) (sites Around \"SitesTooDense\") (sites Around (sites Occupied by:Neutral))})) if:(and (is Empty (to)) (>= 2 (count Pieces Mover in:(sites Around (to)))))) (then \"ScoreUpdate\"))}))) (end (if (all Passed) (byScore)))))\n\n###\n\n", "completion": "(define \"ScoreUpdate\" (if (> (* 2 (size Group at:(last To))) (score Mover)) (if (> (* 2 (size Group at:(last To))) (score Next)) (set Score Mover (+ 1 (* 2 (size Group at:(last To))))) (set Score Mover (* 2 (size Group at:(last To))))))) (define \"SitesTooDense\" (forEach (sites Occupied by:Mover) if:(<= 2 (count Pieces Mover in:(sites Around (site)))))) (game \"RootZone\" (players 2) (equipment { (board (tri {6 8 6 10 5}) use:Vertex) (piece \"Disc\" Each) (piece \"Disc\" Neutral)}) (rules (play (if (= -1 (counter)) (or (move Pass) (move Add (piece \"Disc0\") (to (sites Board)))) (or { (if (= 1 (counter)) (move Select (from (sites Occupied by:Enemy)) (then (remove (last To) (then (add (to (last To)))))))) (move Pass) (move Add (to (difference (union (sites Outer) (sites Around (sites Occupied by:Mover))) (union { (sites Around (sites Occupied by:Enemy)) (sites Around \"SitesTooDense\") (sites Around (sites Occupied by:Neutral))})) if:(and (is Empty (to)) (>= 1 (count Pieces Mover in:(sites Around (to)))))) (then \"ScoreUpdate\"))}))) (end (if (all Passed) (byScore))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayed on an 8x8 board with a double contingent of chess pawns. Pieces move forward one orthogonally or diagonally. Pieces can capture by moving diagonally. The first player to reach the opponent's edge of the board wins. A player also can win if they capture all of the opponent's pieces. The board is tiling by square. The game is played on a 8x8 board.\n\n###\n\n", "completion": "(game \"Breakthrough\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (piece \"Pawn\" Each (or { \"StepForwardToEmpty\" (move Step (directions {FR FL}) (to if:(or (is Empty (to)) (\"IsEnemyAt\" (to))) (apply (remove (to)))))})) (regions P1 (sites Top)) (regions P2 (sites Bottom))}) (rules (start { (place \"Pawn1\" (expand (sites Bottom))) (place \"Pawn2\" (expand (sites Top)))}) (play (forEach Piece)) (end (\"ReachWin\" (sites Mover) Mover)))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game has 3 players. -> The game has 4 players.\n(define \"MadeACompleteCircuit\" (if (= 1 (value Player Mover)) (is In (value Piece at:(where \"Marker\" Mover)) (sites Track \"TrackCW\" from:(\"NextSite\" (last From) \"TrackCW\") to:(last To))) (is In (value Piece at:(where \"Marker\" Mover)) (sites Track \"TrackCCW\" from:(\"NextSite\" (last From) \"TrackCCW\") to:(last To))))) (define \"MoveOn\" (if (\"IsNotOffBoard\" #1) (if (or (is In #1 (sites Empty)) (\"IsEnemyAt\" #1)) (move (from (from) level:(level)) (to #1 (\"HittingCapture\" (value Piece at:(to)))))) #2)) (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 \"NextSite\" (\"NextSiteOnTrack\" 1 from:#1 #2)) (define \"SiteToMoveOnSelectedTrack\" (if (= (value Player Mover) 2) (\"NextSiteOnTrack\" (\"ThrowValue\") \"TrackCCW\") (\"NextSiteOnTrack\" (\"ThrowValue\") \"TrackCW\"))) (define \"ThrowValue\" (mapEntry \"ThrowDiceValue\" (count Pips))) (game \"Patol\" (players 3) (equipment { (\"FortyStonesWithFourGapsBoard\" { (track \"TrackCW\" {39 35 33 31 29 27 25 23 21 19 38 17 15 13 11 9 7 5 3 1 37 0 2 4 6 8 10 12 14 16 36 18 20 22 24 26 28 30 32 34} loop:True) (track \"TrackCCW\" {39 34 32 30 28 26 24 22 20 18 36 16 14 12 10 8 6 4 2 0 37 1 3 5 7 9 11 13 15 17 38 19 21 23 25 27 29 31 33 35} loop:True)}) (regions \"Gates\" (sites {36..39})) (piece \"Marker\" Each (if (\"IsOffBoard\" (value Player Mover)) (or (\"MoveOn\" (\"SiteToMoveOnTrackCW\") (\"RememberSelectedTrack\" (\"SelectCW\"))) (\"MoveOn\" (\"SiteToMoveOnTrackCCW\") (\"RememberSelectedTrack\" (\"SelectCCW\")))) (\"MoveOn\" \"SiteToMoveOnSelectedTrack\"))) (\"StickDice\" 3) (map \"ThrowDiceValue\" {(pair 0 5) (pair 1 3) (pair 2 2) (pair 3 10)}) (hand Each)}) (rules (start (place \"Marker\" \"Hand\")) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (sites \"Gates\")) (then (set Value at:(last To) (last To))))) (nextPhase Mover \"Playing\")) (phase \"Playing\" (play (\"RollMove\" (forEach Piece))) (end (if (\"MadeACompleteCircuit\") (result Mover Win))))}))\n\n###\n\n", "completion": "(define \"MadeACompleteCircuit\" (if (= 1 (value Player Mover)) (is In (value Piece at:(where \"Marker\" Mover)) (sites Track \"TrackCW\" from:(\"NextSite\" (last From) \"TrackCW\") to:(last To))) (is In (value Piece at:(where \"Marker\" Mover)) (sites Track \"TrackCCW\" from:(\"NextSite\" (last From) \"TrackCCW\") to:(last To))))) (define \"MoveOn\" (if (\"IsNotOffBoard\" #1) (if (or (is In #1 (sites Empty)) (\"IsEnemyAt\" #1)) (move (from (from) level:(level)) (to #1 (\"HittingCapture\" (value Piece at:(to)))))) #2)) (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 \"NextSite\" (\"NextSiteOnTrack\" 1 from:#1 #2)) (define \"SiteToMoveOnSelectedTrack\" (if (= (value Player Mover) 2) (\"NextSiteOnTrack\" (\"ThrowValue\") \"TrackCCW\") (\"NextSiteOnTrack\" (\"ThrowValue\") \"TrackCW\"))) (define \"ThrowValue\" (mapEntry \"ThrowDiceValue\" (count Pips))) (game \"Patol\" (players 4) (equipment { (\"FortyStonesWithFourGapsBoard\" { (track \"TrackCW\" {39 35 33 31 29 27 25 23 21 19 38 17 15 13 11 9 7 5 3 1 37 0 2 4 6 8 10 12 14 16 36 18 20 22 24 26 28 30 32 34} loop:True) (track \"TrackCCW\" {39 34 32 30 28 26 24 22 20 18 36 16 14 12 10 8 6 4 2 0 37 1 3 5 7 9 11 13 15 17 38 19 21 23 25 27 29 31 33 35} loop:True)}) (regions \"Gates\" (sites {36..39})) (piece \"Marker\" Each (if (\"IsOffBoard\" (value Player Mover)) (or (\"MoveOn\" (\"SiteToMoveOnTrackCW\") (\"RememberSelectedTrack\" (\"SelectCW\"))) (\"MoveOn\" (\"SiteToMoveOnTrackCCW\") (\"RememberSelectedTrack\" (\"SelectCCW\")))) (\"MoveOn\" \"SiteToMoveOnSelectedTrack\"))) (\"StickDice\" 3) (map \"ThrowDiceValue\" {(pair 0 5) (pair 1 3) (pair 2 2) (pair 3 10)}) (hand Each)}) (rules (start (place \"Marker\" \"Hand\")) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (sites \"Gates\")) (then (set Value at:(last To) (last To))))) (nextPhase Mover \"Playing\")) (phase \"Playing\" (play (\"RollMove\" (forEach Piece))) (end (if (\"MadeACompleteCircuit\") (result Mover Win))))})) END" }, { "prompt": "Construct a Ludii game based on the following description\nGoal: Player with the largest, most complex 'warren' wins.\n \n A warren is the entire networks of friendly stones, that separate areas of the board (enclosures) from each other and from external areas in contact with the board edges.\n \n -- Each distinct enclosure may contain any mixture of empty and enemy occupied sites. \n -- The sites of an enclosure cannot reach any additional site or reach an edge of the board, except by crossing friendly stones or the connections between them.\n \n The score is the product of warren complexity and free-space. The actual calculation depends on the board grid: see 'Options', below.\n \n Play:\n The player of the light stones starts by moving a single stone. \n Thereafter play alternates with each play performing two stone-moves on his turn.\n \n Each stone move is in one of the 6 grid directions, either\n -- to an empty cell surrounded by more friendly stones than before, or\n -- alternatively, to an empty cell surrounded by the same number of friendly stones, but fewer other neighbors.\n \n The moving stone may travel any distance, and pass over any number of stones of either player when moving.\n \n A player may pass part or all of his turn.\n \n When both players successively pass their entire turns, the game ends and is scored. \n The player with the higher score wins.\n \n If the scores are the same, the last player to move, loses. Rabbit Warrens (hex 6,8). Scoring: Product of the number of distinct enclosures, times the total number of empty sites within the enclosures.\n\n###\n\n", "completion": "(define \"ColourBackground\" (colour 245 245 245)) (define \"RabbitMove\" (forEach Piece (do (set Var \"SitesMoverAroundFrom\" (count Sites in:(sites Around (from) Orthogonal if:(is Mover (who at:(to)))))) next:(move Hop Adjacent (between (range 0 Infinity) if:True) (to (sites Empty) if:(is Empty (to)))) ifAfterwards:(or (< (var \"SitesMoverAroundFrom\") (count Sites in:(sites Around (last To) Orthogonal if:(is Mover (who at:(to)))))) (and (= (var \"SitesMoverAroundFrom\") (count Sites in:(sites Around (last To) Orthogonal if:(is Mover (who at:(to)))))) (> (count Sites in:(sites Around (last From) Orthogonal if:(is Next (who at:(to))))) (count Sites in:(sites Around (last To) Orthogonal if:(is Next (who at:(to)))))))) (then (and { (\"GetTerritorySitesAndScore\" Mover) (\"GetTerritorySitesAndScore\" Next) (if (is Prev Next) (moveAgain))}))))) (define \"GetTerritorySitesAndScore\" (and { (set Value at:(handSite #1 0) (\"TC\" #1)) (set Value at:(handSite #1 1) (\"RCHX\" #1)) (set Score #1 (* (\"TC\" #1) (\"RCHX\" #1)))})) (define \"RCHX\" (size Array (array (forEach (difference (sites Inner) (sites Occupied by:#1)) if:(and (\"Included\" #1) (= Infinity (count Steps (step Orthogonal (to if:(not (= (id #1) (who at:(to)))))) (site) (sites (results from:(site) to:(forEach (sites Inner) if:(< (from) (site))) (to)))))))))) (define \"RCSQ\" (+ (results from:(forEach (difference (sites Inner) (sites Occupied by:(player (id #1)))) if:(and (\"Included\" #1) (\"IsLowestReachableSite\" #1))) to:(from) (+ 1 (max (- (max (\"Coordinates\" #1 (column of:(to)))) (min (\"Coordinates\" #1 (column of:(to))))) (- (max (\"Coordinates\" #1 (row of:(to)))) (min (\"Coordinates\" #1 (row of:(to)))))))))) (define \"IsLowestReachableSite\" (= Infinity (count Steps (step Orthogonal (to if:(not (= (id #1) (who at:(to)))))) (site) (sites (results from:(site) to:(forEach (sites Board) if:(< (from) (site))) (to)))))) (define \"Coordinates\" (results from:(to) to:(forEach (sites Board) if:(\"IsSiteInSameTerritory\" #1)) #2)) (define \"IsSiteInSameTerritory\" (!= Infinity (count Steps (step Orthogonal (to if:(not (= (id #1) (who at:(to)))))) (from) (site)))) (define \"TC\" (size Array (array (forEach (difference (sites Inner) (sites Occupied by:#1)) if:(and (\"Included\" #1) (is Empty (site))))))) (define \"RawTerritoryOf\" (forEach (difference (sites Inner) (sites Occupied by:(player (id #1)))) if:(\"Included\" #1))) (define \"Included\" (= Infinity (count Steps (step Orthogonal (to if:(not (= (id #1) (who at:(to)))))) (site) (difference (sites Outer) (sites Inner))))) (game \"Rabbit Warrens\" (players 2) (equipment { (board (hex Hexagon 6 8) use:Cell) (hand P1 size:2) (hand P2 size:2) (piece \"Ball\" Each) (piece \"Hex\" Each) (piece \"Hex\" Neutral)}) (rules (start { (place \"Ball1\" {2 6 9 13 17 21 25 29 33 37 38 42 46 53 57 61 64 68 72 77 81 85 89 93 97 101 108 112 113 117 121 125}) (place \"Ball2\" {1 5 11 15 18 22 26 27 31 35 41 45 49 51 55 59 65 69 73 75 79 83 88 92 99 103 105 109 115 119 120 124}) (place \"Hex1\" (handSite P1 0) value:0) (place \"Hex2\" (handSite P2 0) value:0) (place \"Hex0\" (handSite P1 1) value:0) (place \"Hex0\" (handSite P2 1) value:0)}) (play (or (move Pass) \"RabbitMove\")) (end { (if (and (= (score P1) (score P2)) (all Passed)) (byScore {(score Mover 0)})) (if (all Passed) (byScore))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\n4x8 board. Play begins with two counters in each hole. Opening moves: Players place all of the counters in the outer row into their rightmost hole. They then take one counter from each of the holes in the inner row and redistribute them into the outer row, one in each hole. Then, each player sows counters in an anti-clockwise direction beginning from the rightmost hole in the inner row, proceeding, picking up the contents of holes when the last counter falls into an occupied hole and continuing sowing. However, the final counter that would fall into the rightmost hole in the outer row (which should now contain 17 counters) is not placed there, but rather on the second to right hole in the inner row, which should now contain one counter. Initial phase: In the initial phase, the rightmost hole in the inner and outer row for each player are out of play. All sowing and capturing only occurs on the remaining holes. Sowing occurs in an anti-clockwise direction. When the final counter of a sowing lands in an empty hole, the turn ends. When it falls into an occupied hole in the player's inner row the contents of the opponent's opposite holes in the inner and outer row are captured. These are then sown in the player's holes beginning with the hole from where the previous sowing began. If the final counter of a sowing falls into an occupied hole that cannot make a capture, then the counters in this hole are picked up and sowing continues. Second phase: The initial phase ends when a player plays from the rightmost hole in the outer row. This can be by necessity or by choice. Once this happens, that player must play in all of their holes. The opponent may remain in the initial phase after this point until they play from their rightmost hole. The same sowing and capturing rules as before. Play continues until one player can no longer move. \n\n###\n\n", "completion": "(define \"InnerToOuter\" (if (is Mover P1) (- #1 (\"Columns\")) (+ #1 (\"Columns\")))) (define \"Columns\" 8) (game \"Isolo\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"TrackCCW1\" \"0,E,N1,W\" loop:True P1) (track \"TrackCCW2\" \"16,E,N1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"TrackCCW1\")) (regions \"Home\" P2 (sites Track \"TrackCCW2\")) (regions \"Inner\" P1 (difference (sites Track \"TrackCCW1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"TrackCCW2\") (sites Top))) (regions \"Outer\" P1 (sites Bottom)) (regions \"Outer\" P2 (sites Top)) (piece \"Seed\" Shared) (hand Each) (map \"RightmostOuter\" {(pair P1 7) (pair P2 24)}) (map \"RightmostInner\" {(pair P1 15) (pair P2 16)}) (map \"SecondRightmostInner\" {(pair P1 14) (pair P2 17)})}) (rules (start (set Count 2 to:(union (sites P1 \"Home\") (sites P2 \"Home\")))) phases:{ (phase \"Opening1\" (play (forEach Site (difference (sites Mover \"Outer\") (mapEntry \"RightmostOuter\" Mover)) (if (is Occupied (site)) (move (from (site)) (to (mapEntry \"RightmostOuter\" Mover)) count:(count at:(site)))))) (nextPhase Mover (all Sites (difference (sites Mover \"Outer\") (mapEntry \"RightmostOuter\" Mover)) if:(is Empty (site))) \"Opening2\")) (phase \"Opening2\" (play (forEach Site (sites Mover \"Inner\") (if (= 2 (count at:(site))) (move (from (site)) (to (\"InnerToOuter\" (site))) count:1)))) (nextPhase Mover (all Sites (sites Mover \"Inner\") if:(= (count at:(site)) 1)) \"Opening3\")) (phase \"Opening3\" (play (move Select (from (if (\"SameTurn\") (\"LastHoleSowed\") (sites {(mapEntry \"RightmostInner\" Mover)}))) (then (sow \"TrackCCW\" owner:(mover) apply:(if (!= (to) (mapEntry \"RightmostOuter\" Mover)) (moveAgain) (fromTo (from (to)) (to (mapEntry \"SecondRightmostInner\" Mover)) count:1)))))) (nextPhase Mover (not (is Next Mover)) \"InitialSowing\")) (phase \"InitialSowing\" (play (move Select (from (if (\"SameTurn\") (\"LastHoleSowed\") (sites Mover \"Home\")) if:(is Occupied (from))) (then (sow \"TrackCCW\" owner:(mover) apply:(if (< 1 (count at:(to))) (if (is In (to) (sites Mover \"Inner\")) (if (or (is Occupied (\"OppositePit\" (to))) (is Occupied (\"OppositeOuterPit\" (to)))) (and { (if (is Occupied (\"OppositePit\" (to))) (fromTo (from (\"OppositePit\" (to))) (to (last From)) count:(count at:(\"OppositePit\" (to))))) (if (is Occupied (\"OppositeOuterPit\" (to))) (fromTo (from (\"OppositeOuterPit\" (to))) (to (last From)) count:(count at:(\"OppositeOuterPit\" (to))))) (sow (last From) count:(+ (count at:(\"OppositeOuterPit\" (to))) (count at:(\"OppositePit\" (to)))) \"TrackCCW\" owner:(mover) skipIf:(is In (to) (sites {(mapEntry \"RightmostOuter\" Mover) (mapEntry \"RightmostInner\" Mover)})))}) (moveAgain)) (moveAgain))) skipIf:(is In (to) (sites {(mapEntry \"RightmostOuter\" Mover) (mapEntry \"RightmostInner\" Mover)})))))) (nextPhase Mover (is In (last From) (sites {(mapEntry \"RightmostOuter\" Mover) (mapEntry \"RightmostInner\" Mover)})) \"InitialSowing\")) (phase \"Sowing\" (play (move Select (from (sites Mover \"Home\") if:(is Occupied (from))) (then (sow \"TrackCCW\" owner:(mover) apply:(if (< 1 (count at:(to))) (if (is In (to) (sites Mover \"Inner\")) (if (or (is Occupied (\"OppositePit\" (to))) (is Occupied (\"OppositeOuterPit\" (to)))) (and { (if (is Occupied (\"OppositePit\" (to))) (fromTo (from (\"OppositePit\" (to))) (to (last From)) count:(count at:(\"OppositePit\" (to))))) (if (is Occupied (\"OppositeOuterPit\" (to))) (fromTo (from (\"OppositeOuterPit\" (to))) (to (last From)) count:(count at:(\"OppositeOuterPit\" (to))))) (sow (last From) count:(+ (count at:(\"OppositeOuterPit\" (to))) (count at:(\"OppositePit\" (to)))) \"TrackCCW\" owner:(mover))}) (moveAgain)) (moveAgain))))))))} (end (\"ForEachPlayerNoMovesLoss\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayed on a square grid. The board begins empty. One player plays as Black, the other as White. Players alternate turns placing a piece of their colour on the board; Black plays first. Passing is not allowed. After a move, all opposing pieces without liberties are captured (a stone or group of stones has no liberties if all adjacent points to that stone are occupied). Stones cannot be placed to recreate a previous position. The game ends when one player captures a number of stones equal to a winning threshold agreed upon at the start of the game. Despite not having an explicit territorial goal, this variant produces final positions quite reminiscent of standard Go. The game is played on a 9x9 board 5 captures to win.\n\n###\n\n", "completion": "(define \"RemoveSurrounded\" (forEach Site (sites Occupied by:Next) (if (= (count Liberties at:(site) Orthogonal) 0) (move Remove (site) (then (addScore Mover 1)))))) (game \"BlooGo\" (players 2) (equipment { (board (square 9) use:Vertex) (piece \"Ball\" Each)}) (rules (meta (no Repeat)) (play (move Add (to (sites Empty)) (then \"RemoveSurrounded\"))) (end { (if (>= (score Mover) 5) (result Mover Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe game starts with a tile of each color touching one another. Players take turns placing tiles which must touch at least two other tiles. A player wins by either completely surrounding one or more of the opponent's tiles, or by creating a straight line of five tiles. The game uses hexagonal tiles.\n\n###\n\n", "completion": "(define \"NumTiles\" 24) (game \"Andantino\" (players 2) (equipment { (boardless Hexagonal) (tile \"Hex\" Each numSides:6)}) (rules (start { (place \"Hex1\" (centrePoint)) (place \"Hex2\" (ahead (centrePoint) E))}) (play (move Add (to (sites Playable) if:(<= 2 (count Sites in:(sites Around (to) NotEmpty)))))) (end { (if (or (is Loop surround:Next) (is Line 5)) (result Mover Win)) (if (= (count Moves) (* (count Players) \"NumTiles\")) (result Mover Draw))}))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game is played on a 6x6 board -> The game is played on a 7x7 board\n(game \"Cross\" (players 2) (equipment { (board (hex 6)) (piece \"Marker\" Each)}) (rules (play (move Add (to (sites Empty)))) (end { (if (is Connected {(sites Side S) (sites Side NW) (sites Side NE)}) (result Mover Win)) (if (is Connected {(sites Side N) (sites Side SW) (sites Side SE)}) (result Mover Win)) (if (is Connected {(sites Side N) (sites Side S)}) (result Mover Loss)) (if (is Connected {(sites Side NW) (sites Side SE)}) (result Mover Loss)) (if (is Connected {(sites Side NE) (sites Side SW)}) (result Mover Loss))})))\n\n###\n\n", "completion": "(game \"Cross\" (players 2) (equipment { (board (hex 7)) (piece \"Marker\" Each)}) (rules (play (move Add (to (sites Empty)))) (end { (if (is Connected {(sites Side S) (sites Side NW) (sites Side NE)}) (result Mover Win)) (if (is Connected {(sites Side N) (sites Side SW) (sites Side SE)}) (result Mover Win)) (if (is Connected {(sites Side N) (sites Side S)}) (result Mover Loss)) (if (is Connected {(sites Side NW) (sites Side SE)}) (result Mover Loss)) (if (is Connected {(sites Side NE) (sites Side SW)}) (result Mover Loss))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x8 board. Four counters in each hole. Play begins with both players placing all of the counters in the rightmost three holes in their row into the rightmost hole. Counters are sown in an anti-clockwise fashion, but they can be sown clockwise only if it leads to a capture. Counters are captured when the final counter is sown into a hole opposite a hole containing one or three counters, and those are take. If the hole opposite the next hole also contains one or three, these are also taken, continuing until a hole with any other number of counters is reached. Instead of taking counters from one of their holes, a player may sow any or all of the counters they have captured, beginning from the leftmost hole. The same rules for sowing apply. The game ends when one player has no counters in their holes. \n\n###\n\n", "completion": "(define \"NoPiecesInPlayerSide\" (all Sites (sites #1) if:(= 0 (count at:(site))))) (define \"NextHoleFrom\" (\"NextSiteOnTrack\" #3 from:#1 #2)) (define \"Columns\" 8) (game \"Iyogh\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" store:None { (track \"TrackCCW\" \"0,E,N,W\" loop:True) (track \"TrackCW\" \"7,W,N,E\" loop:True)}) (piece \"Seed\" Shared) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (hand Each) (map \"LeftMost\" {(pair P1 0) (pair P2 15)}) (map \"RightMost\" {(pair P1 7) (pair P2 8)}) (regions \"RightMost\" P1 (sites {5 6})) (regions \"RightMost\" P2 (sites {9 10}))}) (rules (start (set Count 4 to:(sites Track))) phases:{ (phase \"Opening\" (play (move (from (sites Mover \"RightMost\") if:(is Occupied (from))) (to (mapEntry \"RightMost\" Mover)) count:(count at:(from)))) (nextPhase Mover (all Sites (sites Mover \"RightMost\") if:(is Empty (site))) \"Sowing\")) (phase \"Sowing\" (play (or { (if (is Occupied Cell (handSite Mover)) (forEach Value min:1 max:(count Cell at:(handSite Mover)) (do (set Var \"NumToSow\" (value)) next:(move (from Cell (handSite Mover)) (to (mapEntry \"LeftMost\" Mover)) count:(value) (then (and (sow count:(var \"NumToSow\") \"TrackCCW\" if:(or (= 1 (count at:(\"OppositePitTwoRows\" (to)))) (= 3 (count at:(\"OppositePitTwoRows\" (to))))) apply:(if (or (= 1 (count at:(\"OppositePitTwoRows\" (to)))) (= 3 (count at:(\"OppositePitTwoRows\" (to))))) (fromTo (from (\"OppositePitTwoRows\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePitTwoRows\" (to))))) forward:True) (set Var \"NumToSow\" 0))))))) (if (is Occupied Cell (handSite Mover)) (forEach Value min:1 max:(count Cell at:(handSite Mover)) (do (set Var \"NumToSow\" (value)) next:(move (from Cell (handSite Mover) if:(or (= 1 (count at:(\"OppositePitTwoRows\" (\"NextHoleFrom\" (mapEntry \"LeftMost\" Mover) \"TrackCW\" (value))))) (= 3 (count at:(\"OppositePitTwoRows\" (\"NextHoleFrom\" (mapEntry \"LeftMost\" Mover) \"TrackCW\" (value))))))) (to (mapEntry \"LeftMost\" Mover)) count:(value) (then (and (sow count:(var \"NumToSow\") \"TrackCW\" if:(or (= 1 (count at:(\"OppositePitTwoRows\" (to)))) (= 3 (count at:(\"OppositePitTwoRows\" (to))))) apply:(if (or (= 1 (count at:(\"OppositePitTwoRows\" (to)))) (= 3 (count at:(\"OppositePitTwoRows\" (to))))) (fromTo (from (\"OppositePitTwoRows\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePitTwoRows\" (to))))) forward:True) (set Var \"NumToSow\" 0))))))) (move Select (from (sites Mover) if:(< 0 (count at:(from)))) (then (sow \"TrackCCW\" if:(or (= 1 (count at:(\"OppositePitTwoRows\" (to)))) (= 3 (count at:(\"OppositePitTwoRows\" (to))))) apply:(if (or (= 1 (count at:(\"OppositePitTwoRows\" (to)))) (= 3 (count at:(\"OppositePitTwoRows\" (to))))) (fromTo (from (\"OppositePitTwoRows\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePitTwoRows\" (to))))) forward:True))) (move Select (from (sites Mover) if:(and (< 0 (count at:(from))) (or (= 1 (count at:(\"OppositePitTwoRows\" (\"NextHoleFrom\" (from) \"TrackCW\" (count at:(from)))))) (= 3 (count at:(\"OppositePitTwoRows\" (\"NextHoleFrom\" (from) \"TrackCW\" (count at:(from))))))))) (then (sow \"TrackCW\" if:(or (= 1 (count at:(\"OppositePitTwoRows\" (to)))) (= 3 (count at:(\"OppositePitTwoRows\" (to))))) apply:(if (or (= 1 (count at:(\"OppositePitTwoRows\" (to)))) (= 3 (count at:(\"OppositePitTwoRows\" (to))))) (fromTo (from (\"OppositePitTwoRows\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePitTwoRows\" (to))))) forward:True)))})))} (end (forEach Player if:(\"NoPiecesInPlayerSide\" Player) (result Player Loss))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"OpponentHas\" (> (min (count Sites in:(if (< 0 (count Sites in:(intersection (sites Occupied by:Mover) (sites Direction from:(to) #1 stop:(= (mover) (who at:(to))) stopIncluded:True)))) (sites Direction from:(to) #1 stop:(= (mover) (who at:(to)))) (sites Board))) (count Sites in:(if (< 0 (count Sites in:(intersection (sites Occupied by:Mover) (sites Direction from:(to) #2 stop:(= (mover) (who at:(to))) stopIncluded:True)))) (sites Direction from:(to) #2 stop:(= (mover) (who at:(to)))) (sites Board)))) (min (count Sites in:(if (< 0 (count Sites in:(intersection (sites Occupied by:Next) (sites Direction from:(to) #1 stop:(= (next) (who at:(to))) stopIncluded:True)))) (sites Direction from:(to) #1 stop:(= (next) (who at:(to)))) (sites Board))) (count Sites in:(if (< 0 (count Sites in:(intersection (sites Occupied by:Next) (sites Direction from:(to) #2 stop:(= (next) (who at:(to))) stopIncluded:True)))) (sites Direction from:(to) #2 stop:(= (next) (who at:(to)))) (sites Board)))))) (define \"Placeable\" (not (or { (and (\"OpponentHas\" E W) (\"OpponentHas\" NNW SSE)) (and (\"OpponentHas\" E W) (\"OpponentHas\" NNE SSW)) (and (\"OpponentHas\" NNW SSE) (\"OpponentHas\" NNE SSW))}))) (game \"Mity\" (players 2) (equipment { (board (hex 5)) (piece \"Disc\" Each)}) (rules (meta (swap)) (play (move Add (to (sites Empty) if:(\"Placeable\")))) (end (\"BlockWin\"))))\n\n###\n\n", "completion": "Players place one token of their color each turn and the first player unable to do so has lost. You may place on any empty cell unless your opponent has a token closer to that cell than you have along at least 2 of the 3 lines (axes) the cell is on. \n \n The game uses the pie rule: One player chooses the first move and the other player chooses whose move it is. A size 5 board is currently selected 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. When a piece does not capture the maximum number of captures and the opponent catches it, the opponent captures the opponent's piece. The first player to capture all of the opponent's pieces wins. \n\n###\n\n", "completion": "(define \"IsUnpromoted\" (\"IsPieceAt\" \"Counter\" Mover (last To))) (game \"Dama (Italy)\" (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 (\"BlockWin\")))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game starts with 15 geese. -> The game starts with 17 geese.\n(game \"Fox and Geese\" (players 2) (equipment { (\"CrossBoard\" 3 7 use:Vertex diagonals:Alternating) (hand P1) (piece \"Fox\" P1 (or (\"HopCapture\") \"StepToEmpty\")) (piece \"Goose\" P2 \"StepToEmpty\")}) (rules (start { (place \"Goose2\" (union {(expand (sites Bottom)) (sites Row 2) (sites {\"A4\" \"G4\"})})) (place \"Fox1\" (handSite P1))}) phases:{ (phase \"Placement\" P1 (play (move (from (handSite P1)) (to (sites Empty)))) (nextPhase (\"HandEmpty\" P1) \"Movement\")) (phase \"Movement\" (play (forEach Piece)))} (end (\"NoMovesLossAndNoPiecesPlayerLoss\" P2))))\n\n###\n\n", "completion": "(game \"Fox and Geese\" (players 2) (equipment { (\"CrossBoard\" 3 7 use:Vertex diagonals:Alternating) (hand P1) (piece \"Fox\" P1 (or (\"HopCapture\") \"StepToEmpty\")) (piece \"Goose\" P2 \"StepToEmpty\")}) (rules (start { (place \"Goose2\" (union {(expand (sites Bottom)) (sites Row 2) (sites {\"A4\" \"G4\" \"A5\" \"G5\"})})) (place \"Fox1\" (handSite P1))}) phases:{ (phase \"Placement\" P1 (play (move (from (handSite P1)) (to (sites Empty)))) (nextPhase (\"HandEmpty\" P1) \"Movement\")) (phase \"Movement\" (play (forEach Piece)))} (end (\"NoMovesLossAndNoPiecesPlayerLoss\" P2)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nFive rows of five holes. Each player has twelve sticks; one player's sticks are longer than the other player's. Players alternate turns placing one of their sticks in an empty hole on the board. A player may, on their turn, move a stick to an empty adjacent hole in an orthogonal direction instead of placing a stick. Players do not have to place all of their sticks before moving, but if they wish to place a stick after they have already moved, the opponent must also place a stick on their following turn. A player captures an opponent's stick by hopping over it in an orthogonal direction to an empty hole immediately on the opposite side of the opponent's stick. The player who captures all of the opponent's pieces wins. \n\n###\n\n", "completion": "(game \"Choko\" (players 2) (equipment { (board (square 5) use:Vertex) (piece \"Stick\" Each (or \"StepOrthogonalToEmpty\" \"HopOrthogonalCapture\")) (hand Each) (regions \"AllSites\" (sites Board))}) (rules (start (place \"Stick\" \"Hand\" count:12)) (play (if (is Pending) (move (from (handSite Mover)) (to (sites Empty))) (or (if (\"HandOccupied\" Mover) (move (from (handSite Mover)) (to (sites Empty)) (then (set Pending)))) (forEach Piece)))) (end (\"CaptureAll\" Next)))) 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": "Modify the Ludii game according to the following option changes:\nFairKalah board 2 -> FairKalah board 3\n(define \"PiecesOwnedBy\" (+ (count at:(mapEntry #1)) (count in:(sites #1)))) (define \"Columns\" 6) (game \"FairKalah\" (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 at:1) (set Count 4 at:2) (set Count 5 at:3) (set Count 4 at:4) (set Count 4 at:5) (set Count 4 at:6) (set Count 0 at:13) (set Count 4 at:12) (set Count 3 at:11) (set Count 4 at:10) (set Count 4 at:9) (set Count 4 at:8) (set Count 4 at:7) (set Count 0 at:0)}) (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\" (or (= (count in:(sites Bottom)) 0) (= (count in:(sites Top)) 0))))))\n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (+ (count at:(mapEntry #1)) (count in:(sites #1)))) (define \"Columns\" 6) (game \"FairKalah\" (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 at:1) (set Count 5 at:2) (set Count 4 at:3) (set Count 4 at:4) (set Count 4 at:5) (set Count 4 at:6) (set Count 0 at:13) (set Count 4 at:12) (set Count 4 at:11) (set Count 3 at:10) (set Count 4 at:9) (set Count 4 at:8) (set Count 4 at:7) (set Count 0 at:0)}) (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\" (or (= (count in:(sites Bottom)) 0) (= (count in:(sites Top)) 0)))))) 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\n4x22 board. 22 pieces per player, four kings and eighteen regular pieces. Kings have no difference in movement or power than regular pieces. Moves are determined by four two-sided sticks, black on one side and white on the other. The moves are determined by the number of white sides that land face up: 1= a move of 1. A throw of 1 is known as \\ \n\n###\n\n", "completion": "(define \"Move\" (if (and { (if (\"PieceActivated\" (from)) True (\"Tab\")) #1}) (if (is In (from) (sites Mover \"Home\")) (if (not (\"IsFriendAt\" (\"NextSiteOnTrack\" (\"ThrowValue\") \"Track\"))) (move (from) (to (\"NextSiteOnTrack\" (\"ThrowValue\") \"Track\") \"CaptureEnemyPiece\") (then (if (and (not (\"PieceActivated\" (last To))) (= 1 (\"ThrowValue\"))) (\"ActivatePiece\" (last To)))))) (if (not (\"IsFriendAt\" (\"NextSiteOnTrack\" (\"ThrowValue\") \"MiddleTrack\"))) (move (from) (to (\"NextSiteOnTrack\" (\"ThrowValue\") \"MiddleTrack\") \"CaptureEnemyPiece\")))))) (define \"CountOwnPiecesInHome\" (count Pieces Mover in:(sites Mover \"Home\"))) (define \"Tab\" (= 1 (\"ThrowValue\"))) (define \"PieceActivated\" (!= 0 (state at:#1))) (define \"ActivatePiece\" (set State at:#1 1)) (define \"CaptureEnemyPiece\" (apply if:(\"IsEnemyAt\" (to)) (remove (to)))) (define \"SpecialThrows\" (is In (\"ThrowValue\") (sites {1 4 6}))) (define \"ThrowValue\" (mapEntry \"Throw\" (count Pips))) (game \"Kioz\" (players 2) (equipment { (board (rectangle 4 22) { (track \"Track1\" \"0,E,N1,W,\" P1 directed:True) (track \"Track2\" \"87,W,S1,E\" P2 directed:True) (track \"MiddleTrack\" \"44,E,S1,W\" loop:True)}) (\"StickDice\" 4) (piece \"Marker\" Each) (piece \"King\" Each) (map \"Throw\" {(pair 0 4) (pair 1 1) (pair 2 2) (pair 3 2) (pair 4 6)}) (regions \"Home\" P1 (sites Bottom)) (regions \"Home\" P2 (sites Top))}) (rules (start { (place \"Marker1\" (intersection (sites Bottom) (expand (sites Left) steps:17))) (place \"King1\" (intersection (sites Bottom) (expand (sites Right) steps:3))) (place \"Marker2\" (intersection (sites Top) (expand (sites Right) steps:17))) (place \"King2\" (intersection (sites Top) (expand (sites Left) steps:3)))}) (play (\"RollMove\" (if (\"Tab\") (priority { (forEach Piece (\"Move\" (not (\"PieceActivated\" (from))))) (forEach Piece (\"Move\"))}) (forEach Piece (\"Move\"))) (then (if (\"SpecialThrows\") (moveAgain))))) (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game is played on a 3x3 board -> The game is played on a 5x5 board\n(define \"MoveIn\" (forEach Piece (move Select (from) (to (sites Around (from)) if:(\"EmptyWithEnemyIn\" #1 #2)) (then (and \"MoveThePiece\" (directional (from #3) #4 \"RemoveEnemyPiece\")))) (then (if (can Move (\"CaptureFromLast\" (last To))) (moveAgain))))) (define \"CaptureFromLast\" (or (\"MoveAgainIn\" #1 (to) SameDirection (last To) (\"LastDirection\" Vertex)) (\"MoveAgainIn\" #1 (from) OppositeDirection (last From) (directions Vertex from:(last To) to:(last From))))) (define \"MoveAgainIn\" (move Select (from #1) (to (sites Around #1) if:(\"EmptyButNotVisitedWithEnemyIn\" #2 #3)) (then (and { \"MoveThePiece\" (directional (from #4) #5 \"RemoveEnemyPiece\") (if (can Move (or (\"CaptureAgainIn\" #1 (to) SameDirection) (\"CaptureAgainIn\" #1 (from) OppositeDirection))) (moveAgain))})))) (define \"MoveThePiece\" (fromTo (from (last From)) (to (last To)))) (define \"RemoveEnemyPiece\" (to if:(\"IsEnemyAt\" (to)) (apply (remove (to))))) (define \"EmptyWithEnemyIn\" (and (is Empty (to)) (\"IsEnemyAt\" (ahead #1 #2)))) (define \"EmptyButNotVisitedWithEnemyIn\" (and { (not (is Visited (to))) (is Empty (to)) (\"IsEnemyAt\" (ahead #1 #2))})) (define \"CaptureAgainIn\" (move Select (from #1) (to (sites Around #1) if:(and { (not (is Visited (to))) (is Empty (to)) (\"IsEnemyAt\" (ahead #2 #3))})))) (game \"Fanorona\" (players 2) (equipment { (\"AlquerqueBoard\" 3 3) (piece \"Marker\" Each)}) (rules (start { (place \"Marker1\" (union { (union (sites Bottom) (sites {\"C2\"}))})) (place \"Marker2\" (union { (union (sites {\"A2\"}) (sites Top))}))}) (play (if \"SameTurn\" (or (if (is Occupied (last To)) (\"CaptureFromLast\" (last To)) (\"CaptureFromLast\" (last From))) (move Pass)) (priority { (or (\"MoveIn\" (to) SameDirection (last To) (\"LastDirection\" Vertex)) (\"MoveIn\" (from) OppositeDirection (last From) (directions Vertex from:(last To) to:(last From)))) (forEach Piece \"StepToEmpty\")}))) (end (if (no Pieces Mover) (result Next Win)))))\n\n###\n\n", "completion": "(define \"MoveIn\" (forEach Piece (move Select (from) (to (sites Around (from)) if:(\"EmptyWithEnemyIn\" #1 #2)) (then (and \"MoveThePiece\" (directional (from #3) #4 \"RemoveEnemyPiece\")))) (then (if (can Move (\"CaptureFromLast\" (last To))) (moveAgain))))) (define \"CaptureFromLast\" (or (\"MoveAgainIn\" #1 (to) SameDirection (last To) (\"LastDirection\" Vertex)) (\"MoveAgainIn\" #1 (from) OppositeDirection (last From) (directions Vertex from:(last To) to:(last From))))) (define \"MoveAgainIn\" (move Select (from #1) (to (sites Around #1) if:(\"EmptyButNotVisitedWithEnemyIn\" #2 #3)) (then (and { \"MoveThePiece\" (directional (from #4) #5 \"RemoveEnemyPiece\") (if (can Move (or (\"CaptureAgainIn\" #1 (to) SameDirection) (\"CaptureAgainIn\" #1 (from) OppositeDirection))) (moveAgain))})))) (define \"MoveThePiece\" (fromTo (from (last From)) (to (last To)))) (define \"RemoveEnemyPiece\" (to if:(\"IsEnemyAt\" (to)) (apply (remove (to))))) (define \"EmptyWithEnemyIn\" (and (is Empty (to)) (\"IsEnemyAt\" (ahead #1 #2)))) (define \"EmptyButNotVisitedWithEnemyIn\" (and { (not (is Visited (to))) (is Empty (to)) (\"IsEnemyAt\" (ahead #1 #2))})) (define \"CaptureAgainIn\" (move Select (from #1) (to (sites Around #1) if:(and { (not (is Visited (to))) (is Empty (to)) (\"IsEnemyAt\" (ahead #2 #3))})))) (game \"Fanorona\" (players 2) (equipment { (\"AlquerqueBoard\" 5 5) (piece \"Marker\" Each)}) (rules (start { (place \"Marker1\" (union { (union (expand (sites Bottom)) (sites {\"A3\" \"D3\"}))})) (place \"Marker2\" (union { (union (sites {\"B3\" \"E3\"}) (expand (sites Top)))}))}) (play (if \"SameTurn\" (or (if (is Occupied (last To)) (\"CaptureFromLast\" (last To)) (\"CaptureFromLast\" (last From))) (move Pass)) (priority { (or (\"MoveIn\" (to) SameDirection (last To) (\"LastDirection\" Vertex)) (\"MoveIn\" (from) OppositeDirection (last From) (directions Vertex from:(last To) to:(last From)))) (forEach Piece \"StepToEmpty\")}))) (end (if (no Pieces Mover) (result Next Win))))) 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). The first player making a full line of his color on any layer wins. Lines may be diagonal. This is, for a 4x4 set, a 4-in-a-row on the first layer, or a 3-in-a-row on the 2nd layer, or a 2-in-a-row on the 3rd layer. The game is played with two players. The game is played on a 4x4 board.\n\n###\n\n", "completion": "(game \"Spline\" (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))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nEach player has 6 Chess queens. It is played on a 5x5 board. The starting position has the queens arranged on opposite sides, alternating white-black-white-black in each space. The pieces move as queens in Chess. The first player to line up four queens in a row wins. \n\n###\n\n", "completion": "(game \"All Queens Chess\" (players 2) (equipment { (board (square 5)) (piece \"Queen\" Each (move Slide))}) (rules (start { (place \"Queen1\" (union { (difference (sites Bottom) (sites Phase 1)) (intersection (sites Left) (sites Row (/ (count Rows) 2))) (difference (sites Top) (sites Phase 0))})) (place \"Queen2\" (union { (difference (sites Bottom) (sites Phase 0)) (intersection (sites Right) (sites Row (/ (count Rows) 2))) (difference (sites Top) (sites Phase 1))}))}) (play (forEach Piece)) (end (if (is Line 4) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe game is played on a board with twelve points on either side. The points form a continuous track in a horseshoe shape; each player progresses in opposite directions (one from their bottom right to the top right, the other from their bottom left to their top left. Each player has 15 pieces. The starting position is as such, numbering the points from the origin of each player's track: Point six: five pieces. Point 8: three pieces. Point 13: five pieces. Point 24: two pieces. Play begins by each player rolling one die; the player who rolls the highest plays first, and then rolls again to begin play. Players move according to the number on each die by moving one piece the number on one die and another the number on the other die, or by moving one piece twice (once for each die). If doubles are rolled, the player must play the number on each die twice. Players cannot end their move on a point with multiple opposing pieces. If a player ends the turn on a point with one opposing piece, that piece is placed in the middle of the board (not on a point) and must reenter the board according the the next die roll, counting the origin point as a move of one. They cannot reenter on a point with two or more pieces. No other pieces can move until all of the pieces belonging to that player are removed from the center. When all of a player's pieces are on their final 6 points, they may start removing pieces from the board. They can do so by rolling a 6 to move from the 6th point, and so on down to 1. Players must use all available moves presented by the dice. The first player to remove all of their pieces wins. The winner gains one point, or two points if the opponent has pieces in their starting quadrant.\n \n\n###\n\n", "completion": "(define \"HaveAPieceAndCanEscape\" (and (\"IsFriendAt\" (site)) (< (trackSite Move from:(site) steps:(pips)) 0))) (define \"SetScoreOf\" (score #1 (if (is Mover #1) (if (= (\"NumPiece\" #2) 15) 2 1) 0))) (define \"NotEmptyAndNotOffTheBoard\" (and (is Occupied (site)) (\"IsNotOffBoard\" (\"NextSiteFrom\" (site))))) (define \"CanEscape\" (\"IsEndTrack\" (\"NextSiteFrom\" (site)))) (define \"NumPiece\" (size Stack in:(sites Occupied by:#1))) (define \"AllPieceEscaped\" (no Pieces Mover)) (define \"MoveAPieceIf\" (forEach Die replayDouble:True if:#1 (\"MoveAPiece\" #2))) (define \"MoveAPiece\" (move (from #1) (to (\"NextSiteFrom\" #1) if:(\"NoEnemyOrOnlyOne\" (to)) (\"HittingCapture\" (mapEntry Next))))) (define \"DieNotUsedAndNoEscapeAndNotOffTheTrack\" (and { (\"DieNotUsed\") (\"IsNotOffBoard\" (\"NextSiteFrom\" (from))) (\"IsNotEndTrack\" (\"NextSiteFrom\" (from)))})) (define \"RemoveAPiece\" (move Remove (site))) (define \"AllPieceInHome\" (\"AllOwnedPiecesIn\" (sites Mover))) (define \"Bar\" (mapEntry (mover))) (define \"NextSiteFrom\" (\"NextSiteOnTrack\" (pips) from:#1)) (define \"BarEmpty\" (is Empty \"Bar\")) (game \"Portes\" (players 2) (equipment { (\"BackgammonBoard\" (\"BackgammonTracksWithBar\" End)) (dice num:2) (regions P1 { 20..25}) (regions P2 { 7..12}) (map {(pair 1 6) (pair 2 19)}) (piece \"Disc\" Each (\"MoveAPieceIf\" \"DieNotUsedAndNoEscapeAndNotOffTheTrack\" (from)))}) (rules (start { (place Stack \"Disc1\" 0 count:5) (place Stack \"Disc1\" 12 count:2) (place Stack \"Disc1\" 17 count:3) (place Stack \"Disc1\" 20 count:5) (place Stack \"Disc2\" 4 count:3) (place Stack \"Disc2\" 7 count:5) (place Stack \"Disc2\" 13 count:5) (place Stack \"Disc2\" 25 count:2)}) (play (\"RollEachNewTurnMove\" (if \"AllPieceInHome\" (forEach Die replayDouble:True if:(\"DieNotUsed\") (forEach Site (sites Occupied by:Mover) (if (\"NotEmptyAndNotOffTheBoard\") (if (\"CanEscape\") (\"RemoveAPiece\") (\"MoveAPiece\" (site)))) noMoveYet:(firstMoveOnTrack \"Track\" Mover (if \"HaveAPieceAndCanEscape\" \"RemoveAPiece\")) (then (\"ReplayNotAllDiceUsed\")))) (max Distance \"Track\" Mover (if \"BarEmpty\" (forEach Piece top:True) (\"MoveAPieceIf\" (\"DieNotUsed\") (\"Bar\")) (then (if (not (all DiceUsed)) (if (can Move (if \"BarEmpty\" (forEach Piece top:True) (\"MoveAPieceIf\" (\"DieNotUsed\") (\"Bar\")))) (moveAgain))))))))) (end (if (\"AllPieceEscaped\") (byScore { (\"SetScoreOf\" P1 P2) (\"SetScoreOf\" P2 P1)}))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"Dodo\" (\"TwoPlayersNorthSouth\") (equipment { (board (rotate 30 (hex 4))) (piece \"Disc\" Each (\"StepToEmpty\" Forwards))}) (rules (start { (place \"Disc1\" {0 1 2 3 4 5 6 7 9 10 11 15 16}) (place \"Disc2\" {20 21 25 26 27 29 30 31 32 33 34 35 36})}) (play (forEach Piece)) (end (\"MisereBlockWin\"))))\n\n###\n\n", "completion": "On your turn you move one of your pieces one step onto an empty cell in one of the three forwards directions. Black's pieces move towards the bottom of the board, while White's pieces move towards the top. If, at the beginning of your turn, none of your pieces can move, you win. 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\n2x4 board. Six counters per hole. Sowing occurs in a clockwise direction from the left half of a player's row, and anti-clockwise when played from the player's right half of the row. The first seed of sowing is placed in the hole from which the sowing began. When the final counter of a sowing falls into an occupied hole, and it now contains an even number of counters, these are captured, provided the contents of that hole have already been moved. Should the following hole also contain an even number of counters, these are also captured, as well as the next one, until there is a hole with an odd number of counters. If a player cannot move, they must pass until the opponent plays in such a way that they may play. If neither player is able to move, they both capture the counters in their rows. Players then count their counters by placing them six per hole. The player who has more counters than necessary to fill their holes places them aside for use in successive rounds. The player who is unable to fill a hole with six counters leaves it empty, also placing the extra counters aside for later use. This hole is not to be sown into. The player chooses which hole to leave empty. Subsequent rounds continue until one player cannot fill a hole with six counters. The board has 4 columns.\n\n###\n\n", "completion": "(define \"Move\" (or { (move Select (from (sites Mover \"LeftSide\") if:(> (count at:(from)) 1)) (then (and (remember Value \"HolesSowed\" (last To)) (sow \"TrackCW\" apply:(if (and (is In (to) (values Remembered \"HolesSowed\")) (is Even (count at:(to)))) (\"CaptureMove\" \"TrackCW\")) origin:True)))) (move Select (from (sites Mover \"RightSide\") if:(> (count at:(from)) 1)) (then (and (remember Value \"HolesSowed\" (last To)) (sow \"TrackCCW\" apply:(if (and (is In (to) (values Remembered \"HolesSowed\")) (is Even (count at:(to)))) (\"CaptureMove\" \"TrackCCW\")) origin:True))))})) (define \"CaptureMove\" (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to)) (then (if (is Even (count at:(\"NextHole\" (last From) #1 1))) (and (fromTo (from (\"NextHole\" (last From) #1 1)) (to (handSite Mover)) count:(count at:(\"NextHole\" (last From) #1 1))) (if (is Even (count at:(\"NextHole\" (last From) #1 2))) (and (fromTo (from (\"NextHole\" (last From) #1 2)) (to (handSite Mover)) count:(count at:(\"NextHole\" (last From) #1 2))) (if (is Even (count at:(\"NextHole\" (last From) #1 3))) (and (fromTo (from (\"NextHole\" (last From) #1 3)) (to (handSite Mover)) count:(count at:(\"NextHole\" (last From) #1 3))) (if (is Even (count at:(\"NextHole\" (last From) #1 4))) (and (fromTo (from (\"NextHole\" (last From) #1 4)) (to (handSite Mover)) count:(count at:(\"NextHole\" (last From) #1 4))) (if (is Even (count at:(\"NextHole\" (last From) #1 5))) (and (fromTo (from (\"NextHole\" (last From) #1 5)) (to (handSite Mover)) count:(count at:(\"NextHole\" (last From) #1 5))) (if (is Even (count at:(\"NextHole\" (last From) #1 6))) (fromTo (from (\"NextHole\" (last From) #1 6)) (to (handSite Mover)) count:(count at:(\"NextHole\" (last From) #1 6))))))))))))))))) (define \"PiecesOwnedBy\" (+ (count Cell at:(handSite #1)) (count in:(sites #1 \"Home\")))) (define \"NextHole\" (\"NextSiteOnTrack\" #3 from:#1 #2)) (define \"Column\" 4) (game \"Bechi\" (players 2) (equipment { (mancalaBoard 2 (\"Column\") store:None { (track \"TrackCW\" \"3,W,N,E\" loop:True) (track \"TrackCCW\" \"0,E,N,W\" loop:True)}) (regions \"Home\" P1 (sites Bottom)) (regions \"Home\" P2 (sites Top)) (regions \"LeftSide\" P1 (intersection (expand (sites Left) steps:1) (sites Bottom))) (regions \"LeftSide\" P2 (intersection (expand (sites Right) steps:1) (sites Top))) (regions \"RightSide\" P1 (intersection (expand (sites Right) steps:1) (sites Bottom))) (regions \"RightSide\" P2 (intersection (expand (sites Left) steps:1) (sites Top))) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 6 to:(sites Track))) phases:{ (phase \"Sowing\" (play (if (can Move (\"Move\")) (\"Move\") (move Pass (then (if (all Passed) (and { (forEach Site (sites P1 \"Home\") (if (is Occupied (site)) (fromTo (from (site)) (to (handSite P1)) count:(count at:(site))))) (forEach Site (sites P2 \"Home\") (if (is Occupied (site)) (fromTo (from (site)) (to (handSite P2)) count:(count at:(site))))) (forget Value \"HolesSowed\" All)})))))) (end (if (all Passed) { (if (> 6 (count Cell at:(handSite P1))) (result P2 Win)) (if (> 6 (count Cell at:(handSite P2))) (result P1 Win))})) (nextPhase (all Passed) \"BetweenRounds\")) (phase \"BetweenRounds\" (play (if (<= 6 (count Cell at:(handSite Mover))) (move (from (handSite Mover)) (to (intersection (sites Empty) (sites Mover \"Home\"))) count:6))) (nextPhase (all Passed) \"Sowing\"))})) END" }, { "prompt": "Construct a Ludii game based on the following description\nOne player has three dwarfs and the other has one giant.\n Firstly, the giant is placed on one of the top sites. After this first move of the giant, it is the dwarfs' move.\n Each piece can move between the different sites only if they are connected by an edge. The dwarfs can move only forwards or sideways, the giant can move in all the directions.\n \n The goal of the dwarfs is to block the giant on the top site. The giant has to break through the line of dwarfs to get 2 points and win. In case of a repetition of moves, the giant is winning with one point.\n \n \n\n###\n\n", "completion": "(game \"Game of Dwarfs\" (players {(player S) (player N)}) (equipment { (board (add (remove (rotate 90 (\"ThreeMensMorrisGraphWithLeftAndRightTriangles\")) vertices:{3 7 1}) edges:{{0 1} {4 5} {2 7} {0 4}}) use:Vertex) (piece \"Foot\" P1 (move Step Adjacent (to if:(and (if (= 1 (count Turns)) (!= (centrePoint) (to)) True) (is Empty (to)))))) (piece \"Gnome\" P2 (\"StepToEmpty\" (directions {Forwards Rightward Leftward}))) (hand P1) (regions \"Home\" P2 (intersection (sites Outer) (expand (sites Bottom)))) (regions \"Home\" P1 (sites Top))}) (rules (start { (place \"Gnome2\" (intersection (sites Outer) (expand (sites Bottom)))) (place \"Foot1\" (handSite P1))}) phases:{ (phase \"Opening\" P1 (play (move (from (handSite Mover)) (to (expand (sites Top))))) (nextPhase P1 \"MainP1\")) (phase \"MainP1\" P1 (play (forEach Piece (then (if (is In (where \"Foot\" P1) (sites P2)) (set Score P1 2) (if (is Cycle) (set Score P1 1))))))) (phase \"MainP2\" P2 (play (forEach Piece (then (if (no Moves Next) (set Score P2 1) (if (is Cycle) (set Score P1 1)))))))} (end (forEach Player if:(!= 0 (score Player)) (result Player Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x3 board. Eight counters in each pile. A player takes the counters from any of the piles and sows them anti-clockwise, beginning with the pile from which the counters were taken. Any piles that now contain 2, 4, or 6 counters are captured. The player who captures the most counters wins.\n \n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (count Cell at:(handSite #1))) (game \"Kapana Bona\" (players 2) (equipment { (mancalaBoard 2 3 store:None (track \"Track\" \"0,E,N,W\" loop:True)) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 8 to:(sites Track))) (play (move Select (from (sites Board) if:(> (count at:(from)) 0)) (then (sow origin:True (then (forEach Site (sites Board) (if (or { (= (count at:(site)) 2) (= (count at:(site)) 4) (= (count at:(site)) 6)}) (fromTo (from (site)) (to (handSite Mover)) count:(count at:(site)))))))))) (end (\"MancalaByScoreWhen\" (= 0 (count Sites in:(forEach (sites Board) if:(< 1 (count at:(site)))))))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n5x5 intersecting lines, with diagonals drawn in the four quadrants of the board. Two triangles, their apices intersecting the main board at opposite midpoints. The base of the triangle is bisected by a line drawn from the apex, and this line is bisected and intersects with the other two sides of the triangle. One player plays as the Rimoe (king), which starts on the central point. The other player has 24 pieces, eight of which start on the board, on the points immediately adjacent to the Rimoe. The Rimoe plays first, and takes one of the opponent's pieces by hopping over it to an empty spot immediately behind it in a straight line. The Rimoe captures in this way any uninterrupted line of pieces with an odd number. The Rimoe cannot capture a line of pieces with an even number. When the Rimoe cannot capture, it moves one to an empty adjacent space along the lines of the board. The other player places on of their remaining pieces on the board on their turn. When there are no more pieces left to place, the player moves one of the pieces to an empty adjacent spot along the lines. The Rimoe wins by capturing all of the opponent's pieces; the opponent wins by blocking the Rimoe from being able to move. The game is played with one Rimoe able to hop an odd number of enemy pieces.\n\n###\n\n", "completion": "(define \"Hop\" (move Hop (between (range 1 9) if:(\"IsEnemyAt\" (between)) (apply (remove (between)))) (to if:(and (is Empty (to)) (\"NumCapturedPiecesIsOdd\"))))) (define \"NumCapturedPiecesIsOdd\" (is Even (count Steps (from) (to)))) (game \"Rimoe\" (players 2) (equipment { (\"AlquerqueBoardWithBottomAndTopTriangles\") (piece \"King\" P1 (priority { (\"Hop\") (\"StepToEmpty\")})) (piece \"Marker\" P2 (\"StepToEmpty\")) (hand Each)}) (rules (start { (place \"King1\" (centrePoint) count:1) (place \"Marker2\" (handSite P2) count:16) (place \"Marker2\" (difference (expand (sites Centre)) (centrePoint)))}) phases:{ (phase \"Placement\" P2 (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (\"PhaseMovePiece\" \"Movement\")} (end (\"NoMovesP1NoPiecesP2\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\n4x12 board. Twelve pieces per player, one playing as sticks and the other as stones. Pieces begin on the board, one each in every space of the outer rows. Six sticks, with one black side and one white side, used as dice. Players choose who will play as black and who will play as white, and the throws are as follows: six black or white up = 6, five black or white up (called sir)= 5 plus another throw; four black or white up = 0, three black and three white up = 3. A player must throw sir in their colour to unlock a piece before moving it. Pieces move from left to right in their home row, right to left in the next row, left to right in the row following that, and then return to the second row. When a player's piece lands on a spot occupied by an opponent's piece, the opponent's piece is captured. The player who captures all of the opponent's pieces wins. \n\n###\n\n", "completion": "(define \"PieceMove\" (if (or (\"ActivatedPiece\") (and (= (count Pips) (mapEntry \"Sir\" (mover))) (\"InactivePiece\"))) (if (\"IsNotOffBoard\" \"SiteToMoveOnTrack\") (if (or (is In \"SiteToMoveOnTrack\" (sites Empty)) (\"IsEnemyAt\" \"SiteToMoveOnTrack\")) (move (from) (to \"SiteToMoveOnTrack\" \"CaptureEnemyPiece\"))) (then (\"ActivatePiece\"))))) (define \"CaptureEnemyPiece\" (apply if:(\"IsEnemyAt\" (to)) (remove (to)))) (define \"InactivePiece\" (= (state at:(from)) 1)) (define \"ActivatedPiece\" (= (state at:(from)) 0)) (define \"ActivatePiece\" (if (= (state at:(last To)) 1) (set State at:(last To) 0))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" (\"ThrowValue\"))) (define \"ThrowValue\" (mapEntry \"ThrowDiceValue\" (count Pips))) (game \"Siryu (War)\" (players 2) (equipment { (board (rectangle 4 12) { (track \"Track1\" \"0,E,N1,W,N1,E,23,E,W,N1,E,23,W,N1,E,23,W,N1,E,23,W,N1,E,23,W,N1,E,23,W,N1,E,23\" loop:True P1) (track \"Track2\" \"47,W,S1,E,S1,W,24,E,N1,W,24,E,N1,W,24,E,N1,W,24,E,N1,W,24,E,N1,W,24,E,N1,W,24\" loop:True P2)} use:Vertex) (piece \"Stick\" P1 (\"PieceMove\")) (piece \"Marker\" P2 (\"PieceMove\")) (regions \"AllSites\" (sites Board)) (\"StickDice\" 6) (map \"ThrowDiceValue\" {(pair 0 6) (pair 1 5) (pair 2 0) (pair 3 3) (pair 4 0) (pair 5 5) (pair 6 6)}) (map \"Sir\" {(pair 1 1) (pair 2 5)})}) (rules (start { (place \"Stick1\" (sites Bottom) state:1) (place \"Marker2\" (sites Top) state:1)}) (play (\"RollMove\" (if (can Move (forEach Piece)) (forEach Piece (then (if (= (\"ThrowValue\") 5) (moveAgain)))) (move Pass (then (if (= (\"ThrowValue\") 5) (moveAgain))))))) (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nSpiral board of any number of spaces, rendered as holes in the sand. The first space is a mound. Any number of players. One piece per player, and one piece, the \\ The game has 4 players.\n\n###\n\n", "completion": "(define \"MoveBankor\" (move (from (\"WhereBankor\") level:(\"LevelBankor\")) (to (\"BankorOnTrack\" \"Track\" (\"ThrowValue\"))) (then (and (if (!= (mover) \"StateBankor\") (set State at:(\"WhereBankor\") level:(\"LevelBankor\") (mover))) (if (= (last To) (\"Center\")) (forEach Site (sites Track \"Track\" from:(last From) to:(last To)) (if (!= (site) (last To)) (forEach Level (site) FromTop (remove (site) level:(level))))) (forEach Site (sites Track \"Track\" from:(last From) to:(last To)) (if (!= (site) (last To)) (forEach Level (site) FromTop (fromTo (from (site) level:(level)) (to (last To))))))))))) (define \"Center\" 0) (define \"StateBankor\" (state at:(\"WhereBankor\") level:(\"LevelBankor\"))) (define \"LevelBankor\" (where Level \"Bankor\" Neutral at:(\"WhereBankor\"))) (define \"WhereBankor\" (where \"Bankor\" Neutral)) (define \"BankorPhaseDone\" (or (= (\"WhereBankor\") (\"Center\")) (and (is Occupied (\"Center\")) (>= 1 (count Sites in:(difference (sites Occupied by:All) (\"WhereBankor\"))))))) (define \"BankorOnTrack\" (\"NextSiteOnTrack\" #2 from:(\"WhereBankor\") #1)) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" #2 #1)) (define \"Throw1\" (= (\"ThrowValue\") 1)) (define \"ThrowValue\" (mapEntry \"Throw\" (count Pips))) (game \"Sik\" (players 4) (equipment { (board (spiral turns:5 sites:86) { (track \"Track\" {85..0} directed:True)} use:Vertex) (\"StickDice\" 4) (map \"Throw\" {(pair 0 4) (pair 1 3) (pair 2 0) (pair 3 1) (pair 4 6)}) (piece \"Stick\" Each (move (from (from) level:(level) if:(or (= 1 (state at:(from) level:(level))) (\"Throw1\"))) (to (\"SiteToMoveOnTrack\" \"Track\" (\"ThrowValue\")) if:True) (then (if (!= 1 (state at:(last To) level:(last LevelTo))) (set State at:(last To) level:(last LevelTo) 1))))) (piece \"Bankor\" Neutral)}) (rules (start { (place Stack items:{\"Stick4\" \"Stick3\" \"Stick2\" \"Stick1\"} 85) (place Stack \"Bankor0\" 85)}) (play (\"RollMove\" (if (= (\"Center\") (where \"Stick\" Mover)) (if (< (value Player Mover) 2) (move Pass (then (set Value Mover (+ 1 (value Player Mover))))) (if (or (= (mover) (\"StateBankor\")) (= 0 (\"StateBankor\"))) (if (!= 0 (\"ThrowValue\")) (\"MoveBankor\")))) (if (!= 0 (\"ThrowValue\")) (forEach Piece))))) (end { (forEach Player if:(no Pieces Player) (result Player Loss)) (forEach Player if:(\"BankorPhaseDone\") (result Player Win))}))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"IsSpecialThrow\" (is In (\"ThrowValue\") (sites {10 25 30}))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" #2 #1)) (define \"ThrowValue\" (mapEntry \"Throw\" (count Pips))) (game \"Pachesi\" (players 4) (equipment { (\"PachisiBoard\" { (track \"Track1\" \"96,9,S,W,N,7,W,N,E,51,N,E,S,43,E,S,W,10,S,W1,N7,End\" P1 directed:True) (track \"Track2\" \"96,26,W,N,E,51,N,E,S,43,E,S,W,10,S,W,N,7,W,N1,W7,End\" P2 directed:True) (track \"Track3\" \"96,52,N,E,S,43,E,S,W,10,S,W,N,7,W,N,E,51,N,E1,S7,End\" P3 directed:True) (track \"Track4\" \"96,27,E,S,W,10,S,W,N,7,W,N,E,51,N,E,S,43,E,S1,W7,End\" P4 directed:True)}) (\"StickDice\" 7) (piece \"Pawn\" Each (if (\"IsEndTrack\" (\"SiteToMoveOnTrack\" from:(from) (\"ThrowValue\"))) (move Remove (from) level:(level)) (if (and (\"IsEndTrack\" (\"SiteToMoveOnTrack\" from:(from) 1)) (\"IsSpecialThrow\")) (move Remove (from) level:(level)) (move (from (from) level:(level)) (to (\"SiteToMoveOnTrack\" from:(from) (\"ThrowValue\")) if:(not (and (is In (to) (sites \"SafeSites\")) (\"IsEnemyAt\" (to)))) (\"HittingStackCapture\" (centrePoint))))))) (hand Each) (regions \"SafeSites\" (sites {55 63 65 34 15 47 94 84 86 19 38 3})) (map \"Throw\" {(pair 0 7) (pair 1 10) (pair 2 2) (pair 3 3) (pair 4 4) (pair 5 25) (pair 6 30) (pair 7 12)})}) (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\" (or (if (and (is Occupied (handSite Mover)) (\"IsSpecialThrow\")) (move (from (handSite Mover)) (to (centrePoint)))) (forEach Piece)))) (end (\"EscapeWin\"))))\n\n###\n\n", "completion": "Four 3x8 rectangles, arranged in a cross. The counting from the bottom of each arm, the spaces marked are the fourth square in the outer rows and the first in the central row. Four pieces per player. Seven cowrie shells, used as dice. The throws are as follows: one mouth up = 10; two mouths up = 2; three mouth up = 3; four mouths up = 4; five mouths up. = 25; six mouths up = 30, seven mouths up = 12, zero mouths up = 7. Pieces begin in the large central space of the board, and then proceed down the central row of their arm, then clockwise around the board, back to the central row, and then to the central space again. Pieces may enter the board on throws of 10, 25, or 30. When a player's piece lands on a space that is occupied by an opponent's piece, the opponent's piece is sent back to start. Pieces are safe from being sent to start when they rest on a marked space. To move off the board, a player must make an exact throw to arrive in the central square. When resting on the final square before the central one, a throw of 10, 25, or 30 is required. The first player to place all of their pieces in the central square wins. END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"PiecesOwnedBy\" (+ (count Cell at:(handSite #1)) (count in:(sites #1 \"Home\")))) (define \"Columns\" 16) (game \"Chiana wa Bwalo\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"0,E,N1,W\" loop:True P1) (track \"Track2\" \"32,E,N1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"Track1\")) (regions \"Home\" P2 (sites Track \"Track2\")) (regions \"Inner\" P1 (difference (sites Track \"Track1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"Track2\") (sites Top))) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 4 to:(union (sites Top) (sites Bottom)))) (play (move Select (from (sites Mover \"Home\") if:(> (count at:(from)) 0)) (then (sow \"Track\" owner:(mover) apply:(if (and (= (count at:(to)) 1) (> (count at:(\"OppositePit\" (to))) 0)) (fromTo (from (\"OppositePit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePit\" (to))))))))) (end (\"MancalaByScoreWhen\" (no Moves Next)))))\n\n###\n\n", "completion": "4 row board, of any number of holes. Four counters in each player's outer row. Sowing occurs from the player's rearmost hole and in an anti-clockwise direction. When the final counter lands in an empty hole in the inner row, any counters in the opposite hole in the opponent's inner row are captured. The player who captures all of the opponent's counters wins. Each player has 16 holes per row. END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6 board, with a storage hole on either end. The game starts with four counters in each hole. A player picks up all of the counters in one of the holes in their row and sows them one-by-one in a counterclockwise direction in consecutive holes from the hole the pieces originated. The starting hole is always left empty, even if a player sows in a complete circuit of the board, the original house is skipped and sowing continues in the next hole after it. Players capture counters when the final counter is sown in the player's own row and the hole containing it has two or three counters (counting the counter just dropped into it). If the hole before it also has two or three counters, these are also captured and so on until reaching a hole without two or three counters or one not belonging to the player. If an opponent's holes are all empty, the other player must make a move placing counters in the opponent's row. If not possible, the player captures all the counters in their row. The player who has captured the most counters wins. If the game continues in a repeating loop, the players can agree to end the game and capture the counters remaining in their row.\n \n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (+ (count at:(mapEntry #1)) (count in:(sites #1)))) (game \"Fondji\" (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 (if (is Proposed \"End\") (or (move Vote \"End\") (move Vote \"No\")) (or (if (is Cycle) (move Propose \"End\")) (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 (\"MancalaByScoreWhen\" (or (no Moves Mover) (is Decided \"End\")))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6 board with store holes at either end. The game begins with six counters in each hole. Each player owns one row of holes. At the beginning of the turn, a player picks up all of the counters from their side of the board and sows them, one each, into consecutive holes in a counterclockwise pattern. If the last counter lands in a hole that contains 2, 4, or 6 (after sowing), then the player captures the counters in that hole. If the player captures counters in a hole, then they may also capture counters in the previous hole, if it also has 2,4, or 6, continuing until reaching a hole without 2, 4, or 6. Play continues until one player cannot play on their turn, at which point the other player receives all of the remaining counters. The player with the most captured counters wins. \n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (+ (count at:(mapEntry #1)) (count in:(sites #1)))) (game \"Das Bohnenspiel\" (players 2) (equipment { (mancalaBoard 2 6 (track \"Track\" \"1,E,N,W\" loop:True)) (regions \"Home\" P1 (sites Bottom)) (regions \"Home\" P2 (sites Top)) (map {(pair P1 FirstSite) (pair P2 LastSite)}) (piece \"Seed\" Shared)}) (rules (start (set Count 6 to:(sites Track))) (play (move Select (from (sites Mover) if:(> (count at:(from)) 0)) (then (sow if:(is In (count at:(to)) (sites {2 4 6})) apply:(fromTo (from (to)) (to (mapEntry (mover))) count:(count at:(to))) backtracking:True)))) (end (\"MancalaByScoreWhen\" (no Moves Mover))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"Geister\" (players 2) (equipment { (board (square 6)) (hand Each size:2) (piece \"GhostGood\" Each) (piece \"GhostEvil\" Each) (regions \"HomeP1\" P1 (difference (expand (sites Bottom) steps:1) (union (sites Side E) (sites Side W)))) (regions \"HomeP2\" P2 (difference (expand (sites Top) steps:1) (union (sites Side E) (sites Side W)))) (regions \"EscapeP1\" P1 {30 35}) (regions \"EscapeP2\" P2 {0 5}) (map \"Where\" { (pair (id \"GhostGood\" P1) (handSite P1)) (pair (id \"GhostEvil\" P1) (handSite P1 1)) (pair (id \"GhostGood\" P2) (handSite P2)) (pair (id \"GhostEvil\" P2) (handSite P2 1))})}) (rules (start { (place \"GhostGood1\" 36 count:4) (place \"GhostEvil1\" 37 count:4) (set Hidden (sites Hand P1) to:P2) (place \"GhostGood2\" 38 count:4) (place \"GhostEvil2\" 39 count:4) (set Hidden (sites Hand P2) to:P1)}) phases:{ (phase \"Placement\" (play (move (from (sites Occupied by:Mover container:(mover))) (to (forEach (sites Mover \"Home\") if:(is Empty (site)))) (then (if (\"HandEmpty\" P2) (and { (set Hidden (sites P2 \"Home\") False to:P1) (set Hidden (sites P1 \"Home\") False to:P2) (set Hidden What (sites P2 \"Home\") to:P1) (set Hidden What (sites P1 \"Home\") to:P2)}))))) (nextPhase (\"HandEmpty\" P2) \"Movement\")) (phase \"Movement\" (play (forEach Piece {\"GhostGood\" \"GhostEvil\"} (or (move Step Orthogonal (to if:(not (\"IsFriendAt\" (to))) (apply (if (\"IsEnemyAt\" (to)) (add (piece (what at:(to))) (to (mapEntry \"Where\" (what at:(to))))))))) (move Select (from (intersection (sites Occupied by:Mover component:\"GhostGood\") (sites Mover \"Escape\"))) (then (trigger \"Escaped\" (mover))))))) (end { (if (or { (no Pieces Mover \"GhostEvil\" in:(sites Board)) (no Pieces Next \"GhostGood\" in:(sites Board)) (is Triggered \"Escaped\" Mover)}) (result Mover Win)) (if (or (no Pieces Next \"GhostEvil\" in:(sites Board)) (no Pieces Mover \"GhostGood\" in:(sites Board))) (result Mover Loss))}))}))\n\n###\n\n", "completion": "Geister is a two-player board game on a 6\u00d76 game board.\n Each player has four good ghosts and four evil ghosts, whose\n type is not revealed to the opponent player. In each turn\n a player can move one of his ghosts one step vertically or\n horizontally. Moving into a square containing an opponent's\n ghost will capture the opponent's ghost and move it off from\n the board. Moving into a square containing an ally ghost\n is not allowed. A player can also move off one of his good\n ghosts from one of the opponent's corner squares. A player\n wins when one of the three conditions is satisfied:\n \u2022 All the player's evil ghosts are captured.\n \u2022 All the opponent's good ghosts are captured.\n \u2022 One of the player's good ghosts is moved off the board\n from one of the opponent's corner squares. END" }, { "prompt": "Construct a Ludii game based on the following description\nEach box should contain a zero or a one. No more than two similar numbers next to or below each other are allowed. Each row and each column should contain an equal number of zeros and ones. Each row is unique and each column is unique. \n\n###\n\n", "completion": "(game \"Takuzu\" (players 1) (equipment { (board (square 10) (values Cell (range 0 1))) (regions {Columns Rows})}) (rules (start (set { {0 1} {1 1} {4 1} {11 1} {18 1} {25 0} {26 0} {29 0} {34 1} {37 0} {51 1} {52 0} {59 1} {65 1} {67 1} {71 1} {86 0} {87 0} {92 0} {96 0}})) (play (satisfy { (not (is Line 3 Orthogonal)) (is Unique) (is Sum (/ (count Rows) 2))})) (end (if (is Solved) (result P1 Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe aim of Abak is to be the first player to connect one of the orange squares in the centre of the board to any one orange squares in the corners by forming a continuous row of counters of one colour. \n \n In the first phase, each player places one counter on one of the orange squares in the centre of the board. \n \n They continue to take turns to place their counters on a free adjacent square (squares are adjacent if they touch on the sides or diagonally by the points).\n \n The counter may be placed beside counters of any colour. Once placed, a counter may not be moved. \n \n During the game, if a counter is surrounded by more than 4 occupied squares, that counter is removed. \n \n Moreover, if then a counter becomes isolated, it is also removed from the board. The game is played on a 11x11 board. Two players.\n\n###\n\n", "completion": "(define \"AlternateRegions\" (regions \"Centre\" (sites Centre)) (regions \"CentreRing\" (difference (expand (sites Centre)) (sites Centre))) (regions \"CornerSites\" (sites {\"B2\" \"J2\" \"R2\" \"B10\" \"R10\" \"B18\" \"J18\" \"R18\"})) (regions \"DotSites\" (sites {\"F6\" \"J6\" \"N6\" \"N10\" \"F10\" \"F14\" \"J14\" \"N14\"})) (regions \"OuterGoals\" (difference (expand (sites \"CornerSites\")) (sites \"CornerSites\")))) (define \"RegularRegions\" (regions \"Centre\" (sites Centre)) (regions \"CentreRing\" (difference (expand (sites Centre)) (sites Centre))) (regions \"OuterGoals\" (expand (sites Corners)))) (define \"Nbors\" (count Sites in:(intersection (sites Around #1) (sites Occupied by:All)))) (game \"Abak\" (players 2) (equipment { (board (square 11)) (piece \"Disc\" Each) \"RegularRegions\"}) (rules phases: { (phase \"Placement\" (play (move Add (to (intersection (sites \"CentreRing\") (sites Empty))))) (nextPhase (= (count Pieces All) 2) \"Movement\")) (phase \"Movement\" (play (move Add (to (difference (sites Playable) (sites Centre))) (then (forEach Site (sites Occupied by:All) (if (<= 4 (\"Nbors\" (to))) (remove (to))) (then (forEach Site (sites Occupied by:All) (if (= 0 (\"Nbors\" (to))) (remove (to))))))))))} (end (if (is Connected {(sites \"CentreRing\") (sites \"OuterGoals\")}) (result Mover Win))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"Kharebga (7x7)\" (players 2) (equipment { (board (square 7)) (piece \"Marker\" Each (move Slide Orthogonal (then (\"CustodialCapture\" Orthogonal (max 1))))) (hand Each)}) (rules (start (place \"Marker\" \"Hand\" count:24)) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (difference (sites Board) (centrePoint)) if:(is Empty (to))) (then (if (\"NewTurn\") (moveAgain))))) (nextPhase Mover (is Empty (handSite Mover)) \"Capture\")) (\"PhaseMovePiece\" \"Capture\")} (end (\"CaptureAll\" Next))))\n\n###\n\n", "completion": "7x7 board. 24 pieces per player. Players alternate turns placing two pieces on an empty space on the board, except in the central space. Captures cannot be made during the placement phase. When all of the pieces have been placed, players alternate turns moving a piece orthogonally any distance. When an opponent's piece is between two of a player's pieces, it is captured. If a player is unable to make a move, they pass their turn and the opponent plays again. The player who captures all of the opponent's pieces wins.\n END" }, { "prompt": "Construct a Ludii game based on the following description\n2x12 board, divided in half. Spaces on each side take the form of semi-circular sockets, into which the pieces fit. Fifteen pieces per player. Two or three 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. One player begins with all of their pieces on the space furthest to the left on their side, the other with their pieces on the point directly opposite it. Pieces move in opposite directions around the board, only on the half of the board where the pieces begin, toward the point where the opponent's pieces begin, and bearing off the board from there. When a piece lands on the same space as an opponent's piece, the opponent's piece is sent back to where it began. The first person to bear off all their pieces wins. If players move their pieces such that they fill up all the points in a quadrant, and the other fills up all of the points in an adjacent quadrant such that neither player can move, the game is a draw.\n The game involves 2 dice\n\n###\n\n", "completion": "(define \"RemoveAPiece\" (move Remove (from))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" (pips))) (game \"Medio Emperador\" (players 2) (equipment { (\"TableBoard\" \"TableTracksOppositeWithHands\") (dice d:6 num:2) (hand Each) (piece \"Disc\" Each (forEach Die if:(\"DieNotUsed\") (if (\"IsOffBoard\" \"SiteToMoveOnTrack\") \"RemoveAPiece\" (if (\"NoEnemyOrOnlyOne\" \"SiteToMoveOnTrack\") (move (from) (to \"SiteToMoveOnTrack\" (\"HittingCapture\" (handSite Next))))))))}) (rules (start { (place Stack \"Disc1\" 0 count:15) (place Stack \"Disc2\" 12 count:15)}) (play (\"RollEachNewTurnMove\" (or (forEach Piece top:True) (forEach Piece container:(mover) top:True) (then (\"ReplayNotAllDiceUsed\"))))) (end { (\"EscapeWin\") (if (and (no Moves P1) (no Moves P2)) (result Mover Draw))}))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game is played according to the rules described in Wikipedia in stepping to any sites. -> The game is played according to the rules described in Wikipedia in stepping to any sites except the middle.\n(game \"Achi\" (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 (>= (count Moves) 6) \"Movement\")) (\"PhaseMovePiece\" \"Movement\")} (end (\"Line3Win\"))))\n\n###\n\n", "completion": "(game \"Achi\" (players 2) (equipment { (\"AlquerqueBoard\" 3 3) (hand Each) (piece \"Marker\" Each (move Step (to if:(is In (to) (difference (sites Empty) (sites Centre))))))}) (rules (start (place \"Marker\" \"Hand\" count:3)) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase (>= (count Moves) 6) \"Movement\")) (\"PhaseMovePiece\" \"Movement\")} (end (\"Line3Win\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6 board. Four counters in each hole. Sowing occurs in an anti-clockwise direction. The hole from which sowing begins must remain empty throughout the player's turn. Captures are made when the last counter of a sowing fall into the opponent's row in a hole containing one or two counters (thus making two or three), capturing all of the counters in that hole. A continuous series of holes holding two or three counters behind it are also captured, provided the player's sowing caused them to contain this number. If a player has no counters in their holes, the opponent must play to place seeds in their row, if possible. The game ends when players have holes with only empty and single counters. The player who captured the most counters wins. \n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (count Cell at:(handSite #1))) (game \"Awari\" (players 2) (equipment { (mancalaBoard 2 6 store:None (track \"Track\" \"0,E,N,W\" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 4 to:(sites Track))) (play (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 (handSite Mover)) count:(count at:(to))) includeSelf:False backtracking:True))) ifAfterwards:(< 0 (count in:(sites Next))))) (end (\"MancalaByScoreWhen\" (all Sites (sites Track) if:(<= (count at:(site)) 1)))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n5x5 intersecting lines, with diagonals drawn in the four quadrants of the board. Two triangles, their apices intersecting the main board at opposite midpoints. The bast of the triangle is bisected by a line drawn from the apex, and this line is bisected and intersects with the other two sides of the triangle. One player plays as two tigers, which can be placed anywhere on the board, and the other player plays as 32 goats, which begin on the four central points of the quadrants of the square board, eight per stack. Players alternate turns moving a piece to an empty adjacent spot along the lines. The goats move one at a time from their stacks, and cannot be restacked once they have been moved. The tiger may capture a goat by hopping over it to an empty spot immediately on the opposite side of an adjacent goat. Multiple captures in one turn are allowed, but a tiger cannot hop over a stack of goats and hop over it again in the opposite direction. When tigers hop over a stack of goats, only one goat is captured. The goats win by blocking the tigers from being able to move; the tigers win by capturing all the goats. \n\n###\n\n", "completion": "(define \"CaptureAgain\" (then (if (can Move (\"HopCapture\" (from (last To)) (difference Orthogonal OppositeDirection))) (moveAgain)))) (game \"Bagh Bandi\" (players 2) (equipment { (\"AlquerqueBoardWithBottomAndTopTriangles\") (piece \"Goat\" P2 \"StepToEmpty\") (piece \"Tiger\" P1 (or (\"StepToEmpty\") (\"HopCapture\" ~ ~ (\"CaptureAgain\")))) (regions \"CentralSites\" (sites {6 8 16 18})) (hand P1)}) (rules (start { (place Stack \"Tiger1\" (handSite P1) count:2) (place Stack \"Goat2\" 6 count:8) (place Stack \"Goat2\" 8 count:8) (place Stack \"Goat2\" 16 count:8) (place Stack \"Goat2\" 18 count:8)}) phases:{ (phase \"Placement\" P1 (play (move (from (handSite P1)) (to (sites Empty)) (then (if (\"HandOccupied\" Mover) (moveAgain))))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (phase \"Movement\" (play (if (\"SameTurn\") (or (\"HopCapture\" (from (last To)) (difference Orthogonal OppositeDirection) (\"CaptureAgain\")) (move Pass)) (forEach Piece top:True))))} (end (\"NoMovesP1NoPiecesP2\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlace a piece of your colour each turn. Win with 4 in a row of your colour. \n\n###\n\n", "completion": "(game \"Score Four\" (players 2) (equipment { (board (skew .5 (scale 1 .5 (square 4)))) (piece \"discFlat\" Each)}) (rules (play (move Add (to (forEach (sites Board) if:(< (size Stack at:(site)) 4))) stack:True)) (end (if (is Line 4 byLevel:True) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThree-row board, outer rows with sixteen holes and the central with seventeen. Sixteen pieces per player, which start the board in each of the holes in the outer row belonging to a player. Two four-sided dice. Players move their pieces according to the throws of the dice, moving one piece the value of one of the dice and another the value of the other die, or one piece the value of both dice. Players move from their row into the central row, and when reaching the end of the central row, proceed into the opponent's row. Opponent's pieces are taken when a player's piece lands in the same spot as the opponent's piece. Players may not move one of their pieces past one of their other pieces. \n\n###\n\n", "completion": "(define \"MoveAPiece\" (if (or (= (state at:(from)) 1) (and (= (state at:(from)) 0) (= 1 (pips)))) (move Slide #1 (between (exact (pips)) if:(is Empty (between))) (to if:(\"IsEnemyAt\" (to)) (apply if:(not (\"IsFriendAt\" (to))) (remove (to)))) (then (if (= (state at:(last To)) 0) (set State at:(last To) 1)))))) (game \"Daldos\" (players 2) (equipment { (board (merge { (rectangle 1 16) (shift -1 1 (rectangle 1 17)) (shift 0 2 (rectangle 1 16))}) { (track \"Track1\" {0..15 32..16 33..48 32..16} loop:True P1) (track \"Track2\" {33..48 32..16 0..15 32..16} loop:True P2)} use:Vertex) (regions \"AllSites\" (sites Board)) (dice d:4 num:2) (piece \"Minus\" P1 (\"MoveAPiece\" \"Track1\")) (piece \"Minus\" P2 (\"MoveAPiece\" \"Track2\"))}) (rules (start { (place \"Minus1\" (sites Bottom)) (place \"Minus2\" (sites Top))}) (play (\"RollEachNewTurnMove\" (forEach Die replayDouble:(and (= (face 36) 1) (= (face 37) 1)) (forEach Piece (then (if (not (all DiceUsed)) (\"ReplayIfCanMove\" (forEach Die (forEach Piece))))))))) (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Construct a Ludii game based on the following description\n5x5 board. Twelve pieces per player. Players alternate turns placing two pieces on an empty space on the board, except in the central space. Captures cannot be made during the placement phase. When all of the pieces have been placed, players alternate turns moving a piece orthogonally any distance. When an opponent's piece is between two of a player's pieces, it is captured. If a player is unable to make a move, they pass their turn and the opponent plays again. The player who captures all of the opponent's pieces wins. \n\n###\n\n", "completion": "(game \"Kharebga (5x5)\" (players 2) (equipment { (board (square 5)) (piece \"Marker\" Each (move Slide Orthogonal (then (\"CustodialCapture\" Orthogonal (max 1))))) (hand Each)}) (rules (start (place \"Marker\" \"Hand\" count:12)) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (difference (sites Board) (centrePoint)) if:(is Empty (to))) (then (if (\"NewTurn\") (moveAgain))))) (nextPhase Mover (is Empty (handSite Mover)) \"Capture\")) (\"PhaseMovePiece\" \"Capture\")} (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"Cross\" (players 2) (equipment { (board (hex 5)) (piece \"Marker\" Each)}) (rules (play (move Add (to (sites Empty)))) (end { (if (is Connected {(sites Side S) (sites Side NW) (sites Side NE)}) (result Mover Win)) (if (is Connected {(sites Side N) (sites Side SW) (sites Side SE)}) (result Mover Win)) (if (is Connected {(sites Side N) (sites Side S)}) (result Mover Loss)) (if (is Connected {(sites Side NW) (sites Side SE)}) (result Mover Loss)) (if (is Connected {(sites Side NE) (sites Side SW)}) (result Mover Loss))})))\n\n###\n\n", "completion": "A player wins by connecting three non-adjacent board sides with a chain of their pieces. A player loses by connecting two opposite board sides with a chain of their pieces (without also connecting three non-adjacent sides). The game is played on a 5x5 board END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nEach player has 3 holes. -> Each player has 4 holes.\n(define \"NoPieceOnBoard\" (all Sites (union (sites Top) (sites Bottom)) if:(= 0 (count at:(site))))) (define \"PlayableSites\" (sites (values Remembered \"Playable\"))) (game \"Khrour\" (players 2) (equipment { (mancalaBoard 2 3 store:None (track \"Track\" \"0,E,N,W\" loop:True)) (piece \"Seed\" Shared) (hand Each) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start { (set Count 6 to:(sites Track)) (set RememberValue \"Playable\" (union (sites Top) (sites Bottom)))}) phases:{ (phase \"Sowing\" (play (or { (move Select (from (sites Mover) if:(and (is Occupied (from)) (is In (from) (\"PlayableSites\")))) (then (sow apply:(if (and (or { (= 2 (count at:(to))) (= 4 (count at:(to))) (= 6 (count at:(to))) (= 8 (count at:(to)))}) (is In (to) (\"PlayableSites\"))) (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to)))))))} (then (if (\"NoPieceOnBoard\") (forget Value \"Playable\" All) (forEach Site (difference (sites Board) (\"PlayableSites\")) (if (<= 6 (count at:(site))) (remember Value \"Playable\" (site)))))))) (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 (<= 6 (count Cell at:(handSite Mover))) (move (from (handSite Mover)) (to (sites Mover) if:(is Empty (to))) count:6 (then (remember Value \"Playable\" (last To)))) (move (from (handSite Mover)) (to (sites Mover) if:(is Empty (to))) count:(count Cell at:(handSite Mover)))))) (nextPhase (all Passed) \"Sowing\"))}))\n\n###\n\n", "completion": "(define \"NoPieceOnBoard\" (all Sites (union (sites Top) (sites Bottom)) if:(= 0 (count at:(site))))) (define \"PlayableSites\" (sites (values Remembered \"Playable\"))) (game \"Khrour\" (players 2) (equipment { (mancalaBoard 2 4 store:None (track \"Track\" \"0,E,N,W\" loop:True)) (piece \"Seed\" Shared) (hand Each) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start { (set Count 8 to:(sites Track)) (set RememberValue \"Playable\" (union (sites Top) (sites Bottom)))}) phases:{ (phase \"Sowing\" (play (or { (move Select (from (sites Mover) if:(and (is Occupied (from)) (is In (from) (\"PlayableSites\")))) (then (sow apply:(if (and (or { (= 2 (count at:(to))) (= 4 (count at:(to))) (= 6 (count at:(to))) (= 8 (count at:(to)))}) (is In (to) (\"PlayableSites\"))) (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to)))))))} (then (if (\"NoPieceOnBoard\") (forget Value \"Playable\" All) (forEach Site (difference (sites Board) (\"PlayableSites\")) (if (<= 8 (count at:(site))) (remember Value \"Playable\" (site)))))))) (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 (<= 8 (count Cell at:(handSite Mover))) (move (from (handSite Mover)) (to (sites Mover) if:(is Empty (to))) count:8 (then (remember Value \"Playable\" (last To)))) (move (from (handSite Mover)) (to (sites Mover) if:(is Empty (to))) count:(count Cell at:(handSite Mover)))))) (nextPhase (all Passed) \"Sowing\"))})) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlay starts with two counters in each hole. The game starts with 3 counters.\n\n###\n\n", "completion": "(define \"KalahCount\" (count at:(mapEntry #1))) (define \"PiecesOwnedByP2\" (+ {(count at:(mapEntry P2)) (count in:(sites P2)) (count in:(sites P1))})) (define \"PiecesOwnedByP1\" (+ {(count at:(mapEntry P1)) (count in:(sites P1)) (count in:(sites P2))})) (game \"Aw-li On-nam Ot-tjin\" (players 2) (equipment { (mancalaBoard 2 9 (track \"Track\" \"1,E,N,W\" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 FirstSite) (pair P2 LastSite)}) (piece \"Seed\" Shared)}) (rules (start (set Count 3 to:(sites Track))) (play (move Select (from (sites Mover) if:(> (count at:(from)) 1)) (then (sow if:(= (count at:(to)) 3) apply:(fromTo (from (to)) (to (mapEntry (mover))) count:(count at:(to))))))) (end (if (no Moves Mover) { (\"DrawIfNoMoves\" Next) (if (is Mover P1) (byScore { (score P1 (\"KalahCount\" P1)) (score P2 \"PiecesOwnedByP1\")})) (if (is Mover P2) (byScore { (score P1 \"PiecesOwnedByP2\") (score P2 (\"KalahCount\" P2))}))})))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayers decide which colors to play, and who starts first. The board is filled in the beginning with all the players pieces. The only point vacant on the board is the middle point. Each player's pieces are placed on their half of the board, and lined up on the right-hand side of the fifth rank (the middle horizontal line of the grid board). Players alternate turns. Pieces move forward only (straight forward or diagonally forward) one space per turn following the pattern on the board until they are crowned Mullah by reaching the last rank. A non-Mullah piece may capture an enemy piece by hopping over it. The capture can be in any direction. When a piece reaches the other player's rank, it is promoted to Mullah. The Mullah can move and capture in any direction. It can also move any number of spaces. The Mullah can also capture an enemy piece from any distance, and land anywhere behind the captured piece provided there are no other pieces (friendly or not) within the spaces of the leap. If a piece piece reaches the other player's rank as an intermediate step of a capturing sequence, the piece does not get promoted to Mullah. The player to capture all of the opponent's pieces wins. \n\n###\n\n", "completion": "(game \"Kharbaga\" (players {(player S) (player N)}) (equipment { (board (square 5 diagonals:Solid) use:Vertex) (piece \"Counter\" Each (or (\"StepForwardsToEmpty\") (\"HopCapture\") (then (\"PromoteIfReach\" (sites Next) \"DoubleCounter\")))) (piece \"DoubleCounter\" Each (or (\"HopCaptureDistance\") (move Slide))) (regions P1 (sites Top)) (regions P2 (sites Bottom))}) (rules (\"BeforeAfterCentreSetup\" \"Counter2\" \"Counter1\") (play (forEach Piece)) (end (if (no Moves Mover) (result Next Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x12 board, divided in half. Spaces on each side take the form of semi-circular sockets, into which the pieces fit. Fifteen pieces per player. Pieces begin on one half of a player's side of the board (the half to the left of one player, and to the right of the other player), two per space, then two on the next space and one on the space following that one. Three 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. Pieces move in a track the long way around the board toward the portion where the opponent begins. No more than two pieces can occupy a space at a time. When a piece lands on a space occupied by a single piece of the opponent, the opponent's piece is removed from the board. The opponent must then reenter this piece on the board onto an open point according to the throw of the dice, from the original starting quadrant on the board. Players attempt to bear off their pieces by rolling the exact number of spaces left on the board, plus one. The first player to bear off all their pieces wins. \n\n###\n\n", "completion": "(define \"MoveAPieceIf\" (forEach Die replayDouble:True if:#1 (\"MoveAPiece\" #2))) (define \"MoveAPiece\" (move (from #1) (to (\"NextSiteFrom\" #1) if:(\"NoEnemyOrOnlyOne\" (to)) (\"HittingCapture\" (handSite Next))))) (define \"NextSiteFrom\" (\"NextSiteOnTrack\" (pips) from:#1)) (define \"BarEmpty\" (is Empty \"Bar\")) (define \"Bar\" (handSite Mover)) (define \"RemoveAPiece\" (move Remove (from))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" (pips))) (game \"Quinze Tablas\" (players 2) (equipment { (\"TableBoard\" (\"TableTracksOppositeWithHands\" End)) (dice d:6 num:3) (hand Each) (piece \"Disc\" Each (forEach Die if:(\"DieNotUsed\") (if (\"IsEndTrack\" \"SiteToMoveOnTrack\") \"RemoveAPiece\" (if (\"IsNotOffBoard\" \"SiteToMoveOnTrack\") (if (\"IsEmptyOrSingletonStack\" (\"SiteToMoveOnTrack\")) (move (from) (to \"SiteToMoveOnTrack\" (\"HittingCapture\" (handSite Next)))))))))}) (rules (start { (place Stack \"Disc1\" (sites {0..6}) count:2) (place Stack \"Disc1\" 7 count:1) (place Stack \"Disc2\" (sites {12..18}) count:2) (place Stack \"Disc2\" 19 count:1)}) (play (\"RollEachNewTurnMove\" (if (\"BarEmpty\") (forEach Piece top:True) (\"MoveAPieceIf\" (\"DieNotUsed\") (\"Bar\")) (then (\"ReplayNotAllDiceUsed\"))))) (end { (if (no Pieces P1) (result P1 Win)) (if (no Pieces P2) (result P2 Win))}))) 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 their last counter falls into it. If the last counter of a sowing falls into an opponent's captured hole, one of those counters are removed from the board and placed in the store, and the sowing continues with the contents of any of the player's holes. 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 they draw lots to see who gets an extra hole. 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 \"SitesMarkedBy\" (forEach (sites Board) if:(= #1 (state at:(site))))) (define \"RememberOwnedHolesRandom\" (if (< 50 (value Random (range 1 100))) (remember Value \"OwnedP1\" #1) (remember Value \"OwnedP2\" #1))) (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 \"OpponentOwnedHoles\" (if (is Mover P1) (sites (values Remembered \"OwnedP2\")) (sites (values Remembered \"OwnedP1\")))) (define \"OwnedHoles\" (if (is Mover P1) (sites (values Remembered \"OwnedP1\")) (sites (values Remembered \"OwnedP2\")))) (game \"Qelat\" (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 (and (\"SameTurn\") (= 1 (var \"ContinueSowing\"))) (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))) (is In (to) (\"OpponentOwnedHoles\"))}) (set State at:(to) (mover)) (if (< 1 (count at:(to))) (if (= 0 (state at:(to))) (and { (moveAgain) (set Var \"Replay\" (to)) (set Var \"ContinueSowing\" 1)}) (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))) (moveAgain) (set Var \"ContinueSowing\" 0)}))))))))} (then (if (\"OnlyPiecesInMarked\") (and { (forEach Site (\"SitesMarkedBy\" 1) (fromTo (from (site)) (to (handSite P1)) count:(count at:(site)))) (forEach Site (\"SitesMarkedBy\" 2) (fromTo (from (site)) (to (handSite P2)) count:(count at:(site)))) (forget Value \"OwnedP1\" All) (forget Value \"OwnedP2\" All)}))))) (end (if (\"NoPieceOnBoard\") { (if (= 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 (\"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\"))}))))}))))) (nextPhase (and (is Empty (handSite P1)) (is Empty (handSite P2))) \"Sowing\"))})) END" }, { "prompt": "Construct a Ludii game based on the following description\n9x9 intersecting lines, pieces are played on the intersections. 16 pieces per player, one player is black, the other white. Pieces begin placed on the edge of the board: Black on the top and right, white on the bottom and left. Sixteen others are held in reserve for each player. Pieces move any distance orthogonally along the lines. Opponent's pieces are captured when they are surrounded by two of a player's pieces. When this is done, the surrounded player's pieces are removed and replaced with the pieces of the player that surrounded them. If multiple opponent's pieces are in a line and the other player places their pieces at either end of the line, all the pieces in between are captured. When a player is reduced to one piece, it gains the ability to capture by jumping. The player that removes all of their opponent's pieces wins. \n\n###\n\n", "completion": "(game \"Gundru\" (players 2) (equipment { (board (square 9) use:Vertex) (piece \"Marker\" Each (or (if (= 1 (+ (count Cell at:(handSite Mover)) (count Pieces Mover))) (\"HopCapture\")) (move Slide (then (custodial (from (last To)) (between (range 1 (count Rows)) if:(\"IsEnemyAt\" (between)) (apply (and (remove (between)) (fromTo (from (handSite Mover)) (to (between)))))) (to if:(\"IsFriendAt\" (to)))))))) (hand Each)}) (rules (start { (place \"Marker\" \"Hand\" count:16) (place \"Marker1\" (union (sites Top) (difference (sites Right) (sites Bottom)))) (place \"Marker2\" (union (sites Bottom) (difference (sites Left) (sites Top))))}) (play (forEach Piece)) (end (\"BlockWin\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\nEach small 3x3 Tic-Tac-Toe board is referred to as a local board, and the larger 3x3 board is referred to as the global board. The game starts with X playing wherever they want in any of the 81 empty spots. This move 'sends' their opponent to its relative location. For example, if X played in the top right square of their local board, then O needs to play next in the local board at the top right of the global board. O can then play in any one of the nine available spots in that local board, each move sending X to a different local board. If a move is played so that it is to win a local board by the rules of normal Tic-Tac-Toe, then the entire local board is marked as a victory for the player in the global board. Once a local board is won by a player or it is filled completely, no more moves may be played in that board. If a player is sent to such a board, then that player may play in any other board. Game play ends when either a player wins the global board or there are no legal moves remaining, in which case the game is a draw. \n\n###\n\n", "completion": "(define \"CheckLineRightSubGame\" (if (is In (last To) (sites \"SubGame0\")) (is In (to) (sites \"SubGame0\")) (if (is In (last To) (sites \"SubGame1\")) (is In (to) (sites \"SubGame1\")) (if (is In (last To) (sites \"SubGame2\")) (is In (to) (sites \"SubGame2\")) (if (is In (last To) (sites \"SubGame3\")) (is In (to) (sites \"SubGame3\")) (if (is In (last To) (sites \"SubGame4\")) (is In (to) (sites \"SubGame4\")) (if (is In (last To) (sites \"SubGame5\")) (is In (to) (sites \"SubGame5\")) (if (is In (last To) (sites \"SubGame6\")) (is In (to) (sites \"SubGame6\")) (if (is In (last To) (sites \"SubGame7\")) (is In (to) (sites \"SubGame7\")) (is In (to) (sites \"SubGame8\"))))))))))) (game \"Ultimate Tic-Tac-Toe\" (players 2) (equipment { (board (union (square 9) (scale 3 (square 3))) use:Cell) (piece \"Disc\" P1) (piece \"DiscLarge\" P1) (piece \"Cross\" P2) (piece \"CrossLarge\" P2) (regions \"SubGames\" (sites { 0..80})) (regions \"SubGame0\" (sites { 0..2 9..11 18..20})) (regions \"SubGame1\" (sites { 3..5 12..14 21..23})) (regions \"SubGame2\" (sites { 6..8 15..17 24..26})) (regions \"SubGame3\" (sites {27..29 36..38 45..47})) (regions \"SubGame4\" (sites {30..32 39..41 48..50})) (regions \"SubGame5\" (sites {33..35 42..44 51..53})) (regions \"SubGame6\" (sites {54..56 63..65 72..74})) (regions \"SubGame7\" (sites {57..59 66..68 75..77})) (regions \"SubGame8\" (sites {60..62 69..71 78..80})) (regions \"SuperGame\" (sites {81..89})) (map \"SubToSuper\" {0..80} { 81 81 81 82 82 82 83 83 83 81 81 81 82 82 82 83 83 83 81 81 81 82 82 82 83 83 83 84 84 84 85 85 85 86 86 86 84 84 84 85 85 85 86 86 86 84 84 84 85 85 85 86 86 86 87 87 87 88 88 88 89 89 89 87 87 87 88 88 88 89 89 89 87 87 87 88 88 88 89 89 89}) (map \"SubToSub\" {0..80} { 0 1 2 0 1 2 0 1 2 3 4 5 3 4 5 3 4 5 6 7 8 6 7 8 6 7 8 0 1 2 0 1 2 0 1 2 3 4 5 3 4 5 3 4 5 6 7 8 6 7 8 6 7 8 0 1 2 0 1 2 0 1 2 3 4 5 3 4 5 3 4 5 6 7 8 6 7 8 6 7 8})}) (rules (play (priority { (move Add (piece (if (= (mover) P1) (id \"Disc\" P1) (id \"Cross\" P2))) (to (if (= 0 (mapEntry \"SubToSub\" (last To))) (sites \"SubGame0\") (if (= 1 (mapEntry \"SubToSub\" (last To))) (sites \"SubGame1\") (if (= 2 (mapEntry \"SubToSub\" (last To))) (sites \"SubGame2\") (if (= 3 (mapEntry \"SubToSub\" (last To))) (sites \"SubGame3\") (if (= 4 (mapEntry \"SubToSub\" (last To))) (sites \"SubGame4\") (if (= 5 (mapEntry \"SubToSub\" (last To))) (sites \"SubGame5\") (if (= 6 (mapEntry \"SubToSub\" (last To))) (sites \"SubGame6\") (if (= 7 (mapEntry \"SubToSub\" (last To))) (sites \"SubGame7\") (if (= 8 (mapEntry \"SubToSub\" (last To))) (sites \"SubGame8\")))))))))) if:(and (is Empty (to)) (is Empty (mapEntry \"SubToSuper\" (to)))))) (move Add (piece (if (= (mover) P1) (id \"Disc1\") (id \"Cross2\"))) (to (intersection (sites \"SubGames\") (sites Empty)) if:(and (is Empty (to)) (is Empty (mapEntry \"SubToSuper\" (to))))))} (then (if (is Line 3 if:(\"CheckLineRightSubGame\")) (add (piece (if (= (mover) P1) (id \"DiscLarge1\") (id \"CrossLarge2\"))) (to (mapEntry \"SubToSuper\" (last To)))))))) (end (if (is Line 3 throughAny:(sites \"SuperGame\") Mover) (result Mover 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": "Describe the mechanics of the following Ludii game\n(define \"NotAllPieceInHome\" (not (all Sites (sites Occupied by:Mover) if:(is In (site) (sites Mover))))) (game \"Epelle\" (players 2) (equipment { (\"AlquerqueBoard\" 3) (piece \"Marker\" Each \"StepToEmpty\") (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start { (place \"Marker1\" (sites P1)) (place \"Marker2\" (sites P2))}) (play (forEach Piece)) (end (if (and \"NotAllPieceInHome\" (is Line 3)) (result Mover Win)))))\n\n###\n\n", "completion": "3x3 intersecting lines with diagonals. Play occurs on the intersections of the lines. Players each have three pieces, initially placed on the sides closest to the player. Players move the pieces to an adjacent unoccupied intersection along the lines. The goal is to make three in a row which cannot be in the starting position. END" }, { "prompt": "Construct a Ludii game based on the following description\nThe black player has a normal set of chess pieces. The white player has a single piece which can move either as a queen or as a knight. Black's goal is to checkmate the white piece, White's goal is to checkmate the black king. There is no pawn promotion. \n\n###\n\n", "completion": "(define \"InLocationEnPassant\" (and (is Pending) (= (to) (value Pending)))) (define \"SetEnPassantLocation\" (then (set Pending (ahead (last To) Backward)))) (define \"BigCastling\" (\"DoCastle\" \"King\" W 2 \"KingNotCheckedAndToEmpty\" (then (and (\"PieceHasMoved\") (\"DoCastle\" \"RookLeft\" E 3 True))))) (define \"SmallCastling\" (\"DoCastle\" \"King\" E 2 \"KingNotCheckedAndToEmpty\" (then (and (\"PieceHasMoved\") (\"DoCastle\" \"RookRight\" W 2 True))))) (define \"DoCastle\" (move Slide (from (mapEntry #1 (mover))) #2 (between (exact #3) if:#4) #5)) (define \"KingNotCheckedAndToEmpty\" (and (is Empty (to)) (not (\"IsInCheck\" \"King\" Mover at:(to))))) (define \"CaptureToPieceAndResetCounter\" (apply (if (\"IsEnemyAt\" (to)) (remove (to) (then (set Counter)))))) (define \"RememberPieceHasMoved\" (then (if (= (state at:(last To)) 1) \"PieceHasMoved\"))) (define \"PieceHasMoved\" (set State at:(last To) 0)) (define \"HasNeverMoved\" (= (state at:(mapEntry #1 (mover))) 1)) (define \"KingInTheInitialPlace\" (= (what at:(mapEntry \"King\" (mover))) (id \"King\" Mover))) (define \"NextCanNotMoveToProtect\" (not (can Move (do (forEach Piece Next) ifAfterwards:(not (\"IsInCheck\" #1 Next)))))) (game \"Maharajah Chess\" (players 2) (equipment { (board (square 8)) (piece \"Pawn\" P2 S (or { (if (is In (from) (sites Start (piece (what at:(from))))) (\"DoubleStepForwardToEmpty\")) \"StepForwardToEmpty\" (\"StepToEnemy\" (directions {FR FL}))} (then (set Counter)))) (piece \"Rook\" P2 (\"SlideCapture\" Orthogonal ~ (then (set Counter)) \"RememberPieceHasMoved\")) (piece \"King\" P2 (move Step (to if:(not (\"IsFriendAt\" (to))) \"CaptureToPieceAndResetCounter\") \"RememberPieceHasMoved\")) (piece \"Bishop\" P2 (move Slide Diagonal (to if:(\"IsEnemyAt\" (to)) \"CaptureToPieceAndResetCounter\"))) (piece \"Knight\" P2 (\"LeapCapture\" \"KnightWalk\" (then (set Counter)))) (piece \"Queen\" P2 (move Slide (to if:(\"IsEnemyAt\" (to)) \"CaptureToPieceAndResetCounter\"))) (piece \"Amazon\" P1 (or (\"LeapCapture\" \"KnightWalk\" (then (set Counter))) (\"SlideCapture\" ~ ~ (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\")})}) (rules (start { (place \"Pawn2\" (sites Row 6)) (place \"Amazon1\" coord:\"E1\") (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 (do (or (forEach Piece) (if (and { (is Mover P2) \"KingInTheInitialPlace\" (\"HasNeverMoved\" \"King\") (not (\"IsInCheck\" \"King\" Mover))}) (or (if (and (\"HasNeverMoved\" \"RookLeft\") (can Move (\"DoCastle\" \"RookLeft\" E 3 (is Empty (to))))) \"BigCastling\") (if (and (\"HasNeverMoved\" \"RookRight\") (can Move (\"DoCastle\" \"RookRight\" W 2 (is Empty (to))))) \"SmallCastling\")))) ifAfterwards:(if (is Mover P1) (not (\"IsInCheck\" \"Amazon\" Mover)) (not (\"IsInCheck\" \"King\" Mover))))) (end { (if (if (is Mover P1) (and (\"IsInCheck\" \"King\" Next) (\"NextCanNotMoveToProtect\" \"King\")) (and (\"IsInCheck\" \"Amazon\" Next) (\"NextCanNotMoveToProtect\" \"Amazon\"))) (result Mover Win)) (if (or (no Moves Mover) (= (counter) 100)) (result Mover Draw))}))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nOrder 3 board - about 5 moves each -> Order 4 board - about 11 moves each\nTriangle-Square N-2 all directions connect paths to edge - Orthogonal only form groups, about 10% more moves -> Triangle-Square N-2 Orthogonal connections to edge - ALl direction form groups\nScoring Option: Score the size of your largest group, then score an additional point for every opponent's group on the board. -> Scoring Option: No bonus. Score a point only for each piece in your largest group\n(define \"ColourBackground\" (colour 126 130 156)) (define \"TriSquare\" (board (tiling T33434 (- 3 2)) use:Vertex)) (define \"HexCell\" (board (hex Hexagon 3) use:Cell)) (define \"Hex2Limp\" (board (hex (- 3 1) (+ 3 1)) use:Cell)) (define \"HexLimp\" (board (hex Limping (- 3 1)) use:Cell)) (define \"BoardUsed\" \"TriSquare\") (define \"ConnectionDirection\" All) (define \"ScoreConnectionDirection\" Adjacent) (define \"AllHave1Connection2Edge\" (all Sites #1 if:(or (and (is Empty (site)) (is In (site) (sites Outer))) (!= Infinity (count Steps (step \"ConnectionDirection\" (to if:(is Empty (to)))) (site) (difference (sites Outer) (site))))))) (define \"CascadeTiebreaker\" (if (= (var \"MoverScore\") (var \"NextScore\")) (and (set Score Mover (* -1 (\"CascadeScore\" Mover Next))) (set Score Next (* -1 (\"CascadeScore\" Next Mover)))) (\"NoTiebreaker\"))) (define \"NoTiebreaker\" (and (set Score Mover (var \"MoverScore\")) (set Score Next (var \"NextScore\")))) (define \"CascadeScore\" (max 0 (max (difference (sizes Group \"ScoreConnectionDirection\" #1) (sizes Group \"ScoreConnectionDirection\" #2))))) (define \"BonusOpponent\" (set Var \"MoverScore\" (+ (\"GroupCount\" Mover) (count Groups \"ScoreConnectionDirection\" if:(= (who at:(to)) (next)))) (then (set Var \"NextScore\" (+ (\"GroupCount\" Next) (count Groups \"ScoreConnectionDirection\" if:(= (who at:(to)) (mover)))) (then (\"CascadeTiebreaker\")))))) (define \"BonusMover\" (set Var \"MoverScore\" (+ (\"GroupCount\" Mover) (count Groups \"ScoreConnectionDirection\" if:(= (who at:(to)) (mover)))) (then (set Var \"NextScore\" (+ (\"GroupCount\" Next) (count Groups \"ScoreConnectionDirection\" if:(= (who at:(to)) (next)))) (then (\"CascadeTiebreaker\")))))) (define \"GroupScore\" (set Var \"MoverScore\" (\"GroupCount\" Mover) (then (set Var \"NextScore\" (\"GroupCount\" Next) (then (\"CascadeTiebreaker\")))))) (define \"GroupCount\" (max 0 (max (sizes Group \"ScoreConnectionDirection\" #1)))) (game \"Brain Coral\" (players 2) (equipment { \"BoardUsed\" (piece \"Ball\" Each) (piece \"Disc\" Each)}) (rules (start (set Score Each 0)) (play (do (move Add (to (sites Empty))) ifAfterwards:(\"AllHave1Connection2Edge\" (sites Around (last To) \"ConnectionDirection\" includeSelf:True)) (then \"BonusOpponent\"))) (end (if (no Moves Next) { (if (= (score Mover) (score Next)) (result Mover Win)) (if (!= (score Mover) (score Next)) (byScore))}))))\n\n###\n\n", "completion": "(define \"ColourBackground\" (colour 126 130 156)) (define \"TriSquare\" (board (tiling T33434 (- 4 2)) use:Vertex)) (define \"HexCell\" (board (hex Hexagon 4) use:Cell)) (define \"Hex2Limp\" (board (hex (- 4 1) (+ 4 1)) use:Cell)) (define \"HexLimp\" (board (hex Limping (- 4 1)) use:Cell)) (define \"BoardUsed\" \"TriSquare\") (define \"ConnectionDirection\" Adjacent) (define \"ScoreConnectionDirection\" All) (define \"AllHave1Connection2Edge\" (all Sites #1 if:(or (and (is Empty (site)) (is In (site) (sites Outer))) (!= Infinity (count Steps (step \"ConnectionDirection\" (to if:(is Empty (to)))) (site) (difference (sites Outer) (site))))))) (define \"CascadeTiebreaker\" (if (= (var \"MoverScore\") (var \"NextScore\")) (and (set Score Mover (* -1 (\"CascadeScore\" Mover Next))) (set Score Next (* -1 (\"CascadeScore\" Next Mover)))) (\"NoTiebreaker\"))) (define \"NoTiebreaker\" (and (set Score Mover (var \"MoverScore\")) (set Score Next (var \"NextScore\")))) (define \"CascadeScore\" (max 0 (max (difference (sizes Group \"ScoreConnectionDirection\" #1) (sizes Group \"ScoreConnectionDirection\" #2))))) (define \"BonusOpponent\" (set Var \"MoverScore\" (+ (\"GroupCount\" Mover) (count Groups \"ScoreConnectionDirection\" if:(= (who at:(to)) (next)))) (then (set Var \"NextScore\" (+ (\"GroupCount\" Next) (count Groups \"ScoreConnectionDirection\" if:(= (who at:(to)) (mover)))) (then (\"CascadeTiebreaker\")))))) (define \"BonusMover\" (set Var \"MoverScore\" (+ (\"GroupCount\" Mover) (count Groups \"ScoreConnectionDirection\" if:(= (who at:(to)) (mover)))) (then (set Var \"NextScore\" (+ (\"GroupCount\" Next) (count Groups \"ScoreConnectionDirection\" if:(= (who at:(to)) (next)))) (then (\"CascadeTiebreaker\")))))) (define \"GroupScore\" (set Var \"MoverScore\" (\"GroupCount\" Mover) (then (set Var \"NextScore\" (\"GroupCount\" Next) (then (\"CascadeTiebreaker\")))))) (define \"GroupCount\" (max 0 (max (sizes Group \"ScoreConnectionDirection\" #1)))) (game \"Brain Coral\" (players 2) (equipment { \"BoardUsed\" (piece \"Ball\" Each) (piece \"Disc\" Each)}) (rules (start (set Score Each 0)) (play (do (move Add (to (sites Empty))) ifAfterwards:(\"AllHave1Connection2Edge\" (sites Around (last To) \"ConnectionDirection\" includeSelf:True)) (then \"GroupScore\"))) (end (if (no Moves Next) { (if (= (score Mover) (score Next)) (result Mover Win)) (if (!= (score Mover) (score Next)) (byScore))})))) END" }, { "prompt": "Construct a Ludii game based on the following description\nSix dots ('vertices') are drawn. Each dot is connected to every other dot by a line ('edge'). Two players take turns colouring any uncoloured lines. One player colours in one colour, and the other colours in another colour, with each player trying to avoid the creation of a triangle made solely of their colour (only triangles with the dots as corners count; intersections of lines are not relevant); the player who completes such a triangle loses immediately. \n\n###\n\n", "completion": "(game \"Sim\" (players 2) (equipment { (board (complete (regular Star 6)) use:Edge)}) (rules (play (move Add (to Edge (sites Empty Edge)))) (end (if (is Path Edge Mover length:(exact 3) closed:True) (result Mover Loss))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlay begins with the pieces arranged in the last row of squares on opposite sides of the board. Pieces move as rooks in Chess. An opponent's piece is captured by surrounding it on two opposite sides by a player's piece. Play continues until all but one player's pieces are captured. \n\n###\n\n", "completion": "(define \"SurroundCaptures\" (surround (from (last To)) Orthogonal (between if:(and (is In (between) (sites Corners)) (\"IsEnemyAt\" (between))) (apply (remove (between)))) (to if:(\"IsFriendAt\" (to))))) (game \"Hasami Shogi\" (players 2) (equipment { (board (square 9)) (piece \"Fuhyo\" P1 (move Slide Orthogonal (then (or (\"CustodialCapture\" Orthogonal (max 1)) \"SurroundCaptures\")))) (piece \"Tokin\" P2 (move Slide Orthogonal (then (or (\"CustodialCapture\" Orthogonal (max 1)) \"SurroundCaptures\"))))}) (rules (start { (place \"Fuhyo1\" (sites Bottom)) (place \"Tokin2\" (sites Top))}) (play (forEach Piece)) (end (if (= (count Pieces Next) 1) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nSquare board, divided into eight equal triangles, with the central horizonal line extended past the square on either side and lines connecting the end point to the two nearby corners of the square One player plays as the hare, the other player as three hounds. Players take turns placing one of their pieces on the board. When a player has placed all their pieces, they move to an adjacent empty spot. When the hounds block the hare from being able to move, the hounds win.\n The game has an ending condition only for P1.\n\n###\n\n", "completion": "(game \"Haretavl\" (players 2) (equipment { (\"ThreeMensMorrisBoardWithLeftAndRightTriangles\") (hand Each) (piece \"Dog\" P1 \"StepToEmpty\") (piece \"Hare\" P2 \"StepToEmpty\")}) (rules (start { (place \"Dog1\" (handSite P1) count:3) (place \"Hare2\" (handSite P2))}) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (\"PhaseMovePiece\" \"Movement\")} (end { (if (no Moves P2) (result P1 Win))}))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"PlayerPiece\" (piece (if (is Mover P1) (id \"Disc\" P1) (id \"Cross\" P2)))) (game \"Tic-Tac-Die\" (players 2) (equipment { (board (square 3)) (piece \"Disc\" P1) (piece \"Cross\" P2) (dice d:9 from:0 num:1)}) (rules (play (\"RollMove\" (if (is Empty (count Pips)) (move Add (\"PlayerPiece\") (to (count Pips))) (move Pass (then (moveAgain)))))) (end { (\"Line3Win\") (if (is Full) (result Mover Draw))})))\n\n###\n\n", "completion": "Play occurs on a 3x3 grid. One player places an X, the other places an O and players take turns placing their marks in the grid, attempting to get three in a row. The die is showing the cell index to place a piece. Players reroll until they roll an empty cell. END" }, { "prompt": "Construct a Ludii game based on the following description\nCage is a checkers variant for two players played on a square 10x10 board. In this implementation you also have the option of playing on smaller boards. In the initial position, 50 checkers of one color and 50 checkers of a different color fill up the board in a checkered pattern. The goal of the game is to capture all your opponent's checkers.\n \n On your turn, if you can, you must choose one of two different kinds of moves to perform:\n \u2022 a single step, or\n \u2022 a sequence of jumps.\n Note: A single jump is considered a jump sequence of length 1.\n \n Universal restriction:\n All moves are subject to the following restriction:\n \u2022 At no time may a checker be orthogonally adjacent to a checker of the same color.\n \n Stepping:\n Stepping is moving one of your checkers to an orthogonally or diagonally adjacent empty square, and this kind of move is subject to the following two additional restrictions:\n \u2022 A step my never bring the number of orthogonal enemy neighbors of the moved checker down to 0.\n \u2022 The only condition under which a step may fail to bring the moved checker closer to the center of the line you are moving along is if it brings its number of orthogonal enemy neighbors up from 0.\n \n (Some elaboration on this last restriction: In general, a step must decrease the moved checker's straight line distance to the board's central intersection. That's the same as bringing it closer to the center of the orthogonal or diagonal line you are moving along. (Note: The center of a diagonal line is an intersection if it is an even number of squares long, and a square otherwise. The center of an orthogonal line is an edge if it is an even number of squares long, and a square otherwise.) Here is a different way of putting it: Whatever diagonal or orthogonal line you are stepping along, the largest distance to an edge square on this line before the step must be bigger than the largest distance to an edge square on the same line after the step. The only exception to this rule, as explained in the last restriction, is if your checker has no orthogonal neighbors and can step into such a relationship \u2013 then you may step in any direction.)\n \n Jumping sequences:\n If a checker of your color is orthogonally adjacent to an enemy checker, and immediately on the opposite side of that enemy checker is either an empty square or the outside of the board, your checker may initiate a sequence of jumps. You do this by jumping your checker over to the opposite side of the enemy checker and immediately removing the jumped piece. If your checker lands outside the board, it too is removed from the board. Note: If your last checker is removed when you capture your opponent's last checker, you still win.\n \n If the jumping checker lands in a position where it can jump again, your turn does not end, and the checker must make yet a jump. If there are several ways to continue the sequence, you may choose freely between these. The sequence of jumps only ends when the checker lands on a square where it can make no further jump. A 10x10 board is currently selected\n\n###\n\n", "completion": "(define \"Step\" (move Step (from) (to if:(and { (is Empty (to)) (= 0 (count Sites in:(difference (sites Around (to) Own Orthogonal) (sites {(from)})))) (not (and (< 0 (count Sites in:(sites Around (from) Enemy Orthogonal))) (= 0 (count Sites in:(sites Around (to) Enemy Orthogonal))))) (or { (and (= 0 (count Sites in:(sites Around (from) Enemy Orthogonal))) (< 0 (count Sites in:(sites Around (to) Enemy Orthogonal)))) (or { (and (or (= (from) (+ (to) 12)) (= (from) (- (to) 12))) (\"Inward\" N S)) (and (or (= (from) (+ (to) 1)) (= (from) (- (to) 1))) (\"Inward\" E W)) (and (or (= (from) (+ (to) (+ 12 1))) (= (from) (- (to) (+ 12 1)))) (\"Inward\" SW NE)) (and (or (= (from) (+ (to) (- 12 1))) (= (from) (- (to) (- 12 1)))) (\"Inward\" SE NW))})})})))) (define \"Hop\" (move Hop (from #1) Orthogonal (between if:(is Occupied (between)) (apply (remove (between)))) (to if:(and { (is Empty (to)) (= 0 (count Sites in:(sites Around (to) Own Orthogonal)))})) (then (and { (remove (sites Outer)) (set Var 1) (if (can Move (move Hop (from (last To)) Orthogonal (between if:(is Occupied (between)) (apply (remove (between)))) (to if:(and { (is Empty (to)) (= 0 (count Sites in:(sites Around (to) Own Orthogonal)))})))) (moveAgain) (set Var 0))})))) (define \"Inward\" (> (max (count Sites in:(sites Direction from:(from) #1)) (count Sites in:(sites Direction from:(from) #2))) (max (count Sites in:(sites Direction from:(to) #1)) (count Sites in:(sites Direction from:(to) #2))))) (game \"Cage\" (players 2) (equipment { (board (square 12)) (piece \"Disc\" Each)}) (rules (start { (place \"Disc1\" (difference (sites Phase 0) (sites Outer))) (place \"Disc2\" (difference (sites Phase 1) (sites Outer)))}) (play (forEach Piece (if (!= 1 (var)) (or (\"Hop\" ~) (\"Step\")) (\"Hop\" if:(= (from) (last To)))))) (end (if (or (= 0 (count Sites in:(sites Occupied by:P1))) (= 0 (count Sites in:(sites Occupied by:P2)))) (result Mover Win))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"Columns\" 8) (game \"Nsumbi\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"0,E,N1,W\" loop:True P1) (track \"Track2\" \"16,E,N1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"Track1\")) (regions \"Home\" P2 (sites Track \"Track2\")) (regions \"Inner\" P1 (difference (sites Track \"Track1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"Track2\") (sites Top))) (piece \"Seed\" Shared)}) (rules (start (set Count 2 to:(union (sites P1 \"Home\") (sites P2 \"Home\")))) phases:{ (phase \"Opening\" (play (move Select (from (sites Mover)) (then (sow \"Track\" owner:(mover))))) (nextPhase Mover \"Playing\")) (phase \"Playing\" (play (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover)) if:(< 1 (count at:(from)))) (then (sow \"Track\" owner:(mover) apply:(if (and { (< 1 (count at:(to))) (is In (to) (sites Mover \"Inner\")) (> (count at:(\"OppositePit\" (to))) 0) (> (count at:(\"OppositeOuterPit\" (to))) 0)}) (and { (fromTo (from (\"OppositePit\" (to))) (to (last From)) count:(count at:(\"OppositePit\" (to)))) (fromTo (from (\"OppositeOuterPit\" (to))) (to (last From)) count:(count at:(\"OppositeOuterPit\" (to)))) (sow (last From) count:(+ (count at:(\"OppositePit\" (to))) (count at:(\"OppositeOuterPit\" (to)))) \"Track\" owner:(mover) origin:True)}) (if (< 1 (count at:(to))) (moveAgain))))))))} (end (\"BlockWin\"))))\n\n###\n\n", "completion": "4x8 board. Two counters in each hole. Players sow in an anti-clockwise direction from any of their holes. Singletons may not be sowed. Players capture when the sowing ends in a player's inner row and the opponent's inner and outer row holes opposite contain counters; these are captured and sown in the player's rows starting from the same hole that the previous sowing began. If the final counter lands in an occupied hole but capture is not possible, the counters in this hole are picked up and sowing continues. If the final counter ends in an empty hole, the turn ends. Captures cannot be made on each player's first turn. Play continues until one player has no holes with two or more counters, and the opponent wins. END" }, { "prompt": "Construct a Ludii game based on the following description\n4x13, 19, 21, or 29 board. The number of pieces per player equals the number of spaces in a row, which begin the game arrayed in the outer rows of the board. Four sticks, each with a white side and a yellow side. Throws equal the number of white sides which fall up; when only yellow sides are up the throw equals 6. A throw of 1, 4, or 6 grants another throw to the player. Players perform all of their throws first, and then move pieces according to the values of the throws without subdividing the value of a single throw. Players cannot move their pieces until the throw a 1. Pieces cannot move past one another in the home row. Each piece in the home row must individually be unlocked with a throw of 1 before it can move. In the central rows, when two of a player's pieces land on the same spot, they become a king and can be moved as one piece. There is no limit to the number of pieces in the king. They may be uncoupled with a throw of 1, or another throw which removes that number of pieces from the king. When a player's piece lands in a space occupied by an opponent's piece, the opponent's piece is removed from the board. Play progresses from left to right in the player's home row, and then from right to left in the second row, left to right in the third row, and then right to left in the opponent's row. When a piece enters the opponent's row, it cannot move if there are other pieces which can be moved. The player to capture the most of the opponent's pieces wins. The board has 13 columns.\n\n###\n\n", "completion": "(define \"AllPieceInOpponentHome\" (and (= (count Sites in:(difference (sites Occupied by:P1) (sites P2))) 0) (= (count Sites in:(difference (sites Occupied by:P2) (sites P1))) 0))) (define \"CreateAKing\" (move (from) (to (\"NextSiteOnTrack\" (\"ThrowValue\"))))) (define \"UncoupledKing\" (\"Move\" (\"ThrowValue\"))) (define \"KingMove\" (\"Move\" (count at:(from)))) (define \"Move\" (move (from) (to (\"NextSiteOnTrack\" (\"ThrowValue\")) \"CaptureEnemyPiece\") count:#1)) (define \"ThrowEqualSizeKingMinusOne\" (= (+ (\"ThrowValue\") 1) (count at:(from)))) (define \"OpponentPieceAtHome\" (= (count Sites in:(intersection (sites Occupied by:Next) (sites Next))) 0)) (define \"InOpponentHome\" (is In (from) (sites Next))) (define \"InactivePiece\" (= (state at:(from)) 1)) (define \"ActivatedPiece\" (= (state at:(from)) 0)) (define \"ActivatePiece\" (set State at:(last To) 0)) (define \"CaptureEnemyPiece\" (apply if:(\"IsEnemyAt\" (to)) (remove (to) (then (addScore Mover 1))))) (define \"ThrowValue\" (mapEntry (count Pips))) (game \"At-Tab wa-d-Dukk\" (players 2) (equipment { (board (rectangle 4 13) { (track \"Track1\" \"0,E,N1,W,N1,E,N1,W\" P1 directed:True) (track \"Track2\" \"51,W,S1,E,S1,W,S1,E\" P2 directed:True)}) (\"StickDice\" 4) (map {(pair 0 6) (pair 1 1) (pair 2 2) (pair 3 3) (pair 4 4)}) (piece \"Marker\" Each (if (or (\"ActivatedPiece\") (and (= 1 (\"ThrowValue\")) (\"InactivePiece\"))) (if (\"IsNotOffBoard\" (\"NextSiteOnTrack\" (\"ThrowValue\"))) (if (or (not (\"InOpponentHome\")) (and (\"InOpponentHome\") (\"OpponentPieceAtHome\"))) (if (or (is In (\"NextSiteOnTrack\" (\"ThrowValue\")) (sites Empty)) (\"IsEnemyAt\" (\"NextSiteOnTrack\" (\"ThrowValue\")))) (or (if (\"ThrowEqualSizeKingMinusOne\") (\"UncoupledKing\")) (\"KingMove\")) (if (and (is In (\"NextSiteOnTrack\" (\"ThrowValue\")) (sites \"CentralRows\")) (\"IsFriendAt\" (\"NextSiteOnTrack\" (\"ThrowValue\")))) (\"CreateAKing\")))) (then (\"ActivatePiece\"))))) (regions \"AnotherThrow\" (sites {1 4 6})) (regions \"CentralRows\" (union (sites Row 1) (sites Row 2))) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start { (place \"Marker1\" (sites Bottom) state:1) (place \"Marker2\" (sites Top) state:1)}) (play (\"RollMove\" (if (can Move (forEach Piece)) (forEach Piece (then (if (is In (\"ThrowValue\") (sites \"AnotherThrow\")) (moveAgain)))) (move Pass (then (if (is In (\"ThrowValue\") (sites \"AnotherThrow\")) (moveAgain))))))) (end (if (or (\"AllPieceInOpponentHome\") (no Pieces Mover)) (byScore))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayers take turns placing stones of their color on empty squares. If you place orthogonally adjacent to more than 2 stones, regardless of their color, you must place again. You continue until you place orthogonally adjacent to 2 or fewer stones. When the board is full, the player with the most stones on the board is the winner. A 7x7 playing area is currently selected\n\n###\n\n", "completion": "(game \"Flume\" (players 2) (equipment { (board (square 9)) (piece \"Disc\" Each) (piece \"Disc\" Neutral)}) (rules (meta (swap)) (start (place \"Disc0\" (sites Outer))) (play (move Add (to (sites Empty)) (then (and (addScore Mover 1) (if (< 2 (count Sites in:(sites Around (last To) NotEmpty Orthogonal))) (moveAgain)))))) (end (if (is Full) (byScore))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nRules are the same as Chess except pawns may move up to four squares on their first move and kings may only castle on their own half of the board. The player that checkmates one of the opposing kings wins. \n\n###\n\n", "completion": "(define \"EnPassant\" (move Step (directions {FR FL}) (to if:\"InLocationEnPassant\") (then (remove (\"LastPawnMoved\"))))) (define \"LastPawnMoved\" (var)) (define \"InLocationEnPassant\" (is In (to) (sites Pending))) (define \"InitialPawnMove\" (forEach Value min:2 max:4 (move Slide Forward (between (exact (value)) if:(is Empty (between)) (apply (set Pending (between)))) (to if:(is Empty (to))) \"SetEnPassantLocation\"))) (define \"SetEnPassantLocation\" (then (set Var (last To)))) (define \"BigRightCastling\" (\"DoCastle\" \"KingRight\" W 2 \"KingNotCheckedAndToEmpty\" (then (and (\"PieceHasMoved\") (\"DoCastle\" \"RookRightRight\" E 3 True))))) (define \"BigLeftCastling\" (\"DoCastle\" \"KingLeft\" W 2 \"KingNotCheckedAndToEmpty\" (then (and (\"PieceHasMoved\") (\"DoCastle\" \"RookLeftLeft\" E 3 True))))) (define \"SmallRightCastling\" (\"DoCastle\" \"KingRight\" E 2 \"KingNotCheckedAndToEmpty\" (then (and (\"PieceHasMoved\") (\"DoCastle\" \"RookRightRight\" W 2 True))))) (define \"SmallLeftCastling\" (\"DoCastle\" \"KingLeft\" E 2 \"KingNotCheckedAndToEmpty\" (then (and (\"PieceHasMoved\") (\"DoCastle\" \"RookLeftRight\" W 2 True))))) (define \"DoCastle\" (move Slide (from (mapEntry #1 (mover))) #2 (between (exact #3) if:#4) #5)) (define \"KingNotCheckedAndToEmpty\" (and (is Empty (to)) (not (\"IsInCheck\" \"King\" Mover at:(to))))) (define \"CaptureToPieceAndResetCounter\" (apply (if (\"IsEnemyAt\" (to)) (remove (to) (then (set Counter)))))) (define \"RememberPieceHasMoved\" (then (if (= (state at:(last To)) 1) \"PieceHasMoved\"))) (define \"PieceHasMoved\" (set State at:(last To) 0)) (define \"HasNeverMoved\" (= (state at:(mapEntry #1 (mover))) 1)) (define \"InTheInitialPlace\" (= (what at:(mapEntry #1 (mover))) (id \"King\" Mover))) (define \"NextCanNotMove\" (not (can Move (do (forEach Piece Next) ifAfterwards:(not (\"IsInCheck\" \"King\" Next in:(sites Occupied by:Next component:\"King\"))))))) (game \"Double Chess\" (\"TwoPlayersNorthSouth\") (equipment { (board (rectangle 12 16)) (piece \"Pawn\" Each (or { (if (is In (from) (sites Start (piece (what at:(from))))) \"InitialPawnMove\") \"StepForwardToEmpty\" (\"StepToEnemy\" (directions {FR FL})) \"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 \"KingLeft\" {(pair 1 \"E1\") (pair 2 \"E12\")}) (map \"RookLeftLeft\" {(pair 1 \"A1\") (pair 2 \"A12\")}) (map \"RookLeftRight\" {(pair 1 \"H1\") (pair 2 \"H12\")}) (map \"KingRight\" {(pair 1 \"M1\") (pair 2 \"M12\")}) (map \"RookRightLeft\" {(pair 1 \"I1\") (pair 2 \"I12\")}) (map \"RookRightRight\" {(pair 1 \"P1\") (pair 2 \"P12\")}) (regions \"Promotion\" P1 (sites Top)) (regions \"Promotion\" P2 (sites Bottom))}) (rules (start { (place \"Pawn1\" (sites Row 1)) (place \"Pawn2\" (sites Row 10)) (place \"Rook1\" {\"A1\" \"H1\" \"I1\" \"P1\"} state:1) (place \"Knight1\" {\"B1\" \"G1\" \"J1\" \"O1\"}) (place \"Bishop1\" {\"C1\" \"F1\" \"K1\" \"N1\"}) (place \"Queen1\" {\"D1\" \"L1\"}) (place \"King1\" {\"E1\" \"M1\"} state:1) (place \"Rook2\" {\"A12\" \"H12\" \"I12\" \"P12\"} state:1) (place \"Knight2\" {\"B12\" \"G12\" \"J12\" \"O12\"}) (place \"Bishop2\" {\"C12\" \"F12\" \"K12\" \"N12\"}) (place \"Queen2\" {\"D12\" \"L12\"}) (place \"King2\" {\"E12\" \"M12\"} state:1)}) (play (if \"SameTurn\" (move Promote (last To) (piece {\"Queen\" \"Knight\" \"Bishop\" \"Rook\"}) Mover) (or (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King\" Mover in:(sites Occupied by:Mover component:\"King\")))) (or (if (and { (\"InTheInitialPlace\" \"KingLeft\") (\"HasNeverMoved\" \"KingLeft\") (not (\"IsInCheck\" \"King\" Mover at:(mapEntry \"KingLeft\" (mover))))}) (or (if (and (\"HasNeverMoved\" \"RookLeftLeft\") (can Move (\"DoCastle\" \"RookLeftLeft\" E 3 (is Empty (to))))) \"BigLeftCastling\") (if (and (\"HasNeverMoved\" \"RookLeftRight\") (can Move (\"DoCastle\" \"RookLeftRight\" W 2 (is Empty (to))))) \"SmallLeftCastling\"))) (if (and { (\"InTheInitialPlace\" \"KingRight\") (\"HasNeverMoved\" \"KingRight\") (not (\"IsInCheck\" \"King\" Mover at:(mapEntry \"KingRight\" (mover))))}) (or (if (and (\"HasNeverMoved\" \"RookRightLeft\") (can Move (\"DoCastle\" \"RookRightLeft\" E 3 (is Empty (to))))) \"BigRightCastling\") (if (and (\"HasNeverMoved\" \"RookRightRight\") (can Move (\"DoCastle\" \"RookRightRight\" W 2 (is Empty (to))))) \"SmallRightCastling\"))))))) (end { (if (or (no Moves Mover) (= (counter) 100)) (result Mover Draw)) (if (and (\"IsInCheck\" \"King\" Next in:(sites Occupied by:Next component:\"King\")) (\"NextCanNotMove\")) (result Mover Win))}))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game is played on a 4x4 board. -> The game is played on a 5x5 board.\n(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 \"Halma\" (players 2) (equipment { (board (square (\"Dim\"))) (piece \"Counter\" Each) (regions \"Home\" P1 (difference (expand (intersection (sites Bottom) (sites Right)) steps:(+ 1 (/ (\"Dim\") 4)) Orthogonal) (sites { (ahead (coord row:0 column:(- (\"Dim\") 1)) steps:(+ 1 (/ (\"Dim\") 4)) N) (ahead (coord row:0 column:(- (\"Dim\") 1)) steps:(+ 1 (/ (\"Dim\") 4)) W)}))) (regions \"Home\" P2 (difference (expand (intersection (sites Top) (sites Left)) steps:(+ 1 (/ (\"Dim\") 4)) Orthogonal) (sites { (ahead (coord row:(- (\"Dim\") 1) column:0) steps:(+ 1 (/ (\"Dim\") 4)) E) (ahead (coord row:(- (\"Dim\") 1) column:0) steps:(+ 1 (/ (\"Dim\") 4)) S)}))) (map {(pair P1 P2) (pair P2 P1)})}) (rules (start { (place \"Counter1\" (sites P1)) (place \"Counter2\" (sites P2))}) phases:{ (phase \"Movement\" (play (forEach Piece (or (\"HopSequence\" (from)) (move Step (to if:(and (is Empty (to)) (or (not (\"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\" 5) (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 \"Halma\" (players 2) (equipment { (board (square (\"Dim\"))) (piece \"Counter\" Each) (regions \"Home\" P1 (difference (expand (intersection (sites Bottom) (sites Right)) steps:(+ 1 (/ (\"Dim\") 4)) Orthogonal) (sites { (ahead (coord row:0 column:(- (\"Dim\") 1)) steps:(+ 1 (/ (\"Dim\") 4)) N) (ahead (coord row:0 column:(- (\"Dim\") 1)) steps:(+ 1 (/ (\"Dim\") 4)) W)}))) (regions \"Home\" P2 (difference (expand (intersection (sites Top) (sites Left)) steps:(+ 1 (/ (\"Dim\") 4)) Orthogonal) (sites { (ahead (coord row:(- (\"Dim\") 1) column:0) steps:(+ 1 (/ (\"Dim\") 4)) E) (ahead (coord row:(- (\"Dim\") 1) column:0) steps:(+ 1 (/ (\"Dim\") 4)) S)}))) (map {(pair P1 P2) (pair P2 P1)})}) (rules (start { (place \"Counter1\" (sites P1)) (place \"Counter2\" (sites P2))}) phases:{ (phase \"Movement\" (play (forEach Piece (or (\"HopSequence\" (from)) (move Step (to if:(and (is Empty (to)) (or (not (\"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": "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. A stalemate is considered a draw. \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 \"Main Chator (Batak)\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (piece \"King_noCross\" (or (\"StepToNotFriend\") (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))))))) (\"ChessRook\" \"Rook\" ~ (then (if (and (not (\"RookMovedBefore\" (last To))) (not (is In (last To) (\"SitesNextToKing\")))) (\"RememberRookMoved\" (last To))))) (\"ChessBishop\" \"Bishop_noCross\") (\"ChessKnight\" \"Knight\") (piece \"Pawn\" (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\" (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)))))) (\"ChessQueen\" \"Queen\")}) (rules (start { (place \"Pawn1\" (sites Row 1)) (place \"Pawn2\" (sites Row 6)) (place \"Rook1\" {\"A1\" \"H1\"}) (place \"Knight1\" {\"B1\" \"G1\"}) (place \"Bishop_noCross1\" {\"C1\" \"F1\"}) (place \"Queen1\" coord:\"E1\") (place \"King_noCross1\" coord:\"D1\") (place \"Rook2\" {\"A8\" \"H8\"}) (place \"Knight2\" {\"B8\" \"G8\"}) (place \"Bishop_noCross2\" {\"C8\" \"F8\"}) (place \"Queen2\" coord:\"D8\") (place \"King_noCross2\" coord:\"E8\")}) (play (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King_noCross\" Mover)))) (end { (\"Checkmate\" \"King_noCross\") (\"DrawIfNoMoves\" Next)}))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nEach row has 21 holes. -> Each row has 22 holes.\n(define \"PiecesOwnedBy\" (count Sites in:(sites Occupied by:#1))) (define \"AllPiecesInOpponentHome\" (and (= 0 (count Sites in:(difference (sites Occupied by:Team1) (sites P2 \"Home\")))) (= 0 (count Sites in:(difference (sites Occupied by:Team2) (sites P1 \"Home\")))))) (define \"Move\" (move (from (site)) (to (\"NextSiteOnTrack\" \"ThrowValue\") if:(and (or (is Empty (to)) (and (not (is In (to) (sites Next \"Home\"))) (\"IsEnemyAt\" (to)))) (\"NoFriendPieceInBetween\" #1)) \"CaptureEnemyPiece\"))) (define \"NoFriendPieceInBetween\" (= 1 (count Sites in:(intersection (sites Occupied by:#1) (sites Track Mover \"Track\" from:(from) to:(\"NextSiteOnTrack\" \"ThrowValue\")))))) (define \"CaptureEnemyPiece\" (apply if:(\"IsEnemyAt\" (to)) (remove (to)))) (define \"SpecialThrows\" (is In (\"ThrowValue\") (sites {1 4}))) (define \"ThrowValue\" (mapEntry (count Pips))) (game \"Sig (Western Sahara)\" (players 4) (equipment { (board (rectangle 4 21) { (track \"Track1\" \"0,E,N1,W,N1,E,N1,W\" P1 directed:True) (track \"Track2\" \"83,W,S1,E,S1,W,S1,E\" P2 directed:True) (track \"Track3\" \"0,E,N1,W,N1,E,N1,W\" P3 directed:True) (track \"Track4\" \"83,W,S1,E,S1,W,S1,E\" P4 directed:True)} use:Vertex) (piece \"Stick\" Each) (regions \"AllSites\" (sites Board)) (\"StickDice\" 8) (map \"Throw\" {(pair 0 8) (pair 1 1) (pair 2 6) (pair 3 5) (pair 4 4) (pair 5 5) (pair 6 6) (pair 7 1) (pair 8 8)}) (regions \"Home\" P1 (sites Bottom)) (regions \"Home\" P2 (sites Top)) (regions \"Home\" P3 (sites Bottom)) (regions \"Home\" P4 (sites Top))}) (rules (start { (set Team 1 {P1 P3}) (set Team 2 {P2 P4}) (place \"Stick1\" (sites Bottom)) (place \"Stick2\" (sites Top))}) (play (\"RollMove\" (if (or (is Mover P1) (is Mover P3)) (forEach Site (sites Occupied by:Team1) (\"Move\" Team1)) (forEach Site (sites Occupied by:Team2) (\"Move\" Team2))) (then (if (\"SpecialThrows\") (moveAgain))))) (end (if (\"AllPiecesInOpponentHome\") { (if (= (\"PiecesOwnedBy\" Team1) (\"PiecesOwnedBy\" Team2)) (result Mover Draw)) (if (< (\"PiecesOwnedBy\" Team1) (\"PiecesOwnedBy\" Team2)) (result Team2 Win)) (if (> (\"PiecesOwnedBy\" Team1) (\"PiecesOwnedBy\" Team2)) (result Team1 Win))}))))\n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (count Sites in:(sites Occupied by:#1))) (define \"AllPiecesInOpponentHome\" (and (= 0 (count Sites in:(difference (sites Occupied by:Team1) (sites P2 \"Home\")))) (= 0 (count Sites in:(difference (sites Occupied by:Team2) (sites P1 \"Home\")))))) (define \"Move\" (move (from (site)) (to (\"NextSiteOnTrack\" \"ThrowValue\") if:(and (or (is Empty (to)) (and (not (is In (to) (sites Next \"Home\"))) (\"IsEnemyAt\" (to)))) (\"NoFriendPieceInBetween\" #1)) \"CaptureEnemyPiece\"))) (define \"NoFriendPieceInBetween\" (= 1 (count Sites in:(intersection (sites Occupied by:#1) (sites Track Mover \"Track\" from:(from) to:(\"NextSiteOnTrack\" \"ThrowValue\")))))) (define \"CaptureEnemyPiece\" (apply if:(\"IsEnemyAt\" (to)) (remove (to)))) (define \"SpecialThrows\" (is In (\"ThrowValue\") (sites {1 4}))) (define \"ThrowValue\" (mapEntry (count Pips))) (game \"Sig (Western Sahara)\" (players 4) (equipment { (board (rectangle 4 22) { (track \"Track1\" \"0,E,N1,W,N1,E,N1,W\" P1 directed:True) (track \"Track2\" \"87,W,S1,E,S1,W,S1,E\" P2 directed:True) (track \"Track3\" \"0,E,N1,W,N1,E,N1,W\" P3 directed:True) (track \"Track4\" \"87,W,S1,E,S1,W,S1,E\" P4 directed:True)} use:Vertex) (piece \"Stick\" Each) (regions \"AllSites\" (sites Board)) (\"StickDice\" 8) (map \"Throw\" {(pair 0 8) (pair 1 1) (pair 2 6) (pair 3 5) (pair 4 4) (pair 5 5) (pair 6 6) (pair 7 1) (pair 8 8)}) (regions \"Home\" P1 (sites Bottom)) (regions \"Home\" P2 (sites Top)) (regions \"Home\" P3 (sites Bottom)) (regions \"Home\" P4 (sites Top))}) (rules (start { (set Team 1 {P1 P3}) (set Team 2 {P2 P4}) (place \"Stick1\" (sites Bottom)) (place \"Stick2\" (sites Top))}) (play (\"RollMove\" (if (or (is Mover P1) (is Mover P3)) (forEach Site (sites Occupied by:Team1) (\"Move\" Team1)) (forEach Site (sites Occupied by:Team2) (\"Move\" Team2))) (then (if (\"SpecialThrows\") (moveAgain))))) (end (if (\"AllPiecesInOpponentHome\") { (if (= (\"PiecesOwnedBy\" Team1) (\"PiecesOwnedBy\" Team2)) (result Mover Draw)) (if (< (\"PiecesOwnedBy\" Team1) (\"PiecesOwnedBy\" Team2)) (result Team2 Win)) (if (> (\"PiecesOwnedBy\" Team1) (\"PiecesOwnedBy\" Team2)) (result Team1 Win))})))) END" }, { "prompt": "Construct a Ludii game based on the following description\nTwenty-three spaces are arranged in a line: the outer space on each side and the central space are a circular holes, the intervening spaces are vertically-oriented trenches. A stick is laid in each trench, and a stick is stuck into the ground in each end hole, one belonging to each player. They move their sticks toward the opposite end of the track and then go back to their starting point, according to the throw of four stick dice, with one flat and one convex side. The values of the throws are as follows: 4 convex sides up = 4, 3=0, 2=1, 1=0, 0=2. Players continue to throw and move until obtaining a result of 0. When the player passes the central hole, they remove the sticks from the trenches in which they land. If the player lands in the central hole, and throws a 0 on their next throw, they must then return to the space nearest to their home still containing a stick. If the player lands on the same place as the opponent, the opponent is sent back to the space nearest their home which still has a stick in it, thus eliminating this stick. The goal is to eliminate all of the sticks from the opponent's side of the board and then to land on the same space as the opponent's playing stick. If both players are in the end stage and trying to land on each other, and a player lands in the central space and then throws a 0, the game is a draw. \n\n###\n\n", "completion": "(define \"NearestHomeWithStick\" (if (= #1 P1) (if (= (id \"Stick\" Neutral) (what at:1)) 1 (if (= (id \"Stick\" Neutral) (what at:2)) 2 (if (= (id \"Stick\" Neutral) (what at:3)) 3 (if (= (id \"Stick\" Neutral) (what at:4)) 4 (if (= (id \"Stick\" Neutral) (what at:5)) 5 (if (= (id \"Stick\" Neutral) (what at:6)) 6 (if (= (id \"Stick\" Neutral) (what at:7)) 7 (if (= (id \"Stick\" Neutral) (what at:8)) 8 (if (= (id \"Stick\" Neutral) (what at:9)) 9 (if (= (id \"Stick\" Neutral) (what at:10)) 10 (if (= (id \"Stick\" Neutral) (what at:11)) 11 Off))))))))))) (if (= (id \"Stick\" Neutral) (what at:22)) 22 (if (= (id \"Stick\" Neutral) (what at:21)) 21 (if (= (id \"Stick\" Neutral) (what at:20)) 20 (if (= (id \"Stick\" Neutral) (what at:19)) 19 (if (= (id \"Stick\" Neutral) (what at:18)) 18 (if (= (id \"Stick\" Neutral) (what at:17)) 17 (if (= (id \"Stick\" Neutral) (what at:16)) 16 (if (= (id \"Stick\" Neutral) (what at:15)) 15 (if (= (id \"Stick\" Neutral) (what at:14)) 14 (if (= (id \"Stick\" Neutral) (what at:13)) 13 (if (= (id \"Stick\" Neutral) (what at:12)) 12 Off))))))))))))) (define \"Centre\" 12) (define \"NotThrow0\" (!= 0 (\"ThrowValue\"))) (define \"ThrowValue\" (mapEntry \"Throw\" (count Pips))) (game \"Chukaray\" (players 2) (equipment { (board (rectangle 1 25) { (track \"Track1\" {0..23} loop:True P1) (track \"Track2\" {23..0} loop:True P2)} use:Edge) (\"StickDice\" 4) (piece \"Stick\" Each (move (from (from) level:(level)) (to (\"NextSiteOnTrack\" (\"ThrowValue\") from:(from)) if:True (apply (and (if (\"IsEnemyAt\" (to)) (if (\"IsOffBoard\" (\"NearestHomeWithStick\" (who at:(to)))) (remove (to)) (fromTo (from (to)) (to (\"NearestHomeWithStick\" (who at:(to))))))) (if (and { (is Occupied (to)) (\"IsPieceAt\" \"Stick\" Neutral (to) level:0) (is In (to) (sites Next \"Side\"))}) (remove (to) level:0))))))) (piece \"Stick\" Neutral) (map \"Throw\" {(pair 0 2) (pair 1 0) (pair 2 1) (pair 3 0) (pair 4 4)}) (regions \"Side\" P1 (sites {0..11})) (regions \"Side\" P2 (sites {13..23}))}) (rules (start { (place Stack \"Stick1\" 0) (place Stack \"Stick2\" 23) (place Stack \"Stick0\" (sites {1..11 13..22}))}) (play (\"RollMove\" (if (\"NotThrow0\") (forEach Piece) (if (= (\"Centre\") (where \"Stick\" Mover)) (if (\"IsNotOffBoard\" (\"NearestHomeWithStick\" (mover))) (move (from (where \"Stick\" Mover)) (to (\"NearestHomeWithStick\" (mover)))) (if (and (\"IsOffBoard\" (\"NearestHomeWithStick\" (mover))) (\"IsOffBoard\" (\"NearestHomeWithStick\" (next)))) (move Pass (then (trigger \"Draw\" Mover))))))) (then (if (\"NotThrow0\") (moveAgain))))) (end { (\"CaptureAll\" Next) (if (is Triggered \"Draw\" Mover) (result Mover Draw))}))) 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\n4x6-7 board. Two counters in each hole; before beginning each player rearranges these as they wish, with the following rules: The leftmost hole in the outer row must have the most counters; holes in the inner row may only have one counter. Initial phase: In this phase, only holes with two or fewer counters may be used to sow. Sowing occurs in an anti-clockwise direction, and when a counter lands in an occupied hole the sowing continues. When the final counter lands in an empty hole, the turn ends. If the empty hole is in the player's inner row, counters in the opponent's inner row opposite are captured, and if there are also counters in the opponent's outer row hole opposite, these are also taken. The initial phase ends for a player when two of the player's counters have been taken. On the next turn they must play from the hole with the largest number of counters, and from that point they may move from any hole. The rules for play remain the same as in the initial phase otherwise. The player who captures all of the opponent's counters wins. Each player has 6 holes by row.\n\n###\n\n", "completion": "(define \"SitesWithMaxCounter\" (forEach (sites Mover \"Home\") if:(= (max (results from:(sites Mover \"Home\") to:(sites Mover \"Home\") (count at:(to)))) (count at:(site))))) (define \"OnlyOneInInner\" (all Sites (sites Mover \"Inner\") if:(= 1 (count at:(site))))) (define \"LeftMostCounters\" (all Sites (difference (sites Mover \"Home\") (mapEntry \"LeftMost\" Mover)) if:(> (count at:(mapEntry Mover)) (count at:(site))))) (define \"Columns\" 6) (game \"Quela\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"TrackCCW1\" \"0,E,N1,W\" loop:True P1) (track \"TrackCCW2\" \"12,E,N1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"TrackCCW1\")) (regions \"Home\" P2 (sites Track \"TrackCCW2\")) (regions \"Inner\" P1 (difference (sites Track \"TrackCCW1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"TrackCCW2\") (sites Top))) (map \"LeftMost\" {(pair P1 0) (pair P2 23)}) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 2 to:(union (sites P1 \"Home\") (sites P2 \"Home\")))) phases:{ (phase \"Rearrangement\" (play (or (move (from (sites Mover \"Home\") if:(is Occupied (from))) (to (difference (sites Mover) (from)))) (if (and (\"LeftMostCounters\") (\"OnlyOneInInner\")) (move Pass)))) (nextPhase (all Passed) \"InitialPhase\")) (phase \"InitialPhase\" (play (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(or (\"SameTurn\") (and (> 3 (count at:(from))) (is Occupied (from))))) (then (sow \"TrackCCW\" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover \"Inner\")) (if (is Occupied (\"OppositePit\" (to))) (and (fromTo (from (\"OppositePit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePit\" (to)))) (if (is Occupied (\"OppositeOuterPit\" (to))) (fromTo (from (\"OppositeOuterPit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositeOuterPit\" (to))))))))))))) { (nextPhase P1 (< 1 (count Cell at:(handSite P2))) \"MiddlePhase\") (nextPhase P2 (< 1 (count Cell at:(handSite P1))) \"MiddlePhase\")}) (phase \"MiddlePhase\" (play (move Select (from (\"SitesWithMaxCounter\")) (then (sow \"TrackCCW\" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover \"Inner\")) (if (is Occupied (\"OppositePit\" (to))) (and (fromTo (from (\"OppositePit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePit\" (to)))) (if (is Occupied (\"OppositeOuterPit\" (to))) (fromTo (from (\"OppositeOuterPit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositeOuterPit\" (to))))))))))))) (nextPhase Mover \"FinalPhase\")) (phase \"FinalPhase\" (play (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(is Occupied (from))) (then (sow \"TrackCCW\" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover \"Inner\")) (if (is Occupied (\"OppositePit\" (to))) (and (fromTo (from (\"OppositePit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePit\" (to)))) (if (is Occupied (\"OppositeOuterPit\" (to))) (fromTo (from (\"OppositeOuterPit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositeOuterPit\" (to))))))))))))) (end (\"BlockWin\")))})) 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 Ludii game based on the following description\nThe same rules as Tic-Tac-Toe are used with four players in a 5x5 board. The third and fourth players play with \\ \n\n###\n\n", "completion": "(game \"Tic-Tac-Four\" (players 4) (equipment { (board (square 5)) (piece \"Disc\" P1) (piece \"Cross\" P2) (piece \"Y\" P3) (piece \"Z\" P4)}) (rules (play (move Add (to (sites Empty)))) (end (\"Line3Win\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6 board with two stores. Four counters per hole. Sowing occurs in an anti-clockwise direction. In the first and second moves, players may choose to drop as many counters as they wish into the holes they are sowing into. From the third turn on, the players must sow one counter at a time. The hole from which a sowing began is skipped if the sowing goes all the way around the board. When the final counter lands in a hole containing one or two people, thus causing it to contain two or three, these are captured. Any previous holes, in an unbroken sequence, also containing two or three counters, are captured. A move of a single counter cannot capture. When a player's row is empty, the opponent must sow into their row if it is possible to do so. Play ends when one player's row is empty, and the opponent claims all of the remaining counters. The player with the most counters wins. \n\n###\n\n", "completion": "(define \"NextHole\" (\"NextSiteOnTrack\" 1 from:(last To) \"Track\")) (define \"PiecesOwnedBy\" (+ (count at:(mapEntry #1)) (count in:(sites #1)))) (define \"Columns\" 6) (game \"Ti\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" (track \"Track\" \"1,E,N,W\" loop:True)) (regions \"Home\" P1 (sites Bottom)) (regions \"Home\" P2 (sites Top)) (map {(pair P1 FirstSite) (pair P2 LastSite)}) (piece \"Seed\" Shared)}) (rules (start (set Count 4 to:(sites Track))) phases:{ (phase \"TwoFirstTurn\" (play (if (\"SameTurn\") (forEach Value min:1 max:(var \"NumCounters\") (move Add (piece (id \"Seed\" Shared)) (to (\"NextHole\") (apply (set Var \"NumCounters\" (- (var \"NumCounters\") (value))))) count:(value) (then (if (< 0 (var \"NumCounters\")) (moveAgain) (set Value Mover (+ 1 (value Player Mover))))))) (move Select (from (sites Mover \"Home\") if:(> (count at:(from)) 0)) (then (and { (moveAgain) (remove (last To) count:(count at:(last To))) (set Var \"NumCounters\" (count at:(last To)))}))))) (nextPhase Mover (= (value Player Mover) 1) \"Sowing\")) (phase \"Sowing\" (play (do (or (move Select (from (sites Mover \"Home\") if:(> (count at:(from)) 1)) (then (sow if:(or (= (count at:(to)) 2) (= (count at:(to)) 3)) apply:(fromTo (from (to)) (to (mapEntry (mover))) count:(count at:(to))) includeSelf:False backtracking:True))) (move Select (from (sites Mover \"Home\") if:(= (count at:(from)) 1)) (then (sow)))) ifAfterwards:(< 0 (count in:(sites Next \"Home\"))))))} (end (\"MancalaByScoreWhen\" (no Moves Mover))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"PiecesOwnedBy\" (+ (count Cell at:(handSite #1)) (count in:(forEach (sites Board) if:(= (id #1) (state at:(site))))))) (define \"NoFreeSeed\" (all Sites (forEach (sites Board) if:(= 0 (state at:(site)))) if:(= 0 (count at:(site))))) (define \"Columns\" 6) (game \"Gamacha (Nobility)\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" store:None (track \"Track\" \"0,E,N,W\" loop:True)) (piece \"Seed\" Shared) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (hand Each)}) (rules (start (set Count 4 to:(sites Track))) (play (move Select (from (if (\"SameTurn\") (\"LastHoleSowed\") (sites Mover)) if:(and (< 0 (count at:(from))) (= 0 (state at:(from))))) (then (sow apply:(if (and (is In (to) (sites Mover)) (= 1 (count at:(to)))) (if (= 1 (count at:(\"OppositePit\" (to)))) (fromTo (from (\"OppositePit\" (to))) (to (handSite Mover)) count:1)) (if (< 1 (count at:(to))) (and (moveAgain) (if (and {(is In (to) (sites Next)) (= 0 (state at:(to))) (= 4 (count at:(to)))}) (set State at:(to) (mover)))))))))) (end (\"MancalaByScoreWhen\" (\"NoFreeSeed\")))))\n\n###\n\n", "completion": "2x6 board. Four counters in each hole. Sowing occurs in an anti-clockwise direction. When the final counter of a sowing lands in an empty hole on the player's own row, the contents of the opponent's opposite hole are captured only if it contains one counter. If the final counter lands in an occupied hole, the contents of it are picked up and sowing continues. If the final counter lands in a hole in the opponent's row, causing it to contain four counters, the hole becomes a qasamo, and it can no longer be sown from. Play continues until all of the counters are captured or are in a qasamo. The player with the most counters captured and in all qasamo belonging to them wins. END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayed on an 8x8 board with pieces with specialized moves: Pawns (8): can move one space orthogonally forward, or two steps orthogonally forward on their first move, capture one space diagonally forward; Rooks (2): can move any number of spaces orthogonally; Bishops (2): can move any number of spaces diagonally; Knight (2): moves in any direction, one space orthogonally with one space forward diagonally; Queens (1): can move any number of spaces orthogonally or diagonally; Kings (1): can move one space orthogonally or diagonally. Castling, En Passant, and Pawn promotion allowed. Play begins by each player moving two of their pieces in the same turn, provided that neither enter the opponent's half of the board. An opponent's piece is captured by moving a player's own piece onto a space occupied by the opponent's piece. When a King can be captured on the next turn by an opponent's piece, it is in check. The King must not be in check at the end of the player's turn. If this is not possible, it is checkmate and the opponent wins.\n \n\n###\n\n", "completion": "(define \"CaptureForwardDiagonal\" (move Step (directions {FR FL}) (to if:(\"IsEnemyAt\" (to)) (apply (remove (to)))))) (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 \"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 \"CaptureToPiece\" (apply (if (\"IsEnemyAt\" (to)) (remove (to))))) (define \"RememberPieceHasMoved\" (then (if (= (state at:(last To)) 1) (\"PieceHasMoved\" (last To))))) (define \"PieceHasMoved\" (set State at:#1 0)) (define \"HasNeverMoved\" (= (state at:(mapEntry #1 (mover))) 1)) (define \"NextCanNotMove\" (not (can Move (do (forEach Piece Next) ifAfterwards:(not (\"IsInCheck\" \"King\" Next)))))) (game \"Shakhmaty\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (piece \"Pawn\" Each (or { (if (is In (from) (sites Start (piece (what at:(from))))) (\"DoubleStepForwardToEmpty\" \"SetEnPassantLocation\")) \"StepForwardToEmpty\" \"CaptureForwardDiagonal\" \"EnPassant\"} (then (if (is In (last To) (sites Mover \"Promotion\")) (moveAgain))))) (piece \"Rook\" Each (move Slide Orthogonal (to if:(\"IsEnemyAt\" (to)) \"CaptureToPiece\") \"RememberPieceHasMoved\")) (piece \"King\" Each (move Step (to if:(not (\"IsFriendAt\" (to))) \"CaptureToPiece\") \"RememberPieceHasMoved\")) (piece \"Bishop\" Each (move Slide Diagonal (to if:(\"IsEnemyAt\" (to)) \"CaptureToPiece\"))) (piece \"Knight\" Each (move Leap \"KnightWalk\" (to if:(not (\"IsFriendAt\" (to))) \"CaptureToPiece\"))) (piece \"Queen\" Each (move Slide (to if:(\"IsEnemyAt\" (to)) \"CaptureToPiece\"))) (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)) (regions \"Half\" P1 (expand (sites Bottom) steps:3)) (regions \"Half\" P2 (expand (sites Top) steps:3))}) (rules (start { (place \"Pawn1\" (sites Row 1)) (place \"Pawn2\" (sites Row 6)) (place \"Rook1\" {\"A1\" \"H1\"} state:1) (place \"Knight1\" {\"B1\" \"G1\"}) (place \"Bishop1\" {\"C1\" \"F1\"}) (place \"Queen1\" coord:\"D1\") (place \"King1\" coord:\"E1\" state:1) (place \"Rook2\" {\"A8\" \"H8\"} state:1) (place \"Knight2\" {\"B8\" \"G8\"}) (place \"Bishop2\" {\"C8\" \"F8\"}) (place \"Queen2\" coord:\"D8\") (place \"King2\" coord:\"E8\" state:1)}) phases:{ (phase \"Opening\" (play (do (forEach Piece) ifAfterwards:(and (is In (last To) (sites Mover \"Half\")) (not (\"IsInCheck\" \"King\" Mover))) (then (if (\"NewTurn\") (moveAgain))))) (nextPhase Mover (\"SameTurn\") \"Playing\")) (phase \"Playing\" (play (if \"SameTurn\" (move Promote (last To) (piece {\"Queen\" \"Knight\" \"Bishop\" \"Rook\"}) Mover) (do (or (forEach Piece) (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\")))) ifAfterwards:(not (\"IsInCheck\" \"King\" Mover))))))} (end (if (and (\"IsInCheck\" \"King\" Next) (\"NextCanNotMove\")) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n4x5 or 8 board. One counter in each hole. Players alternate turns picking up the counters in one of their holes and sowing them in an anti-clockwise direction. When the final counter lands in a hole with counters, these counters are picked up and sowing continues. When the final counter lands in an empty hole in the inner row, any counters in the opponent's opposite inner row hole are captured, and if this capture was possible, any counters in the outer row hole are also captured. The player who captures all of the opponent's counters wins. Each player has 6 holes per row.\n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (+ (count Cell at:(handSite #1)) (count in:(sites #1 \"Home\")))) (define \"Columns\" 5) (game \"Nchayo\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"0,E,N1,W\" loop:True P1) (track \"Track2\" \"10,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 1 to:(sites Board))) (play (move Select (from (if (\"SameTurn\") (\"LastHoleSowed\") (sites Mover \"Home\")) if:(is Occupied (from))) (then (sow \"Track\" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover \"Inner\")) (if (is Occupied (\"OppositePit\" (to))) (and (fromTo (from (\"OppositePit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePit\" (to)))) (if (is Occupied (\"OppositeOuterPit\" (to))) (fromTo (from (\"OppositeOuterPit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositeOuterPit\" (to))))))))))))) (end (\"MancalaByScoreWhen\" (no Moves Next))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThree concentric squares, with lines connecting the diagonals and the midpoints of the sides. Twelve pieces per player. Players alternate turns placing a piece on an empty spot on the board. When a player places three pieces in a row along one of the lines on the board, they remove one of the pieces belonging to the opponent. When all of the pieces have been placed, players alternate turns moving a piece to an empty adjacent spot along the lines. The first player to capture all of the opponent's pieces wins. \n\n###\n\n", "completion": "(game \"Tule Paid\" (players 2) (equipment { (board (concentric Square rings:3 joinCorners:True) use:Vertex) (hand Each) (piece \"Marker\" Each (\"StepToEmpty\" ~ (then (\"ReplayIfLine3\"))))}) (rules (start (place \"Marker\" \"Hand\" count:12)) 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 (\"CaptureAll\" Next)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThree concentric squares, with lines connecting the diagonals and the midpoints of the sides. Twelve pieces per player. Players alternate turns placing one of their pieces on one of the empty intersections of the board. If a player places three of their stones in a straight line, the player may remove one of the opponent's pieces. When all of the pieces have been placed, the players alternate turns moving one of their pieces to an empty adjacent point along the lines of the board. When a player is reduced to three pieces, they may move one of their stone to any empty space on the board. The player who reduces their opponent to two pieces wins. \n\n###\n\n", "completion": "(define \"RemoveEnemyPiece\" (if (can Move (\"RemoveAnyEnemyPieceNotInLine3\" Orthogonal)) (\"RemoveAnyEnemyPieceNotInLine3\" Orthogonal) (\"RemoveAnyEnemyPiece\"))) (game \"Tsoro Yemutwelve\" (players 2) (equipment { (board (concentric Square rings:3 joinCorners:True) use:Vertex) (hand Each) (piece \"Marker\" Each (\"StepToEmpty\" ~ (then (\"ReplayIfLine3\" Orthogonal exact:True))))}) (rules (start (place \"Marker\" \"Hand\" count:12)) phases:{ (phase \"Placement\" (play (if \"SameTurn\" \"RemoveEnemyPiece\" (move (from (handSite Mover)) (to (sites Empty)) (then (\"ReplayIfLine3\" Orthogonal exact:True))))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (phase \"Movement\" (play (if \"SameTurn\" \"RemoveEnemyPiece\" (if (> (count Pieces Mover) 3) (forEach Piece) (move (from (sites Occupied by:Mover)) (to (sites Empty)))))))} (end (\"HavingLessPiecesLoss\" Next 2)))) 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": "Describe the mechanics of the following Ludii game\n(game \"Wari (Alignment)\" (players 2) (equipment { (board (square 6)) (hand Each) (piece \"Marker\" Each (if (is Line 4 Orthogonal through:(from)) (\"StepToEmpty\" Orthogonal) (\"StepToEmpty\" Orthogonal (then (\"ReplayIfLine3\" Orthogonal exact:True)))))}) (rules (start (place \"Marker\" \"Hand\" count:12)) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (phase \"Movement\" (play (if \"SameTurn\" (\"RemoveAnyEnemyPiece\") (forEach Piece))))} (end (\"CaptureAll\" Next))))\n\n###\n\n", "completion": "6x6 board. Twelve pieces per player. Players alternate turns placing a piece on an empty space on the board. No captures may be made in the placement phase. When all of the pieces have been placed, players alternate turns moving a piece orthogonally to an empty adjacent space on the board. When a player places three of their pieces in an orthogonal row, they remove one of the opponent's pieces. Lines of four or more do not capture. Moving a piece out of a line of four or more, making it now a line of three, does not capture. Lines of three made during the placement phase also do not result in capture. The player who captures all of the opponent's pieces wins. END" }, { "prompt": "Construct a Ludii game based on the following description\n2x12 board, with spaces as points, divided in two. Fifteen pieces per player, which start stacked, two on the players' first three points and three in the next three points. Two six-sided dice. Players unstack the pieces by moving pieces off of the stack, but remaining on the same point, according to the throws of the dice. The value of the throw indicates the number of the point which can be unstacked. For example, a throw of 1 and 4 allows the player to unstack the pieces on points 1 and 4. Doubles allow the player to unstack all pieces on that point. The player then bears off the pieces from this quadrant of the board. Players bear off the pieces in the same manner as they were unstacked. The first player to bear off all their pieces wins.\n \n\n###\n\n", "completion": "(define \"UnstackHalf\" (forEach Level (last To) (set State at:(last To) level:(level) 1))) (define \"UnstackFull\" (forEach Level (last To) (set State at:(last To) level:(level) 2))) (define \"PieceStacked\" (or (\"PieceFullStacked\" #1) (\"PieceHalfStacked\" #1))) (define \"PieceHalfStacked\" (= (state at:#1) 1)) (define \"PieceFullStacked\" (= (state at:#1) 0)) (define \"PieceUnstacked\" (= (state at:#1) 2)) (define \"RemoveAPiece\" (move Remove (from))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" (pips))) (define \"SiteToSelect\" (\"NextSiteOnTrack\" (- (pips) 1) from:(mapEntry \"StartTrack\" (mover)))) (game \"Kiz Tavlasi\" (players 2) (equipment { (\"BackgammonBoard\" { (track \"Track1\" {7..12} P1 directed:True) (track \"Track2\" {18..13} P2 directed:True)}) (dice d:6 num:2) (piece \"Disc\" Each (forEach Die if:(\"DieNotUsed\") (if (\"IsOffBoard\" \"SiteToMoveOnTrack\") \"RemoveAPiece\" (move (from) (to \"SiteToMoveOnTrack\"))))) (map \"StartTrack\" {(pair P1 7) (pair P2 18)})}) (rules (start { (place Stack \"Disc1\" (sites {7..9}) count:2) (place Stack \"Disc1\" (sites {10..12}) count:3) (place Stack \"Disc2\" (sites {13..15}) count:3) (place Stack \"Disc2\" (sites {16..18}) count:2)}) phases:{ (phase \"UnStacking\" (play (\"RollEachNewTurnMove\" (forEach Die if:(\"DieNotUsed\") (or (if (\"PieceFullStacked\" \"SiteToSelect\") (move Select (from (\"SiteToSelect\")) (then (and (if (= 3 (size Stack at:(last To))) (\"UnstackHalf\") (\"UnstackFull\")) (\"ReplayNotAllDiceUsed\"))))) (if (\"PieceHalfStacked\" \"SiteToSelect\") (move Select (from (\"SiteToSelect\")) (then (and (\"UnstackFull\") (\"ReplayNotAllDiceUsed\"))))))))) (nextPhase Mover (all Sites (sites Occupied by:Mover) if:(not (\"PieceStacked\" (site)))) \"BearingOff\")) (phase \"BearingOff\" (play (do (if (or (all DiceEqual) (\"NewTurn\")) (roll)) next:(forEach Piece top:True) (then (if (not (all DiceUsed)) (moveAgain))))) (end (\"EscapeWin\")))})) 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": "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": "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 \"Clobber\" (players 2) (equipment { (board (rectangle 1 2)) (piece \"Marker\" Each (\"StepToEnemy\" Orthogonal))}) (rules (start { (place \"Marker1\" (sites Phase 1)) (place \"Marker2\" (sites Phase 0))}) (play (forEach Piece)) (end (\"NoMoves\" Loss))))\n\n###\n\n", "completion": "(game \"Clobber\" (players 2) (equipment { (board (rectangle 2 3)) (piece \"Marker\" Each (\"StepToEnemy\" Orthogonal))}) (rules (start { (place \"Marker1\" (sites Phase 1)) (place \"Marker2\" (sites Phase 0))}) (play (forEach Piece)) (end (\"NoMoves\" Loss)))) END" }, { "prompt": "Construct a Ludii game based on the following description\n5x5 intersecting lines, with the diagonals of every 2x2 square formed. On one side, a triangle, with the apex intersecting with the midpoint of that side. There is a line from the apex to the midpoint of the triangle's base, and another interior triangle, connecting the base of the larger triangle with the midpoints of the sides of the larger triangle. One player plays as the Taisho (\\ \n\n###\n\n", "completion": "(game \"Juroku Musashi\" (players 2) (equipment { (board (add (merge (scale 2 (square 5 diagonals:Alternating)) (shift 2 -2 (wedge 3))) vertices:{ {3 -2} {5 -2}} edges:{{25 31} {25 29} {27 29} {27 32}}) use:Vertex) (piece \"Marker\" P1 \"StepToEmpty\") (piece \"Marker\" P2 (or (\"HopCapture\") (\"StepToEmpty\")))}) (rules (start { (place \"Marker1\" (difference (sites Outer) (expand (sites Bottom)))) (place \"Marker2\" (ahead (centrePoint) N))}) (play (forEach Piece)) (end (\"NoMovesP2NoPiecesP1\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\n5x5 intersecting lines, with diagonals in each quadrant. Six pieces per player. Players alternate turns placing one of their pieces on an empty spot on the board. When all of the pieces are placed, they alternate turns moving one of their pieces to an empty adjacent spot along the lines of the board. During either phase, when a player places three of their pieces in a row, they may remove one of the opponent's pieces from the board. Pieces which are in a three-in-a-row arrangement cannot be removed from the board. The player who captures all of the opponent's pieces wins. \n\n###\n\n", "completion": "(game \"Altan Xaraacaj\" (players 2) (equipment { (\"AlquerqueBoard\" 5 5) (hand Each) (piece \"Marker\" Each (\"StepToEmpty\" ~ (then (\"ReplayIfLine3\" Orthogonal exact:True))))}) (rules (start (place \"Marker\" \"Hand\" count:6)) phases:{ (phase \"Placement\" (play (if \"SameTurn\" (\"RemoveAnyEnemyPieceNotInLine3\" Orthogonal) (move (from (handSite Mover)) (to (sites Empty)) (then (\"ReplayIfLine3\" Orthogonal exact:True))))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (phase \"Movement\" (play (if \"SameTurn\" (\"RemoveAnyEnemyPieceNotInLine3\" Orthogonal) (forEach Piece))))} (end (\"CaptureAll\" Next)))) 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": "Construct a Ludii game based on the following description\nA track of eleven squares, with marks in the two outer and central squares. Ten further squares extending from the central square, with markings in the fifth and final squares. Including this fifth square, a square track with eleven squares per side, with a marked square in each corner and middle square of each side. Five pieces per player. Seven cowries used as dice. The number of mouths up equals the value of the throw; when no mouths are up the player loses their turn. Players begin from opposite ends of the bottom track, and proceed up the vertical track, around the square, and then up the remainder of the vertical track. A player must throw a 1, 5, or 7 to enter the board. Throws of 1, 5, or 7 grant the player another throw. If a piece lands on a space occupied by a piece belonging to the opponent, the opponent's piece is removed from the board and must enter again. Pieces resting on a marked square are safe from being sent back. The player who moves all five of their pieces beyond the final space in the vertical row with an exact throw wins.\n \n\n###\n\n", "completion": "(define \"Move\" (or { (forEach Piece) (forEach Piece container:(mover)) (if (and { (\"SpecialThrow\") (\"HandOccupied\" Mover) (or (is Empty \"StartPoint\") (\"IsFriendAt\" (\"StartPoint\")))}) (move (from (handSite (mover))) (to (\"StartPoint\"))))} (then (if (\"SpecialThrow\") (moveAgain))))) (define \"StartPoint\" (mapEntry (mover))) (define \"SpecialThrow\" (or { (= (count Pips) 1) (= (count Pips) 5) (= (count Pips) 7)})) (define \"CaptureEnemyPiece\" (apply if:(\"IsEnemyAt\" (to)) (fromTo (from (to)) (to (handSite (who at:(to)))) count:(count at:(to))))) (define \"RemoveAPiece\" (move Remove (from))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" (count Pips))) (game \"Panchi\" (players 2) (equipment { (board (merge { (rectangle 1 11) (shift 0 5 (rotate 90 (rectangle 1 11))) (shift 0 5 (rectangle 1 11)) (shift -5 10 (rotate 90 (rectangle 1 11))) (shift 5 10 (rotate 90 (rectangle 1 11))) (shift 0 15 (rectangle 1 11))}) { (track \"Track1\" \"0,E5,N5,W,N,E,S,W5,N,End\" P1 directed:True) (track \"Track2\" \"10,W5,N5,E,N,W,S,E5,N,End\" P2 directed:True)}) (piece \"Pawn\" Each (if (\"IsEndTrack\" \"SiteToMoveOnTrack\") \"RemoveAPiece\" (if (\"IsNotOffBoard\" \"SiteToMoveOnTrack\") (if (if (not (\"IsEnemyAt\" \"SiteToMoveOnTrack\")) True (not (is In \"SiteToMoveOnTrack\" (sites \"Protect\")))) (move (from (from) level:(level)) (to \"SiteToMoveOnTrack\" \"CaptureEnemyPiece\")))))) (\"StickDice\" 7) (hand Each) (regions \"Protect\" (sites {0 10 5 16 21 23 30 36 46 56 51 42})) (map {(pair P1 0) (pair P2 10)})}) (rules (start { (place Stack \"Pawn1\" (handSite P1) count:5) (place Stack \"Pawn2\" (handSite P2) count:5)}) (play (\"RollMove\" (if (can Move (\"Move\")) (\"Move\") (move Pass (then (if (\"SpecialThrow\") (moveAgain))))))) (end (\"EscapeWin\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6 board. Four counters in each hole. In the opening phase, the player takes all of the counters in their rightmost hole and places them in the opponent's opposite hole. The player then takes the contents of the next hole, placing all of them into the hole following it, until the entire board has alternating holes with eight and zero counters. When the final hole is made with eight counters, these are picked up and the player sows as normal in an anti-clockwise direction. When the final counter falls into an occupied hole, the counters are picked up and sowing continues. When the final counter falls into an empty hole, the player captures the counters in the opposite hole. If a player cannot play, they must pass their turn until there are counters available for them to play. Play continues until there is one piece or fewer on the board, the player to whom the row in which the single piece is located captures it. 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, and if each player has two remaining counters ownership is determined by chance. Play continues in several rounds like this until one player takes all the counters.\n \n\n###\n\n", "completion": "(define \"RightMostEmpty\" (trackSite FirstSite \"TrackCW\" from:(mapEntry \"RightMost\" Mover) if:(is Empty (to)))) (define \"RememberOwnedHolesRandom\" (if (< 50 (value Random (range 1 100))) (remember Value \"OwnedP1\" #1) (remember Value \"OwnedP2\" #1))) (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 \"OneOrLessPieceOnBoard\" (>= 1 (count Pieces All in:(sites Board)))) (define \"NextHole\" (\"NextSiteOnTrack\" #2 from:#1 \"Track\")) (define \"Columns\" 6) (game \"Jimafesosh\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" store:None { (track \"TrackCCW\" \"0,E,N,W\" loop:True) (track \"TrackCW\" \"5,W,N,E\" loop:True)}) (piece \"Seed\" Shared) (hand Each) (map \"RightMost\" {(pair P1 5) (pair P2 6)}) (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 \"TrackCCW\"))}) phases:{ (phase \"Opening1\" (play (move Select (from (if (\"SameTurn\") (var \"Replay\") 5)) (then (sow numPerHole:4 \"TrackCCW\" apply:(and (moveAgain) (if (is Occupied (\"NextHole\" (to) 1)) (set Var \"Replay\" (\"NextHole\" (to) 1)) (set Var \"Replay\" Undefined))))))) (nextPhase (= Undefined (var \"Replay\")) \"Opening2\")) (phase \"Opening2\" (play (move Select (from (if (and (\"SameTurn\") (!= Undefined (var \"Replay\"))) (var \"Replay\") 4)) (then (sow \"TrackCCW\" apply:(if (< 1 (count at:(to))) (and (moveAgain) (set Var \"Replay\" (to))) (if (is Occupied (\"OppositePitTwoRows\" (to))) (fromTo (from (\"OppositePitTwoRows\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePitTwoRows\" (to)))))))))) (nextPhase (not (is Next Prev)) \"Sowing\")) (phase \"Sowing\" (play (or { (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (\"OwnedHoles\")) if:(is Occupied (from))) (then (sow \"TrackCCW\" apply:(if (< 1 (count at:(to))) (and (moveAgain) (set Var \"Replay\" (to))) (if (is Occupied (\"OppositePitTwoRows\" (to))) (fromTo (from (\"OppositePitTwoRows\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePitTwoRows\" (to)))))))))} (then (if (\"OneOrLessPieceOnBoard\") (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)))) (forget Value \"OwnedP1\" All) (forget Value \"OwnedP2\" 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 (\"RightMostEmpty\")) count:4 (then (and { (\"RemmemberOwnedHoles\" (last To)) (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\"))})))}))))) (nextPhase (and (is Empty (handSite P1)) (is Empty (handSite P2))) \"Sowing\"))})) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlay using the standard rules of chess. \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 { \"KingInTheInitialPlace\" (\"HasNeverMoved\" \"King\") (not (\"KingCheck\" Mover))}) (or (if (and (\"HasNeverMoved\" \"RookLeft\") (can Move (\"DoCastle\" \"RookLeft\" E 3 (is Empty (to))))) \"BigCastling\") (if (and (\"HasNeverMoved\" \"RookRight\") (can Move (\"DoCastle\" \"RookRight\" W 2 (is Empty (to))))) \"SmallCastling\")))) (define \"BigCastling\" (\"DoCastle\" \"King\" W 2 \"KingNotCheckedAndToEmpty\" (then (and (\"PieceHasMoved\") (\"DoCastle\" \"RookLeft\" E 3 True))))) (define \"SmallCastling\" (\"DoCastle\" \"King\" E 2 \"KingNotCheckedAndToEmpty\" (then (and (\"PieceHasMoved\") (\"DoCastle\" \"RookRight\" W 2 True))))) (define \"DoCastle\" (move Slide (from (mapEntry #1 (mover))) #2 (between (exact #3) if:#4) #5)) (define \"KingNotCheckedAndToEmpty\" (and (is Empty (to)) (not (is Threatened (id \"King\" Mover) at:(to))))) (define \"RememberPieceHasMoved\" (then (if (= (state at:(last To)) 1) \"PieceHasMoved\"))) (define \"PieceHasMoved\" (set State at:(last To) 0)) (define \"ThatPieceNeverMoved\" (= (state at:(mapEntry #1 (mover))) 1)) (define \"HasNeverMoved\" (= (state at:(mapEntry #1 (mover))) 1)) (define \"KingInTheInitialPlace\" (= (what at:(mapEntry \"King\" (mover))) (id \"King\" Mover))) (define \"KingCheck\" (is Threatened (id \"King\" #1) at:(where \"King\" #1))) (define \"NextCanNotMove\" (not (can Move (do (forEach Piece Next) ifAfterwards:(not (\"KingCheck\" Next)))))) (game \"Chess Puzzle\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (\"ChessPawn\" \"Pawn\" (or \"InitialPawnMove\" \"EnPassant\") (then (and (\"ReplayInMovingOn\" (sites Mover \"Promotion\")) (set Counter)))) (\"ChessRook\" \"Rook\" (then (set Counter)) (\"RememberPieceHasMoved\")) (\"ChessKing\" \"King\" (then (set Counter)) (\"RememberPieceHasMoved\")) (\"ChessBishop\" \"Bishop\" (then (set Counter))) (\"ChessKnight\" \"Knight\" (then (set Counter))) (\"ChessQueen\" \"Queen\" (then (set Counter))) (map \"King\" {(pair 1 \"E1\") (pair 2 \"E8\")}) (map \"RookLeft\" {(pair 1 \"A1\") (pair 2 \"A8\")}) (map \"RookRight\" {(pair 1 \"H1\") (pair 2 \"H8\")}) (regions \"Promotion\" P1 (sites Top)) (regions \"Promotion\" P2 (sites Bottom))}) (rules (start { (place \"King1\" 42) (place \"Rook1\" 12) (place \"King2\" 58)}) (play (if \"SameTurn\" (move Promote (last To) (piece {\"Queen\" \"Knight\" \"Bishop\" \"Rook\"}) Mover) (do (or (forEach Piece) (\"Castling\")) ifAfterwards:(not (\"KingCheck\" Mover))))) (end { (if (and { (\"KingCheck\" Next) \"NextCanNotMove\" (<= (count Turns) 1)}) (result P1 Win)) (if (or (no Moves Next) (and (= 1 (count Turns)) (not (is Mover Next)))) (result P1 Loss))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nEDGES - Each player owns two opposite edges, say, the first player has top and bottom edges, while the second player has left and right edges.\n \n DROP - Each player drops one of his stones on an empty cell.\n - If at least one opponent stone is between that stone and another friendly stone (orthogonal or diagonal), then all opponent stones that were between those stones flip their colour.\n - Stones cannot be dropped on the opponent's edges (including corners).\n \n GOAL - Wins the first player who manages to do a path connecting his two opposite edges.\n - Two tiles diagonally aside are not continuous in a path.\n - The corners belong to both edges. \n\n###\n\n", "completion": "(define \"ConnectedEdges\" (!= 0 (count Sites in:(forEach (sites Occupied by:#1) if:(is Connected at:(site) Orthogonal #1))))) (game \"Troll\" (players 2) (equipment { (board (square 8)) (piece \"Ball\" Each) (regions P1 {(sites Top) (sites Bottom)}) (regions P2 {(sites Left) (sites Right)})}) (rules (play (move Add (to (if (is Mover P1) (difference (sites Empty) (union (sites Left) (sites Right))) (difference (sites Empty) (union (sites Top) (sites Bottom))))) (then (custodial (from (last To)) (between if:(\"IsEnemyAt\" (between)) (apply (and (remove (between)) (add (piece (id \"Ball\" Mover)) (to (between)))))) (to if:(\"IsFriendAt\" (to))))))) (end { (if (\"ConnectedEdges\" P1) (result P1 Win)) (if (\"ConnectedEdges\" P2) (result P2 Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe game is played on a board with twelve points on either side. The points form a continuous track in a horseshoe shape; each player progresses in opposite directions (one from their bottom right to the top right, the other from their bottom left to their top left). Each player has 15 pieces. The starting position is as such, numbering the points from the origin of each player's track: Point six: five pieces. Point 8: three pieces. Point 13: five pieces. Point 24: two pieces. Players move according to the number on each die by moving one piece the number on one die and another the number on the other die, or by moving one piece twice (once for each die). Players cannot end their move on a point with multiple opposing pieces. If a player ends the turn on a point with one opposing piece, that piece is placed in the middle of the board (not on a point) and must reenter the board according to the next die roll, counting the origin point as a move of one. They cannot reenter on a point with two or more pieces. No other pieces can move until all of the pieces belonging to that player are removed from the center. When all of a player's pieces are on their final 6 points, they may start removing pieces from the board. They can do so by rolling a 6 to move from the 6th point, and so on down to 1. Players must use all available moves presented by the dice. The first player to remove all of their pieces wins. The winner gains one point, or two points if the opponent has pieces in their starting quadrant.\n \n\n###\n\n", "completion": "(define \"AllPiecesInFinalQuadrant\" (\"AllOwnedPiecesIn\" (sites Mover \"FinalQuadrant\"))) (define \"EnterPieces\" (if (is Occupied (mapEntry \"Bar\" Mover)) (forEach Die if:(\"DieNotUsed\") (move (from (mapEntry \"Bar\" Mover)) (to (\"NextSiteFrom\" (mapEntry \"Bar\" Mover) (pips)) if:(< (size Stack at:(to)) 2) (\"HittingCapture\" (mapEntry \"Bar\" Next)))) (then (\"ReplayNotAllDiceUsed\"))))) (define \"NextSiteFrom\" (\"NextSiteOnTrack\" #2 from:#1)) (game \"Nard\" (players 2) (equipment { (\"BackgammonBoard\" (\"BackgammonTracksWithBar\" End)) (dice d:6 num:2) (map \"Bar\" {(pair P1 6) (pair P2 19)}) (regions \"FinalQuadrant\" P1 (sites {20..25})) (regions \"FinalQuadrant\" P2 (sites {7..12})) (piece \"Disc\" Each (forEach Die if:(\"DieNotUsed\") (if (\"IsEndTrack\" (\"NextSiteFrom\" (from) (pips))) (if (\"AllPiecesInFinalQuadrant\") (move Remove (from))) (move (from (from)) (to (\"NextSiteFrom\" (from) (pips)) if:(\"NoEnemyOrOnlyOne\" (to)) (\"HittingCapture\" (mapEntry \"Bar\" Next))))) (then (\"ReplayNotAllDiceUsed\"))))}) (rules (start { (place Stack \"Disc1\" 7 count:5) (place Stack \"Disc1\" 4 count:3) (place Stack \"Disc1\" 13 count:5) (place Stack \"Disc1\" 25 count:2) (place Stack \"Disc2\" 20 count:5) (place Stack \"Disc2\" 17 count:3) (place Stack \"Disc2\" 0 count:5) (place Stack \"Disc2\" 12 count:2)}) (play (\"RollEachNewTurnMove\" (priority { (\"EnterPieces\") (if (is Empty (mapEntry \"Bar\" Mover)) (max Distance (forEach Piece top:True)))}) (then (if (no Pieces Mover) (if (no Pieces Enemy in:(sites Mover \"FinalQuadrant\")) (addScore Mover 1) (addScore Mover 2)))))) (end (\"EscapeWin\")))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nIf, at the end of your opponent\u2019s turn, you have at least 4 of your stones and/or stacks in the same rank, or in the same file, you win. -> You win for having any of the following at the end of your opponent\u2019s turn: 3 stones along the outermost files and ranks (a, i, 1, or 9); 4 stones along files b or h, or ranks 2 or 8; and 5 stones along the central files and ranks (c \u2013 g and 3 \u2013 7).\n(define \"OpponentCount\" (count Sites in:(\"OpponentSites\" #1 #2))) (define \"OpponentSites\" (intersection (sites #1 #2) (sites Occupied by:Next container:\"Board\"))) (define \"MoveSecondKnight\" (move Add (to (\"PossibleKnightSites\" (var \"CondemnedSite\"))) stack:True (then (remove (var \"CondemnedSite\"))))) (define \"MoveFirstKnight\" (move Add (to (\"PossibleKnightSites\" (var \"CondemnedSite\"))) stack:True (then (do (set Pending) next:(moveAgain))))) (define \"MoveCondemnPiece\" (move Select (from if:(and (\"IsTopLevel\" (from)) (<= 2 (count Sites in:(\"PossibleKnightSites\" (from)))))) (then (do (set Var \"CondemnedSite\" (last From)) next:(do (set State at:(var \"CondemnedSite\") (\"CondemnedState\")) next:(moveAgain)))))) (define \"PossibleKnightSites\" (sites To (move Leap (from #1) { { F F R F} { F F L F} { F R F F} { F L F F}} (to if:(\"CanPlaceKnight\"))))) (define \"CanPlaceKnight\" (or (is Empty (to)) (and (\"IsEnemyAt\" (to)) (\"IsEmptyOrSingletonStack\" (to))))) (define \"CondemnedState\" 1) (game \"Callanish\" (players 2) (equipment { (board (square 7)) (piece \"Disc\" Each (\"MoveCondemnPiece\"))}) (rules phases: { (phase \"Opening\" (play (move Add (to (sites Empty)))) (nextPhase (>= (count Turns) 2) \"Playing\")) (phase \"Playing\" (play (if \"SameTurn\" (if (is Pending) (\"MoveSecondKnight\") (\"MoveFirstKnight\")) (forEach Piece))))} (end { (if (and (= (% (- (count Moves) 2) 3) 0) (or { (<= 4 (\"OpponentCount\" Row 0)) (<= 4 (\"OpponentCount\" Row 1)) (<= 4 (\"OpponentCount\" Row 2)) (<= 4 (\"OpponentCount\" Row 3)) (<= 4 (\"OpponentCount\" Row 4)) (<= 4 (\"OpponentCount\" Row 5)) (<= 4 (\"OpponentCount\" Row 6)) (<= 4 (\"OpponentCount\" Column 0)) (<= 4 (\"OpponentCount\" Column 1)) (<= 4 (\"OpponentCount\" Column 2)) (<= 4 (\"OpponentCount\" Column 3)) (<= 4 (\"OpponentCount\" Column 4)) (<= 4 (\"OpponentCount\" Column 5)) (<= 4 (\"OpponentCount\" Column 6))})) (result Mover Loss)) (if (no Moves Mover) (result Mover Loss))})))\n\n###\n\n", "completion": "(define \"OpponentCount\" (count Sites in:(\"OpponentSites\" #1 #2))) (define \"OpponentSites\" (intersection (sites #1 #2) (sites Occupied by:Next container:\"Board\"))) (define \"MoveSecondKnight\" (move Add (to (\"PossibleKnightSites\" (var \"CondemnedSite\"))) stack:True (then (remove (var \"CondemnedSite\"))))) (define \"MoveFirstKnight\" (move Add (to (\"PossibleKnightSites\" (var \"CondemnedSite\"))) stack:True (then (do (set Pending) next:(moveAgain))))) (define \"MoveCondemnPiece\" (move Select (from if:(and (\"IsTopLevel\" (from)) (<= 2 (count Sites in:(\"PossibleKnightSites\" (from)))))) (then (do (set Var \"CondemnedSite\" (last From)) next:(do (set State at:(var \"CondemnedSite\") (\"CondemnedState\")) next:(moveAgain)))))) (define \"PossibleKnightSites\" (sites To (move Leap (from #1) { { F F R F} { F F L F} { F R F F} { F L F F}} (to if:(\"CanPlaceKnight\"))))) (define \"CanPlaceKnight\" (or (is Empty (to)) (and (\"IsEnemyAt\" (to)) (\"IsEmptyOrSingletonStack\" (to))))) (define \"CondemnedState\" 1) (game \"Callanish\" (players 2) (equipment { (board (remove (square 9) cells:{0 1 7 8 9 17 63 71 72 73 79 80})) (piece \"Disc\" Each (\"MoveCondemnPiece\"))}) (rules phases: { (phase \"Opening\" (play (move Add (to (sites Empty)))) (nextPhase (>= (count Turns) 2) \"Playing\")) (phase \"Playing\" (play (if \"SameTurn\" (if (is Pending) (\"MoveSecondKnight\") (\"MoveFirstKnight\")) (forEach Piece))))} (end { (if (and (= (% (- (count Moves) 2) 3) 0) (or { (<= 3 (\"OpponentCount\" Row 0)) (<= 4 (\"OpponentCount\" Row 1)) (<= 5 (\"OpponentCount\" Row 2)) (<= 5 (\"OpponentCount\" Row 3)) (<= 5 (\"OpponentCount\" Row 4)) (<= 5 (\"OpponentCount\" Row 5)) (<= 5 (\"OpponentCount\" Row 6)) (<= 4 (\"OpponentCount\" Row 7)) (<= 3 (\"OpponentCount\" Row 8)) (<= 3 (\"OpponentCount\" Column 0)) (<= 4 (\"OpponentCount\" Column 1)) (<= 5 (\"OpponentCount\" Column 2)) (<= 5 (\"OpponentCount\" Column 3)) (<= 5 (\"OpponentCount\" Column 4)) (<= 5 (\"OpponentCount\" Column 5)) (<= 5 (\"OpponentCount\" Column 6)) (<= 4 (\"OpponentCount\" Column 7)) (<= 3 (\"OpponentCount\" Column 8))})) (result Mover Loss)) (if (no Moves Mover) (result Mover Loss))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThree concentric triangles, with lines connecting their midpoints and corners. Eight pieces per player. Players alternate turns placing a piece on an empty spot on the board. When all of the pieces are placed, players alternate turns moving a piece to an empty adjacent spot along the lines. When a player places three of their pieces in a row, they remove one of the opponent's pieces from the board. A piece that is in a three-in-a-row pattern cannot be removed. The player who removes all of the opponent's pieces wins. \n\n###\n\n", "completion": "(game \"Gurgaldaj\" (players 2) (equipment { (board (concentric Triangle rings:3 joinCorners:True) use:Vertex) (hand Each) (piece \"Marker\" Each (\"StepToEmpty\" ~ (then (\"ReplayIfLine3\" Orthogonal))))}) (rules (start (place \"Marker\" \"Hand\" count:8)) phases:{ (phase \"Placement\" (play (if \"SameTurn\" (\"RemoveAnyEnemyPieceNotInLine3\" Orthogonal) (move (from (handSite Mover)) (to (sites Empty)) (then (\"ReplayIfLine3\" Orthogonal))))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (phase \"Movement\" (play (if \"SameTurn\" (\"RemoveAnyEnemyPieceNotInLine3\" Orthogonal) (forEach Piece))))} (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe game is played on a board with twelve points on either side. The points form a continuous track in a horseshoe shape; each player progresses in opposite directions (one from their bottom right to the top right, the other from their bottom left to their top left). Each player has 15 pieces. The starting position is as such, numbering the points from the origin of each player's track: Point six: five pieces Point 8: three pieces Point 13: five pieces Point 24: two pieces. Players move according to the number on each die by moving one piece the number on one die and other the number on the other die, or by moving one piece the total number of both die. Players cannot end their move on a point with multiple opposing pieces. If a player ends the turn on a point with one opposing piece, that piece is placed in the middle of the board (not on a point) and must reenter the board according the the next die roll, counting the origin point as a move of 1. They cannot reenter on a point with two or more pieces. No other pieces can move until all of the pieces belonging to that player are removed from the center. When all of a player's pieces are on their final 6 points, they may start removing pieces from the board. They can do so by rolling a 6 to move from the 6th point, and so on down to 1. Players must use all available moves presented by the dice. The first player to remove all of their pieces wins.\n \n\n###\n\n", "completion": "(define \"AllPiecesInFinalQuadrant\" (\"AllOwnedPiecesIn\" (sites Mover \"FinalQuadrant\"))) (define \"EnterPieces\" (if (is Occupied (handSite Mover)) (forEach Die if:(\"DieNotUsed\") (move (from (handSite Mover)) (to (\"NextSiteFrom\" (handSite Mover) (pips)) if:(< (size Stack at:(to)) 2) (\"HittingCapture\" (handSite Next)))) (then (\"ReplayNotAllDiceUsed\"))))) (define \"NextSiteFrom\" (\"NextSiteOnTrack\" #2 from:#1)) (game \"Ssang-Ryouk\" (players 2) (equipment { (board (add (remove (merge (rectangle 3 6) (shift 7 0 (rectangle 3 6))) vertices:{6 7 8 9 10 11 24 25 26 27 28 29}) edges:{{11 18} {5 12} {0 6} {1 7} {2 8} {3 9} {4 10} {5 11} {12 18} {13 19} {14 20} {15 21} {16 22} {17 23}}) { (track \"Track1\" \"24,17,W,N,E,End\" P1 directed:True) (track \"Track2\" \"25,23,W,S,E,End\" P2 directed:True)} use:Vertex) (dice d:6 num:2) (piece \"Disc\" Each (forEach Die if:(\"DieNotUsed\") (if (= End (\"NextSiteFrom\" (from) (pips))) (if (\"AllPiecesInFinalQuadrant\") (move Remove (from))) (move (from (from)) (to (\"NextSiteFrom\" (from) (pips)) if:(\"NoEnemyOrOnlyOne\" (to)) (\"HittingCapture\" (handSite Next))))) (then (\"ReplayNotAllDiceUsed\")))) (hand Each) (regions \"FinalQuadrant\" P1 (sites {18..23})) (regions \"FinalQuadrant\" P2 (sites {12..17}))}) (rules (start { (place Stack \"Disc1\" 6 count:5) (place Stack \"Disc1\" 4 count:3) (place Stack \"Disc1\" 12 count:5) (place Stack \"Disc1\" 23 count:2) (place Stack \"Disc2\" 18 count:5) (place Stack \"Disc2\" 10 count:3) (place Stack \"Disc2\" 0 count:5) (place Stack \"Disc2\" 17 count:2)}) (play (\"RollEachNewTurnMove\" (priority { (\"EnterPieces\") (if (is Empty (handSite Mover)) (max Distance (forEach Piece top:True)))}))) (end (\"EscapeWin\")))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"PiecesOwnedBy\" (+ (count at:(mapEntry #1)) (count in:(sites #1)))) (game \"Enindji\" (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 (if (is Proposed \"End\") (or (move Vote \"End\") (move Vote \"No\")) (or (if (is Cycle) (move Propose \"End\")) (do (move Select (from (sites Mover) if:(< 0 (count at:(from)))) (then (sow if:(= (count at:(to)) 4) apply:(fromTo (from (to)) (to (if (is In (to) (sites P1)) (mapEntry 1) (mapEntry 2))) count:(count at:(to))) includeSelf:False))) ifAfterwards:(< 0 (count in:(sites Next))))))) (end (\"MancalaByScoreWhen\" (and (no Moves Mover) (no Moves Next))))))\n\n###\n\n", "completion": "2x6 board, with a storage hole on either end. The game starts with four counters in each hole. A player picks up all of the counters in one of the holes in their row and sows them one-by-one in a counterclockwise direction in consecutive holes from the hole the pieces originated. The starting hole is always left empty, even if a player sows in a complete circuit of the board, the original house is skipped and sowing continues in the next hole after it. When the final counter of a sowing lands in a hole with three counters, the owner of that hole captures the counters. If an opponent's holes are all empty, the other player must make a move placing counters in the opponent's row. If not possible, the player captures all the counters in their row. The player who has captured the most counters wins. If the game continues in a repeating loop, the players can agree to end the game and capture the counters remaining in their row.\n END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nSmall Size -> Small Size\n(define \"Move\" (move (from (sites Occupied by:All)) (to (union (sites Around (sites Distance (step Orthogonal (to if:(is In (to) (sites Empty)))) from:(from) (range 1 (count Sites in:(sites Board)))) Orthogonal) (sites Around (from) Orthogonal)) if: (and (= (what at:(from)) (what at:(to))) (not (= (from) (to)))) (apply (and (remove (from)) (remove (to))))))) (game \"Shisen-Sho\" (players 1) (equipment { (board (rectangle (+ 14 0)(+ 18 0))) (piece \"BambooOne\" P1) (piece \"BambooTwo\" P1) (piece \"BambooThree\" P1) (piece \"BambooFour\" P1) (piece \"BambooFive\" P1) (piece \"BambooSix\" P1) (piece \"BambooSeven\" P1) (piece \"BambooEight\" P1) (piece \"BambooNine\" P1) (piece \"CharacterOne\" P1) (piece \"CharacterTwo\" P1) (piece \"CharacterThree\" P1) (piece \"CharacterFour\" P1) (piece \"CharacterFive\" P1) (piece \"CharacterSix\" P1) (piece \"CharacterSeven\" P1) (piece \"CharacterEight\" P1) (piece \"CharacterNine\" P1) (piece \"CircleOne\" P1) (piece \"CircleTwo\" P1) (piece \"CircleThree\" P1) (piece \"CircleFour\" P1) (piece \"CircleFive\" P1) (piece \"CircleSix\" P1) (piece \"CircleSeven\" P1) (piece \"CircleEight\" P1) (piece \"CircleNine\" P1) (piece \"DragonGreen\" P1) (piece \"DragonRed\" P1) (piece \"DragonWhite\" P1) (piece \"FlowerBamboo\" P1) (piece \"FlowerChrysanthemum\" P1) (piece \"FlowerOrchid\" P1) (piece \"FlowerPlum\" P1) (piece \"SeasonSpring\" P1) (piece \"SeasonSummer\" P1) (piece \"SeasonAutumn\" P1) (piece \"SeasonWinter\" P1) (piece \"WindNorth\" P1) (piece \"WindEast\" P1) (piece \"WindWest\" P1) (piece \"WindSouth\" P1) (regions \"TilePlacementRegion\" (sites Board))}) (rules (start { (place Random (sites \"TilePlacementRegion\") {\"BambooOne\" \"BambooTwo\" \"BambooThree\" \"BambooFour\" \"BambooFive\" \"BambooSix\" \"BambooSeven\" \"BambooEight\" \"BambooNine\" \"CharacterOne\" \"CharacterTwo\" \"CharacterThree\" \"CharacterFour\" \"CharacterFive\" \"CharacterSix\" \"CharacterSeven\" \"CharacterEight\" \"CharacterNine\" \"CircleOne\" \"CircleTwo\" \"CircleThree\" \"CircleFour\" \"CircleFive\" \"CircleSix\" \"CircleSeven\" \"CircleEight\" \"CircleNine\" \"DragonGreen\" \"DragonRed\" \"DragonWhite\" \"FlowerBamboo\" \"FlowerChrysanthemum\" \"FlowerOrchid\" \"FlowerPlum\" \"SeasonSpring\" \"SeasonSummer\" \"SeasonAutumn\" \"SeasonWinter\" \"WindNorth\" \"WindEast\" \"WindWest\" \"WindSouth\"} count:6)}) (play \"Move\") (end (if (no Pieces All) (result P1 Win)))))\n\n###\n\n", "completion": "(define \"Move\" (move (from (sites Occupied by:All)) (to (union (sites Around (sites Distance (step Orthogonal (to if:(is In (to) (sites Empty)))) from:(from) (range 1 (count Sites in:(sites Board)))) Orthogonal) (sites Around (from) Orthogonal)) if: (and (= (what at:(from)) (what at:(to))) (not (= (from) (to)))) (apply (and (remove (from)) (remove (to))))))) (game \"Shisen-Sho\" (players 1) (equipment { (board (rectangle (+ 16 0)(+ 21 0))) (piece \"BambooOne\" P1) (piece \"BambooTwo\" P1) (piece \"BambooThree\" P1) (piece \"BambooFour\" P1) (piece \"BambooFive\" P1) (piece \"BambooSix\" P1) (piece \"BambooSeven\" P1) (piece \"BambooEight\" P1) (piece \"BambooNine\" P1) (piece \"CharacterOne\" P1) (piece \"CharacterTwo\" P1) (piece \"CharacterThree\" P1) (piece \"CharacterFour\" P1) (piece \"CharacterFive\" P1) (piece \"CharacterSix\" P1) (piece \"CharacterSeven\" P1) (piece \"CharacterEight\" P1) (piece \"CharacterNine\" P1) (piece \"CircleOne\" P1) (piece \"CircleTwo\" P1) (piece \"CircleThree\" P1) (piece \"CircleFour\" P1) (piece \"CircleFive\" P1) (piece \"CircleSix\" P1) (piece \"CircleSeven\" P1) (piece \"CircleEight\" P1) (piece \"CircleNine\" P1) (piece \"DragonGreen\" P1) (piece \"DragonRed\" P1) (piece \"DragonWhite\" P1) (piece \"FlowerBamboo\" P1) (piece \"FlowerChrysanthemum\" P1) (piece \"FlowerOrchid\" P1) (piece \"FlowerPlum\" P1) (piece \"SeasonSpring\" P1) (piece \"SeasonSummer\" P1) (piece \"SeasonAutumn\" P1) (piece \"SeasonWinter\" P1) (piece \"WindNorth\" P1) (piece \"WindEast\" P1) (piece \"WindWest\" P1) (piece \"WindSouth\" P1) (regions \"TilePlacementRegion\" (sites Board))}) (rules (start { (place Random (sites \"TilePlacementRegion\") {\"BambooOne\" \"BambooTwo\" \"BambooThree\" \"BambooFour\" \"BambooFive\" \"BambooSix\" \"BambooSeven\" \"BambooEight\" \"BambooNine\" \"CharacterOne\" \"CharacterTwo\" \"CharacterThree\" \"CharacterFour\" \"CharacterFive\" \"CharacterSix\" \"CharacterSeven\" \"CharacterEight\" \"CharacterNine\" \"CircleOne\" \"CircleTwo\" \"CircleThree\" \"CircleFour\" \"CircleFive\" \"CircleSix\" \"CircleSeven\" \"CircleEight\" \"CircleNine\" \"DragonGreen\" \"DragonRed\" \"DragonWhite\" \"FlowerBamboo\" \"FlowerChrysanthemum\" \"FlowerOrchid\" \"FlowerPlum\" \"SeasonSpring\" \"SeasonSummer\" \"SeasonAutumn\" \"SeasonWinter\" \"WindNorth\" \"WindEast\" \"WindWest\" \"WindSouth\"} count:8)}) (play \"Move\") (end (if (no Pieces All) (result P1 Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nNine concentric circles. Any number of players. Each player plays as one piece. Two nut shells, used as dice. The values are as follows: two round sides = 2; two hollow sides = 1; one of each side = 0. Players move their pieces from outside the circles into progressive rings until they reach Paradise at the center, at which point the piece goes back to the outside of the board. The first player to reach Paradise three times wins. The game involves 8 players.\n\n###\n\n", "completion": "(define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" #1)) (define \"ThrowValue\" (mapEntry \"Throw\" (count Pips))) (game \"Paradis\" (players 8) (equipment { (board (concentric {8 8 8 8 8 8 8 8 8 8}) { (track \"Track1\" {72 64 56 48 40 32 24 16 8 0 8 16 24 32 40 48 56 64 72 64 56 48 40 32 24 16 8 0 8 16 24 32 40 48 56 64 72 64 56 48 40 32 24 16 8 0 8 16 24 32 40 48 56 64} P1 directed:True) (track \"Track2\" {73 65 57 49 41 33 25 17 9 1 9 17 25 33 41 49 57 65 73 65 57 49 41 33 25 17 9 1 9 17 25 33 41 49 57 65 73 65 57 49 41 33 25 17 9 1 9 17 25 33 41 49 57 65} P2 directed:True) (track \"Track3\" {74 66 58 50 42 34 26 18 10 2 10 18 26 34 42 50 58 66 74 66 58 50 42 34 26 18 10 2 10 18 26 34 42 50 58 66 74 66 58 50 42 34 26 18 10 2 10 18 26 34 42 50 58 66} P3 directed:True) (track \"Track4\" {75 67 59 51 43 35 27 19 11 3 11 19 27 35 43 51 59 67 75 67 59 51 43 35 27 19 11 3 11 19 27 35 43 51 59 67 75 67 59 51 43 35 27 19 11 3 11 19 27 35 43 51 59 67} P4 directed:True) (track \"Track5\" {76 68 60 52 44 36 28 20 12 4 12 20 28 36 44 52 60 68 76 68 60 52 44 36 28 20 12 4 12 20 28 36 44 52 60 68 76 68 60 52 44 36 28 20 12 4 12 20 28 36 44 52 60 68} P5 directed:True) (track \"Track6\" {77 69 61 53 45 37 29 21 13 5 13 21 29 37 45 53 61 69 77 69 61 53 45 37 29 21 13 5 13 21 29 37 45 53 61 69 77 69 61 53 45 37 29 21 13 5 13 21 29 37 45 53 61 69} P6 directed:True) (track \"Track7\" {78 70 62 54 46 38 30 22 14 6 14 22 30 38 46 54 62 70 78 70 62 54 46 38 30 22 14 6 14 22 30 38 46 54 62 70 78 70 62 54 46 38 30 22 14 6 14 22 30 38 46 54 62 70} P7 directed:True) (track \"Track8\" {79 71 63 55 47 39 31 23 15 7 15 23 31 39 47 55 63 71 79 71 63 55 47 39 31 23 15 7 15 23 31 39 47 55 63 71 79 71 63 55 47 39 31 23 15 7 15 23 31 39 47 55 63 71} P8 directed:True)} use:Vertex) (\"StickDice\" 2) (piece \"Marker\" Each (move (from (from)) (to (\"SiteToMoveOnTrack\" (\"ThrowValue\")) (apply (if (or (and (= 1 (\"ThrowValue\")) (= (mapEntry \"Center\" Mover) (to))) (and (= 2 (\"ThrowValue\")) (or (= (mapEntry \"Center\" Mover) (to)) (= (mapEntry \"Center\" Mover) (\"SiteToMoveOnTrack\" 1))))) (addScore Mover 1)))))) (map \"Throw\" {(pair 0 2) (pair 1 0) (pair 2 1)}) (map \"Center\" {(pair P1 0) (pair P2 1) (pair P3 2) (pair P4 3) (pair P5 4) (pair P6 5) (pair P7 6) (pair P8 7)})}) (rules (start { (place \"Marker1\" 72) (place \"Marker2\" 73) (place \"Marker3\" 74) (place \"Marker4\" 75) (place \"Marker5\" 76) (place \"Marker6\" 77) (place \"Marker7\" 78) (place \"Marker8\" 79)}) (play (\"RollMove\" (if (!= (\"ThrowValue\") 0) (forEach Piece)))) (end (if (= (score Mover) 3) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n8x8 board, every other square marked with an X in a checkered pattern. Twelve pieces per player, positioned on the first three rows closest to the player on the marked squares. Players alternate turns moving a piece diagonally forward. A player may capture an opponent's piece by hopping over it to an empty spot on the opposite side of it along the lines. Multiple captures are allowed, if possible. When a player's piece reaches the opposite edge of the board from which it started, it becomes a king. It may move over any distance, diagonally, and may capture by leaping any distance over any number of opponent's pieces, capturing all of them in that line. The king cannot take in multiple directions in one turn. The first player to capture all of the opponent's pieces wins.\n \n\n###\n\n", "completion": "(define \"HopKing\" (move Hop (from) Diagonal (between before:(count Rows) (range 1 9) after:(count Rows) if:(and (not (is In (between) (sites ToClear))) (\"IsEnemyAt\" (between))) (apply (remove (between)))) (to if:(is Empty (to))) (then (\"ReplayIfCanMove\" (hop (from (last To)) SameDirection (between before:(count Rows) (range 1 (count Rows)) after:(count Rows) if:(and (not (is In (between) (sites ToClear))) (\"IsEnemyAt\" (between))) (apply (remove (between)))) (to if:(is Empty (to)))))))) (define \"HopKingAgain\" (move Hop (from (last To)) SameDirection (between before:(count Rows) (range 1 9) after:(count Rows) if:(and (not (is In (between) (sites ToClear))) (\"IsEnemyAt\" (between))) (apply (remove (between)))) (to if:(is Empty (to))) (then (\"ReplayIfCanMove\" (hop (from (last To)) SameDirection (between before:(count Rows) (range 1 (count Rows)) after:(count Rows) if:(and (not (is In (between) (sites ToClear))) (\"IsEnemyAt\" (between))) (apply (remove (between)))) (to if:(is Empty (to)))))))) (define \"JumpToPromotionZone\" (is In (last To) (sites Next))) (define \"IsUnpromoted\" (\"IsPieceAt\" \"Counter\" Mover (last To))) (define \"HopMan\" (move Hop (from #1) Diagonal (between if:(and (not (is In (between) (sites ToClear))) (\"IsEnemyAt\" (between))) (apply (remove (between) at:EndOfTurn))) (to if:(is Empty (to))) #2)) (game \"Moo\" (\"TwoPlayersNorthSouth\") (\"DraughtsEquipment\" (square 8) ~ (regions \"MarkedCell\" (sites Phase 0))) (rules (\"BlackCellsSetup\" 3) (play (if \"SameTurn\" (or (if \"IsUnpromoted\" (\"HopMan\" (last To) (then (\"ReplayIfCanMove\" (\"HopMan\" (last To)) (\"PromoteIfReach\" (sites Next) \"DoubleCounter\")))) (\"HopKingAgain\")) (move Pass)) (or (forEach Piece \"Counter\" (or (\"HopMan\" (from) (then (\"ReplayIfCanMove\" (\"HopMan\" (last To)) (\"PromoteIfReach\" (sites Next) \"DoubleCounter\")))) (\"StepToEmpty\" (directions {FR FL})) (then (\"PromoteIfReach\" (sites Next) \"DoubleCounter\")))) (forEach Piece \"DoubleCounter\" (or (\"HopKing\") (move Slide Diagonal)))))) (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Construct a Ludii game based on the following description\n5x5 intersecting lines, with diagonals in each 3x3 quadrant of the board. On one end, a square with diagonals, with one corner as the midpoint of one of the sides of the main board. On the opposite side, a triangle, with a line bisecting the base and another bisecting this line and intersecting with the other two sides of the triangle. The triangle's apex is the midpoint of the opposite side as the square. One player plays with two larger pieces, the Bulls, which start at the points where the triangle and square intersect with the main board. The other player plays with 24 smaller pieces. Eight of these begin on the points surrounding the central point of the board, the rest are in the hand. Players alternate turns. The Bulls move to an empty adjacent spot, the other player places one of the pieces from their hand onto the board. When all of these pieces are on the board, the player may move one of the pieces to an empty adjacent spot. The Bull may captured one of the smaller pieces my hopping over it onto an empty space. The goal of the Bulls is to capture all of the smaller pieces. The goal of the player with the smaller pieces is to corner the bulls so they cannot move. Doing so in the triangle and the square is a better win than cornering the Bulls on the main board. \n\n###\n\n", "completion": "(game \"Bouge Shodra\" (players 2) (equipment { (board (merge (\"AlquerqueGraphWithBottomTriangle\") (rotate 45 (shift 1.5 6.2 (square 2 diagonals:Solid)))) use:Vertex) (hand P1) (piece \"Marker\" P1 \"StepToEmpty\") (piece \"Bull\" P2 (or \"StepToEmpty\" \"HopCapture\"))}) (rules (start { (place \"Bull2\" (sites {\"C3\" \"C7\"})) (place \"Marker1\" (difference (expand (sites Centre)) (centrePoint))) (place \"Marker1\" (handSite P1) count:16)}) phases:{ (phase \"Placement\" P1 (play (move (from (handSite P1)) (to (sites Empty)))) (nextPhase Mover (\"HandEmpty\" P1) \"Movement\")) (\"PhaseMovePiece\" \"Movement\")} (end (\"NoMovesP2NoPiecesP1\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe two players take turns moving stacks of their own color (including singletons - stacks of height one), one stack per turn. Players will always have a move available and must make one.\n \n OBJECT OF THE GAME: Kill the enemy queen, or deprive your opponent of moves. \n \n The pie rule is used in Monkey Queen. \n \n Each player will always have exactly one queen monkey on the board which is a stack of two or more checkers all of the player's own color. Additionally, each player may have one or more baby monkeys on the board which are singletons of his own color.\n \n CAPTURING QUEEN MOVES - A monkey queen captures exactly like a Chess queen. Slide the entire stack in any direction (horizontally, vertically or diagonally) along a straight sequence of unoccupied squares terminated by an enemy occupied square, and capture the enemy queen or baby by replacement.\n \n NOTE: A queen may not give birth to its own baby and kill an enemy baby in the same move.\n \n NOTE: A queen of height two may not make a non-capturing move.\n \n NON-CAPTURING QUEEN MOVES - When not capturing, a queen moves any distance in any one direction, exactly like a Chess queen, except it leaves its bottom checker behind on the originating square, reducing the stack height by one. The queen monkey has thus given birth to a baby monkey.\n \n CAPTURING BABY MOVES - A monkey baby, like a monkey queen, captures exactly like a Chess queen. Slide the baby (singleton) in any direction along a straight sequence of unoccupied squares terminated by an enemy occupied square, and capture the enemy queen or baby by replacement.\n \n NON-CAPTURING BABY MOVES - When not capturing, a baby must move toward the enemy queen in the following sense: The straight line distance between your baby and the enemy queen must be shortened by your move.\n \n NOTE: There's no requirement to make a kill in Monkey Queen. \n\n###\n\n", "completion": "(game \"Monkey Queen\" (players 2) (equipment { (board (square 12)) (piece \"Marker\" (or { (move Slide (to if:(\"IsEnemyAt\" (to)) (apply if:(\"IsEnemyAt\" (to)) (remove (to) count:(size Stack at:(to))))) stack:True (then (if (< 1 (size Stack at:(last To))) (set Value Mover (last To))))) (if (< 2 (size Stack at:(from))) (move Slide stack:True (then (and (fromTo (from (last To) level:0) (to (last From))) (set Value Mover (last To)))))) (if (= 1 (size Stack at:(from))) (move Slide (between if:(and (< (count Steps (to) (value Player Next)) (count Steps (from) (value Player Next))) (is Empty (between))))))}))}) (rules (meta (swap)) (start { (place Stack \"Marker1\" 6 count:20) (place Stack \"Marker2\" 137 count:20)}) (play (forEach Piece top:True)) (end (if (or (all Sites (sites Occupied by:Next) if:(= 1 (size Stack at:(site)))) (no Moves Next)) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x2, 3, 4, or 6 board. Each hole contains a number of counters equal to the total number of holes in the board. Sowing begins from any hole in the player's row, and proceeds anti-clockwise. Counters are captured when the final counter lands in an occupied hole, making it contain 2, 4, 6, or 8 counters. When all of the counters have been captured, a second game begins. Each player fills their holes with the same number of counters as the beginning of the previous game. The player who has extra counters holds these in reserve. The other player will have either empty holes or one without the requisite number to fill the hole. Sowing cannot begin and captures cannot be made from these holes until the contents of these holes reaches the required number of counters to fill them. The second player in the first game now becomes the first player. Play continues with subsequent games until one player captures all the counters.\n \n Evidence Map Each player has 2 holes.\n\n###\n\n", "completion": "(define \"NoPieceOnBoard\" (all Sites (union (sites Top) (sites Bottom)) if:(= 0 (count at:(site))))) (define \"PlayableSites\" (sites (values Remembered \"Playable\"))) (game \"Khrour\" (players 2) (equipment { (mancalaBoard 2 2 store:None (track \"Track\" \"0,E,N,W\" loop:True)) (piece \"Seed\" Shared) (hand Each) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start { (set Count 4 to:(sites Track)) (set RememberValue \"Playable\" (union (sites Top) (sites Bottom)))}) phases:{ (phase \"Sowing\" (play (or { (move Select (from (sites Mover) if:(and (is Occupied (from)) (is In (from) (\"PlayableSites\")))) (then (sow apply:(if (and (or { (= 2 (count at:(to))) (= 4 (count at:(to))) (= 6 (count at:(to))) (= 8 (count at:(to)))}) (is In (to) (\"PlayableSites\"))) (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to)))))))} (then (if (\"NoPieceOnBoard\") (forget Value \"Playable\" All) (forEach Site (difference (sites Board) (\"PlayableSites\")) (if (<= 4 (count at:(site))) (remember Value \"Playable\" (site)))))))) (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 (<= 4 (count Cell at:(handSite Mover))) (move (from (handSite Mover)) (to (sites Mover) if:(is Empty (to))) count:4 (then (remember Value \"Playable\" (last To)))) (move (from (handSite Mover)) (to (sites Mover) if:(is Empty (to))) count:(count Cell at:(handSite Mover)))))) (nextPhase (all Passed) \"Sowing\"))})) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe diamond board uses a square tiling. -> The board uses a hexagon tiling.\nThe game is played on a 3x3 board. -> The game is played on a 4x4 board.\n(define \"HalfBoardSize\" (/ (count Cells) 2)) (define \"CaptureTheCell\" (claim (to Cell (site)) (then (and (addScore Mover 1) (moveAgain))))) (define \"NoFreeEdge\" (\"NoSites\" (intersection (sites Incident Edge of:Cell at:(site)) (sites Empty Edge)))) (define \"CellOfLastEdge\" (sites Incident Cell of:Edge at:(last To))) (game \"Dots and Boxes\" (players 2) (equipment {(board (square Diamond 3))}) (rules (play (move Add (to Edge (sites Empty Edge)) (then (forEach Site \"CellOfLastEdge\" (if \"NoFreeEdge\" \"CaptureTheCell\"))))) (end (if (> (score Mover) \"HalfBoardSize\") (result Mover Win)))))\n\n###\n\n", "completion": "(define \"HalfBoardSize\" (/ (count Cells) 2)) (define \"CaptureTheCell\" (claim (to Cell (site)) (then (and (addScore Mover 1) (moveAgain))))) (define \"NoFreeEdge\" (\"NoSites\" (intersection (sites Incident Edge of:Cell at:(site)) (sites Empty Edge)))) (define \"CellOfLastEdge\" (sites Incident Cell of:Edge at:(last To))) (game \"Dots and Boxes\" (players 2) (equipment {(board (hex 4))}) (rules (play (move Add (to Edge (sites Empty Edge)) (then (forEach Site \"CellOfLastEdge\" (if \"NoFreeEdge\" \"CaptureTheCell\"))))) (end (if (> (score Mover) \"HalfBoardSize\") (result Mover Win))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nEach player has 12 holes and sow clockwise. -> Each player has 15 holes and sow anti-clockwise.\n(define \"OnlyOneCounterInEachHole\" (all Sites (sites Board) if:(<= (count at:(site)) 1))) (define \"NoCounters\" (all Sites (sites #1) if:(= 0 (count at:(site))))) (define \"NextHole\" (\"NextSiteOnTrack\" 1 from:#1 \"Track\")) (define \"PlayFromLastHole\" (last To afterConsequence:True)) (define \"Columns\" 12) (game \"Andada\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" store:None (track \"Track\" \"11,W,N,E\" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 2 to:(sites Track))) phases:{ (phase \"Opening\" (play (move Select (from (if (\"SameTurn\") (sites {(\"NextHole\" (\"PlayFromLastHole\"))}) (sites Mover)) if:(> (count at:(from)) 0)) (then (sow (then (if (is Occupied (\"NextHole\" (\"PlayFromLastHole\"))) (moveAgain))))))) (nextPhase (is Mover P2) \"Playing\")) (phase \"Playing\" (play (move Select (from (if (\"SameTurn\") (sites {\"PlayFromLastHole\"}) (sites Mover)) if:(> (count at:(from)) 0)) (then (sow apply:(if (= 1 (count at:(to))) (if (\"OnlyOneCounterInEachHole\") (if (is In (\"NextHole\" (to)) (sites Next)) (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to)))) (if (and (is Occupied (\"OppositePit\" (to))) (is In (to) (sites Mover))) (fromTo (from (\"OppositePit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePit\" (to)))))) (moveAgain)))))) (end (forEach Player if:(\"NoCounters\" Player) (result Player Loss))))}))\n\n###\n\n", "completion": "(define \"OnlyOneCounterInEachHole\" (all Sites (sites Board) if:(<= (count at:(site)) 1))) (define \"NoCounters\" (all Sites (sites #1) if:(= 0 (count at:(site))))) (define \"NextHole\" (\"NextSiteOnTrack\" 1 from:#1 \"Track\")) (define \"PlayFromLastHole\" (last To afterConsequence:True)) (define \"Columns\" 15) (game \"Andada\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" store:None (track \"Track\" \"0,E,N,W\" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 2 to:(sites Track))) phases:{ (phase \"Opening\" (play (move Select (from (if (\"SameTurn\") (sites {(\"NextHole\" (\"PlayFromLastHole\"))}) (sites Mover)) if:(> (count at:(from)) 0)) (then (sow (then (if (is Occupied (\"NextHole\" (\"PlayFromLastHole\"))) (moveAgain))))))) (nextPhase (is Mover P2) \"Playing\")) (phase \"Playing\" (play (move Select (from (if (\"SameTurn\") (sites {\"PlayFromLastHole\"}) (sites Mover)) if:(> (count at:(from)) 0)) (then (sow apply:(if (= 1 (count at:(to))) (if (\"OnlyOneCounterInEachHole\") (if (is In (\"NextHole\" (to)) (sites Next)) (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to)))) (if (and (is Occupied (\"OppositePit\" (to))) (is In (to) (sites Mover))) (fromTo (from (\"OppositePit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePit\" (to)))))) (moveAgain)))))) (end (forEach Player if:(\"NoCounters\" Player) (result Player Loss))))})) END" }, { "prompt": "Construct a Ludii game based on the following description\nFour players. Played with two six-sided dice. A throw of 5 is counted as 1, a throw of 6 is counted as 4.Throws move the pieces as follows: 1: Pawn or King, which move the same as in Shatranj; 2: Rook, which jumps to the second diagonal space; 3: Horse, which moves orthogonally one space and then diagonally another space, jumping over any intervening pieces; 4: Elephant, which moves orthogonally any distance. Kings may be captured. Pieces are assigned values, which award the players stakes at the end of the game: King=5, Elephant=4, Horse=3, Rook=2, Pawn=1. If a player captures all of the other Kings and is still in possession of their own King, the score awarded is 54. The player with the most points wins. \n\n###\n\n", "completion": "(define \"PlayAPiece\" (forEach Die (if (= (\"ThrowPipValue\") 1) (or (forEach Piece \"Pawn\") (forEach Piece \"King_noCross\")) (if (= (\"ThrowPipValue\") 4) (forEach Piece \"Elephant\") (if (= (\"ThrowPipValue\") 3) (forEach Piece \"Knight\") (if (= (\"ThrowPipValue\") 2) (forEach Piece \"Rook\"))))))) (define \"CaptureForwardDiagonal\" (move Step (directions {FR FL}) (to if:(\"IsEnemyAt\" (to)) (\"CaptureToPieceAndAddScore\")))) (define \"CaptureToPieceAndAddScore\" (apply (if (is Occupied (to)) (and { (if (is In (to) (sites {(where \"King\" P1) (where \"King\" P2) (where \"King\" P3) (where \"King\" P4)})) (set Value Mover (+ (value Player Mover) 1))) (if (and (!= Off (where \"King\" Mover)) (= (value Player Mover) 1)) (addScore Mover 54)) (addScore Mover (value Piece at:(to))) (remove (to))})))) (define \"ThrowPipValue\" (mapEntry \"Throw\" (pips))) (game \"Four-Player Chaturanga (al-Biruni)\" (players {(player N) (player W) (player S) (player E)}) (equipment { (board (square 8)) (dice d:6 from:1 num:2) (piece \"Pawn\" Each (or \"StepForwardToEmpty\" \"CaptureForwardDiagonal\")) (piece \"Rook\" Each (move Hop Diagonal (to if:(not (\"IsFriendAt\" (to))) \"CaptureToPieceAndAddScore\"))) (piece \"Knight\" Each (move Leap \"KnightWalk\" (to if:(not (\"IsFriendAt\" (to))) \"CaptureToPieceAndAddScore\"))) (piece \"Elephant\" Each (move Slide Orthogonal (between if:(is Empty (between))) (to if:(\"IsEnemyAt\" (to)) \"CaptureToPieceAndAddScore\"))) (piece \"King_noCross\" Each (move Step (to if:(not (\"IsFriendAt\" (to))) \"CaptureToPieceAndAddScore\"))) (map \"Throw\" {(pair 1 1) (pair 2 2) (pair 3 3) (pair 4 4) (pair 5 1) (pair 6 4)})}) (rules (start { (place \"Pawn1\" {\"A2\" \"B2\" \"C2\" \"D2\"} value:1) (place \"Pawn2\" {\"G1\" \"G2\" \"G3\" \"G4\"} value:1) (place \"Pawn3\" {\"H7\" \"G7\" \"E7\" \"F7\"} value:1) (place \"Pawn4\" {\"B5\" \"B6\" \"B7\" \"B8\"} value:1) (place \"Rook1\" coord:\"A1\" value:2) (place \"Rook2\" coord:\"H1\" value:2) (place \"Rook3\" coord:\"H8\" value:2) (place \"Rook4\" coord:\"A8\" value:2) (place \"Knight1\" coord:\"B1\" value:3) (place \"Knight2\" coord:\"H2\" value:3) (place \"Knight3\" coord:\"G8\" value:3) (place \"Knight4\" coord:\"A7\" value:3) (place \"Elephant1\" coord:\"C1\" value:4) (place \"Elephant2\" coord:\"H3\" value:4) (place \"Elephant3\" coord:\"F8\" value:4) (place \"Elephant4\" coord:\"A6\" value:4) (place \"King_noCross1\" coord:\"D1\" value:5) (place \"King_noCross2\" coord:\"H4\" value:5) (place \"King_noCross3\" coord:\"E8\" value:5) (place \"King_noCross4\" coord:\"A5\" value:5)}) (play (\"RollEachNewTurnMove\" \"PlayAPiece\" (then (if (can Move \"PlayAPiece\") (moveAgain))))) (end (if (= (count Pieces Mover) (- (count Pieces All) 2)) (byScore))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nFour players. Circular board, with 24 semi-circular sockets along the circumference, divided into four sections of six. Twelve pieces per player; the player's colors are green, red, black, and white, the sections to which they enter are in that order anti-clockwise around the board. Three seven-sided dice. Play proceeds in an anti-clockwise fashion around the board, as is the order of player turns. Players enter their pieces on the board according to the throws of the dice. The player must enter all of their pieces, and then attempt to move all of their pieces in the section of the board belonging to the player sitting opposite them. Once the player achieves this, they begin bearing their pieces off the board. When a piece lands on a spot occupied by a single piece belonging to the opponent, the opponent's piece is returned to the place where it started. When a player bears off all their pieces, they win. \n\n###\n\n", "completion": "(define \"AllPiecesInLastQuadrant\" (no Pieces Mover in:(union (sites Hand Mover) (difference (sites Board) (sites Mover \"FinalQuadrant\"))))) (define \"NextSiteFrom\" (\"NextSiteOnTrack\" (pips) from:#1)) (game \"El Mundo\" (players 4) (equipment { (board (concentric {24}) { (track \"Track1\" {24 0 2 4 6 8 10 12 14 16 18 20 22 23 21 19 17 15 13} P1 directed:True) (track \"Track2\" {25 12 14 16 18 20 22 23 21 19 17 15 13 11 9 7 5 3 1} P2 directed:True) (track \"Track3\" {26 23 21 19 17 15 13 11 9 7 5 3 1 0 2 4 6 8 10} P3 directed:True) (track \"Track4\" {27 11 9 7 5 3 1 0 2 4 6 8 10 12 14 16 18 20 22} P4 directed:True)} use:Vertex) (dice d:7 num:3) (regions \"Mundo\" P1 {23 21 19 17 15 13}) (regions \"Mundo\" P2 {11 9 7 5 3 1}) (regions \"Mundo\" P3 {0 2 4 6 8 10}) (regions \"Mundo\" P4 {12 14 16 18 20 22}) (piece \"Marker\" Each (forEach Die if:(\"DieNotUsed\") (if (and (\"AllPiecesInLastQuadrant\") (= (\"NextSiteFrom\" (from)) Off)) (move Remove (from)) (move (from (from)) (to (\"NextSiteFrom\" (from)) if:(\"NoEnemyOrOnlyOne\" (to)) (\"HittingCapture\" (handSite (who at:(to))))))) (then (\"ReplayNotAllDiceUsed\")))) (map \"Entry\" {(pair P1 0) (pair P2 6) (pair P3 12) (pair P4 18)}) (hand Each) (regions \"FinalQuadrant\" P1 (sites {13 15 17 19 21 23})) (regions \"FinalQuadrant\" P2 (sites {1 3 5 7 9 11})) (regions \"FinalQuadrant\" P3 (sites {10 8 6 4 2 0})) (regions \"FinalQuadrant\" P4 (sites {22 20 18 16 14 12}))}) (rules (start { (place Stack \"Marker1\" (handSite P1) count:12) (place Stack \"Marker2\" (handSite P2) count:12) (place Stack \"Marker3\" (handSite P3) count:12) (place Stack \"Marker4\" (handSite P4) count:12)}) (play (\"RollEachNewTurnMove\" (or (forEach Piece top:True) (forEach Piece container:(mover) top:True)))) (end (\"EscapeWin\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayers move their pieces to an adjacent empty point. The goal is to block the other player from being able to move. \n\n###\n\n", "completion": "(game \"Madelinette\" (players 2) (equipment { (board (add (remove (\"AlquerqueGraph\" 3 3) vertices:{7 1}) edges:{{0 1}}) use:Vertex) (piece \"Counter\" Each (\"StepToEmpty\"))}) (rules (start { (place \"Counter1\" (sites {\"A1\" \"C2\" \"A3\"})) (place \"Counter2\" (sites {\"C1\" \"A2\" \"C3\"}))}) (play (forEach Piece)) (end (\"NoMoves\" Loss)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nSame as standard Chess except:\n 1. The board is initially empty and each player has the normal complement of 16 pieces in reserve.\n 2. During a turn, a player must do one of three things:\n --- place a piece from in hand on an empty square on the board\n --- move a previously placed piece to an empty square\n --- move a previously placed piece onto a square occupied by an opposing piece, capturing it.\n 3. Pawns may be entered on the first, second, third or fourth rows only.\n 4. No en-passant, castling, or initial double-step pawn moves.\n 5. A player's King must be placed before being allowed to make any capturing moves. A piece that controls the square that the enemy King occupies does not check it until the friendly King is entered onto the board. That is called 'quasi-check'. A player is under no compulsion to move out of quasi-check, and may even move into quasi-check. A player may legally move into quasi-check. Original\n\n###\n\n", "completion": "(define \"PlacePawn\" (do (move (from (sites Occupied by:#1 container:\"Hand\" component:\"Pawn\")) (to (intersection (sites Empty) (sites #1 \"PawnPlacementRows\")))) ifAfterwards:True)) (define \"KingNotCheckedAndToEmpty\" (and (is Empty (to)) (or (not (\"IsInCheck\" \"King\" Mover at:(to))) (no Pieces Next \"King\" in:(sites Board))))) (game \"Unachess\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (\"ChessPawn\" \"Pawn\" ~ (then (and (\"ReplayInMovingOn\" (sites Mover \"Promotion\")) (set Counter)))) (\"ChessRook\" \"Rook\" (then (set Counter))) (\"ChessKing\" \"King\" (then (set Counter))) (\"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)) (regions \"PawnPlacementRows\" P1 (expand (sites Bottom) steps:3)) (regions \"PawnPlacementRows\" P2 (expand (sites Top) steps:3)) (hand Each size:6)}) (rules (start { (place \"Pawn1\" (handSite P1 0) count:8) (place \"Pawn2\" (handSite P2 0) count:8) (place \"Rook1\" (handSite P1 1) count:2 state:1) (place \"Knight1\" (handSite P1 2) count:2) (place \"Bishop1\" (handSite P1 3) count:2) (place \"Queen1\" (handSite P1 4)) (place \"King1\" (handSite P1 5) state:1) (place \"Rook2\" (handSite P2 1) count:2 state:1) (place \"Knight2\" (handSite P2 2) count:2) (place \"Bishop2\" (handSite P2 3) count:2) (place \"Queen2\" (handSite P2 4)) (place \"King2\" (handSite P2 5) state:1)}) (play (if \"SameTurn\" (move Promote (last To) (piece {\"Queen\" \"Knight\" \"Bishop\" \"Rook\"}) Mover) (do (or { (do (move (from (sites Occupied by:Mover container:\"Hand\" components:{\"King\" \"Queen\" \"Rook\" \"Bishop\" \"Knight\"})) (to (sites Empty))) ifAfterwards:True) (\"PlacePawn\" Mover) (forEach Piece)}) ifAfterwards:(or (not (\"IsInCheck\" \"King\" Mover)) (no Pieces Next \"King\" in:(sites Board)))))) (end { (\"Checkmate\" \"King\") (if (or (no Moves Mover) (= (counter) 99)) (result Mover Draw))}))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"Traffic Lights\" (players 2) (equipment { (board (rectangle 3 4)) (piece \"Square\" Shared) (piece \"Triangle\" Shared) (piece \"Disc\" Shared)}) (rules (play (or { (move Add (piece \"Square\") (to (sites Empty))) (move Select (from (sites Occupied by:Shared component:\"Square\")) (then (promote (last To) (piece {\"Triangle\"}) Shared))) (move Select (from (sites Occupied by:Shared component:\"Triangle\")) (then (promote (last To) (piece {\"Disc\"}) Shared)))})) (end (\"Line3Win\"))))\n\n###\n\n", "completion": "The object is to get a line of three of the same color.\n \n On each turn, you may do ONE of the following:\n \n (1) Put a red counter in an empty square.\n (2) Replace a red counter with a yellow one.\n (3) Replace a yellow counter with a green one. The game is played on a 3x4 board. END" }, { "prompt": "Construct a Ludii game based on the following description\nThis game has two versions: an addition and a deletion version. In the addition version, the graph is initially uncoloured. Players alternate turns, colouring an uncoloured edge in a common colour. However, in the deletion version, the game starts with all the edges coloured. At each turn, a player chooses to remove the colour of an edge. In both versions, the current player loses by turning the coloured graph into a regular graph.\n The game is played on the Graph2. The players play on Addition version.\n\n###\n\n", "completion": "(game \"Windir\" (players 2) (equipment { (board (complete (subdivide (regular Star 8))) use:Edge) (piece \"Marker\" Neutral)}) (rules (play (move Add (piece \"Marker0\") (to Edge (sites Empty Edge)))) (end (if (is RegularGraph Neutral) (result Mover Loss))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nEach player begins with 21 pieces, arranges on the 21 intersections of three consecutive radii. Players alternate turns moving to an empty adjacent spot. Captures are made by hopping over an opponent's piece. The player who captures all of the other player's pieces wins. \n\n###\n\n", "completion": "(game \"Gol Ekuish\" (players 2) (equipment { (board (concentric {1 6 6 6 6 6 6 6}) use:Vertex) (piece \"Counter\" Each (or (\"HopRotationalCapture\") (\"StepRotationalToEmpty\")))}) (rules (start { (place \"Counter1\" (sites {2..4 8..10 14..16 20..22 26..28 32..34 38..40})) (place \"Counter2\" (sites {1 7 13 19 25 31 37 5 6 11 12 17 18 23 24 29 30 35 36 41 42}))}) (play (forEach Piece)) (end (\"NoMoves\" Loss)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nNumbers from 1 to n are placed in the squares. Each row and column must add up to the same number and numbers cannot repeat in the row, column, or square. \n\n###\n\n", "completion": "(game \"Magic Square\" (players 1) (equipment { (board (square 3) (values Cell (range 1 9))) (regions {Columns Rows Diagonals})}) (rules (play (satisfy { (all Different (sites Board)) (is Sum 15)})) (end (if (is Solved) (result P1 Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n17x17 intersecting lines. 151 pieces per player. Each player begins with six larger pieces on the board, on the third line from the perimeter on all four sides, one piece on every fourth intersection, alternating between black and white. These pieces are never moved from the board. There is a star marking at each of these points. Players alternate turns placing one of their pieces on an empty intersection of the board. When a player encloses an area with their pieces, it becomes their territory, and any pieces of the opponent inside it are captured. The opponent cannot place one of their pieces inside a territory won on the previous turn. White plays first. When players can no longer play, the number of counters and each territory are counted to determine the winner. \n\n###\n\n", "completion": "(define \"RemovePreviousTerritoryTaken\" (forEach Site (sites Empty) (if (!= 0 (state at:(site))) (set State at:(site) 0)))) (define \"CaptureSurroundedPiece\" (enclose (from (last To)) Orthogonal (between if:(or (\"IsEnemyAt\" (between)) (is Empty (between))) (apply (and (if (\"IsEnemyAt\" (between)) (remove (between))) (set State at:(between) (mover))))))) (game \"Mig Mang\" (players 2) (equipment { (board (square 17) use:Vertex) (piece \"Ball\" Each)}) (rules (start { (place \"Ball1\" (sites {\"C7\" \"K15\" \"C15\" \"G3\" \"O11\" \"O3\"}) state:1) (place \"Ball2\" (sites {\"C3\" \"K3\" \"C11\" \"G15\" \"O15\" \"O7\"}) state:1)}) (play (move Add (to (sites Empty) if:(= (state at:(to)) 0)) (then (and (\"RemovePreviousTerritoryTaken\") (\"CaptureSurroundedPiece\"))))) (end (if (and (no Moves P1) (no Moves P2)) (byScore { (score P1 (+ (count Pieces P1) (size Territory P1))) (score P2 (+ (count Pieces P2) (size Territory P2)))}))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6 board. Play begins with four counters in each hole. Moves begin from any hole in the player's row and sowing proceeds in an anti-clockwise direction. If the final counter of a sowing lands in an occupied hole, these counters are lifted and sowing continues. If the final counter lands in an empty hole, any counters in the opposite hole are taken and the turn ends. Play continues until one player cannot move. When this happens, the other player captures the remaining counters and the game ends. The player with the most counters wins. \n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (define \"Columns\" 6) (game \"French Wari\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" store:None (track \"Track\" \"0,E,N,W\" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 4 to:(sites Track))) (play (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover)) if:(> (count at:(from)) 0)) (then (sow apply:(if (> (count at:(to)) 1) (moveAgain) (if (> (count at:(\"OppositePitTwoRows\" (to))) 0) (fromTo (from (\"OppositePitTwoRows\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePitTwoRows\" (to)))))))))) (end (\"MancalaByScoreWhen\" (no Moves Mover))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"Fettas\" (players 2) (equipment { (\"NineMensMorrisBoard\") (hand Each) (piece \"Marker\" Each (\"StepToEmpty\" ~ (then (\"ReplayIfLine3\" Orthogonal exact:True))))}) (rules (start (place \"Marker\" \"Hand\" count:11)) phases:{ (phase \"Placement\" (play (if \"SameTurn\" (\"RemoveAnyEnemyPiece\") (move (from (handSite Mover)) (to (sites Empty)) (then (\"ReplayIfLine3\" Orthogonal exact:True))))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (phase \"Movement\" (play (if \"SameTurn\" (\"RemoveAnyEnemyPiece\") (forEach Piece))))} (end (\"CaptureAll\" Next))))\n\n###\n\n", "completion": "Three concentric squares, with lines connecting the midpoints of the sides. Eleven pieces per player. Players alternate turns placing a piece on the board. When a player lines up three of their pieces in a row along one of the lines of the board, the player removes one of the opponent's pieces. When all of the pieces are placed, players move their pieces one spot along the lines of the board. The player who captures all of the opponent's pieces wins. END" }, { "prompt": "Modify the Ludii game according to the following option changes:\n12 Holes per row. -> 15 Holes per row.\n(define \"NextHoleFrom\" (\"NextSiteOnTrack\" 1 from:#1 #2)) (define \"AHoleHasMoreThanOneCounter\" (not (all Sites (forEach (sites Mover) if:(< 1 (count at:(site)))) if:(= 0 (count at:(site)))))) (define \"NoPiece\" (all Sites (sites Player \"Home\") if:(= 0 (count at:(site))))) (define \"Columns\" 12) (game \"Tsoro (Reentered Captures)\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"0,E,N1,W\" loop:True P1) (track \"Track2\" \"24,E,N1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"Track1\")) (regions \"Home\" P2 (sites Track \"Track2\")) (regions \"Inner\" P1 (difference (sites Track \"Track1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"Track2\") (sites Top))) (piece \"Seed\" Shared)}) (rules (start (set Count 2 to:(union (sites Top) (sites Bottom)))) (play (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(if \"AHoleHasMoreThanOneCounter\" (> (count at:(from)) 1) (and (= (count at:(from)) 1) (= 0 (count at:(\"NextHoleFrom\" (from) Mover)))))) (then (sow \"Track\" owner:(mover) apply:(if (= (count at:(to)) 1) (if (is In (to) (sites Mover \"Inner\")) (if (> (count at:(\"OppositePit\" (to))) 0) (and { (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:(\"OppositeOuterPit\" (to))) (count at:(\"OppositePit\" (to)))) \"Track\" owner:(mover))}))) (moveAgain)))))) (end (forEach NonMover if:(\"NoPiece\") (result Player Loss)))))\n\n###\n\n", "completion": "(define \"NextHoleFrom\" (\"NextSiteOnTrack\" 1 from:#1 #2)) (define \"AHoleHasMoreThanOneCounter\" (not (all Sites (forEach (sites Mover) if:(< 1 (count at:(site)))) if:(= 0 (count at:(site)))))) (define \"NoPiece\" (all Sites (sites Player \"Home\") if:(= 0 (count at:(site))))) (define \"Columns\" 15) (game \"Tsoro (Reentered Captures)\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"0,E,N1,W\" loop:True P1) (track \"Track2\" \"30,E,N1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"Track1\")) (regions \"Home\" P2 (sites Track \"Track2\")) (regions \"Inner\" P1 (difference (sites Track \"Track1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"Track2\") (sites Top))) (piece \"Seed\" Shared)}) (rules (start (set Count 2 to:(union (sites Top) (sites Bottom)))) (play (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(if \"AHoleHasMoreThanOneCounter\" (> (count at:(from)) 1) (and (= (count at:(from)) 1) (= 0 (count at:(\"NextHoleFrom\" (from) Mover)))))) (then (sow \"Track\" owner:(mover) apply:(if (= (count at:(to)) 1) (if (is In (to) (sites Mover \"Inner\")) (if (> (count at:(\"OppositePit\" (to))) 0) (and { (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:(\"OppositeOuterPit\" (to))) (count at:(\"OppositePit\" (to)))) \"Track\" owner:(mover))}))) (moveAgain)))))) (end (forEach NonMover if:(\"NoPiece\") (result Player Loss))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"RemoveDeadPieces\" (forEach Site (forEach (sites Occupied by:#1 container:\"Board\") if:(= (size Stack at:(site)) 2)) (and (remove (site)) (remove (site))))) (define \"RemoveEnemyPiece\" (move Remove (forEach (sites Occupied by:Next container:\"Board\") if:(\"IsSingletonStack\" (site))))) (game \"Dig Dig\" (players 2) (equipment { (board (concentric Square rings:3 joinCorners:True) use:Vertex) (hand Each) (piece \"Marker\" Each (\"StepToEmpty\" ~ (then (\"ReplayIfLine3\" if:(\"IsSingletonStack\" (to))))))}) (rules (start { (place Stack \"Marker1\" (handSite P1)) (place Stack \"Marker2\" (handSite P2))}) phases:{ (phase \"Placement\" (play (if \"SameTurn\" \"RemoveEnemyPiece\" (move (from (handSite Mover)) (to (union (forEach (sites Occupied by:Next container:\"Board\") if:(= 1 (size Stack at:(site)))) (sites Empty))) copy:True (then (\"ReplayIfLine3\" if:(\"IsSingletonStack\" (to))))) (then (if (and (not (is Next Mover)) (is Full)) (and { (\"RemoveDeadPieces\" P1) (\"RemoveDeadPieces\" P2) (set Pending)}))))) (nextPhase (is Pending) \"Movement\")) (phase \"Movement\" (play (if \"SameTurn\" \"RemoveEnemyPiece\" (forEach Piece))) (end (if (all Sites (sites Occupied by:Next) if:(not (is In (site) (sites Board)))) (result Mover Win))))}))\n\n###\n\n", "completion": "Three concentric squares, with lines connecting the corners and midpoints of the squares. Two players. Players alternate turns placing one of their pieces on one of the spots on the board. A player may place a piece on top of a piece belonging to their opponent during this phase of the game, and they are both canceled out. When three uncanceled pieces form a row along the lines on the board, the player may capture one of the opponent's pieces. Once all of the spots have been occupied, the canceled pieces are removed. Players alternate turns moving one of their pieces to an empty adjacent spot on the board.The player who captures all of the opponent's pieces wins. END" }, { "prompt": "Construct a Ludii game based on the following description\nFanorona-Tsivy is played on a board of 9x5 intersecting lines with diagonals. Each player has 22 pieces, starting on the intersections of the lines except in the centre position, placed on opposite rows of the board, but alternating in the central row.. Pieces move to an adjacent intersection along the lines. Players must capture pieces when possible. Capturing is accomplished by moving to an adjacent intersection to an opposing piece in the continuing direction of the capturing stones movement, or by moving away from an adjacent opposing pieces in such a direction. When an opponent's piece is captured, all other of the opponent's pieces in that line are also captured. Multiple captures can be made, but cannot be done by moving twice in the same direction. Multiple captures are optional. A player wins by capturing all of the other player's pieces. The game is played on a 5x9 board\n\n###\n\n", "completion": "(define \"MoveIn\" (forEach Piece (move Select (from) (to (sites Around (from)) if:(\"EmptyWithEnemyIn\" #1 #2)) (then (and \"MoveThePiece\" (directional (from #3) #4 \"RemoveEnemyPiece\")))) (then (if (can Move (\"CaptureFromLast\" (last To))) (moveAgain))))) (define \"CaptureFromLast\" (or (\"MoveAgainIn\" #1 (to) SameDirection (last To) (\"LastDirection\" Vertex)) (\"MoveAgainIn\" #1 (from) OppositeDirection (last From) (directions Vertex from:(last To) to:(last From))))) (define \"MoveAgainIn\" (move Select (from #1) (to (sites Around #1) if:(\"EmptyButNotVisitedWithEnemyIn\" #2 #3)) (then (and { \"MoveThePiece\" (directional (from #4) #5 \"RemoveEnemyPiece\") (if (can Move (or (\"CaptureAgainIn\" #1 (to) SameDirection) (\"CaptureAgainIn\" #1 (from) OppositeDirection))) (moveAgain))})))) (define \"MoveThePiece\" (fromTo (from (last From)) (to (last To)))) (define \"RemoveEnemyPiece\" (to if:(\"IsEnemyAt\" (to)) (apply (remove (to))))) (define \"EmptyWithEnemyIn\" (and (is Empty (to)) (\"IsEnemyAt\" (ahead #1 #2)))) (define \"EmptyButNotVisitedWithEnemyIn\" (and { (not (is Visited (to))) (is Empty (to)) (\"IsEnemyAt\" (ahead #1 #2))})) (define \"CaptureAgainIn\" (move Select (from #1) (to (sites Around #1) if:(and { (not (is Visited (to))) (is Empty (to)) (\"IsEnemyAt\" (ahead #2 #3))})))) (game \"Fanorona\" (players 2) (equipment { (\"AlquerqueBoard\" 5 9) (piece \"Marker\" Each)}) (rules (start { (place \"Marker1\" (union { (union (expand (sites Bottom)) (sites {\"B3\" \"D3\" \"G3\" \"I3\"}))})) (place \"Marker2\" (union { (union (sites {\"A3\" \"C3\" \"F3\" \"H3\"}) (expand (sites Top)))}))}) (play (if \"SameTurn\" (or (if (is Occupied (last To)) (\"CaptureFromLast\" (last To)) (\"CaptureFromLast\" (last From))) (move Pass)) (priority { (or (\"MoveIn\" (to) SameDirection (last To) (\"LastDirection\" Vertex)) (\"MoveIn\" (from) OppositeDirection (last From) (directions Vertex from:(last To) to:(last From)))) (forEach Piece \"StepToEmpty\")}))) (end (if (no Pieces Mover) (result Next Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n4x8 board, occasionally 4x9 or 10. Two counters in each hole, except the leftmost hole in the inner row, which has zero, and the hole to its right, which has one. Sowing occurs in an anti-clockwise direction. Players sow from any hole in their two rows. When the final counter lands in an occupied hole, these counters are picked up and sowing continues. When the final counter lands in an empty hole in the inner row, the counters in the opponent's opposite hole in their inner row are captured. If there are also counters in the opponent's opposite hole in the outer row, these are also captured, but only when a capture from the inner row was also made. Players cannot sow single counters, unless there are no holes with multiple counters left, in which case single counters may be sown into an empty hole. Play continues until one player has captured all of the opponent's counters, thus winning the game. Each row has 8 holes.\n\n###\n\n", "completion": "(define \"AllSitesNoMoreThanOne\" (all Sites (sites Mover \"Home\") if:(>= 1 (count at:(site))))) (define \"NextHole\" (\"NextSiteOnTrack\" #2 from:#1 \"Track\")) (define \"NoPiece\" (all Sites (sites Player) if:(= 0 (count at:(site))))) (define \"Columns\" 8) (game \"Njombwa (Two Counters)\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"0,E,N1,W\" loop:True P1) (track \"Track2\" \"16,E,N1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"Track1\")) (regions \"Home\" P2 (sites Track \"Track2\")) (regions \"Inner\" P1 (difference (sites Track \"Track1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"Track2\") (sites Top))) (piece \"Seed\" Shared)}) (rules (start { (set Count 2 to:(difference (sites Board) (sites {8 (+ 1 8) (- (* 8 3) 1) (- (* 8 3) 2)}))) (set Count 1 to:(sites {(+ 8 1) (- (* 8 3) 2)}))}) (play (if (\"AllSitesNoMoreThanOne\") (move Select (from (sites Mover \"Home\") if:(and (is Occupied (from)) (is Empty (\"NextHole\" (from) 1)))) (then (sow \"Track\" owner:(mover)))) (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(> (count at:(from)) 1)) (then (sow \"Track\" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (and (is In (to) (sites Mover \"Inner\")) (is Occupied (\"OppositePit\" (to)))) (and (remove (\"OppositePit\" (to))) (if (is Occupied (\"OppositeOuterPit\" (to))) (remove (\"OppositeOuterPit\" (to)))))))))))) (end (forEach NonMover if:(\"NoPiece\") (result Player Loss))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nEach player has 6 holes per row. -> Each player has 8 holes per row.\n(define \"PiecesOwnedBy\" (+ (count Cell at:(handSite #1)) (count in:(sites #1 \"Home\")))) (define \"Columns\" 6) (game \"Chiana wa Bwalo\" (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)}) (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 Top) (sites Bottom)))) (play (move Select (from (sites Mover \"Home\") if:(> (count at:(from)) 0)) (then (sow \"Track\" owner:(mover) apply:(if (and (= (count at:(to)) 1) (> (count at:(\"OppositePit\" (to))) 0)) (fromTo (from (\"OppositePit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePit\" (to))))))))) (end (\"MancalaByScoreWhen\" (no Moves Next)))))\n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (+ (count Cell at:(handSite #1)) (count in:(sites #1 \"Home\")))) (define \"Columns\" 8) (game \"Chiana wa Bwalo\" (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 Top) (sites Bottom)))) (play (move Select (from (sites Mover \"Home\") if:(> (count at:(from)) 0)) (then (sow \"Track\" owner:(mover) apply:(if (and (= (count at:(to)) 1) (> (count at:(\"OppositePit\" (to))) 0)) (fromTo (from (\"OppositePit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePit\" (to))))))))) (end (\"MancalaByScoreWhen\" (no Moves Next))))) 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 Ludii game based on the following description\nPlayed with three \\ Played on the normal board.\n\n###\n\n", "completion": "(game \"Demala Diviyan Keliya\" (players 2) (equipment { (board (add (remove (merge (shift 0 2 (scale 8 2 (rectangle 3 2))) (scale 1 2 (wedge 5 4))) edges:{ {0 1} {2 3} {4 5}}) edges:{ {0 15} {18 1} {2 11} {14 3} {4 7} {10 5}}) use:Vertex) (hand P2) (piece \"Tiger\" P1 (or \"HopCapture\" \"StepToEmpty\")) (piece \"Dog\" P2 \"StepToEmpty\")}) (rules (start { (place \"Tiger1\" {\"H5\" \"G4\" \"I4\"}) (place \"Dog2\" (handSite P2) count:15)}) phases:{ (phase \"Placement\" P2 (play (move (from (handSite P2)) (to (sites Empty)))) (nextPhase (\"HandEmpty\" P2) \"Movement\")) (\"PhaseMovePiece\" \"Movement\" (end (\"NoMovesLossAndLessNumPiecesPlayerLoss\" P2 7)))})) END" }, { "prompt": "Construct a Ludii game based on the following description\nAt the first round of the game, players can only pick a blank face cube.\n \n Next round players can play the same cube at the previously.\n \n A player cannot return a cube that he/she has played to place on where he/she took it from.\n \n A player who creates the line of opponent\u2019s symbol is the person who loses the game, even if he/she has created a line of his/her own symbol at the same time. \n\n###\n\n", "completion": "(define \"Push\" (move Select #1 (then (and { (push (from (last To)) #2) \"CompleteLineWithPieceTaken\"})))) (define \"From\" (from (difference (intersection (sites #1) #2) (sites {(last To)})))) (define \"LastColumn\" (sites Column (column of:(last To)))) (define \"LastRow\" (sites Row (row of:(last To)))) (define \"TakeAPieceInOuterSites\" (move Select (from (sites Outer)) (then (and (fromTo (from (last To)) (to (handSite (mover)))) (moveAgain))))) (define \"CompleteLineWithPieceTaken\" (if (or (= (what at:(handSite (mover))) (id \"Square0\")) (= (what at:(handSite (mover))) (mover))) (add (piece (mover)) (to (last To))) (add (piece (next)) (to (last To)))) (remove (handSite (mover)))) (game \"Pushing Me XO\" (players 2) (equipment { (board (square 5)) (piece \"Disc\" P1) (piece \"Cross\" P2) (piece \"Square\" Neutral) (hand Each)}) (rules (start (place \"Square0\" (sites Board))) (play (if \"SameTurn\" (or { (\"Push\" (\"From\" Left \"LastRow\") E) (\"Push\" (\"From\" Right \"LastRow\") W) (\"Push\" (\"From\" Bottom \"LastColumn\") N) (\"Push\" (\"From\" Top \"LastColumn\") S)}) \"TakeAPieceInOuterSites\")) (end { (if (is Line 5 throughAny:(sites LastTo) what:(next)) (result Next Win)) (if (is Line 5 throughAny:(sites LastTo) what:(mover)) (result Mover Win))}))) END" }, { "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": "Describe the mechanics of the following Ludii game\n(define \"PieceIsOnTheBoard\" (\"IsNotOffBoard\" (where \"Square\" Mover state:(count Pips)))) (define \"MoveAPieceOf\" (forEach Piece (if #1 (\"MoveForwards\")))) (define \"ValueNextLower\" (if (\"IsNotOffBoard\" (where \"Square\" Mover state:(- (count Pips) 1))) (= (state at:(from)) (- (count Pips) 1)) (if (\"IsNotOffBoard\" (where \"Square\" Mover state:(- (count Pips) 2))) (= (state at:(from)) (- (count Pips) 2)) (if (\"IsNotOffBoard\" (where \"Square\" Mover state:(- (count Pips) 3))) (= (state at:(from)) (- (count Pips) 3)) (if (\"IsNotOffBoard\" (where \"Square\" Mover state:(- (count Pips) 4))) (= (state at:(from)) (- (count Pips) 4)) (= (state at:(from)) (- (count Pips) 5))))))) (define \"ValueNextHigher\" (if (\"IsNotOffBoard\" (where \"Square\" Mover state:(+ (count Pips) 1))) (= (state at:(from)) (+ (count Pips) 1)) (if (\"IsNotOffBoard\" (where \"Square\" Mover state:(+ (count Pips) 2))) (= (state at:(from)) (+ (count Pips) 2)) (if (\"IsNotOffBoard\" (where \"Square\" Mover state:(+ (count Pips) 3))) (= (state at:(from)) (+ (count Pips) 3)) (if (\"IsNotOffBoard\" (where \"Square\" Mover state:(+ (count Pips) 4))) (= (state at:(from)) (+ (count Pips) 4)) (= (state at:(from)) (+ (count Pips) 5))))))) (define \"SameValue\" (= (state at:(from)) (count Pips))) (define \"MoveForwards\" (move Step Forwards (to if:True \"CaptureToPiece\"))) (define \"GoalReached\" (all Sites (sites Mover \"Goal\") if:(is In (site) (sites Occupied by:Mover)))) (define \"CubeInHand\" (sites Occupied by:Mover container:(mover))) (define \"EmptySitesInHome\" (forEach (sites Mover \"Home\") if:(is Empty (site)))) (define \"CaptureToPiece\" (apply (if (is Occupied (to)) (remove (to))))) (game \"EinStein Wurfelt Nicht\" (players {(player SE) (player NW)}) (equipment { (board (square 5)) (piece \"Square\" Each) (hand Each size:6) (dice num:1) (regions \"Home\" P1 (expand (intersection (sites Top) (sites Left)) steps:2 Orthogonal)) (regions \"Home\" P2 (expand (intersection (sites Bottom) (sites Right)) steps:2 Orthogonal)) (regions \"Goal\" P1 (intersection (sites Bottom) (sites Right))) (regions \"Goal\" P2 (intersection (sites Top) (sites Left)))}) (rules (start { (place \"Square1\" (handSite P1) state:1) (place \"Square1\" (handSite P1 1) state:2) (place \"Square1\" (handSite P1 2) state:3) (place \"Square1\" (handSite P1 3) state:4) (place \"Square1\" (handSite P1 4) state:5) (place \"Square1\" (handSite P1 5) state:6) (place \"Square2\" (handSite P2) state:1) (place \"Square2\" (handSite P2 1) state:2) (place \"Square2\" (handSite P2 2) state:3) (place \"Square2\" (handSite P2 3) state:4) (place \"Square2\" (handSite P2 4) state:5) (place \"Square2\" (handSite P2 5) state:6)}) phases:{ (phase \"Placement\" (play (move (from (\"CubeInHand\")) (to (\"EmptySitesInHome\")))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (phase \"Movement\" (play (\"RollMove\" (if (\"PieceIsOnTheBoard\") (\"MoveAPieceOf\" (\"SameValue\")) (or (\"MoveAPieceOf\" (\"ValueNextHigher\")) (\"MoveAPieceOf\" (\"ValueNextLower\")))))))} (end (if (or (no Pieces Next) (\"GoalReached\")) (result Mover Win)))))\n\n###\n\n", "completion": "The game is played on a square board with a 5\u00d75 grid. Each player has six cubes, numbered one to six. During setup, each player can arrange the cubes as he or she sees fit within the triangular area of their own color.\n \n The players take turns rolling a six-sided die and then moving the matching cube. If the matching cube is no longer on the board, the player moves a remaining cube whose number is next-higher or next-lower to the rolled number. The player starting in the top-left may move that cube one square to the right, down, or on the diagonal down and to the right; the player starting in the bottom-right may move that cube one square to the left, up, or on the diagonal up and to the left. Any cube which already lies in the target square is removed from the board.\n \n The objective of the game is for a player to either get one of their cubes to the far corner square in the grid (where their opponent started) or to remove all of their opponent's cubes from the board. The version of the game played on 5x5 board. END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nOrder 4 Hexagon -> Order 4 Hexagon\n(define \"DiagonalVector\" (sites Around (from) Diagonal)) (define \"UnconfinedStiesOf\" (forEach (sites Board) if:(!= Infinity (count Steps Adjacent (step Adjacent (to if:(or (is Empty (to)) (is #1 (who at:(to)))))) (site) (sites Outer))))) (define \"SetScoreOf\" (set Score #1 (- 0 (count Sites in:(difference (sites Occupied by:#1) (\"UnconfinedStiesOf\" #1)))))) (define \"MakeSwap\" (if (is Empty (\"SwapSite\" 1)) (fromTo (from (\"SwapSite\" 0)) (to (\"SwapSite\" 1))) (if (is Empty (\"SwapSite\" 0)) (fromTo (from (\"SwapSite\" 1)) (to (\"SwapSite\" 0))) (set Var \"Piece1\" (\"SwapPiece\" 1) (then (add (piece (\"SwapPiece\" 0)) (to (\"SwapSite\" 1) (apply (remove (to)))) (then (add (piece (var \"Piece1\")) (to (\"SwapSite\" 0) (apply (remove (to)))))))))) (then (and { (\"SetScoreOf\" Mover) (\"SetScoreOf\" Next) (forget Value All)})))) (define \"SwapPiece\" (what at:(\"SwapSite\" #1) level:(topLevel at:(\"SwapSite\" #1)))) (define \"SwapSite\" (arrayValue (values Remembered) index:#1)) (define \"Placement\" (move Select (from #1 if:(> 2 (count Stack at:(from)))) (to \"DiagonalVector\" if:(and { (is In (to) (sites Occupied by:Mover top:True)) (= 2 (count Sites in:(\"SwapSites\" (to) (from)))) (or (= 1 (count Sites in:(intersection (\"SwapSites\" (to) (from)) (sites Occupied by:Mover top:True)))) (= 1 (count Sites in:(intersection (\"SwapSites\" (to) (from)) (sites Occupied by:Next top:True)))))})) (then (and { (add (piece (id \"Disc\" Mover)) (to (last From)) stack:True) (forEach Site (\"SwapSites\" (last To) (last From)) (remember Value (site)))})))) (define \"SwapSites\" (intersection (sites Around #1 Adjacent) (sites Around #2 Adjacent))) (game \"Veloop (Hex)\" (players 2) (equipment { (board (renumber (rotate 90 (hex Hexagon 3))) use:Cell) (piece \"Disc\" Each)}) (rules (start { (place \"Disc1\" 7) (place \"Disc2\" 12)}) (play (priority (\"Placement\" (sites Empty)) (\"Placement\" (sites Occupied by:Next)) (then (\"MakeSwap\")))) (end (if (!= 0 (+ (score P1) (score P2))) (byScore)))))\n\n###\n\n", "completion": "(define \"DiagonalVector\" (sites Around (from) Diagonal)) (define \"UnconfinedStiesOf\" (forEach (sites Board) if:(!= Infinity (count Steps Adjacent (step Adjacent (to if:(or (is Empty (to)) (is #1 (who at:(to)))))) (site) (sites Outer))))) (define \"SetScoreOf\" (set Score #1 (- 0 (count Sites in:(difference (sites Occupied by:#1) (\"UnconfinedStiesOf\" #1)))))) (define \"MakeSwap\" (if (is Empty (\"SwapSite\" 1)) (fromTo (from (\"SwapSite\" 0)) (to (\"SwapSite\" 1))) (if (is Empty (\"SwapSite\" 0)) (fromTo (from (\"SwapSite\" 1)) (to (\"SwapSite\" 0))) (set Var \"Piece1\" (\"SwapPiece\" 1) (then (add (piece (\"SwapPiece\" 0)) (to (\"SwapSite\" 1) (apply (remove (to)))) (then (add (piece (var \"Piece1\")) (to (\"SwapSite\" 0) (apply (remove (to)))))))))) (then (and { (\"SetScoreOf\" Mover) (\"SetScoreOf\" Next) (forget Value All)})))) (define \"SwapPiece\" (what at:(\"SwapSite\" #1) level:(topLevel at:(\"SwapSite\" #1)))) (define \"SwapSite\" (arrayValue (values Remembered) index:#1)) (define \"Placement\" (move Select (from #1 if:(> 2 (count Stack at:(from)))) (to \"DiagonalVector\" if:(and { (is In (to) (sites Occupied by:Mover top:True)) (= 2 (count Sites in:(\"SwapSites\" (to) (from)))) (or (= 1 (count Sites in:(intersection (\"SwapSites\" (to) (from)) (sites Occupied by:Mover top:True)))) (= 1 (count Sites in:(intersection (\"SwapSites\" (to) (from)) (sites Occupied by:Next top:True)))))})) (then (and { (add (piece (id \"Disc\" Mover)) (to (last From)) stack:True) (forEach Site (\"SwapSites\" (last To) (last From)) (remember Value (site)))})))) (define \"SwapSites\" (intersection (sites Around #1 Adjacent) (sites Around #2 Adjacent))) (game \"Veloop (Hex)\" (players 2) (equipment { (board (renumber (rotate 90 (hex Hexagon 4))) use:Cell) (piece \"Disc\" Each)}) (rules (start { (place \"Disc1\" 15) (place \"Disc2\" 22)}) (play (priority (\"Placement\" (sites Empty)) (\"Placement\" (sites Occupied by:Next)) (then (\"MakeSwap\")))) (end (if (!= 0 (+ (score P1) (score P2))) (byScore))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nHalf Chess is played with the same rules as chess. \n\n###\n\n", "completion": "(game \"Half Chess\" (players 2) (equipment { (board (rectangle 4 8)) (\"ChessRook\" \"Rook\" (then (set Counter))) (\"ChessKing\" \"King\" (then (set Counter))) (\"ChessBishop\" \"Bishop\" (then (set Counter))) (\"ChessKnight\" \"Knight\" (then (set Counter))) (\"ChessQueen\" \"Queen\" (then (set Counter)))}) (rules (start { (place \"Rook1\" {\"H1\" \"H4\"}) (place \"Knight1\" {\"G1\" \"G4\"}) (place \"Bishop1\" {\"G2\" \"G3\"}) (place \"Queen1\" coord:\"H3\") (place \"King1\" coord:\"H2\") (place \"Rook2\" {\"A1\" \"A4\"}) (place \"Knight2\" {\"B1\" \"B4\"}) (place \"Bishop2\" {\"B2\" \"B3\"}) (place \"Queen2\" coord:\"A3\") (place \"King2\" coord:\"A2\")}) (play (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King\" Mover)))) (end { (\"Checkmate\" \"King\") (if (or (no Moves Mover) (= (counter) 100)) (result Mover Draw))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayed on a five-pointed star shaped board. One player plays with one piece, the \\ The game starts with 7 discs for the second player.\n\n###\n\n", "completion": "(game \"Kaooa\" (players 2) (equipment { (\"StarBoard\" 5) (hand Each) (piece \"Marker\" P1 (or (\"HopSequenceCapture\") \"StepToEmpty\")) (piece \"Marker\" P2 \"StepToEmpty\")}) (rules (start { (place \"Marker1\" (handSite P1) count:1) (place \"Marker2\" (handSite P2) count:7)}) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (\"PhaseMovePiece\" \"Movement\" (end (\"NoMoves\" 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 the base of the triangle, and another bisecting this line. Eighteen pieces per player, each side arranged on one side of the board, with the central point empty and the player's pieces on the points to the right of it. Players alternate turns moving one of their pieces to an empty point. A piece may jump an opponent's piece to capture it. Multiple captures are allowed. The player who captures all of the opponent's pieces wins.\n \n\n###\n\n", "completion": "(game \"Lam Pusri\" (players 2) (equipment { (\"AlquerqueBoardWithBottomAndTopTriangles\") (piece \"Marker\" Each (or (\"HopSequenceCapture\") (\"StepToEmpty\")))}) (rules (start { (place \"Marker1\" (union {(sites Row 0) (sites Row 1) (sites Row 2) (sites Row 3) (expand (sites {\"E5\"}) W)})) (place \"Marker2\" (union {(sites Row 5) (sites Row 6) (sites Row 7) (sites Row 8) (expand (sites {\"A5\"}) E)}))}) (play (if \"SameTurn\" (or (\"HopSequenceCaptureAgain\") (move Pass)) (forEach Piece))) (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game involves 3 players. -> The game involves 4 players.\n(define \"EntryPoint\" (mapEntry #1)) (define \"Goal\" 24) (define \"CaptureEnemyPiece\" (apply if:(and (not (is In (to) (sites \"ProtectedSites\"))) (\"IsEnemyAt\" (to))) (and (fromTo (from (to)) (to (handSite (who at:(to))))) (moveAgain)))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" (\"ThrowValue\"))) (define \"Grace\" (is In (count Pips) (array {0 4}))) (define \"ThrowValue\" (mapEntry \"Throw\" (count Pips))) (game \"Ashta-kashte\" (players 3) (equipment { (board (square 7) { (track \"Track1\" \"27,N,W,S,E,N2,SW1,W4,N4,E4,S3,W3,N2,E2,S1,W1\" P1 directed:True) (track \"Track2\" \"21,S,E,N,W,S2,NE1,E4,S4,W4,N3,E3,S2,W2,N1,E1\" P2 directed:True) (track \"Track3\" \"3,E,N,W,S,E2,NW1,N4,E4,S4,W3,N3,E2,S2,W1,N1\" P3 directed:True)}) (piece \"Paddle\" Each (if (and (is In (from) (sites Board)) (\"IsNotOffBoard\" \"SiteToMoveOnTrack\")) (move (from (from) level:(level)) (to \"SiteToMoveOnTrack\" \"CaptureEnemyPiece\")) (then (if (= \"Goal\" (last To)) (remove (last To)))))) (hand Each) (\"StickDice\" 4) (map {(pair 1 \"G4\") (pair 2 \"A4\") (pair 3 \"D1\") (pair 4 \"D7\")}) (map \"Throw\" {(pair 0 8)}) (regions \"ProtectedSites\" (sites {0 3 6 21 27 3 45 42 48 24}))}) (rules (start { (place Stack \"Paddle1\" (handSite P1) count:4) (place Stack \"Paddle2\" (handSite P2) count:4) (place Stack \"Paddle3\" (handSite P3) count:4)}) (play (\"RollMove\" (or { (forEach Piece) (move Pass) (if (and (\"Grace\") (!= 0 (who at:(handSite Mover)))) (move (from (handSite Mover)) (to (mapEntry Mover))))}) (then (if (\"Grace\") (moveAgain))))) (end (\"EscapeWin\"))))\n\n###\n\n", "completion": "(define \"EntryPoint\" (mapEntry #1)) (define \"Goal\" 24) (define \"CaptureEnemyPiece\" (apply if:(and (not (is In (to) (sites \"ProtectedSites\"))) (\"IsEnemyAt\" (to))) (and (fromTo (from (to)) (to (handSite (who at:(to))))) (moveAgain)))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" (\"ThrowValue\"))) (define \"Grace\" (is In (count Pips) (array {0 4}))) (define \"ThrowValue\" (mapEntry \"Throw\" (count Pips))) (game \"Ashta-kashte\" (players 4) (equipment { (board (square 7) { (track \"Track1\" \"27,N,W,S,E,N2,SW1,W4,N4,E4,S3,W3,N2,E2,S1,W1\" P1 directed:True) (track \"Track2\" \"21,S,E,N,W,S2,NE1,E4,S4,W4,N3,E3,S2,W2,N1,E1\" P2 directed:True) (track \"Track3\" \"3,E,N,W,S,E2,NW1,N4,E4,S4,W3,N3,E2,S2,W1,N1\" P3 directed:True) (track \"Track4\" \"45,W,S,E,N,W2,SE1,S4,W4,N4,E3,S3,W2,N2,E1,S1\" P4 directed:True)}) (piece \"Paddle\" Each (if (and (is In (from) (sites Board)) (\"IsNotOffBoard\" \"SiteToMoveOnTrack\")) (move (from (from) level:(level)) (to \"SiteToMoveOnTrack\" \"CaptureEnemyPiece\")) (then (if (= \"Goal\" (last To)) (remove (last To)))))) (hand Each) (\"StickDice\" 4) (map {(pair 1 \"G4\") (pair 2 \"A4\") (pair 3 \"D1\") (pair 4 \"D7\")}) (map \"Throw\" {(pair 0 8)}) (regions \"ProtectedSites\" (sites {0 3 6 21 27 3 45 42 48 24}))}) (rules (start { (place Stack \"Paddle1\" (handSite P1) count:4) (place Stack \"Paddle2\" (handSite P2) count:4) (place Stack \"Paddle3\" (handSite P3) count:4) (place Stack \"Paddle4\" (handSite P4) count:4)}) (play (\"RollMove\" (or { (forEach Piece) (move Pass) (if (and (\"Grace\") (!= 0 (who at:(handSite Mover)))) (move (from (handSite Mover)) (to (mapEntry Mover))))}) (then (if (\"Grace\") (moveAgain))))) (end (\"EscapeWin\")))) 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": "Describe the mechanics of the following Ludii game\n(define \"PiecesOwnedBy\" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (define \"PlayFromLastHole\" (last To afterConsequence:True)) (define \"Columns\" 12) (game \"Intotoi\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" store:None (track \"Track\" \"0,E,N,W\" loop:True)) (piece \"Seed\" Shared) (hand Each) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start (set Count 3 to:(sites {1 2 4 5 7 8 10 11 22 21 19 18 16 15 13 12}))) phases:{ (phase \"Opening1\" (play (move Select (from 10) (then (sow count:2)))) (nextPhase \"Opening2\")) (phase \"Opening2\" (play (if (\"SameTurn\") (move Select (from (sites {\"PlayFromLastHole\"}) if:(> (count at:(from)) 0)) (then (sow apply:(if (!= 1 (count at:(to))) (moveAgain))))) (move Select (from (sites {13 15}) if:(> (count at:(from)) 0)) (then (sow count:2 apply:(if (!= 1 (count at:(to))) (moveAgain))))))) (nextPhase (not (is Next Mover)) \"Play\")) (phase \"Play\" (play (move Select (from (sites From (do (move Select (from (sites Mover) if:(> (count at:(from)) 0)) (then (sow))) ifAfterwards:(or (and (= 1 (count at:(\"PlayFromLastHole\"))) (is In (\"PlayFromLastHole\") (sites Mover))) (is In (\"PlayFromLastHole\") (sites Next))))) if:(> (count at:(from)) 0)) (then (sow apply:(if (= 1 (count at:(to))) (if (and (is Occupied (\"OppositePit\" (to))) (is In (to) (sites Mover))) (fromTo (from (\"OppositePit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePit\" (to))))) (moveAgain)))))) (nextPhase Mover (is Next Mover) \"Replay\")) (phase \"Replay\" (play (move Select (from (sites {\"PlayFromLastHole\"}) if:(> (count at:(from)) 0)) (then (sow apply:(if (= 1 (count at:(to))) (if (and (is Occupied (\"OppositePit\" (to))) (is In (to) (sites Mover))) (fromTo (from (\"OppositePit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePit\" (to))))) (moveAgain)))))) (nextPhase Mover (not (is Next Mover)) \"Play\"))} (end (\"MancalaByScoreWhen\" (no Moves Mover)))))\n\n###\n\n", "completion": "2x12 board. Starting position, from the left hand hole, for each player: 0-3-3-0-3-3-0-3-3-0-3-3 In the opening play, one player must sow two counters from the second hole from their right. The opponent then makes the same play from their row, or from the fourth hole from their right. When the final counter lands in an occupied hole, these are picked up and sowing continues. A player's turn ends when the final counter falls into an empty hole. Players may now begin their move from any hole in their row, but only if it ends in an empty hole in their row or if it enters the opponent's row. If the final counter lands in an occupied hole in the opponent's row, these are picked up and sowing continues. If the final counter lands in an occupied hole in the player's row, the contents of the hole in the opponent's hole opposite it are captured. Sowing ends when a capture is made or when a counter falls into an empty hole. END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nPlayed on a size 5 board. -> Played on a size 6 board.\n(define \"Skip\" (move Set NextPlayer (player (next)))) (define \"IsPlayingPhase\" (= 1 (var))) (define \"BlackVC\" (or (is Connected Orthogonal {(sites Side N) (sites Side S)}) (is Connected Orthogonal {(sites Side E) (sites Side W)}))) (define \"WhiteVC\" (is Connected All {(sites Side N) (sites Side S) (sites Side E) (sites Side W)})) (game \"Pippinzip\" (players 2) (equipment { (board (square 5) use:Vertex) (piece \"Disc\" Each)}) (rules phases:{ (phase \"Opening\" (play (or (or (move Add (piece (id \"Disc\" P2)) (to (sites Empty)) (then (if (< (count MovesThisTurn) 2) (moveAgain)))) \"Skip\") (if (= (count MovesThisTurn) 0) (move Pass (then (if (is Mover P1) (swap Players P1 P2 (then (note \"Player 1 is now Black. Player 2 is now White.\" to:All))) (note \"Player 1 remains White. Player 2 remains Black.\" to:All) (then (do (set NextPlayer (player 1)) next:(set Var 1))))))))) (nextPhase (\"IsPlayingPhase\") \"Playing\")) (phase \"Playing\" (play (move Add (to (sites Empty)))))} (end { (if (and (not (\"IsPlayingPhase\")) (\"BlackVC\")) (result Mover Win)) (if (and {(= (id P2) (mover)) (\"BlackVC\")}) (result P2 Win)) (if (and {(= (id P1) (mover)) (\"WhiteVC\")}) (result P1 Win))})))\n\n###\n\n", "completion": "(define \"Skip\" (move Set NextPlayer (player (next)))) (define \"IsPlayingPhase\" (= 1 (var))) (define \"BlackVC\" (or (is Connected Orthogonal {(sites Side N) (sites Side S)}) (is Connected Orthogonal {(sites Side E) (sites Side W)}))) (define \"WhiteVC\" (is Connected All {(sites Side N) (sites Side S) (sites Side E) (sites Side W)})) (game \"Pippinzip\" (players 2) (equipment { (board (square 6) use:Vertex) (piece \"Disc\" Each)}) (rules phases:{ (phase \"Opening\" (play (or (or (move Add (piece (id \"Disc\" P2)) (to (sites Empty)) (then (if (< (count MovesThisTurn) 2) (moveAgain)))) \"Skip\") (if (= (count MovesThisTurn) 0) (move Pass (then (if (is Mover P1) (swap Players P1 P2 (then (note \"Player 1 is now Black. Player 2 is now White.\" to:All))) (note \"Player 1 remains White. Player 2 remains Black.\" to:All) (then (do (set NextPlayer (player 1)) next:(set Var 1))))))))) (nextPhase (\"IsPlayingPhase\") \"Playing\")) (phase \"Playing\" (play (move Add (to (sites Empty)))))} (end { (if (and (not (\"IsPlayingPhase\")) (\"BlackVC\")) (result Mover Win)) (if (and {(= (id P2) (mover)) (\"BlackVC\")}) (result P2 Win)) (if (and {(= (id P1) (mover)) (\"WhiteVC\")}) (result P1 Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\n3x3 board with diagonals. Three pieces per player. Players take turns placing their pieces. Once all pieces have been placed, they may move a piece to any unoccupied spot. The first player to align their three pieces in a row along one of lines on the board is the winner. The board is 3x3 and the winning conditions is a 3 in a row.\n\n###\n\n", "completion": "(game \"Les Pendus\" (players 2) (equipment { (board (square 3 diagonals:Alternating) 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 Mover (\"HandEmpty\" Mover) \"Movement\")) (\"PhaseMovePiece\" \"Movement\")} (end (if (is Line 3) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nA circle with eight radii. Three pieces per player. Each player has three pieces, which must start on the outer ring adjacent to each other. Players alternate turns moving a piece to an empty point along the lines of the board. The player who makes a line of three through the center of the circle wins. \n\n###\n\n", "completion": "(game \"Ring\" (players 2) (equipment { (board (concentric {1 8}) use:Vertex) (hand Each) (piece \"Marker\" Each \"StepToEmpty\")}) (rules (start (place \"Marker\" \"Hand\" count:3)) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (difference (sites Empty) (sites Centre))))) (nextPhase Mover \"PlacementAdjacent\")) (phase \"PlacementAdjacent\" (play (move (from (handSite Mover)) (to (difference (sites Empty) (sites Centre)) if:(is In (to) (sites Around (sites Occupied by:Mover)))))) (nextPhase (\"HandEmpty\" P2) \"Movement\")) (\"PhaseMovePiece\" \"Movement\")} (end (if (is Line 3 through:(centrePoint) what:(mover)) (result Mover Win))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game involves 2 players. -> The game involves 4 players.\n(define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" #1)) (define \"ThrowValue\" (mapEntry \"Throw\" (count Pips))) (game \"Paradis\" (players 2) (equipment { (board (concentric {2 2 2 2 2 2 2 2 2 2}) { (track \"Track1\" {18 16 14 12 10 8 6 4 2 0 2 4 6 8 10 12 14 16 18 16 14 12 10 8 6 4 2 0 2 4 6 8 10 12 14 16 18 16 14 12 10 8 6 4 2 0 2 4 6 8 10 12 14 16} P1 directed:True) (track \"Track2\" {19 17 15 13 11 9 7 5 3 1 3 5 7 9 11 13 15 17 19 17 15 13 11 9 7 5 3 1 3 5 7 9 11 13 15 17 19 17 15 13 11 9 7 5 3 1 3 5 7 9 11 13 15 17} P2 directed:True)} use:Vertex) (\"StickDice\" 2) (piece \"Marker\" Each (move (from (from)) (to (\"SiteToMoveOnTrack\" (\"ThrowValue\")) (apply (if (or (and (= 1 (\"ThrowValue\")) (= (mapEntry \"Center\" Mover) (to))) (and (= 2 (\"ThrowValue\")) (or (= (mapEntry \"Center\" Mover) (to)) (= (mapEntry \"Center\" Mover) (\"SiteToMoveOnTrack\" 1))))) (addScore Mover 1)))))) (map \"Throw\" {(pair 0 2) (pair 1 0) (pair 2 1)}) (map \"Center\" {(pair P1 0) (pair P2 1)})}) (rules (start { (place \"Marker1\" 18) (place \"Marker2\" 19)}) (play (\"RollMove\" (if (!= (\"ThrowValue\") 0) (forEach Piece)))) (end (if (= (score Mover) 3) (result Mover Win)))))\n\n###\n\n", "completion": "(define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" #1)) (define \"ThrowValue\" (mapEntry \"Throw\" (count Pips))) (game \"Paradis\" (players 4) (equipment { (board (concentric {4 4 4 4 4 4 4 4 4 4}) { (track \"Track1\" {36 32 28 24 20 16 12 8 4 0 4 8 12 16 20 24 28 32 36 32 28 24 20 16 12 8 4 0 4 8 12 16 20 24 28 32 36 32 28 24 20 16 12 8 4 0 4 8 12 16 20 24 28 32} P1 directed:True) (track \"Track2\" {37 33 29 25 21 17 13 9 5 1 5 9 13 17 21 25 29 33 37 33 29 25 21 17 13 9 5 1 5 9 13 17 21 25 29 33 37 33 29 25 21 17 13 9 5 1 5 9 13 17 21 25 29 33} P2 directed:True) (track \"Track3\" {38 34 30 26 22 18 14 10 6 2 6 10 14 18 22 26 30 34 38 34 30 26 22 18 14 10 6 2 6 10 14 18 22 26 30 34 38 34 30 26 22 18 14 10 6 2 6 10 14 18 22 26 30 34} P3 directed:True) (track \"Track4\" {39 35 31 27 23 19 15 11 7 3 7 11 15 19 23 27 31 35 39 35 31 27 23 19 15 11 7 3 7 11 15 19 23 27 31 35 39 35 31 27 23 19 15 11 7 3 7 11 15 19 23 27 31 35} P4 directed:True)} use:Vertex) (\"StickDice\" 2) (piece \"Marker\" Each (move (from (from)) (to (\"SiteToMoveOnTrack\" (\"ThrowValue\")) (apply (if (or (and (= 1 (\"ThrowValue\")) (= (mapEntry \"Center\" Mover) (to))) (and (= 2 (\"ThrowValue\")) (or (= (mapEntry \"Center\" Mover) (to)) (= (mapEntry \"Center\" Mover) (\"SiteToMoveOnTrack\" 1))))) (addScore Mover 1)))))) (map \"Throw\" {(pair 0 2) (pair 1 0) (pair 2 1)}) (map \"Center\" {(pair P1 0) (pair P2 1) (pair P3 2) (pair P4 3)})}) (rules (start { (place \"Marker1\" 36) (place \"Marker2\" 37) (place \"Marker3\" 38) (place \"Marker4\" 39)}) (play (\"RollMove\" (if (!= (\"ThrowValue\") 0) (forEach Piece)))) (end (if (= (score Mover) 3) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nColour edges of the graph, by selecting them, until they form a path that passes through every vertex exactly once and returns to its starting point.\n \n\n###\n\n", "completion": "(game \"Hamiltonian Maze\" (players 1) (equipment { (board (graph vertices:{ {0 0} {2 0} {4 0} {6 0} {8 0} {10 0} {2 2} {4 2} {6 2} {8 2} {10 2} {0 4} {2 4} {6 4} {8 4} {10 4} {0 6} {2 6} {4 6} {6 6} {8 6} {10 6} {0 8} {2 8} {4 8} {6 8} {8 8} {10 8} {0 10} {2 10} {6 10} {8 10} {10 10}} edges:{{0 1} {0 11} {1 6} {6 7} {7 8} {2 7} {2 3} {8 9} {3 8} {3 4} {9 10} {4 9} {4 5} {5 10} {6 12} {11 12} {7 18} {12 13} {8 13} {13 14} {14 15} {9 14} {15 10} {11 16} {16 17} {12 17} {17 18} {13 19} {18 19} {19 20} {20 14} {20 21} {15 21} {22 16} {22 23} {23 24} {18 24} {24 25} {25 26} {19 25} {27 26} {21 27} {22 28} {29 28} {23 29} {29 30} {25 30} {30 31} {31 32} {27 32}}) use:Vertex)}) (rules (play (move Add (to Edge (sites Empty Edge)))) (end { (if (is Path Edge Mover length:(exact (count Sites \"Board\")) closed:True) (result Mover Win)) (if (is Path Edge Mover length:(max (count Moves)) closed:True) (result Mover Loss))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayed on an 8x8 board. 16 pieces per player, lined up in the second and third rows. A piece can move forwards, straight ahead or diagonally, or sideways to an orthogonally adjacent field if that field is empty, and capture opponents' pieces by jumping left, right, or forwards. When they reach the opposite side, they become a king, which may move in all directions (up, down, left, right, or diagonally), as long as the path is clear of pieces, and can jump opponents' pieces from any distance orthogonally. Captures must be taken if possible, and the maximum number of jumps must be made. Multiple captures cannot be made by moving 180 degrees from the previous jump. Pieces can be promoted to king mid-jump. Winning is achieved by capturing all of the other player's pieces or by blocking them so they cannot move. The rules come from Schmidt.\n\n###\n\n", "completion": "(define \"IsUnpromoted\" (\"IsPieceAt\" \"Counter\" Mover (last To))) (define \"HopMan\" (\"HopCapture\" (from #1) (directions {Forward Rightward Leftward}) #2)) (define \"PromotedHopOrthogonalSequenceCapture\" (\"HopCapture\" #1 #2 (then (\"ReplayIfCanMove\" (\"HopCapture\" (from (last To)) #2))))) (game \"Tama\" (players 2) (\"DraughtsEquipment\" (square 8)) (rules (start { (place \"Counter1\" (union (sites Row 1) (sites Row 2))) (place \"Counter2\" (union (sites Row 5) (sites Row 6)))}) (play (if \"SameTurn\" (if \"IsUnpromoted\" (max Moves (\"HopMan\" (last To) (then (\"ReplayIfCanMove\" (\"HopMan\" (last To)) (\"PromoteIfReach\" (sites Next) \"DoubleCounter\"))))) (max Moves (\"PromotedHopOrthogonalSequenceCapture\" (from (last To)) (difference Orthogonal OppositeDirection)))) (priority { (max Moves (or { (forEach Piece \"Counter\" (\"HopMan\" (from) (then (\"ReplayIfCanMove\" (\"HopMan\" (last To)) (\"PromoteIfReach\" (sites Next) \"DoubleCounter\"))))) (forEach Piece \"DoubleCounter\" (\"PromotedHopOrthogonalSequenceCapture\" (from) Orthogonal))})) (or (forEach Piece \"Counter\" (\"StepToEmpty\" (directions {Forwards Rightward Leftward})) (then (\"PromoteIfReach\" (sites Next) \"DoubleCounter\"))) (forEach Piece \"DoubleCounter\" (\"StepToEmpty\")))}))) (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nGoal: Connect all three edge colors with a single group of connected stones of your own color. (As in 'Y') \n \n Turns alternate. The player seeking to connect with the darker color starts.\n On each turn the current player places one stone of each color (friendly stone first) onto an empty intersection of the board. Hex 4-5 Board (48)\n\n###\n\n", "completion": "(define \"EdgesOfSide\" (intersection (sites Outer Edge) (forEach of:(difference #1 (sites Corners Vertex)) (sites Incident Edge of:Vertex at:(site))))) (define \"BoardColour\" (colour 215 203 170)) (define \"P2Colour\" (colour White)) (define \"P1Colour\" (colour DarkGreen)) (define \"AddPieceOf\" (move Add (piece #1) (to (sites Empty)) #2)) (define \"Side3\" (union (sites Side NW) (sites Side SW))) (define \"Side2\" (union (sites Side SE) (sites Side S))) (define \"Side1\" (union (sites Side NE) (sites Side N))) (game \"Bipartisan Y\" (players 2) (equipment { (board (tri Limping 4) use:Vertex) (piece \"Disc\" Each) (piece \"Counter\" Neutral maxState:2)}) (rules (play (if (\"SameTurn\") (\"AddPieceOf\" (next) ~) (\"AddPieceOf\" (mover) (then (moveAgain))))) (end { (if (and (= 1 (who at:(last To))) (is Connected 3 {\"Side1\" \"Side2\" \"Side3\"})) (result P1 Win)) (if (and (= 2 (who at:(last To))) (is Connected 3 {\"Side1\" \"Side2\" \"Side3\"})) (result P2 Win))}))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"Move\" (if (\"IsEndTrack\" (\"SiteToMoveOnTrack\" from:(from) (\"ThrowValue\"))) (move (from (from)) (to (mapEntry \"Start\" Mover)) (then (fromTo (from (handSite (\"HandOpponent\"))) (to (handSite (\"HandTeam\")))))) (move (from (from)) (to (\"SiteToMoveOnTrack\" from:(from) (\"ThrowValue\")) if:True (apply (if (\"IsEnemyAt\" (to)) (and (fromTo (from (to)) (to (mapEntry \"Start\" (who at:(to))))) (fromTo (from (handSite (\"HandOpponent\"))) (to (handSite (\"HandTeam\")))))))) (then (if (= (last To) (mapEntry \"Opposite\" Mover)) (and (fromTo (from (last To)) (to (mapEntry \"Start\" Mover))) (fromTo (from (handSite (\"HandTeam\"))) (to (handSite (\"HandOpponent\")))))))))) (define \"HandOpponent\" (if (or (is Mover P1) (is Mover P2)) 3 1)) (define \"HandTeam\" (if (or (is Mover P1) (is Mover P2)) 1 3)) (define \"ReplayThrow\" (or (= (\"ThrowValue\") 5) (= (\"ThrowValue\") 10))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" #2 #1)) (define \"ThrowValue\" (mapEntry \"Throw\" (count Pips))) (game \"Zohn Ahl\" (players 4) (equipment { (board (graph vertices:{ {0 0} {1 0.4} {2 0.4} {3 0.4} {4 0} {5 0} {6 0.4} {7 0.4} {8 0.4} {9 0} {4 1} {5 1} {-6 3} {-5.6 4} {-5.6 5} {-5.6 6} {-6 7} {-6 8} {-5 7} {-5 8} {-5.6 9} {-5.6 10} {-5.6 11} {-6 12} {0 15} {1 14.6} {2 14.6} {3 14.6} {4 15} {5 15} {6 14.6} {7 14.6} {8 14.6} {9 15} {4 14} {5 14} {15 3} {14.6 4} {14.6 5} {14.6 6} {15 7} {15 8} {14 7} {14 8} {14.6 9} {14.6 10} {14.6 11} {15 12}} edges:{ {0 12} {23 24} {33 47} {36 9} {4 10} {5 11} {16 18} {17 19} {28 34} {35 29} {43 41} {42 40}}) { (track \"Track1\" \"5,6,7,8,9,36,37,38,39,40,41,44,45,46,47,33,32,31,30,29,28,27,26,25,24,23,22,21,20,17,16,15,14,13,12,0,1,2,3,End\" P1 directed:True) (track \"Track2\" \"5,6,7,8,9,36,37,38,39,40,41,44,45,46,47,33,32,31,30,29,28,27,26,25,24,23,22,21,20,17,16,15,14,13,12,0,1,2,3,End\" P2 directed:True) (track \"Track3\" \"4,3,2,1,0,12,13,14,15,16,17,20,21,22,23,24,25,26,27,28,29,30,31,32,33,47,46,45,44,41,40,39,38,37,36,9,8,7,6,End\" P3 directed:True) (track \"Track4\" \"4,3,2,1,0,12,13,14,15,16,17,20,21,22,23,24,25,26,27,28,29,30,31,32,33,47,46,45,44,41,40,39,38,37,36,9,8,7,6,End\" P4 directed:True)} use:Vertex) (piece \"Stick\" P1 (\"Move\")) (piece \"Stick\" P3 (\"Move\")) (piece \"Stick\" Neutral) (\"StickDice\" 4) (hand P1) (hand P3) (map \"Throw\" {(pair 0 10) (pair 1 1) (pair 2 2) (pair 3 3) (pair 4 5)}) (map \"Opposite\" {(pair P1 29) (pair P2 29) (pair P3 28) (pair P4 28)}) (map \"Start\" {(pair P1 5) (pair P2 5) (pair P3 4) (pair P4 4)})}) (rules (start { (set Team 1 {P1 P2}) (set Team 2 {P3 P4}) (place \"Stick1\" 5) (place \"Stick3\" 4) (place \"Stick0\" (handSite P1) count:10) (place \"Stick0\" (handSite P3) count:10)}) (play (\"RollMove\" (if (or (is Mover P1) (is Mover P2)) (forEach Piece P1) (forEach Piece P3)) (then (if (\"ReplayThrow\") (moveAgain))))) (end (if (is Empty (handSite (\"HandOpponent\"))) (result TeamMover Win)))))\n\n###\n\n", "completion": "The board is roughly rectangular. There are six points on either side, with each side divided in half by two short parallel lines, the rivers. There are four arcs in the corners of the \\ Each team has 10 scoring sticks. END" }, { "prompt": "Construct a Ludii game based on the following description\n2x3 board. Three counters in each hole. Players sow from any one of their holes. Sowing can occur in the following directions: From the leftmost hole, clockwise; from the rightmost hole, anti-clockwise; from the center hole, the player may choose either direction. If the final counter falls into a hole in the opponent's row containing one counter, making it now contain two, these are taken. If the holes before them also contain two, in an unbroken sequence, they may all be captured. Single counters cannot be sown. When neither player can move, the single counters in each player's rows are taken by the player belonging to those rows. The player with the most counters wins. \n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (define \"Sow\" (move Select (from #1 if:(> (count at:(from)) 1)) (then (sow #2 if:(and (= (count at:(to)) 2) (is In (to) (sites Next))) apply:(fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))) backtracking:True)))) (game \"Um el Tuweisat\" (players 2) (equipment { (mancalaBoard 2 3 store:None { (track \"TrackCCW\" \"0,E,N,W\" loop:True) (track \"TrackCW\" \"2,W,N,E\" loop:True)}) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map \"RightHole\" {(pair P1 2) (pair P2 3)}) (map \"CenterHole\" {(pair P1 1) (pair P2 4)}) (map \"LeftHole\" {(pair P1 0) (pair P2 5)}) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 3 to:(sites Track))) (play (or { (\"Sow\" (mapEntry \"RightHole\" (mover)) \"TrackCCW\") (\"Sow\" (mapEntry \"LeftHole\" (mover)) \"TrackCW\") (\"Sow\" (mapEntry \"CenterHole\" (mover)) \"TrackCCW\") (\"Sow\" (mapEntry \"CenterHole\" (mover)) \"TrackCW\")})) (end (\"MancalaByScoreWhen\" (and (no Moves P1) (no Moves P2)))))) END" }, { "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 Ludii game based on the following description\n5x5 grid, with six spaces extending from the central row; the final three of this extension rendered as rectangles rather than squares (Cairo, Medina, and Mecca, in that order). The central square of the grid is marked with a circle (the Minaret). Any number of players. Three pieces per player, a father, a mother, and an angel. Six sticks, black on one side and white on the other, used as dice. The throws are as follows: Five of any color plus one of the other color (known as \\ The game has 4 players.\n\n###\n\n", "completion": "(define \"Move\" (if (!= 0 #1) (or { (if (is In (from) (sites Track \"FirstTrack\")) (move (from (from) level:(level)) (to (\"SiteToMoveOnTrack\" \"FirstTrack\" #1))) (\"CaptureMove\" \"FirstTrack\")) (if (is In (from) (sites Track \"SecondTrack\")) (move (from (from) level:(level)) (to (\"SiteToMoveOnTrack\" \"SecondTrack\" #1)) (\"CaptureMove\" \"SecondTrack\"))) (\"EnterToMinaret\") (\"ExitFromMinaret\") (\"GoToStep1\") (\"GoToStep2\") (\"GoToStep3\") #2 (\"PrepareLastStep\") (\"LastSirMove\" (\"Step3\") (\"Cairo\")) (\"LastSirMove\" (\"Cairo\") (\"Medina\")) (\"LastSirMove\" (\"Medina\") (\"Mecca\"))}))) (define \"CaptureMove\" (then (forEach Site (sites Track Mover #1 from:(\"NextSite\" (last From) #1) to:(last To)) (forEach Level (site) FromTop (if (\"IsEnemyAt\" (site) level:(level)) (fromTo (from (site) level:(level)) (to (if (= (site) (where \"Father\" (who at:(site) level:(level)))) (\"StartFather\") (if (= (site) (where \"Mother\" (who at:(site) level:(level)))) (\"StartMother\") (\"StartAngel\")))))))))) (define \"GoToStep3Angel\" (\"SirMove\" (\"GroundAway\") (\"Step1\"))) (define \"GoToStep3\" (\"SirMove\" (\"Step2\") (\"Step3\"))) (define \"GoToStep2\" (\"SirMove\" (\"Step1\") (\"Step2\"))) (define \"GoToStep1\" (\"SirMove\" (\"Ground\") (\"Step1\"))) (define \"ExitFromMinaret\" (\"SirMove\" (\"Minaret\") (\"ExitMinaret\"))) (define \"EnterToMinaret\" (\"SirMove\" (\"EnterMinaret\") (\"Minaret\"))) (define \"NextSite\" (\"NextSiteOnTrack\" 1 from:#1 #2)) (define \"SirMove\" (if (and (\"Sir\") (= (from) #1)) (move (from (from) level:(level)) (to #2)))) (define \"LastSirMove\" (if (and { (\"Sir\") (= (from) #1) (= 2 (state at:(from) level:(level)))}) (move (from (from) level:(level)) (to #2 (apply (set State at:(from) level:(level) 0)))))) (define \"PrepareLastStep\" (if (and { (\"Sir\") (is In (from) (sites {(\"Step3\") (\"Medina\") (\"Cairo\")})) (< (state at:(from) level:(level)) 2)}) (move (from (from) level:(level)) (to (from) (apply (set State at:(to) level:(level) (+ 1 (state at:(to) level:(level))))))))) (define \"Sir\" (= \"ThrowValue\" 1)) (define \"ExtraThrowValue\" (mapEntry \"ExtraThrow\" (count Pips))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" #2 #1)) (define \"ThrowValue\" (mapEntry \"Throw\" (count Pips))) (define \"AllPiecesInMecca\" (and { (= (\"Mecca\") (where \"Angel\" Mover)) (= (\"Mecca\") (where \"Father\" Mover)) (= (\"Mecca\") (where \"Mother\" Mover))})) (define \"StartMother\" 7) (define \"StartAngel\" 10) (define \"StartFather\" 13) (define \"Mecca\" 28) (define \"Medina\" 29) (define \"Cairo\" 30) (define \"Step3\" 16) (define \"Step2\" 17) (define \"Step1\" 2) (define \"Ground\" 23) (define \"GroundAway\" 24) (define \"ExitMinaret\" 6) (define \"EnterMinaret\" 12) (define \"Minaret\" 9) (game \"Siryu (Race)\" (players 4) (equipment { (board (merge { (rectangle 5 2) (shift 2 -3 (scale 1.2 1 (rectangle 8 1))) (shift 3.2 0 (rectangle 5 2)) (shift 1.6 -6 (scale 2 1 (rectangle 3 1)))}) { (track \"FirstTrack\" \"13,S,E1,N,E1,S1\" directed:True) (track \"SecondTrack\" \"6,S1,E1,N,E1,S\" directed:True)}) (\"StickDice\" 6) (map \"Throw\" {(pair 0 6) (pair 1 1) (pair 2 0) (pair 3 0) (pair 4 0) (pair 5 1) (pair 6 6)}) (map \"ExtraThrow\" {(pair 0 1) (pair 1 1) (pair 2 0) (pair 3 0) (pair 4 0) (pair 5 1) (pair 6 3)}) (piece \"Father\" Each (\"Move\" (\"ThrowValue\"))) (piece \"Angel\" Each (\"Move\" (* 2 (\"ThrowValue\")) (\"GoToStep3Angel\"))) (piece \"Mother\" Each (\"Move\" (\"ThrowValue\")))}) (rules (start { (place Stack \"Father1\" \"StartFather\") (place Stack \"Angel1\" \"StartAngel\") (place Stack \"Mother1\" \"StartMother\") (place Stack \"Father2\" \"StartFather\") (place Stack \"Angel2\" \"StartAngel\") (place Stack \"Mother2\" \"StartMother\") (place Stack \"Father3\" \"StartFather\") (place Stack \"Angel3\" \"StartAngel\") (place Stack \"Mother3\" \"StartMother\") (place Stack \"Father4\" \"StartFather\") (place Stack \"Angel4\" \"StartAngel\") (place Stack \"Mother4\" \"StartMother\")}) (play (\"RollMove\" (forEach Piece) (then (if (!= 0 (\"ExtraThrowValue\")) (and (if (= 3 (\"ExtraThrowValue\")) (if (<= (var) 0) (set Var 2) (set Var (+ 2 (var))))) (moveAgain)) (if (> (var) 0) (and (set Var (- (var) 1)) (moveAgain))))))) (end (if (\"AllPiecesInMecca\") (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nDEFINITION: A group is a maximal set of orthogonally adjacent like-colored pieces.\n GAMEPLAY: On your turn, flip an enemy group.\n OBJECTIVE: Eliminate the enemy pieces. An 8x8 board is currently selected. No heuristic is used.\n\n###\n\n", "completion": "(define \"FlipGroupAndCalculateDifference\" (do (add (to (sites Group at:(last From) Orthogonal) (apply (remove (to))))) next:(and (set Score P1 (- (count Groups Orthogonal if:(= (id P1) (who at:(to)))) (count Groups Orthogonal if:(= (id P2) (who at:(to)))))) (set Score P2 (- (count Groups Orthogonal if:(= (id P2) (who at:(to)))) (count Groups Orthogonal if:(= (id P1) (who at:(to))))))))) (define \"FlipGroupAndCountEnemy\" (do (add (to (sites Group at:(last From) Orthogonal) (apply (remove (to))))) next:(and (set Score P1 (* -1 (count Groups Orthogonal if:(= (id P2) (who at:(to)))))) (set Score P2 (* -1 (count Groups Orthogonal if:(= (id P1) (who at:(to))))))))) (define \"FlipGroupAndCountFriendly\" (do (add (to (sites Group at:(last From) Orthogonal) (apply (remove (to))))) next:(and (set Score P1 (count Groups Orthogonal if:(= (id P1) (who at:(to))))) (set Score P2 (count Groups Orthogonal if:(= (id P2) (who at:(to)))))))) (define \"FlipGroup\" (add (to (sites Group at:(last From) Orthogonal) (apply (remove (to)))))) (game \"Paintbucket\" (players 2) (equipment { (board (square 8)) (tile \"Square\" Each)}) (rules (start { (place \"Square1\" (sites Phase 0)) (place \"Square2\" (sites Phase 1))}) (play (move Select (from (sites Occupied by:Next)) (then (\"FlipGroup\")))) (end (\"CaptureAll\" Next Loss)))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x4 board, rendered as holes in the sand. Six counters per hole. A player picks up all of the counters in one of the holes in their row and sows them in an anti-clockwise direction. When the final counter lands in an empty hole, the contents of the following hole are picked up and the sowing continues. When the final counter lands in a hole in the opponent's row causing it to contain six counters, these counters are captured. Play continues until one player has no counters in their holes, and the opponent wins. \n\n###\n\n", "completion": "(define \"NoCounters\" (all Sites (sites #1) if:(= 0 (count at:(site))))) (define \"NextHole\" (\"NextSiteOnTrack\" 1 from:#1 \"Track\")) (define \"PlayFromLastHole\" (last To afterConsequence:True)) (define \"Columns\" 4) (game \"Boukerourou\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" store:None (track \"Track\" \"0,E,N,W\" loop:True)) (piece \"Seed\" Shared) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start (set Count 6 to:(sites Track))) (play (move Select (from (if (\"SameTurn\") (sites {(\"NextHole\" (\"PlayFromLastHole\"))}) (sites Mover)) if:(> (count at:(from)) 0)) (then (sow apply:(if (and (= 1 (count at:(to))) (is Occupied (\"NextHole\" (to)))) (moveAgain) (if (and (is In (to) (sites Next)) (= 6 (count at:(to)))) (remove (to)))))))) (end (forEach Player if:(\"NoCounters\" Player) (result Player Loss))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n5x5 board. Markings in the central square, each corner square, and the central square of each side. Black plays with thirteen pieces, white plays with ten. Black places the first piece on the central square, then players alternate turns placing a piece on their own half of the board. When all of the pieces are placed, players alternate turns moving pieces on space orthogonally. A piece is captured when it is surrounded on two opposite sides by opponent's pieces. Black wins if it can block white from being able to move. White wins if it is impossible for black to block them. \n\n###\n\n", "completion": "(game \"Gala\" (players 2) (equipment { (board (square 5)) (hand Each) (regions P1 (expand (sites Bottom) steps:2)) (regions P2 (expand (sites Top) steps:2)) (regions \"MarkedCells\" (union { (sites Centre) (sites Corners) (intersection (sites Outer) (sites Row (row of:(centrePoint)))) (intersection (sites Outer) (sites Column (column of:(centrePoint))))})) (piece \"Marker\" Each (\"StepOrthogonalToEmpty\"))}) (rules (start { (place \"Marker1\" (handSite P1) count:10) (place \"Marker2\" (handSite P2) count:12) (place \"Marker2\" (centrePoint))}) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (intersection (sites Empty) (sites Mover))))) (nextPhase (and (\"HandEmpty\" P1) (\"HandEmpty\" P2)) \"Movement\")) (phase \"Movement\" (play (forEach Piece (then (\"CustodialCapture\")))) (end { (if (no Moves P1) (result P2 Win)) (if (< (count Pieces P2) 2) (result P1 Win))}))})) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nA board with side lengths 5 and 6 is currently selected -> A board with side lengths 7 and 8 is currently selected\n(define \"Remove\" (forEach Group (if (all Sites (sites) if:(= 0 (count Sites in:(difference (intersection (sites Occupied by:Mover) (sites Direction from:(site) stop:(is Occupied (to)) stopIncluded:True)) (sites))))) (remove (sites))))) (define \"Move\" (move Add (to (forEach (sites Empty) if:(> (count Pieces Mover in:(sites LineOfSight at:(site))) 0))) #1)) (game \"Meridians\" (players 2) (equipment { (board (dual (hex Prism 6 5)) use:Vertex) (piece \"Disc\" Each)}) (rules phases:{ (phase \"Opening\" (play (move Add (to (if (< 0 (count Sites in:(sites Occupied by:Mover))) (forEach (sites Empty) if:(and (> (count Pieces Mover in:(sites LineOfSight at:(site))) 0) (= (count Sites in:(sites Around (site) Own)) 0))) (sites Empty))))) (nextPhase (= 4 (count Moves)) \"Play\")) (phase \"Play\" (play (if (can Move (\"Move\" ~)) (\"Move\" (then (\"Remove\"))) (move Pass (then (\"Remove\"))))))} (end (if (and (< 4 (count Moves)) (or (= 0 (count Sites in:(sites Occupied by:P1))) (= 0 (count Sites in:(sites Occupied by:P2))))) (result Mover Loss)))))\n\n###\n\n", "completion": "(define \"Remove\" (forEach Group (if (all Sites (sites) if:(= 0 (count Sites in:(difference (intersection (sites Occupied by:Mover) (sites Direction from:(site) stop:(is Occupied (to)) stopIncluded:True)) (sites))))) (remove (sites))))) (define \"Move\" (move Add (to (forEach (sites Empty) if:(> (count Pieces Mover in:(sites LineOfSight at:(site))) 0))) #1)) (game \"Meridians\" (players 2) (equipment { (board (dual (hex Prism 8 7)) use:Vertex) (piece \"Disc\" Each)}) (rules phases:{ (phase \"Opening\" (play (move Add (to (if (< 0 (count Sites in:(sites Occupied by:Mover))) (forEach (sites Empty) if:(and (> (count Pieces Mover in:(sites LineOfSight at:(site))) 0) (= (count Sites in:(sites Around (site) Own)) 0))) (sites Empty))))) (nextPhase (= 4 (count Moves)) \"Play\")) (phase \"Play\" (play (if (can Move (\"Move\" ~)) (\"Move\" (then (\"Remove\"))) (move Pass (then (\"Remove\"))))))} (end (if (and (< 4 (count Moves)) (or (= 0 (count Sites in:(sites Occupied by:P1))) (= 0 (count Sites in:(sites Occupied by:P2))))) (result Mover Loss))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe pieces follow a track describing by Murray. -> The pieces follow a longer track than the description of Finkel.\n(define \"RemoveAPiece\" (move Remove (from))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" (count Pips))) (game \"Royal Game of Ur\" (players 2) (equipment { (board (hole (hole (rectangle 3 8) (poly { {4 0} {4 1} {6 1} {6 0}})) (poly { {4 2} {4 3} {6 3} {6 2}})) {(track \"Track1\" \"20,3,W,N1,E6,S,E,N,W,S1,W,S1,E,End\" P1 directed:True) (track \"Track2\" \"21,17,W,S1,E6,N,E,S,W,N1,W,N1,E,End\" P2 directed:True)}) (\"StickDice\" 4) (hand Each) (regions \"Replay\" (sites {\"A1\" \"A3\" \"D2\" \"G1\" \"G3\"})) (piece \"UrPiece\" Each (if (\"IsEndTrack\" \"SiteToMoveOnTrack\") \"RemoveAPiece\" (if (\"IsNotOffBoard\" \"SiteToMoveOnTrack\") (if (or (is Empty \"SiteToMoveOnTrack\") (and (not (\"IsFriendAt\" \"SiteToMoveOnTrack\")) (not (is In \"SiteToMoveOnTrack\" (sites \"Replay\"))))) (move (from) (to \"SiteToMoveOnTrack\" (\"HittingCapture\" (handSite Next))) (then (\"ReplayInMovingOn\" (sites \"Replay\"))))))))}) (rules (start { (place \"UrPiece1\" (handSite P1) count:7) (place \"UrPiece2\" (handSite P2) count:7)}) (play (\"RollMove\" (if (!= (count Pips) 0) (or (forEach Piece) (forEach Piece container:(mover)))))) (end (\"EscapeWin\"))))\n\n###\n\n", "completion": "(define \"RemoveAPiece\" (move Remove (from))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" (count Pips))) (game \"Royal Game of Ur\" (players 2) (equipment { (board (hole (hole (rectangle 3 8) (poly { {4 0} {4 1} {6 1} {6 0}})) (poly { {4 2} {4 3} {6 3} {6 2}})) {(track \"Track1\" \"20,3,W,N1,E6,N,E,S,W,End\" P1 directed:True) (track \"Track2\" \"21,17,W,S1,E6,S,E,N,W,End\" P2 directed:True)}) (\"StickDice\" 4) (hand Each) (regions \"Replay\" (sites {\"A1\" \"A3\" \"D2\" \"G1\" \"G3\"})) (piece \"UrPiece\" Each (if (\"IsEndTrack\" \"SiteToMoveOnTrack\") \"RemoveAPiece\" (if (\"IsNotOffBoard\" \"SiteToMoveOnTrack\") (if (or (is Empty \"SiteToMoveOnTrack\") (and (not (\"IsFriendAt\" \"SiteToMoveOnTrack\")) (not (is In \"SiteToMoveOnTrack\" (sites \"Replay\"))))) (move (from) (to \"SiteToMoveOnTrack\" (\"HittingCapture\" (handSite Next))) (then (\"ReplayInMovingOn\" (sites \"Replay\"))))))))}) (rules (start { (place \"UrPiece1\" (handSite P1) count:7) (place \"UrPiece2\" (handSite P2) count:7)}) (play (\"RollMove\" (if (!= (count Pips) 0) (or (forEach Piece) (forEach Piece container:(mover)))))) (end (\"EscapeWin\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\n6x6 board. Each player has twelve sticks. One player's sticks are without bark to distinguish them. Players placing their sticks in empty spaces, filling the central four first. Once all of the sticks have been placed, the players may move their sticks orthogonally one space. If a player can bring three of their sticks in a row, they may then remove one of the opponent's sticks during either phase of the game. During the movement phase, if a player has a row of four pieces and moves one away, leaving a row of three spaces, this also allows the player to capture an opponent's piece. The player who can no longer play loses. \n\n###\n\n", "completion": "(define \"CheckLine3LastFrom\" (if (and (!= (last From) (ahead (last From) #1)) (= (mover) (who at:(ahead (last From) #1)))) (if (is Line 3 Orthogonal through:(ahead (last From) #1) exact:True) (and (moveAgain) (addScore Mover 1))))) (define \"RemoveEnemyPiece\" (move Remove (sites Occupied by:Next container:\"Board\") (then (and (set Score Mover (- (score Mover) 1)) (if (< 1 (score Mover)) (moveAgain)))))) (define \"IfLine3MoveAgain\" (then (if (is Line 3 Orthogonal exact:True) (and (moveAgain) (addScore Mover 1))))) (define \"AddPieceTo\" (move (from (handSite Mover)) #1 #2)) (define \"FreeCentreSites\" (to (forEach (sites Centre) if:(is Empty (site))))) (define \"IfCentreFull\" (= (count Moves) 4)) (game \"Dala\" (players 2) (equipment { (board (square 6)) (hand Each) (piece \"Stick\" Each (if (is Line 4 Orthogonal through:(from) exact:True) (\"StepToEmpty\" Orthogonal (then (and { (\"CheckLine3LastFrom\" N) (\"CheckLine3LastFrom\" S) (\"CheckLine3LastFrom\" E) (\"CheckLine3LastFrom\" W)}))) (\"StepToEmpty\" Orthogonal \"IfLine3MoveAgain\")))}) (rules (start (place \"Stick\" \"Hand\" count:12)) phases:{ (phase \"PlacementCenter\" (play (\"AddPieceTo\" \"FreeCentreSites\")) (nextPhase \"IfCentreFull\" \"Placement\")) (phase \"Placement\" (play (if (!= 0 (score Mover)) \"RemoveEnemyPiece\" (\"AddPieceTo\" (to (sites Empty)) \"IfLine3MoveAgain\"))) (nextPhase (\"HandEmpty\" P2) \"Movement\")) (phase \"Movement\" (play (if (!= 0 (score Mover)) \"RemoveEnemyPiece\" (forEach Piece))) (end (\"HavingLessPiecesLoss\" Next 2)))})) END" }, { "prompt": "Construct a Ludii game based on the following description\nEach stone must move to any adjacent(orthogonal or diagonal) cell, which is occupied by an enemy stone. This stone is captured by replacement. After that, all adjacent enemy stones (orthogonal or diagonal) are converted to friendly ones. There are fewer and fewer stones on the board as the game proceeds, which is a major difference with Othello and Ataxx.\n \n The player which has more stones, after there is no valid move left, wins the game. \n\n###\n\n", "completion": "(game \"Crusade\" (players 2) (equipment { (board (square 8)) (piece \"Ball\" Each (\"StepToEnemy\" ~ (then (forEach Site (sites Around (last To)) (if (\"IsEnemyAt\" (site)) (and (remove (site)) (add (piece (id \"Ball\" Mover)) (to (site)))))))))}) (rules (start { (place \"Ball1\" (sites Phase 1)) (place \"Ball2\" (sites Phase 0))}) (play (forEach Piece)) (end (if (no Moves Next) (byScore { (score P1 (count Pieces P1)) (score P2 (count Pieces P2))}))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThis game is played on a hexagonal board made up of hexagonal squares, usually 6 squares per side, although other sizes are possible. Initially the board is empty and black pieces are placed in turns until one player passes. The player who passed becomes Black. The other player becomes White and takes the next turn. Play continues, with each player in turn placing pieces of their colour on unoccupied squares on the board. White wins if they manage to connect two opposite sides of the board. Black wins if they manage to connect three non-adjacent sides of the board. To avoid ties, if a player meets the opponent's goal with their pieces, they lose the game. The game is played on a board with 6 hexes per side. You cannot place stones on the edge in the opening phase.\n\n###\n\n", "completion": "(define \"IsPlayingPhase\" (= 1 (var))) (define \"BlackVC\" (or (\"IsSidesConnected\" S NW (sites Side NE)) (\"IsSidesConnected\" N SW (sites Side SE)))) (define \"WhiteVC\" (or { (\"IsSidesConnected\" S N) (\"IsSidesConnected\" SW NE) (\"IsSidesConnected\" SE NW)})) (define \"IsSidesConnected\" (is Connected {(sites Side #1) (sites Side #2) #3})) (game \"Unlur\" (players 2) (equipment { (board (hex 6)) (piece \"Disc\" Each)}) (rules phases:{ (phase \"Opening\" (play (or (move Add (piece (id \"Disc\" P2)) (to (intersection (sites Empty) (sites Inner)))) (move Pass (then (if (is Mover P1) (swap Players P1 P2 (then (note \"Player 1 is now Black. Player 2 is now White.\" to:All))) (note \"Player 1 remains White. Player 2 remains Black.\" to:All) (then (do (set NextPlayer (player 1)) next:(set Var 1)))))))) (nextPhase (\"IsPlayingPhase\") \"Playing\")) (phase \"Playing\" (play (move Add (to (sites Empty)))))} (end { (if (and {(\"IsPlayingPhase\") (= (id P1) (mover)) (\"BlackVC\") (not (\"WhiteVC\"))}) (result P1 Loss)) (if (and {(\"IsPlayingPhase\") (= (id P2) (mover)) (\"WhiteVC\") (not (\"BlackVC\"))}) (result P2 Loss)) (if (and {(\"IsPlayingPhase\") (= (id P1) (mover)) (\"WhiteVC\")}) (result P1 Win)) (if (and {(\"IsPlayingPhase\") (= (id P2) (mover)) (\"BlackVC\")}) (result P2 Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nFour 3x8 rectangles, arranged in a cross. In the outer rows of each arm, the third square from the outer corners is marked with an X. In two opposite arms, the bottom left corner is marked with \\ \n\n###\n\n", "completion": "(define \"Move\" (or { (if (and { (>= 0 (var \"EnteredPiece\")) (is Occupied (handSite Mover)) (\"Bange\")}) (move (from (handSite Mover)) (to (mapEntry \"DefaultEntry\" Mover)) (then (set Var \"EnteredPiece\" 1)))) (if (and { (>= 0 (var \"EnteredPiece\")) (is Occupied (handSite Mover)) (\"Dust\")}) (move (from (handSite Mover)) (to (mapEntry \"DefaultEntry\" Mover)) (then (set Var \"EnteredPiece\" 1)))) (if (and { (>= 0 (var \"EnteredPiece\")) (is Occupied (handSite Mover)) (\"Dust\")}) (move (from (handSite Mover)) (to (mapEntry \"XEntry\" Mover)))) (forEach Piece)})) (define \"Dust\" (= (\"ThrowValue\") 11)) (define \"Bange\" (= (\"ThrowValue\") 25)) (define \"IsSpecialThrow\" (is In (\"ThrowValue\") (sites {12 25 11 6}))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" #2 #1)) (define \"ThrowValue\" (mapEntry \"Throw\" (count Pips))) (game \"Bargese\" (players 2) (equipment { (\"PachisiBoard\" { (track \"Track1\" \"26,W,S,E,8,S,E,N,11,E,N,W,53,N,W,S,42,W,S1,E7,End\" P1 directed:True) (track \"Track2\" \"27,E,N,W,53,N,W,S,42,W,S,E,8,S,E,N,11,E,N1,W7,End\" P2 directed:True)}) (hand Each) (\"StickDice\" 6) (piece \"Pawn\" Each (if (and { (>= 0 (var \"EnteredPiece\")) (\"IsEndTrack\" (\"SiteToMoveOnTrack\" from:(from) 1)) (or (\"Bange\") (\"Dust\"))}) (move Remove (from) level:(level) (then (set Var \"EnteredPiece\" 1))) (if (and (>= 0 (var \"EnteredPiece\")) (\"IsEndTrack\" (\"SiteToMoveOnTrack\" from:(from) 2))) (move (from (from)) (to (\"SiteToMoveOnTrack\" from:(from) 1))) (move (from (from) level:(level)) (to (\"SiteToMoveOnTrack\" from:(from) (if (< 0 (var \"EnteredPiece\")) (- (\"ThrowValue\") 1) (\"ThrowValue\"))) if:(not (and (is In (to) (sites \"SafeSites\")) (\"IsEnemyAt\" (to)))) (\"HittingStackCapture\" (handSite (who at:(to) level:(level))))) (then (set Var \"EnteredPiece\" 0)))))) (map \"Throw\" {(pair 0 6) (pair 1 11) (pair 2 2) (pair 3 3) (pair 4 4) (pair 5 25) (pair 6 12)}) (map \"DefaultEntry\" {(pair P1 26) (pair P2 27)}) (map \"XEntry\" {(pair P1 2) (pair P2 48)}) (regions \"SafeSites\" (sites {60 62 16 48 87 89 37 2}))}) (rules (start { (place Stack \"Pawn1\" (handSite P1) count:4) (place Stack \"Pawn2\" (handSite P2) count:4)}) (play (do (if (>= 0 (var \"EnteredPiece\")) (roll)) next:(if (can Move (\"Move\")) (\"Move\") (move Pass (then (set Var \"EnteredPiece\" 0)))) (then (if (\"IsSpecialThrow\") (moveAgain))))) (end (\"EscapeWin\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlay occurs on a 3x3 grid. One player places an X, the other places an O and players take turns placing their marks in the grid, losing is they make three in a row of their colour. \n\n###\n\n", "completion": "(game \"Tic-Tac-Toe Misere\" (players 2) (equipment { (board (square 3)) (piece \"Disc\" P1) (piece \"Cross\" P2)}) (rules (play (move Add (to (sites Empty)))) (end (if (is Line 3) (result Next Win))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nChess rooks are added to the game. -> Chess knights are added to the game.\n(define \"InitialPawnMove\" (if (is In (from) (sites Start (piece (what at:(from))))) (\"DoubleStepForwardToEmpty\" \"SetEnPassantLocation\"))) (define \"EnPassant\" (move Step (directions {FR FL}) (to if:\"InLocationEnPassant\") (then (remove (ahead (last To) Backward))))) (define \"InLocationEnPassant\" (and (is Pending) (= (to) (value Pending)))) (define \"SetEnPassantLocation\" (then (set Pending (ahead (last To) Backward)))) (game \"The Pawn Game\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (\"ChessPawn\" \"Pawn\" (or \"InitialPawnMove\" \"EnPassant\")) (\"ChessRook\" \"Rook\") (regions P1 (sites Top)) (regions P2 (sites Bottom))}) (rules (start { (place \"Pawn1\" (sites Row 1)) (place \"Pawn2\" (sites Row 6)) (place \"Rook1\" {\"A1\" \"H1\"}) (place \"Rook2\" {\"A8\" \"H8\"})}) (play (forEach Piece)) (end { (\"ReachWin\" (sites Mover) Mover) (\"BlockWin\")})))\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)))) (game \"The Pawn Game\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (\"ChessPawn\" \"Pawn\" (or \"InitialPawnMove\" \"EnPassant\")) (\"ChessKnight\" \"Knight\") (regions P1 (sites Top)) (regions P2 (sites Bottom))}) (rules (start { (place \"Pawn1\" (sites Row 1)) (place \"Pawn2\" (sites Row 6)) (place \"Knight1\" {\"B1\" \"G1\"}) (place \"Knight2\" {\"B8\" \"G8\"})}) (play (forEach Piece)) (end { (\"ReachWin\" (sites Mover) Mover) (\"BlockWin\")}))) END" }, { "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\n4x6-28 board; 16-20 is most common, only even numbers of holes. Two counters in each hole except the leftmost on the inner row, which is left empty, and the one to its right which contains one counter. Players sow by picking up the counters in any of their holes and sowing them in an anti-clockwise direction. Sowing continues when the last counter falls into an occupied hole by picking up the counters in that hole and continuing in the same direction. When the final counter lands in an empty hole in the inner row, the counters in the opponent's hole opposite in the inner row are captured; if there are also counters in the opponent's outer row opposite, these are also captured. The player is also entitled to capture counters in any other hole on the opponent's side. The turn ends with a capture and the opponent's turn begins. Play always begins with a stylized move, where the counters are taken from the third hole from the left in the inner row, sowing and making captures as described above. Players may not sow single counters unless there are no holes on their side containing multiple counters. Play ends when one player has captured all of their opponent's counters. Each player has 16 holes per row.\n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (+ (count Cell at:(handSite #1)) (count in:(sites #1 \"Home\")))) (define \"Sow\" (then (sow \"Track\" owner:(mover) apply:(if (> (count at:(to)) 1) (moveAgain) (if (is In (to) (sites Mover \"Inner\")) (and { (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))) (if (> (count at:(\"OppositePit\" (to))) 0) (fromTo (from (\"OppositePit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePit\" (to))))) (if (> (count at:(\"OppositeOuterPit\" (to))) 0) (fromTo (from (\"OppositeOuterPit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositeOuterPit\" (to))))) (set Pending) (moveAgain)})))))) (define \"StylizedMove\" (if (is Mover P1) (difference (expand (intersection (sites Row 1) (sites Left)) steps:2 E) (expand (intersection (sites Row 1) (sites Left)) steps:1 E)) (difference (expand (intersection (sites Row 2) (sites Right)) steps:2 W) (expand (intersection (sites Row 2) (sites Right)) steps:1 W)))) (define \"MoveAgainAfterCapture\" (and (is Pending) (\"SameTurn\"))) (define \"Columns\" 16) (game \"Mefuvha\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"0,E,N1,W\" loop:True P1) (track \"Track2\" \"32,E,N1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"Track1\")) (regions \"Home\" P2 (sites Track \"Track2\")) (regions \"Inner\" P1 (difference (sites Track \"Track1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"Track2\") (sites Top))) (piece \"Seed\" Shared) (hand Each)}) (rules (start { (set Count 2 to:(difference (union (sites P1 \"Home\") (sites P2 \"Home\")) (union (expand (intersection (sites Row 1) (sites Left)) steps:1 E) (expand (intersection (sites Row 2) (sites Right)) steps:1 W)))) (set Count 1 to:(union (difference (expand (intersection (sites Row 1) (sites Left)) steps:1 E) (sites Left)) (difference (expand (intersection (sites Row 2) (sites Right)) steps:1 W) (sites Right))))}) (play (if \"MoveAgainAfterCapture\" (move Select (from (sites Next \"Home\") if:(> (count at:(from)) 0)) (then (fromTo (from (last From)) (to (handSite Mover)) count:(count at:(last From))))) (priority (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (if (< (count Turns) 3) \"StylizedMove\" (sites Mover \"Home\"))) if:(> (count at:(from)) 1)) \"Sow\") (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(= (count at:(from)) 1)) \"Sow\")))) (end (\"MancalaByScoreWhen\" (no Moves Mover))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe rules are the same as for Chess, except instead of moving a piece, a player's turn may be taken by replacing a captured piece on the board on any empty space. This piece is controlled by the player who replaced it. Captured pawns cannot be placed in the first or last row. \n\n###\n\n", "completion": "(define \"CaptureForwardDiagonal\" (move Step (directions {FR FL}) (to if:(\"IsEnemyAt\" (to)) (apply (add (piece (mapEntry \"captured\" (what at:(to)))) (to (mapEntry \"where\" (what at:(to))))))))) (define \"EnPassant\" (move Step (directions {FR FL}) (to if:\"InLocationEnPassant\") (then (add (piece (mapEntry \"captured\" (what at:(ahead (last To) Backward)))) (to (mapEntry \"where\" (what at:(ahead (last To) Backward)))))))) (define \"InLocationEnPassant\" (and (is Pending) (= (to) (value Pending)))) (define \"SetEnPassantLocation\" (then (set Pending (ahead (last To) Backward)))) (define \"BigCastling\" (\"DoCastle\" \"King\" W 2 \"KingNotCheckedAndToEmpty\" (then (and (\"PieceHasMoved\") (\"DoCastle\" \"RookLeft\" E 3 True))))) (define \"SmallCastling\" (\"DoCastle\" \"King\" E 2 \"KingNotCheckedAndToEmpty\" (then (and (\"PieceHasMoved\") (\"DoCastle\" \"RookRight\" W 2 True))))) (define \"DoCastle\" (move Slide (from (mapEntry #1 (mover))) #2 (between (exact #3) if:#4) #5)) (define \"KingNotCheckedAndToEmpty\" (and (is Empty (to)) (not (\"IsInCheck\" \"King\" Mover at:(to))))) (define \"CaptureToPieceAndResetCounter\" (apply (if (\"IsEnemyAt\" (to)) (add (piece (mapEntry \"captured\" (what at:(to)))) (to (mapEntry \"where\" (what at:(to)))) (then (set Counter)))))) (define \"RememberPieceHasMoved\" (then (if (= (state at:(last To)) 1) \"PieceHasMoved\"))) (define \"PieceHasMoved\" (set State at:(last To) 0)) (define \"HasNeverMoved\" (= (state at:(mapEntry #1 (mover))) 1)) (define \"KingInTheInitialPlace\" (\"IsPieceAt\" \"King\" Mover (mapEntry \"King\" (mover)))) (define \"NextCanNotMove\" (not (can Move (do (or { (forEach Piece Next) (move (from (sites Occupied by:Next container:\"Hand\" components:{\"Rook\" \"Bishop\" \"Knight\" \"Queen\"})) (to (sites Empty))) (move (from (sites Occupied by:Next container:\"Hand\" component:\"Pawn\")) (to (difference (sites Empty) (sites \"LastRanks\"))))}) ifAfterwards:(not (\"IsInCheck\" \"King\" Next)))))) (game \"Loop Chess\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (piece \"Pawn\" Each (or { (if (is In (from) (sites Start (piece (what at:(from))))) (\"DoubleStepForwardToEmpty\" \"SetEnPassantLocation\")) \"StepForwardToEmpty\" \"CaptureForwardDiagonal\" \"EnPassant\"} (then (and (if (is In (last To) (sites Mover \"Promotion\")) (moveAgain)) (set Counter))))) (piece \"Rook\" Each (move Slide Orthogonal (to if:(\"IsEnemyAt\" (to)) \"CaptureToPieceAndResetCounter\") \"RememberPieceHasMoved\")) (piece \"King\" Each (move Step (to if:(not (\"IsFriendAt\" (to))) \"CaptureToPieceAndResetCounter\") \"RememberPieceHasMoved\")) (piece \"Bishop\" Each (move Slide Diagonal (to if:(\"IsEnemyAt\" (to)) \"CaptureToPieceAndResetCounter\"))) (piece \"Knight\" Each (move Leap \"KnightWalk\" (to if:(not (\"IsFriendAt\" (to))) \"CaptureToPieceAndResetCounter\"))) (piece \"Queen\" Each (move Slide (to if:(\"IsEnemyAt\" (to)) \"CaptureToPieceAndResetCounter\"))) (map \"where\" {(pair 2 64) (pair 1 70) (pair 4 65) (pair 3 71) (pair 6 66) (pair 5 72) (pair 8 67) (pair 7 73) (pair 10 68) (pair 9 74) (pair 12 69) (pair 11 75)}) (map \"captured\" {(pair 1 2) (pair 2 1) (pair 3 4) (pair 4 3) (pair 5 6) (pair 6 5) (pair 7 8) (pair 8 7) (pair 9 10) (pair 10 9) (pair 11 12) (pair 12 11)}) (map \"King\" {(pair 1 \"E1\") (pair 2 \"E8\")}) (map \"RookLeft\" {(pair 1 \"A1\") (pair 2 \"A8\")}) (map \"RookRight\" {(pair 1 \"H1\") (pair 2 \"H8\")}) (regions \"LastRanks\" (union (sites Top) (sites Bottom))) (regions \"Promotion\" P1 (sites Top)) (regions \"Promotion\" P2 (sites Bottom)) (hand Each size:6)}) (rules (start { (place \"Pawn1\" (sites Row 1)) (place \"Pawn2\" (sites Row 6)) (place \"Rook1\" {\"A1\" \"H1\"} state:1) (place \"Knight1\" {\"B1\" \"G1\"}) (place \"Bishop1\" {\"C1\" \"F1\"}) (place \"Queen1\" coord:\"D1\") (place \"King1\" coord:\"E1\" state:1) (place \"Rook2\" {\"A8\" \"H8\"} state:1) (place \"Knight2\" {\"B8\" \"G8\"}) (place \"Bishop2\" {\"C8\" \"F8\"}) (place \"Queen2\" coord:\"D8\") (place \"King2\" coord:\"E8\" state:1)}) (play (if \"SameTurn\" (move Promote (last To) (piece {\"Queen\" \"Knight\" \"Bishop\" \"Rook\"}) Mover) (do (or { (move (from (sites Occupied by:Mover container:\"Hand\" components:{\"Rook\" \"Bishop\" \"Knight\" \"Queen\"})) (to (sites Empty))) (move (from (sites Occupied by:Mover container:\"Hand\" component:\"Pawn\")) (to (difference (sites Empty) (sites \"LastRanks\")))) (forEach Piece) (if (and { \"KingInTheInitialPlace\" (\"HasNeverMoved\" \"King\") (not (\"IsInCheck\" \"King\" Mover))}) (or (if (and (\"HasNeverMoved\" \"RookLeft\") (can Move (\"DoCastle\" \"RookLeft\" E 3 (is Empty (to))))) \"BigCastling\") (if (and (\"HasNeverMoved\" \"RookRight\") (can Move (\"DoCastle\" \"RookRight\" W 2 (is Empty (to))))) \"SmallCastling\")))}) ifAfterwards:(not (\"IsInCheck\" \"King\" Mover))))) (end { (if (and (\"IsInCheck\" \"King\" Next) (\"NextCanNotMove\")) (result Mover Win)) (if (or (no Moves Mover) (= (counter) 100)) (result Mover Draw))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThree concentric squares, with the midpoints of their sides connected with lines. Twelve pieces per player. Players take turns placing one of their pieces on an empty point on the board. The first player to make three in a row obtains the privilege of starting the next phase after all of the stones are placed; if no one makes three in a row the last player to place a stone begins the next phase. Ones all of the stones are placed, the player who has the right to begin the next phase removes any one of the opponent's stones, and the opponent does the same with one of the player's pieces. Then, players alternate turns moving one of their pieces to an empty adjacent space. When a player place three of their pieces in a row, they remove one of the opponent's pieces. If a player moves in such a way that the opponent cannot move, the player must make an extra move to allow the opponent a place to play. A player cannot capture an opponent's piece when this extra move is made. The player who captures all but two of the opponent's pieces wins. Games are usually played in sequence, starting with the winner of the previous game, with the first player to win five games in a row being the winner.\n \n\n###\n\n", "completion": "(define \"ResetGame\" (and { (remove (sites Occupied by:All)) (add (piece (id \"Marker\" P1)) (to (handSite P1)) count:12) (add (piece (id \"Marker\" P2)) (to (handSite P2)) count:12)})) (define \"RemoveEnemyPiece\" (move Remove (sites Occupied by:Next container:\"Board\") #1)) (define \"IfLine3MoveAgain\" (then (if (and (\"NewTurn\") (is Line 3)) (moveAgain) (if (no Moves Next) (and (moveAgain) (set Pending)))))) (define \"SetPlayerSecondPhase\" (and (if (and (< (var) 1) (is Line 3)) (set Var #1)) (if (and (\"HandEmpty\" P1) (\"HandEmpty\" P2)) (if (< (\"PlayerSecondPhase\") 1) (moveAgain) (set NextPlayer (player (\"PlayerSecondPhase\"))))))) (define \"PlayerSecondPhase\" (var)) (game \"Shah\" (players 2) (equipment { (\"NineMensMorrisBoard\") (piece \"Marker\" Each (\"StepToEmpty\" ~ \"IfLine3MoveAgain\")) (hand Each)}) (rules (start (place \"Marker\" \"Hand\" count:12)) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (sites Empty)) (then (\"SetPlayerSecondPhase\" (mover))))) (nextPhase (and (\"HandEmpty\" P1) (\"HandEmpty\" P2)) \"Remove\")) (phase \"Remove\" (play (\"RemoveEnemyPiece\")) (nextPhase Mover \"Move\")) (phase \"Move\" (play (if (and (not (is Pending)) \"SameTurn\") (\"RemoveEnemyPiece\" (then (if (no Moves Next) (and (moveAgain) (set Pending))))) (if (is Pending) (do (forEach Piece (\"StepToEmpty\")) ifAfterwards:(can Move (forEach Piece Next))) (forEach Piece)) (then (if (= 2 (count Pieces P1)) (addScore P2 1 (then (if (!= (score P2) 5) (\"ResetGame\")))) (if (= 2 (count Pieces P2)) (addScore P1 1 (then (if (!= (score P1) 5) (\"ResetGame\"))))))))) (nextPhase (= 0 (count Sites in:(sites Occupied by:All container:\"Board\"))) \"Placement\"))} (end (if (= (score Mover) 5) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n5x5 intersecting lines, with diagonals in each square formed by the lines. Twenty pieces per player, which each player places on the points on their side of the board, as well as the two points to the left of the central space. The central spot remains empty. Players alternate turns by moving a piece to an adjacent empty spot along the lines on the board. A player may capture an opponent's piece by hopping over one adjacent piece if there is an empty spot behind it along a line on the board. The player who captures all of the opponent's pieces wins. \n\n###\n\n", "completion": "(game \"Bis Gutiya\" (players 2) (equipment { (board (square 5 diagonals:Solid) use:Vertex) (piece \"Marker\" Each (or (\"StepToEmpty\") (\"HopCapture\")))}) (rules (\"BeforeAfterCentreSetup\" \"Marker1\" \"Marker2\") (play (forEach Piece)) (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Construct a Ludii game based on the following description\n4x6-21 board; 8 is most common, 12, 15, and 18 are also popular. Two counters in each hole in the players' outer rows. Before the game starts, players choose to make additional captures from one, two, or three holes. Sowing occurs in an anti-clockwise direction, only in the two rows belonging to the player. When the final counter lands in an occupied hole, these are picked up and sowing continues. When the final counter lands in an empty hole in the inner row, any counters in the opposite hole in the opponent's inner row are captured. If there also are counters in the opposite hole in the opponent's outer row, these are also captured, but only if there was first a capture from the inner row hole. The player then captures again, from the agreed-upon number of extra holes, chosen from any of the opponent's holes. Players cannot sow from a hole with a single counter unless there are no holes with multiple counters. Single counters can only be sown into an empty hole. Play continues until one player has captured all of the opponent's counters, thus winning the game. 3 extra captures. 8 Holes per row.\n\n###\n\n", "completion": "(define \"HaveToMakeExtraCapture\" (set Var 3)) (define \"NumCapture\" (var)) (define \"NextHoleFrom\" (\"NextSiteOnTrack\" 1 from:#1 #2)) (define \"AHoleHasMoreThanOneCounter\" (not (all Sites (forEach (sites Mover) if:(< 1 (count at:(site)))) if:(= 0 (count at:(site)))))) (define \"NoPiece\" (all Sites (sites Player \"Home\") if:(= 0 (count at:(site))))) (define \"Columns\" 8) (game \"Tsoro (Additional Capture)\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"0,E,N1,W\" loop:True P1) (track \"Track2\" \"16,E,N1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"Track1\")) (regions \"Home\" P2 (sites Track \"Track2\")) (regions \"Inner\" P1 (difference (sites Track \"Track1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"Track2\") (sites Top))) (piece \"Seed\" Shared)}) (rules (start (set Count 2 to:(union (sites Top) (sites Bottom)))) (play (if (< 0 (\"NumCapture\")) (move Remove (forEach (sites Next) if:(< 0 (count at:(site)))) (then (and (if (< 1 (\"NumCapture\")) (moveAgain)) (set Var (- (\"NumCapture\") 1))))) (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(if \"AHoleHasMoreThanOneCounter\" (> (count at:(from)) 1) (and (= (count at:(from)) 1) (= 0 (count at:(\"NextHoleFrom\" (from) Mover)))))) (then (sow \"Track\" owner:(mover) apply:(if (= (count at:(to)) 1) (if (is In (to) (sites Mover \"Inner\")) (if (> (count at:(\"OppositePit\" (to))) 0) (and { (remove (\"OppositePit\" (to))) (if (> (count at:(\"OppositeOuterPit\" (to))) 0) (remove (\"OppositeOuterPit\" (to)))) (moveAgain) (\"HaveToMakeExtraCapture\")}))) (moveAgain))))))) (end (forEach NonMover if:(\"NoPiece\") (result Player Loss))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nStarting of the game, the player can select the goal of the puzzle, which can be spanning tree or caterpillar tree. This game has two versions: addition and deletion version. At the addition version, the board graph is initially uncoloured. Players take turns to colour an uncoloured edge by a common colour. After colouring some edges, if the player makes a spanning tree (or caterpillar tree), he wins. At the other version, the game starts with all the same coloured edges. At each turn, a player chooses to remove the colour of a coloured edge. After removing some coloured edges, if the player makes his desired tree (spanning or caterpillar tree), he wins. The game is played on the Graph1. The players play on Addition version.\n\n###\n\n", "completion": "(game \"SpanRups\" (players 1) (equipment { (board (graph vertices:{ {0 0} {0 1} {0 2} {0 3} {0 4} {1 0} {1 1} {1 2} {1 3} {1 4} {2 0} {2 1} {2 2} {2 3} {2 4} {3 0} {3 1} {3 2} {3 3} {3 4} {4 0} {4 1} {4 2} {4 3} {4 4}} edges:{ {0 1} {0 5} {0 6} {1 6} {1 2} {1 5} {2 7} {2 3} {3 8} {3 4} {3 9} {4 8} {4 9} {5 6} {5 10} {6 11} {6 7} {6 12} {7 12} {7 8} {8 13} {8 9} {9 14} {7 11} {7 13} {8 12} {10 11} {11 12} {12 13} {13 14} {10 15} {11 16} {11 17} {12 16} {12 17} {12 18} {13 17} {13 18} {14 19} {15 16} {15 20} {15 21} {16 20} {16 21} {20 21} {16 17} {17 22} {21 22} {17 18} {18 23} {22 23} {18 19} {18 24} {19 23} {19 24} {23 24}}) use:Edge) (piece \"Marker\" Each)}) (rules (play (move Add (to Edge (sites Empty Edge)))) (end { (if (no Moves Mover) (result Mover Loss)) (if (is SpanningTree Mover) (result Mover Win))}))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game is played on a board with 7 hexes per side. -> The game is played on a board with 8 hexes per side.\n(define \"IsPlayingPhase\" (= 1 (var))) (define \"BlackVC\" (or (\"IsSidesConnected\" S NW (sites Side NE)) (\"IsSidesConnected\" N SW (sites Side SE)))) (define \"WhiteVC\" (or { (\"IsSidesConnected\" S N) (\"IsSidesConnected\" SW NE) (\"IsSidesConnected\" SE NW)})) (define \"IsSidesConnected\" (is Connected {(sites Side #1) (sites Side #2) #3})) (game \"Unlur\" (players 2) (equipment { (board (hex 7)) (piece \"Disc\" Each)}) (rules phases:{ (phase \"Opening\" (play (or (move Add (piece (id \"Disc\" P2)) (to (intersection (sites Empty) (sites Inner)))) (move Pass (then (if (is Mover P1) (swap Players P1 P2 (then (note \"Player 1 is now Black. Player 2 is now White.\" to:All))) (note \"Player 1 remains White. Player 2 remains Black.\" to:All) (then (do (set NextPlayer (player 1)) next:(set Var 1)))))))) (nextPhase (\"IsPlayingPhase\") \"Playing\")) (phase \"Playing\" (play (move Add (to (sites Empty)))))} (end { (if (and {(\"IsPlayingPhase\") (= (id P1) (mover)) (\"BlackVC\") (not (\"WhiteVC\"))}) (result P1 Loss)) (if (and {(\"IsPlayingPhase\") (= (id P2) (mover)) (\"WhiteVC\") (not (\"BlackVC\"))}) (result P2 Loss)) (if (and {(\"IsPlayingPhase\") (= (id P1) (mover)) (\"WhiteVC\")}) (result P1 Win)) (if (and {(\"IsPlayingPhase\") (= (id P2) (mover)) (\"BlackVC\")}) (result P2 Win))})))\n\n###\n\n", "completion": "(define \"IsPlayingPhase\" (= 1 (var))) (define \"BlackVC\" (or (\"IsSidesConnected\" S NW (sites Side NE)) (\"IsSidesConnected\" N SW (sites Side SE)))) (define \"WhiteVC\" (or { (\"IsSidesConnected\" S N) (\"IsSidesConnected\" SW NE) (\"IsSidesConnected\" SE NW)})) (define \"IsSidesConnected\" (is Connected {(sites Side #1) (sites Side #2) #3})) (game \"Unlur\" (players 2) (equipment { (board (hex 8)) (piece \"Disc\" Each)}) (rules phases:{ (phase \"Opening\" (play (or (move Add (piece (id \"Disc\" P2)) (to (intersection (sites Empty) (sites Inner)))) (move Pass (then (if (is Mover P1) (swap Players P1 P2 (then (note \"Player 1 is now Black. Player 2 is now White.\" to:All))) (note \"Player 1 remains White. Player 2 remains Black.\" to:All) (then (do (set NextPlayer (player 1)) next:(set Var 1)))))))) (nextPhase (\"IsPlayingPhase\") \"Playing\")) (phase \"Playing\" (play (move Add (to (sites Empty)))))} (end { (if (and {(\"IsPlayingPhase\") (= (id P1) (mover)) (\"BlackVC\") (not (\"WhiteVC\"))}) (result P1 Loss)) (if (and {(\"IsPlayingPhase\") (= (id P2) (mover)) (\"WhiteVC\") (not (\"BlackVC\"))}) (result P2 Loss)) (if (and {(\"IsPlayingPhase\") (= (id P1) (mover)) (\"WhiteVC\")}) (result P1 Win)) (if (and {(\"IsPlayingPhase\") (= (id P2) (mover)) (\"BlackVC\")}) (result P2 Win))}))) END" }, { "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 Ludii game based on the following description\nUse Options to select a board size.\n Goal: Be the last to play.\n \n Then the first player (Maroon) places a stone, after which the players alternate, taking up to two moves per turn.\n To move, either:\n \n 1. Add a stone to an empty space that is not in line-of-sight of any opponent's stone. -Or,\n 2. Slide a stone along a straight line to a new position, with the following restriction:\n \n Either\n -- A. The new location must have a greater number of opponent's stones adjacent to it, or\n -- B. The new location must have more sight-lines to opponent's stones than the old location, while keeping number of adjacent opponent's stones the same. \n \n To avoid forfeiting the game, a player must move at least once on a turn. The second move can be voluntarily skipped.\n The winner is last to play.\n \n The score shown is a count of the available moves at the beginning of a player's turn for use by the AI. Extra small board (39 nodes) as a filler game and for learning how to play\n\n###\n\n", "completion": "(define \"Perf7\" (board (dual (remove (hex \"Jungle\") cells:{12 25 34 41 50 57 66 75 82 91 98 107 116 123 131 144 150 161})) use:Vertex)) (define \"Perf6\" (board (dual (remove (hex 8) cells:{0 4 5 6 7 8 13 17 20 27 28 35 44 49 54 61 62 65 72 76 77 84 91 92 96 103 106 107 114 119 124 133 140 141 148 151 155 160 161 162 163 164 168})) use:Vertex)) (define \"Perf5\" (board (dual (remove (hex 7 8) cells:{0 1 2 3 4 5 6 7 8 9 10 11 12 16 17 18 19 26 27 34 38 43 50 53 60 63 64 71 76 77 82 89 92 99 108 116 123 130 131 132 136 137 138 139 140 141 142 143 144 145 146})) use:Vertex)) (define \"Perf4\" (board (dual (remove (hex 6) cells:{0 1 5 12 17 23 30 37 40 45 50 53 60 67 73 78 85 89 90})) use:Vertex)) (define \"Perf3\" (board (dual (remove (hex 5 6) cells:{0 1 2 3 4 5 6 7 11 12 13 14 21 25 30 37 42 53 63 64 65 69 70 71 72 73 74})) use:Vertex)) (define \"Perf2\" (board (dual (remove (hex 4 5) cells:{0 1 15 20 25 32 36 39 44})) use:Vertex)) (define \"Jungle\" (poly { { -3.5 -11.75} { -10.0 -5.25} { -6.75 12.0} { 1.25 14.75} { 15.25 3.25} { 14.0 -5.75}})) (define \"BoardUsed\" \"Perf2\") (define \"LoSDirection\" Orthogonal) (define \"PassEnd\" (if (and (\"SameTurn\") (no Moves Next)) (result Mover Win))) (define \"ScoreTerritory\" (and (\"MPScoring\" Mover Next) (\"MPScoring\" Next Mover))) (define \"MPScoring\" (set Score #1 (+ (size Array (array (sites From (\"Movement\" #1)))) (count Sites in:(difference (\"SitesControlledBy\" #1) (\"SitesControlledBy\" #2)))))) (define \"Movement\" (forEach Piece (do (and (set Var \"LoSFrom\" (\"LoSAt\" (from))) (set Var \"QtyAroundFrom\" (\"QtyAround\" (from)))) next:(move Slide \"LoSDirection\") ifAfterwards:(or (> (\"QtyAround\" (last To)) (var \"QtyAroundFrom\")) (and (= (\"QtyAround\" (last To)) (var \"QtyAroundFrom\")) (> (\"LoSAt\" (last To)) (var \"LoSFrom\"))))) #1)) (define \"Placement\" (move Add (piece (mover)) (to (difference (sites Empty) (\"SitesControlledBy\" Next))))) (define \"SitesControlledBy\" (sites (results from:(sites Occupied by:#1) to:(sites LineOfSight Empty at:(from) \"LoSDirection\") (to)))) (define \"LoSAt\" (count Pieces Next in:(sites LineOfSight Piece at:#1 \"LoSDirection\"))) (define \"QtyAround\" (count Pieces Next in:(sites Around #1 \"LoSDirection\"))) (game \"Epoxy\" (players 2) (equipment { \"BoardUsed\" (piece \"Ball\" Each (move Slide))}) (rules (start (set Score Each 0)) (play (or { (\"Placement\") (\"Movement\" Mover) (if (and (not (is Prev Next)) (< 0 (counter))) (move Pass))} (then (if (is Prev Next) (moveAgain) (\"ScoreTerritory\"))))) (end \"PassEnd\"))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"CanEscape\" (\"IsOffBoard\" #1)) (define \"AllPieceEscaped\" (no Pieces Mover)) (define \"Bar\" (mapEntry (mover))) (define \"RemoveAPiece\" (move Remove (site))) (define \"NextSiteFromDist6\" (\"NextSiteOnTrack\" 6 from:#1)) (define \"NextSiteFrom\" (\"NextSiteOnTrack\" (pips) from:#1)) (game \"Imperial\" (players 2) (equipment { (\"BackgammonBoard\" (\"BackgammonTracksWithBar\")) (dice num:3) (map {(pair 1 19) (pair 2 6)}) (piece \"Disc\" Each)}) (rules (start { (place Stack \"Disc1\" 10 count:5) (place Stack \"Disc1\" 11 count:5) (place Stack \"Disc1\" 12 count:5) (place Stack \"Disc2\" 23 count:5) (place Stack \"Disc2\" 24 count:5) (place Stack \"Disc2\" 25 count:5)}) (play (\"RollEachNewTurnMove\" (forEach Die if:(\"DieNotUsed\") (forEach Site (sites Occupied by:Mover) (if (\"CanEscape\" (\"NextSiteFrom\" (site))) (\"RemoveAPiece\") (move (from (site)) (to (\"NextSiteFrom\" (site)) if:(\"NoEnemyOrOnlyOne\" (to)) (\"HittingCapture\" (\"Bar\")))))) (then (\"ReplayNotAllDiceUsed\"))))) (end (if (\"AllPieceEscaped\") (result Mover Win)))))\n\n###\n\n", "completion": "2x12 board, divided in half, where the spaces are rendered as points. Fifteen pieces per player. Three six-sided dice. The points form a continuous track in a horseshoe shape; each player progresses in opposite directions, one from their bottom right to the top right, the other from their bottom left to their top left. Pieces begin on the board, five each on the sixth, seventh, and eighth point in their track. Players move according to the number on each die by moving one piece the value on one die then another piece the value on the other die, or by moving one piece the value of one die and then the value of the other. A piece cannot move to a point that is occupied by more than one of the opponent's pieces. If a piece lands on a point occupied by a single piece belonging to the opponent, the opponent's piece is removed from the board and must enter again from the beginning of the player's track. A piece may be borne off the board when a throw is greater than the number of points left on the board. The first player to bear all of their pieces off the board wins.\n END" }, { "prompt": "Construct a Ludii game based on the following description\nThe game is played on a sheet of graph paper, with any set of designs traced out. It is most commonly played on rectangular board like a 6\u00d76 square.\n \n Two players have a collection of dominoes which they place on the grid in turn. A player can place a domino either horizontally or vertically. Contrary to the related game of Domineering, the possible moves are the same for the two players, and Cram is then an impartial game.\n \n As for all impartial games, there are two possible conventions for victory: in the normal game, the first player who cannot move loses, and on the contrary, in the misere version, the first player who cannot move wins. The board has 6 rows. The board has 6 columns. The Last player to play wins.\n\n###\n\n", "completion": "(game \"Cram\" (players 2) (equipment { (board (rectangle 6 6)) (tile \"Tile\" P1 {F} numSides:4) (tile \"Tile\" P2 {F} numSides:4)}) (rules (play (or (move Add (piece (mover) state:0) (to (sites Empty))) (move Add (piece (mover) state:1) (to (sites Empty))))) (end (\"NoMoves\" Loss)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nMOVE - Stones may move to an adjacent (orthogonal or diagonal) empty cell.\n \n CAPTURE - Stones capture by jumping over an enemy stone and landing in the immediate opposite empty cell.\n - Captures are mandatory.\n - Captures are multiple and the player must choose the jumping sequence that captures more enemy stones.\n \n GOAL - A player wins when it captures all enemy stones, or when he moves his last remaining stone to the center cell. \n\n###\n\n", "completion": "(game \"Jumping Beans\" (players 2) (equipment { (board (square 7)) (piece \"Bean\" Each (\"StepToEmpty\"))}) (rules (\"BeforeAfterCentreSetup\" \"Bean1\" \"Bean2\") (play (if (\"SameTurn\") (max Moves (\"HopCapture\" (from (last To)) ~ (then (\"ReplayIfCanMove\" (\"HopCapture\" (from (last To))))))) (priority { (max Moves (forEach Piece (\"HopCapture\" ~ ~ (then (\"ReplayIfCanMove\" (\"HopCapture\" (from (last To)))))))) (forEach Piece)}))) (end (if (or (no Pieces Next) (and (= 1 (count Pieces Mover)) (= (centrePoint) (where \"Bean\" Mover)))) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6 board. 72 counters are distributed unevenly into the holes with the only rule that corresponding holes on either side of the board must contain counters. The opponent moves first, but may flip the board around if they prefer that arrangement, sacrificing the first move. Counters are sowed in an anti-clockwise direction from a hole in the player's row. If the last counter falls into a hole making it odd, these are picked up and sowing continues. If it lands in a hole making it even, these counters are captured as are the ones in the opposite hole. If the previous hole also has an even number, these and the ones in the opposite hole are captured. If the last counter falls into an empty hole, the turn ends. If a player has no counters in their holes, the opponent must give them one counter, to be placed in the leftmost hole and played from there. Play ends when the board is cleared of counters. Each player counts the number of counters they captured. The player with more counters is given a score equal to the difference in the number of counters. Another round begins again exactly as before. The game is won when a player accumulates sixty points. \n\n###\n\n", "completion": "(define \"EmptyBoard\" (all Sites (sites Board) if:(= 0 (count at:(site))))) (define \"NoCounters\" (all Sites (sites #1) if:(= 0 (count at:(site))))) (define \"CorrespondingHolesHaveSeeds\" (all Sites (sites Bottom) if:(if (is Empty (site)) (is Empty (+ (site) \"Columns\")) (is Occupied (+ (site) \"Columns\"))))) (define \"Columns\" 6) (game \"Li'b al-'Aqil\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" store:None (track \"Track\" \"0,E,N,W\" loop:True)) (piece \"Seed\" Shared) (hand Each) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map \"LeftMost\" {(pair P1 0) (pair P2 11)})}) (rules (start (place \"Seed\" (handSite P1) count:72)) phases:{ (phase \"Opening1\" (play (or { (if (is Occupied Cell (handSite P1)) (forEach Value min:1 max:(count Cell at:(handSite P1)) (move (from (handSite P1)) (to (sites Board)) count:(value))) (forEach Site (sites Board) (if (is Occupied (site)) (move (from (site)) (to (sites Board) if:(!= (to) (from)))))) (then (moveAgain))) (if (and (is Empty (handSite P1)) (\"CorrespondingHolesHaveSeeds\")) (move Pass))})) (nextPhase (was Pass) \"Opening2\")) (phase \"Opening2\" (play (or (move Pass (then (moveAgain))) (move Swap Players P1 P2) (then (set Pending)))) (nextPhase \"Sowing\")) (phase \"Sowing\" (play (if (and (\"NewTurn\") (\"NoCounters\" Next)) (move (from (sites Mover) if:(is Occupied (from))) (to (mapEntry \"LeftMost\" Next))) (move Select (from (if (and (not (is Pending)) (\"SameTurn\")) (sites {(var \"Replay\")}) (sites Mover)) if:(is Occupied (from))) (then (sow if:True apply:(if (is Odd (count at:(to))) (and (moveAgain) (set Var \"Replay\" (to))) (and (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))) (if (is Occupied (\"OppositePitTwoRows\" (to))) (fromTo (from (\"OppositePitTwoRows\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePitTwoRows\" (to))))))) backtracking:(and (is Occupied (to)) (is Even (count at:(to))))))) (then (if (\"EmptyBoard\") (and (if (< (count Cell at:(handSite P1)) (count Cell at:(handSite P2))) (addScore P2 (- (count Cell at:(handSite P2)) (count Cell at:(handSite P1)))) (addScore P1 (- (count Cell at:(handSite P1)) (count Cell at:(handSite P2))))) (if (is Occupied Cell (handSite P2)) (fromTo (from (handSite P2)) (to (handSite P1)) count:(count Cell at:(handSite P2))))))))) (nextPhase (\"EmptyBoard\") \"Opening1\"))} (end (forEach Player if:(<= 60 (score Player)) (result Player Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nCrossway is played with a Go set. The board starts out empty. Each player takes possession of all of the stones of one color. Players take turns adding their stones to the board, one stone per turn. A player must never create a crosscut formation. Black makes the first placement of the game. If you have no more available placements, you forfeit your turn and your opponent can continue making placements until completing his goal connection. For White to win, White must form a contiguous sequence of white stones connecting the West edge to the East edge of the board. Each stone in the sequence must be connected to neighboring stones in the sequence by horizontal, vertical, or diagonal adjacencies. Likewise for Black and the North and South edges. A corner is considered to be part of both adjoining edges. Crossway makes use of the pie rule. This means Black makes the first placement, and White has the option of switching colors with Black, and claiming Black's first move as his own. If White chooses to exercise the pie rule, Black then becomes White and now makes the second placement of the game. The pie rule can only be used once and on the second move of the game. The game is played on a 19x19 board\n\n###\n\n", "completion": "(define \"IsNotCut\" (not (is Pattern {F R F R F} whats:{(mover) (next)}))) (game \"Crossway\" (players 2) (equipment { (board (square 19) use:Vertex) (piece \"Marker\" Each) (regions P1 {(sites Side N) (sites Side S)}) (regions P2 {(sites Side W) (sites Side E)})}) (rules (meta (swap)) (play (do (move Add (to (sites Empty))) ifAfterwards:\"IsNotCut\")) (end (if (is Connected All Mover) (result Mover Win))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nOrder 8 board -> Order 2 board\nSquare Grid -> Hex Grid\n(define \"BoardUsed\" (square 8)) (define \"StepIteration\" (if (<= #2 (count Pieces Next in:(sites Around (from)))) (move (from (from)) (to (#1))))) (define \"S5\" (intersection (sites Empty) (sites Around (\"S4\")))) (define \"S4\" (intersection (sites Empty) (sites Around (\"S3\")))) (define \"S3\" (intersection (sites Empty) (sites Around (\"S2\")))) (define \"S2\" (intersection (sites Empty) (sites Around (\"S1\")))) (define \"S1\" (intersection (sites Empty) (sites Around (from)))) (define \"StepMoves\" (or { (\"StepIteration\" \"S1\" 1) (\"StepIteration\" \"S2\" 2) (\"StepIteration\" \"S3\" 3) (\"StepIteration\" \"S4\" 4) (\"StepIteration\" \"S5\" 5)})) (define \"PlaceOutOfSight\" (move Add (to (sites Empty) if:(not (is Within (id \"Disc\" Mover) in:(sites LineOfSight Piece at:(to))))) (then (addScore Mover 1)))) (game \"Infuse\" (players 2) (equipment { (board \"BoardUsed\" use:Cell) (piece \"Disc\" Each)}) (rules (start (set Score Each 0)) (play (if (was Pass) (or (move Pass) (priority (\"PlaceOutOfSight\") (forEach Piece (do (\"StepMoves\") ifAfterwards:(can Move (add (to (sites Empty) if:(not (is Within (id \"Disc\" Mover) in:(sites LineOfSight Piece at:(to))))))))))) (or { (\"PlaceOutOfSight\") (forEach Piece (\"StepMoves\")) (move Pass)}))) (end { (if (and (all Passed) (> (score Mover) (score Next))) (result Mover Win)) (if (and (all Passed) (<= (score Mover) (score Next))) (result Next Win))})))\n\n###\n\n", "completion": "(define \"BoardUsed\" (hex 2)) (define \"StepIteration\" (if (<= #2 (count Pieces Next in:(sites Around (from)))) (move (from (from)) (to (#1))))) (define \"S5\" (intersection (sites Empty) (sites Around (\"S4\")))) (define \"S4\" (intersection (sites Empty) (sites Around (\"S3\")))) (define \"S3\" (intersection (sites Empty) (sites Around (\"S2\")))) (define \"S2\" (intersection (sites Empty) (sites Around (\"S1\")))) (define \"S1\" (intersection (sites Empty) (sites Around (from)))) (define \"StepMoves\" (or { (\"StepIteration\" \"S1\" 1) (\"StepIteration\" \"S2\" 2) (\"StepIteration\" \"S3\" 3) (\"StepIteration\" \"S4\" 4) (\"StepIteration\" \"S5\" 5)})) (define \"PlaceOutOfSight\" (move Add (to (sites Empty) if:(not (is Within (id \"Disc\" Mover) in:(sites LineOfSight Piece at:(to))))) (then (addScore Mover 1)))) (game \"Infuse\" (players 2) (equipment { (board \"BoardUsed\" use:Cell) (piece \"Disc\" Each)}) (rules (start (set Score Each 0)) (play (if (was Pass) (or (move Pass) (priority (\"PlaceOutOfSight\") (forEach Piece (do (\"StepMoves\") ifAfterwards:(can Move (add (to (sites Empty) if:(not (is Within (id \"Disc\" Mover) in:(sites LineOfSight Piece at:(to))))))))))) (or { (\"PlaceOutOfSight\") (forEach Piece (\"StepMoves\")) (move Pass)}))) (end { (if (and (all Passed) (> (score Mover) (score Next))) (result Mover Win)) (if (and (all Passed) (<= (score Mover) (score Next))) (result Next Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nIt is played on a board that is a grid of dots. 3x3 dots is common. Players alternate turns drawing a line between two of the dots. If a player completes a square, they receive one point and play again. The player with the most points when there are no more moves wins. The board uses a square tiling. The game is played on a 8x8 board. The first player capture half the cells wins.\n\n###\n\n", "completion": "(define \"HalfBoardSize\" (/ (count Cells) 2)) (define \"CaptureTheCell\" (claim (to Cell (site)) (then (and (addScore Mover 1) (moveAgain))))) (define \"NoFreeEdge\" (\"NoSites\" (intersection (sites Incident Edge of:Cell at:(site)) (sites Empty Edge)))) (define \"CellOfLastEdge\" (sites Incident Cell of:Edge at:(last To))) (game \"Dots and Boxes\" (players 2) (equipment {(board (square 8))}) (rules (play (move Add (to Edge (sites Empty Edge)) (then (forEach Site \"CellOfLastEdge\" (if \"NoFreeEdge\" \"CaptureTheCell\"))))) (end (if (> (score Mover) \"HalfBoardSize\") (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6 board with two stores. Four counters in each hole. Play may begin from any of the player's holes. Counters are sown anti-clockwise. If the last counter falls into an empty hole or a hole in either row, making that hole contain four counters, play ends, and the four counters are taken. Also, if at any time during the sowing a hole contains four counters, the player on whose row this occurs takes those counters. Otherwise, the player lifts the counters in the hole in which the final counter lands and continues sowing. Play ends when one player can no longer move. The player with the most counters wins. \n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (+ (count at:(mapEntry #1)) (count in:(sites #1)))) (game \"Obridje\" (players 2) (equipment { (mancalaBoard 2 6 (track \"Track\" \"1,E,N,W\" loop:True)) (piece \"Seed\" Shared) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 FirstSite) (pair P2 LastSite)})}) (rules (start (set Count 4 to:(sites Track))) (play (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (sites Mover)) if:(> (count at:(from)) 0)) (then (do (set Var \"NumSowed\" (count at:(last To))) next:(sow apply:(if (and (!= 4 (count at:(to))) (< 1 (count at:(to)))) (and (moveAgain) (set Var \"Replay\" (to))))) (then (and (forEach Site (sites Track from:(last From) to:(trackSite Move from:(last From) \"Track\" steps:(var \"NumSowed\"))) (if (= 4 (count at:(site))) (fromTo (from (site)) (to (if (is In (to) (sites P1)) (mapEntry P1) (mapEntry P2))) count:4))) (set Var \"NumSowed\" 0))))))) (end (\"MancalaByScoreWhen\" (no Moves Next))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nEach row has 41 holes. -> Each row has 42 holes.\n(define \"PiecesOwnedBy\" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (define \"Columns\" 41) (game \"En Gehe\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" store:None (track \"Track\" \"0,E,N,W\" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 4 to:(sites Track))) (play (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover)) if:(> (count at:(from)) 0)) (then (sow apply:(if (> (count at:(to)) 1) (moveAgain) (if (and (is In (to) (sites Mover)) (> (count at:(\"OppositePit\" (to))) 0)) (and (fromTo (from (\"OppositePit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePit\" (to)))) (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to)))))))))) (end (\"MancalaByScoreWhen\" (no Moves Mover)))))\n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (define \"Columns\" 42) (game \"En Gehe\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" store:None (track \"Track\" \"0,E,N,W\" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 4 to:(sites Track))) (play (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover)) if:(> (count at:(from)) 0)) (then (sow apply:(if (> (count at:(to)) 1) (moveAgain) (if (and (is In (to) (sites Mover)) (> (count at:(\"OppositePit\" (to))) 0)) (and (fromTo (from (\"OppositePit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePit\" (to)))) (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to)))))))))) (end (\"MancalaByScoreWhen\" (no Moves Mover))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nOn a turn, the active player takes a cube that is blank or bearing his symbol from the outer ring of the grid, then adds it to the grid by pushing it into one of the rows from which it was removed. Thus, a few pieces of the grid change places each turn, and the cubes slowly go from blank to crosses and circles. Play continues until someone forms an orthogonal or diagonal line of five cubes bearing his symbol, with this person winning the game. \n\n###\n\n", "completion": "(define \"Push\" (move Select #1 (then (and { (push (from (last To)) #2) \"CompleteLineWithPieceTaken\"})))) (define \"From\" (from (difference (intersection (sites #1) #2) (sites {(last To)})))) (define \"LastColumn\" (sites Column (column of:(last To)))) (define \"LastRow\" (sites Row (row of:(last To)))) (define \"TakeAPieceInOuterSites\" (move Select (from (sites Outer) if:(or (is Mover (who at:(from))) (= (who at:(from)) 0))) (then (and (fromTo (from (last To)) (to (handSite (mover)))) (moveAgain))))) (define \"CompleteLineWithPieceTaken\" (if (or (= (what at:(handSite (mover))) (id \"Square0\")) (= (what at:(handSite (mover))) (mover))) (add (piece (mover)) (to (last To))) (add (piece (next)) (to (last To)))) (remove (handSite (mover)))) (game \"Quixo\" (players 2) (equipment { (board (square 5)) (piece \"Disc\" P1) (piece \"Cross\" P2) (piece \"Square\" Neutral) (hand Each)}) (rules (start (place \"Square0\" (sites Board))) (play (if \"SameTurn\" (or { (\"Push\" (\"From\" Left \"LastRow\") E) (\"Push\" (\"From\" Right \"LastRow\") W) (\"Push\" (\"From\" Bottom \"LastColumn\") N) (\"Push\" (\"From\" Top \"LastColumn\") S)}) \"TakeAPieceInOuterSites\")) (end { (if (is Line 5 throughAny:(sites LastTo) what:(next)) (result Next Win)) (if (is Line 5 throughAny:(sites LastTo) what:(mover)) (result Mover Win))}))) END" }, { "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": "Modify the Ludii game according to the following option changes:\nA size 4 board is currently selected -> A size 5 board is currently selected\n(define \"ScoreOf\" (+ (results from:(sites Occupied by:#1) to:0 (if (\"ConnectsAt\" (from)) 1 -1)))) (define \"UpdateScoreMover\" (and (set Score Mover 0) (forEach Group Orthogonal if:(is Mover (who at:(to))) (if (\"Connects\" (sites)) (addScore Mover (count Sites in:(sites))) (addScore Mover (- (count Sites in:(sites)))))))) (define \"LengthOfDiagonal\" (* 2 (- 4 1))) (define \"ConnectsSLOWER\" (or { (is Connected {(sites Side N) #1 (sites Side S)}) (is Connected {(sites Side NW) #1 (sites Side SE)}) (is Connected {(sites Side NE) #1 (sites Side SW)})})) (define \"Connects\" (= (max (results from:(intersection #1 (sites Perimeter)) to:(intersection #1 (sites Perimeter)) (count Steps (from) (to)))) (\"LengthOfDiagonal\"))) (define \"ConnectsAt\" (or { (is Connected at:#1 {(sites Side N) (sites Side S)}) (is Connected at:#1 {(sites Side NW) (sites Side SE)}) (is Connected at:#1 {(sites Side NE) (sites Side SW)})})) (game \"Signum\" (players 2) (equipment { (board (hex 4)) (piece \"Disc\" Each)}) (rules (meta (swap)) (play (move Add (to (sites Empty)))) (end (if (is Full) (byScore { (score P1 (\"ScoreOf\" P1)) (score P2 (\"ScoreOf\" P2))})))))\n\n###\n\n", "completion": "(define \"ScoreOf\" (+ (results from:(sites Occupied by:#1) to:0 (if (\"ConnectsAt\" (from)) 1 -1)))) (define \"UpdateScoreMover\" (and (set Score Mover 0) (forEach Group Orthogonal if:(is Mover (who at:(to))) (if (\"Connects\" (sites)) (addScore Mover (count Sites in:(sites))) (addScore Mover (- (count Sites in:(sites)))))))) (define \"LengthOfDiagonal\" (* 2 (- 5 1))) (define \"ConnectsSLOWER\" (or { (is Connected {(sites Side N) #1 (sites Side S)}) (is Connected {(sites Side NW) #1 (sites Side SE)}) (is Connected {(sites Side NE) #1 (sites Side SW)})})) (define \"Connects\" (= (max (results from:(intersection #1 (sites Perimeter)) to:(intersection #1 (sites Perimeter)) (count Steps (from) (to)))) (\"LengthOfDiagonal\"))) (define \"ConnectsAt\" (or { (is Connected at:#1 {(sites Side N) (sites Side S)}) (is Connected at:#1 {(sites Side NW) (sites Side SE)}) (is Connected at:#1 {(sites Side NE) (sites Side SW)})})) (game \"Signum\" (players 2) (equipment { (board (hex 5)) (piece \"Disc\" Each)}) (rules (meta (swap)) (play (move Add (to (sites Empty)))) (end (if (is Full) (byScore { (score P1 (\"ScoreOf\" P1)) (score P2 (\"ScoreOf\" P2))}))))) END" }, { "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": "Describe the mechanics of the following Ludii game\n(define \"PromoteTo\" (move Promote (last To) #1 Mover)) (define \"KingCaptureStep\" (move Step #1 (to if:\"IsToEmptyOrEnemy\" (apply (if (\"IsEnemyAt\" (to)) (remove (to) (then (set Counter)))))) #2)) (define \"P12\" (if (is Mover P1) #1 #2)) (define \"IsToEmptyOrEnemy\" (or \"IsToEmpty\" (\"IsEnemyAt\" (to)))) (define \"IsToEmpty\" (is In (to) (sites Empty))) (define \"Directions\" (\"P12\" (directions #1) (directions #2))) (game \"Mini Hexchess\" (\"TwoPlayersNorthSouth\") (equipment { (board (rotate 90 (hex 4))) (piece \"King\" Each (\"KingCaptureStep\" All ~)) (piece \"Queen\" Each (\"SlideCapture\" ~ ~ (then (set Counter)))) (piece \"Rook\" Each (\"SlideCapture\" Orthogonal ~ (then (set Counter)))) (piece \"Bishop\" Each (\"SlideCapture\" Diagonal ~ (then (set Counter)))) (\"ChessKnight\" \"Knight\" (then (set Counter))) (piece \"Pawn\" Each (or { \"StepForwardToEmpty\" (\"StepToEnemy\" (\"Directions\" {NNW NNE} {SSW SSE}))} (then (and (if (is In (last To) (sites Mover \"PromotionZone\")) (moveAgain)) (set Counter))))) (regions \"PromotionZone\" P1 (union (sites Side NW) (sites Side NE))) (regions \"PromotionZone\" P2 (union (sites Side SW) (sites Side SE))) (regions \"Region-Dark\" (sites Phase 2)) (regions \"Region-Light\" (sites Phase 1)) (regions \"Region-Medium\" (sites Phase 0))}) (rules (start { (place \"King1\" coord:\"B2\") (place \"Rook1\" coord:\"B1\") (place \"Bishop1\" coord:\"A1\") (place \"Knight1\" coord:\"A2\") (place \"King2\" coord:\"F6\") (place \"Rook2\" coord:\"F7\") (place \"Bishop2\" coord:\"G7\") (place \"Knight2\" coord:\"G6\") (place \"Pawn1\" {\"A3\" \"B3\" \"C3\" \"C2\" \"C1\"}) (place \"Pawn2\" {\"E7\" \"E6\" \"E5\" \"F5\" \"G5\"})}) phases:{ (phase \"Movement\" (play (if (\"SameTurn\") (\"PromoteTo\" (piece {\"Rook\" \"Bishop\" \"Knight\"})) (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King\" Mover))))) (end { (\"Checkmate\" \"King\") (if (or (no Moves Mover) (= (counter) 100)) (result Mover Draw))}))}))\n\n###\n\n", "completion": "Mini Hexchess is played on a hexagonal board with each side having length 5, and each space oriented horizontally. The board has 37 spaces.\n \n Piece Movement:\n * Kings, Rooks, Bishops, and Knights move as in Glinski Chess.\n - Kings step one space in any of the 12 directions. They do not castle.\n - Rooks slide in any of the 6 adjacent directions.\n - Bishops slide in any of the 6 'diagonal' directions.\n - Knights move two spaces in any adjacent direction, then one space in another direction.\n * There are no Queens in Mini Hexchess.\n * Pawns can advance one space forward without capturing. Pawns can never advance more than one space. Pawns capture 'diagonally forward' (i.e., to a space ahead connected by an edge, and having the same colour). There is no en passant capture. On reaching the farthest rank in a given file, Pawns are promoted to a Rook, Bishop, or Knight. Note that a Pawn cannot be promoted to a Queen, since there are no Queens in Mini Hexchess.\n \n The game ends on a checkmate or stalemate. END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayed on a square grid 11x11 or larger. White goes first and places two pieces every turn, Black places four pieces per turn. White wins if they make an orthogonal line of four pieces; Black wins if they make an orthogonal line of 7 pieces. Played on a size 11 board.\n\n###\n\n", "completion": "(game \"Unfair\" (players 2) (equipment { (board (square 11) use:Vertex) (piece \"Ball\" Each)}) (rules (play (or (move Add (to (sites Empty) if:(= (id P1) (mover))) (then (if (= 0 (count MovesThisTurn)) (moveAgain)))) (move Add (to (sites Empty) if:(= (id P2) (mover))) (then (if (< (count MovesThisTurn) 3) (moveAgain)))))) (end { (if (and ((= (id P1) (mover)) (is Line 4 Orthogonal))) (result Mover Win)) (if (and ((= (id P2) (mover)) (is Line 7 Orthogonal))) (result Mover Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x12 board. Beginning from the leftmost hole closest to a player and proceeding in an anti-clockwise direction, the opening arrangement of counters is an alternating pattern of one empty hole, followed by two holes with three counters each. The first move for each player must be from an occupied hole in the right half of their row. Players sow in an anti-clockwise direction, but if the final counter is about to fall in a hole in the player's own row, it is instead placed in the first hole in the opponent's row. After this, players may sow from any hole in their row, provided that the final counter does not fall into an occupied hole in their row. When the final counter of a sowing lands in an occupied hole in the opponent's row, the counters there are picked up and sowing continues. When this happens, the player is allowed to drop the final counter into an occupied hole in their row, which would then be picked up and sowing would continue as before. When the final counter falls into an empty hole in the player's row, any counters in the opponent's hole opposite are captured. When the final counter falls into an empty hole in the opponent's row, the turn ends. The player who captures all of the opponent's counters wins. Players typically play to achieve five consecutive wins. \n\n###\n\n", "completion": "(define \"NextHoleFrom\" (\"NextSiteOnTrack\" #2 from:#1)) (define \"NoPiece\" (= (count in:(sites Player \"Home\")) 0)) (define \"LastHoleSowed\" (sites {(\"LastHole\")})) (define \"LastHole\" (last To afterConsequence:True)) (define \"Columns\" 12) (game \"Tapata\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" store:None (track \"TrackCCW\" \"0,E,N,W\" loop:True)) (piece \"Seed\" Shared) (regions \"Home\" P1 (sites Bottom)) (regions \"Home\" P2 (sites Top)) (regions \"Right Half\" P1 (intersection (sites Bottom) (expand (sites Right) steps:5))) (regions \"Right Half\" P2 (intersection (sites Top) (expand (sites Left) steps:5))) (map {(pair P1 0) (pair P2 23)})}) (rules (start (set Count 3 to:(sites {1 2 4 5 7 8 10 11 22 21 19 18 16 15 13 12}))) phases:{ (phase \"FirstMove\" (play (move Select (from (difference (sites Mover \"Right Half\") (sites Empty))) (then (sow apply:(if (is In (to) (sites Mover \"Home\")) (fromTo (from (to)) (to (mapEntry Next)))))))) (nextPhase Mover \"Play\")) (phase \"Play\" (play (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(and (> (count at:(from)) 0) (or (\"SameTurn\") (and (\"NewTurn\") (not (and (is In (\"NextHoleFrom\" (from) (count at:(from))) (sites Mover \"Home\")) (!= 0 (count at:(\"NextHoleFrom\" (from) (count at:(from))))))))))) (then (sow apply:(if (< 1 (count at:(to))) (moveAgain) (if (and (!= 0 (count at:(\"OppositePit\" (to)))) (is In (to) (sites Mover \"Home\"))) (remove (\"OppositePit\" (to))))))))))} (end (forEach NonMover if:(\"NoPiece\") (result Player Loss))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayers take turns placing one piece of their colour on empty cells; the piece they place may not be adjacent to the last piece placed by their opponent. A player wins by connecting all three board sides with a connected group of their pieces. Played on a size 11 board. The first player to connect all three sides wins.\n\n###\n\n", "completion": "(game \"Tabu Y\" (players 2) (equipment { (board (hex Triangle 11)) (piece \"Disc\")}) (rules (play (move Add (to (sites Empty) if:(not (is In (to) (sites Around (last To))))))) (end (if (is Connected 3 Sides) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nDEFINITIONS\n Group: like-colored stones adjacent to each other. Singletons are considered groups of size 1.\n Path: an empty point, or an uninterrupted straight line of empty points that have a pair of like-colored stones on both ends, which are not part of the same group. Such a pair is said to have a path.\n Dead group: a group in which all stones belonging to it have no path. If any stone belonging to a group has a path, the group is said to have a path.\n \n GAME PLAY (Overview)\n Decide which player plays as which color (Light or Dark) in any adequate way.\n Light goes first, then alternate turns.\n On each player's first turn, players place a stone of their own color on any empty point.\n On each player's second turn, players place another stone of their color so that their own two stones have a path.\n \n Then players take actions below on each turn, in this order.\n 1. Remove all opponent\u2019s dead groups. This happens automatically in Ludii.\n 2. Place a stone of their own color on an empty point that is on at least one same straight line with an existing friendly stone, and no opponent's stone in between. Passing is not allowed.\n \n After the second turn, the player with no stones of their color on the board at the beginning of their turn loses. A board with side lengths 6 and 7 is currently selected\n\n###\n\n", "completion": "(define \"Remove\" (forEach Group (if (all Sites (sites) if:(= 0 (count Sites in:(difference (intersection (sites Occupied by:Mover) (sites Direction from:(site) stop:(is Occupied (to)) stopIncluded:True)) (sites))))) (remove (sites))))) (define \"Move\" (move Add (to (forEach (sites Empty) if:(> (count Pieces Mover in:(sites LineOfSight at:(site))) 0))) #1)) (game \"Meridians\" (players 2) (equipment { (board (dual (hex Prism 7 6)) use:Vertex) (piece \"Disc\" Each)}) (rules phases:{ (phase \"Opening\" (play (move Add (to (if (< 0 (count Sites in:(sites Occupied by:Mover))) (forEach (sites Empty) if:(and (> (count Pieces Mover in:(sites LineOfSight at:(site))) 0) (= (count Sites in:(sites Around (site) Own)) 0))) (sites Empty))))) (nextPhase (= 4 (count Moves)) \"Play\")) (phase \"Play\" (play (if (can Move (\"Move\" ~)) (\"Move\" (then (\"Remove\"))) (move Pass (then (\"Remove\"))))))} (end (if (and (< 4 (count Moves)) (or (= 0 (count Sites in:(sites Occupied by:P1))) (= 0 (count Sites in:(sites Occupied by:P2))))) (result Mover Loss))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nEach turn the current player must move, capture and drop.\n \n The current player must move one of their pieces in a straight line in any of the six hexagonal directions to land on a vacant foreign cell; any intervening cells must also be empty. The opponent who owns the landing cell becomes the candidate and the other opponent becomes the bunny.\n All opponents' pieces immediately adjacent to the landing cell are captured and removed from the board. The current player must make the move that captures the most pieces each turn, but may choose amongst equals. This is called the max capture rule.\n The moving player must then drop a bunny piece on any empty cell, unless a player has just been eliminated.\n The candidate becomes the next player to move.\n \n Goal: Play stops the moment any player is eliminated. The game is won by the player with the most pieces left, else is a tie between the two remaining players if they are both left with the same number of pieces. \n\n###\n\n", "completion": "(define \"Bunny\" (if (= (mover) 1) (if (= (\"Candidate\") 2) 3 2) (if (= (mover) 2) (if (= (\"Candidate\") 1) 3 1) (if (= (\"Candidate\") 1) 2 1)))) (define \"Candidate\" (var)) (define \"GetCandidate\" (set Var (mapEntry \"PlayerPhase\" (phase of:(last To))))) (game \"Triad\" (players 3) (equipment { (board (hex 5)) (piece \"Marker\" Each (move Slide Orthogonal (to (apply if:(!= (mover) (mapEntry \"PlayerPhase\" (phase of:(to)))))) (then (and { (forEach Site (sites Around (last To) Orthogonal) (if (is Enemy (what at:(site))) (remove (site)))) \"GetCandidate\" (moveAgain)})))) (map \"PlayerPhase\" {(pair 1 1) (pair 0 2) (pair 2 3)})}) (rules (start { (place \"Marker1\" (expand origin:(coord \"A5\") steps:2)) (place \"Marker2\" (expand origin:(coord \"I9\") steps:2)) (place \"Marker3\" (expand origin:(coord \"E1\") steps:2))}) (play (if \"SameTurn\" (move Add (piece (\"Bunny\")) (to (sites Empty)) (then (set NextPlayer (player \"Candidate\")))) (max Captures (forEach Piece)))) (end (if (or { (no Pieces P1) (no Pieces P2) (no Pieces P3)}) (byScore { (score P1 (count Pieces P1)) (score P2 (count Pieces P2)) (score P3 (count Pieces P3))}))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nMen can move one step forwards orthogonally or diagonally, or can jump an opponent's adjacent piece to capture it, in any direction. When a man ends its turn on the opposite edge of the board from its starting position, it becomes a king and may move or jump over any number of spaces in any direction. Captures are compulsory and the maximum number of jumps must be made. The first player unable to move, loses. The game is played on a 8x8 board\n\n###\n\n", "completion": "(define \"IsUnpromoted\" (\"IsPieceAt\" \"Counter\" Mover (last To))) (define \"HopCounter\" (move Hop (from #1) All (between if:(and (not (is In (between) (sites ToClear))) (\"IsEnemyAt\" (between))) (apply (remove (between) at:EndOfTurn))) (to if:(is Empty (to))) #2)) (game \"Omnidirectional Draughts\" (players 2) (\"DraughtsEquipment\" (square 8)) (rules (start { (place \"Counter1\" (expand (sites Bottom) steps: (- (/ 8 2) 2))) (place \"Counter2\" (expand (sites Top) steps: (- (/ 8 2) 2)))}) (play (if \"SameTurn\" (if \"IsUnpromoted\" (max Moves (\"HopCounter\" (last To) (then (\"ReplayIfCanMove\" (\"HopCounter\" (last To)) (\"PromoteIfReach\" (sites Next) \"DoubleCounter\"))))) (max Moves (\"HopSequenceCaptureAgain\" before:(count Rows) after:(count Rows) at:EndOfTurn))) (priority { (max Moves (or (forEach Piece \"Counter\" (\"HopCounter\" (from) (then (\"ReplayIfCanMove\" (\"HopCounter\" (last To)) (\"PromoteIfReach\" (sites Next) \"DoubleCounter\"))))) (forEach Piece \"DoubleCounter\" (\"HopSequenceCapture\" before:(count Rows) after:(count Rows) at:EndOfTurn)))) (or (forEach Piece \"Counter\" (\"StepToEmpty\" (directions Forwards)) (then (\"PromoteIfReach\" (sites Next) \"DoubleCounter\"))) (forEach Piece \"DoubleCounter\" (move Slide)))}))) (end (\"BlockWin\")))) END" }, { "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": "Describe the mechanics of the following Ludii game\n(define \"CanMoveAnotherStone\" (can Move (do (set Var #2) next:(forEach Site (difference (sites Occupied by:Mover) #1) (step (from (site)) (directions Cell from:#1 to:(var)) (to if:(and (is Empty (to)) (not (is In (to) (sites \"RedDots\")))))))))) (game \"Tandems\" (players 2) (equipment { (board (square 5)) (piece \"Pawn\" Each (move Step (to if:(and { (is Empty (to)) (not (is In (to) (sites \"RedDots\"))) (\"CanMoveAnotherStone\" (from) (to))})) (then (moveAgain)))) (regions \"RedDots\" (sites {\"B2\" \"B4\" \"D2\" \"D4\"}))}) (rules (start { (place \"Pawn1\" (sites Bottom)) (place \"Pawn2\" (sites Top))}) (play (if (\"SameTurn\") (forEach Site (difference (sites Occupied by:Mover) (last To)) (move Step (from (site)) (\"LastDirection\" Cell) (to if:(and (is Empty (to)) (not (is In (to) (sites \"RedDots\"))))))) (forEach Piece))) (end { (if (and (is Mover P1) (all Sites (sites Occupied by:P1) if:(is In (site) (sites Top)))) (result P1 Win)) (if (and (is Mover P2) (all Sites (sites Occupied by:P2) if:(is In (site) (sites Bottom)))) (result P2 Win))})))\n\n###\n\n", "completion": "On each turn, each player must move two friendly stones to adjacent (diagonal or orthogonal) empty cells, both in the same direction. Stones cannot move into the restricted points on the game board.\n \n The player that first moves 5 stones to the last row wins the game. END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game is played on a 5x5 board -> The game is played on a 7x7 board\n(game \"Gale\" (players 2) (equipment { (board (square 5)) (piece \"Square\" Each) (regions P1 {(sites Top) (sites Bottom)}) (regions P2 {(sites Left) (sites Right)})}) (rules (start { (place \"Square1\" (forEach (sites Board) if:(and (is Even (column of:(site))) (is Odd (row of:(site)))))) (place \"Square2\" (forEach (sites Board) if:(and (is Even (row of:(site))) (is Odd (column of:(site))))))}) (play (move Add (to (sites Empty)))) (end (if (is Connected Mover) (result Mover Win)))))\n\n###\n\n", "completion": "(game \"Gale\" (players 2) (equipment { (board (square 7)) (piece \"Square\" Each) (regions P1 {(sites Top) (sites Bottom)}) (regions P2 {(sites Left) (sites Right)})}) (rules (start { (place \"Square1\" (forEach (sites Board) if:(and (is Even (column of:(site))) (is Odd (row of:(site)))))) (place \"Square2\" (forEach (sites Board) if:(and (is Even (row of:(site))) (is Odd (column of:(site))))))}) (play (move Add (to (sites Empty)))) (end (if (is Connected Mover) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayed on an 8x8 board with each player having twelve pieces. Pieces move diagonally one space forward, and can capture opponent's pieces by jumping them if they are adjacent. Capturing must happen if it is possible, multiple captures are allowed, and can happen in a forward or backward direction. Once pieces reach the opposite side of the board from their starting position, they become kings and can move diagonally either forwards or backwards. A piece may become a king in the midst of a sequence of captures, and then capture as a king in the same turn. Kings may capture over any distance, leaping over all opponent's pieces in a line. The goal is to capture all of the opponent's pieces.\n \n\n###\n\n", "completion": "(define \"JumpToPromotionZone\" (is In (last To) (sites Next))) (define \"IsUnpromoted\" (\"IsPieceAt\" \"Counter\" Mover (last To))) (define \"HopCounter\" (move Hop (from #1) Diagonal (between if:(and (not (is In (between) (sites ToClear))) (\"IsEnemyAt\" (between))) (apply (remove (between)))) (to if:(is Empty (to))) #2)) (game \"Shashki\" (\"TwoPlayersNorthSouth\") (\"DraughtsEquipment\" (square 8)) (rules (\"BlackCellsSetup\" 3) (play (if \"SameTurn\" (if \"IsUnpromoted\" (\"HopCounter\" (last To) (then (if \"JumpToPromotionZone\" (and (promote (last To) (piece \"DoubleCounter\") Mover) (\"ReplayIfCanMove\" (\"HopDiagonalSequenceCaptureAgain\" before:(count Rows) after:(count Rows)))) (\"ReplayIfCanMove\" (\"HopCounter\" (last To)))))) (\"HopDiagonalSequenceCaptureAgain\" before:(count Rows) after:(count Rows))) (priority { (or (forEach Piece \"Counter\" (\"HopCounter\" (from) (then (if \"JumpToPromotionZone\" (and (promote (last To) (piece \"DoubleCounter\") Mover) (\"ReplayIfCanMove\" (\"HopDiagonalSequenceCaptureAgain\" before:(count Rows) after:(count Rows)))) (\"ReplayIfCanMove\" (\"HopCounter\" (last To))))))) (forEach Piece \"DoubleCounter\" (\"HopDiagonalSequenceCapture\" before:(count Rows) after:(count Rows)))) (or (forEach Piece \"Counter\" (\"StepToEmpty\" (directions {FR FL})) (then (\"PromoteIfReach\" (sites Next) \"DoubleCounter\"))) (forEach Piece \"DoubleCounter\" (move Slide Diagonal)))}))) (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"Lam Turki\" (players 1) (equipment { (\"StarBoard\" 5) (hand Each) (piece \"Marker\" P1 (\"HopFriendCapture\"))}) (rules (start { (place \"Marker\" (handSite P1) count:9)}) phases:{ (phase \"Placement\" (play (if (is Even (count Moves)) (move (from (handSite Mover)) (to (sites Empty)) (then (moveAgain))) (forEach Piece (if (= (from) (last To)) (move Hop (between if:(or (\"IsFriendAt\" (between)) (is Empty (between)))) (to if:(is Empty (to)))))))) (end (if (no Moves Next) (result Mover Loss))) (nextPhase Mover (and (is Even (count Moves)) (\"HandEmpty\" Mover)) \"Movement\")) (\"PhaseMovePiece\" \"Movement\" (end { (if (= (count Pieces) 1) (result Mover Win)) (if (no Moves Next) (result Mover Loss))}))}))\n\n###\n\n", "completion": "The board is a five-pointed star. The player has nine pieces. In the first phase, the player attempts to place all the pieces on the board. The player choses a point, then moves the piece two spaces in a straight line. The piece may move through a spot occupied by another piece, but must land on an empty space. Once all of the pieces are placed in this way, the player captures a piece on the board by hopping over with with another one of the pieces to an empty space on the opposite side of the piece to be captured. The goal is to capture all of the pieces except one. END" }, { "prompt": "Construct a Ludii game based on the following description\nGame is played on an Alquerque board with 5x5 intersecting lines and with a triangular appendage on either side. Each player has sixteen pieces, which are placed on the intersections and move along the lines to the next open intersection. Players can hop opponents pieces to capture them. Multiple captures in one turn are allowed. A player wins when they capture all of the opponent's pieces or block them from being able to move. The game is played with sixteen pieces.\n\n###\n\n", "completion": "(game \"Mogul Putt'han\" (players 2) (equipment { (\"AlquerqueBoardWithBottomAndTopTriangles\") (piece \"Marker\" Each (or (\"HopSequenceCapture\") (\"StepToEmpty\")))}) (rules (start { (place \"Marker1\" (union {(sites Row 0) (sites Row 1) (sites Row 2) (sites Row 3)})) (place \"Marker2\" (union {(sites Row 5) (sites Row 6) (sites Row 7) (sites Row 8)}))}) (play (if \"SameTurn\" (or (\"HopSequenceCaptureAgain\") (move Pass)) (forEach Piece))) (end (\"NoMoves\" Loss)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThree concentric pentagons, with lines connecting the corners and the midpoints of each side. Fourteen pieces per player. Players alternate turns placing one of their pieces on an empty spot on the board. When all of the pieces are placed, they alternate turns moving one of their pieces to an empty adjacent spot along the lines of the board. During either phase, when a player places three of their pieces in a row, they may remove one of the opponent's pieces from the board. Pieces which are in a three-in-a-row arrangement cannot be removed from the board. The player who captures all of the opponent's pieces wins.\n \n\n###\n\n", "completion": "(game \"Tavan Tal\" (players 2) (equipment { (board (add (merge { (shift 2 2 (merge { (rectangle 1 3) (shift -1.31 0.95 (rotate 108 (rectangle 1 3))) (shift -0.81 2.49 (rotate 216 (rectangle 1 3))) (shift 1.31 0.95 (rotate -108 (rectangle 1 3))) (shift 0.81 2.49 (rotate -216 (rectangle 1 3)))})) (shift 1 1 (scale 2 (merge { (rectangle 1 3) (shift -1.31 0.95 (rotate 108 (rectangle 1 3))) (shift -0.81 2.49 (rotate 216 (rectangle 1 3))) (shift 1.31 0.95 (rotate -108 (rectangle 1 3))) (shift 0.81 2.49 (rotate -216 (rectangle 1 3)))}))) (scale 3 (merge { (rectangle 1 3) (shift -1.31 0.95 (rotate 108 (rectangle 1 3))) (shift -0.81 2.49 (rotate 216 (rectangle 1 3))) (shift 1.31 0.95 (rotate -108 (rectangle 1 3))) (shift 0.81 2.49 (rotate -216 (rectangle 1 3)))}))}) edges:{ {26 16} {16 6} {5 15} {15 25} {29 19} {19 9} {7 17} {17 27} {28 18} {18 8} {22 12} {12 2} {1 11} {11 21} {20 10} {10 0} {3 13} {13 23} {24 14} {14 4}}) use:Vertex) (hand Each) (piece \"Marker\" Each (\"StepToEmpty\" ~ (then (\"ReplayIfLine3\"))))}) (rules (start (place \"Marker\" \"Hand\" count:14)) phases:{ (phase \"Placement\" (play (if \"SameTurn\" (\"RemoveAnyEnemyPieceNotInLine3\" Orthogonal) (move (from (handSite Mover)) (to (sites Empty)) (then (\"ReplayIfLine3\"))))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (phase \"Movement\" (play (if \"SameTurn\" (\"RemoveAnyEnemyPieceNotInLine3\" Orthogonal) (forEach Piece))))} (end (\"CaptureAll\" Next)))) END" }, { "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 Ludii game based on the following description\nPlayers take turns marking any unmarked cell with no marked neighbour. Player who can\u2019t move loses. \n\n###\n\n", "completion": "(define \"NoNeighbour\" (\"NoSites\" (sites Around (to) Orthogonal if:(is In (to) (sites Occupied by:Neutral))))) (game \"Spots\" (players 2) (equipment { (board (hex 5)) (piece \"Marker\" Neutral)}) (rules (play (move Add (piece \"Marker0\") (to (sites Empty) if:\"NoNeighbour\"))) (end (\"NoMoves\" Loss)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nAt the beginning of the game, the first player places 4 pieces of any colour in the bottom row. These pieces will be hidden to the second player during all the game.\n \n The objective of the second player (called codebreaker) is to try to guess the pattern, in both order and color, within a specific number of tries (corresponding to the number of rows). Each guess is made by placing a row of code pegs on the board.\n Once placed, a feedback on his last try is provided by placing from zero to four key pegs in the small holes of the row with the guess. A black key peg is placed for each code peg from the guess which is correct in both color and position. A white key peg indicates the existence of a correct color code peg placed in the wrong position. The game is played on a 12x12 board.\n\n###\n\n", "completion": "(define \"AddWhiteHint\" (\"AddHint\" \"Disc1\")) (define \"AddBlackHint\" (\"AddHint\" \"Disc2\")) (define \"AddHint\" (add (piece #1) (to (regionSite (\"HintPositions\") index:(value))))) (define \"CombinationFound\" (and (= 0 (count Sites in:(intersection (sites Empty) (sites Row (\"RowToCheck\"))))) (= \"NumColumn\" (count Sites in:(forEach (sites Row (\"RowToCheck\")) if:(\"PositionAndColorOK\")))))) (define \"PositionAndColorOK\" (= (what at:(site)) (what at:(coord row:0 column:(column of:(site)))))) (define \"CombinationToFindPlaced\" (= 0 (count Sites in:(intersection (sites Empty) (sites Bottom))))) (define \"CombinationPlaced\" (= 0 (count Sites in:(intersection (sites Empty) (sites Row (\"RowToPlace\")))))) (define \"ColorInSolution\" (is In (what at:(regionSite (sites Bottom) index:(value))) (results from:(sites Row (\"RowToPlace\")) to:0 (what at:(from))))) (define \"RightPositionAndColor\" (= (what at:(regionSite (sites Row (\"RowToPlace\")) index:(value))) (what at:(coord row:0 column:(value))))) (define \"HintPositions\" (union (sites Row (+ \"RowToPlace\" 1)) (sites Row (- \"RowToPlace\" 1)))) (define \"RowToCheck\" (- \"TopRow\" (* 3 (- (\"NumTry\") 1)))) (define \"RowToPlace\" (- \"TopRow\" (* 3 (\"NumTry\")))) (define \"NumTry\" (var)) (define \"TopRow\" (+ 2 (* 3 (- \"NumRow\" 1)))) (define \"NumColumn\" 4) (define \"NumRow\" 12) (game \"Mastermind\" (players 2) (equipment { (board (merge { (rectangle (+ 1 \"NumRow\") \"NumColumn\") (shift \"NumColumn\" 0.75 (repeat \"NumRow\" 1 step:{{1 0} {0 1}} (poly {{0 0} {0 0.5} {0.5 0.5} {0.5 0}})))}) use:Vertex) (piece \"Marker1\" Shared) (piece \"Marker2\" Shared) (piece \"Marker3\" Shared) (piece \"Marker4\" Shared) (piece \"Marker5\" Shared) (piece \"Marker6\" Shared) (piece \"Marker7\" Shared) (piece \"Marker8\" Shared) (piece \"Disc1\" Shared) (piece \"Disc2\" Shared) (hand Shared size:8)}) (rules (start { (place \"Marker1\" (handSite Shared)) (place \"Marker2\" (handSite Shared 1)) (place \"Marker3\" (handSite Shared 2)) (place \"Marker4\" (handSite Shared 3)) (place \"Marker5\" (handSite Shared 4)) (place \"Marker6\" (handSite Shared 5)) (place \"Marker7\" (handSite Shared 6)) (place \"Marker8\" (handSite Shared 7))}) phases:{ (phase \"Placement\" P1 (play (move (from (sites Hand Shared)) (to (intersection (sites Empty) (sites Bottom))) copy:True (then (and { (set Hidden at:(last To) to:P2) (if (\"CombinationToFindPlaced\") (set Var 0) (moveAgain))}))))) (phase \"Finding\" P2 (play (move (from (sites Hand Shared)) (to (intersection (sites Empty) (sites Row (\"RowToPlace\")))) copy:True (then (and (moveAgain) (if (\"CombinationPlaced\") (and (forEach Value min:0 max:(- \"NumColumn\" 1) (if (\"RightPositionAndColor\") (\"AddBlackHint\") (if (\"ColorInSolution\") (\"AddWhiteHint\")))) (set Var (+ 1 (\"NumTry\"))) (then (if (or (\"CombinationFound\") (>= \"NumTry\" \"NumRow\")) (forEach Site (sites Bottom) (set Hidden at:(site) False to:P2)))))))))) (end { (if (\"CombinationFound\") (result P2 Win)) (if (>= \"NumTry\" \"NumRow\") (result P1 Win))}))})) END" }, { "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" }, { "prompt": "Construct a Ludii game based on the following description\n3x3 intersecting lines, with diagonals in the square. Three pieces per player, which begin on opposite sides of the square. Players alternate turns moving one of their pieces along the lines of the board. When a player surrounds one of the opponent's pieces with two of their pieces, the opponent's piece is captured. The player who captures all of the opponent's pieces wins. \n\n###\n\n", "completion": "(game \"El-Mthaltha\" (players 2) (equipment { (\"AlquerqueBoard\" 3 3) (piece \"Marker\" Each (\"StepToEmpty\" ~ (then (\"CustodialCapture\" Orthogonal (max 1)))))}) (rules (start { (place \"Marker1\" (sites Bottom)) (place \"Marker2\" (sites Top))}) (play (forEach Piece)) (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe board consists of four rows of any number of holes. Two to twelve players, who play on two equal teams. The number of pieces per team is equal to the number of holes in one row. One team plays as pieces of camel dung, the other as sticks. The pieces begin, one in each hole, in the outer rows of the board. Eight sticks, used as dice, with a marked side and a blank side. The values of the throws are equal to the number of marked sides which land face up. A throw of 4 grants the player another throw. Pieces can only be moved for the first time with a throw of 1 or 8. One piece may move one space on a throw of 1, or eight pieces may each move one space on a throw of 8. Once a piece has made its initial move, it may move according to the throws of the sticks. The bottom team's pieces move from right to left in the home row, left to right in the next row, right to left in the third row, and then into the opponent's home row. The top team moves left to right (from their perspective) in their home row, right to left in the next row, left to right in the next row, and into the bottom player's home row. When a team's piece lands on a space in the central two rows occupied by an opponent's piece, the opponent's piece is captured. Pieces cannot be captured in the home rows. When a piece moves into the opponent's home row, they move back into the central two rows, moving in the opposite direction as before. After moving into the home row a piece can no longer be captured, even when it is in the central two rows. Play continues until both team's pieces have moved out of their home row and can no longer be captured. Players then alternate turns throwing the sticks, removing one of the opponent's pieces every time a 4 is thrown. A team wins when only their pieces are left on the board. The game involves 4 players. Each row has 20 Holes.\n\n###\n\n", "completion": "(define \"Move\" (if (\"NeverGoInEnemyHome\" (from)) (or (if (<= (var) 0) (move (from (from) if:(if (\"ActivatedPiece\" (from)) True (\"ActivatedThrow\"))) (to (\"NextSiteOnTrack\" (\"ThrowValue\") \"Track\") if:(if (is In (to) (\"MiddleSites\")) (or (is Empty (to)) (and (\"IsEnemyAt\" (to)) (\"PieceCanBeCapture\"))) (is Empty (to))) (apply (\"CaptureMove\"))) (then (if (not (\"ActivatedPiece\" (last To))) (\"ActivePiece\" (last To)))))) (if (or (= (\"ThrowValue\") 8) (> (var) 0)) (move (from (from)) (to (\"NextSiteOnTrack\" 1 \"Track\") if:(if (is In (to) (\"MiddleSites\")) (or (is Empty (to)) (and (\"IsEnemyAt\" (to)) (\"PieceCanBeCapture\"))) (is Empty (to))) (apply (\"CaptureMove\"))) (then (and (if (not (\"ActivatedPiece\" (last To))) (\"ActivePiece\" (last To))) (if (> (var) 0) (and (if (> (var) 1) (moveAgain)) (set Var (- (var) 1))) (and (set Var (- (\"ThrowValue\") 1)) (moveAgain))))))) (then (if (is In (last To) (if (is In (mover) (players Team1)) (sites Top) (sites Bottom))) (set State at:(last To) 2)))) (if (\"MoveBackOnMiddleSites\" (from)) (move (from (from)) (to (\"NextSiteOnTrack\" (\"ThrowValue\") \"GoBackTrack\") if:(if (is In (to) (\"MiddleSites\")) (not (\"IsFriendAt\" (to))) (is Empty (to))) (apply (\"CaptureMove\"))) (then (if (is In (last To) (\"MiddleSites\")) (set State at:(last To) 3)))) (if (\"MoveOnLoop\" (from)) (move (from (from)) (to (\"NextSiteOnTrack\" (\"ThrowValue\") \"LoopTrack\") if:(if (is In (to) (\"MiddleSites\")) (not (\"IsFriendAt\" (to))) (is Empty (to))) (apply (\"CaptureMove\")))))))) (define \"AllPiecesOutOfHomeAndCanNotBeCaptured\" (and (= 0 (count Sites in:(difference (sites Occupied by:All) (\"MiddleSites\")))) (= 0 (count Sites in:(forEach (sites Occupied by:All) if:(< (state at:(site)) 2)))))) (define \"PieceCanBeCapture\" (< (state at:(to)) 2)) (define \"MoveBackOnMiddleSites\" (= (state at:#1) 2)) (define \"MoveOnLoop\" (= (state at:#1) 3)) (define \"NeverGoInEnemyHome\" (< (state at:#1) 2)) (define \"CaptureMove\" (if (\"IsEnemyAt\" (to)) (remove (to)))) (define \"MiddleSites\" (difference (sites Board) (union (sites Top) (sites Bottom)))) (define \"ActivePiece\" (set State at:#1 1)) (define \"ActivatedPiece\" (< 0 (state at:#1))) (define \"ActivatedThrow\" (is In (\"ThrowValue\") (sites {1 8}))) (define \"IsSpecialThrow\" (= (\"ThrowValue\") 4)) (define \"ThrowValue\" (count Pips)) (game \"Sig (Mauritania)\" (players 4) (equipment { (board (rectangle 4 20) { (track \"Track1\" \"19,W,N1,E,N1,W,N1,E\" P1 directed:True) (track \"Track2\" \"79,W,S1,E,S1,W,S1,E\" P2 directed:True) (track \"LoopTrack1\" \"40,E,S1,W\" loop:True P1) (track \"LoopTrack2\" \"20,E,N1,W\" loop:True P2) (track \"GoBackTrack1\" \"79,W,S1,E,S1,W\" P1 directed:True) (track \"GoBackTrack2\" \"19,W,N1,E,N1,W\" P2 directed:True)} use:Vertex) (\"StickDice\" 8) (piece \"Marker\" P1 (\"Move\")) (piece \"Stick\" P2 (\"Move\"))}) (rules (start { (place \"Marker1\" (sites Bottom)) (place \"Stick2\" (sites Top)) (set Team 1 {P1 P3}) (set Team 2 {P2 P4})}) phases:{ (phase \"MovingPhase\" (play (do (if (<= (var) 0) (roll)) next:(if (is In (mover) (players Team1)) (forEach Piece P1) (forEach Piece P2)) (then (if (\"IsSpecialThrow\") (moveAgain))))) (nextPhase (\"AllPiecesOutOfHomeAndCanNotBeCaptured\") \"RemovingPhase\")) (phase \"RemovingPhase\" (play (\"RollMove\" (if (= (\"ThrowValue\") 4) (move Remove (sites Occupied by:Enemy))))))} (end (\"CaptureAllTeam\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x12 board, divided in half. Spaces on each side take the form of semi-circular sockets, into which the pieces fit. Fifteen pieces per player. Two or three dice. Players move according to the number on each die by moving one piece the value on one die then another piece the value on the other die, or by moving one piece the value of one die and then the value of the other. Both players enter their pieces into the same quadrant of the board, and move pieces along a horseshoe-shaped track around the board toward the quadrant on the opposite side of the board. When a piece lands on a space occupied by a single piece of the opponent, the opponent's piece is removed from the board and must enter again as before. When all of the dice present the same number, the player receives another turn. The player to bear off all of their pieces first wins.\n The game involves 3 dice\n\n###\n\n", "completion": "(define \"RemoveAPiece\" (move Remove (from))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" (pips))) (game \"Pareia de Entrada\" (players 2) (equipment { (\"TableBoard\" \"TableTracksSameDirectionWithHands\") (dice d:6 num:3) (hand Each) (piece \"Disc\" Each (forEach Die if:(\"DieNotUsed\") (if (\"IsOffBoard\" \"SiteToMoveOnTrack\") \"RemoveAPiece\" (if (\"NoEnemyOrOnlyOne\" \"SiteToMoveOnTrack\") (move (from) (to \"SiteToMoveOnTrack\" (\"HittingCapture\" (handSite Next))))))))}) (rules (start { (place Stack \"Disc1\" (handSite P1) count:15) (place Stack \"Disc2\" (handSite P2) count:15)}) (play (do (if (or (is Pending) (\"NewTurn\")) (roll)) next:(or (forEach Piece top:True) (forEach Piece container:(mover) top:True) (then (and (\"ReplayNotAllDiceUsed\") (if (and (all DiceUsed) (all DiceEqual)) (and (set Pending) (moveAgain)))))))) (end (\"EscapeWin\")))) END" }, { "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 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": "Describe the mechanics of the following Ludii game\n(define \"CountAndMarkOddGroupsMover\" (and (set Score Mover 0) (forEach Group Orthogonal if:(is Mover (who at:(to))) (if (is Odd (count Sites in:(sites))) (and (addScore Mover -1) (forEach Site (sites) (set State at:(site) 1))) (forEach Site (sites) (set State at:(site) 0)))))) (game \"Mono\" (players 2) (equipment { (board (hex 5)) (piece \"Disc\" Each)}) (rules (meta (swap)) (play (move Add (to (sites Empty)) (then (\"CountAndMarkOddGroupsMover\")))) (end (if (is Full) { (if (= (count Groups if:(= (id P1) (who at:(to)))) (count Groups if:(= (id P2) (who at:(to))))) (byScore)) (if True (byScore { (score P1 (- (count Groups if:(= (id P1) (who at:(to)))))) (score P2 (- (count Groups if:(= (id P2) (who at:(to))))))}))}))))\n\n###\n\n", "completion": "Players 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 If both players have the same number of groups, your score is your number of odd-sized groups, otherwise it is simply your number of groups.\n \n The running score only shows the number of odd groups (with a minus sign in front of it, for technical reasons).\n \n Groups of odd size is marked with a red outline. A size 5 board is currently selected END" }, { "prompt": "Construct a Ludii game based on the following description\n6x6 board. Two or four players. Three pieces per player, which begin in opposite corners of the board. Players alternate turns moving one piece to an empty adjacent space, orthogonally or diagonally, but not backwards. The first player to place their pieces in the squares in the opposite corner where the opponent's pieces started wins. The board is a square 6x6 The game involves two players.\n\n###\n\n", "completion": "(define \"SizeStart\" 1) (game \"Bajr\" (players {(player NE) (player SW)}) (equipment { (board (square 6)) (piece \"Counter\" Each (\"StepToEmpty\" (directions {Forwards Leftward Rightward}))) (regions \"Home\" P1 (expand (intersection (sites Bottom) (sites Left)) steps:\"SizeStart\" Orthogonal)) (regions \"Home\" P2 (expand (intersection (sites Top) (sites Right)) steps:\"SizeStart\" Orthogonal)) (map {(pair P1 P2) (pair P2 P1)})}) (rules (start { (place \"Counter1\" (sites P1)) (place \"Counter2\" (sites P2))}) (play (forEach Piece)) (end (\"FillWin\" (sites (player (mapEntry (mover)))))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe pieces start with each color on opposite ends of the board, with two empty holes in between. The goal is to move the pieces so that they end up on opposite sides of the board from their starting position. Pieces can only be moved forward. \n\n###\n\n", "completion": "(define \"MoveOfThePiece\" (or (move Hop (from) Forward (between if:(\"IsFriendAt\" (between))) (to if:(is Empty (to)))) (\"StepForwardToEmpty\"))) (game \"Insanity\" (players 1) (equipment { (board (rectangle 1 10)) (piece \"Marker1\" P1 E \"MoveOfThePiece\") (piece \"Marker2\" P1 W \"MoveOfThePiece\")}) (rules (start { (place \"Marker1\" (expand (sites Left) steps:3)) (place \"Marker2\" (expand (sites Right) steps:3))}) (play (forEach Piece)) (end (if (is Target {2 2 2 2 0 0 1 1 1 1}) (result P1 Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n4x6-21 board; 8 is most common, 12, 15, and 18 are also popular. Each player's rightmost hole is the musoro. Two counters in each hole in the players' outer rows, except each musoro which has three. Sowing occurs in an anti-clockwise direction. When the final counter lands in an occupied hole, these are picked up and sowing continues. If this final hole is one of the musoro, the player may choose to end their turn instead of continuing to sow. When the final counter lands in an empty hole in the inner row, any counters in the opposite hole in the opponent's inner row are captured. If there also are counters in the opposite hole in the opponent's outer row, these are also captured, but only if there was first a capture from the inner row hole. Players cannot sow from a hole with a single counter unless there are no holes with multiple counters. Single counters can only be sown into an empty hole. Play continues until one player has captured all of the opponent's counters, thus winning the game.\n 8 Holes per row.\n\n###\n\n", "completion": "(define \"NextHoleFrom\" (\"NextSiteOnTrack\" 1 from:#1 #2)) (define \"AHoleHasMoreThanOneCounter\" (not (all Sites (forEach (sites Mover) if:(< 1 (count at:(site)))) if:(= 0 (count at:(site)))))) (define \"LastHoleSowed\" (sites {(var)})) (define \"NoPiece\" (all Sites (sites Player \"Home\") if:(= 0 (count at:(site))))) (define \"Columns\" 8) (game \"Musoro Tsoro\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"0,E,N1,W\" loop:True P1) (track \"Track2\" \"16,E,N1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"Track1\")) (regions \"Home\" P2 (sites Track \"Track2\")) (regions \"Inner\" P1 (difference (sites Track \"Track1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"Track2\") (sites Top))) (regions \"Outer\" P1 (sites Bottom)) (regions \"Outer\" P2 (sites Top)) (piece \"Seed\" Shared)}) (rules (start { (place \"Seed\" (intersection (sites Top) (sites Left)) counts:{3} state:2) (place \"Seed\" (intersection (sites Bottom) (sites Right)) counts:{3} state:1) (set Count 2 to:(union (difference (sites Top) (sites Left)) (difference (sites Bottom) (sites Right))))}) (play (or (if (and (!= 0 (state at:(var))) (\"SameTurn\")) (move Pass)) (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(if \"AHoleHasMoreThanOneCounter\" (> (count at:(from)) 1) (and (= (count at:(from)) 1) (= 0 (count at:(\"NextHoleFrom\" (from) Mover)))))) (then (and (sow \"Track\" owner:(mover) apply:(if (= (count at:(to)) 1) (if (is In (to) (sites Mover \"Inner\")) (if (> (count at:(\"OppositePit\" (to))) 0) (and (remove (\"OppositePit\" (to))) (if (> (count at:(\"OppositeOuterPit\" (to))) 0) (remove (\"OppositeOuterPit\" (to))))))) (and (moveAgain) (set Var (to))))) (forEach Site (sites Board) (if (!= 0 (state at:(site))) (set State at:(site) (state at:(site)))))))))) (end (forEach NonMover if:(\"NoPiece\") (result Player Loss))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nIn this Shogi Puzzle, you have to checkmate the black Osho, using the regular rules of Shogi, with the smallest number of moves possible. \n\n###\n\n", "completion": "(define \"PlaceAPawn\" (do (move (from (sites Occupied by:Mover container:\"Hand\" component:\"Fuhyo\")) (to (difference (sites Empty) (sites Mover \"LastRank\")) if:\"OnePawnPerColumn\")) ifAfterwards:(not (\"KingCheck\" Next)))) (define \"PlaceALance\" (move (from (sites Occupied by:Mover container:\"Hand\" component:\"Kyosha\")) (to (difference (sites Empty) (sites Mover \"LastRank\"))))) (define \"PlaceAKnight\" (move (from (sites Occupied by:Mover container:\"Hand\" component:\"Keima\")) (to (difference (sites Empty) (sites Mover \"TwoFurthestRank\"))))) (define \"OnePawnPerColumn\" (= (count Sites in:(sites Occupied by:Mover container:\"Board\" component:\"Fuhyo\")) (count Sites in:(difference (sites Occupied by:Mover container:\"Board\" component:\"Fuhyo\") (sites Column (column of:(to))))))) (define \"NextCanNotMove\" (not (can Move (do (forEach Piece Next) ifAfterwards:(not (\"KingCheck\" Next)))))) (define \"KingCheck\" (is Threatened (id \"Osho\" #1) at:(where \"Osho\" #1))) (define \"StepMove\" (move Step #1 (to if:(not (\"IsFriendAt\" (to))) \"CapturePiece\") #2)) (define \"SlideMove\" (move Slide #1 (to if:(\"IsEnemyAt\" (to)) \"CapturePiece\") #2)) (define \"CanPromote\" (then (if (or (\"InPromotionZone\" (last To)) (\"InPromotionZone\" (last From))) (moveAgain)))) (define \"Promote\" (move Promote (last To) (piece (mapEntry \"promoted\" (what at:(last To)))))) (define \"InTwoFurthestRank\" (is In #1 (sites Mover \"TwoFurthestRank\"))) (define \"InLastRank\" (is In #1 (sites Mover \"LastRank\"))) (define \"InPromotionZone\" (is In #1 (sites Mover \"Promotion\"))) (define \"CapturePiece\" (apply (add (piece (mapEntry \"captured\" (what at:(to)))) (to (mapEntry \"where\" (what at:(to))))))) (define \"CapturePiece\" (apply (add (piece (mapEntry \"captured\" (what at:(to)))) (to (mapEntry \"where\" (what at:(to))))))) (game \"Shogi Puzzle\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 9)) (piece \"Osho\" Each (\"StepMove\")) (piece \"Fuhyo\" Each (\"StepMove\" Forward (then (if (\"InPromotionZone\" (last To)) (if (\"InLastRank\" (last To)) \"Promote\" (moveAgain)))))) (piece \"Ginsho\" Each (\"StepMove\" (directions {Forward BL BR FL FR}) \"CanPromote\")) (piece \"Hisha\" Each (\"SlideMove\" Orthogonal \"CanPromote\")) (piece \"Kakugyo\" Each (\"SlideMove\" Diagonal \"CanPromote\")) (piece \"Keima\" Each (forEach Direction Forward (to if:True (apply (forEach Direction (from (to)) (directions {FR FL}) (if (not (\"IsFriendAt\" (to))) (move (from) (to (apply if:(\"IsEnemyAt\" (to)) (add (piece (mapEntry \"Captured\" (what at:(to)))) (to (mapEntry \"Where\" (what at:(to)))))))))))) (then (if (\"InPromotionZone\" (last To)) (if (\"InTwoFurthestRank\" (last To)) \"Promote\" (moveAgain)))))) (piece \"Kyosha\" Each (\"SlideMove\" Forward (then (if (\"InPromotionZone\" (last To)) (if (\"InLastRank\" (last To)) \"Promote\" (moveAgain)))))) (\"ShogiGold\" \"Kinsho\" \"CapturePiece\") (\"ShogiGold\" \"Tokin\" \"CapturePiece\") (\"ShogiGold\" \"Narigin\" \"CapturePiece\") (piece \"Ryuo\" Each (or (\"SlideMove\" Orthogonal) (\"StepMove\" Diagonal))) (piece \"Ryuma\" Each (or (\"SlideMove\" Diagonal) (\"StepMove\" Orthogonal))) (\"ShogiGold\" \"Narikei\" \"CapturePiece\") (\"ShogiGold\" \"Narikyo\" \"CapturePiece\") (regions \"LastRankP1\" P1 (sites Top)) (regions \"LastRankP2\" P2 (sites Bottom)) (regions \"TwoFurthestRankP1\" P1 (expand (sites Top))) (regions \"TwoFurthestRankP2\" P2 (expand (sites Bottom))) (regions \"Promotion\" P1 (expand (sites Top) steps:2)) (regions \"Promotion\" P2 (expand (sites Bottom) steps:2)) (map \"where\" {(pair 3 88) (pair 4 81) (pair 5 89) (pair 6 82) (pair 7 90) (pair 8 83) (pair 9 91) (pair 10 84) (pair 11 92) (pair 12 85) (pair 13 93) (pair 14 86) (pair 15 94) (pair 16 87) (pair 17 88) (pair 18 81) (pair 19 89) (pair 20 82) (pair 21 90) (pair 22 83) (pair 23 91) (pair 24 84) (pair 25 92) (pair 26 85) (pair 27 93) (pair 28 86)}) (map \"captured\" {(pair 3 4) (pair 4 3) (pair 5 6) (pair 6 5) (pair 7 8) (pair 8 7) (pair 9 10) (pair 10 9) (pair 11 12) (pair 12 11) (pair 13 14) (pair 14 13) (pair 15 16) (pair 16 15) (pair 17 4) (pair 18 3) (pair 19 6) (pair 20 5) (pair 21 8) (pair 22 7) (pair 23 10) (pair 24 9) (pair 25 12) (pair 26 11) (pair 27 14) (pair 28 13)}) (map \"promoted\" {(pair 3 17) (pair 4 18) (pair 5 19) (pair 6 20) (pair 7 21) (pair 8 22) (pair 9 23) (pair 10 24) (pair 11 25) (pair 12 26) (pair 13 27) (pair 14 28)}) (hand Each size:7)}) (rules (start { (place \"Kinsho1\" {\"G7\"}) (place \"Kinsho1\" 86) (place \"Osho2\" coord:\"G9\")}) (play (if \"SameTurn\" (or \"Promote\" (move Pass)) (do (or { (move (from (sites Occupied by:Mover container:\"Hand\" components:{\"Kakugyo\" \"Ginsho\" \"Hisha\" \"Kinsho\"})) (to (sites Empty))) \"PlaceAPawn\" \"PlaceALance\" \"PlaceAKnight\" (forEach Piece)}) ifAfterwards:(not (\"KingCheck\" Mover))))) (end { (if (and { (\"KingCheck\" Next) \"NextCanNotMove\" (<= (count Turns) 1)}) (result P1 Win)) (if (or (no Moves Next) (and (= 1 (count Turns)) (not (is Mover Next)))) (result P1 Loss))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\n10x10 board, 20 pieces per player. Pieces move diagonally one or can jump an opponent's adjacent player to capture it. Pieces can move forward or backwards. When a piece reaches the opposite edge of the board from its starting position, it becomes a king and can may move and jump over any number of spaces diagonally. Captures are compulsory and the maximum number of jumps must be made. Winning is achieved by capturing all the opponent's pieces or by blocking them from moving. \n\n###\n\n", "completion": "(define \"IsUnpromoted\" (\"IsPieceAt\" \"Counter\" Mover (last To))) (game \"International Draughts\" (\"TwoPlayersNorthSouth\") (\"DraughtsEquipment\" (square 10)) (rules (\"BlackCellsSetup\" 4) (play (if \"SameTurn\" (if \"IsUnpromoted\" (max Moves (\"HopInternationalDraughtsStyle\" (from (last To)) (then (\"ReplayIfCanMove\" (\"HopInternationalDraughtsStyle\" (from (last To))) (\"PromoteIfReach\" (sites Next) \"DoubleCounter\"))))) (max Moves (\"HopDiagonalSequenceCaptureAgain\" before:(count Rows) after:(count Rows) at:EndOfTurn))) (priority { (max Moves (or (forEach Piece \"Counter\" (\"HopInternationalDraughtsStyle\" (from) (then (\"ReplayIfCanMove\" (\"HopInternationalDraughtsStyle\" (from (last To))) (\"PromoteIfReach\" (sites Next) \"DoubleCounter\"))))) (forEach Piece \"DoubleCounter\" (\"HopDiagonalSequenceCapture\" before:(count Rows) after:(count Rows) at:EndOfTurn)))) (or (forEach Piece \"Counter\" (\"StepToEmpty\" (directions {FR FL})) (then (\"PromoteIfReach\" (sites Next) \"DoubleCounter\"))) (forEach Piece \"DoubleCounter\" (move Slide Diagonal)))}))) (end (\"BlockWin\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\n3x3 intersecting lines with diagonals. Play occurs on the intersections of the lines. Players each have three pieces, initially placed on the sides closest to the player. Players move the pieces to an adjacent unoccupied intersection along the lines. The goal is to make three in a row which cannot be in the starting position. An alternate version requires the three in a row to be diagonal. \n\n###\n\n", "completion": "(define \"NotAllPieceInHome\" (not (all Sites (sites Occupied by:Mover) if:(is In (site) (sites Mover))))) (game \"Tant Fant\" (players 2) (equipment { (\"AlquerqueBoard\" 3) (piece \"Marker\" Each \"StepToEmpty\") (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start { (place \"Marker1\" (sites P1)) (place \"Marker2\" (sites P2))}) (play (forEach Piece)) (end (if (and \"NotAllPieceInHome\" (is Line 3)) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n7x7 board. 24 pieces per player. Players alternate turns placing two pieces on the board. When all of the pieces are placed, players alternate turns moving one piece orthogonally any distance. The first player to place seven of their pieces in an orthogonal or diagonal line wins.\n \n\n###\n\n", "completion": "(game \"Fart (7x7)\" (players 2) (equipment { (board (square 7)) (piece \"Marker\" Each (move Slide Orthogonal)) (hand Each)}) (rules (start (place \"Marker\" \"Hand\" count:24)) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (difference (sites Board) (centrePoint)) if:(is Empty (to))) (then (if (\"NewTurn\") (moveAgain))))) (nextPhase Mover (is Empty (handSite Mover)) \"Move\")) (phase \"Move\" (play (forEach Piece)))} (end (if (is Line 7) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayers take turns placing one stone of either color on the board, until it is full. Player One wins if there is an odd number of groups with at least five pieces on the board, Player Two wins otherwise. Played on a size 5 board. Min group size 5.\n\n###\n\n", "completion": "(define \"GroupCount\" (+ (count Groups if:(= (who at:(to)) P1) min:5) (count Groups if:(= (who at:(to)) P2) min:5))) (game \"Odd\" (players 2) (equipment { (board (rotate 90 (hex 5))) (piece \"Marker\" Each) (hand Shared size:2)}) (rules (start { (place \"Marker1\" (handSite Shared)) (place \"Marker2\" (handSite Shared 1))}) (play (move (from (sites Hand Shared)) (to (sites Empty)) copy:True)) (end (if (is Full) (if (is Odd (+ (count Groups if:(= (who at:(to)) P1) min:5) (count Groups if:(= (who at:(to)) P2) min:5))) (result P1 Win)) (result P2 Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n5x6 board, made in the sand. One player plays with twelve sticks and the other with twelve pebbles. The player with the sticks plays first. Players alternate turns placing one of their pieces on an empty space on the board. Players are not permitted to place more than two of their own pieces in an orthogonal row on the board. When all of the pieces are placed, players alternate turns moving one of their pieces orthogonally one space. When a player successfully places three of their pieces in an orthogonal row of three, the player captures one of the opponent's pieces. The player who captures all of their opponent's pieces wins. \n\n###\n\n", "completion": "(game \"Wali\" (players 2) (equipment { (board (rectangle 5 6)) (hand Each) (piece \"Stick\" P1 (\"StepToEmpty\" Orthogonal (then (\"ReplayIfLine3\" Orthogonal)))) (piece \"Ball\" Each (\"StepToEmpty\" Orthogonal (then (\"ReplayIfLine3\" Orthogonal))))}) (rules (start { (place \"Stick1\" (handSite P1) count:12) (place \"Ball2\" (handSite P2) count:12)}) phases:{ (phase \"Placement\" (play (do (move (from (handSite Mover)) (to (sites Empty))) ifAfterwards:(not (is Line 3 Orthogonal)))) (nextPhase (\"HandEmpty\" P2) \"Movement\")) (phase \"Movement\" (play (if \"SameTurn\" (\"RemoveAnyEnemyPiece\") (forEach Piece))))} (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Construct a Ludii game based on the following description\n4x7 board. Three counters in each hole in the outer row; before beginning each player rearranges these as they wish, with the following rules: The leftmost hole in the outer row must have the most counters; Each hole must have equal to or less than the number of the counters as the hole on its left; there can be a maximum of two holes with one counter in the inner row. Initial phase: Sowing occurs in an anti-clockwise direction, and when a counter lands in an occupied hole the sowing continues. When the final counter lands in an empty hole, the turn ends. If the empty hole is in the player's inner row, counters in the opponent's inner row opposite are captured, and if there are also counters in the opponent's outer row hole opposite, these are also taken. The initial phase ends for a player when they have one counter in each hole. After this, players can only move single counters into empty holes. The player who captures all of the opponent's counters wins. \n\n###\n\n", "completion": "(define \"NoPiece\" (all Sites (sites Player \"Home\") if:(= 0 (count at:(site))))) (define \"OneCounterInEachHole\" (all Sites (sites Mover \"Home\") if:(> 2 (count at:(site))))) (define \"NextHole\" (\"NextSiteOnTrack\" #2 from:#1 \"TrackCCW\")) (define \"MaximumOfTwoHolesInInner\" (>= 2 (count Sites in:(forEach (sites Mover \"Inner\") if:(= 1 (count at:(site))))))) (define \"EqualOrLessThanLeftHole\" (all Sites (sites Mover \"Home\") if:(if (= (site) (\"HoleOnLeft\")) True (<= (count at:(site)) (count at:(\"HoleOnLeft\")))))) (define \"HoleOnLeft\" (if (is Mover P1) (ahead (site) W) (ahead (site) E))) (define \"LeftMostCounters\" (all Sites (difference (sites Mover \"Home\") (mapEntry \"LeftMost\" Mover)) if:(> (count at:(mapEntry Mover)) (count at:(site))))) (define \"Columns\" 7) (game \"Quiela\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"TrackCCW1\" \"0,E,N1,W\" loop:True P1) (track \"TrackCCW2\" \"14,E,N1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"TrackCCW1\")) (regions \"Home\" P2 (sites Track \"TrackCCW2\")) (regions \"Inner\" P1 (difference (sites Track \"TrackCCW1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"TrackCCW2\") (sites Top))) (regions \"Outer\" P1 (sites Bottom)) (regions \"Outer\" P2 (sites Top)) (piece \"Seed\" Shared) (map \"LeftMost\" {(pair P1 0) (pair P2 27)}) (hand Each)}) (rules (start (set Count 3 to:(union (sites P1 \"Outer\") (sites P2 \"Outer\")))) phases:{ (phase \"Rearrangement\" (play (or (move (from (sites Mover \"Home\") if:(is Occupied (from))) (to (difference (sites Mover) (from)))) (if (and {(\"LeftMostCounters\") (\"EqualOrLessThanLeftHole\") (\"MaximumOfTwoHolesInInner\")}) (move Pass)))) (nextPhase (all Passed) \"InitialPhase\")) (phase \"InitialPhase\" (play (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(is Occupied (from))) (then (sow \"TrackCCW\" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover \"Inner\")) (if (is Occupied (\"OppositePit\" (to))) (and (fromTo (from (\"OppositePit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePit\" (to)))) (if (is Occupied (\"OppositeOuterPit\" (to))) (fromTo (from (\"OppositeOuterPit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositeOuterPit\" (to))))))))))))) (nextPhase Mover (\"OneCounterInEachHole\") \"MainPhase\")) (phase \"MainPhase\" (play (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(if (< 1 (count at:(from))) True (if (= 1 (count at:(from))) (is Empty (\"NextHole\" (from) 1))))) (then (sow \"TrackCCW\" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover \"Inner\")) (if (is Occupied (\"OppositePit\" (to))) (and (fromTo (from (\"OppositePit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePit\" (to)))) (if (is Occupied (\"OppositeOuterPit\" (to))) (fromTo (from (\"OppositeOuterPit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositeOuterPit\" (to))))))))))))))} (end (forEach NonMover if:(\"NoPiece\") (result Player Loss))))) END" }, { "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 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": "Describe the mechanics of the following Ludii game\n(define \"PiecesOwnedBy\" (+ (count at:(mapEntry #1)) (count in:(sites #1)))) (game \"Kara\" (players 2) (equipment { (mancalaBoard 2 3 (track \"Track\" \"1,E,N,W\" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 FirstSite) (pair P2 LastSite)}) (map \"RightHole\" {(pair P1 3) (pair P2 4)}) (piece \"Seed\" Shared)}) (rules (start (set Count 7 to:(sites Track))) (play (move Select (from (sites Mover) if:(> (count at:(from)) 0)) (then (sow if:(and (is In (count at:(to)) (sites {2 4 6})) (is In (to) (union (sites Next) (sites {(mapEntry \"RightHole\" (mover))})))) apply:(fromTo (from (to)) (to (mapEntry (mover))) count:(count at:(to))))))) (end (\"MancalaByScoreWhen\" (no Moves Mover)))))\n\n###\n\n", "completion": "Play begins with seven counters in each hole. Players begin by picking up the counters in one of their holes and sowing them anti-clockwise. If the final counter lands in an opponent's hole or the rightmost hole belonging to the player sowing, having dropped counters in the opponent's holes making them contain two, four, or six counters, the contents of those holes are captured. The player who has the most counters at the end of the game wins. END" }, { "prompt": "Construct a Ludii game based on the following description\nReversi is played on a hexhex-6 board with some cells removed. Pieces are double-sided, with each side distinct in some way from the other. Each side designates ownership of that pieces to a certain player when face-up. In Reversi Mode, play begins with the players taking turns placing pieces into the central six hexagons until they are full; in Othello mode, the central six hexagons are pre-filled with alternating Black and White discs. Then players may place their pieces next to an opponent's piece, as long as a straight line can be drawn between the new piece and an existing piece belonging to that player that goes through the opponent's piece. The opponent's pieces between the new piece and the old piece are then flipped and now belong to the player who just played. If a player cannot make a legal move, they pass. Play continues until the board is full or neither player can make a legal move. The player with the most pieces on the board wins. The pieces are placed on the board.\n\n###\n\n", "completion": "(define \"ReverseBoundedPieces\" (custodial (from (site)) (between if:(is Enemy (state at:(between))) (apply (allCombinations (add (piece \"Disc0\" state:(mover)) (to (site))) (flip (between))))) (to if:(is Friend (state at:(to)))))) (game \"MacBeth\" (players 2) (equipment { (board (remove (hex 6) cells:{7 9 11 22 24 26 28 41 43 45 47 49 62 64 66 68 79 81 83})) (piece \"Disc\" Neutral (flips 1 2))}) (rules phases:{ (phase \"Placement\" (play (move Add (piece \"Disc0\" state:(mover)) (to (intersection (sites Empty) (sites Centre))))) (nextPhase Mover (>= (count Moves) 5) \"Playing\")) (phase \"Playing\" (play (forEach Site (sites Empty) (append \"ReverseBoundedPieces\" (then (and (set Score P1 (count Sites in:(sites State 1))) (set Score P2 (count Sites in:(sites State 2)))))))))} (end (if (all Passed) (byScore))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n5x5 intersecting lines. Two triangles on opposite sides of the square, with the apex intersecting with the midpoint of opposite sides. A line is drawn from the apex , bisecting the base, and another line bisecting this one and the opposite two sides of the triangle. Lines are drawn through the apex, extending the sides of the triangle to the midpoint of the adjacent side. Sixteen pieces per player, which begin on the points of the board closes to the player. Players alternate turns moving a piece to an empty adjacent spot orthogonally or diagonally, even when there are not lines connecting the adjacent points. A player's piece may hop over an opponent's piece to an empty space immediately on the opposite side of it to capture it. The player who occupies all of the points in the opponent's triangle wins. \n\n###\n\n", "completion": "(game \"Shanzak Kammar\" (players 2) (equipment { (board (add (\"AlquerqueGraphWithBottomAndTopTriangles\") edges:{{5 1} {1 7} {7 3} {3 9} {13 9} {7 13} {11 5} {15 11} {11 17} {7 11} {17 13} {13 19} {23 19} {23 17} {17 21} {15 21}}) use:Vertex) (piece \"Marker\" Each (or \"StepToEmpty\" \"HopCapture\")) (regions \"Goal\" P1 (expand (sites Top))) (regions \"Goal\" P2 (expand (sites Bottom)))}) (rules (start { (place \"Marker1\" (expand (sites Bottom) steps:3)) (place \"Marker2\" (expand (sites Top) steps:3))}) (play (forEach Piece)) (end (if (= 6 (count Pieces Mover in:(sites Mover \"Goal\"))) (result Mover Win))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"StackSizeLessThan2\" (< (size Stack at:(\"NextSiteOnTrack\" (pips))) 2)) (define \"Unstack\" (set State at:(last To) 0)) (define \"PieceStacked\" (= (state at:#1) 1)) (define \"RemoveAPiece\" (move Remove (from))) (define \"SiteToSelect\" (\"NextSiteOnTrack\" (- (pips) 1) from:(mapEntry \"StartTrack\" (mover)))) (game \"Doblet\" (players 2) (equipment { (\"TableBoard\" (\"TableTracksOpposite\" End)) (dice d:6 num:3) (piece \"Disc\" Each (forEach Die if:(\"DieNotUsed\") (if (\"IsEndTrack\" (\"NextSiteOnTrack\" (pips))) \"RemoveAPiece\" (move (from) (to (\"NextSiteOnTrack\" (pips)) if:\"StackSizeLessThan2\" (apply (if (\"IsEnemyAt\" (to)) (remove (to))))))))) (map \"StartTrack\" {(pair P1 0) (pair P2 12)})}) (rules (start { (place Stack \"Disc1\" (sites {0..5}) count:2 state:1) (place Stack \"Disc2\" (sites {12..17}) count:2 state:1)}) phases:{ (phase \"UnStacking\" (play (\"RollEachNewTurnMove\" (forEach Die if:(\"DieNotUsed\") (if (\"PieceStacked\" \"SiteToSelect\") (move Select (from (\"SiteToSelect\")) (then (and { (\"Unstack\") (\"ReplayNotAllDiceUsed\")}))))))) (nextPhase Mover (all Sites (sites Occupied by:Mover) if:(not (\"PieceStacked\" (site)))) \"BearingOff\")) (phase \"BearingOff\" (play (\"RollEachNewTurnMove\" (forEach Piece top:True) (then (if (and (not (was Pass)) (not (all DiceUsed))) (moveAgain))))))} (end (\"EscapeWin\"))))\n\n###\n\n", "completion": "2x12 board, divided in half. Spaces on each side take the form of semi-circular sockets, into which the pieces fit. Twelve pieces per player. Pieces begin on one half of a player's side of the board (the half to the left of one player, and to the right of the other player), two per space, stacked on top of one another. Three dice. To begin, a player must first unstack their pieces, by rolling the number of the space on which the stack is located, and thus removing the stack, but keeping the piece on the same space. Once complete, pieces move in a track the long way around the board toward the portion where the opponent begins. Players move according to the number on each die by moving one piece the value on one die then another piece the value on the other die, or by moving one piece the value of one die and then the value of the other. No more than two pieces can occupy a space at a time. When a piece lands on a space occupied by a single piece of the opponent, the opponent's piece is removed from the board. Players attempt to bear off their pieces by rolling the exact number of spaces left on the board, plus one. When unstacking the pieces in the beginning or when bearing off at the end, if the player cannot play their roll but the opponent is able, the opponent may use the roll. The first player to bear off all of their pieces wins.\n 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 Ludii game based on the following description\nThe two players, Red and Blue, alternately place tokens on the intersections of the board until each has placed fifteen. Thereafter they alternate turns sliding a single token along a line to an adjacent vertex.\n \n A player who occupies the three vertices of any triangle has formed a mill and may relocate one enemy token. Occupying the four vertices of a square (forming a double mill) allows the player to relocate two enemy tokens. No more than two tokens may be relocated in a single turn, even if a player completes a mill and double mill with the same move.\n \n The winner is the first player to occupy all six vertices of either any neutral hexagon or one of his/her own color. A win can be achieved during either the placement or movement phases of the game. \n\n###\n\n", "completion": "(define \"NextPlayerHasLost\" (is Triggered \"Lose\" Next)) (define \"NextPlayerLose\" (trigger \"Lose\" Next)) (define \"AllCellOfLastVertex\" (sites Incident Cell of:Vertex at:(last To))) (define \"PlaceAPiece\" (move (from (handSite Mover)) (to (sites Empty)))) (define \"MoveAnEnemyPiece\" (move (from (sites Occupied by:Next container:\"Board\")) (to (sites Empty) (apply if:\"OneMoreToMove\" (moveAgain))))) (define \"CellFilled\" (= (count Sites in:(intersection \"AllVerticesOfCell\" (sites Occupied by:Mover))) (count Sites in:\"AllVerticesOfCell\"))) (define \"SquareFilled\" (= 4 (count Sites in:\"AllVerticesOfCell\"))) (define \"HexFilled\" (= 6 (count Sites in:\"AllVerticesOfCell\"))) (define \"AllVerticesOfCell\" (sites Incident Vertex of:Cell at:(site))) (define \"TwoPieceToMove\" (set Pending)) (define \"OneMoreToMove\" (is Pending)) (game \"Kensington\" (players 2) (equipment { (board (rotate 90 (tiling T3464 2)) use:Vertex) (hand Each) (piece \"Marker\" Each \"StepToEmpty\") (regions \"HexA\" P1 (sites Cell \"E4\")) (regions \"HexB\" P1 (sites Cell \"I4\")) (regions \"HexA\" P2 (sites Cell \"E12\")) (regions \"HexB\" P2 (sites Cell \"I12\")) (regions \"HexNeutral1\" (sites Cell \"C8\")) (regions \"HexNeutral2\" (sites Cell \"G8\")) (regions \"HexNeutral3\" (sites Cell \"K8\"))}) (rules (start (place \"Marker\" \"Hand\" count:15)) (play (if \"SameTurn\" \"MoveAnEnemyPiece\" (if (\"HandEmpty\" Mover) (forEach Piece) \"PlaceAPiece\" (then (forEach Site \"AllCellOfLastVertex\" (if \"CellFilled\" (if \"HexFilled\" (if (or { (= \"AllVerticesOfCell\" (sites Mover \"HexA\")) (= \"AllVerticesOfCell\" (sites Mover \"HexB\")) (= \"AllVerticesOfCell\" (sites \"HexNeutral1\")) (= \"AllVerticesOfCell\" (sites \"HexNeutral2\")) (= \"AllVerticesOfCell\" (sites \"HexNeutral3\"))}) \"NextPlayerLose\") (and (if \"SquareFilled\" \"TwoPieceToMove\") (moveAgain))))))))) (end (if \"NextPlayerHasLost\" (result Mover Win))))) END" }, { "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 Ludii game based on the following description\nEach player has his own board, set up so that the opponent cannot see it. The referee has a board of his own on which he plays the moves of both players. He can see both player's boards.\n \n To make a move, a player plays a stone on his own board. The referee then checks on his board whether the move is legal and informs both players about the tried move. How exactly the referee comments on the move depends on the rule variant.\n \n As long as a player tries to play an illegal move, it's still his turn and he may try another move. After the player has made a legal move, the referee copies the move to his own board. Then, it's the other player's turn. The game is played on a 9x9 board\n\n###\n\n", "completion": "(define \"MadeALegalMove\" (do (add (to (last To)) (then (and { \"CaptureSurroundedPiece\" (set Hidden at:(last To) to:Next) (note player:Mover \"has moved\") (note player:Next \"to play\")}))) ifAfterwards:(\"HasFreedom\" Orthogonal))) (define \"NotEmpty\" (not (is In (last To) (sites Empty)))) (define \"IllegalMove\" (and { (note player:Mover \"made an illegal move\") (note player:Mover \"to play\") (moveAgain)})) (define \"CaptureSurroundedPiece\" (enclose (from (last To)) Orthogonal (between if:(\"IsEnemyAt\" (between)) (apply (and (addScore Mover 1) (remove (between))))))) (game \"Phantom Go\" (players 2) (equipment { (board (square 9) use:Vertex) (piece \"Marker\" Each)}) (rules (play (or (move Select (from (union (sites Empty) (sites Hidden to:Mover))) (then (priority { (if (\"NotEmpty\") (\"IllegalMove\")) (\"MadeALegalMove\") (\"IllegalMove\")}))) (move Pass))) (end (if (all Passed) (byScore { (score P1 (+ (score P1) (size Territory P1))) (score P2 (+ (score P2) (size Territory P2)))}))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n4x12-24 (only even numbers allowed) board. Play begins with two counters in the outer row of each players' holes and two counter in each of the four holes on the right hand side of both players' inner row of holes. Player picks up contents of any hole containing two or more counters and sows them anti-clockwise. If the final counter of the sowing falls into an empty hole, the turn is over. If the last counter falls into an occupied hole, sowing continues by picking up the counters in that hole and continuing in the same direction. If the last counter falls into an occupied hole in the player's inner row, and the opponent's two holes opposite it are occupied, these are captured and sowing continues using these counters beginning at the next hole after the one which caused the capture. Play ends when one player cannot move; i.e. when they have only single counters in holes or all their counters have been captured. Each player has 12 holes. The player can sow from any hole with one or more seeds.\n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (define \"MoveAgainAfterCapture\" (is Pending)) (define \"PlayFromNextHole\" (sites {(value Pending)})) (define \"NextHole\" (\"NextSiteOnTrack\" 1 from:(to) \"Track\")) (define \"Columns\" 12) (game \"Hus (Damara)\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"0,E,N1,W\" loop:True P1) (track \"Track2\" \"24,E,N1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"Track1\")) (regions \"Home\" P2 (sites Track \"Track2\")) (regions \"Inner\" P1 (difference (sites Track \"Track1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"Track2\") (sites Top))) (regions \"Outer\" P1 (sites Bottom)) (regions \"Outer\" P2 (sites Top)) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 2 to:(union { (expand (intersection (sites Row 1) (sites Right)) steps:3 W) (expand (intersection (sites Row 2) (sites Left)) steps:3 E) (sites P1 \"Outer\") (sites P2 \"Outer\")}))) (play (move Select (from (if (\"SameTurn\") (if \"MoveAgainAfterCapture\" \"PlayFromNextHole\" \"LastHoleSowed\") (sites Mover \"Home\")) if:(> (count at:(from)) 0)) (then (sow \"Track\" owner:(mover) apply:(if (> (count at:(to)) 1) (if (and { (is In (to) (sites Mover \"Inner\")) (> (count at:(\"OppositePit\" (to))) 0) (> (count at:(\"OppositeOuterPit\" (to))) 0)}) (and { (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))) (fromTo (from (\"OppositePit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePit\" (to)))) (fromTo (from (\"OppositeOuterPit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositeOuterPit\" (to)))) (if (> (count at:\"NextHole\") 1) (and (set Pending \"NextHole\") (moveAgain)))}) (moveAgain))))))) (end (\"MancalaByScoreWhen\" (no Moves Mover))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6 board. Four counters in each hole. Sowing occurs in a clockwise direction when starting from the three holes on the left of the board, and in an anti-clockwise direction when starting from the three holes on the right. Sowing ends when the final counter is dropped, regardless of whether the hole is occupied or not. When the final counter is dropped into a hole containing three counters, thus making it contain four, the hole is captured. This can only be done if the hole is one of the end holes on either side of either row, or the penultimate holes on either side of the opponent's row. Sowing is not allowed from a captured hole. When no player is able to move, the player with the most counters in their captured holes wins. \n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (count in:(forEach (sites Board) if:(= (id #1) (state at:(site)))))) (game \"Qelat (Beni Amir-Mensa)\" (players 2) (equipment { (mancalaBoard 2 6 store:None { (track \"TrackCCW\" \"0,E,N,W\" loop:True) (track \"TrackCW\" \"5,W,N,E\" loop:True)}) (piece \"Seed\" Shared) (regions \"Left\" P1 (intersection (expand (sites Left) steps:2) (sites Bottom))) (regions \"Left\" P2 (intersection (expand (sites Right) steps:2) (sites Top))) (regions \"Right\" P1 (intersection (expand (sites Right) steps:2) (sites Bottom))) (regions \"Right\" P2 (intersection (expand (sites Left) steps:2) (sites Top)))}) (rules (start (set Count 4 to:(sites Track))) (play (or (move Select (from (sites Mover \"Left\") if:(and (= 0 (state at:(from))) (is Occupied (from)))) (then (sow \"TrackCW\" apply:(if (and { (is In (to) (union (expand (sites Right)) (expand (sites Left)))) (= 4 (count at:(to))) (= 0 (state at:(to)))}) (set State at:(to) (mover)))))) (move Select (from (sites Mover \"Right\") if:(and (= 0 (state at:(from))) (is Occupied (from)))) (then (sow \"TrackCCW\" apply:(if (and { (is In (to) (union (expand (sites Right)) (expand (sites Left)))) (= 4 (count at:(to))) (= 0 (state at:(to)))}) (set State at:(to) (mover)))))))) (end (\"MancalaByScoreWhen\" (and (no Moves P1) (no Moves P2)))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"Shatranj (Iraq)\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (\"ChessKing\" \"King_noCross\") (piece \"Ferz_noCross\" (or (\"SlideCapture\") (\"LeapCapture\" \"KnightWalk\"))) (piece \"Elephant\" (move Slide Diagonal (between if:(or (is In (between) (sites Around (from))) (is Empty (between)))) (to if:(and (not (\"IsPieceAt\" \"Elephant\" Next (to))) (\"IsEnemyAt\" (to))) (apply if:(not (is In (to) (sites Around (from)))) (if (\"IsEnemyAt\" (to)) (remove (to))))))) (\"ChessKnight\" \"Knight\") (\"ChessRook\" \"Rook\") (\"ChessPawn\" \"Pawn\" ~ (then (\"PromoteIfReach\" (sites Mover \"Promotion\") \"Ferz_noCross\"))) (regions \"Promotion\" P1 (sites Top)) (regions \"Promotion\" P2 (sites Bottom))}) (rules (start { (place \"Pawn1\" (sites Row 1)) (place \"Pawn2\" (sites Row 6)) (place \"Rook1\" {\"A1\" \"H1\"}) (place \"Knight1\" {\"B1\" \"G1\"}) (place \"Elephant1\" {\"C1\" \"F1\"}) (place \"Ferz_noCross1\" coord:\"D1\") (place \"King_noCross1\" coord:\"E1\") (place \"Rook2\" {\"A8\" \"H8\"}) (place \"Knight2\" {\"B8\" \"G8\"}) (place \"Elephant2\" {\"C8\" \"F8\"}) (place \"Ferz_noCross2\" coord:\"D8\") (place \"King_noCross2\" coord:\"E8\")}) (play (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King_noCross\" Mover)))) (end { (\"Checkmate\" \"King_noCross\") (if (no Moves Mover) (result Mover Loss))})))\n\n###\n\n", "completion": "8x8 board. The pieces move as follows, with the number per player: 1 x Shah (king): moves one space orthogonally or diagonally. 1 x Fers (counselor): Any distance orthogonally or diagonally, or like the Asb. 2 x Rukh (rook): Any number of spaces orthogonally. No castling. 2 x Pil (elephant): Any distance diagonally, jumping over the first. Cannot capture another Pil. 2 x Asb (horse): Moves as a chess knight. 8 x Sarbaz (soldier): Moves one space forward orthogonally; one space forward diagonally to capture. No en passant. Promoted to Fers when reaching the eighth rank. An opponent's piece is captured by moving a player's own piece onto a space occupied by the opponent's piece. When a Shah can be captured on the next turn by an opponent's piece, it is in check. The Shah must not be in check at the end of the player's turn. If this is not possible, it is checkmate and the opponent wins. Stalemate results in a win for that player causing it.\n 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": "Describe the mechanics of the following Ludii game\n(define \"SquareGraphics\" (graphics { (board Style Go) (piece Background image:\"square.svg\" edgeColour:(colour 100 100 100 255)) (piece Foreground image:\"cross.svg\" edgeColour:(colour 100 100 100 255)) (piece Colour strokeColour:(colour 100 100 100 255)) (piece Scale .26) (show Piece Value CornerLeft valueOutline:True scale:1.5)})) (define \"HexGraphics\" (graphics { (board Colour OuterEdges (colour Black)) (board Colour InnerEdges (colour Black)) (board StyleThickness OuterEdges 1.5) (board StyleThickness InnerEdges 0.4) (board StyleThickness InnerVertices 0.4) (board StyleThickness OuterVertices 0.4) (board Colour Symbols (colour Black)) (player Colour P1 (colour Black)) (player Colour P2 (colour LightOrange)) (region Colour (sites Occupied by:P1) (colour 60 120 170 120)) (region Colour (sites Occupied by:P2) (colour 195 195 200 120)) (show Piece Value Middle valueOutline:False scale:.8)})) (define \"SetNewGroupValue\" (forEach Site (sites Group at:(last To) All) (set Value at:(site) (count Sites in:(sites Group at:(last To) All))))) (define \"ToToSites\" (to (difference (sites Empty) (forEach of:(sites Occupied by:Mover) (if (>= (value Piece at:(site)) (score Mover)) (sites Around (site) All)))))) (game \"Ecosys\" (players 2) (equipment { ((board (square Square 9) use:Vertex)) (piece \"Disc\" Each)}) (rules (start (set Score Each 0)) (play (move Add (\"ToToSites\") (then (and (\"SetNewGroupValue\") (set Score Mover (size Array (sizes Group All Mover))))))) (end (\"NoMoves\" Loss))))\n\n###\n\n", "completion": "With the board empty, Black starts.\n \n Players take turns in alternation, placing a stone on to an empty cell.\n However, a stone must not be placed next to a group that already has the same (or more) stones as there are friendly groups.\n \n The game is lost by the first player forced to place a stone next to a friendly group that has as many (or more) stones as there are friendly groups. 9 Square END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game is played on a 4x4 board -> The game is played on a 6x6 board\nThe version of the game played with 3 players. -> The version of the game played with 4 players.\n(game \"Omega\" (players 3) (equipment { (board (hex 4)) (piece \"Marker\" Each)}) (rules (play (move Add (piece (+ 1 (% (count Moves) (count Players)))) (to (sites Empty)) (then (if (!= (count MovesThisTurn) (- (count Players) 1)) (moveAgain))))) (end (if (and { (not (is Mover P1)) (is Next P1) (> (pow (count Players) 2) (count Sites in:(sites Empty)))}) (byScore {(score P1 (* (sizes Group P1))) (score P2 (* (sizes Group P2))) (score P3 (* (sizes Group P3)))})))))\n\n###\n\n", "completion": "(game \"Omega\" (players 4) (equipment { (board (hex 6)) (piece \"Marker\" Each)}) (rules (play (move Add (piece (+ 1 (% (count Moves) (count Players)))) (to (sites Empty)) (then (if (!= (count MovesThisTurn) (- (count Players) 1)) (moveAgain))))) (end (if (and { (not (is Mover P1)) (is Next P1) (> (pow (count Players) 2) (count Sites in:(sites Empty)))}) (byScore {(score P1 (* (sizes Group P1))) (score P2 (* (sizes Group P2))) (score P3 (* (sizes Group P3))) (score P4 (* (sizes Group P4)))}))))) END" }, { "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": "Describe the mechanics of the following Ludii game\n(game \"Ahtarah Guti\" (players 2) (equipment { (\"AlquerqueBoardWithBottomAndTopTriangles\") (piece \"Marker\" Each (or (\"HopSequenceCapture\") (\"StepToEmpty\")))}) (rules (start { (place \"Marker1\" (union {(sites Row 0) (sites Row 1) (sites Row 2) (sites Row 3) (sites {13 14})})) (place \"Marker2\" (union {(sites Row 5) (sites Row 6) (sites Row 7) (sites Row 8) (sites {10 11})}))}) (play (if \"SameTurn\" (or (\"HopSequenceCaptureAgain\") (move Pass)) (forEach Piece))) (end (\"CaptureAll\" Next))))\n\n###\n\n", "completion": "5x5 intersecting lines, with diagonals in each quadrant. Two triangles, the apexes of which intersect with the square at the midpoint of opposite sides. One line bisecting the base of the triangle, and another bisecting this line. Eighteen pieces per player, each side arranged on one side of the board, with the central point empty and the player's pieces on the points to the right of it. Players alternate turns moving one of their pieces to an empty point. A piece may jump an opponent's piece to capture it. Multiple captures are allowed. The player who captures all of the opponent's pieces wins. END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" (count Pips))) (game \"Had\" (players 2) (equipment { (board (rectangle 3 14) { (track \"Track1\" \"0,E,N1,W,N1,E\" P1 directed:True) (track \"Track2\" \"41,W,S1,E,S1,W\" P2 directed:True)}) (dice d:4 num:2) (piece \"Marker\" Each (if (\"IsOffBoard\" (\"SiteToMoveOnTrack\")) (move Remove (from)) (move (from) (to (\"SiteToMoveOnTrack\") if:(is Empty (to))))))}) (rules (start { (place \"Marker1\" (sites Bottom)) (place \"Marker2\" (sites Top))}) (play (\"RollMove\" (forEach Piece))) (end (if (no Pieces Mover) (result Mover Win)))))\n\n###\n\n", "completion": "3x14 board. Fourteen pieces per player, placed in the outer rows of the board. Two knucklebones used as dice. Players move their pieces according to the throws of the knucklebones. Pieces move in a boustrophedon path along the board. The first player to remove their pieces from the board wins. END" }, { "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\n4x8=20 holes, with an even number per row. One counter in each hole, except the right-hand end row of the inner row. Sowing occurs in an anti-clockwise direction, only into an empty hole. When a counter lands in a hole in the inner row and the opponent's opposite inner row hole is empty, the contents of the opponent's opposite outer row hole are captured. The player who captures all of the opponent's pieces wins. \n\n###\n\n", "completion": "(define \"NextHoleFrom\" (\"NextSiteOnTrack\" 1 from:#1)) (define \"NoPiece\" (all Sites (sites Player \"Home\") if:(= 0 (count at:(site))))) (define \"Columns\" 8) (game \"Sute\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"0,E,N1,W\" loop:True P1) (track \"Track2\" \"16,E,N1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"Track1\")) (regions \"Home\" P2 (sites Track \"Track2\")) (regions \"Inner\" P1 (difference (sites Track \"Track1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"Track2\") (sites Top))) (piece \"Seed\" Shared)}) (rules (start (set Count 1 to:(difference (union (sites P1 \"Home\") (sites P2 \"Home\")) (union (intersection (sites Right) (sites Row 1)) (intersection (sites Left) (sites Row 2)))))) (play (move Select (from (sites Mover \"Home\") if:(and (> (count at:(from)) 0) (= 0 (count at:(\"NextHoleFrom\" (from)))))) (then (sow \"Track\" owner:(mover) apply:(if (and (= (count at:(\"OppositePit\" (to))) 0) (is In (to) (sites Mover \"Inner\"))) (remove (\"OppositeOuterPit\" (to)))))))) (end (forEach NonMover if:(\"NoPiece\") (result Player Loss))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\n5x5 Square -> 6x6 Square\n(define \"KnightVector\" (sites (from) {{F R F L F} {F L F R F}})) (define \"UnconfinedStiesOf\" (forEach (sites Board) if:(!= Infinity (count Steps Adjacent (step Adjacent (to if:(or (is Empty (to)) (is #1 (who at:(to)))))) (site) (sites Outer))))) (define \"SetScoreOf\" (set Score #1 (- 0 (count Sites in:(difference (sites Occupied by:#1) (\"UnconfinedStiesOf\" #1)))))) (define \"MakeSwap\" (if (is Empty (\"SwapSite\" 1)) (fromTo (from (\"SwapSite\" 0)) (to (\"SwapSite\" 1))) (if (is Empty (\"SwapSite\" 0)) (fromTo (from (\"SwapSite\" 1)) (to (\"SwapSite\" 0))) (set Var \"Piece1\" (\"SwapPiece\" 1) (then (add (piece (\"SwapPiece\" 0)) (to (\"SwapSite\" 1) (apply (remove (to)))) (then (add (piece (var \"Piece1\")) (to (\"SwapSite\" 0) (apply (remove (to)))))))))) (then (and { (\"SetScoreOf\" Mover) (\"SetScoreOf\" Next) (forget Value All) (if (and (\"NewTurn\") (< -1 (counter))) (moveAgain))})))) (define \"SwapPiece\" (what at:(\"SwapSite\" #1) level:(topLevel at:(\"SwapSite\" #1)))) (define \"SwapSite\" (arrayValue (values Remembered) index:#1)) (define \"Placement\" (move Select (from #1 if:(> 2 (count Stack at:(from)))) (to \"KnightVector\" if:(and { (is In (to) (sites Occupied by:Mover top:True)) (= 2 (count Sites in:(\"SwapSites\" (to) (from)))) (or (= 1 (count Sites in:(intersection (\"SwapSites\" (to) (from)) (sites Occupied by:Mover top:True)))) (= 1 (count Sites in:(intersection (\"SwapSites\" (to) (from)) (sites Occupied by:Next top:True)))))})) (then (and { (add (piece (id \"Disc\" Mover)) (to (last From)) stack:True) (forEach Site (\"SwapSites\" (last To) (last From)) (remember Value (site)))})))) (define \"SwapSites\" (intersection (sites Around #1 Adjacent) (sites Around #2 Adjacent))) (game \"Veloop (Square)\" (players 2) (equipment { (board (renumber (rotate 90 (square Square 5))) use:Cell) (piece \"Disc\" Each)}) (rules (start { (place \"Disc1\" {7}) (place \"Disc2\" {12})}) (play (priority (\"Placement\" (sites Empty)) (\"Placement\" (sites Occupied by:Next)) (then (\"MakeSwap\")))) (end (if (!= 0 (+ (score P1) (score P2))) (byScore)))))\n\n###\n\n", "completion": "(define \"KnightVector\" (sites (from) {{F R F L F} {F L F R F}})) (define \"UnconfinedStiesOf\" (forEach (sites Board) if:(!= Infinity (count Steps Adjacent (step Adjacent (to if:(or (is Empty (to)) (is #1 (who at:(to)))))) (site) (sites Outer))))) (define \"SetScoreOf\" (set Score #1 (- 0 (count Sites in:(difference (sites Occupied by:#1) (\"UnconfinedStiesOf\" #1)))))) (define \"MakeSwap\" (if (is Empty (\"SwapSite\" 1)) (fromTo (from (\"SwapSite\" 0)) (to (\"SwapSite\" 1))) (if (is Empty (\"SwapSite\" 0)) (fromTo (from (\"SwapSite\" 1)) (to (\"SwapSite\" 0))) (set Var \"Piece1\" (\"SwapPiece\" 1) (then (add (piece (\"SwapPiece\" 0)) (to (\"SwapSite\" 1) (apply (remove (to)))) (then (add (piece (var \"Piece1\")) (to (\"SwapSite\" 0) (apply (remove (to)))))))))) (then (and { (\"SetScoreOf\" Mover) (\"SetScoreOf\" Next) (forget Value All) (if (and (\"NewTurn\") (< -1 (counter))) (moveAgain))})))) (define \"SwapPiece\" (what at:(\"SwapSite\" #1) level:(topLevel at:(\"SwapSite\" #1)))) (define \"SwapSite\" (arrayValue (values Remembered) index:#1)) (define \"Placement\" (move Select (from #1 if:(> 2 (count Stack at:(from)))) (to \"KnightVector\" if:(and { (is In (to) (sites Occupied by:Mover top:True)) (= 2 (count Sites in:(\"SwapSites\" (to) (from)))) (or (= 1 (count Sites in:(intersection (\"SwapSites\" (to) (from)) (sites Occupied by:Mover top:True)))) (= 1 (count Sites in:(intersection (\"SwapSites\" (to) (from)) (sites Occupied by:Next top:True)))))})) (then (and { (add (piece (id \"Disc\" Mover)) (to (last From)) stack:True) (forEach Site (\"SwapSites\" (last To) (last From)) (remember Value (site)))})))) (define \"SwapSites\" (intersection (sites Around #1 Adjacent) (sites Around #2 Adjacent))) (game \"Veloop (Square)\" (players 2) (equipment { (board (renumber (rotate 90 (square Square 6))) use:Cell) (piece \"Disc\" Each)}) (rules (start { (place \"Disc1\" {15}) (place \"Disc2\" {21})}) (play (priority (\"Placement\" (sites Empty)) (\"Placement\" (sites Occupied by:Next)) (then (\"MakeSwap\")))) (end (if (!= 0 (+ (score P1) (score P2))) (byScore))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nNumbers from 1 to 9 have to be placed in the squares such that each row, column, cage has each number appearing only once, and the numbers in each cage add up to the assigned number. \n\n###\n\n", "completion": "(game \"Killer Sudoku\" (players 1) (equipment { (board (square 9) (values Cell (range 1 9))) (hints { (hint {0 9 18 27} 27) (hint {1 10} 8) (hint {2 11} 16) (hint {3 12 13 22} 10) (hint {4 5 6} 13) (hint {7 8} 17) (hint {14 15} 15) (hint {16 17 25 26} 14) (hint {19 20 29} 6) (hint {21 30 39} 20) (hint {31 40 49} 17) (hint {23 24 32} 20) (hint {28 37 38} 13) (hint {33 34} 6) (hint {35 44} 12) (hint {36 45} 6) (hint {46 47} 14) (hint {48 56 57} 9) (hint {41 50 59} 8) (hint {42 43 52} 17) (hint {51 60 61} 20) (hint {53 62 71 80} 15) (hint {54 55 63 64} 25) (hint {58 67 68 77} 22) (hint {65 66} 17) (hint {69 78} 4) (hint {70 79} 16) (hint {72 73} 3) (hint {74 75 76} 15)}) (regions {Columns Rows SubGrids}) (regions \"RegionHint\" HintRegions)}) (rules (play (satisfy { (is Sum \"RegionHint\" (hint)) (all Different)})) (end (if (is Solved) (result P1 Win))))) END" }, { "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 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 Ludii game based on the following description\nEssentially, the game consists of a number of objects in \\ The last mover loses. The game involves 5 piles.\n\n###\n\n", "completion": "(game \"Nim\" (players 2) (equipment { (board (rectangle 1 5)) (piece \"Marker\" Neutral)}) (rules (start { (set Count 3 to:(sites {0 4})) (set Count 4 to:(sites {1 3})) (set Count 5 at:2)}) (play (if \"SameTurn\" (or (move Select (from (last To)) (then (if (= (count at:(last To)) 1) (remove (last To)) (and (set Count at:(last To) (- (count at:(last To)) 1)) (moveAgain))))) (move Pass)) (move Select (from (sites Occupied by:Neutral)) (then (if (= (count at:(last To)) 1) (remove (last To)) (and (set Count at:(last To) (- (count at:(last To)) 1)) (moveAgain))))))) (end (if (no Moves Next) (result Next Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayed on an 8x8 board with each player having twelve pieces. Pieces move diagonally one space forward, and can capture opponent's pieces by jumping them in a forward direction if they are adjacent. Capturing must happen if it is possible. Multiple captures are allowed. Once pieces reach the opposite side of the board from their starting position, they become kings and can move diagonally either forwards or backwards. The goal is to capture all of the opponent's pieces. \n\n###\n\n", "completion": "(define \"IsUnpromoted\" (\"IsPieceAt\" \"Counter\" Mover (last To))) (game \"English Draughts\" (\"TwoPlayersNorthSouth\") (\"DraughtsEquipment\" (square 8)) (rules (\"BlackCellsSetup\" 3) (play (if \"SameTurn\" (if \"IsUnpromoted\" (\"HopCapture\" (from (last To)) (directions {FR FL}) (then (\"PromoteIfReach\" (sites Next) \"DoubleCounter\" (\"ReplayIfCanMove\" (\"HopCapture\" (from (last To)) (directions {FR FL})))))) (\"HopDiagonalSequenceCaptureAgain\")) (priority { (or (forEach Piece \"Counter\" (\"HopCapture\" (from) (directions {FR FL}) (then (\"PromoteIfReach\" (sites Next) \"DoubleCounter\" (\"ReplayIfCanMove\" (\"HopCapture\" (from (last To)) (directions {FR FL}))))))) (forEach Piece \"DoubleCounter\" (\"HopDiagonalSequenceCapture\"))) (or (forEach Piece \"Counter\" (\"StepToEmpty\" (directions {FR FL})) (then (\"PromoteIfReach\" (sites Next) \"DoubleCounter\"))) (forEach Piece \"DoubleCounter\" \"StepDiagonalToEmpty\"))}))) (end (\"BlockWin\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\nFor setup, players may drop their initial two workers anywhere on the board. Then players take turns moving either a worker or a soldier. Soldiers move in straight lines and capture by replacement. Workers produce new things based on the piece opposite them (worker+worker = base, worker+base = worker or soldier). The first player to be left with no moves loses. \n\n###\n\n", "completion": "(define \"Produce\" (and (custodial (from (last To)) (between (max 1) if:(is Empty (between)) (apply (set State at:(between) \"ProduceBase\"))) (to if:(\"IsFriendlyWorkerAt\" (to)))) (custodial (from (last To)) (between (max 1) if:(is Empty (between)) (apply (set State at:(between) \"ProduceWorkerOrSoldier\"))) (to if:(\"IsFriendlyBaseAt\" (to)))))) (define \"IsFriendlyBaseAt\" (and (is Friend (who at:#1 #2)) (\"IsPieceAt\" \"Base\" Mover #1))) (define \"IsFriendlyWorkerAt\" (and (is Friend (who at:#1 #2)) (\"IsPieceAt\" \"Soldier\" Mover #1))) (define \"ClearProduction\" (forEach Site (sites Empty) (set State at:(to) 0))) (define \"ProductionSites\" (> (+ (count Sites in:(sites State \"ProduceWorkerOrSoldier\")) (count Sites in:(sites State \"ProduceBase\"))) 0)) (define \"ProduceBase\" 2) (define \"ProduceWorkerOrSoldier\" 1) (game \"Workers and Soldiers\" (players {(player N) (player S)}) (equipment { (board (hex Limping 5 4)) (piece \"Soldier\" Each (move Slide (then \"Produce\"))) (piece \"Shooter\" Each (move Slide (to if:(is Enemy (who at:(to))) (apply (remove (to)))))) (piece \"Base\" Each) (hand Each size:2)}) (rules (start { (place \"Soldier\" \"Hand\" count:2)}) phases:{ (phase \"Movement2\" (play (or (forEach Piece) (move (from (sites Occupied by:Mover container:\"Hand\")) (to (sites Empty)) (then \"Produce\")) (then (if (\"ProductionSites\") (moveAgain))))) { (nextPhase (\"ProductionSites\") \"Produce2\") (nextPhase (not (\"ProductionSites\")) \"Movement1\")}) (phase \"Produce2\" (play (or { (move Add (piece (id \"Soldier\" Mover)) (to (sites Empty) if:(= (state at:(to)) \"ProduceWorkerOrSoldier\")) ((then (set State at:(last To) 0)))) (move Add (piece (id \"Shooter\" Mover)) (to (sites Empty) if:(= (state at:(to)) \"ProduceWorkerOrSoldier\")) ((then (set State at:(last To) 0)))) (move Add (piece (id \"Base\" Mover)) (to (sites Empty) if:(= (state at:(to)) \"ProduceBase\")) ((then (set State at:(last To) 0)))) (move Pass (then \"ClearProduction\"))} (then (if (\"ProductionSites\") (moveAgain))))) { (nextPhase (not (\"ProductionSites\")) \"Movement1\")}) (phase \"Movement1\" (play (or (forEach Piece) (move (from (sites Occupied by:Mover container:\"Hand\")) (to (sites Empty)) (then \"Produce\")) (then (moveAgain)))) { (nextPhase (\"ProductionSites\") \"Produce1\") (nextPhase (not (\"ProductionSites\")) \"Movement2\")}) (phase \"Produce1\" (play (or { (move Add (piece (id \"Soldier\" Mover)) (to (sites Empty) if:(= (state at:(to)) \"ProduceWorkerOrSoldier\")) ((then (set State at:(last To) 0)))) (move Add (piece (id \"Shooter\" Mover)) (to (sites Empty) if:(= (state at:(to)) \"ProduceWorkerOrSoldier\")) ((then (set State at:(last To) 0)))) (move Add (piece (id \"Base\" Mover)) (to (sites Empty) if:(= (state at:(to)) \"ProduceBase\")) ((then (set State at:(last To) 0)))) (move Pass (then \"ClearProduction\"))} (then (moveAgain)))) { (nextPhase (not (\"ProductionSites\")) \"Movement2\")})} (end { (if (no Moves P1) (result P2 Win)) (if (no Moves P2) (result P1 Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\n8x12 board. Each player begins with a complement of pieces, each with their own powers of movement as follows: King (x1): may move one space in any direction; Queen (x1): moves one space diagonally, may leap two spaces diagonally on its first move over any intervening pieces; Man (x1): moves one space in any direction; Fool (x1): moves orthogonally one space; Courier (x2): moves diagonally any distance; Bishop (x2): moves diagonally two spaces, jumping over any intervening pieces; Knight (x2): moves orthogonally one space and then diagonally another space, jumping over any intervening pieces; Rook (x2): moves orthogonally any distance; Pawns (x12): move forward one space or diagonally forward one space to capture. Only the Rooks' and Queens' pawns may move forward two spaces for their first move. Each player must move the Rooks' Pawns and Queens' Pawn in this way in their first three moves. A piece is captured when an opponent's piece moves onto its space. The King is in check when it can be taken on the opponent's next turn; it must not remain in check at the end of the player's turn. When the king cannot move out of check, it is checkmated and the opponent wins. \n\n###\n\n", "completion": "(game \"Currierspiel\" (\"TwoPlayersNorthSouth\") (equipment { (board (rectangle 8 12)) (regions \"StartingPawnRookQueen\" P1 (sites {\"A2\" \"G2\" \"L2\"})) (regions \"StartingPawnRookQueen\" P2 (sites {\"A7\" \"G7\" \"L7\"})) (\"ChessKing\" \"King\") (piece \"Queen\" Each (or (\"StepToNotFriend\" Diagonal) (if (= 1 (state at:(from))) (move Hop (between if:True) (to if:(not (\"IsFriendAt\" (to))) (apply (remove (to))))) (then (set State at:(last To) 0))))) (\"ChessKing\" \"Mann\") (piece \"Fool\" Each (\"StepToNotFriend\" Orthogonal)) (\"ChessBishop\" \"Ferz\") (piece \"Bishop\" Each (move Hop (between if:True) (to if:(not (\"IsFriendAt\" (to))) (apply (remove (to)))))) (\"ChessKnight\" \"Knight\") (\"ChessRook\" \"Rook\") (\"ChessPawn\" \"Pawn\")}) (rules (start { (place \"Pawn1\" (sites Row 1)) (place \"Pawn2\" (sites Row 6)) (place \"Rook1\" {\"A1\" \"L1\"}) (place \"Knight1\" {\"B1\" \"K1\"}) (place \"Ferz1\" {\"C1\" \"J1\"}) (place \"Bishop1\" {\"D1\" \"I1\"}) (place \"Queen1\" coord:\"G1\" state:1) (place \"Fool1\" coord:\"H1\") (place \"Mann1\" coord:\"E1\") (place \"King1\" coord:\"F1\") (place \"Rook2\" {\"A8\" \"L8\"}) (place \"Knight2\" {\"B8\" \"K8\"}) (place \"Ferz2\" {\"C8\" \"J8\"}) (place \"Bishop2\" {\"D8\" \"I8\"}) (place \"Queen2\" coord:\"G8\" state:1) (place \"Fool2\" coord:\"H8\") (place \"Mann2\" coord:\"E8\") (place \"King2\" coord:\"F8\")}) phases: { (phase \"Opening\" (play (forEach Site (intersection (sites Occupied by:Mover) (sites Mover)) (move (from (site)) (to (ahead (site) steps:2 Forward))))) (nextPhase Mover (= 0 (count Sites in:(intersection (sites Occupied by:Mover) (sites Mover)))) \"Playing\")) (phase \"Playing\" (play (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King\" Mover)))))} (end (\"Checkmate\" \"King\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\n9x9 intersecting lines, with diagonals drawn in every 4x4 square formed. Forty pieces per player, placed on the board with the central space unoccupied. Players alternate turns moving one piece to an empty adjacent spot. They may capture an opponent's piece by hopping over it. Multiple hops in one turn are allowed, but not required. The first person to capture all of the opponent's pieces wins. \n\n###\n\n", "completion": "(game \"Meurimueng-rimueng Peuet Ploh\" (players 2) (equipment { (\"AlquerqueBoard\" 9 9) (piece \"Marker\" Each (or (\"HopSequenceCapture\") (\"StepToEmpty\")))}) (rules (\"BeforeAfterCentreSetup\" \"Marker1\" \"Marker2\") (play (if \"SameTurn\" (or (\"HopSequenceCaptureAgain\") (move Pass)) (forEach Piece))) (end (\"ForEachPlayerNoPiecesLoss\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\n 4x3 grid with a 3x 2 grid connected by a \\ The pieces follow the track described by Finkel. The rosettes are protecting the pieces and allow them to replay.\n\n###\n\n", "completion": "(define \"RemoveAPiece\" (move Remove (from))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" (count Pips))) (game \"Royal Game of Ur\" (players 2) (equipment { (board (hole (hole (rectangle 3 8) (poly { {4 0} {4 1} {6 1} {6 0}})) (poly { {4 2} {4 3} {6 3} {6 2}})) {(track \"Track1\" \"20,3,W,N1,E,S1,W,End\" P1 directed:True) (track \"Track2\" \"21,17,W,S1,E,N1,W,End\" P2 directed:True)}) (\"StickDice\" 4) (hand Each) (regions \"Replay\" (sites {\"A1\" \"A3\" \"D2\" \"G1\" \"G3\"})) (piece \"UrPiece\" Each (if (\"IsEndTrack\" \"SiteToMoveOnTrack\") \"RemoveAPiece\" (if (\"IsNotOffBoard\" \"SiteToMoveOnTrack\") (if (or (is Empty \"SiteToMoveOnTrack\") (and (not (\"IsFriendAt\" \"SiteToMoveOnTrack\")) (not (is In \"SiteToMoveOnTrack\" (sites \"Replay\"))))) (move (from) (to \"SiteToMoveOnTrack\" (\"HittingCapture\" (handSite Next))) (then (\"ReplayInMovingOn\" (sites \"Replay\"))))))))}) (rules (start { (place \"UrPiece1\" (handSite P1) count:7) (place \"UrPiece2\" (handSite P2) count:7)}) (play (\"RollMove\" (if (!= (count Pips) 0) (or (forEach Piece) (forEach Piece container:(mover)))))) (end (\"EscapeWin\")))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\n1 extra capture. -> 2 extra captures.\n12 Holes per row. -> 15 Holes per row.\n(define \"HaveToMakeExtraCapture\" (set Var 1)) (define \"NumCapture\" (var)) (define \"NextHoleFrom\" (\"NextSiteOnTrack\" 1 from:#1 #2)) (define \"AHoleHasMoreThanOneCounter\" (not (all Sites (forEach (sites Mover) if:(< 1 (count at:(site)))) if:(= 0 (count at:(site)))))) (define \"NoPiece\" (all Sites (sites Player \"Home\") if:(= 0 (count at:(site))))) (define \"Columns\" 12) (game \"Tsoro (Additional Capture)\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"0,E,N1,W\" loop:True P1) (track \"Track2\" \"24,E,N1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"Track1\")) (regions \"Home\" P2 (sites Track \"Track2\")) (regions \"Inner\" P1 (difference (sites Track \"Track1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"Track2\") (sites Top))) (piece \"Seed\" Shared)}) (rules (start (set Count 2 to:(union (sites Top) (sites Bottom)))) (play (if (< 0 (\"NumCapture\")) (move Remove (forEach (sites Next) if:(< 0 (count at:(site)))) (then (and (if (< 1 (\"NumCapture\")) (moveAgain)) (set Var (- (\"NumCapture\") 1))))) (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(if \"AHoleHasMoreThanOneCounter\" (> (count at:(from)) 1) (and (= (count at:(from)) 1) (= 0 (count at:(\"NextHoleFrom\" (from) Mover)))))) (then (sow \"Track\" owner:(mover) apply:(if (= (count at:(to)) 1) (if (is In (to) (sites Mover \"Inner\")) (if (> (count at:(\"OppositePit\" (to))) 0) (and { (remove (\"OppositePit\" (to))) (if (> (count at:(\"OppositeOuterPit\" (to))) 0) (remove (\"OppositeOuterPit\" (to)))) (moveAgain) (\"HaveToMakeExtraCapture\")}))) (moveAgain))))))) (end (forEach NonMover if:(\"NoPiece\") (result Player Loss)))))\n\n###\n\n", "completion": "(define \"HaveToMakeExtraCapture\" (set Var 2)) (define \"NumCapture\" (var)) (define \"NextHoleFrom\" (\"NextSiteOnTrack\" 1 from:#1 #2)) (define \"AHoleHasMoreThanOneCounter\" (not (all Sites (forEach (sites Mover) if:(< 1 (count at:(site)))) if:(= 0 (count at:(site)))))) (define \"NoPiece\" (all Sites (sites Player \"Home\") if:(= 0 (count at:(site))))) (define \"Columns\" 15) (game \"Tsoro (Additional Capture)\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"0,E,N1,W\" loop:True P1) (track \"Track2\" \"30,E,N1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"Track1\")) (regions \"Home\" P2 (sites Track \"Track2\")) (regions \"Inner\" P1 (difference (sites Track \"Track1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"Track2\") (sites Top))) (piece \"Seed\" Shared)}) (rules (start (set Count 2 to:(union (sites Top) (sites Bottom)))) (play (if (< 0 (\"NumCapture\")) (move Remove (forEach (sites Next) if:(< 0 (count at:(site)))) (then (and (if (< 1 (\"NumCapture\")) (moveAgain)) (set Var (- (\"NumCapture\") 1))))) (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(if \"AHoleHasMoreThanOneCounter\" (> (count at:(from)) 1) (and (= (count at:(from)) 1) (= 0 (count at:(\"NextHoleFrom\" (from) Mover)))))) (then (sow \"Track\" owner:(mover) apply:(if (= (count at:(to)) 1) (if (is In (to) (sites Mover \"Inner\")) (if (> (count at:(\"OppositePit\" (to))) 0) (and { (remove (\"OppositePit\" (to))) (if (> (count at:(\"OppositeOuterPit\" (to))) 0) (remove (\"OppositeOuterPit\" (to)))) (moveAgain) (\"HaveToMakeExtraCapture\")}))) (moveAgain))))))) (end (forEach NonMover if:(\"NoPiece\") (result Player Loss))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n8x8 board, twelve pieces per player, arranged on the black spaces. Pieces move diagonally one space, or may hop an opponent's piece to capture it. Pieces may also capture orthogonally, but must remain on the black spaces. When a piece reaches the opponent's edge of the board, the piece becomes a \\ \n\n###\n\n", "completion": "(game \"Makvoer\" (players 2) (equipment { (board (square 8)) (piece \"Counter\" Each (or { \"StepDiagonalToEmpty\" \"HopDiagonalCapture\" (do (move Hop Orthogonal (between before:1 after:2 if:(\"IsEnemyAt\" (between)) (apply (remove (between)))) (to if:(is Empty (to)))) ifAfterwards:(is In (last To) (sites Phase 0)))} (then (\"PromoteIfReach\" (sites Next) \"DoubleCounter\")))) (piece \"DoubleCounter\" Each (or (move Slide) (\"HopCaptureDistance\"))) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (\"BlackCellsSetup\" 3) (play (forEach Piece)) (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nEach player has 8 holes on each row. -> Each player has 10 holes on each row.\n(define \"PiecesOwnedBy\" (count in:(sites #1 \"Home\"))) (define \"Columns\" 8) (game \"Tshuba\" (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 2 to:(union (sites P1 \"Home\") (sites P2 \"Home\")))) (play (if (= 1 (var \"ExtraCapture\")) (move Remove (difference (sites Next \"Home\") (sites Empty)) count:(count at:(to)) (then (set Var \"ExtraCapture\" 0))) (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover)) if:(< 0 (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)})))))))) (end (if (all Sites (sites Next \"Home\") if:(= 0 (count at:(site)))) (result Mover Win)))))\n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (count in:(sites #1 \"Home\"))) (define \"Columns\" 10) (game \"Tshuba\" (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))) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 2 to:(union (sites P1 \"Home\") (sites P2 \"Home\")))) (play (if (= 1 (var \"ExtraCapture\")) (move Remove (difference (sites Next \"Home\") (sites Empty)) count:(count at:(to)) (then (set Var \"ExtraCapture\" 0))) (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover)) if:(< 0 (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)})))))))) (end (if (all Sites (sites Next \"Home\") if:(= 0 (count at:(site)))) (result Mover Win))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nEach player has 7 holes. -> Each player has 8 holes.\n(define \"PiecesOwnedBy\" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (define \"PlayFrom\" (play (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover #1)) if:(> (count at:(from)) 0)) (then (sow \"Track\" owner:(mover) apply:(if (= (count at:(to)) 1) (if (is In (to) (sites Mover \"Inner\")) (if (> (count at:(\"OppositePit\" (to))) 0) (and (fromTo (from (\"OppositePit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePit\" (to)))) (if (> (count at:(\"OppositeOuterPit\" (to))) 0) (fromTo (from (\"OppositeOuterPit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositeOuterPit\" (to)))))))) (moveAgain))))))) (define \"Columns\" 7) (game \"Muvalavala (Luena)\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"6,W,N1,E\" loop:True P1) (track \"Track2\" \"20,W,N1,E\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"Track1\")) (regions \"Home\" P2 (sites Track \"Track2\")) (regions \"Inner\" P1 (difference (sites Track \"Track1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"Track2\") (sites Top))) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 2 to:(union (sites P1 \"Home\") (sites P2 \"Home\")))) phases:{ (phase \"Opening\" (\"PlayFrom\" \"Inner\") (nextPhase (>= (count Turns) 2) \"Playing\")) (phase \"Playing\" (\"PlayFrom\" \"Home\"))} (end (\"MancalaByScoreWhen\" (no Moves Mover)))))\n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (define \"PlayFrom\" (play (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover #1)) if:(> (count at:(from)) 0)) (then (sow \"Track\" owner:(mover) apply:(if (= (count at:(to)) 1) (if (is In (to) (sites Mover \"Inner\")) (if (> (count at:(\"OppositePit\" (to))) 0) (and (fromTo (from (\"OppositePit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePit\" (to)))) (if (> (count at:(\"OppositeOuterPit\" (to))) 0) (fromTo (from (\"OppositeOuterPit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositeOuterPit\" (to)))))))) (moveAgain))))))) (define \"Columns\" 8) (game \"Muvalavala (Luena)\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"7,W,N1,E\" loop:True P1) (track \"Track2\" \"23,W,N1,E\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"Track1\")) (regions \"Home\" P2 (sites Track \"Track2\")) (regions \"Inner\" P1 (difference (sites Track \"Track1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"Track2\") (sites Top))) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 2 to:(union (sites P1 \"Home\") (sites P2 \"Home\")))) phases:{ (phase \"Opening\" (\"PlayFrom\" \"Inner\") (nextPhase (>= (count Turns) 2) \"Playing\")) (phase \"Playing\" (\"PlayFrom\" \"Home\"))} (end (\"MancalaByScoreWhen\" (no Moves Mover))))) 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.\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": "Modify the Ludii game according to the following option changes:\nThe fox can capture many pieces in a sequence. -> The fox can capture orthogonally one single piece.\n(define \"BottomEmptySites\" (intersection (sites Empty) (sites Bottom))) (define \"HenAdded\" (set Value Prev (- (value Player Prev) 1))) (define \"DidNotCaptured\" (> (value Player Prev) 0)) (define \"HasNotCaptured\" (if (< (value Player Mover) 0) (set Value Mover 1) (set Value Mover (+ 1 (value Player Mover))))) (define \"HopCustomSequenceCapture\" (move Hop #1 #2 (between if:(\"IsEnemyAt\" (between)) (apply (remove (between) #3))) (to if:(is Empty (to))) (then (if (can Move (hop (from (last To)) #2 (between if:(and (not (is In (between) (sites ToClear))) (\"IsEnemyAt\" (between))) (apply (remove (between) #3))) (to if:(is Empty (to))))) (moveAgain))))) (define \"ShouldCapturedButMoved\" (and (is Pending) (not (is In (last To) (\"SitesWithPossibleCaptureInPreviousTurn\"))))) (define \"SitesWithPossibleCaptureInPreviousTurn\" (sites Pending)) (define \"RememberSiteWithPossibleMultiCapture\" (set Pending (sites To (if (\"SameTurn\") #1 (forEach Piece \"Fox\" #2))))) (define \"RememberSiteWithPossibleCapture\" (set Pending (sites To (forEach Piece \"Fox\" #1)))) (game \"Renard et les Poules\" (players 2) (equipment { (\"CrossBoard\" 3 7 use:Vertex diagonals:Alternating) (hand P1) (piece \"Fox\" P1 S (or (\"HopSequenceCapture\") (\"StepToEmpty\"))) (piece \"Hen\" P2 N (\"StepToEmpty\" (directions {Forwards Rightward Leftward})))}) (rules (start { (place \"Fox1\" (centrePoint)) (place \"Hen2\" (union {(expand (sites Bottom)) (sites Row 2) (sites {\"A4\" \"G4\" \"A5\" \"G5\"})}))}) phases:{ (phase \"FoxPhase\" P1 (play (do (\"RememberSiteWithPossibleMultiCapture\" (\"HopSequenceCaptureAgain\") (\"HopSequenceCapture\")) next: (if (\"SameTurn\") (or (\"HopSequenceCaptureAgain\") (move Pass)) (forEach Piece) (then (if (\"ShouldCapturedButMoved\") (\"HasNotCaptured\"))))))) (phase \"HenPhase\" P2 (play (if (and (\"DidNotCaptured\") (!= 0 (count Sites in:(\"BottomEmptySites\")))) (move Add (to (\"BottomEmptySites\")) (then (and (\"HenAdded\") (moveAgain)))) (forEach Piece))))} (end { (if (no Moves P1) (result P1 Loss)) (if (or (is In (where \"Fox\" P1) (sites Bottom)) (no Pieces P2)) (result P1 Win))})))\n\n###\n\n", "completion": "(define \"BottomEmptySites\" (intersection (sites Empty) (sites Bottom))) (define \"HenAdded\" (set Value Prev (- (value Player Prev) 1))) (define \"DidNotCaptured\" (> (value Player Prev) 0)) (define \"HasNotCaptured\" (if (< (value Player Mover) 0) (set Value Mover 1) (set Value Mover (+ 1 (value Player Mover))))) (define \"HopCustomSequenceCapture\" (move Hop #1 #2 (between if:(\"IsEnemyAt\" (between)) (apply (remove (between) #3))) (to if:(is Empty (to))) (then (if (can Move (hop (from (last To)) #2 (between if:(and (not (is In (between) (sites ToClear))) (\"IsEnemyAt\" (between))) (apply (remove (between) #3))) (to if:(is Empty (to))))) (moveAgain))))) (define \"ShouldCapturedButMoved\" (and (is Pending) (not (is In (last To) (\"SitesWithPossibleCaptureInPreviousTurn\"))))) (define \"SitesWithPossibleCaptureInPreviousTurn\" (sites Pending)) (define \"RememberSiteWithPossibleMultiCapture\" (set Pending (sites To (if (\"SameTurn\") #1 (forEach Piece \"Fox\" #2))))) (define \"RememberSiteWithPossibleCapture\" (set Pending (sites To (forEach Piece \"Fox\" #1)))) (game \"Renard et les Poules\" (players 2) (equipment { (\"CrossBoard\" 3 7 use:Vertex diagonals:Alternating) (hand P1) (piece \"Fox\" P1 S (or (\"HopCapture\" (directions {N S E W})) (\"StepToEmpty\" (directions {N S E W})))) (piece \"Hen\" P2 N (\"StepToEmpty\" (directions {Forwards Rightward Leftward})))}) (rules (start { (place \"Fox1\" (centrePoint)) (place \"Hen2\" (union {(expand (sites Bottom)) (sites Row 2) (sites {\"A4\" \"G4\" \"A5\" \"G5\"})}))}) phases:{ (phase \"FoxPhase\" P1 (play (do (\"RememberSiteWithPossibleCapture\" (\"HopCapture\" (directions {N S E W}))) next:(forEach Piece (then (if (\"ShouldCapturedButMoved\") (\"HasNotCaptured\"))))))) (phase \"HenPhase\" P2 (play (if (and (\"DidNotCaptured\") (!= 0 (count Sites in:(\"BottomEmptySites\")))) (move Add (to (\"BottomEmptySites\")) (then (and (\"HenAdded\") (moveAgain)))) (forEach Piece))))} (end { (if (no Moves P1) (result P1 Loss)) (if (or (is In (where \"Fox\" P1) (sites Bottom)) (no Pieces P2)) (result P1 Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6 board. Four counters per hole. Play begins with a simultaneous racing move, where players attempt to be the first to drop the final counter of their sowing into an empty hole. Sowing occurs in an anti-clockwise direction. If the final counter falls into an occupied hole, these are picked up and sowing continues. If the final counter falls into an empty hole, the turn ends. At any time during the sowing, if a hole is made to contain four counters, the owner of the hole in which the four counters are located captures them, unless it is the final hole of the sowing, in which case the player who is sowing captures them. Play continues until a player can no longer move because there are no counters in their row, and the opponent captures the remaining counters. 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. 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 \"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 \"Mewelad\" (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 \"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 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 Ludii game based on the following description\nThe goal of Theseus is to escape of the labyrinth. Theseus can step orthogonally but after steeping the Minotaur comes closer to him twice faster. If the Minotaur catches him, Theseus dies. The board in Wikipedia. The minotaur comes closer to Theseus in looking only the number of orthogonal steps without to take in account the walls. Theseus wins immediately if he reaches the exit.\n\n###\n\n", "completion": "(define \"MinotaurThreat\" (\"GoCloserToTheseus\" E (\"GoCloserToTheseus\" W (\"GoCloserToTheseus\" N (\"GoCloserToTheseus\" S))) (then (\"MinotaurThreatAgain\")))) (define \"MinotaurThreatAgain\" (\"GoCloserToTheseus\" E (\"GoCloserToTheseus\" W (\"GoCloserToTheseus\" N (\"GoCloserToTheseus\" S))))) (define \"GoCloserToTheseus\" (if (and (\"NoEdgeBetweenCells\" (where (id \"Minotaur0\")) (ahead (where (id \"Minotaur0\")) #1)) (\"OriginalCloserToTheseus\" #1)) (\"MoveMinotaur\" #1) #2 #3)) (define \"MoveMinotaur\" (fromTo (from (where (id \"Minotaur0\"))) (to (ahead (from) #1) (apply (if (= (id \"Theseus\") (what at:(to))) (remove (to))))))) (define \"SmartCloserToTheseus\" (> (count Steps (step (from (where (id \"Minotaur0\"))) Orthogonal (to if:(\"NoEdgeBetweenCells\" (from) (to)))) (where (id \"Minotaur0\")) (where (id \"Theseus\"))) (count Steps (step (from (ahead (where (id \"Minotaur0\")) #1)) Orthogonal (to if:(\"NoEdgeBetweenCells\" (from) (to)))) (ahead (where (id \"Minotaur0\")) #1) (where (id \"Theseus\"))))) (define \"OriginalCloserToTheseus\" (> (count Steps Orthogonal (where (id \"Minotaur0\")) (where (id \"Theseus\"))) (count Steps Orthogonal (ahead (where (id \"Minotaur0\")) #1) (where (id \"Theseus\"))))) (define \"NoEdgeBetweenCells\" (\"NoSites\" (intersection (sites Occupied by:Shared on:Edge) (\"EdgeInCommon\" #1 #2)))) (define \"EdgeInCommon\" (intersection (sites Incident Edge of:Cell at:#1) (sites Incident Edge of:Cell at:#2))) (game \"Theseus and the Minotaur\" (players 1) (equipment { (board (square 6)) (piece \"Theseus\" P1 (move Step Orthogonal (to if:(and (is Empty (to)) (\"NoEdgeBetweenCells\" (from) (to)))))) (piece \"Minotaur\" Neutral) (piece \"Marker\" Shared) (regions \"Exit\" {34})}) (rules (start { (place \"Theseus\" coord:\"E4\") (place \"Minotaur0\" coord:\"A6\") (set Shared Edge (union (sites Outer Edge) (sites {65 60 53 47 46 33 41 63 76 48 28 21 36 43 56 62 20})))}) (play (or (forEach Piece) (move Pass) (then (if (not (is In (where (id \"Theseus\")) (sites \"Exit\"))) (\"MinotaurThreat\"))))) (end { (if (no Pieces Mover) (result Mover Loss)) (if (is In (where (id \"Theseus\")) (sites \"Exit\")) (result Mover Win))}))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe version of the game played with 3 players. -> The version of the game played with 4 players.\n(game \"Line and Cross\" (players 3) (equipment { (board (graph vertices:{{2 0} {1 1} {4 1} {7 1} {10 1} {0 2} {2 2} {3 2} {5 2} {9 2} {0 3} {6 3} {7 3} {9 3} {10 3} {11 3} {2 4} {4 4} {6 4} {7 4} {8 4} {10 4} {12 4} {7 5} {9 5} {11 5} {13 5} {1 6} {2 6} {4 6} {6 6} {8 6} {10 6} {12 6} {14 6}} edges:{ {0 6} {5 7} {1 27} {10 11} {2 17} {16 28} {8 9} {3 12} {17 19} {18 30} {29 30} {23 24} {20 31} {13 15} {4 14} {21 32} {25 26} {22 33} {33 34} {1 2} {6 16} {16 17} {27 29} {11 18} {12 19} {19 23} {19 20} {21 22} {15 25} {13 24}}) use:Edge) (piece \"Marker\" Shared)}) (rules (start { (set Shared Edge (sites Board Edge))}) (play (move Remove (sites Occupied by:Shared) (then (and (remove Edge (last To)) (forEach Site (sites Crossing at:(last To) All) (and (remove Edge (to)) (addScore Mover 1))))))) (end (if (no Moves Next) (byScore)))))\n\n###\n\n", "completion": "(game \"Line and Cross\" (players 4) (equipment { (board (graph vertices:{{2 0} {1 1} {4 1} {7 1} {10 1} {0 2} {2 2} {3 2} {5 2} {9 2} {0 3} {6 3} {7 3} {9 3} {10 3} {11 3} {2 4} {4 4} {6 4} {7 4} {8 4} {10 4} {12 4} {7 5} {9 5} {11 5} {13 5} {1 6} {2 6} {4 6} {6 6} {8 6} {10 6} {12 6} {14 6}} edges:{ {0 6} {5 7} {1 27} {10 11} {2 17} {16 28} {8 9} {3 12} {17 19} {18 30} {29 30} {23 24} {20 31} {13 15} {4 14} {21 32} {25 26} {22 33} {33 34} {1 2} {6 16} {16 17} {27 29} {11 18} {12 19} {19 23} {19 20} {21 22} {15 25} {13 24}}) use:Edge) (piece \"Marker\" Shared)}) (rules (start { (set Shared Edge (sites Board Edge))}) (play (move Remove (sites Occupied by:Shared) (then (and (remove Edge (last To)) (forEach Site (sites Crossing at:(last To) All) (and (remove Edge (to)) (addScore Mover 1))))))) (end (if (no Moves Next) (byScore))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game is played on a 4x4 board -> The game is played on a 5x5 board\n(game \"Havannah\" (players 2) (equipment { (board (hex 4)) (piece \"Marker\" Each)}) (rules (play (move Add (to (sites Empty)))) (end (if (or { (is Loop) (is Connected 3 SidesNoCorners) (is Connected 2 Corners)}) (result Mover Win)))))\n\n###\n\n", "completion": "(game \"Havannah\" (players 2) (equipment { (board (hex 5)) (piece \"Marker\" Each)}) (rules (play (move Add (to (sites Empty)))) (end (if (or { (is Loop) (is Connected 3 SidesNoCorners) (is Connected 2 Corners)}) (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": "Modify the Ludii game according to the following option changes:\nThe number of counters to have in the hole to capture in the initial captures before the sequence is 3. -> The number of counters to have in the hole to capture in the initial captures before the sequence is 4.\n(define \"UpdateNumCaptureTwo\" (set Value Mover (+ 1 (value Player Mover)))) (define \"NumCountersToCapture\" (if (is In 3 (\"NumToCapture\")) (+ 1 3) (if (is In 1 (\"NumToCapture\")) 2 (if (is In 3 (\"NumToCapture\")) 4 6)))) (define \"UpdateNumToCapture\" (if (is Mover P1) (and (forget Value \"NumToCaptureP1\" All) (if (is In 3 (\"NumToCapture\")) (remember Value \"NumToCaptureP1\" 1) (if (is In 1 (\"NumToCapture\")) (remember Value \"NumToCaptureP1\" 3) (if (is In 5 (\"NumToCapture\")) (remember Value \"NumToCaptureP1\" 1) (remember Value \"NumToCaptureP1\" 5))))) (and (forget Value \"NumToCaptureP2\" All) (if (is In 3 (\"NumToCapture\")) (remember Value \"NumToCaptureP2\" 1) (if (is In 1 (\"NumToCapture\")) (remember Value \"NumToCaptureP2\" 3) (if (is In 5 (\"NumToCapture\")) (remember Value \"NumToCaptureP2\" 1) (remember Value \"NumToCaptureP2\" 5))))))) (define \"NumToCapture\" (if (is Mover P1) (sites (values Remembered \"NumToCaptureP1\")) (sites (values Remembered \"NumToCaptureP2\")))) (define \"PiecesOwnedBy\" (count at:(mapEntry #1))) (define \"Columns\" 4) (game \"The Concentration Game\" (players 2) (equipment { (mancalaBoard 3 \"Columns\" store:None (track \"Track\" \"0,E,N,W,S2\" loop:True)) (piece \"Seed\" Shared) (regions P1 (union (sites {4}) (sites Bottom))) (regions P2 (union (sites {7}) (sites Top))) (map {(pair P1 5) (pair P2 6)})}) (rules (start { (set Count 10 to:(sites Outer)) (set RememberValue \"NumToCaptureP1\" 3) (set RememberValue \"NumToCaptureP2\" 3) (set RememberValue \"NumCaptureTwoP1\" 0) (set RememberValue \"NumCaptureTwoP2\" 0)}) (play (move Select (from (sites Mover) if:(< 1 (count at:(from)))) (then (sow if:(= (count at:(to)) (\"NumCountersToCapture\")) apply:(and (fromTo (from (to)) (to (mapEntry (mover))) count:(count at:(to))) (if (< (value Player Mover) 5) (\"UpdateNumCaptureTwo\") (\"UpdateNumToCapture\"))) origin:True)))) (end (\"MancalaByScoreWhen\" (no Moves Next)))))\n\n###\n\n", "completion": "(define \"UpdateNumCaptureTwo\" (set Value Mover (+ 1 (value Player Mover)))) (define \"NumCountersToCapture\" (if (is In 4 (\"NumToCapture\")) (+ 1 4) (if (is In 1 (\"NumToCapture\")) 2 (if (is In 3 (\"NumToCapture\")) 4 6)))) (define \"UpdateNumToCapture\" (if (is Mover P1) (and (forget Value \"NumToCaptureP1\" All) (if (is In 4 (\"NumToCapture\")) (remember Value \"NumToCaptureP1\" 1) (if (is In 1 (\"NumToCapture\")) (remember Value \"NumToCaptureP1\" 3) (if (is In 5 (\"NumToCapture\")) (remember Value \"NumToCaptureP1\" 1) (remember Value \"NumToCaptureP1\" 5))))) (and (forget Value \"NumToCaptureP2\" All) (if (is In 4 (\"NumToCapture\")) (remember Value \"NumToCaptureP2\" 1) (if (is In 1 (\"NumToCapture\")) (remember Value \"NumToCaptureP2\" 3) (if (is In 5 (\"NumToCapture\")) (remember Value \"NumToCaptureP2\" 1) (remember Value \"NumToCaptureP2\" 5))))))) (define \"NumToCapture\" (if (is Mover P1) (sites (values Remembered \"NumToCaptureP1\")) (sites (values Remembered \"NumToCaptureP2\")))) (define \"PiecesOwnedBy\" (count at:(mapEntry #1))) (define \"Columns\" 4) (game \"The Concentration Game\" (players 2) (equipment { (mancalaBoard 3 \"Columns\" store:None (track \"Track\" \"0,E,N,W,S2\" loop:True)) (piece \"Seed\" Shared) (regions P1 (union (sites {4}) (sites Bottom))) (regions P2 (union (sites {7}) (sites Top))) (map {(pair P1 5) (pair P2 6)})}) (rules (start { (set Count 10 to:(sites Outer)) (set RememberValue \"NumToCaptureP1\" 4) (set RememberValue \"NumToCaptureP2\" 4) (set RememberValue \"NumCaptureTwoP1\" 0) (set RememberValue \"NumCaptureTwoP2\" 0)}) (play (move Select (from (sites Mover) if:(< 1 (count at:(from)))) (then (sow if:(= (count at:(to)) (\"NumCountersToCapture\")) apply:(and (fromTo (from (to)) (to (mapEntry (mover))) count:(count at:(to))) (if (< (value Player Mover) 5) (\"UpdateNumCaptureTwo\") (\"UpdateNumToCapture\"))) origin:True)))) (end (\"MancalaByScoreWhen\" (no Moves Next))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n8x8 board, with diagonals drawn in the 2x2 squares in each corner, as well as the diagonals of the entire board. Each player has a complement of pieces, with special moves as follows: Min-gyi (x1, \\ \n\n###\n\n", "completion": "(define \"AllPiecesOnBoard\" (= 0 (count Sites in:(union (sites Occupied by:P1 container:\"Hand\") (sites Occupied by:P2 container:\"Hand\"))))) (define \"IfPawnStoreIt\" (if (is Occupied (to)) (fromTo (from (to)) (to (handSite Mover 5))))) (define \"EmptySiteOnPlayerSideOrOccupiedByOwnedPawn\" (difference (intersection (sites Mover) (union (sites Empty) (sites Occupied by:Mover container:\"Board\" component:\"Pawn\"))) (sites \"NoPawnSites\"))) (define \"AnyOwnedSitesOnBoardExceptPawn\" (difference (sites Occupied by:Mover container:\"Board\") (sites Occupied by:Mover container:\"Board\" component:\"Pawn\"))) (define \"PawnWasMovedForward\" (and (is In (last From) (sites Board)) (\"IsPieceAt\" \"Pawn\" Mover (last To)))) (define \"ReplaceAPawn\" (move (from (sites Occupied by:Mover container:\"Hand\" component:\"Pawn\")) (to (\"EmptySitesBehindPawnPositions\")))) (define \"EmptySitesBehindPawnPositions\" (intersection (difference (sites Mover) (union (sites \"PawnSites\") (sites \"NoPawnSites\"))) (sites Empty))) (define \"PawnToReplace\" (!= 0 (count Sites in:(sites Occupied by:Mover container:\"Hand\" component:\"Pawn\")))) (game \"Sittuyin\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (hand Each size:6) (\"ChessKing\" \"King_noCross\") (\"ChessRook\" \"Rook\") (piece \"Elephant\" Each (\"StepToNotFriend\" Forwards)) (\"ChessKnight\" \"Knight\") (\"ChessPawn\" \"Pawn\" ~ (then (\"PromoteIfReach\" (difference (sites \"DiagonalSites\") (sites Mover \"Home\")) \"Queen\"))) (piece \"Queen\" Each (\"StepToNotFriend\" Diagonal)) (regions \"Home\" P1 (expand (sites Bottom) steps:3)) (regions \"Home\" P2 (expand (sites Top) steps:3)) (regions \"NoPawnSites\" (union (difference (sites Row 3) (expand (sites Right) steps:3)) (difference (sites Row 4) (expand (sites Left) steps:3)))) (regions \"PawnSites\" (union { (difference (sites Row 2) (expand (sites Right) steps:3)) (difference (sites Row 3) (expand (sites Left) steps:3)) (difference (sites Row 4) (expand (sites Right) steps:3)) (difference (sites Row 5) (expand (sites Left) steps:3))})) (regions \"DiagonalSites\" (union (union (sites Centre) (expand (sites Corners) steps:1)) (sites {\"C6\" \"F6\" \"F3\" \"C3\"}))) (map \"KingInitPos\" { (pair P1 (coord \"G2\")) (pair P2 (coord \"B7\"))})}) (rules (start { (place \"Pawn1\" (difference (sites Row 2) (expand (sites Right) steps:3))) (place \"Pawn1\" (difference (sites Row 3) (expand (sites Left) steps:3))) (place \"Pawn2\" (difference (sites Row 4) (expand (sites Right) steps:3))) (place \"Pawn2\" (difference (sites Row 5) (expand (sites Left) steps:3))) (place \"King_noCross1\" (handSite P1)) (place \"King_noCross2\" (handSite P2)) (place \"Queen1\" (handSite P1 1)) (place \"Queen2\" (handSite P2 1)) (place \"Elephant1\" (handSite P1 2) count:2) (place \"Elephant2\" (handSite P2 2) count:2) (place \"Knight1\" (handSite P1 3) count:2) (place \"Knight2\" (handSite P2 3) count:2) (place \"Rook1\" (handSite P1 4) count:2) (place \"Rook2\" (handSite P2 4) count:2)}) phases:{ (phase \"PlaceKing\" (play (move (from (sites Occupied by:Mover container:\"Hand\" component:\"King_noCross\")) (to (mapEntry \"KingInitPos\" Mover)))) (nextPhase Mover \"PlaceFirstElephant\")) (phase \"PlaceFirstElephant\" (play (move (from (sites Occupied by:Mover container:\"Hand\" component:\"Elephant\")) (to (sites Around (mapEntry \"KingInitPos\" Mover))))) (nextPhase Mover \"PlaceOtherPieces\")) (phase \"PlaceOtherPieces\" (play (if (\"PawnToReplace\") (\"ReplaceAPawn\") (or (if (\"AllPiecesOnBoard\") (or (forEach Piece \"Pawn\" \"StepForwardToEmpty\") (move (from (\"AnyOwnedSitesOnBoardExceptPawn\")) (to (\"EmptySiteOnPlayerSideOrOccupiedByOwnedPawn\") (apply (\"IfPawnStoreIt\"))) (then (if (\"PawnToReplace\") (moveAgain)))))) (move (from (sites Occupied by:Mover container:\"Hand\")) (to (\"EmptySiteOnPlayerSideOrOccupiedByOwnedPawn\") (apply (\"IfPawnStoreIt\"))) (then (if (\"PawnToReplace\") (moveAgain))))))) (nextPhase (\"PawnWasMovedForward\") \"Playing\")) (phase \"Playing\" (play (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King_noCross\" Mover)))) (end (\"Checkmate\" \"King_noCross\")))})) END" }, { "prompt": "Construct a Ludii game based on the following description\n3x15 board, with the central spot marked. Fifteen pieces per player, arranged along the outer two rows of the board. Another piece, the Gonagas (\\ \n\n###\n\n", "completion": "(define \"DieNotUsed\" (!= (pips) 0)) (define \"MoveGonagasWithStoredPips\" (forEach Value (values Remembered \"Pips\") (move Slide (from (from) level:(level) if:(= (state at:(from) level:(level)) (mover))) Orthogonal (between (exact (value)) if:True) (to (apply if:(or (is Empty (to)) (and (\"IsEnemyAt\" (to)) (\"IsActivated\" (to) (topLevel at:(to))))))) (then (and { (forEach Level (last To) (if (!= (topLevel at:(last To)) (level)) (remove (last To) level:(level)))) (forget Value \"Pips\" (count Steps (last From) (last To))) (if (!= 1 (size Array (values Remembered \"Pips\"))) (moveAgain))}))))) (define \"MovePieceWithStoredPips\" (forEach Value (values Remembered \"Pips\") (move (from (from) level:(level) if:(or (\"IsActivated\" (from) (level)) (\"Sahkku\" (value)))) (to (\"NextSiteOnTrack\" (value) from:(from)) if:(or { (= (id \"Gonagas\" Shared) (what at:(to))) (is Empty (to)) (and (\"IsEnemyAt\" (to)) (\"IsActivated\" (to) (topLevel at:(to))))}) (apply (and { (if (not (\"IsActivated\" (from) (level))) (\"ActivePiece\" (from) (level))) (forget Value \"Pips\" (value)) (if (= (what at:(to)) (id \"Gonagas\" Shared)) (set State at:(to) (mover)) (if (\"IsEnemyAt\" (to)) (remove (to))))}))) (then (if (!= 0 (size Array (values Remembered \"Pips\"))) (moveAgain)))))) (define \"IsActivated\" (= 1 (state at:#1 level:#2))) (define \"ActivePiece\" (set State at:#1 level:#2 1)) (define \"NumberOfSahkku\" (if (and (\"Sahkku\" (\"Die1\") 1) (all DiceEqual)) 3 (if (or { (and {(not (\"Sahkku\" (\"Die1\"))) (\"Sahkku\" (\"Die2\")) (\"Sahkku\" (\"Die3\"))}) (and {(\"Sahkku\" (\"Die1\")) (not (\"Sahkku\" (\"Die2\"))) (\"Sahkku\" (\"Die3\"))}) (and {(\"Sahkku\" (\"Die1\")) (\"Sahkku\" (\"Die2\")) (not (\"Sahkku\" (\"Die3\")))})}) 2 (if (or { (and {(not (\"Sahkku\" (\"Die1\"))) (not (\"Sahkku\" (\"Die2\"))) (\"Sahkku\" (\"Die3\"))}) (and {(\"Sahkku\" (\"Die1\")) (not (\"Sahkku\" (\"Die2\"))) (not (\"Sahkku\" (\"Die3\")))}) (and {(not (\"Sahkku\" (\"Die1\"))) (\"Sahkku\" (\"Die2\")) (not (\"Sahkku\" (\"Die3\")))})}) 1 0)))) (define \"IsASahkku\" (is AnyDie 1)) (define \"Die3\" (face 47)) (define \"Die2\" (face 46)) (define \"Die1\" (face 45)) (define \"Sahkku\" (= 1 #1)) (game \"Sahkku\" (players 2) (equipment { (board (rectangle 3 15) { (track \"Track1\" \"0,E,N1,W,N1,E,S1,W\" loop:True P1) (track \"Track2\" \"44,W,S1,E,S1,W,N1,E\" loop:True P2)}) (dice d:4 from:0 num:3) (piece \"Marker\" Each (forEach Die if:(\"DieNotUsed\") (move (from (from) level:(level) if:(or (\"IsActivated\" (from) (level)) (\"Sahkku\" (pips)))) (to (\"NextSiteOnTrack\" (pips) from:(from)) if:(or { (= (id \"Gonagas\" Shared) (what at:(to))) (is Empty (to)) (and (\"IsEnemyAt\" (to)) (\"IsActivated\" (to) (topLevel at:(to))))}) (apply (and { (if (not (\"IsActivated\" (from) (level))) (\"ActivePiece\" (from) (level))) (forget Value \"Pips\" (pips)) (if (= (what at:(to)) (id \"Gonagas\" Shared)) (set State at:(to) (mover)) (if (\"IsEnemyAt\" (to)) (remove (to))))}))) (then (\"ReplayNotAllDiceUsed\"))))) (piece \"Gonagas\" Shared (forEach Die if:(\"DieNotUsed\") (move Slide (from (from) level:(level) if:(= (state at:(from) level:(level)) (mover))) Orthogonal (between (exact (pips)) if:True) (to (apply if:(or (is Empty (to)) (and (\"IsEnemyAt\" (to)) (\"IsActivated\" (to) (topLevel at:(to))))))) (then (and (forEach Level (last To) (if (!= (topLevel at:(last To)) (level)) (remove (last To) level:(level)))) (\"ReplayNotAllDiceUsed\"))))))}) (rules (start { (place Stack \"Marker1\" (sites Bottom)) (place Stack \"Marker2\" (sites Top)) (place Stack \"Gonagas\" (centrePoint))}) phases:{ (phase \"Opening\" (play (do (and (roll) (if (and (!= 0 (value Player Mover)) (= 0 (count MovesThisTurn))) (set Value Mover 0))) next:(move Pass (then (and (if (\"IsASahkku\") (set Value Mover (+ (\"NumberOfSahkku\")(value Player Mover)))) (forEach Die (if (!= 0 (pips)) (remember Value \"Pips\" (pips))))))) (then (if (or (<= 3 (value Player Mover)) (!= 2 (count MovesThisTurn))) (moveAgain) (and (forget Value \"Pips\" All) (set Value Mover 0)))))) (nextPhase Mover (<= 3 (value Player Mover)) \"PlayingPips\")) (phase \"PlayingPips\" (play (\"RollEachNewTurnMove\" (or (forEach Piece \"MovePieceWithStoredPips\") (forEach Piece \"MoveGonagasWithStoredPips\" Shared)))) (nextPhase Mover (= 0 (size Array (values Remembered \"Pips\"))) \"Playing\")) (phase \"Playing\" (play (\"RollEachNewTurnMove\" (or (forEach Piece) (forEach Piece Shared)))))} (end (\"CaptureAll\" Next)))) 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": "Describe the mechanics of the following Ludii game\n(define \"DiagonalSENW\" (union (sites Direction from:(last To) SE included:True) (sites Direction from:(last To) NW))) (define \"DiagonalNESW\" (union (sites Direction from:(last To) NE included:True) (sites Direction from:(last To) SW))) (game \"Diagonals\" (players 2) (equipment { (board (square 8) use:Vertex) (piece \"Ball\" Each)}) (rules (play (move Add (to (sites Empty)) (then (and (if (not (is In (last To) (sites {\"A8\" \"H1\"}))) (if (all Sites (\"DiagonalNESW\") if:(is Occupied (site))) (addScore Mover (count Sites in:(forEach (\"DiagonalNESW\") if:(\"IsFriendAt\" (site))))))) (if (not (is In (last To) (sites {\"A1\" \"H8\"}))) (if (all Sites (\"DiagonalSENW\") if:(is Occupied (site))) (addScore Mover (count Sites in:(forEach (\"DiagonalSENW\") if:(\"IsFriendAt\" (site))))))))))) (end (if (is Full) (byScore)))))\n\n###\n\n", "completion": "TURN - On each turn, each player drops a friendly stone on an empty cell. If a diagonal line is full (i.e., there are no empty cells on that diagonal), the player who dropped the last stone achieves so many points as the number of friendly stones on the finished line.\n \n Two lines can be finished on one turn, the player achieves points for both lines (the dropped stone counts twice, once for each diagonal).\n A diagonal line must have at least 2 stones. So, corner cells do not count as diagonals.\n \n GOAL - When all cells are occupied, wins the player with more points. END" }, { "prompt": "Construct a Ludii game based on the following description\nEach turn consists of moving a piece one square orthogonally in any direction. An animal may eat any animal smaller than itself by moving on to its square. The only exception to this rule is that the rat can kill the elephant. If the same animals meet, the animal moving on to a square eats the animal already there. Three pieces have special powers. When the rat reaches the river it can enter it and move along those squares squares as if it were any other. If it is in the river no other animal can attack it. The rat is unable to attack the elephant from the river. If both rats meet in the river the moving piece eats the other one. When a lion or a tiger reaches a square on the edge of the river, at the next move it can jump over the river in any orthogonal direction, landing on the nearest land square. It captures any smaller animal on that square: if, however, there is a rat in the river in the line of the jump, it blocks this move. Each side has three trap-squares and the player's own pieces may move on and off them without restriction, but if an enemy animal occupies a trap-square, it loses all its power and becomes weaker than any defending piece. As soon as it moves out of the trap it regains its full strength. A player may not move any of his animals on to his own den. The player who moves any of their pieces into the enemy's den wins. \n\n###\n\n", "completion": "(define \"RestoredPower\" (set State at:(last To) (mapEntry (what at:(last To))))) (define \"LosePower\" (set State at:(last To) 0)) (define \"HopTheWater\" (move Hop #1 (between #2 if:(is In (between) (forEach (sites \"Water\") if:(is Empty (site)))) (apply (remove (between)))) (to if:(and { (not (is In (to) (sites \"Water\"))) (not (\"IsFriendAt\" (to))) (<= (state at:(to)) (state at:(from)))})))) (define \"StepMove\" (move Step Orthogonal (to if:(and (is In (to) (difference (union (sites Occupied by:Next) (sites Empty)) (union (sites \"Water\") (sites Mover)))) (<= (state at:(to)) (state at:(from)))) (apply (remove (to)))))) (game \"Jungle\" (players 2) (equipment { (board (rectangle 9 7)) (piece \"Elephant\" Each \"StepMove\") (piece \"Lion\" Each (or { \"StepMove\" (\"HopTheWater\" (directions {W E}) (max 2)) (\"HopTheWater\" (directions {N S}) (max 3))})) (piece \"Tiger\" Each (or { \"StepMove\" (\"HopTheWater\" (directions {W E}) (max 2)) (\"HopTheWater\" (directions {N S}) (max 3))})) (piece \"Leopard\" Each \"StepMove\") (piece \"Dog\" Each \"StepMove\") (piece \"Wolf\" Each \"StepMove\") (piece \"Cat\" Each \"StepMove\") (piece \"Rat\" Each (move Step Orthogonal (to if:(and (is In (to) (difference (union (sites Occupied by:Next) (sites Empty)) (sites Mover))) (or (<= (state at:(to)) (state at:(from))) (and (not (is In (from) (sites \"Water\"))) (\"IsPieceAt\" \"Elephant\" Next (to))))) (apply (remove (to)))))) (regions \"Water\" (sites {\"B4\" \"C4\" \"B5\" \"C5\" \"B6\" \"C6\" \"E4\" \"F4\" \"E5\" \"F5\" \"E6\" \"F6\"})) (regions \"Trap\" (sites {\"C1\" \"E1\" \"D2\" \"D8\" \"C9\" \"E9\"})) (regions \"Den\" P1 (sites {\"D1\"})) (regions \"Den\" P2 (sites {\"D9\"})) (map {(pair 1 8) (pair 2 8) (pair 3 7) (pair 4 7) (pair 5 6) (pair 6 6) (pair 7 5) (pair 8 5) (pair 9 4) (pair 10 4) (pair 11 3) (pair 12 3) (pair 13 2) (pair 14 2) (pair 15 1) (pair 16 1)})}) (rules (start { (place \"Rat1\" coord:\"G3\" state:1) (place \"Rat2\" coord:\"A7\" state:1) (place \"Cat1\" coord:\"B2\" state:2) (place \"Cat2\" coord:\"F8\" state:2) (place \"Wolf1\" coord:\"C3\" state:3) (place \"Wolf2\" coord:\"E7\" state:3) (place \"Dog1\" coord:\"F2\" state:4) (place \"Dog2\" coord:\"B8\" state:4) (place \"Leopard1\" coord:\"E3\" state:5) (place \"Leopard2\" coord:\"C7\" state:5) (place \"Tiger1\" coord:\"A1\" state:6) (place \"Tiger2\" coord:\"G9\" state:6) (place \"Lion1\" coord:\"G1\" state:7) (place \"Lion2\" coord:\"A9\" state:7) (place \"Elephant1\" coord:\"A3\" state:8) (place \"Elephant2\" coord:\"G7\" state:8)}) (play (forEach Piece (then (and (if (is In (last From) (sites \"Trap\")) \"RestoredPower\") (if (is In (last To) (sites \"Trap\")) \"LosePower\"))))) (end (\"ReachWin\" (sites Next) Mover)))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"MoveOn\" (if (\"IsNotOffBoard\" #1) (move (from (from) level:(level)) (to #1 if:(is Empty #1))) #2)) (define \"ReachEastDoor\" (= (last To) \"EastDoor\")) (define \"MadeACompleteCircuit\" (if (= 1 (state at:(where \"Stick\" Mover))) (is In \"EastDoor\" (sites Track \"TrackCW\" from:(\"NextSite\" (last From) \"TrackCW\") to:(last To))) (is In \"EastDoor\" (sites Track \"TrackCCW\" from:(\"NextSite\" (last From) \"TrackCCW\") to:(last To))))) (define \"NextSite\" (\"NextSiteOnTrack\" 1 from:#1 #2)) (define \"ThrowValue\" (if (= (count Pips) 3) 5 (if (= (count Pips) 0) 10 (if (= (count Pips) 1) 2 (if (= (face 44) 1) 15 3))))) (define \"SiteToMoveOnTrackCCW\" (\"NextSiteOnTrack\" (\"ThrowValue\") \"TrackCCW\")) (define \"SiteToMoveOnTrackCW\" (\"NextSiteOnTrack\" (\"ThrowValue\") \"TrackCW\")) (define \"SiteToMoveOnSelectedTrack\" (if (= (state at:(from)) 1) (\"NextSiteOnTrack\" (\"ThrowValue\") \"TrackCW\") (\"NextSiteOnTrack\" (\"ThrowValue\") \"TrackCCW\"))) (define \"EastDoor\" 38) (game \"Owasokotz\" (players 4) (equipment { (\"FortyStonesWithFourGapsBoard\" { (track \"TrackCW\" {39 35 33 31 29 27 25 23 21 19 38 17 15 13 11 9 7 5 3 1 37 0 2 4 6 8 10 12 14 16 36 18 20 22 24 26 28 30 32 34} loop:True) (track \"TrackCCW\" {39 34 32 30 28 26 24 22 20 18 36 16 14 12 10 8 6 4 2 0 37 1 3 5 7 9 11 13 15 17 38 19 21 23 25 27 29 31 33 35} loop:True)}) (regions \"AllSites\" (sites Board)) (piece \"Stick\" Each (if (= (state at:(from)) 0) (or (\"MoveOn\" (\"NextSiteOnTrack\" (\"ThrowValue\") \"TrackCCW\") (then (set State at:(last To) 2))) (\"MoveOn\" (\"NextSiteOnTrack\" (\"ThrowValue\") \"TrackCW\") (then (set State at:(last To) 1)))) (\"MoveOn\" (\"SiteToMoveOnSelectedTrack\" (\"ThrowValue\"))))) (\"StickDice\" 3) (hand Each)}) (rules (start (place Stack items:{\"Stick4\" \"Stick3\" \"Stick2\" \"Stick1\"} Edge \"EastDoor\")) (play (\"RollMove\" (forEach Piece))) (end (if (and (not (was Pass)) (\"MadeACompleteCircuit\")) (result Mover Win)))))\n\n###\n\n", "completion": "Forty stones arranged in a circle, with a larger gap after every tenth stone. These gaps are known as doors. Any number of players, each player begins with one piece, which begins at the east door. Three sticks used as dice, black on one side, white on the other, with one stick notched on the white side. The throws are as follows: two black with one notched white side up = 15; three white sides up = 10; two black and one white, not notched = 3, two white and one black = 2, three black = 5. Throws of 10 and 15 grant the player another throw. Players may move in either direction around the circle. To win, the player must complete a circuit of the board and pass the east door. The game has 4 players. The goal is to pass the east door. END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"IsUnpromoted\" (\"IsPieceAt\" \"Counter\" Mover (last To))) (game \"Pleasant Draughts\" (\"TwoPlayersNorthSouth\") (\"DraughtsEquipment\" (square 8)) (rules (\"BlackCellsSetup\" 3) (play (if \"SameTurn\" (or (if \"IsUnpromoted\" (\"HopCapture\" (from (last To)) (directions {FR FL}) (then (\"PromoteIfReach\" (sites Next) \"DoubleCounter\" (\"ReplayIfCanMove\" (\"HopCapture\" (from (last To)) (directions {FR FL})))))) (\"HopDiagonalSequenceCaptureAgain\")) (move Pass)) (or (forEach Piece \"Counter\" (or (\"HopCapture\" (from) (directions {FR FL}) (then (\"PromoteIfReach\" (sites Next) \"DoubleCounter\" (\"ReplayIfCanMove\" (\"HopCapture\" (from (last To)) (directions {FR FL})))))) (\"StepToEmpty\" (directions {FR FL})) (then (\"PromoteIfReach\" (sites Next) \"DoubleCounter\")))) (forEach Piece \"DoubleCounter\" (or (\"StepDiagonalToEmpty\") (\"HopDiagonalSequenceCapture\")))))) (end (\"CaptureAll\" Next))))\n\n###\n\n", "completion": "Played on an 8x8 board with each player having twelve pieces. Pieces move diagonally one space forward, and can capture opponent's pieces by jumping them if they are adjacent. Capturing is not mandatory. Multiple captures are allowed. Once pieces reach the opposite side of the board from their starting position, they become kings and can move diagonally either forwards or backwards. The goal is to capture all of the opponent's pieces.\n END" }, { "prompt": "Construct a Ludii game based on the following description\n4x4 board. One player plays as four tigers, which begin the board placed in the four corner spaces. The other player plays as twelve oxen. The first move is made by placing one of the oxen on an empty space, followed by a move by the tiger closest to the ox. Players continue alternating moves, the oxen player placing an ox and the tiger player moving a tiger. When moving, pieces move to an empty adjacent spot orthogonally. Once all of the oxen are placed, the players alternate turns moving their pieces on the board. Pieces may capture another piece by hopping over an adjacent opponent's piece to an empty space immediately on the opposite side of it. Tigers capture orthogonally, oxen capture diagonally. Oxen may also capture a tiger by blocking it from being able to move. The oxen win by reducing the tigers to two. \n\n###\n\n", "completion": "(define \"MinDistanceWithCorners\" (min (results from:(last To) to:(sites Corners) (count Steps (from) (to))))) (define \"RemoveAllTigersWithNoMove\" (then (forEach Site (sites Occupied by:Next) (if (not (can Move (or (step (from (site)) Orthogonal (to if:(is Empty (to)))) (hop (from (site)) Orthogonal (between if:(= (who at:(between)) P1) (apply (remove (between)))) (to if:(is Empty (to))))))) (remove (site)))))) (game \"Len Cua Kin Ngoa\" (players 2) (equipment { (board (square 4)) (hand P1) (piece \"Ox\" P1 (or (\"HopDiagonalCapture\") \"StepOrthogonalToEmpty\")) (piece \"Tiger\" P2 (or (\"HopOrthogonalCapture\") \"StepOrthogonalToEmpty\"))}) (rules (start { (place \"Ox1\" (handSite P1) count:12) (place \"Tiger2\" (sites Corners))}) phases:{ (phase \"Placement\" P1 (play (move (from (handSite P1)) (to (sites Empty)) (\"RemoveAllTigersWithNoMove\"))) (nextPhase (\"HandEmpty\" P1) \"MovementP1\")) (phase \"MovementP1\" P1 (play (forEach Piece (\"RemoveAllTigersWithNoMove\")))) (phase \"FirstTigerMovement\" P2 (play (forEach Piece (if (= (count Steps (from) (last To)) (\"MinDistanceWithCorners\")) (or (\"HopOrthogonalCapture\") \"StepToEmpty\")))) (nextPhase Mover \"MovementP2\")) (phase \"MovementP2\" P2 (play (forEach Piece)))} (end { (if (no Pieces P1) (result P2 Win)) (if (>= 2 (count Pieces P2)) (result P1 Win))}))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"ReachedTarget\" (is In (last To) (sites Mover))) (game \"Bombardment\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (piece \"NuclearBomb\" Each (or (\"StepForwardsToEmpty\") (move Select (from (from)) (then (forEach Site (sites Around (last To) includeSelf:True) (if (is Occupied (site)) (remove (site)))))))) (regions P1 (sites Top)) (regions P2 (sites Bottom))}) (rules (start { (place \"NuclearBomb1\" (expand (sites Bottom))) (place \"NuclearBomb2\" (expand (sites Top)))}) (play (forEach Piece)) (end (if (or (\"ReachedTarget\") (no Pieces Next)) (result Mover Win)))))\n\n###\n\n", "completion": "MOVE - On each turn, each player must do one of the following actions:\n - Move one friendly stone (the missiles) one cell forward (orthogonally or diagonally)\n - Explode one friendly stone, i.e., capture all stones of either color orthogonally and diagonally adjacent including itself.\n \n GOAL - Wins the player that move a stone into the last row, or is the only with stones in the board. END" }, { "prompt": "Construct a Ludii game based on the following description\nFutoshiki is played on a square grid. The starting state may have numbers placed in the squares of the grid. The goal is to place numbers in the squares so that each row and each column has only one instance of a particular number. The \\ \n\n###\n\n", "completion": "(game \"Futoshiki\" (players 1) (equipment { (board (square 5) (values Vertex (range 1 5)) use:Vertex) (hints { (hint {0 1}) (hint {1 2}) (hint {8 9}) (hint {21 20}) (hint {23 22}) (hint {24 23})} Vertex) (regions {Columns Rows})}) (rules (start (set { {9 4} {12 4} {15 4} {19 2}})) (play (satisfy { (forAll Hint (< (from) (to))) (all Different)})) (end (if (is Solved) (result P1 Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayers take turns removing a piece of their colour whose number is higher than the last piece they removed (free choice of first piece). A player with no legal moves passes. The game ends when neither player has any legal moves and is won by the player with the fewest remaining pieces (draw if equal). \n\n###\n\n", "completion": "(define \"StoreStateRemoved\" (set Value Mover (state at:(last To)))) (define \"LastStateRemove\" (value Player Mover)) (game \"Greater\" (players 2) (equipment { (board (square 4)) (piece \"Disc\" Each)}) (rules (start { (place \"Disc1\" {\"A1\"} state:1) (place \"Disc1\" {\"B1\"} state:2) (place \"Disc1\" {\"C1\"} state:3) (place \"Disc1\" {\"D1\"} state:4) (place \"Disc1\" {\"A2\"} state:5) (place \"Disc1\" {\"B2\"} state:6) (place \"Disc1\" {\"C2\"} state:7) (place \"Disc1\" {\"D2\"} state:8) (place \"Disc2\" {\"A3\"} state:5) (place \"Disc2\" {\"B3\"} state:6) (place \"Disc2\" {\"C3\"} state:7) (place \"Disc2\" {\"D3\"} state:8) (place \"Disc2\" {\"A4\"} state:1) (place \"Disc2\" {\"B4\"} state:2) (place \"Disc2\" {\"C4\"} state:3) (place \"Disc2\" {\"D4\"} state:4)}) (play (move Select (from (forEach (sites Occupied by:Mover) if:(> (state at:(site)) (\"LastStateRemove\")))) (then (and (\"StoreStateRemoved\") (remove (last To)))))) (end (if (and (no Moves P1) (no Moves P2)) (byScore { (score P1 (- (count Pieces P1))) (score P2 (- (count Pieces P2)))}))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"Tsatsarandi\" (players 2) (equipment { (board (square 8)) (\"ChessPawn\" \"Pawn\") (\"ChessRook\" \"Rook\") (\"ChessKing\" \"King_noCross\") (piece \"Bishop_noCross\" (move Hop Diagonal (between if:True) (to if:(or (is Empty (to)) (\"IsEnemyAt\" (to))) (apply (remove (to)))))) (\"ChessKnight\" \"Knight\") (piece \"Ferz_noCross\" (\"StepToNotFriend\" Diagonal))}) (rules (start { (place \"King_noCross1\" coord:\"E1\") (place \"King_noCross2\" coord:\"E8\") (place \"Ferz_noCross1\" coord:\"D1\") (place \"Ferz_noCross2\" coord:\"D8\") (place \"Bishop_noCross1\" {\"C1\" \"F1\"}) (place \"Bishop_noCross2\" {\"C8\" \"F8\"}) (place \"Knight1\" {\"B1\" \"G1\"}) (place \"Knight2\" {\"B8\" \"G8\"}) (place \"Rook1\" {\"A1\" \"H1\"}) (place \"Rook2\" {\"A8\" \"H8\"}) (place \"Pawn1\" (sites Row 1)) (place \"Pawn2\" (sites Row 6))}) (play (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King_noCross\" Mover)))) (end (\"Checkmate\" \"King_noCross\"))))\n\n###\n\n", "completion": "8x8 board. Pieces have specific moves, as follows: Mai (x1): moves one space in any direction; Chiroma (x1): Moves one space diagonally; Bintu (x2): moves exactly two spaces diagonally, jumping over the first square; Fer (x2): moves orthogonally one space and then diagonally another space, jumping over any intervening pieces; Kaigamma (x2): moves orthogonally any distance; Gollo: (x8) move one space forward orthogonally, or one space diagonally forward to capture. Pieces capture the opponent's pieces by moving onto the spot they occupy. No en passant; no castling. When the Mai can be captured at the beginning of the opponent's next turn, it is in check and must be removed from this state on the player's turn. If this is not possible, it is checkmate and the player who threatened the Mai wins. END" }, { "prompt": "Construct a Ludii game based on the following description\nPlay is on a grid of any number of squares. Some of the squares are marked with a number which indicates the number of squares adjacent to it are colored. Player determines which squares are colored and colors them in, revealing a picture. \n\n###\n\n", "completion": "(game \"Fill A Pix\" (players 1) (equipment { (board (square 10) (values Cell (range 0 1))) (hints { (hint 1 0) (hint 3 3) (hint 5 3) (hint 7 3) (hint 9 0) (hint 13 6) (hint 16 6) (hint 21 4) (hint 22 5) (hint 23 6) (hint 27 7) (hint 28 5) (hint 30 5) (hint 32 6) (hint 34 8) (hint 35 9) (hint 37 8) (hint 38 5) (hint 40 4) (hint 42 3) (hint 45 8) (hint 46 8) (hint 49 1) (hint 50 2) (hint 54 3) (hint 56 5) (hint 60 0) (hint 63 0) (hint 68 2) (hint 69 1) (hint 75 0) (hint 77 2) (hint 81 0) (hint 84 0) (hint 89 4) (hint 96 1) (hint 96 1) (hint 98 4) (hint 99 4)}) (piece \"Square\" P1)}) (rules (play (satisfy { (forAll Hint (is Count (sites Around (from) includeSelf:True) of:1 (hint)))})) (end (if (is Solved) (result P1 Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nGoal: Score the most points: \n -- One point for each stone in one's largest group.\n -- Bonus points are also awarded for certain captured stones.\n \n The board starts empty.\n Players take alternating turns placing one of their stones onto an empty site.\n Directly after placement, every site of the board must remain connected to an empty perimeter site via a continuous path of empty sites, and the stone that was placed must be next to any 2 empty sites. \n \n Capture \n After placement, simultaneously remove all the stones adjacent to the placed stone that are no longer next to 2 empty sites.\n \n There is no passing. The game ends when no more placements can be made. \n \n Ties are broken in favor of the underdog by compairing cascading largest groups (excluding tied pairs) Tie breaker scores are negative, so largest group LOSES.\n \n Plateau version (mauve background):\n Connection to the edge is by omni-directional steps. Stone groups are orthogonal only. \n Players score one point for every stone in their largest group, plus a bonus point for each captured opponent's stone.\n \n The player with the higher score wins. \n \n Floodplain version (green background):\n Connection to the edge is by orthogonal steps. Stone groups are omni-directional adjacent. \n Players score one point for every stone in their largest group, plus a bonus point for each of their stones that the opponent removed from the board.\n \n The player with the higher score wins. Order 9 board Watershed Plateau: Omni-Square Grid - Orthogonal group scoring, Bonus for opponent's captured, Largest group loses a tie.\n\n###\n\n", "completion": "(define \"ColourBackground\" (colour 156 130 126)) (define \"ColourBackground2\" (colour 156 130 126)) (define \"ColourBackground1\" (colour 126 130 156)) (define \"SquareDiagonal\" (board (square 9) use:Vertex)) (define \"SquareGrid\" (board (square 9) use:Cell)) (define \"BoardUsed\" \"SquareDiagonal\") (define \"ConnectionDirection\" All) (define \"ScoreConnectionDirection\" Orthogonal) (define \"AllHave1Connection2Edge\" (all Sites #1 if:(or (and (is Empty (site)) (is In (site) (sites Outer))) (!= Infinity (count Steps (step \"ConnectionDirection\" (to if:(is Empty (to)))) (site) (difference (sites Outer) (site))))))) (define \"CapturingAtScoreWhat4Who\" (forEach Value (array #1) (if (> 2 (count Sites in:(sites Around (value) \"ConnectionDirection\" if:(is Empty (to))))) (if (is #2 (who at:(value))) (remove (value) (then (if (is Empty (handSite #3)) (add (piece (id \"Disc\" #2)) (to (handSite #3)) (then (set Value at:(handSite #3) (+ 1 (value Piece at:(handSite #3)))))) (set Value at:(handSite #3) (+ 1 (value Piece at:(handSite #3))))))) (remove (value)))))) (define \"Scoring\" (set Var \"MoverScore\" (+ (value Piece at:(handSite Mover)) (\"GroupCount\" Mover)) (then (set Var \"NextScore\" (+ (value Piece at:(handSite Next)) (\"GroupCount\" Next)) (then (\"CascadeTiebreaker\")))))) (define \"CascadeTiebreaker\" (if (= (var \"MoverScore\") (var \"NextScore\")) (and (set Score Mover (* -1 (\"CascadeScore\" Mover Next))) (set Score Next (* -1 (\"CascadeScore\" Next Mover)))) (\"CascadeTie\"))) (define \"CascadeTie\" (and (set Score Mover (var \"MoverScore\")) (set Score Next (var \"NextScore\")))) (define \"CascadeScore\" (max 0 (max (difference (sizes Group \"ScoreConnectionDirection\" #1) (sizes Group \"ScoreConnectionDirection\" #2))))) (define \"GroupCount\" (max 0 (max (sizes Group \"ScoreConnectionDirection\" #1)))) (game \"Watershed\" (players 2) (equipment { \"BoardUsed\" (piece \"Ball\" Each) (piece \"Disc\" Each) (hand Each size:1)}) (rules (start (set Score Each 0)) (play (do (move Add (to (sites Empty) if:(< 1 (count Sites in:(intersection (sites Around (to) \"ConnectionDirection\") (sites Empty)))))) ifAfterwards:(\"AllHave1Connection2Edge\" (intersection (sites Around (last To) \"ConnectionDirection\") (sites Empty))) (then (do (\"CapturingAtScoreWhat4Who\" (intersection (sites Occupied by:All) (sites Around (last To) \"ConnectionDirection\")) Next Mover) next:(\"Scoring\"))))) (end (if (no Moves Next) { (if (= (score Mover) (score Next)) (result Mover Win)) (if (!= (score Mover) (score Next)) (byScore))})))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThree concentric squares, with lines connecting the corners and the midpoints of the sides. Twelve pieces per player. Players alternate turns placing a piece on an empty spot on the board. When all of the pieces have been placed, 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, they remove one of the opponent's pieces. Pieces which are in a three-in-a-row pattern cannot be removed from the board. The player who removes all of the opponent's pieces wins. \n\n###\n\n", "completion": "(game \"Xonin Shatar (Simple)\" (players 2) (equipment { (board (concentric Square rings:3 joinCorners:True) use:Vertex) (hand Each) (piece \"Marker\" Each (\"StepToEmpty\" ~ (then (\"ReplayIfLine3\"))))}) (rules (start (place \"Marker\" \"Hand\" count:12)) phases:{ (phase \"Placement\" (play (if \"SameTurn\" (\"RemoveAnyEnemyPieceNotInLine3\" Orthogonal) (move (from (handSite Mover)) (to (sites Empty)) (then (\"ReplayIfLine3\"))))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (phase \"Movement\" (play (if \"SameTurn\" (\"RemoveAnyEnemyPieceNotInLine3\" Orthogonal) (forEach Piece))))} (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x12 board, with spaces as points, divided in two. Twelve pieces per player, which start stacked, two per point in the quadrant to the player's right. Two six-sided dice. Players unstack the pieces by moving pieces off of the stack, but remaining on the same point, according to the throws of the dice. The value of the throw indicates the number of the point which can be unstacked. For example, a throw of 1 and 4 allows the player to unstack the pieces on points 1 and 4. Doubles allow players to only move one piece, but grant the player another throw. When all of a player's pieces are unstacked, they must be restacked, in the same way. When they have been successfully restacked, the player then bears off the pieces from this quadrant of the board. When bearing off, players move according to the number on each die by moving one piece the value on one die then another piece the value on the other die, or by moving one piece the value of one die and then the value of the other. The first player to bear off all their pieces wins. \n\n###\n\n", "completion": "(define \"Stack\" (forEach Level (last To) (set State at:(last To) level:(level) 0))) (define \"Unstack\" (forEach Level (last To) (set State at:(last To) level:(level) 1))) (define \"PieceStacked\" (= (state at:#1) 0)) (define \"PieceUnstacked\" (= (state at:#1) 1)) (define \"RemoveAPiece\" (move Remove (from))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" (pips))) (define \"SiteToSelect\" (\"NextSiteOnTrack\" (- (pips) 1) from:(mapEntry \"StartTrack\" (mover)))) (game \"Ofanfelling\" (players 2) (equipment { (\"BackgammonBoard\" { (track \"Track1\" {7..12} P1 directed:True) (track \"Track2\" {18..13} P2 directed:True)}) (dice d:6 num:2) (piece \"Disc\" Each (forEach Die if:(\"DieNotUsed\") (if (\"IsOffBoard\" \"SiteToMoveOnTrack\") \"RemoveAPiece\" (move (from) (to \"SiteToMoveOnTrack\"))))) (map \"StartTrack\" {(pair P1 7) (pair P2 18)})}) (rules (start { (place Stack \"Disc1\" (sites {7..12}) count:2) (place Stack \"Disc2\" (sites {13..18}) count:2)}) phases:{ (phase \"UnStacking\" (play (do (if (or (is Pending) (\"NewTurn\")) (roll)) next: (forEach Die if:(\"DieNotUsed\") (if (\"PieceStacked\" \"SiteToSelect\") (move Select (from (\"SiteToSelect\")) (then (and (\"Unstack\") (\"ReplayNotAllDiceUsed\")))))) (then (if (all DiceEqual) (and (set Pending) (moveAgain)))))) (nextPhase Mover (all Sites (sites Occupied by:Mover) if:(not (\"PieceStacked\" (site)))) \"Stacking\")) (phase \"Stacking\" (play (do (if (or (is Pending) (\"NewTurn\")) (roll)) next: (forEach Die if:(\"DieNotUsed\") (if (\"PieceUnstacked\" \"SiteToSelect\") (move Select (from (\"SiteToSelect\")) (then (and (\"Stack\") (\"ReplayNotAllDiceUsed\")))))) (then (if (all DiceEqual) (and (set Pending) (moveAgain)))))) (nextPhase Mover (all Sites (sites Occupied by:Mover) if:(not (\"PieceUnstacked\" (site)))) \"BearingOff\")) (phase \"BearingOff\" (play (do (if (or (all DiceEqual) (\"NewTurn\")) (roll)) next:(forEach Piece top:True) (then (if (or (not (all DiceUsed)) (all DiceEqual)) (moveAgain))))) (end (\"EscapeWin\")))})) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game is played on a 4x4 board. -> The game is played on a 5x5 board.\n(define \"ReachedTarget\" (is In (last To) (sites Mover))) (game \"Breakback\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 4)) (piece \"Pawn\" Each (or { \"StepForwardToEmpty\" (move Step (directions {FR FL}) (to if:(or (is Empty (to)) (\"IsEnemyAt\" (to))) (apply (remove (to)))))})) (regions P1 (sites Top)) (regions P2 (sites Bottom))}) (rules (start { (place \"Pawn1\" (expand (sites Bottom))) (place \"Pawn2\" (expand (sites Top)))}) (play (priority (forEach Piece (\"StepBackwardToEmpty\")) (forEach Piece))) (end (if \"ReachedTarget\" (result Mover Win)))))\n\n###\n\n", "completion": "(define \"ReachedTarget\" (is In (last To) (sites Mover))) (game \"Breakback\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 5)) (piece \"Pawn\" Each (or { \"StepForwardToEmpty\" (move Step (directions {FR FL}) (to if:(or (is Empty (to)) (\"IsEnemyAt\" (to))) (apply (remove (to)))))})) (regions P1 (sites Top)) (regions P2 (sites Bottom))}) (rules (start { (place \"Pawn1\" (expand (sites Bottom))) (place \"Pawn2\" (expand (sites Top)))}) (play (priority (forEach Piece (\"StepBackwardToEmpty\")) (forEach Piece))) (end (if \"ReachedTarget\" (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe player to play the last possible legal move wins the game. The other player loses. Unless, that is, the board is completely full, in which case the game is a tie. \n\n###\n\n", "completion": "(define \"AddPiece\" (move Add (piece (id #1 Neutral)) (to (sites Empty) if:(and { (all Sites (sites Row (row of:(to))) if:(!= (id #1 Neutral) (what at:(site)))) (all Sites (sites Column (column of:(to))) if:(!= (id #1 Neutral) (what at:(site)))) (\"CheckLineRightSubGame\" #1)})))) (define \"CheckLineRightSubGame\" (if (is In (to) (sites \"Square0\")) (all Sites (sites \"Square0\") if:(!= (id #1 Neutral) (what at:(site)))) (if (is In (to) (sites \"Square1\")) (all Sites (sites \"Square1\") if:(!= (id #1 Neutral) (what at:(site)))) (if (is In (to) (sites \"Square2\")) (all Sites (sites \"Square2\") if:(!= (id #1 Neutral) (what at:(site)))) (if (is In (to) (sites \"Square3\")) (all Sites (sites \"Square3\") if:(!= (id #1 Neutral) (what at:(site)))) (if (is In (to) (sites \"Square4\")) (all Sites (sites \"Square4\") if:(!= (id #1 Neutral) (what at:(site)))) (if (is In (to) (sites \"Square5\")) (all Sites (sites \"Square5\") if:(!= (id #1 Neutral) (what at:(site)))) (if (is In (to) (sites \"Square6\")) (all Sites (sites \"Square6\") if:(!= (id #1 Neutral) (what at:(site)))) (if (is In (to) (sites \"Square7\")) (all Sites (sites \"Square7\") if:(!= (id #1 Neutral) (what at:(site)))) (all Sites (sites \"Square8\") if:(!= (id #1 Neutral) (what at:(site))))))))))))) (game \"Duidoku\" (players 2) (equipment { (board (square 9)) (piece \"1\" Neutral) (piece \"2\" Neutral) (piece \"3\" Neutral) (piece \"4\" Neutral) (piece \"5\" Neutral) (piece \"6\" Neutral) (piece \"7\" Neutral) (piece \"8\" Neutral) (piece \"9\" Neutral) (regions \"Square0\" (sites { 0..2 9..11 18..20})) (regions \"Square1\" (sites { 3..5 12..14 21..23})) (regions \"Square2\" (sites { 6..8 15..17 24..26})) (regions \"Square3\" (sites {27..29 36..38 45..47})) (regions \"Square4\" (sites {30..32 39..41 48..50})) (regions \"Square5\" (sites {33..35 42..44 51..53})) (regions \"Square6\" (sites {54..56 63..65 72..74})) (regions \"Square7\" (sites {57..59 66..68 75..77})) (regions \"Square8\" (sites {60..62 69..71 78..80}))}) (rules (play (or { (\"AddPiece\" \"1\") (\"AddPiece\" \"2\") (\"AddPiece\" \"3\") (\"AddPiece\" \"4\") (\"AddPiece\" \"5\") (\"AddPiece\" \"6\") (\"AddPiece\" \"7\") (\"AddPiece\" \"8\") (\"AddPiece\" \"9\")})) (end { (if (all Sites (sites Board) if:(is Occupied (site))) (result Mover Draw)) (\"BlockWin\")}))) END" }, { "prompt": "Construct a Ludii game based on the following description\n5x5 intersecting lines, with diagonals in the quadrants. Five pieces per player. Players alternate turns placing a piece on the board. Once all of the pieces are placed on the board, players alternate turns moving a piece to an empty adjacent spot on the board. The player who places all five of their pieces in a line wins. \n\n###\n\n", "completion": "(game \"Marelle Quadruple\" (players 2) (equipment { (\"AlquerqueBoard\" 5 5) (hand Each) (piece \"Marker\" Each \"StepToEmpty\")}) (rules (start (place \"Marker\" \"Hand\" count:5)) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase (\"HandEmpty\" P2) \"Movement\")) (\"PhaseMovePiece\" \"Movement\")} (end (if (is Line 5) (result Mover Win))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game has 3 players. -> The game has 4 players.\n(define \"MadeACompleteCircuit\" (if (= 1 (value Player Mover)) (is In (value Piece at:(where \"Marker\" Mover)) (sites Track \"TrackCW\" from:(\"NextSite\" (last From) \"TrackCW\") to:(last To))) (is In (value Piece at:(where \"Marker\" Mover)) (sites Track \"TrackCCW\" from:(\"NextSite\" (last From) \"TrackCCW\") to:(last To))))) (define \"MoveOn\" (if (\"IsNotOffBoard\" #1) (if (or (is In #1 (sites Empty)) (\"IsEnemyAt\" #1)) (move (from (from) level:(level)) (to #1 (\"HittingCapture\" (value Piece at:(to)))))) #2)) (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 \"NextSite\" (\"NextSiteOnTrack\" 1 from:#1 #2)) (define \"SiteToMoveOnSelectedTrack\" (if (= (value Player Mover) 2) (\"NextSiteOnTrack\" (\"ThrowValue\") \"TrackCCW\") (\"NextSiteOnTrack\" (\"ThrowValue\") \"TrackCW\"))) (define \"ThrowValue\" (count Pips)) (game \"Kawasukuts\" (players 3) (equipment { (\"FortyStonesWithFourGapsBoard\" { (track \"TrackCW\" {39 35 33 31 29 27 25 23 21 19 38 17 15 13 11 9 7 5 3 1 37 0 2 4 6 8 10 12 14 16 36 18 20 22 24 26 28 30 32 34} loop:True) (track \"TrackCCW\" {39 34 32 30 28 26 24 22 20 18 36 16 14 12 10 8 6 4 2 0 37 1 3 5 7 9 11 13 15 17 38 19 21 23 25 27 29 31 33 35} loop:True)}) (regions \"Gates\" (sites {36..39})) (piece \"Marker\" Each (if (\"IsOffBoard\" (value Player Mover)) (or (\"MoveOn\" (\"SiteToMoveOnTrackCW\") (\"RememberSelectedTrack\" (\"SelectCW\"))) (\"MoveOn\" (\"SiteToMoveOnTrackCCW\") (\"RememberSelectedTrack\" (\"SelectCCW\")))) (\"MoveOn\" \"SiteToMoveOnSelectedTrack\"))) (dice d:2 facesByDie:{{0 2} {0 3} {0 10}} num:3) (hand Each)}) (rules (start (place \"Marker\" \"Hand\")) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (sites \"Gates\")) (then (set Value at:(last To) (last To))))) (nextPhase Mover \"Playing\")) (phase \"Playing\" (play (\"RollMove\" (forEach Piece))) (end (if (and (!= 0 (\"ThrowValue\")) (\"MadeACompleteCircuit\")) (result Mover Win))))}))\n\n###\n\n", "completion": "(define \"MadeACompleteCircuit\" (if (= 1 (value Player Mover)) (is In (value Piece at:(where \"Marker\" Mover)) (sites Track \"TrackCW\" from:(\"NextSite\" (last From) \"TrackCW\") to:(last To))) (is In (value Piece at:(where \"Marker\" Mover)) (sites Track \"TrackCCW\" from:(\"NextSite\" (last From) \"TrackCCW\") to:(last To))))) (define \"MoveOn\" (if (\"IsNotOffBoard\" #1) (if (or (is In #1 (sites Empty)) (\"IsEnemyAt\" #1)) (move (from (from) level:(level)) (to #1 (\"HittingCapture\" (value Piece at:(to)))))) #2)) (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 \"NextSite\" (\"NextSiteOnTrack\" 1 from:#1 #2)) (define \"SiteToMoveOnSelectedTrack\" (if (= (value Player Mover) 2) (\"NextSiteOnTrack\" (\"ThrowValue\") \"TrackCCW\") (\"NextSiteOnTrack\" (\"ThrowValue\") \"TrackCW\"))) (define \"ThrowValue\" (count Pips)) (game \"Kawasukuts\" (players 4) (equipment { (\"FortyStonesWithFourGapsBoard\" { (track \"TrackCW\" {39 35 33 31 29 27 25 23 21 19 38 17 15 13 11 9 7 5 3 1 37 0 2 4 6 8 10 12 14 16 36 18 20 22 24 26 28 30 32 34} loop:True) (track \"TrackCCW\" {39 34 32 30 28 26 24 22 20 18 36 16 14 12 10 8 6 4 2 0 37 1 3 5 7 9 11 13 15 17 38 19 21 23 25 27 29 31 33 35} loop:True)}) (regions \"Gates\" (sites {36..39})) (piece \"Marker\" Each (if (\"IsOffBoard\" (value Player Mover)) (or (\"MoveOn\" (\"SiteToMoveOnTrackCW\") (\"RememberSelectedTrack\" (\"SelectCW\"))) (\"MoveOn\" (\"SiteToMoveOnTrackCCW\") (\"RememberSelectedTrack\" (\"SelectCCW\")))) (\"MoveOn\" \"SiteToMoveOnSelectedTrack\"))) (dice d:2 facesByDie:{{0 2} {0 3} {0 10}} num:3) (hand Each)}) (rules (start (place \"Marker\" \"Hand\")) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (sites \"Gates\")) (then (set Value at:(last To) (last To))))) (nextPhase Mover \"Playing\")) (phase \"Playing\" (play (\"RollMove\" (forEach Piece))) (end (if (and (!= 0 (\"ThrowValue\")) (\"MadeACompleteCircuit\")) (result Mover Win))))})) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayers alternate moving their pieces forward or backward diagonally. A piece may also jump over one adjacent piece of the opponent diagonally forward. This does not capture the opponent's piece. Jumps are compulsory. A player cannot block the other player's pieces such that he or she cannot perform a legal move. The player that can first bring each of their pieces seven rows forward is the winner. The pieces must retain their original order in each row. \n\n###\n\n", "completion": "(define \"GoalOfP2Filled\" (and { (\"IsPieceAt\" \"Salta1Star\" P2 (coord \"A1\")) (\"IsPieceAt\" \"Salta2Star\" P2 (coord \"C1\")) (\"IsPieceAt\" \"Salta3Star\" P2 (coord \"E1\")) (\"IsPieceAt\" \"Salta4Star\" P2 (coord \"G1\")) (\"IsPieceAt\" \"Salta5Star\" P2 (coord \"I1\")) (\"IsPieceAt\" \"Salta1Moon\" P2 (coord \"B2\")) (\"IsPieceAt\" \"Salta2Moon\" P2 (coord \"D2\")) (\"IsPieceAt\" \"Salta3Moon\" P2 (coord \"F2\")) (\"IsPieceAt\" \"Salta4Moon\" P2 (coord \"H2\")) (\"IsPieceAt\" \"Salta5Moon\" P2 (coord \"J2\")) (\"IsPieceAt\" \"Salta1Dot\" P2 (coord \"A3\")) (\"IsPieceAt\" \"Salta2Dot\" P2 (coord \"C3\")) (\"IsPieceAt\" \"Salta3Dot\" P2 (coord \"E3\")) (\"IsPieceAt\" \"Salta4Dot\" P2 (coord \"G3\")) (\"IsPieceAt\" \"Salta5Dot\" P2 (coord \"I3\"))})) (define \"GoalOfP1Filled\" (and { (\"IsPieceAt\" \"Salta1Star\" P1 (coord \"J10\")) (\"IsPieceAt\" \"Salta2Star\" P1 (coord \"H10\")) (\"IsPieceAt\" \"Salta3Star\" P1 (coord \"F10\")) (\"IsPieceAt\" \"Salta4Star\" P1 (coord \"D10\")) (\"IsPieceAt\" \"Salta5Star\" P1 (coord \"B10\")) (\"IsPieceAt\" \"Salta1Moon\" P1 (coord \"I9\")) (\"IsPieceAt\" \"Salta2Moon\" P1 (coord \"G9\")) (\"IsPieceAt\" \"Salta3Moon\" P1 (coord \"E9\")) (\"IsPieceAt\" \"Salta4Moon\" P1 (coord \"C9\")) (\"IsPieceAt\" \"Salta5Moon\" P1 (coord \"A9\")) (\"IsPieceAt\" \"Salta1Dot\" P1 (coord \"J8\")) (\"IsPieceAt\" \"Salta2Dot\" P1 (coord \"H8\")) (\"IsPieceAt\" \"Salta3Dot\" P1 (coord \"F8\")) (\"IsPieceAt\" \"Salta4Dot\" P1 (coord \"D8\")) (\"IsPieceAt\" \"Salta5Dot\" P1 (coord \"B8\"))})) (define \"HopSequence\" (\"Hop\" #1 (then (if (can Move (\"Hop\" (last To))) (moveAgain))))) (define \"Hop\" (move Hop (from #1) Diagonal (between if:(\"IsEnemyAt\" (between))) (to if:(\"IsEmptyAndNotVisited\" (to))) #2)) (game \"Salta\" (players 2) (equipment { (board (square 10)) (piece \"Salta1Dot\" Each) (piece \"Salta2Dot\" Each) (piece \"Salta3Dot\" Each) (piece \"Salta4Dot\" Each) (piece \"Salta5Dot\" Each) (piece \"Salta1Moon\" Each) (piece \"Salta2Moon\" Each) (piece \"Salta3Moon\" Each) (piece \"Salta4Moon\" Each) (piece \"Salta5Moon\" Each) (piece \"Salta1Star\" Each) (piece \"Salta2Star\" Each) (piece \"Salta3Star\" Each) (piece \"Salta4Star\" Each) (piece \"Salta5Star\" Each)}) (rules (start { (place \"Salta1Star1\" coord:\"A1\") (place \"Salta2Star1\" coord:\"C1\") (place \"Salta3Star1\" coord:\"E1\") (place \"Salta4Star1\" coord:\"G1\") (place \"Salta5Star1\" coord:\"I1\") (place \"Salta1Moon1\" coord:\"B2\") (place \"Salta2Moon1\" coord:\"D2\") (place \"Salta3Moon1\" coord:\"F2\") (place \"Salta4Moon1\" coord:\"H2\") (place \"Salta5Moon1\" coord:\"J2\") (place \"Salta1Dot1\" coord:\"A3\") (place \"Salta2Dot1\" coord:\"C3\") (place \"Salta3Dot1\" coord:\"E3\") (place \"Salta4Dot1\" coord:\"G3\") (place \"Salta5Dot1\" coord:\"I3\") (place \"Salta1Star2\" coord:\"J10\") (place \"Salta2Star2\" coord:\"H10\") (place \"Salta3Star2\" coord:\"F10\") (place \"Salta4Star2\" coord:\"D10\") (place \"Salta5Star2\" coord:\"B10\") (place \"Salta1Moon2\" coord:\"I9\") (place \"Salta2Moon2\" coord:\"G9\") (place \"Salta3Moon2\" coord:\"E9\") (place \"Salta4Moon2\" coord:\"C9\") (place \"Salta5Moon2\" coord:\"A9\") (place \"Salta1Dot2\" coord:\"J8\") (place \"Salta2Dot2\" coord:\"H8\") (place \"Salta3Dot2\" coord:\"F8\") (place \"Salta4Dot2\" coord:\"D8\") (place \"Salta5Dot2\" coord:\"B8\")}) (play (if \"SameTurn\" (\"HopSequence\" (last To)) (priority { (forEach Piece (\"HopSequence\" (from))) (forEach Piece \"StepDiagonalToEmpty\")}))) (end { (if \"GoalOfP1Filled\" (result P1 Win)) (if \"GoalOfP2Filled\" (result P2 Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nEach player has four pieces.\n Players take turns moving a piece to an empty dot.\n A player may capture an opponent\u2019s piece by placing a piece on either side of an opponent\u2019s piece. If a player moves their own piece between two of the opponent\u2019s pieces, it is not captured.\n A player wins by reducing the opponent to one piece.\n The game is played according to the rules of the source.\n\n###\n\n", "completion": "(game \"Boseog Gonu\" (players 2) (equipment { (board (remove (merge { (rectangle 3 3 diagonals:Alternating) (shift 0 -1 (rotate 180 (wedge 2))) (shift 0 2 (wedge 2)) (shift -1.5 0.5 (rotate 90 (wedge 2))) (shift 1.5 0.5 (rotate -90 (wedge 2)))}) edges:{ {{1 1} {0 0}} {{1 1} {2 2}} {{1 1} {2 0}} {{1 1} {0 2}}}) use:Vertex) (piece \"Disc\" Each (\"StepToEmpty\" ~ (then (custodial (from (last To)) (between (max 1) if:(\"IsEnemyAt\" (between)) (apply (remove (between)))) (to if:(= (what at:(to)) (what at:(last To))))))))}) (rules (start { (place \"Disc1\" {\"A3\" \"B3\" \"B4\" \"B2\"}) (place \"Disc2\" {\"D2\" \"D3\" \"E3\" \"D4\"})}) (play (forEach Piece)) (end (\"HavingLessPiecesLoss\" Next 1)))) END" }, { "prompt": "Construct a Ludii game based on the following description\n8x8 board. One player plays as one Shah, which can move like any of the other pieces. The other player has the usual complement of pieces, as in Chess. Pawns (x8): can move one space forward and capture one space forward diagonally; Rook (x2): can move 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; Shah (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, with the Vizier is place to the left of the Shah. 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 Shah on the next turn, the Shah is in check, the opponent's next move must free the Shah from check. If the opponent cannot, it is checkmate and the player wins. \n\n###\n\n", "completion": "(define \"PromotedPiece\" (if (and (is In (last To) (sites Corners)) (!= 2 (count Pieces Mover \"Boat\"))) (id \"Boat\" Mover) (if (and (or (= (column of:(last To)) 1) (= (column of:(last To)) 6)) (!= 2 (count Pieces Mover \"Knight\"))) (id \"Knight\" Mover) (if (and (or (= (column of:(last To)) 2) (= (column of:(last To)) 5)) (!= 2 (count Pieces Mover \"Elephant\"))) (id \"Elephant\" Mover) (if (and (= (column of:(last To)) 3) (!= 1 (count Pieces Mover \"Queen\"))) (id \"Queen\" Mover) Undefined))))) (define \"RememberPieceHasMoved\" (then (if (= (state at:(last To)) 1) \"PieceHasMoved\"))) (define \"PieceHasMoved\" (set State at:(last To) 0)) (define \"HasNeverMoved\" (= (state at:#1) 1)) (define \"NextCanNotMoveToProtect\" (not (can Move (do (forEach Piece Next) ifAfterwards:(not (\"IsInCheck\" #1 Next)))))) (game \"Shatranj Diwana Shah\" (players 2) (equipment { (board (square 8)) (piece \"Pawn\" P2 S (do (or { \"StepForwardToEmpty\" (\"StepToEnemy\" (directions {FR FL}))}) ifAfterwards:(if (is In (last To) (sites Mover \"Promotion\")) (!= Undefined (\"PromotedPiece\")) True) (then (\"PromoteIfReach\" (sites Mover \"Promotion\") \"PromotedPiece\")))) (piece \"Boat\" P2 (\"SlideCapture\" Orthogonal)) (piece \"King_noCross\" Each (if (is Mover P1) (or (\"LeapCapture\" \"KnightWalk\") (\"SlideCapture\")) (or (\"StepToNotFriend\") (if (\"HasNeverMoved\" (from)) (\"LeapCapture\" \"KnightWalk\")) \"RememberPieceHasMoved\"))) (piece \"Elephant\" P2 (\"SlideCapture\" Diagonal)) (piece \"Knight\" P2 (\"LeapCapture\" \"KnightWalk\")) (piece \"Queen\" P2 (\"SlideCapture\")) (regions \"Promotion\" P2 (sites Bottom))}) (rules (start { (place \"Pawn2\" (sites Row 6)) (place \"King_noCross1\" coord:\"D1\") (place \"Boat2\" {\"A8\" \"H8\"}) (place \"Knight2\" {\"B8\" \"G8\"}) (place \"Elephant2\" {\"C8\" \"F8\"}) (place \"Queen2\" coord:\"D8\") (place \"King_noCross2\" coord:\"E8\" state:1)}) (play (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King_noCross\" Mover)) (then (if (and (\"IsPieceAt\" \"King_noCross\" P1 (last To)) (\"HasNeverMoved\" (where \"King_noCross\" P2))) (if (\"IsInCheck\" \"King_noCross\" P2) (set State at:(where \"King_noCross\" P2) 0)))))) (end (if (and (\"IsInCheck\" \"King_noCross\" Next) (\"NextCanNotMoveToProtect\" \"King_noCross\")) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nIn the game, played on a grid of any size, two players move their pieces simultaneously, which leave a trail behind them. The first player to run into one of the trails or the edge of the board loses. \n\n###\n\n", "completion": "(game \"Tron\" (players 2) (equipment { (board (square 10)) (piece \"King\" Each (move Step Orthogonal (to (apply (if (is Occupied (to)) (trigger \"Collision\" (mover))))) (then (add (piece (id \"Square\" Mover)) (to (last From)))))) (piece \"Square\" Each)}) (rules (start { (place \"King1\" coord:\"E5\") (place \"King2\" coord:\"F6\")}) (play (forEach Piece)) (end (if (is Triggered \"Collision\" Mover) (result Next Win))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game involves 2 players. -> The game involves 3 players.\nThe track is composed of 20 spaces -> The track is composed of 25 spaces\n(define \"SetHyenaPlayer\" (and (add (piece \"Hyena\") (to 0) stack:True) (set Var (id Mover)))) (define \"HyenaPlayer\" (var)) (define \"SiteHyenaToMove\" (\"SiteToMoveOnTrack\" from:(where \"Hyena\" Shared) (* 2 (\"ThrowValue\")))) (define \"SiteToMove\" (if (= (from) (handSite Mover)) (\"SiteToMoveOnTrack\" from:0 (- (\"ThrowValue\") 1)) (\"SiteToMoveOnTrack\" from:(from) (\"ThrowValue\")))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" #2 #1)) (define \"ThrowValue\" (mapEntry \"Throw\" (count Pips))) (game \"Nama\" (players 2) (equipment { (board (rectangle 20 1) (track \"Track\" {0..19} directed:True)) (hand Each) (hand Shared) (piece \"Marker\" Each (if (\"IsOffBoard\" (\"SiteToMove\")) (move Remove (from) level:(level) (then (if (\"IsOffBoard\" (where \"Hyena\" Shared)) (\"SetHyenaPlayer\")))) (move (from (from) level:(level)) (to (\"SiteToMove\")) stack:True))) (piece \"Hyena\" Shared) (\"StickDice\" 4) (map \"Throw\" {(pair 0 0) (pair 1 0) (pair 2 2) (pair 3 0) (pair 4 20)})}) (rules (start (place \"Marker\" \"Hand\")) (play (\"RollMove\" (if (< 0 (\"ThrowValue\")) (if (= (\"HyenaPlayer\") (id Mover)) (if (\"IsOffBoard\" (\"SiteHyenaToMove\")) (move Remove (where \"Hyena\" Shared) (then (forEach Site (sites Board) (if (is Occupied (site)) (remove (site) count:(size Stack at:(site))))))) (move (from (where \"Hyena\" Shared)) (to (\"SiteHyenaToMove\")) (then (forEach Value min:1 max:(- (* 2 (\"ThrowValue\")) 1) (if (is Occupied (\"SiteToMoveOnTrack\" from:(last From) (value))) (remove (\"SiteToMoveOnTrack\" from:(last From) (value)) count:(size Stack at:(\"SiteToMoveOnTrack\" from:(last From) (value))))))))) (or (forEach Piece) (forEach Piece container:(mover))))))) (end { (forEach Player if:(and { (> (\"HyenaPlayer\") 0) (!= (player) (\"HyenaPlayer\")) (\"IsOffBoard\" (where \"Hyena\" Shared))}) (result Player Loss)) (if (and (= (id Mover) (\"HyenaPlayer\")) (\"IsOffBoard\" (where \"Hyena\" Shared))) (result Mover Win)) (forEach Player if:(and (!= (player) (\"HyenaPlayer\")) (no Pieces of:(player))) (result Player Loss))})))\n\n###\n\n", "completion": "(define \"SetHyenaPlayer\" (and (add (piece \"Hyena\") (to 0) stack:True) (set Var (id Mover)))) (define \"HyenaPlayer\" (var)) (define \"SiteHyenaToMove\" (\"SiteToMoveOnTrack\" from:(where \"Hyena\" Shared) (* 2 (\"ThrowValue\")))) (define \"SiteToMove\" (if (= (from) (handSite Mover)) (\"SiteToMoveOnTrack\" from:0 (- (\"ThrowValue\") 1)) (\"SiteToMoveOnTrack\" from:(from) (\"ThrowValue\")))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" #2 #1)) (define \"ThrowValue\" (mapEntry \"Throw\" (count Pips))) (game \"Nama\" (players 3) (equipment { (board (rectangle 25 1) (track \"Track\" {0..24} directed:True)) (hand Each) (hand Shared) (piece \"Marker\" Each (if (\"IsOffBoard\" (\"SiteToMove\")) (move Remove (from) level:(level) (then (if (\"IsOffBoard\" (where \"Hyena\" Shared)) (\"SetHyenaPlayer\")))) (move (from (from) level:(level)) (to (\"SiteToMove\")) stack:True))) (piece \"Hyena\" Shared) (\"StickDice\" 4) (map \"Throw\" {(pair 0 0) (pair 1 0) (pair 2 2) (pair 3 0) (pair 4 20)})}) (rules (start (place \"Marker\" \"Hand\")) (play (\"RollMove\" (if (< 0 (\"ThrowValue\")) (if (= (\"HyenaPlayer\") (id Mover)) (if (\"IsOffBoard\" (\"SiteHyenaToMove\")) (move Remove (where \"Hyena\" Shared) (then (forEach Site (sites Board) (if (is Occupied (site)) (remove (site) count:(size Stack at:(site))))))) (move (from (where \"Hyena\" Shared)) (to (\"SiteHyenaToMove\")) (then (forEach Value min:1 max:(- (* 2 (\"ThrowValue\")) 1) (if (is Occupied (\"SiteToMoveOnTrack\" from:(last From) (value))) (remove (\"SiteToMoveOnTrack\" from:(last From) (value)) count:(size Stack at:(\"SiteToMoveOnTrack\" from:(last From) (value))))))))) (or (forEach Piece) (forEach Piece container:(mover))))))) (end { (forEach Player if:(and { (> (\"HyenaPlayer\") 0) (!= (player) (\"HyenaPlayer\")) (\"IsOffBoard\" (where \"Hyena\" Shared))}) (result Player Loss)) (if (and (= (id Mover) (\"HyenaPlayer\")) (\"IsOffBoard\" (where \"Hyena\" Shared))) (result Mover Win)) (forEach Player if:(and (!= (player) (\"HyenaPlayer\")) (no Pieces of:(player))) (result Player Loss))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\n7x7 lines, forming a grid. 21 pieces per player. The pieces begin on the three rows closest to the player. Pieces move forward orthogonally or sideways, never backwards. A piece may capture an adjacent opponent's piece by hopping over it to an empty adjacent spot immediately on the opposite side of it along the lines of the board. Multiple captures are allowed. Captures can only be made in the forward orthogonal or sideways directions also. The player who captures all of their opponent's pieces or who blocks them from being able to move wins. \n\n###\n\n", "completion": "(game \"Tablo\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 7) use:Vertex) (piece \"Marker\" Each (or { (\"StepToEmpty\" (directions {Forward Rightward Leftward})) (\"HopCapture\" ~ (directions {Forward Rightward Leftward}) (then (\"ReplayIfCanMove\" (\"HopCapture\" (from (last To)) (directions {Forward Rightward Leftward})))))}))}) (rules (start { (place \"Marker1\" (expand (sites Bottom) steps:2)) (place \"Marker2\" (expand (sites Top) steps:2))}) (play (if (\"SameTurn\") (and (\"HopCapture\" (from (last To)) (directions {Forward Rightward Leftward}) (then (\"ReplayIfCanMove\" ((\"HopCapture\" (from (last To)) (directions {Forward Rightward Leftward})))))) (move Pass)) (forEach Piece))) (end (\"BlockWin\")))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"UpdateCounterDoublePlay\" (if (< (value Player Mover) (- (/ (count Pips) 2) 1)) (and (moveAgain) (if (< (value Player Mover) 0) (set Value Mover 1) (set Value Mover (+ 1 (value Player Mover))))) (set Value Mover 0))) (define \"SetScoreOf\" (score #1 (if (is Mover #1) (if (= (\"NumPiece\" #2) 15) 2 1) 0))) (define \"NumPiece\" (size Stack in:(sites Occupied by:#1))) (define \"Bar\" (mapEntry #1)) (define \"AllPieceInOpponentSide\" (\"AllOwnedPiecesIn\" (sites Mover \"OppositeQuadrant\"))) (define \"NumSitesInFirstQuadrantWithMoreThan2Pieces\" (count Sites in:(forEach (intersection (sites Occupied by:Mover) (sites Mover \"Home\")) if:(>= (size Stack at:(site)) 2)))) (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 de Versailles\" (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 (do (\"RollEachNewTurnMove\" (if (all DiceEqual) (forEach Site (sites Occupied by:Mover) (if (and (\"CanEscape\" (\"NextSiteFromDistDoubleDice\" (site))) (\"AllPieceInOpponentSide\")) (\"RemoveAPiece\") (if (or (!= (site) \"StartPos\") (and (= (site) \"StartPos\") (\"PieceInOpponentQuadrantOrNoPieceInTheBoard\"))) (move (from (site)) (to (\"NextSiteFromDistDoubleDice\" (site)) if:(\"NoEnemyOrOnlyOne\" (to)) (\"HittingCapture\" (\"Bar\" (next))))))) (then (\"UpdateCounterDoublePlay\"))) (forEach Die if:(\"DieNotUsed\") (forEach Site (sites Occupied by:Mover) (if (and (\"CanEscape\" (\"NextSiteFrom\" (site))) (\"AllPieceInOpponentSide\")) (\"RemoveAPiece\") (if (or (!= (site) \"StartPos\") (and (= (site) \"StartPos\") (\"PieceInOpponentQuadrantOrNoPieceInTheBoard\"))) (move (from (site)) (to (\"NextSiteFrom\" (site)) if:(\"NoEnemyOrOnlyOne\" (to)) (\"HittingCapture\" (\"Bar\" (next)))))))) (then (\"ReplayNotAllDiceUsed\"))))) ifAfterwards:(<= (\"NumSitesInFirstQuadrantWithMoreThan2Pieces\") 2))) (end { (if (\"AllPieceEscaped\") (byScore { (\"SetScoreOf\" P1 P2) (\"SetScoreOf\" P2 P1)}))})))\n\n###\n\n", "completion": "2x12 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 may move the value of one of the die (n), n times (e.g., double sixes allows a player to move 6 six times, double twos allow a player to move 2 twice). Each player progresses in a clockwise direction around the board, to bear off upon reaching the final point on the opposite side of the board from which the player started. This first piece must reach the opposite quadrant of the board from where it started before the player may enter any other pieces. In the quadrant where the players enter their pieces, that player may only have two or more pieces on a point on a maximum of two points. 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. It is considered a double win if the player bears off all their pieces before the opponent bears off any. END" }, { "prompt": "Construct a Ludii game based on the following description\nTumbleweed is played with stackable tokens on a hexhex board.\n \n A stack is said to be seen from a hex when they are connected by a straight line, with no stacks in between.\n \n The players take turns settling hexes by placing a stack of their tokens on a hex of their choice. The height of a new stack is equal to the number of friendly stacks seen from the settled hex. Removing a stack occupying a hex and re-settling it with a new stack is possible, only as long as the new stack is taller than the previous one. This works with opponent stacks (to capture), or your own stacks (to reinforce).\n \n The board is initially empty, except for a central neutral (blue) two-stack. The first player sets up initial one-stacks: White and Red. The second player then chooses which side he wants to play, by clicking on a stone. Red goes first.\n \n The game ends when no more moves can be made by either player, or after two successive passes. The player who occupies over half the board wins. The program automatically scores indirectly controlled territory. Played on a size 8 board.\n\n###\n\n", "completion": "(define \"TerritoryP2\" (+ (count Sites in:(sites Occupied by:P2)) (count Sites in:(forEach (sites Empty) if:(> (count Sites in:(intersection (sites Occupied by:P2) (sites LineOfSight at:(site)))) (count Sites in:(intersection (sites Occupied by:P1) (sites LineOfSight at:(site))))))))) (define \"TerritoryP1\" (+ (count Sites in:(sites Occupied by:P1)) (count Sites in:(forEach (sites Empty) if:(> (count Sites in:(intersection (sites Occupied by:P1) (sites LineOfSight at:(site)))) (count Sites in:(intersection (sites Occupied by:P2) (sites LineOfSight at:(site))))))))) (define \"PlayableSites\" (forEach (sites Board) if:(> (count Sites in:(intersection (sites Occupied by:Mover) (sites LineOfSight at:(site)))) (size Stack at:(site))))) (define \"FriendlyInSight\" (count Sites in:(intersection (sites Occupied by:Mover) (sites LineOfSight at:(last From))))) (game \"Tumbleweed\" (players 2) (equipment { (board (hex 8)) (piece \"Disc\" Each) (piece \"Disc\" Neutral)}) (rules (start (place Stack \"Disc0\" (centrePoint) count:2)) phases:{ (phase \"Opening\" (play (if (= 0 (count Moves)) (move Add (piece \"Disc1\") (to (sites Empty)) (then (moveAgain))) (if (= 1 (count Moves)) (move Add (piece \"Disc2\") (to (sites Empty))) (move Select (from (union (sites Occupied by:P1) (sites Occupied by:P2))) (then (if (= 1 (who at:(last From))) (do (swap Players 1 2) next:(set NextPlayer (player 1))) (pass))))))) (nextPhase (= 3 (count Moves)) \"Play\")) (phase \"Play\" (play (or (move Select (from \"PlayableSites\") (then (add (to (last From)) count:(- \"FriendlyInSight\" ((size Stack at:(last From)))) stack:True))) (move Pass))))} (end (if (all Passed) (byScore { (score P1 \"TerritoryP1\") (score P2 \"TerritoryP2\")}))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(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 \"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 \"Marker\" 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 \"EnterAPiece\" (move (from (handSite Mover)) (to (\"NextSiteOnTrack\" (- \"ThrowValue\" 1) from:(\"EntryPoint\" (mover)) \"Track\")))) (define \"FreePiece\" (= 0 #1)) (define \"CapturedPiece\" (= 2 #1)) (define \"CapturingPiece\" (= 1 #1)) (define \"CaptureMove\" (forEach Level (last To) FromTop (and (if (is Enemy (who at:(last To) level:(level))) (\"SetCapturePiece\" at:(last To) level:(level))) (if (is Friend (who at:(last To) level:(level))) (\"SetCapturingPiece\" at:(last To) level:(level)))))) (define \"AtLeastAnEnemyPieceThere\" (is In #1 (sites Occupied by:Enemy top:False))) (define \"UnsetCapturingPieces\" (forEach Level (last From) FromTop (if (is Friend (who at:(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 \"EntryPoint\" (mapEntry \"Entry\" (mover))) (define \"ThrowValue\" (mapEntry \"Throw\" (count Pips))) (game \"Puluc\" (players 2) (equipment { (board (rectangle 1 10) { (track \"Track1\" {0..8} loop:True P1) (track \"Track2\" {8..0} loop:True P2) (track \"CaptureTrack1\" {8..0} P1 directed:True) (track \"CaptureTrack2\" {0..8} P2 directed:True)} use:Edge) (piece \"Marker\" Each (or (if (\"FreePiece\" (state at:(from) level:(level))) (move (from (from) level:(level)) (to (\"NextSiteOnTrack\" (\"ThrowValue\") from:(from) \"Track\")) (then (if (\"AtLeastAnEnemyPieceThere\" (last To)) (\"CaptureMove\"))))) (if (\"CapturingPiece\" (state at:(from) level:(level))) (if (\"IsNotOffBoard\" (\"NextSiteOnTrack\" (\"ThrowValue\") from:(from) \"CaptureTrack\")) (move (from (from) level:(level)) (to (\"NextSiteOnTrack\" (\"ThrowValue\") from:(from) \"CaptureTrack\")) (then (and (\"CapturedPiecesFollowCapturingPiece\") (\"UnsetCapturingPieces\")))) (move Remove (from) level:(level) (then (and { (\"UnsetCapturingPieces\") (\"RemoveCapturedPieces\") (\"RebirthCapturingPiece\")}))))))) (regions \"AllSites\" (sites Board Vertex)) (map \"Throw\" {(pair 0 5) (pair 1 3) (pair 2 2) (pair 3 3) (pair 4 4)}) (map \"Entry\" { (pair 1 0) (pair 2 8)}) (\"StickDice\" 4) (hand Each)}) (rules (start { (place Stack \"Marker1\" (handSite P1) count:5) (place Stack \"Marker2\" (handSite P2) count:5)}) (play (\"RollMove\" (or { (if (is Occupied (handSite Mover)) (\"EnterAPiece\")) (forEach Piece)}) (then (if (\"NewTurn\") (moveAgain))))) (end { (\"CaptureAll\" P2) (\"CaptureAll\" P1)})))\n\n###\n\n", "completion": "Ten corn kernels are placed in a line; the spaces between the kernels are the playing spaces. Four kernels of corn are used as dice, blackened on one side. The throws are as follows: Two of the same side up = 2, three of the same side up = 3; four black sides up = 4; four unblackened sides up = 5. Five pieces per player. Players take turns moving pieces according to the throws of the corn, with two throws per turn. When a player reaches the opposite end of the board, they move to the start and continue moving in the same direction. If a piece lands on a space occupied by an opponent's piece, the player then moves in the reverse direction, carrying the opponent's piece with it in an attempt to move past the starting points and off the board. Upon moving off the board, the opponent's piece is captured. The player then enters their piece again on their next turn. However, if the opponent lands on a piece carrying one of their pieces away, they then start carrying both of those pieces back to their starting point, freeing the captured piece and capturing the other player's piece. The player who captures all of the opponent's pieces wins. END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nA size 8 board is currently selected -> A size 7 board is currently selected\n(define \"OntoEmptyOrIceberg\" (step (to if:(or (= (id Neutral) (who at:(to))) (is Empty (to)))))) (define \"NearestIcebergs\" (intersection (sites Occupied by:Neutral) (sites Distance (\"OntoEmptyOrIceberg\") from:(from) (exact (\"DistanceToNearestIceberg\"))))) (define \"DistanceToNearestIceberg\" (count Steps (\"OntoEmptyOrIceberg\") (from) (sites Occupied by:Neutral))) (game \"Icebreaker\" (players 2) (equipment { (board (hex 8)) (piece \"Disc\" Each (move Step (to if:(and (or (= (id Neutral) (who at:(to))) (is Empty (to))) (= 1 (- (count Steps (\"OntoEmptyOrIceberg\") (from) (\"NearestIcebergs\")) (count Steps (\"OntoEmptyOrIceberg\") (to) (\"NearestIcebergs\"))))) (apply (if (is Occupied (to)) (and (remove (to)) (addScore Mover 1))))))) (piece \"Disc\" Neutral)}) (rules (start { (place \"Disc0\" (difference (sites Board) (sites Corners))) (place \"Disc1\" (sites Around (centrePoint) distance:(- 8 1) NNW)) (place \"Disc1\" (sites Around (centrePoint) distance:(- 8 1) E)) (place \"Disc1\" (sites Around (centrePoint) distance:(- 8 1) SSW)) (place \"Disc2\" (sites Around (centrePoint) distance:(- 8 1) NNE)) (place \"Disc2\" (sites Around (centrePoint) distance:(- 8 1) W)) (place \"Disc2\" (sites Around (centrePoint) distance:(- 8 1) SSE))}) (play (forEach Piece Mover)) (end (if (or (< (/ (- (count Sites in:(sites Board)) 6) 2) (score P1)) (< (/ (- (count Sites in:(sites Board)) 6) 2) (score P2))) (byScore)))))\n\n###\n\n", "completion": "(define \"OntoEmptyOrIceberg\" (step (to if:(or (= (id Neutral) (who at:(to))) (is Empty (to)))))) (define \"NearestIcebergs\" (intersection (sites Occupied by:Neutral) (sites Distance (\"OntoEmptyOrIceberg\") from:(from) (exact (\"DistanceToNearestIceberg\"))))) (define \"DistanceToNearestIceberg\" (count Steps (\"OntoEmptyOrIceberg\") (from) (sites Occupied by:Neutral))) (game \"Icebreaker\" (players 2) (equipment { (board (hex 7)) (piece \"Disc\" Each (move Step (to if:(and (or (= (id Neutral) (who at:(to))) (is Empty (to))) (= 1 (- (count Steps (\"OntoEmptyOrIceberg\") (from) (\"NearestIcebergs\")) (count Steps (\"OntoEmptyOrIceberg\") (to) (\"NearestIcebergs\"))))) (apply (if (is Occupied (to)) (and (remove (to)) (addScore Mover 1))))))) (piece \"Disc\" Neutral)}) (rules (start { (place \"Disc0\" (difference (sites Board) (sites Corners))) (place \"Disc1\" (sites Around (centrePoint) distance:(- 7 1) NNW)) (place \"Disc1\" (sites Around (centrePoint) distance:(- 7 1) E)) (place \"Disc1\" (sites Around (centrePoint) distance:(- 7 1) SSW)) (place \"Disc2\" (sites Around (centrePoint) distance:(- 7 1) NNE)) (place \"Disc2\" (sites Around (centrePoint) distance:(- 7 1) W)) (place \"Disc2\" (sites Around (centrePoint) distance:(- 7 1) SSE))}) (play (forEach Piece Mover)) (end (if (or (< (/ (- (count Sites in:(sites Board)) 6) 2) (score P1)) (< (/ (- (count Sites in:(sites Board)) 6) 2) (score P2))) (byScore))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game starts with 5 pieces by player. -> The game starts with 7 pieces by player.\n(define \"RemoveEnemyPieceInMillOnlyIfNoOtherChoice\" (if (can Move (\"RemoveAnyEnemyPieceNotInLine3\" Orthogonal)) (\"RemoveAnyEnemyPieceNotInLine3\" Orthogonal) (\"RemoveAnyEnemyPiece\"))) (game \"Six Men's Morris\" (players 2) (equipment { (board (concentric Square rings:2) use:Vertex) (hand Each) (piece \"Marker\" Each (\"StepToEmpty\" ~ (then (\"ReplayIfLine3\" Orthogonal exact:True))))}) (rules (start (place \"Marker\" \"Hand\" count:5)) 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))))\n\n###\n\n", "completion": "(define \"RemoveEnemyPieceInMillOnlyIfNoOtherChoice\" (if (can Move (\"RemoveAnyEnemyPieceNotInLine3\" Orthogonal)) (\"RemoveAnyEnemyPieceNotInLine3\" Orthogonal) (\"RemoveAnyEnemyPiece\"))) (game \"Six Men's Morris\" (players 2) (equipment { (board (concentric Square rings:2) use:Vertex) (hand Each) (piece \"Marker\" Each (\"StepToEmpty\" ~ (then (\"ReplayIfLine3\" Orthogonal exact:True))))}) (rules (start (place \"Marker\" \"Hand\" count:7)) 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\n14x14 board. 28 pieces per player. Pieces begin on the board in the following arrangement, and with the following movements: Outer row, from left corner: Rukh: moves orthogonally any distance; Ghora: moves orthogonally one space and then diagonally another space, jumping over the first space; Dahja: moves orthogonally any distance; Ratha: moves orthogonally any distance; Fil: moves diagonally any distance; Shahzada: moves diagonally or orthogonally any distance; Wazir: moves diagonally or orthogonally any distance; Raja: moves one space in any direction; Rani: moves one square in any direction; Fil, Ratha, Dahja, Ghora, Rukh. In the second row are fourteen Paidal: moves one square forward orthogonally or one diagonally to capture. Players alternate turns moving a piece to a space on the board. If one of the opponent's pieces is on the space to which a player moves their piece, the opponent's piece is captured. If the Raja can be captured on the opponent's next turn, it is in check. The Raja cannot remain in check at the end of the player's turn. If this is not possible, it is checkmate and the opponent wins.\n \n\n###\n\n", "completion": "(game \"Shatranj (14x14)\" (players 2) (equipment { (board (square 14)) (\"ChessPawn\" \"Pawn\") (\"ChessRook\" \"Rook\") (\"ChessRook\" \"Commoner\") (\"ChessRook\" \"Wazir\") (\"ChessKing\" \"King_noCross\") (\"ChessKing\" \"Mann\") (\"ChessBishop\" \"Bishop_noCross\") (\"ChessKnight\" \"Knight\") (\"ChessQueen\" \"Queen\") (\"ChessQueen\" \"Amazon\")}) (rules (start { (place \"Pawn1\" (sites Row 1)) (place \"Pawn2\" (sites Row 12)) (place \"Rook1\" {\"A1\" \"N1\"}) (place \"Knight1\" {\"B1\" \"M1\"}) (place \"Commoner1\" {\"C1\" \"L1\"}) (place \"Wazir1\" {\"D1\" \"K1\"}) (place \"Bishop_noCross1\" {\"E1\" \"J1\"}) (place \"Amazon1\" coord:\"F1\") (place \"Queen1\" coord:\"G1\") (place \"King_noCross1\" coord:\"H1\") (place \"Mann1\" coord:\"I1\") (place \"Rook2\" {\"A14\" \"N14\"}) (place \"Knight2\" {\"B14\" \"M14\"}) (place \"Commoner2\" {\"C14\" \"L14\"}) (place \"Wazir2\" {\"D14\" \"K14\"}) (place \"Bishop_noCross2\" {\"E14\" \"J14\"}) (place \"Amazon2\" coord:\"I14\") (place \"Queen2\" coord:\"H14\") (place \"King_noCross2\" coord:\"G14\") (place \"Mann2\" coord:\"F14\")}) (play (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King_noCross\" Mover)))) (end (\"Checkmate\" \"King_noCross\")))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"CombinedGroupCounts\" ( + { (* 10000 (count Groups Orthogonal #1)) (* 100 (- (count Groups Orthogonal #1) (count Groups Orthogonal #1 min:3))) (- (- (count Groups Orthogonal #1) (count Groups Orthogonal #1 min:5)) (- (count Groups Orthogonal #1) (count Groups Orthogonal #1 min:3)))})) (game \"Hermit\" (players 2) (equipment { (board (tri Hexagon 5) use:Vertex) (piece \"Marker\" Each) (piece \"Marker\" Neutral)}) (rules (start { (set Score P1 0) (set Score P2 0)}) (play (do (move Add (to (sites Empty))) ifAfterwards: (or { (= 1 (size Group at:(last To) Orthogonal)) (= 3 (size Group at:(last To) Orthogonal)) (= 5 (size Group at:(last To) Orthogonal))}) (then (addScore Mover (- (\"CombinedGroupCounts\" if:(= (who at:(to)) (mover))) (score Mover)))))) (end (if (all Passed) { (if (> (\"CombinedGroupCounts\" if:(= (who at:(to)) P1)) (\"CombinedGroupCounts\" if:(= (who at:(to)) P2))) (result P1 Win)) (if (< (\"CombinedGroupCounts\" if:(= (who at:(to)) P1)) (\"CombinedGroupCounts\" if:(= (who at:(to)) P2))) (result P2 Win))} (result Mover Win)))))\n\n###\n\n", "completion": "Hermit is a two player abstract game in which players drop stones to create edgewise connected, owned groups of odd sizes 1, 3 and 5 exclusively. \n The game ends when neither player can legally place a stone. \n The player with the most groups on the board at game's end wins. \n Ties are broken by the most groups of size 1 (hermits), then by the most groups of size 3, and finally, the last player to place a stone wins.\n \n Scores are formatted 'aa1133', where aa = count of all groups, 11 = count of size 1 groups, and 33 = count of size 3 groups.\n \n It is helpful to turn on 'Show Legal Moves' (Alt-M). Base 5 hexagonal board of triangles END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"FifteenFinal\" (if (is Mover P1) (and (\"IsFriendAt\" 12) (= 15 (size Stack at:12))) (and (\"IsFriendAt\" 13) (= 15 (size Stack at:13))))) (define \"SevenFiveThreeFinal\" (if (is Mover P1) (and { (\"IsFriendAt\" 10) (\"IsFriendAt\" 11) (\"IsFriendAt\" 12) (= 3 (size Stack at:10)) (= 5 (size Stack at:11)) (= 7 (size Stack at:12))}) (and { (\"IsFriendAt\" 13) (\"IsFriendAt\" 14) (\"IsFriendAt\" 15) (= 7 (size Stack at:13)) (= 5 (size Stack at:14)) (= 3 (size Stack at:15))}))) (define \"ThreeOnFiveFinal\" (if (is Mover P1) (and { (\"IsFriendAt\" 8) (\"IsFriendAt\" 9) (\"IsFriendAt\" 10) (\"IsFriendAt\" 11) (\"IsFriendAt\" 12) (= 3 (size Stack at:8)) (= 3 (size Stack at:9)) (= 3 (size Stack at:10)) (= 3 (size Stack at:11)) (= 3 (size Stack at:12))}) (and { (\"IsFriendAt\" 13) (\"IsFriendAt\" 14) (\"IsFriendAt\" 15) (\"IsFriendAt\" 17) (\"IsFriendAt\" 18) (= 3 (size Stack at:13)) (= 3 (size Stack at:14)) (= 3 (size Stack at:15)) (= 3 (size Stack at:17)) (= 3 (size Stack at:18))}))) (define \"FiveOnThreeFinal\" (if (is Mover P1) (and { (\"IsFriendAt\" 10) (\"IsFriendAt\" 11) (\"IsFriendAt\" 12) (= 5 (size Stack at:10)) (= 5 (size Stack at:11)) (= 5 (size Stack at:12))}) (and { (\"IsFriendAt\" 13) (\"IsFriendAt\" 14) (\"IsFriendAt\" 15) (= 5 (size Stack at:13)) (= 5 (size Stack at:14)) (= 5 (size Stack at:15))}))) (define \"AllPiecesInFinalQuadrant\" (\"AllOwnedPiecesIn\" (sites Mover \"FinalQuadrant\"))) (define \"NextSiteFrom\" (\"NextSiteOnTrack\" #2 from:#1)) (game \"Svensk Bradspel\" (players 2) (equipment { (\"BackgammonBoard\" (\"BackgammonTracksSameDirectionOppositeCornersWithBars2\" End)) (dice d:6 num:2) (piece \"Disc\" Each (forEach Die replayDouble:True if:(\"DieNotUsed\") (if (\"IsEndTrack\" (\"NextSiteFrom\" (from) (pips))) (if (\"AllPiecesInFinalQuadrant\") (move Remove (from))) (move (from (from)) (to (\"NextSiteFrom\" (from) (pips)) if:(and (\"NoEnemyOrOnlyOne\" (to)) (if (not (is In (to) (sites Mover \"StartingSide\"))) True (if (= (value Player Mover) 1) True (is Empty (to))))) (apply (if (\"IsEnemyAt\" (to)) (fromTo (from (to)) (to (mapEntry \"Bar\" Next)))))))) (then (and (\"ReplayNotAllDiceUsed\") (if (and (= (last To) (mapEntry \"12thPoint\" Mover)) (!= 1 (value Player Mover))) (set Value Mover 1)))))) (regions \"FinalQuadrant\" P1 (sites {7..12})) (regions \"FinalQuadrant\" P2 (sites {13..18})) (regions \"StartingSide\" P1 (sites {25..20 18..14})) (regions \"StartingSide\" P2 (sites {0..5 7..11})) (map \"12thPoint\" {(pair P1 13) (pair P2 12)}) (map \"Bar\" {(pair P1 6) (pair P2 19)})}) (rules (start { (place Stack \"Disc1\" 25 count:15) (place Stack \"Disc2\" 0 count:15)}) (play (\"RollEachNewTurnMove\" (forEach Piece top:True))) (end { (\"EscapeWin\") (if (\"FiveOnThreeFinal\" Mover) (result Mover Win)) (if (\"ThreeOnFiveFinal\" Mover) (result Mover Win)) (if (\"SevenFiveThreeFinal\" Mover) (result Mover Win)) (if (\"FifteenFinal\" Mover) (result Mover Win))})))\n\n###\n\n", "completion": "2x12 board, with the spaces rendered as points, divided into half. Fifteen pieces per player. 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. A throw of doubles forces the player to play the throw twice. Each player's pieces begin in three stacks of five, on the leftmost point (with respect to the opponent) on the opponent's side of the board. Play proceeds (with respect to the player) from right to left on the opponent's side of the board, and then from left to right on the player's side of the board. A player cannot place two pieces on a single point on any of the first eleven points of the board, except for those pieces in the starting position, until one of the player's pieces has first landed on the twelfth point. However, a player may place two pieces on any point after the twelfth point, regardless of whether a piece has ever landed on the twelfth point. A player cannot move a piece onto a point containing two or more pieces belonging to the opponent. When a piece lands on a point occupied by a single piece belonging to the opponent, it is removed from the board and must be entered again, and can only do so using the value of one die, not both, with the starting point considered to be point 1, the next point 2, etc. Opponent's pieces can be removed from the board in this way when reentering the board. To win, a player must place their pieces in one of the following winning positions: five pieces on each of the final three points; three pieces on the final five points; seven on the final point, five on the penultimate point, and three on the antepenultimate point; fifteen on the final point. If none of these positions are possible, the player must bear off all of their pieces once all of their pieces have reached the final six points. The first player to reach a winning position or to bear off all of their pieces wins. END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"Custodial\" (custodial (from (last To)) Orthogonal (between (max 1) if:(= (what at:(between)) (id #1)) (apply (remove (between)))) (to if:(\"FriendOrCentre\")))) (define \"JarlButNotTheExpandedCentre\" (and (= (what at:(between)) (id \"Jarl2\")) (and (!= (between) (\"Castle\")) (not (is In (between) (sites \"OrthogonalSitesCentre\")))))) (define \"JarlAndExpandedCentre\" (and (= (what at:(between)) (id \"Jarl2\")) (or (= (between) (\"Castle\")) (is In (between) (sites \"OrthogonalSitesCentre\"))))) (define \"FriendOrCentre\" (or (\"IsFriendAt\" (to)) (= (to) (\"Castle\")))) (define \"CaptureJarl\" (apply (trigger \"Surrounded\" P2))) (define \"JarlWasCaptured\" (is Triggered \"Surrounded\" P2)) (define \"Castle\" (centrePoint)) (define \"Custodial\" (custodial (from (last To)) Orthogonal (between (max 1) if:(= (what at:(between)) (id #1)) (apply (remove (between)))) (to if:(\"FriendOrCentre\")))) (define \"JarlButNotTheExpandedCentre\" (and (= (what at:(between)) (id \"Jarl2\")) (and (!= (between) (\"Castle\")) (not (is In (between) (sites \"OrthogonalSitesCentre\")))))) (define \"JarlAndExpandedCentre\" (and (= (what at:(between)) (id \"Jarl2\")) (or (= (between) (\"Castle\")) (is In (between) (sites \"OrthogonalSitesCentre\"))))) (define \"FriendOrCentre\" (or (\"IsFriendAt\" (to)) (= (to) (\"Castle\")))) (define \"CaptureJarl\" (apply (trigger \"Surrounded\" P2))) (define \"JarlWasCaptured\" (is Triggered \"Surrounded\" P2)) (define \"Castle\" (centrePoint)) (define \"NoRepetition\" (meta (no Repeat))) (game \"Poprad Game\" (players 2) (equipment { (board (square 17)) (piece \"Marker\" Each (move Slide Orthogonal (then (\"CustodialCapture\" Orthogonal (max 1))))) (hand Each)}) (rules (\"NoRepetition\") (start (place \"Marker\" \"Hand\" count:144)) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (difference (sites Board) (centrePoint)) if:(is Empty (to))) (then (if (and (is Occupied (handSite Mover)) (\"NewTurn\")) (moveAgain))))) (nextPhase Mover (is Empty (handSite Mover)) \"Capture\")) (\"PhaseMovePiece\" \"Capture\")} (end (\"HavingLessPiecesLoss\" Next 1))))\n\n###\n\n", "completion": "17x17 or 17x18 board. States can not be repeated. Kharebga rules applied to a 17x17 board. END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe elephants can jump only diagonally. -> The elephants can move like a Silver in Shogi.\n(game \"Chaturanga\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (\"ChessPawn\" \"Pawn\" ~ (then (\"ReplayInMovingOn\" (sites Mover \"Promotion\")))) (\"ChessRook\" \"Rook\") (\"ChessKing\" \"King_noCross\") (piece \"Elephant\" Each (move Hop Diagonal (between if:True) (to if:(not (\"IsFriendAt\" (to))) (apply (remove (to)))))) (\"ChessKnight\" \"Knight\") (piece \"Ferz_noCross\" Each (\"StepToNotFriend\" Diagonal)) (regions \"Promotion\" P1 (sites Top)) (regions \"Promotion\" P2 (sites Bottom))}) (rules (start { (place \"Pawn1\" (sites Row 1)) (place \"Pawn2\" (sites Row 6)) (place \"Rook1\" {\"A1\" \"H1\"}) (place \"Knight1\" {\"B1\" \"G1\"}) (place \"Elephant1\" {\"C1\" \"F1\"}) (place \"Ferz_noCross1\" coord:\"D1\") (place \"King_noCross1\" coord:\"E1\") (place \"Rook2\" {\"A8\" \"H8\"}) (place \"Knight2\" {\"B8\" \"G8\"}) (place \"Elephant2\" {\"C8\" \"F8\"}) (place \"Ferz_noCross2\" coord:\"E8\") (place \"King_noCross2\" coord:\"D8\")}) (play (if \"SameTurn\" (move Promote (last To) (piece \"Ferz_noCross\") Mover) (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King_noCross\" Mover))))) (end { (\"Checkmate\" \"King_noCross\") (\"MisereBlockWin\") (\"HavingLessPiecesLoss\" Next 1)})))\n\n###\n\n", "completion": "(game \"Chaturanga\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (\"ChessPawn\" \"Pawn\" ~ (then (\"ReplayInMovingOn\" (sites Mover \"Promotion\")))) (\"ChessRook\" \"Rook\") (\"ChessKing\" \"King_noCross\") (piece \"Elephant\" Each (\"StepToNotFriend\" (directions {Forward BL BR FL FR}))) (\"ChessKnight\" \"Knight\") (piece \"Ferz_noCross\" Each (\"StepToNotFriend\" Diagonal)) (regions \"Promotion\" P1 (sites Top)) (regions \"Promotion\" P2 (sites Bottom))}) (rules (start { (place \"Pawn1\" (sites Row 1)) (place \"Pawn2\" (sites Row 6)) (place \"Rook1\" {\"A1\" \"H1\"}) (place \"Knight1\" {\"B1\" \"G1\"}) (place \"Elephant1\" {\"C1\" \"F1\"}) (place \"Ferz_noCross1\" coord:\"D1\") (place \"King_noCross1\" coord:\"E1\") (place \"Rook2\" {\"A8\" \"H8\"}) (place \"Knight2\" {\"B8\" \"G8\"}) (place \"Elephant2\" {\"C8\" \"F8\"}) (place \"Ferz_noCross2\" coord:\"E8\") (place \"King_noCross2\" coord:\"D8\")}) (play (if \"SameTurn\" (move Promote (last To) (piece \"Ferz_noCross\") Mover) (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King_noCross\" Mover))))) (end { (\"Checkmate\" \"King_noCross\") (\"MisereBlockWin\") (\"HavingLessPiecesLoss\" Next 1)}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nCross-shaped board, with two opposite arms bent at a right angle. Line cross each arm, creating 55 intersections where the pieces are placed. Two teams of one, two, or three people play, with each player controlling one piece. Four longitudinally split reed are used as dice, two are unmarked on the concave side which count as 1, and the other two are marked, and count as 15 and 20. The throws are as follows: All convex faces up = 10; all concave sides up = 5; one concave side up = the value of that side; two concave sides up = 2, three concave sides up =3, A player must throw 10 or more to enter the board. Once a piece is entered, the player throws three times consecutively. Each player owns one of the bent arms of the board, and the piece move anti-clockwise from the right hand end of the arm, to the exit at the left hand end of the arm, but not entering the opponent's arm. When a player lands on a space occupied by an opponent's piece, the opponent's piece is sent back to start. Pieces on the central spot (spot 25) are safe from being sent back. When a piece enters the player's arm again as they approach the goal, throws of 10, 15, and 20 count as 1. On the penultimate space, a throw of 2, 3, or 5 allows a piece to exit, but on the final space a throw of 1, 10, 15, or 20 is required. If playing on teams, a player who has reached the goal continues to throw and use those throws to move their teammates' pieces. The first team to remove all their pieces from the board wins. The game is played with 6 players.\n\n###\n\n", "completion": "(define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" #2 #1)) (define \"ThrowValueEndTrack\" (if (is In (\"ThrowValue\") (sites {1 10 15 20})) 1 (\"ThrowValue\"))) (define \"ThrowValue\" (mapEntry \"Throw\" (count Pips))) (game \"Petol\" (players 6) (equipment { (board (remove (merge { (shift 0 7 (scale 2 1 (rectangle 3 2))) (scale 2 1 (rectangle 8 2)) (shift 0 9 (scale 2 1 (rectangle 8 2))) (shift 4.5 1 (scale 2 1 (rectangle 6 2))) (shift -4.5 10 (scale 2 1 (rectangle 6 2))) (shift 4.5 6 (graph vertices:{ { 0 0} { 0 1} { 2 3} {2 0}} edges:{ {0 1} {1 2} {2 3} {3 0}})) (shift 2 7 (graph vertices:{ { 0 0} { 0 2} { 4.5 2} {2.5 0}} edges:{ {0 1} {1 2} {2 3} {3 0}})) (shift 0 7 (graph vertices:{ { 0 0} { 0 2} { -2.5 2} {-4.5 0}} edges:{ {0 1} {1 2} {2 3} {3 0}})) (shift -2.5 10 (graph vertices:{ { 0 0} { 0 -1} { -2 -3} {-2 0}} edges:{ {0 1} {1 2} {2 3} {3 0}}))}) edges:{{2 3}}) { (track \"Track1\" \"56,S,E1,S,E,N,W,S7,W1,N,End\" P1 directed:True) (track \"Track2\" \"35,N,W1,N,W,S,E,N7,E1,S,End\" P2 directed:True) (track \"Track3\" \"56,S,E1,S,E,N,W,S7,W1,N,End\" P3 directed:True) (track \"Track4\" \"35,N,W1,N,W,S,E,N7,E1,S,End\" P4 directed:True) (track \"Track5\" \"56,S,E1,S,E,N,W,S7,W1,N,End\" P5 directed:True) (track \"Track6\" \"35,N,W1,N,W,S,E,N7,E1,S,End\" P6 directed:True)} use:Vertex) (dice d:2 facesByDie:{{0 1} {0 1} {0 15} {0 20}} num:4) (piece \"Marker\" Each (if (\"IsEndTrack\" (\"SiteToMoveOnTrack\" from:(from) 1)) (if (or { (= 1 (\"ThrowValue\")) (= 10 (\"ThrowValue\")) (= 15 (\"ThrowValue\")) (= 20 (\"ThrowValue\"))}) (move Remove (from) level:(level))) (if (\"IsEndTrack\" (\"SiteToMoveOnTrack\" from:(from) 2)) (or (if (or { (= 2 (\"ThrowValue\")) (= 3 (\"ThrowValue\")) (= 5 (\"ThrowValue\"))}) (move Remove (from) level:(level))) (if (is In (\"ThrowValue\") (sites {1 10 15 20})) (move (from (from) level:(level)) (to (\"SiteToMoveOnTrack\" from:(from) 1))))) (if (is In (from) (sites Mover \"EndTrack\")) (move (from (from) level:(level)) (to (\"SiteToMoveOnTrack\" from:(from) (\"ThrowValueEndTrack\")) if:True)) (move (from (from) level:(level)) (to (\"SiteToMoveOnTrack\" from:(from) (\"ThrowValue\")) if:(not (and (is In (to) (sites \"SafeSites\")) (\"IsEnemyAt\" (to)))) (\"HittingStackCapture\" (handSite (who at:(to) level:(level)))))))))) (hand Each) (map \"Throw\" {(pair 0 10) (pair 37 5) (pair 1 1) (pair 15 15) (pair 20 20) (pair 2 2) (pair 16 2) (pair 21 2) (pair 35 2) (pair 17 3) (pair 22 3) (pair 36 3)}) (map \"Entry\" {(pair P1 56) (pair P2 35) (pair P3 56) (pair P4 35) (pair P5 56) (pair P6 35)}) (regions \"SafeSites\" (sites {2 3})) (regions \"EndTrack\" P1 (sites {60 47 49 51 53 55 57})) (regions \"EndTrack\" P2 (sites {58 44 42 40 38 36 34})) (regions \"EndTrack\" P3 (sites {60 47 49 51 53 55 57})) (regions \"EndTrack\" P4 (sites {58 44 42 40 38 36 34})) (regions \"EndTrack\" P5 (sites {60 47 49 51 53 55 57})) (regions \"EndTrack\" P6 (sites {58 44 42 40 38 36 34}))}) (rules (start { (set Team 1 {P1 P3 P5}) (set Team 2 {P2 P4 P6}) (place \"Marker1\" (handSite P1)) (place \"Marker2\" (handSite P2)) (place \"Marker3\" (handSite P3)) (place \"Marker4\" (handSite P4)) (place \"Marker5\" (handSite P5)) (place \"Marker6\" (handSite P6))}) (play (\"RollMove\" (or { (if (and (is Occupied (handSite Mover)) (<= 10 (\"ThrowValue\"))) (move (from (handSite Mover)) (to (mapEntry \"Entry\" Mover)) (then (and (moveAgain) (set Value Mover 0))))) (forEach Piece (then (if (and (< Undefined (value Player Mover)) (> 3 (value Player Mover))) (if (> 2 (value Player Mover)) (and (moveAgain) (set Value Mover (+ 1 (value Player Mover)))) (set Value Mover (+ 1 (value Player Mover))))))) (if (no Pieces Mover) (if (or {(is Mover P1) (is Mover P3) (is Mover P5)}) (or {(forEach Piece P1) (forEach Piece P3) (forEach Piece P5)}) (or {(forEach Piece P2) (forEach Piece P4) (forEach Piece P6)})))}))) (end (\"EscapeTeamWin\")))) 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\nThe game is played on the board of Kensington. It follows the rules of Go except when a capture is made, the pieces captured are flipped. \n\n###\n\n", "completion": "(define \"CaptureSurroundedPiece\" (enclose (from (last To)) Orthogonal (between if:(\"IsEnemyAt\" (between)) (apply (and (remove (between)) (add (to (between)))))))) (game \"Lotus\" (players 2) (equipment { (board (rotate 90 (tiling T3464 2)) use:Vertex) (piece \"Marker\" Each)}) (rules (play (or (do (move Add (to (sites Empty)) (then \"CaptureSurroundedPiece\")) ifAfterwards:\"HasFreedom\") (move Pass (then (addScore Mover 1))))) (end (if (all Passed) (byScore { (score P1 (+ {(score P1) (size Territory P1) (count Sites in:(sites Occupied by:P1))})) (score P2 (+ {(score P2) (size Territory P2) (count Sites in:(sites Occupied by:P2))}))}))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"Goal\" 96) (game \"Pachisi\" (players 4) (equipment { (\"PachisiBoard\" { (track \"Track1\" \"97,68,N,11,E,N,W,53,N,W,S,42,W,S,E,8,S,55,N8\" P1 directed:True) (track \"Track2\" \"98,46,W,53,N,W,S,42,W,S,E,8,S,E,N,11,E,34,W8\" P2 directed:True) (track \"Track3\" \"99,81,S,42,W,S,E,8,S,E,N,11,E,N,W,53,N,94,S8\" P3 directed:True) (track \"Track4\" \"100,4,E,8,S,E,N,11,E,N,W,53,N,W,S,42,W,19,E8\" P4 directed:True)}) (hand Each) (\"StickDice\" 6) (map \"Die\" {(pair 0 25) (pair 1 10) (pair 2 2) (pair 3 3) (pair 4 4) (pair 5 5) (pair 6 6)}) (map \"Entry\" {(pair 1 68) (pair 2 46) (pair 3 81) (pair 4 4)}) (map \"PreviousGoal\" {(pair 1 9) (pair 2 27) (pair 3 52) (pair 4 26)}) (regions \"Castle\" {61 63 65 32 47 15 80 84 86 21 38 3}) (regions \"Grace\" {0 1 6}) (piece \"Pawn\" Each (if (or (= (\"NextSiteOnTrack\" (count Pips)) (\"Goal\")) (and (is In (count Pips) (sites \"Grace\")) (= (from) (mapEntry \"PreviousGoal\" (mover))))) (move Select (from) (to (\"Goal\")) (then (remove (last From)))) (if (and (not (= (\"NextSiteOnTrack\" (mapEntry \"Die\" (count Pips))) (\"Goal\"))) (not (\"IsOffBoard\" (\"NextSiteOnTrack\" (mapEntry \"Die\" (count Pips)))))) (move (from (from) level:(level)) (to (\"NextSiteOnTrack\" (mapEntry \"Die\" (count Pips))) (apply if:(or (not (is In (\"NextSiteOnTrack\" (mapEntry \"Die\" (count Pips))) (sites \"castle\"))) (and (is In (\"NextSiteOnTrack\" (mapEntry \"Die\" (count Pips))) (sites \"Castle\")) (\"IsFriendAt\" (\"NextSiteOnTrack\" (mapEntry \"Die\" (count Pips)))))) (if (\"IsEnemyAt\" (to)) (fromTo (from (to)) (to (handSite (who at:(to))))))))))))}) (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) (set Team 1 {P1 P3}) (set Team 2 {P2 P4})}) phases:{ (phase \"firstTurn\" (play (\"RollMove\" (move (from (handSite (mover))) (to (\"NextSiteOnTrack\" (mapEntry \"Die\" (count Pips)) from:(handSite (mover))))))) (nextPhase (> (count Moves) 3) \"Movement\")) (phase \"Movement\" (play (\"RollMove\" (or { (forEach Piece) (if (and (is Occupied (handSite (mover))) (is In (count Pips) (sites \"Grace\"))) (move (from (handSite Mover) level:(topLevel at:(handSite (mover)))) (to (mapEntry \"Entry\" (mover))))) (move Pass)} (then (if (is In (count Pips) (sites \"Grace\")) (moveAgain)))))))} (end (\"EscapeTeamWin\"))))\n\n###\n\n", "completion": "Four pieces per player. Play begins in the central row of each player's arm of the board. Values of the cowries are: 0=6, 1=10, 2=2, 3=3, 4=4, 5=25, 6=12. A roll of 25 adds an extra move of 1. This extra move can be assigned to any piece or allows the player to move a piece onto the board. Play proceeds in an anti-clockwise direction. Pieces on a space marked \\ END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game has 8 players. -> The game has 10 players.\n(games { (subgame \"Aj Sayil\" \"Players/8\" next:1) (subgame \"Aj T'iwil\" \"Players/8\" next:2) (subgame \"Aj Sina'anil\" \"Players/8\" next:3) (subgame \"Aj Sakakil\" \"Players/8\" next:4) (subgame \"A K'aak'il\" \"Players/8\")})\n\n###\n\n", "completion": "(games { (subgame \"Aj Sayil\" \"Players/10\" next:1) (subgame \"Aj T'iwil\" \"Players/10\" next:2) (subgame \"Aj Sina'anil\" \"Players/10\" next:3) (subgame \"Aj Sakakil\" \"Players/10\" next:4) (subgame \"A K'aak'il\" \"Players/10\")}) 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": "Describe the mechanics of the following Ludii game\n(define \"FromEdgeToEdge\" (and ( ( (is In (site) (sites #1))) ( (= 0 (count Pieces All in:(sites LineOfSight at:(site) #2))))))) (define \"DroppableFromDirection\" (and ( (= 0 (count Pieces All in:(sites LineOfSight at:(site) #1))) (= 1 (count Pieces in:(sites Around (site) #2)))))) (game \"Centrifugal Force\" (players 2) (equipment { (board (square 13)) (piece \"Cross\" P1) (piece \"Disc\" P2) (piece \"Square\" Neutral)}) (rules (start { (place \"Square0\" coord:\"A1\") (place \"Square0\" coord:\"M1\") (place \"Square0\" coord:\"M13\") (place \"Square0\" coord:\"A13\")}) (play (move Add (to (forEach (sites Empty) if: (or ( (or { (\"FromEdgeToEdge\" Top S) (\"FromEdgeToEdge\" Bottom N) (\"FromEdgeToEdge\" Left E) (\"FromEdgeToEdge\" Right W)}) (or { (\"DroppableFromDirection\" N S) (\"DroppableFromDirection\" S N) (\"DroppableFromDirection\" W E) (\"DroppableFromDirection\" E W)}))))))) (end { (if (is Line 5) (result Mover Win)) (if (no Moves Next) (result All Draw))})))\n\n###\n\n", "completion": "At the beginning of the game, the board is empty except for the the four edge cells, which are occupied by a square which belongs to neither player.\n \n The first player plays with crosses, the second with circles.\n Each player, on his turn, must place his marker on the grid onto an empty cell respecting the following rule:\n the marker is dropped from one of the four sides of the board choosing a row or a column, and, proceeding in a straight line so that it goes inside of the board, it stops in front of the first obstacle (the border of the board, a marker of any of the two players or one of the four sqaures).\n Pretty much the same as what happens in Connect4, except here there are four dropping directions.\n \n To win the game you need to be the first to form an horizontal, vertical, or diagonal line of at least five of your markers.\n If there are no available moves, the game ends in a draw. The game is played on a 13x13 board. Look and feel: Retro END" }, { "prompt": "Construct a Ludii game based on the following description\nForty stones, arranged in a circle, with a larger gap (called a door) after every tenth stone. Two or four players, each player playing with one piece. Each piece begins in one of the doors: north/winter is yellow, west/spring is blue, south/summer is red, east/autumn is white. North and west move anti-clockwise around the circle, south and east move clockwise. Three sticks, red on one side and black on the other, used as dice, the throws are as follows: three red = 10, three black = 5, two red and one black = 3, two black and one red = 2. A throw of 10 grants the player another throw. When a player lands on a spot occupied by an opponent, the opponent's piece is sent back to start. The first player to complete four circuits of the board wins. Circuits are usually counted with beans or corn. The game has 4 players.\n\n###\n\n", "completion": "(define \"MadeACompleteCircuit\" (if (or (is Mover P1) (is Mover P2)) (is In (mapEntry \"Start\" Mover) (sites Track \"TrackCCW\" from:(\"NextSite\" (last From) \"TrackCCW\") to:(last To))) (is In (mapEntry \"Start\" Mover) (sites Track \"TrackCW\" from:(\"NextSite\" (last From) \"TrackCW\") to:(last To))))) (define \"NextSite\" (\"NextSiteOnTrack\" 1 from:#1 #2)) (define \"Move\" (move (from (from) level:(level)) (to (\"NextSiteOnTrack\" (\"ThrowValue\") #1) if:(not (\"IsFriendAt\" (to))) (\"HittingCapture\" (mapEntry \"Start\" (who at:(to))))))) (define \"TrackMove\" (\"NextSiteOnTrack\" (\"ThrowValue\") #1)) (define \"ThrowValue\" (mapEntry \"Throw\" (count Pips))) (game \"Tasholiwe\" (players 4) (equipment { (\"FortyStonesWithFourGapsBoard\" { (track \"TrackCW\" {39 35 33 31 29 27 25 23 21 19 38 17 15 13 11 9 7 5 3 1 37 0 2 4 6 8 10 12 14 16 36 18 20 22 24 26 28 30 32 34} loop:True) (track \"TrackCCW\" {39 34 32 30 28 26 24 22 20 18 36 16 14 12 10 8 6 4 2 0 37 1 3 5 7 9 11 13 15 17 38 19 21 23 25 27 29 31 33 35} loop:True)}) (map \"Throw\" {(pair 0 10) (pair 1 3) (pair 2 2) (pair 3 5)}) (map \"Start\" {(pair 1 39) (pair 2 36) (pair 3 37) (pair 4 38)}) (regions \"AllSites\" (sites Board Vertex)) (piece \"Stick\" Each) (\"StickDice\" 3) (hand Each)}) (rules (start { (place \"Stick1\" Edge (mapEntry \"Start\" P1)) (place \"Stick2\" Edge (mapEntry \"Start\" P2)) (place \"Stick3\" Edge (mapEntry \"Start\" P3)) (place \"Stick4\" Edge (mapEntry \"Start\" P4))}) (play (\"RollMove\" (if (or (is Mover P1) (is Mover P2)) (forEach Piece (\"Move\" \"TrackCCW\")) (forEach Piece (\"Move\" \"TrackCW\"))) (then (do (if (\"MadeACompleteCircuit\") (addScore Mover 1) (then (if (= (score Mover) 4) (remove (last To))))) next:(if (and (!= 4 (score Mover)) (= 10 (\"ThrowValue\"))) (moveAgain)))))) (end (if (>= (score Mover) 4) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n4x6-21 board; 8 is most common, 12, 15, and 18 are also popular. Two counters in each hole in the players' outer rows. Two holes in each player's outer row are selected as misoro. Typically, the left two holes are chosen. Sowing occurs in an anti-clockwise direction, only in the two rows belonging to the player. When the final counter lands in an occupied hole, these are picked up and sowing continues. If this final hole is one of the misoro, the player may choose to end their turn instead of continuing to sow. When the final counter lands in an empty hole in the inner row, any counters in the opposite hole in the opponent's inner row are captured. If there also are counters in the opposite hole in the opponent's outer row, these are also captured, but only if there was first a capture from the inner row hole. Players cannot sow from a hole with a single counter unless there are no holes with multiple counters. Single counters can only be sown into an empty hole. Play continues until one player has captured all of the opponent's counters, thus winning the game.\n Players choose the misoro holes. 8 Holes per row.\n\n###\n\n", "completion": "(define \"NextHoleFrom\" (\"NextSiteOnTrack\" 1 from:#1 #2)) (define \"AHoleHasMoreThanOneCounter\" (not (all Sites (forEach (sites Mover) if:(< 1 (count at:(site)))) if:(= 0 (count at:(site)))))) (define \"LastHoleSowed\" (sites {(var)})) (define \"NoPiece\" (all Sites (sites Player \"Home\") if:(= 0 (count at:(site))))) (define \"Columns\" 8) (game \"Misoro Tsoro\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"0,E,N1,W\" loop:True P1) (track \"Track2\" \"16,E,N1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"Track1\")) (regions \"Home\" P2 (sites Track \"Track2\")) (regions \"Inner\" P1 (difference (sites Track \"Track1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"Track2\") (sites Top))) (regions \"Outer\" P1 (sites Bottom)) (regions \"Outer\" P2 (sites Top)) (piece \"Seed\" Shared)}) (rules (start (set Count 2 to:(union (sites Top) (sites Bottom)))) phases:{ (phase \"Misoro\" (play (move Select (from (forEach (sites Mover \"Outer\") if:(= 0 (state at:(site))))) (then (set State at:(last To) (mover))))) (nextPhase (= 4 (count Turns)) \"Playing\")) (phase \"Playing\" (play (or (if (and (!= 0 (state at:(var))) (\"SameTurn\")) (move Pass)) (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(if \"AHoleHasMoreThanOneCounter\" (> (count at:(from)) 1) (and (= (count at:(from)) 1) (= 0 (count at:(\"NextHoleFrom\" (from) Mover)))))) (then (and (sow \"Track\" owner:(mover) apply:(if (= (count at:(to)) 1) (if (is In (to) (sites Mover \"Inner\")) (if (> (count at:(\"OppositePit\" (to))) 0) (and (remove (\"OppositePit\" (to))) (if (> (count at:(\"OppositeOuterPit\" (to))) 0) (remove (\"OppositeOuterPit\" (to))))))) (and (moveAgain) (set Var (to))))) (forEach Site (sites Board) (if (!= 0 (state at:(site))) (set State at:(site) (state at:(site)))))))))))} (end (forEach NonMover if:(\"NoPiece\") (result Player Loss))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6 board, with a store hole on either end. Four counters in each hole. Each player owns the six holes, three holes in each row, to their right. Sowing occurs in an anti-clockwise direction, and only in the holes belonging to the player. Play begins with a stylized opening move. The first player takes the counters from the holes in each of the row of holes closest to them, and places them in the central row of their holes in the further row. The counters from the hole next in the direction of sowing are then sown. The counters from the central hole in the further of the player's rows are then sown. When this is completed, the player takes the counters from the holes in the row closest to them, and holds them until the opponent performs the same sequence of moves on their side of the board. At this point, each player places the counters they are holding into any hole on the opponent's side of the board which contains more than one counter. Players then alternate turns sowing pieces around their holes of the board. Sowing always skips the hole from which sowing began. When the final counter of a sowing causes a hole to contain four counters, these counters are placed on any hole on the opponent's side of the board that contains more than one counter. When a player has only single seeds in their holes, and the opponent is about to place counters in the player's holes, the opponent moves one of the player's counters into another hole containing one counter, thus making two, and places the counters from the opponent's side are placed there. The player who is able to place all of their counters on the opponent's side of the board wins. The opening rules of the variant Lontu Holo.\n\n###\n\n", "completion": "(define \"OneSeedInEachHole\" (all Sites (sites #1 \"Home\") if:(= 1 (count at:(site))))) (define \"NoSeedInHome\" (all Sites (sites #1 \"Home\") if:(is Empty (site)))) (define \"NextHoleFrom\" (\"NextSiteOnTrack\" #3 from:#1 #2)) (game \"Lontu-Holo\" (players 2) (equipment { (mancalaBoard 2 6 { (track \"TrackCCW1\" {1 2 3 9 8 7} loop:True P1) (track \"TrackCCW2\" {4 5 6 12 11 10} loop:True P2)}) (regions \"Home\" P1 (sites Track \"TrackCCW1\")) (regions \"Home\" P2 (sites Track \"TrackCCW2\")) (regions \"TwoHolesClosestNotCentre\" P1 (sites {1 3})) (regions \"TwoHolesClosestNotCentre\" P2 (sites {10 12})) (regions \"TwoHolesFurtherNotCentre\" P1 (sites {7 9})) (regions \"TwoHolesFurtherNotCentre\" P2 (sites {4 6})) (regions \"LeftMostHoles\" P1 (intersection (expand (sites Left)) (sites Track \"TrackCCW1\"))) (regions \"LeftMostHoles\" P2 (intersection (expand (sites Right)) (sites Track \"TrackCCW2\"))) (regions \"RightMostHoles\" P1 (intersection (sites Centre) (sites Track \"TrackCCW1\"))) (regions \"RightMostHoles\" P2 (intersection (sites Centre) (sites Track \"TrackCCW2\"))) (regions \"ClosestRow\" P1 (intersection (sites Bottom) (sites Track \"TrackCCW1\"))) (regions \"ClosestRow\" P2 (intersection (sites Top) (sites Track \"TrackCCW2\"))) (map \"CentreFurtherRow\" {(pair P1 8) (pair P2 5)}) (map \"CentreClosestRow\" {(pair P1 2) (pair P2 11)}) (map \"RightFurtherRow\" {(pair P1 9) (pair P2 4)}) (map \"RightClosestRow\" {(pair P1 3) (pair P2 10)}) (map \"LeftFurtherRow\" {(pair P1 7) (pair P2 6)}) (map \"LeftClosestRow\" {(pair P1 1) (pair P2 12)}) (piece \"Seed\" Shared) (map \"Store\" {(pair P1 FirstSite) (pair P2 LastSite)})}) (rules (start (set Count 4 to:(union (sites Bottom) (sites Top)))) phases:{ (phase \"Opening1\" (play (move (from (sites Mover \"TwoHolesClosestNotCentre\") if:(is Occupied (from))) (to (mapEntry \"CentreFurtherRow\" Mover)) count:(count at:(from)))) (nextPhase Mover (all Sites (sites Mover \"TwoHolesClosestNotCentre\") if:(is Empty (site))) \"Opening2\")) (phase \"Opening2\" (play (move Select (from (\"NextHoleFrom\" (mapEntry \"CentreFurtherRow\" Mover) \"TrackCCW\" 1)) (then (sow \"TrackCCW\" owner:(mover))))) (nextPhase Mover \"Opening3\")) (phase \"Opening3\" (play (move Select (from (mapEntry \"CentreFurtherRow\" Mover)) (then (sow \"TrackCCW\" owner:(mover))))) (nextPhase Mover \"Opening4\")) (phase \"Opening4\" (play (move (from (sites Mover \"ClosestRow\") if:(is Occupied (from))) (to (mapEntry \"Store\" Mover)) count:(count at:(from)))) (nextPhase Mover (all Sites (sites Mover \"ClosestRow\") if:(is Empty (site))) \"Opening5\")) (phase \"Opening5\" (play (move (from (mapEntry \"Store\" Mover)) (to (sites Mover \"Home\") if:(< 1 (count at:(to)))) count:1)) (nextPhase Mover (is Empty (mapEntry \"Store\" Mover)) \"Sowing\")) (phase \"Sowing\" (play (if (\"SameTurn\") (if (\"OneSeedInEachHole\" Next) (move (from (sites Next \"Home\")) (to (sites Next \"Home\") if:(!= (from) (to))) count:1 (then (moveAgain))) (move (from (var \"Replay\")) (to (sites Next \"Home\") if:(< 1 (count at:(to)))) count:1 (then (if (is Occupied (last From)) (moveAgain))))) (move Select (from (sites Mover \"Home\") if:(is Occupied (from))) (then (sow \"TrackCCW\" owner:(mover) apply:(if (= 4 (count at:(to))) (and (moveAgain) (set Var \"Replay\" (to))))))))) (end (if (\"NoSeedInHome\" Mover) (result Mover Win))))})) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe objective of Cannon is to capture or shoot the opponent's Town.\n \n The player also wins the game if his opponent doesn't have legal moves.\n \n Players move alternately. On their first turns both players put a special piece called \\ \n\n###\n\n", "completion": "(define \"CannonShoot\" (forEach Direction All (if (and { (\"IsCannon\") (is Empty (\"AheadSite\" steps:3))}) (if (\"IsEnemyAt\" (\"AheadSite\" steps:4)) (move Remove (\"AheadSite\" steps:4)) (if (and (is Empty (\"AheadSite\" steps:4)) (\"IsEnemyAt\" (\"AheadSite\" steps:5))) (move Remove (\"AheadSite\" steps:5))))))) (define \"IsCannon\" (and (\"IsPieceAt\" \"Pawn\" Mover (to)) (\"IsPieceAt\" \"Pawn\" Mover (\"AheadSite\" steps:2)))) (define \"AheadSite\" (ahead (from) #1 (directions Vertex from:(from) to:(to)))) (define \"CannonMove\" (move Hop All (between (exact 2) if:(\"IsPieceAt\" \"Pawn\" Mover (between))) (to if:(is Empty (to))))) (define \"RetreatMove\" (if (\"EnemyAround\") (move Hop (directions Backwards of:All) (between if:(is Empty (between))) (to if:(is Empty (to)))))) (define \"EnemyAround\" (not (all Sites (sites Around (from) All) if:(not (\"IsEnemyAt\" (site)))))) (define \"StepCapture\" (\"StepToEnemy\" (directions {Forwards Rightward Leftward} of:All))) (define \"StepToEmptyForwards\" (\"StepToEmpty\" (directions Forwards of:All))) (game \"Cannon\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 10) use:Vertex) (piece \"Pawn\" Each (or { (\"StepToEmptyForwards\") (\"StepCapture\") (\"RetreatMove\") (\"CannonMove\") (\"CannonShoot\")})) (piece \"Town\" Each) (hand Each) (regions \"Home\" P1 (sites Bottom)) (regions \"Home\" P2 (sites Top))}) (rules (start { (place \"Town\" \"Hand\") (place \"Pawn1\" (forEach (difference (expand (sites Row 2)) (sites Right)) if:(is Even (column of:(site))))) (place \"Pawn2\" (forEach (difference (expand (sites Row 7)) (sites Left)) if:(is Odd (column of:(site)))))}) phases:{ (phase \"Placing\" (play (move (from (handSite Mover)) (to (difference (sites Mover \"Home\") (sites Corners))))) (nextPhase Mover \"Moving\")) (phase \"Moving\" (play (forEach Piece)) (end (if (or (\"IsOffBoard\" (where \"Town\" Next)) (no Moves Next)) (result Mover Win))))})) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x12 board, with the spaces rendered as points, divided into half. Fifteen pieces per player, which begin on the rightmost point, with respect to the player, on the opposite side of the board from which they sit. 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. A throw of doubles forces the player to play the throw twice. More than two pieces of the same player may not occupy a point on the starting side of the board. The player cannot move past the penultimate point on the opposite side of the board until five pieces have been moved from the starting point. A single opponent's piece may be removed from the board when a player's piece lands on it, and the opponent's piece must reenter the board. Pieces cannot move to a point occupied by two opponent's piece. A piece cannot reenter then board on a point occupied by another piece, whether belonging to the player or the opponent. When all of a player's pieces have reached the final quadrant of the board, the player may begin to remove them from the table. The player who bears off their pieces scores two points. \n\n###\n\n", "completion": "(define \"EnterPieces\" (if (is Occupied (handSite Mover)) (forEach Die replayDouble:True if:(\"DieNotUsed\") (move (from (handSite Mover)) (to (\"NextSiteFrom\" (mapEntry \"Entry\" Mover) (- (pips) 1)) if:(is Empty (to)))) (then (\"ReplayNotAllDiceUsed\"))))) (define \"AllPiecesInFinalQuadrant\" (\"AllOwnedPiecesIn\" (sites Mover \"FinalQuadrant\"))) (define \"NextSiteFrom\" (\"NextSiteOnTrack\" #2 from:#1)) (game \"Kotra\" (players 2) (equipment { (\"BackgammonBoard\" { (track \"Track1\" {12..7 5..0 13..18 20..25 End} P1 directed:True) (track \"Track2\" {13..18 20..25 12..7 5..0 End} P2 directed:True)}) (dice d:6 num:2) (piece \"Disc\" Each (forEach Die replayDouble:True if:(\"DieNotUsed\") (if (\"IsEndTrack\" (\"NextSiteFrom\" (from) (pips))) (if (\"AllPiecesInFinalQuadrant\") (move Remove (from))) (move (from (from)) (to (\"NextSiteFrom\" (from) (pips)) if:(and { (\"NoEnemyOrOnlyOne\" (to)) (if (not (is In (to) (sites Mover \"StartingSide\"))) True (> 2 (size Stack at:(to)))) (if (not (is In (to) (sites Mover \"AfterPenultimate\"))) True (>= 10 (count Pieces in:(sites {(handSite Mover) (mapEntry \"Entry\" Mover)}))))}) (\"HittingCapture\" (handSite Next))))) (then (\"ReplayNotAllDiceUsed\")))) (hand Each) (regions \"FinalQuadrant\" P1 (sites {20..25})) (regions \"FinalQuadrant\" P2 (sites {0..5})) (regions \"StartingSide\" P1 (sites {0..5 7..12})) (regions \"StartingSide\" P2 (sites {13..18 20..25})) (regions \"AfterPenultimate\" P1 (sites {25})) (regions \"AfterPenultimate\" P2 (sites {0})) (map \"Entry\" {(pair P1 12) (pair P2 13)})}) (rules (start { (place Stack \"Disc1\" 12 count:15) (place Stack \"Disc2\" 13 count:15)}) (play (\"RollEachNewTurnMove\" (or (\"EnterPieces\") (forEach Piece top:True)) (then (if (no Pieces Mover) (set Score Mover 2))))) (end (\"EscapeWin\")))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"RemoveKingIfCheckmate\" (if (and (is Active #1) (not (is Mover #1))) (if (and (\"IsInCheck\" \"King\" #1) (\"CanNotMove\" #1 #2)) (remove (where (id \"King\" #1)))))) (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 \"BigCastlingVer\" (\"DecideToCastle\" \"King\" N 2 \"KingNotCheckedAndToEmpty\" (then (\"CastleRook\" \"RookLeft\" S 3 True)))) (define \"SmallCastlingVer\" (\"DecideToCastle\" \"King\" S 2 \"KingNotCheckedAndToEmpty\" (then (\"CastleRook\" \"RookRight\" N 2 True)))) (define \"BigCastlingHor\" (\"DecideToCastle\" \"King\" W 2 \"KingNotCheckedAndToEmpty\" (then (\"CastleRook\" \"RookLeft\" E 3 True)))) (define \"SmallCastlingHor\" (\"DecideToCastle\" \"King\" E 2 \"KingNotCheckedAndToEmpty\" (then (\"CastleRook\" \"RookRight\" W 2 True)))) (define \"CastleRook\" (slide (from (mapEntry #1 (mover))) #2 (between (exact #3) if:#4) (to if:True (apply (\"PieceHasMoved\" (from)))))) (define \"DecideToCastle\" (move Slide (from (mapEntry #1 (mover))) #2 (between (exact #3) if:#4) (to if:True (apply (\"PieceHasMoved\" (from)))) #5)) (define \"KingNotCheckedAndToEmpty\" (and (is Empty (to)) (not (\"IsInCheck\" \"King\" Mover at:(to))))) (define \"RememberPieceHasMoved\" (then (if (= (state at:(last To)) 1) (\"PieceHasMoved\" (last To))))) (define \"PieceHasMoved\" (set State at:#1 0)) (define \"HasNeverMoved\" (= (state at:(mapEntry #1 (mover))) 1)) (define \"CanNotMove\" (not (can Move (do (and (forEach Piece #1) (set NextPlayer (player #2))) ifAfterwards:(not (\"IsInCheck\" \"King\" #1)))))) (game \"Four-Player Chess\" (players {(player N) (player S) (player E) (player W)}) (equipment { (board (merge (shift 0 3 (rectangle 8 14)) (shift 3 0 (rectangle 14 8)))) (\"ChessPawn\" \"Pawn\" (or (if (is In (from) (sites Start (piece (what at:(from))))) (\"DoubleStepForwardToEmpty\" \"SetEnPassantLocation\")) \"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 \"H1\") (pair 2 \"H14\") (pair 3 \"A7\") (pair 4 \"N7\")}) (map \"RookLeft\" {(pair 1 \"D1\") (pair 2 \"K14\") (pair 3 \"A11\") (pair 4 \"N4\")}) (map \"RookRight\" {(pair 1 \"K1\") (pair 2 \"D14\") (pair 3 \"A4\") (pair 4 \"N11\")}) (regions \"Promotion\" P1 (sites Top)) (regions \"Promotion\" P2 (sites Bottom)) (regions \"Promotion\" P3 (sites Right)) (regions \"Promotion\" P4 (sites Left))}) (rules (start { (place \"Pawn1\" (sites Row 1)) (place \"Pawn2\" (sites Row 12)) (place \"Pawn3\" (sites Column 1)) (place \"Pawn4\" (sites Column 12)) (place \"Rook1\" {\"D1\" \"K1\"} state:1) (place \"Knight1\" {\"E1\" \"J1\"}) (place \"Bishop1\" {\"F1\" \"I1\"}) (place \"Queen1\" coord:\"G1\") (place \"King1\" coord:\"H1\" state:1) (place \"Rook2\" {\"D14\" \"K14\"} state:1) (place \"Knight2\" {\"E14\" \"J14\"}) (place \"Bishop2\" {\"F14\" \"I14\"}) (place \"Queen2\" coord:\"G14\") (place \"King2\" coord:\"H14\" state:1) (place \"Rook3\" {\"A11\" \"A4\"} state:1) (place \"Knight3\" {\"A10\" \"A5\"}) (place \"Bishop3\" {\"A6\" \"A9\"}) (place \"Queen3\" coord:\"A8\") (place \"King3\" coord:\"A7\" state:1) (place \"Rook4\" {\"N4\" \"N11\"} state:1) (place \"Knight4\" {\"N5\" \"N10\"}) (place \"Bishop4\" {\"N6\" \"N9\"}) (place \"Queen4\" coord:\"N8\") (place \"King4\" coord:\"N7\" state:1)}) (play (if \"SameTurn\" (move Promote (last To) (piece {\"Queen\" \"Knight\" \"Bishop\" \"Rook\"}) Mover) (do (or (forEach Piece) (if (and (\"HasNeverMoved\" \"King\") (not (\"IsInCheck\" \"King\" Mover))) (or { (if (and (\"HasNeverMoved\" \"RookLeft\") (can Move (\"CastleRook\" \"RookLeft\" E 3 (is Empty (to))))) \"BigCastlingHor\") (if (and (\"HasNeverMoved\" \"RookRight\") (can Move (\"CastleRook\" \"RookRight\" W 2 (is Empty (to))))) \"SmallCastlingHor\") (if (and (\"HasNeverMoved\" \"RookLeft\") (can Move (\"CastleRook\" \"RookLeft\" S 3 (is Empty (to))))) \"BigCastlingVer\") (if (and (\"HasNeverMoved\" \"RookRight\") (can Move (\"CastleRook\" \"RookRight\" N 2 (is Empty (to))))) \"SmallCastlingVer\")}))) ifAfterwards:(not (\"IsInCheck\" \"King\" Mover))) (then (and { (\"RemoveKingIfCheckmate\" P1 1) (\"RemoveKingIfCheckmate\" P2 2) (\"RemoveKingIfCheckmate\" P3 3) (\"RemoveKingIfCheckmate\" P4 4)})))) (end { (forEach NonMover if:(\"IsOffBoard\" (where \"King\" Player)) (result Player Loss)) (if (and (<= (count Active) 2) (or (no Moves Mover) (= (counter) (* 50 (count Active))))) (result Mover Draw))})))\n\n###\n\n", "completion": "Once a player is checkmated their king is removed, but all their other pieces remain on the board as neutral obstacles. Neutral pieces cannot help checkmate other players. If a player cannot make a move when there are more than two players remaining, they skip their turn rather than giving a stalemate. Four Players. END" }, { "prompt": "Modify the Ludii game according to the following option changes:\n3 Players. -> 4 Players.\n(define \"CaptureAgain\" (then (if (and (< (count MovesThisTurn) 6) (can Move (\"Move\" (from (last To))))) (moveAgain) (forEach Site (sites Board) (if (= 1 (state at:(site))) (set State at:(site) 0)))))) (define \"Move\" (move Hop #1 (between if:(and (is Occupied (between)) (!= 1 (state at:(between))))) (to if:(is Empty (to)) (apply (if (is Even (count MovesThisTurn)) (and { (remove (between)) (if (= (what at:(between)) (id \"Marker\" Shared)) (addScore Mover 1) (addScore Mover 2)) (forEach Site (sites Board) (if (= 1 (state at:(site))) (and (remove (site)) (if (= (what at:(site)) (id \"Marker\" Shared)) (addScore Mover 1) (addScore Mover 2)))))}) (set State at:(between) 1)))) #2)) (game \"Pasang\" (players 3) (equipment { (board (add (remove (square 11) vertices:{48 49 50 59 60 61 70 71 72}) edges:{ {0 12} {12 24} {24 36} {10 20} {20 30} {30 40} {75 87} {87 99} {99 111} {71 81} {81 91} {91 101}}) use:Vertex) (piece \"Marker\" Shared (\"Move\" (from) (\"CaptureAgain\"))) (piece \"Disc\" Shared (\"Move\" (from) (\"CaptureAgain\")))}) (rules (start { (place \"Marker\" (forEach (sites {0..47 56..63}) if:(is Even (site)))) (place \"Disc\" (forEach (sites {0..47 56..63}) if:(is Odd (site)))) (place \"Marker\" (forEach (sites {48..55 64..111}) if:(is Odd (site)))) (place \"Disc\" (forEach (sites {48..55 64..111}) if:(is Even (site))))}) phases:{ (phase \"InitPhase\" (play (move Remove (sites Corners) (then (set Score Mover 1)))) (nextPhase \"MainPhase\")) (phase \"MainPhase\" (play (if (\"SameTurn\") (and (move Pass (then (forEach Site (sites Board) (if (= 1 (state at:(site))) (set State at:(site) 0))))) (\"Move\" (from (last To)) (\"CaptureAgain\"))) (forEach Piece Shared))))} (end (if (no Moves Next) (byScore)))))\n\n###\n\n", "completion": "(define \"CaptureAgain\" (then (if (and (< (count MovesThisTurn) 6) (can Move (\"Move\" (from (last To))))) (moveAgain) (forEach Site (sites Board) (if (= 1 (state at:(site))) (set State at:(site) 0)))))) (define \"Move\" (move Hop #1 (between if:(and (is Occupied (between)) (!= 1 (state at:(between))))) (to if:(is Empty (to)) (apply (if (is Even (count MovesThisTurn)) (and { (remove (between)) (if (= (what at:(between)) (id \"Marker\" Shared)) (addScore Mover 1) (addScore Mover 2)) (forEach Site (sites Board) (if (= 1 (state at:(site))) (and (remove (site)) (if (= (what at:(site)) (id \"Marker\" Shared)) (addScore Mover 1) (addScore Mover 2)))))}) (set State at:(between) 1)))) #2)) (game \"Pasang\" (players 4) (equipment { (board (add (remove (square 11) vertices:{48 49 50 59 60 61 70 71 72}) edges:{ {0 12} {12 24} {24 36} {10 20} {20 30} {30 40} {75 87} {87 99} {99 111} {71 81} {81 91} {91 101}}) use:Vertex) (piece \"Marker\" Shared (\"Move\" (from) (\"CaptureAgain\"))) (piece \"Disc\" Shared (\"Move\" (from) (\"CaptureAgain\")))}) (rules (start { (place \"Marker\" (forEach (sites {0..47 56..63}) if:(is Even (site)))) (place \"Disc\" (forEach (sites {0..47 56..63}) if:(is Odd (site)))) (place \"Marker\" (forEach (sites {48..55 64..111}) if:(is Odd (site)))) (place \"Disc\" (forEach (sites {48..55 64..111}) if:(is Even (site))))}) phases:{ (phase \"InitPhase\" (play (move Remove (sites Corners) (then (set Score Mover 1)))) (nextPhase \"MainPhase\")) (phase \"MainPhase\" (play (if (\"SameTurn\") (and (move Pass (then (forEach Site (sites Board) (if (= 1 (state at:(site))) (set State at:(site) 0))))) (\"Move\" (from (last To)) (\"CaptureAgain\"))) (forEach Piece Shared))))} (end (if (no Moves Next) (byScore))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe board is drawn in the sand, with any large number of holes in a spiral pattern. The starting point is before the first hole in the outer ring of the spiral, and is made as a mound of sand; the goal is another mound of sand at the center of the spiral. Each player has one piece, which they place on the starting mound. Another piece, the hyena, also begins on the starting mound. Four throwing sticks, with a black side and a white side, used as dice. The values of the throws are as follows: four white sides = 20; three white sides = 5; two white sides = 0; one white sides = 9; all black sides = 80. Players throw, move, and throw again until they throw a 0. When a player reaches the goal, they then play as the hyena on their turn. When the hyena catches up to another player's piece, it drags the piece with it, until throwing a 0. When a 0 is thrown, the player moves back to the place where they were before the hyena dragged them, and must overtake the hyena in this turn. If the player cannot, they are removed from the game. If the player is overtaken by the hyena a second time, they are removed from the game. The game has 4 players.\n\n###\n\n", "completion": "(define \"MoveHyena\" (move (from (\"WhereHyena\") level:(\"LevelHyena\")) (to (\"HyenaOnTrack\" \"Track\" (\"ThrowValue\"))) (then (if (= (last To) (\"Center\")) (forEach Site (sites Track \"Track\" from:(last From) to:(last To)) (if (!= (site) (last To)) (forEach Level (site) FromTop (remove (site) level:(level))))) (forEach Site (sites Track \"Track\" from:(last From) to:(last To)) (if (!= (site) (last To)) (forEach Level (site) FromTop (fromTo (from (site) level:(level)) (to (last To) (apply (if (and (= 0 (state at:(site) level:(level))) (!= 0 (who at:(site) level:(level)))) (if (<= (site) (- (count Vertices) 1)) (set State at:(site) level:(level) (site)))))))))))))) (define \"Center\" 0) (define \"LevelHyena\" (where Level \"Hyena\" Neutral at:(\"WhereHyena\"))) (define \"WhereHyena\" (if (\"IsNotOffBoard\" (where \"Hyena\" Neutral)) (where \"Hyena\" Neutral) (handSite P1))) (define \"HyenaPhaseDone\" (or (= (\"WhereHyena\") (\"Center\")) (and { (is Occupied (\"Center\")) (>= 1 (count Sites in:(difference (sites Occupied by:All) (\"WhereHyena\")))) (\"IsSingletonStack\" (\"WhereHyena\"))}))) (define \"HyenaOnTrack\" (\"NextSiteOnTrack\" #2 from:(\"WhereHyena\") #1)) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" #2 #1)) (define \"NotThrow0\" (!= (\"ThrowValue\") 0)) (define \"ThrowValue\" (mapEntry \"Throw\" (count Pips))) (game \"Ishighan\" (players 4) (equipment { (board (spiral turns:5 sites:86) { (track \"Track\" {86..0} directed:True)} use:Vertex) (\"StickDice\" 4) (map \"Throw\" {(pair 0 20) (pair 1 5) (pair 2 0) (pair 3 9) (pair 4 80)}) (piece \"Stick\" Each (if (\"IsOffBoard\" (\"SiteToMoveOnTrack\" \"Track\" (\"ThrowValue\"))) (move (from (from) level:(level)) (to 0) (then (if (= 1 (value Player Mover)) (forEach Site (sites Track \"Track\" from:(last From) to:(last To)) (forEach Level (site) FromTop (if (\"IsPieceAt\" \"Hyena\" Neutral (site) level:(level)) (set Value Mover 2))))))) (move (from (from) level:(level)) (to (\"SiteToMoveOnTrack\" \"Track\" (\"ThrowValue\")) if:True) (then (if (= 1 (value Player Mover)) (forEach Site (sites Track \"Track\" from:(last From) to:(last To)) (forEach Level (site) FromTop (if (\"IsPieceAt\" \"Hyena\" Neutral (site) level:(level)) (set Value Mover 2)))))))) maxState:85) (piece \"Hyena\" Neutral) (hand P1)}) (rules (start { (place Stack items:{\"Stick4\" \"Stick3\" \"Stick2\" \"Stick1\"} (handSite P1)) (place Stack \"Hyena0\" (handSite P1))}) (play (\"RollMove\" (if (= (\"Center\") (where \"Stick\" Mover)) (if (\"NotThrow0\") (\"MoveHyena\") (move Pass (then (forEach Site (sites Board) (forEach Level (site) FromTop (if (!= 0 (state at:(site) level:(level))) (if (< 0 (value Player (who at:(site) level:(level)))) (remove (site) level:(level)) (fromTo (from (site) level:(level)) (to (state at:(site) level:(level)) (apply (and (set State at:(site) level:(level) 0) (set Value (player (who at:(site) level:(level))) 1)))))))))))) (if (\"NotThrow0\") (or (forEach Piece) (forEach Piece container:1)) (move Pass (then (if (= 1 (value Player Mover)) (remove (where \"Stick\" Mover) level:(where Level \"Stick\" Neutral at:(where \"Stick\" Mover)))))))) (then (if (\"NotThrow0\") (moveAgain))))) (end { (forEach Player if:(no Pieces Player) (result Player Loss)) (forEach Player if:(\"HyenaPhaseDone\") (result Player Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nWhen a capture is made, the capturing piece is revealed to the opponent. If an orthogonal move is attempted to a spot with a hidden piece of the opponent, the move is not completed and the enemy piece is revealed. The goal is to reach the opposite side of the board like in Breakthrough. \n\n###\n\n", "completion": "(define \"RegionReached\" (not (= (count Sites in:(sites Occupied by:Mover)) (count Sites in:(difference (sites Occupied by:Mover) (sites Next)))))) (define \"Moves\" (or { \"StepForwardToEmpty\" (move Step Forward (to if:(and (\"IsEnemyAt\" (to)) (is Hidden at:(to) to:Mover))) (then (fromTo (from (last To)) (to (last From)) (then (and { (add (piece (next)) (to (last To))) (set Hidden at:(last To) False to:Next) (set Hidden at:(last To) False to:Mover)}))))) (move Step (directions {FR FL}) (to if:(is Empty (to)) (apply (remove (to))))) (move Step (directions {FR FL}) (to if:(\"IsEnemyAt\" (to)) (apply (remove (to)))) (then (set Hidden at:(last To) to:Next)))})) (game \"Sneakthrough\" (players 2) (equipment { (board (square 8)) (piece \"Pawn\" P1 N \"Moves\") (piece \"Pawn\" P2 S \"Moves\") (regions P2 (sites Top)) (regions P1 (sites Bottom))}) (rules (start { (place \"Pawn1\" (expand (sites Bottom))) (place \"Pawn2\" (expand (sites Top))) (set Hidden (difference (sites Board) (sites Occupied by:P1)) to:P1) (set Hidden (difference (sites Board) (sites Occupied by:P2)) to:P2)}) (play (forEach Piece)) (end (if \"RegionReached\" (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe board is initially empty. Each player chooses a colour: White or Black. White starts by placing a stone on a vacant square. Black does the same.\n \n Players continue taking turns; however, your turn goes as follows: 1. Mark one of your exposed stones for removal from the board (i.e. it cannot be under an enemy stone). 2. Add one of your stones to the board. 3. Add another one of your stones to the board, at which point the marked stone is removed. The following rules constrain where you can add each stone: It must be a \u201cknight\u2019s move\u201d away from the marked stone. That is to say, either 2 spaces vertically and 1 horizontally, or 2 spaces horizontally, and 1 vertically away from the marked stone. The space on which you place it must have none of your stones, and either: be vacant, or have an enemy stone, in which case you will place yours on top, creating a stack that you control. If, at the end of your opponent\u2019s turn, you have at least 5 of your stones and/or stacks in the same rank, or in the same file, you win.\n\n###\n\n", "completion": "(define \"OpponentCount\" (count Sites in:(\"OpponentSites\" #1 #2))) (define \"OpponentSites\" (intersection (sites #1 #2) (sites Occupied by:Next container:\"Board\"))) (define \"MoveSecondKnight\" (move Add (to (\"PossibleKnightSites\" (var \"CondemnedSite\"))) stack:True (then (remove (var \"CondemnedSite\"))))) (define \"MoveFirstKnight\" (move Add (to (\"PossibleKnightSites\" (var \"CondemnedSite\"))) stack:True (then (do (set Pending) next:(moveAgain))))) (define \"MoveCondemnPiece\" (move Select (from if:(and (\"IsTopLevel\" (from)) (<= 2 (count Sites in:(\"PossibleKnightSites\" (from)))))) (then (do (set Var \"CondemnedSite\" (last From)) next:(do (set State at:(var \"CondemnedSite\") (\"CondemnedState\")) next:(moveAgain)))))) (define \"PossibleKnightSites\" (sites To (move Leap (from #1) { { F F R F} { F F L F} { F R F F} { F L F F}} (to if:(\"CanPlaceKnight\"))))) (define \"CanPlaceKnight\" (or (is Empty (to)) (and (\"IsEnemyAt\" (to)) (\"IsEmptyOrSingletonStack\" (to))))) (define \"CondemnedState\" 1) (game \"Callanish\" (players 2) (equipment { (board (square 9)) (piece \"Disc\" Each (\"MoveCondemnPiece\"))}) (rules phases: { (phase \"Opening\" (play (move Add (to (sites Empty)))) (nextPhase (>= (count Turns) 2) \"Playing\")) (phase \"Playing\" (play (if \"SameTurn\" (if (is Pending) (\"MoveSecondKnight\") (\"MoveFirstKnight\")) (forEach Piece))))} (end { (if (and (= (% (- (count Moves) 2) 3) 0) (or { (<= 5 (\"OpponentCount\" Row 0)) (<= 5 (\"OpponentCount\" Row 1)) (<= 5 (\"OpponentCount\" Row 2)) (<= 5 (\"OpponentCount\" Row 3)) (<= 5 (\"OpponentCount\" Row 4)) (<= 5 (\"OpponentCount\" Row 5)) (<= 5 (\"OpponentCount\" Row 6)) (<= 5 (\"OpponentCount\" Row 7)) (<= 5 (\"OpponentCount\" Row 8)) (<= 5 (\"OpponentCount\" Column 0)) (<= 5 (\"OpponentCount\" Column 1)) (<= 5 (\"OpponentCount\" Column 2)) (<= 5 (\"OpponentCount\" Column 3)) (<= 5 (\"OpponentCount\" Column 4)) (<= 5 (\"OpponentCount\" Column 5)) (<= 5 (\"OpponentCount\" Column 6)) (<= 5 (\"OpponentCount\" Column 7)) (<= 5 (\"OpponentCount\" Column 8))})) (result Mover Loss)) (if (no Moves Mover) (result Mover Loss))}))) 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. Three six-sided dice. The points form a continuous track in a horseshoe shape; each player progresses in opposite directions, one from their bottom right to the top right, the other from their bottom left to their top left. Pieces begin on the board, each player with eight pieces on the sixth and seven on the seventh point of their track. Players move according to the number on each die by moving one piece the value on one die then another piece the value on the other die, or by moving one piece the value of one die and then the value of the other. A piece cannot move to a point that is occupied by more than one of the opponent's pieces. If a piece lands on a point occupied by a single piece belonging to the opponent, the opponent's piece is removed from the board and must enter again from the beginning of the player's track. A piece may be borne off the board when a throw is greater than the number of points left on the board. The first player to bear all of their pieces off the board wins.\n \n\n###\n\n", "completion": "(define \"CanEscape\" (\"IsOffBoard\" #1)) (define \"AllPieceEscaped\" (no Pieces Mover)) (define \"Bar\" (mapEntry (mover))) (define \"RemoveAPiece\" (move Remove (site))) (define \"NextSiteFromDist6\" (\"NextSiteOnTrack\" 6 from:#1)) (define \"NextSiteFrom\" (\"NextSiteOnTrack\" (pips) from:#1)) (game \"Provincial\" (players 2) (equipment { (\"BackgammonBoard\" (\"BackgammonTracksWithBar\")) (dice num:3) (map {(pair 1 19) (pair 2 6)}) (piece \"Disc\" Each)}) (rules (start { (place Stack \"Disc1\" 7 count:8) (place Stack \"Disc1\" 5 count:7) (place Stack \"Disc2\" 20 count:8) (place Stack \"Disc2\" 18 count:7)}) (play (\"RollEachNewTurnMove\" (forEach Die if:(\"DieNotUsed\") (forEach Site (sites Occupied by:Mover) (if (\"CanEscape\" (\"NextSiteFrom\" (site))) (\"RemoveAPiece\") (move (from (site)) (to (\"NextSiteFrom\" (site)) if:(\"NoEnemyOrOnlyOne\" (to)) (\"HittingCapture\" (\"Bar\")))))) (then (\"ReplayNotAllDiceUsed\"))))) (end (if (\"AllPieceEscaped\") (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n8x8 board. Twelve pieces per player. Pieces move diagonally one space forward, and can capture opponent's pieces by jumping them in a forward direction if they are adjacent. Capturing must happen if it is possible. Multiple captures are allowed. Once pieces reach the opposite side of the board from their starting position, they become kings and can move diagonally either forwards or backwards, and can capture by jumping over any number of pieces, any distance. The goal is to capture all of the opponent's pieces. \n\n###\n\n", "completion": "(define \"IsUnpromoted\" (\"IsPieceAt\" \"Counter\" Mover (last To))) (game \"Main Dam\" (\"TwoPlayersNorthSouth\") (\"DraughtsEquipment\" (square 8)) (rules (\"BlackCellsSetup\" 3) (play (if \"SameTurn\" (if \"IsUnpromoted\" (\"HopCapture\" (from (last To)) (directions {FR FL}) (then (\"PromoteIfReach\" (sites Next) \"DoubleCounter\" (\"ReplayIfCanMove\" (\"HopCapture\" (from (last To)) (directions {FR FL})))))) (\"HopDiagonalSequenceCaptureAgain\" before:(count Rows) after:(count Rows))) (priority { (or (forEach Piece \"Counter\" (\"HopCapture\" (from) (directions {FR FL}) (then (\"PromoteIfReach\" (sites Next) \"DoubleCounter\" (\"ReplayIfCanMove\" (\"HopCapture\" (from (last To)) (directions {FR FL}))))))) (forEach Piece \"DoubleCounter\" (\"HopDiagonalSequenceCapture\" before:(count Rows) after:(count Rows)))) (or (forEach Piece \"Counter\" (\"StepToEmpty\" (directions {FR FL})) (then (\"PromoteIfReach\" (sites Next) \"DoubleCounter\"))) (forEach Piece \"DoubleCounter\" (move Slide Diagonal)))}))) (end (\"BlockWin\")))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"Hund efter Hare (Vendsyssel)\" (players 2) (equipment { (board (add (merge { (add (remove (rectangle 1 7) vertices:{3}) edges:{{2 3}}) (scale 2 (shift 0.5 -0.5 (rectangle 1 3))) (scale 2 (shift 0.5 0.5 (rectangle 1 3)))}) edges:{ {0 9} {0 6} {11 5} {5 8} {1 6} {1 9} {4 11} {4 8} {9 2} {2 7} {6 2} {2 10} {10 3} {3 8} {7 3} {3 11}}) use:Vertex) (piece \"Hare\" P1 \"StepToEmpty\") (piece \"Dog\" P2 \"StepToEmpty\")}) (rules (start { (place \"Hare1\" coord:\"B2\") (place \"Dog2\" (sites {\"A2\" \"B1\" \"B3\"}))}) (play (forEach Piece)) (end { (if (no Moves P1) (result P2 Win))})))\n\n###\n\n", "completion": "Three diamonds in a row, the central one connecting to the others one opposite corners. A horizontal line connects the top corners of the diamonds, another horizontal line connects the bottom corners of the diamonds, and a longer horizontal line connects all the middle corners. The outer two diamonds have vertical lines connecting their top and bottom corners. One player plays as three hounds, which begin on the outer corner and top and bottom corner of one of the end diamonds. The other player plays as one hare, which begins on the central point of the same diamond. Players alternate turns moving a piece to an empty adjacent spot along the lines of the board. The Hare moves first. The hounds win by blocking the hare from being able to move. The game has an ending condition only for P2. END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" #2 #1)) (define \"ThrowValue\" (if (= 1 (count Pips)) 1 (if (= 4 (count Pips)) 5 (if (= 0 (count Pips)) 10 (if (= 2 (count Pips)) (if (or (= 0 (\"BlankDie1\")) (= 0 (\"BlankDie2\"))) 2 35) (if (or (= 0 (\"BlankDie1\")) (= 0 (\"BlankDie2\"))) 3 (if (= 0 (\"StripedDie\")) 20 15))))))) (define \"BlankDie2\" (face 74)) (define \"BlankDie1\" (face 73)) (define \"CrossHatchingDie\" (face 72)) (define \"StripedDie\" (face 71)) (game \"Kolica Atarakua\" (players 2) (equipment { (board (add (merge { (rectangle 1 10) (shift 0 9 (rectangle 1 10)) (shift -1 -1 (square 2)) (shift 9 -1 (square 2)) (rectangle 10 1) (shift 9 0 (rectangle 10 1)) (shift -1 9 (square 2)) (shift 9 9 (square 2)) (shift 5 0 (rectangle 6 1)) (shift 0 5 (rectangle 1 6)) (shift 4 4 (rectangle 1 6)) (shift 4 4 (rectangle 6 1))}) vertices:{{1 1} {1 8} {8 1} {8 8} {4.5 4.5}}) { (track \"Track1\" \"69,5,N,W,N,W,S,65,11,E,N,W,67,41,S,E,N,66,8,W,S,E,64,26,N4,E3,68,56\" P1 directed:True) (track \"Track2\" \"70,14,S,E,S,E,N,66,8,W,S,E,64,26,N,W,S,65,11,E,N,W,67,41,S4,W3,68,56\" P2 directed:True)} use:Vertex) (\"StickDice\" 4) (piece \"Marker\" Each (if (\"IsOffBoard\" (\"SiteToMoveOnTrack\" from:(from) (\"ThrowValue\"))) (move Remove (from) level:(level)) (move (from (from) level:(level)) (to (\"SiteToMoveOnTrack\" from:(from) (\"ThrowValue\")) if:True (\"HittingStackCapture\" (handSite (who at:(to) level:(level))))) (then (if (is In (last To) (sites \"RemoveSites\")) (fromTo (from (last To)) (to (handSite (mover))))))))) (hand Each) (regions \"RemoveSites\" (sites {51 56}))}) (rules (start { (place Stack \"Marker1\" (handSite P1) count:4) (place Stack \"Marker2\" (handSite P2) count:4)}) (play (\"RollMove\" (or (forEach Piece) (forEach Piece container:(mover))))) (end (\"EscapeWin\"))))\n\n###\n\n", "completion": "Two players. Four pieces per player, played with four stick dice. They are round on one side, flat on the other, and the round side of one has horizontal stripes, another has cross-hatching, the other two remaining blank. The throws are as follows: One flat side up = 1; two flat sides and at least one blank round side up = 2; two flat sides and both marked round sides up = 35; four flat sides up = 5; four round sides up = 10; three flat sides and one blank round side up = 3; three flat sides and cross-hatched round side up = 15; three flat sides and striped round side up = 20. The throw may only be applied to one piece. Pieces enter from the midpoint of the sides and proceed along the track in the middle, then back to the edge following that track and making a circuit of the board, returning back to the center when it has traveled along the entire perimeter. If a piece lands exactly on the points where the tracks cross in the center, the piece starts again from the beginning, but remains in the center of the board until it does so. The goal is for pieces to pass the points where the center tracks intersect after traveling all the way around the board with all four pieces. If a player lands on the same space as an opponent's piece, the opponent's piece must again start from the beginning. END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6 board with two stores. Five counters in each hole. Sowing occurs in an anti-clockwise direction. When the final counter lands in a hole in the opponent's row containing one or two counters, thus making it contain two or three counters, they are captured. Any other holes in the opponent's row which also contain two or three counters, in an unbroken sequence preceding the hole where the first capture was made, are captured. When a player sows around the board, the hole from which the counters were taken is left empty. Play ends when one player cannot play from their row, and players capture any remaining counters in their holes. The player with the most counters wins. The seeds have a normal size.\n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (+ (count at:(mapEntry #1)) (count in:(sites #1)))) (define \"Columns\" 6) (game \"Shono\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" (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 5 to:(sites Track))) (play (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)))) (end (\"MancalaByScoreWhen\" (no Moves Mover))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe abstract strategy game Quoridor is surprisingly deep for its simple rules. The object of the game is to advance your pawn to the opposite edge of the board. On your turn you may either move your pawn or place a wall. You may hinder your opponent with wall placement, but not completely block them off. Meanwhile, they are trying to do the same to you. The first pawn to reach the opposite side wins. The game has 2 players\n\n###\n\n", "completion": "(define \"NumPlayers\" 2) (define \"SizePath\" (count Steps (step Orthogonal (to if:(and (is Empty (to)) (\"NoEdgeBetweenCells\" (from) (to))))) (where \"Pawn\" #1) (sites #1))) (define \"ReachedTarget\" (and (is LastTo Cell) (is In (last To) (sites Mover)))) (define \"NoEdgeBetweenCells\" (all Sites (sites Occupied by:Shared on:Edge) if:(not (is In (site) (\"EdgeInCommon\" #1 #2))))) (define \"EdgeInCommon\" (intersection (sites Incident Edge of:Cell at:#1) (sites Incident Edge of:Cell at:#2))) (game \"Quoridor\" (players \"NumPlayers\") (equipment { (board (square 9)) (piece \"Pawn\" Each (or (move Step Orthogonal (to if:(and (is Empty (to)) (\"NoEdgeBetweenCells\" (from) (to))))) (move Hop Orthogonal (between if:(\"IsEnemyAt\" (between))) (to if:(and { (is Empty (to)) (\"NoEdgeBetweenCells\" (from) (between)) (\"NoEdgeBetweenCells\" (between) (to))}))))) (piece \"Rectangle\" Shared) (hand Each) (regions P1 (sites Top)) (regions P2 (sites Bottom))}) (rules (start { (place \"Rectangle\" (handSite P1) count:10) (place \"Rectangle\" (handSite P2) count:10) (place \"Pawn1\" (intersection (sites Bottom) (sites Column (column of:(centrePoint))))) (place \"Pawn2\" (intersection (sites Top) (sites Column (column of:(centrePoint)))))}) (play (or (do (if (is Occupied (handSite Mover)) (move (from (handSite Mover)) (to Edge (difference (sites Empty Edge) (sites Outer Edge))))) ifAfterwards:(and { (!= Infinity (\"SizePath\" P1)) (!= Infinity (\"SizePath\" P2))})) (forEach Piece))) (end (if \"ReachedTarget\" (result Mover Win))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"IsFirstCheck\" (is Pending)) (define \"SetFirstCheck\" (set Pending)) (define \"RememberKingMovedOrChecked\" (set State at:#1 1)) (define \"KingMovedOrCheckedBefore\" (= 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 \"Main Chator\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (piece \"King_noCross\" (or (\"StepToNotFriend\" ~ (then (if (not (\"KingMovedOrCheckedBefore\" (last To))) (\"RememberKingMovedOrChecked\" (last To))))) (if (\"IsFirstCheck\") (or { (\"SlideCapture\" ~ (between (exact 2))) (\"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))))))})))) (\"ChessRook\" \"Rook\" ~ (then (if (and (not (\"RookMovedBefore\" (last To))) (not (is In (last To) (\"SitesNextToKing\")))) (\"RememberRookMoved\" (last To))))) (\"ChessBishop\" \"Bishop_noCross\") (\"ChessKnight\" \"Knight\") (piece \"Pawn\" (if (= 1 (state at:(from))) (\"StepToEmpty\" (directions {Rightward Leftward}) (then (set State at:(last To) 2))) (if (= 2 (state at:(from))) (\"StepToEmpty\" (directions {BR BL Rightward Leftward}) (then (promote (last To) (piece \"Queen\") Mover))) (or { \"StepForwardToEmpty\" (\"StepToEnemy\" (directions {FR FL}))} (then (if (is In (last To) (sites Mover \"Promotion\")) (if (is In (last To) (sites Corners)) (promote (last To) (piece \"Queen\") Mover) (set State at:(last To) 1)))))))) (\"ChessQueen\" \"Queen\") (regions \"Promotion\" P1 (sites Top)) (regions \"Promotion\" P2 (sites Bottom))}) (rules (start { (place \"Pawn1\" (sites Row 1)) (place \"Pawn2\" (sites Row 6)) (place \"Rook1\" {\"A1\" \"H1\"}) (place \"Knight1\" {\"B1\" \"G1\"}) (place \"Bishop_noCross1\" {\"C1\" \"F1\"}) (place \"Queen1\" coord:\"E1\") (place \"King_noCross1\" coord:\"D1\") (place \"Rook2\" {\"A8\" \"H8\"}) (place \"Knight2\" {\"B8\" \"G8\"}) (place \"Bishop_noCross2\" {\"C8\" \"F8\"}) (place \"Queen2\" coord:\"D8\") (place \"King_noCross2\" coord:\"E8\")}) (play (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King_noCross\" Mover)) (then (if (\"IsInCheck\" \"King_noCross\" Next) (if (not (\"KingMovedOrCheckedBefore\" (where \"King_noCross\" Next))) (and (\"RememberKingMovedOrChecked\" (where \"King_noCross\" Next)) (\"SetFirstCheck\"))))))) (end (\"Checkmate\" \"King_noCross\"))))\n\n###\n\n", "completion": "Played on an 8x8 board with pieces with specialized moves. The pieces are as follows, and placed on the outer rank in the following order, starting from the left corner and moving in, with the placement mirrored on the right side (the Mautri is placed to the right of the Rajah): Tor (2): can move any number of spaces orthogonally; Kudah (2): moves in any direction, one space orthogonally with one space forward diagonally, jumping over any intervening pieces; Gajah (2): can move any number of spaces diagonally; Rajah (1): can move one space orthogonally or diagonally; Mautri (1): can move any number of spaces orthogonally or diagonally; Bidah (8), placed in front of the other pieces: can move one space forward, or one space diagonally to capture. The Bidah are placed on the second file. When first checked, the Rajah may move like a Kudah, or move two spaces in any direction. Players capture pieces by moving onto a space occupied by an opponent's piece. Castling may occur in two separate moves: the Tor moves next to the Rajah, and if the Rajah is checked, it may move to the other side of the Tor. Promotion of Bidahs occur when they reach the opposite edge of the board, but only immediately if they reach the Tor's square. Pawns reaching any other square must make two further moves before they can be promoted; the first must be a lateral orthogonal move, the second may be lateral orthogonal or diagonal. If the Rajah can be captured on the opponent's next turn, it is in check. The Rajah must not be in check at the end of the player's turn. If this is impossible, it is checkmate and the opponent wins. END" }, { "prompt": "Construct a Ludii game based on the following description\n4x8 board, played only along the perimeter. One to four counters per hole. Any number of players, holes are distributed equally among the players. Sowing occurs in an anti-clockwise direction. Each player owns the holes in which their counters are located at the beginning of their turn, and they must sow from the leftmost hole. When a counter falls into a hole containing counters belonging to the opponent, this hole and the counters in it are captured by the player, but remain in place and 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. 4 seeds per hole. The board is a 4x8.\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 \"NumSeed\" 4) (define \"Columns\" 8) (game \"Quendo\" (players 4) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track\" \"0,E,N,W,S2\" loop:True)}) (piece \"Seed\" Each) (hand Each)}) (rules (start { (place \"Seed1\" (sites {0..4}) counts:{\"NumSeed\"}) (place \"Seed2\" (sites {5..7 15 23}) counts:{\"NumSeed\"}) (place \"Seed3\" (sites {31..27}) counts:{\"NumSeed\"}) (place \"Seed4\" (sites {26..24 16 8}) counts:{\"NumSeed\"})}) (play (if (!= 1 (count Pieces Mover)) (move Select (from (\"LeftMost\")) (then (sow 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)))))))) (move (from (\"LeftMost\")) (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\nThe dilemma is repeated 10 times:\n - If the two players are cooperating (C), they get 6 points.\n - If the two players are defecting (D), they get 2 points.\n - If one player is cooperating (C) and the other is defecting (D), the first one gets 0 points and the second one gets 10 points.\n \n\n###\n\n", "completion": "(define \"DefectP2\" (= 1 (var \"Choice2\"))) (define \"CooperateP2\" (= 0 (var \"Choice2\"))) (define \"DefectP1\" (= 1 (var \"Choice1\"))) (define \"CooperateP1\" (= 0 (var \"Choice1\"))) (define \"P2IsDefecting\" (set Var \"Choice2\" 1)) (define \"P2IsCooperating\" (set Var \"Choice2\" 0)) (define \"P1IsDefecting\" (set Var \"Choice1\" 1)) (define \"P1IsCooperating\" (set Var \"Choice1\" 0)) (game \"Iterated Prisoners Dilemma\" (players 2) (mode Simultaneous) (equipment { (board (square 2))}) (rules (play (or { (move Select (from 0) P1 (then (\"P1IsCooperating\"))) (move Select (from 1) P1 (then (\"P1IsDefecting\"))) (move Select (from 2) P2 (then (\"P2IsCooperating\"))) (move Select (from 3) P2 (then (\"P2IsDefecting\")))} (then (if (and (\"CooperateP1\") (\"CooperateP2\")) (and (addScore P1 3) (addScore P2 3)) (if (and (\"DefectP1\") (\"DefectP2\")) (and (addScore P1 1) (addScore P2 1)) (if (and (\"CooperateP1\") (\"DefectP2\")) (and (addScore P1 0) (addScore P2 5)) (and (addScore P1 5) (addScore P2 0))))) applyAfterAllMoves:True))) (end (if (= (counter) 8) (byScore))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game is played on the Graph2. -> The game is played on the Graph3.\n(game \"SpanRups\" (players 1) (equipment { (board (graph vertices:{ {1 0} {3 0} {5 0} {6 0} {7 0} {8 0} {10 0} {11 0} {12 0} {0 2} {3 2} {5 2} {8 2} {11 2} {2 3} {7 3} {1 4} {12 4} {2 5} {5 5} {8 5} {10 5} {2 7} {6 7} {10 7}{1 8} {4 9} {7 9} {10 9} {1 10} {5 10} {10 10} {1 12} {4 12} {7 12} {9 12}} edges:{ {0 10} {1 10} {2 11} {3 11} {4 12} {5 12} {6 13} {7 13} {8 13} {10 19} {16 10} {9 10} {11 19} {15 20} {12 20} {13 20} {13 17} {14 10} {18 23} {19 23} {20 23} {20 24} {21 20} {23 26} {22 26} {26 33} {26 32} {26 29} {26 25} {23 27} {27 34} {30 27} {27 35} {31 27} {27 28} {24 33} {2 3} {30 35} {34 31} {10 18} {28 34} {6 20} {27 24} {21 17} {23 31} {9 25} {20 31} {15 30} {32 22} {23 25} {19 26} {18 19} {0 16} {9 1} {1 11} {2 15} {5 11} {4 19} {12 21} {17 8}}) use:Edge) (piece \"Marker\" Each)}) (rules (play (move Add (to Edge (sites Empty Edge)))) (end { (if (no Moves Mover) (result Mover Loss)) (if (is SpanningTree Mover) (result Mover Win))})))\n\n###\n\n", "completion": "(game \"SpanRups\" (players 1) (equipment { (board (graph vertices:{ {6 0} {5 5} {9 5} {0 7} {2 7} {7 7} {12 7} {14 7} {5 9} {9 9} {6 14}} edges:{ {0 1} {0 2} {0 3} {0 4} {0 5} {0 6} {0 7} {0 10} {3 4} {4 5} {5 6} {6 7} {1 4} {1 5} {2 5} {2 6} {4 8} {5 8} {5 9} {6 9} {3 10} {4 10} {8 10} {5 10} {9 10} {6 10} {7 10}}) use:Edge) (piece \"Marker\" Each)}) (rules (play (move Add (to Edge (sites Empty Edge)))) (end { (if (no Moves Mover) (result Mover Loss)) (if (is CaterpillarTree Mover) (result Mover Win))}))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\n2 Tigers. -> 3 Tigers.\n6 Goats. -> 7 Goats.\n(game \"Pulijudamu\" (players 2) (equipment { (board (add (remove (merge (scale 1 2 (wedge 5 3)) (shift 0 2 (scale 8 2 (rectangle 3 2)))) edges:{{17 18} {15 16} {13 14}}) edges:{{13 7} {15 4} {17 1} {3 18} {6 16} {9 14}}) use:Vertex) (hand Each) (piece \"Goat\" P2 (\"StepToEmpty\")) (piece \"Tiger\" P1 (or (\"StepToEmpty\") (\"HopCapture\")))}) (rules (start { (place \"Goat2\" (handSite P2) count:6) (place \"Tiger1\" (handSite P1) count:2)}) phases:{ (phase \"Opening\" P1 (play (move (from (handSite Mover)) (to (if (= 0 (count Sites in:(intersection (sites Top) (sites Occupied by:Mover)))) (sites Top) (intersection (sites Empty) (sites {1 2 3})))) (then (if (\"HandOccupied\" Mover) (moveAgain))))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (phase \"Opening\" P2 (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (\"PhaseMovePiece\" \"Movement\")} (end (\"NoMovesP1NoPiecesP2\"))))\n\n###\n\n", "completion": "(game \"Pulijudamu\" (players 2) (equipment { (board (add (remove (merge (scale 1 2 (wedge 5 3)) (shift 0 2 (scale 8 2 (rectangle 3 2)))) edges:{{17 18} {15 16} {13 14}}) edges:{{13 7} {15 4} {17 1} {3 18} {6 16} {9 14}}) use:Vertex) (hand Each) (piece \"Goat\" P2 (\"StepToEmpty\")) (piece \"Tiger\" P1 (or (\"StepToEmpty\") (\"HopCapture\")))}) (rules (start { (place \"Goat2\" (handSite P2) count:7) (place \"Tiger1\" (handSite P1) count:3)}) phases:{ (phase \"Opening\" P1 (play (move (from (handSite Mover)) (to (if (= 0 (count Sites in:(intersection (sites Top) (sites Occupied by:Mover)))) (sites Top) (intersection (sites Empty) (sites {1 2 3})))) (then (if (\"HandOccupied\" Mover) (moveAgain))))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (phase \"Opening\" P2 (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (\"PhaseMovePiece\" \"Movement\")} (end (\"NoMovesP1NoPiecesP2\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\n5x5 intersecting lines, with diagonals drawn in each quadrant. One player plays as four tigers, places on the four corners of the board. The other player plays as twenty goats, which are placed on the remaining points, leaving the central point open. Players alternate turns moving a piece to an empty adjacent point along the lines. The tigers may capture a goat by hopping over it to an empty adjacent spot immediately on the opposite side of the goat along the lines. The tigers win when they capture all of the goats; the goats win by blocking the tigers from being able to move. \n\n###\n\n", "completion": "(game \"Kulaochal\" (players 2) (equipment { (\"AlquerqueBoard\" 5 5) (piece \"Tiger\" P1 (or (\"StepToEmpty\") (\"HopCapture\"))) (piece \"Goat\" P2 (\"StepToEmpty\"))}) (rules (start { (place \"Tiger1\" (sites Corners)) (place \"Goat2\" (difference (sites Board) (union (sites Corners) (sites Centre))))}) (play (forEach Piece)) (end (\"NoMovesP1NoPiecesP2\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayed on a 19x19 board. The 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. The game is played on a 19x19 board\n\n###\n\n", "completion": "(define \"CaptureSurroundedPiece\" (enclose (from (last To)) Orthogonal (between if:(\"IsEnemyAt\" (between)) (apply (and (addScore Mover 1) (remove (between))))))) (game \"Go\" (players 2) (equipment { (board (square 19) use:Vertex) (piece \"Marker\" Each)}) (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:\nHex N / N-1 Grid -> Hex Grid - Standard\nOrder 3 board -> Order 5 board\n(define \"DoubleMove\" (then (if (and (is Prev Next) (not (was Pass))) (moveAgain)))) (define \"HexCell\" (board (hex Hexagon 3) use:Cell)) (define \"Hex2Limp\" (board (hex (- 3 1) (+ 3 1)) use:Cell)) (define \"HexLimp\" (board (hex Limping (- 3 1)) use:Cell)) (define \"BoardUsed\" \"HexLimp\") (define \"Connection\" Orthogonal) (define \"ScoreHalf\" (forEach Piece (if (= (* 2 (count Pieces Mover in:(sites Around (from) Orthogonal))) (count Sites in:(sites Around (from) Orthogonal))) (set State at:(from) 1) (set State at:(from) 0)) (then (set Score Mover (count Sites in:(intersection (sites Occupied by:Mover) (sites State 1))))))) (define \"Score3\" (forEach Piece (if (= 3 (count Pieces Mover in:(sites Around (from) Orthogonal))) (set State at:(from) 1) (set State at:(from) 0)) (then (set Score Mover (count Sites in:(intersection (sites Occupied by:Mover) (sites State 1))))))) (game \"Goldilocks Stones\" (players 2) (equipment { \"BoardUsed\" (piece \"Ball\" P1) (piece \"Ball\" P2)}) (rules (start (set Score Each 0)) (play (or (move Pass) (move Add (piece (mover)) (to (sites Empty)) (then \"ScoreHalf\")))) (end (if (all Passed) { (if (= (score Mover) (score Next)) (result Mover Loss)) (if (!= (score Mover) (score Next)) (byScore))}))))\n\n###\n\n", "completion": "(define \"DoubleMove\" (then (if (and (is Prev Next) (not (was Pass))) (moveAgain)))) (define \"HexCell\" (board (hex Hexagon 5) use:Cell)) (define \"Hex2Limp\" (board (hex (- 5 1) (+ 5 1)) use:Cell)) (define \"HexLimp\" (board (hex Limping (- 5 1)) use:Cell)) (define \"BoardUsed\" \"HexCell\") (define \"Connection\" Orthogonal) (define \"ScoreHalf\" (forEach Piece (if (= (* 2 (count Pieces Mover in:(sites Around (from) Orthogonal))) (count Sites in:(sites Around (from) Orthogonal))) (set State at:(from) 1) (set State at:(from) 0)) (then (set Score Mover (count Sites in:(intersection (sites Occupied by:Mover) (sites State 1))))))) (define \"Score3\" (forEach Piece (if (= 3 (count Pieces Mover in:(sites Around (from) Orthogonal))) (set State at:(from) 1) (set State at:(from) 0)) (then (set Score Mover (count Sites in:(intersection (sites Occupied by:Mover) (sites State 1))))))) (game \"Goldilocks Stones\" (players 2) (equipment { \"BoardUsed\" (piece \"Ball\" P1) (piece \"Ball\" P2)}) (rules (start (set Score Each 0)) (play (or (move Pass) (move Add (piece (mover)) (to (sites Empty)) (then \"ScoreHalf\")))) (end (if (all Passed) { (if (= (score Mover) (score Next)) (result Mover Loss)) (if (!= (score Mover) (score Next)) (byScore))})))) 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 corners and midpoints of the squares. Twelve pieces per player. In the first phase, players take turns placing pieces on an empty spot on the board. If they place three pieces so they are in a line, forming a \\ \n\n###\n\n", "completion": "(game \"Mlabalaba\" (players 2) (equipment { (board (concentric Square rings:3 joinCorners:True) use:Vertex) (hand Each) (piece \"Marker\" Each (if (= 3 (count Pieces Mover)) (move (from (from)) (to (sites Empty))) (\"StepToEmpty\") (then (\"ReplayIfLine3\" Orthogonal))))}) (rules (start (place \"Marker\" \"Hand\" count:12)) phases:{ (phase \"Placement\" (play (if \"SameTurn\" (\"RemoveAnyEnemyPieceNotInLine3\" Orthogonal) (move (from (handSite Mover)) (to (sites Empty)) (then (\"ReplayIfLine3\" Orthogonal))))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (phase \"Movement\" (play (if \"SameTurn\" (\"RemoveAnyEnemyPieceNotInLine3\" Orthogonal) (forEach Piece))))} (end (forEach NonMover if:(= 2 (count Pieces Player)) (result Player Loss))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game is played with 2 players. -> The game is played with 3 players.\n(define \"AllReachedCenter\" (= 2 (count Pieces Mover in:(sites Centre)))) (define \"Move\" (or (if (and { (is Occupied (handSite Mover)) (all DiceEqual) (= 2 (value Player Mover))}) (move (from (handSite Mover)) (to (mapEntry \"Entry\" Mover)) (then (and (moveAgain) (set Var \"Double\" 1))))) (forEach Piece))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" #2 #1)) (define \"ThrowValue\" (count Pips)) (game \"Saturankam\" (players 2) (equipment { (board (square 9) { (track \"Track1\" \"81,4,E,N,W,S,E1,N7,E6,S6,W5,N5,E4,S4,W3,N3,E2,S2,W1,N1\" P1 directed:True) (track \"Track2\" \"83,36,S,E,N,W,S1,E7,S6,W6,N5,E5,S4,W4,N3,E3,S2,W2,N1,E1\" P2 directed:True)}) (dice d:4 faces:{1 3 4 6} num:2) (piece \"Marker\" Each (if (and (or { (= (\"SiteToMoveOnTrack\" from:(from) 1) (centrePoint)) (= (\"SiteToMoveOnTrack\" from:(from) 3) (centrePoint)) (= (\"SiteToMoveOnTrack\" from:(from) 4) (centrePoint))}) (= (value Player Mover) (\"ThrowValue\"))) (if (and (all DiceEqual) (= (\"SiteToMoveOnTrack\" from:(from) (/ (\"ThrowValue\") 2)) (centrePoint))) (move (from (from)) (to (centrePoint)) (then (and (moveAgain) (set Var \"Double\" 1))))) (forEach Value min:1 max:(value Player Mover) (move (from (from) level:(level)) (to (\"SiteToMoveOnTrack\" from:(from) (value)) if:True (apply (and (if (and (not (is In (to) (sites \"SafeSites\"))) (\"IsEnemyAt\" (to))) (forEach Level (to) FromTop (fromTo (from (to) level:(level)) (to (handSite (who at:(to) level:(level))))))) (if (< 0 (- (value Player Mover) (value))) (and (moveAgain) (set Value Mover (- (value Player Mover) (value)))) (and (set Value Mover 0) (if (all DiceEqual) (and (moveAgain) (set Var \"Double\" 1)))))))))))) (hand Each) (regions \"SafeSites\" (sites {4 44 76 36 40})) (map \"Entry\" {(pair P1 4) (pair P2 76)})}) (rules (start { (place Stack \"Marker1\" 4 count:2) (place Stack \"Marker2\" 76 count:2)}) (play (if (or (= 1 (var \"Double\")) (\"NewTurn\")) (\"RollMove\" (move Pass (then (and { (set Value Mover (\"ThrowValue\")) (if (= 1 (var \"Double\")) (set Var \"Double\" 0)) (moveAgain)})))) (if (can Move (\"Move\")) (\"Move\") (move Pass (then (and (set Var \"Double\" 0) (set Value Mover 0))))))) (end (if (\"AllReachedCenter\") (result Mover Win)))))\n\n###\n\n", "completion": "(define \"AllReachedCenter\" (= 2 (count Pieces Mover in:(sites Centre)))) (define \"Move\" (or (if (and { (is Occupied (handSite Mover)) (all DiceEqual) (= 2 (value Player Mover))}) (move (from (handSite Mover)) (to (mapEntry \"Entry\" Mover)) (then (and (moveAgain) (set Var \"Double\" 1))))) (forEach Piece))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" #2 #1)) (define \"ThrowValue\" (count Pips)) (game \"Saturankam\" (players 3) (equipment { (board (square 9) { (track \"Track1\" \"81,4,E,N,W,S,E1,N7,E6,S6,W5,N5,E4,S4,W3,N3,E2,S2,W1,N1\" P1 directed:True) (track \"Track2\" \"83,36,S,E,N,W,S1,E7,S6,W6,N5,E5,S4,W4,N3,E3,S2,W2,N1,E1\" P2 directed:True) (track \"Track3\" \"83,76,W,S,E,N,W1,S7,W6,N6,E5,S5,W4,N4,E3,S3,W2,N2,E1,S1\" P3 directed:True)}) (dice d:4 faces:{1 3 4 6} num:2) (piece \"Marker\" Each (if (and (or { (= (\"SiteToMoveOnTrack\" from:(from) 1) (centrePoint)) (= (\"SiteToMoveOnTrack\" from:(from) 3) (centrePoint)) (= (\"SiteToMoveOnTrack\" from:(from) 4) (centrePoint))}) (= (value Player Mover) (\"ThrowValue\"))) (if (and (all DiceEqual) (= (\"SiteToMoveOnTrack\" from:(from) (/ (\"ThrowValue\") 2)) (centrePoint))) (move (from (from)) (to (centrePoint)) (then (and (moveAgain) (set Var \"Double\" 1))))) (forEach Value min:1 max:(value Player Mover) (move (from (from) level:(level)) (to (\"SiteToMoveOnTrack\" from:(from) (value)) if:True (apply (and (if (and (not (is In (to) (sites \"SafeSites\"))) (\"IsEnemyAt\" (to))) (forEach Level (to) FromTop (fromTo (from (to) level:(level)) (to (handSite (who at:(to) level:(level))))))) (if (< 0 (- (value Player Mover) (value))) (and (moveAgain) (set Value Mover (- (value Player Mover) (value)))) (and (set Value Mover 0) (if (all DiceEqual) (and (moveAgain) (set Var \"Double\" 1)))))))))))) (hand Each) (regions \"SafeSites\" (sites {4 44 76 36 40})) (map \"Entry\" {(pair P1 4) (pair P2 36) (pair P3 76)})}) (rules (start { (place Stack \"Marker1\" 4 count:2) (place Stack \"Marker2\" 36 count:2) (place Stack \"Marker3\" 76 count:2)}) (play (if (or (= 1 (var \"Double\")) (\"NewTurn\")) (\"RollMove\" (move Pass (then (and { (set Value Mover (\"ThrowValue\")) (if (= 1 (var \"Double\")) (set Var \"Double\" 0)) (moveAgain)})))) (if (can Move (\"Move\")) (\"Move\") (move Pass (then (and (set Var \"Double\" 0) (set Value Mover 0))))))) (end (if (\"AllReachedCenter\") (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nTwo rows of six holes with stores on either end. Four counters in each hole. Players sow in an anti-clockwise direction. When the last counter falls into a hole, and it now contains two or three counters, these are captured. The game is played with 2 players.\n\n###\n\n", "completion": "(define \"NextHole\" (\"NextSiteOnTrack\" 1 from:(to) #1)) (define \"PiecesHandOwnedBy\" (+ (count in:(sites #1)) (count Cell at:(handSite #1)))) (define \"PiecesOwnedBy\" (+ (count in:(sites #1)) (count at:(mapEntry #1)))) (game \"Kpo\" (players 2) (equipment { (mancalaBoard 2 6 (track \"Track\" \"1,E,N,W\" loop:True)) (piece \"Seed\" Shared) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 FirstSite) (pair P2 LastSite)})}) (rules (start (set Count 4 to:(sites Track))) (play (move Select (from (sites Mover) if:(> (count at:(from)) 0)) (then (sow apply:(if (or (= (count at:(to)) 2) (= (count at:(to)) 3)) (fromTo (from (to)) (to (mapEntry Mover)) count:(count at:(to)))))))) (end (\"MancalaByScoreWhen\" (no Moves Next))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nTriangle-Square Grid -> Triangle-Square Omni-Grid\nOrder 3 board -> Order 5 board\n(define \"Icosahedron\" (board (add (remove (tri Limping 4) vertices:{0 1 3 4 5 6 7 8 9 10 11 13 15 17 18 19 20 23 24 25 26 27 31 32 34 35 36 37 39 40 42 43 44 45 46 47}) edges:{ {0 1} {0 2} {0 3} {0 9} {0 10} {1 2} {1 4} {1 6} {6 11} {7 11} {8 11} {1 9} {2 3} {3 5} {3 8} {3 10} {6 9} {8 10} {9 10} {9 11} {10 11}}) use:Vertex)) (define \"HexCell\" (board (hex Hexagon 3) use:Cell)) (define \"HexHex\" (board (tri Hexagon 3) use:Vertex)) (define \"TriSquare\" (board (tiling T33434 (- 3 2)) use:Vertex)) (define \"HexLimpCell\" (board (hex Limping (- 3 1)) use:Cell)) (define \"HexLimp\" (board (tri Limping (- 3 1)) use:Vertex)) (define \"SquareGrid\" (board (square 3) use:Vertex)) (define \"BoardUsed\" \"TriSquare\") (define \"Connection\" Orthogonal) (game \"Claustro\" (players 2) (equipment { \"BoardUsed\" (piece \"Ball\" P1) (piece \"Ball\" P2)}) (rules (start (set Score Each 0)) (play (move Add (piece (mover)) (to (sites Empty) if:(<= 0 (- (count Pieces Next in:(sites Around (to) Orthogonal)) (count Pieces Mover in:(sites Around (to) Orthogonal))))) (then (if (not (all Sites (sites Occupied by:Mover) if:(can Move (step (from (site)) Orthogonal (to if:(is Empty (to))))))) (trigger \"End\" Mover) (if (not (all Sites (sites Occupied by:Next) if:(can Move (step (from (site)) Orthogonal (to if:(is Empty (to))))))) (trigger \"End\" Next)))))) (end (if (or (is Triggered \"End\" Mover) (is Triggered \"End\" Next)) (if (is Triggered \"End\" Mover) (result Mover Loss)) (result Mover Win)))))\n\n###\n\n", "completion": "(define \"Icosahedron\" (board (add (remove (tri Limping 4) vertices:{0 1 3 4 5 6 7 8 9 10 11 13 15 17 18 19 20 23 24 25 26 27 31 32 34 35 36 37 39 40 42 43 44 45 46 47}) edges:{ {0 1} {0 2} {0 3} {0 9} {0 10} {1 2} {1 4} {1 6} {6 11} {7 11} {8 11} {1 9} {2 3} {3 5} {3 8} {3 10} {6 9} {8 10} {9 10} {9 11} {10 11}}) use:Vertex)) (define \"HexCell\" (board (hex Hexagon 5) use:Cell)) (define \"HexHex\" (board (tri Hexagon 5) use:Vertex)) (define \"TriSquare\" (board (tiling T33434 (- 5 2)) use:Vertex)) (define \"HexLimpCell\" (board (hex Limping (- 5 1)) use:Cell)) (define \"HexLimp\" (board (tri Limping (- 5 1)) use:Vertex)) (define \"SquareGrid\" (board (square 5) use:Vertex)) (define \"BoardUsed\" \"TriSquare\") (define \"Connection\" All) (game \"Claustro\" (players 2) (equipment { \"BoardUsed\" (piece \"Ball\" P1) (piece \"Ball\" P2)}) (rules (start (set Score Each 0)) (play (move Add (piece (mover)) (to (sites Empty) if:(<= 0 (- (count Pieces Next in:(sites Around (to) All)) (count Pieces Mover in:(sites Around (to) All))))) (then (if (not (all Sites (sites Occupied by:Mover) if:(can Move (step (from (site)) All (to if:(is Empty (to))))))) (trigger \"End\" Mover) (if (not (all Sites (sites Occupied by:Next) if:(can Move (step (from (site)) All (to if:(is Empty (to))))))) (trigger \"End\" Next)))))) (end (if (or (is Triggered \"End\" Mover) (is Triggered \"End\" Next)) (if (is Triggered \"End\" Mover) (result Mover Loss)) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nFour pieces are the sheep; they are placed on the dark squares along one side of the board. one piece is the wolf; it is placed on any dark square on the side opposite the sheep. The goal of the wolf is to reach one of the sheep's original spaces, the sheep's goal is to block the wolf from doing so. Sheep move diagonally forward one square, the wolf moves diagonally forward or backward one square. \n\n###\n\n", "completion": "(game \"Wolf and Sheep\" (players 2) (equipment { (board (square 8)) (piece \"Sheep\" P1 N (\"StepToEmpty\" (directions {FR FL}))) (piece \"Wolf\" P2 \"StepDiagonalToEmpty\")}) (rules (start { (place \"Wolf2\" {\"D8\"}) (place \"Sheep1\" {\"A1\" \"C1\" \"E1\" \"G1\"})}) (play (forEach Piece)) (end { (if (and (no Moves P2) (is Mover P2)) (result P1 Win)) (if (is In (where \"Wolf\" P2) (sites Bottom)) (result P2 Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nA triangle, with two lines drawn from the apex to the base. A rectangle is drawn across the triangle, and another line connecting the midpoints of the short sides of the rectangle. One player plays as three tigers, the other as seventeen people. One tiger begins on the apex of the triangle and the other two may be placed anywhere. Players alternate turns, with the person playing as the people first placing a person on the board, and then one of the tigers moving to an empty adjacent spot along the lines of the board. When all of the people have been placed, the people move on the board in the same fashion. The tigers may capture one of the people by jumping over it to an empty adjacent spot immediately on the opposite side of one of the people along the lines of the board. The tigers win when they capture enough people so that the people cannot block the tiger, the people win when they can block the tiger from being able to move. \n\n###\n\n", "completion": "(game \"Mysore Tiger Game (Three Tigers)\" (players 2) (equipment { (board (add (remove (merge (shift 0 2 (scale 8 2 (rectangle 3 2))) (scale 1 2 (wedge 5 4))) edges:{ {0 1} {2 3} {4 5}}) edges:{ {0 15} {18 1} {2 11} {14 3} {4 7} {10 5}}) use:Vertex) (hand Each) (piece \"Human\" P2 (\"StepToEmpty\")) (piece \"Tiger\" P1 (or (\"StepToEmpty\") (\"HopCapture\")))}) (rules (start { (place \"Human2\" (handSite P2) count:17) (place \"Tiger1\" (sites Top)) (place \"Tiger1\" (handSite P1) count:2)}) phases:{ (phase \"Opening\" P1 (play (move (from (handSite Mover)) (to (sites Empty)) (then (if (\"HandOccupied\" Mover) (moveAgain))))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (phase \"Opening\" P2 (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (\"PhaseMovePiece\" \"Movement\")} (end (\"NoMovesP1NoPiecesP2\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayed on a 6x6 board with corner loops. Each player has 12 pieces. Play is made on the intersections of the lines. pieces are captured by moving via the outer loops and occupying a space held by another player. The goal is to capture all of the opponent's pieces. If no further captures are possible, the player with the most remaining pieces wins. The pieces can step to an empty site. The pieces can slide to capture. The mover win if the next player does not have any piece. The game is played on the Awithlaknan Mosona board.\n\n###\n\n", "completion": "(define \"NPiecesOnTrack\" (end (forEach Track if:(> #1 (count Pieces Mover in:(sites Track))) (result Mover Loss)))) (define \"NoCaptureProposal\" 101) (define \"SlideToCapture\" (move Slide \"AllTracks\" (between if:(or (= (between) (from)) (is Empty (between)))) (to if:(\"IsEnemyAt\" (to)) (apply if:False (remove (to)))) (then (set Counter)))) (game \"Surakarta\" (players 2) (equipment { (surakartaBoard (square 6)) (piece \"Marker\" Each (or { (move Step All (to if:(is Empty (to)))) (\"SlideToCapture\")}))}) (rules (start { (place \"Marker1\" (expand (sites Bottom))) (place \"Marker2\" (expand (sites Top)))}) (play (if (is Proposed \"End\") (or (move Vote \"End\") (move Vote \"No\" (then (set Counter)))) (or (if (>= (counter) \"NoCaptureProposal\") (move Propose \"End\" (then (vote \"End\")))) (forEach Piece)))) (end { (if (is Decided \"End\") (byScore { (score P1 (count Pieces P1)) (score P2 (count Pieces P2))})) (\"CaptureAll\" Next)}))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6 board. Play begins with four counters in each hole. Players begin the game simultaneously, sowing according to the rules below, until one player drops their final counter into an empty 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 continues with the contents of any of the player's holes. 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 \"SitesMarkedBy\" (forEach (sites Board) if:(= #1 (state at:(site))))) (define \"RememberOwnedHolesRandom\" (if (< 50 (value Random (range 1 100))) (remember Value \"OwnedP1\" #1) (remember Value \"OwnedP2\" #1))) (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 \"RemmemberCanCaptureHoles\" (if (is Mover P1) (remember Value \"CanCaptureP1\" #1) (remember Value \"CanCaptureP2\" #1))) (define \"CanCaptureHoles\" (if (is Mover P1) (sites (values Remembered \"CanCaptureP1\")) (sites (values Remembered \"CanCaptureP2\")))) (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 \"Mewegae\" (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))) (if (is In (to) (\"CanCaptureHoles\")) (and (fromTo (from (to)) (to (handSite Mover)) count:1) (set State at:(to) (state at:(to)))) (\"RemmemberCanCaptureHoles\" (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) (forget Value \"CanCaptureP1\" All) (forget Value \"CanCaptureP2\" 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:\nBoard & size: Hexhex (12) with edges alternating 2 and 3 -> Board & size: Hexhex (18) with edges alternating 2 and 4\n(define \"HopEnemy\" (forEach Piece (move Hop (between if:(is Within (id \"Fan\" Neutral) at:(between)) (apply (and (remove (between)) (add (piece (id \"Disc\" Mover)) (to (between)))))) (to if:(and (is Empty (to)) (\"MoveAllowed\"))) (then (and (\"UpdateScore\" Mover) (\"UpdateScore\" Next)))) Mover)) (define \"HopNeutral\" (forEach Piece (move Hop (between if:(is Next (who at:(between))) (apply (and (remove (between)) (add (piece (id \"Fan\" Neutral)) (to (between)))))) (to if:(and (is Empty (to)) (\"MoveAllowed\"))) (then (and (\"UpdateScore\" Mover) (\"UpdateScore\" Next)))) Mover)) (define \"StepMove\" (forEach Piece (move Step (to (sites Around (from)) if:(and (is Empty (to)) (\"MoveAllowed\"))) (then (\"UpdateScore\" Mover))) Mover)) (define \"Placement\" (move Add (piece (id \"Disc\" Mover)) (to (sites Empty) if:\"NonAdjacent\"))) (define \"UpdateScore\" (set Score #1 (/ (+ (results from:(sites Occupied by:#1) to:(sites Around (from) if:(is #1 (who at:(to)))) 1)) 2))) (define \"Option2\" (not (is Within (id \"Disc\" Mover) in:(sites LineOfSight Piece at:(to))))) (define \"NonAdjacent\" (not (is Within (id \"Disc\" Mover) in:(sites Around (to))))) (define \"MoveAllowed\" (< (\"Unfriendlies\" (to)) (\"Unfriendlies\" (from)))) (define \"Unfriendlies\" (count Sites in:(intersection (sites Around #1) (union (sites Occupied by:Next) (sites Occupied by:Neutral))))) (define \"TieBreaker\" (count Pieces #1)) (game \"Refugia\" (players 2) (equipment { (board (hex {2 3 2 3 2})) (piece \"Disc\" P1) (piece \"Disc\" P2) (piece \"Fan\" Neutral)}) (rules (start (set Score Each 0)) (play (or { (\"StepMove\") (\"HopEnemy\") (\"HopNeutral\") (\"Placement\") (move Pass)})) (end (if (all Passed) { (if (> (score Mover) (score Next)) (result Mover Win)) (if (< (score Mover) (score Next)) (result Next Win)) (if (> (\"TieBreaker\" Mover) (\"TieBreaker\" Next)) (result Mover Win)) (if (< (\"TieBreaker\" Mover) (\"TieBreaker\" Next)) (result Next Win))} (result Next Win)))))\n\n###\n\n", "completion": "(define \"HopEnemy\" (forEach Piece (move Hop (between if:(is Within (id \"Fan\" Neutral) at:(between)) (apply (and (remove (between)) (add (piece (id \"Disc\" Mover)) (to (between)))))) (to if:(and (is Empty (to)) (\"MoveAllowed\"))) (then (and (\"UpdateScore\" Mover) (\"UpdateScore\" Next)))) Mover)) (define \"HopNeutral\" (forEach Piece (move Hop (between if:(is Next (who at:(between))) (apply (and (remove (between)) (add (piece (id \"Fan\" Neutral)) (to (between)))))) (to if:(and (is Empty (to)) (\"MoveAllowed\"))) (then (and (\"UpdateScore\" Mover) (\"UpdateScore\" Next)))) Mover)) (define \"StepMove\" (forEach Piece (move Step (to (sites Around (from)) if:(and (is Empty (to)) (\"MoveAllowed\"))) (then (\"UpdateScore\" Mover))) Mover)) (define \"Placement\" (move Add (piece (id \"Disc\" Mover)) (to (sites Empty) if:\"NonAdjacent\"))) (define \"UpdateScore\" (set Score #1 (/ (+ (results from:(sites Occupied by:#1) to:(sites Around (from) if:(is #1 (who at:(to)))) 1)) 2))) (define \"Option2\" (not (is Within (id \"Disc\" Mover) in:(sites LineOfSight Piece at:(to))))) (define \"NonAdjacent\" (not (is Within (id \"Disc\" Mover) in:(sites Around (to))))) (define \"MoveAllowed\" (< (\"Unfriendlies\" (to)) (\"Unfriendlies\" (from)))) (define \"Unfriendlies\" (count Sites in:(intersection (sites Around #1) (union (sites Occupied by:Next) (sites Occupied by:Neutral))))) (define \"TieBreaker\" (count Pieces #1)) (game \"Refugia\" (players 2) (equipment { (board (hex {2 4 2 4 2})) (piece \"Disc\" P1) (piece \"Disc\" P2) (piece \"Fan\" Neutral)}) (rules (start (set Score Each 0)) (play (or { (\"StepMove\") (\"HopEnemy\") (\"HopNeutral\") (\"Placement\") (move Pass)})) (end (if (all Passed) { (if (> (score Mover) (score Next)) (result Mover Win)) (if (< (score Mover) (score Next)) (result Next Win)) (if (> (\"TieBreaker\" Mover) (\"TieBreaker\" Next)) (result Mover Win)) (if (< (\"TieBreaker\" Mover) (\"TieBreaker\" Next)) (result Next Win))} (result Next Win))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nBoard & size: Equiversi Hexhex with edges alternating 3 and 5 -> Board & size: Hexhex with edges alternating 4 and 5\n(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\" (no Moves Mover)) (define \"Sites2Capture\" (\"TriangleSites\" (sites Occupied by:Next) (sites Occupied by:Next) { (value Player (mover))})) (define \"OutstandingCaptures\" (< 0 (size Array (array \"Sites2Capture\")))) (define \"TriangleSites\" (union { (\"Due2Step\" {F} #1 #2 #3) (\"Due2Step\" {F R F} #1 #2 #3) (\"Due2Step\" {F F} #1 #2 #3) (\"Due2Step\" {F R F F} #1 #2 #3) (\"Due2Step\" {F F R F} #1 #2 #3) (\"Due2Step\" {F F R F F} #1 #2 #3) (\"Due2Step\" {F F F} #1 #2 #3) (\"Due2Step\" {F R F F F} #1 #2 #3) (\"Due2Step\" {F F F R F} #1 #2 #3) (\"Due2Step\" {F F R F F F} #1 #2 #3) (\"Due2Step\" {F F F R F F} #1 #2 #3) (\"Due2Step\" {F F F F} #1 #2 #3) (\"Due2Step\" {F F F R F F F} #1 #2 #3) (\"Due2Step\" {F R F F F F} #1 #2 #3) (\"Due2Step\" {F F F F R F} #1 #2 #3) (\"Due2Step\" {F F F F R F F} #1 #2 #3) (\"Due2Step\" {F F R F F F F} #1 #2 #3) (\"Due2Step\" {F F F F F} #1 #2 #3) (\"Due2Step\" {F F F R F F F F} #1 #2 #3) (\"Due2Step\" {F F F F R F F F} #1 #2 #3) (\"Due2Step\" {F F F F F R F} #1 #2 #3) (\"Due2Step\" {F R F F F F F} #1 #2 #3)})) (define \"Due2Step\" (intersection (sites Board) (sites (results from:#2 to:(intersection (sites (from) { #1} rotations:True) #3) (if (!= 0 (size Array (intersection (intersection (array (sites (from) { #1} rotations:True)) (array (sites (to) { #1} rotations:True))) (array #4)))) (from) -1))))) (game \"Tri-It-Out\" (players 2) (equipment { (board (tri {3 5 3 5 3}) use:Vertex) (piece \"Counter\" Each)}) (rules (meta (no Repeat PositionalInTurn)) (start { (set Score Each 0)}) (play (if (is Pending) (move Remove (sites Pending) (then (and (set Value Mover Infinity) (moveAgain)))) (move Add (to (difference (sites Empty) (\"TriangleSites\" (sites Empty) (sites Occupied by:P1) (sites Occupied by:P2))) (apply (set Value Mover (to)))) (then (if \"OutstandingCaptures\" (and (set Pending \"Sites2Capture\") (moveAgain))))) (then (set Score P1 (- (count Pieces P1)) (then (set Score P2 (- (count Pieces P2)))))))) (end { (if (and { (no Moves Next) False}) (result Mover Loss)) (if (and (no Moves Next) (= (count Pieces P1) (count Pieces P2))) (result Mover Loss)) (if (and (no Moves Next) (!= (count Pieces P1) (count Pieces P2))) (byScore))})))\n\n###\n\n", "completion": "(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\" (no Moves Mover)) (define \"Sites2Capture\" (\"TriangleSites\" (sites Occupied by:Next) (sites Occupied by:Next) { (value Player (mover))})) (define \"OutstandingCaptures\" (< 0 (size Array (array \"Sites2Capture\")))) (define \"TriangleSites\" (union { (\"Due2Step\" {F} #1 #2 #3) (\"Due2Step\" {F R F} #1 #2 #3) (\"Due2Step\" {F F} #1 #2 #3) (\"Due2Step\" {F R F F} #1 #2 #3) (\"Due2Step\" {F F R F} #1 #2 #3) (\"Due2Step\" {F F R F F} #1 #2 #3) (\"Due2Step\" {F F F} #1 #2 #3) (\"Due2Step\" {F R F F F} #1 #2 #3) (\"Due2Step\" {F F F R F} #1 #2 #3) (\"Due2Step\" {F F R F F F} #1 #2 #3) (\"Due2Step\" {F F F R F F} #1 #2 #3) (\"Due2Step\" {F F F F} #1 #2 #3) (\"Due2Step\" {F F F R F F F} #1 #2 #3) (\"Due2Step\" {F R F F F F} #1 #2 #3) (\"Due2Step\" {F F F F R F} #1 #2 #3) (\"Due2Step\" {F F F F R F F} #1 #2 #3) (\"Due2Step\" {F F R F F F F} #1 #2 #3) (\"Due2Step\" {F F F F F} #1 #2 #3) (\"Due2Step\" {F F F R F F F F} #1 #2 #3) (\"Due2Step\" {F F F F R F F F} #1 #2 #3) (\"Due2Step\" {F F F F F R F} #1 #2 #3) (\"Due2Step\" {F R F F F F F} #1 #2 #3)})) (define \"Due2Step\" (intersection (sites Board) (sites (results from:#2 to:(intersection (sites (from) { #1} rotations:True) #3) (if (!= 0 (size Array (intersection (intersection (array (sites (from) { #1} rotations:True)) (array (sites (to) { #1} rotations:True))) (array #4)))) (from) -1))))) (game \"Tri-It-Out\" (players 2) (equipment { (board (tri {4 5 4 5 4}) use:Vertex) (piece \"Counter\" Each)}) (rules (meta (no Repeat PositionalInTurn)) (start { (set Score Each 0)}) (play (if (is Pending) (move Remove (sites Pending) (then (and (set Value Mover Infinity) (moveAgain)))) (move Add (to (difference (sites Empty) (\"TriangleSites\" (sites Empty) (sites Occupied by:P1) (sites Occupied by:P2))) (apply (set Value Mover (to)))) (then (if \"OutstandingCaptures\" (and (set Pending \"Sites2Capture\") (moveAgain))))) (then (set Score P1 (- (count Pieces P1)) (then (set Score P2 (- (count Pieces P2)))))))) (end { (if (and { (no Moves Next) False}) (result Mover Loss)) (if (and (no Moves Next) (= (count Pieces P1) (count Pieces P2))) (result Mover Loss)) (if (and (no Moves Next) (!= (count Pieces P1) (count Pieces P2))) (byScore))}))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game uses square tiles -> The game uses triangle tiles\n(define \"NumTiles\" 24) (game \"Andantino\" (players 2) (equipment { (boardless Square) (tile \"Square\" Each numSides:4)}) (rules (start { (place \"Square1\" (centrePoint)) (place \"Square2\" (ahead (centrePoint) E))}) (play (move Add (to (sites Playable) if:(<= 2 (count Sites in:(sites Around (to) NotEmpty)))))) (end { (if (or (is Loop surround:Next) (is Line 5)) (result Mover Win)) (if (= (count Moves) (* (count Players) \"NumTiles\")) (result Mover Draw))})))\n\n###\n\n", "completion": "(define \"NumTiles\" 24) (game \"Andantino\" (players 2) (equipment { (boardless Triangular) (tile \"Triangle\" Each numSides:3)}) (rules (start { (place \"Triangle1\" (centrePoint)) (place \"Triangle2\" (ahead (centrePoint) E))}) (play (move Add (to (sites Playable) if:(<= 2 (count Sites in:(sites Around (to) NotEmpty)))))) (end { (if (or (is Loop surround:Next) (is Line 5)) (result Mover Win)) (if (= (count Moves) (* (count Players) \"NumTiles\")) (result Mover Draw))}))) 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 Ludii game based on the following description\nPlayed on a 5x5 board. There are 3 'Musketeer' pieces and 22 'Enemy' pieces. Musketeers can only move by capturing enemies on any adjacent space. Enemies can only move to empty adjacent spaces. Enemies win if all three musketeers are ever on the same line or column. Musketeers win as soon as they run out of legal moves. \n\n###\n\n", "completion": "(game \"Three Musketeers\" (players 2) (equipment { (board (square 5)) (piece \"Musketeer\" P1 (move Step Orthogonal (to if:(\"IsEnemyAt\" (to)) (apply (remove (to)))))) (piece \"Enemy\" P2 (\"StepOrthogonalToEmpty\"))}) (rules (start { (place \"Musketeer1\" {\"A1\" \"C3\" \"E5\"}) (place \"Enemy2\" (difference (sites Board) (sites {\"A1\" \"C3\" \"E5\"})))}) (play (forEach Piece)) (end { (if (no Moves P1) (result P1 Win)) (if (and (is Mover P1) (is Line 3 Orthogonal contiguous:False)) (result P2 Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6 board. Five counters in each hole. Play begins from any hole in a player's row and sown anti-clockwise. 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. Players cannot change their move mid-turn and counting of counters is forbidden. 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. A new game begins. The player with the fewest counters arranges them in their holes, distributing them as equally as possible. The opponent then mirrors this arrangement in their holes, placing aside any extras for use in subsequent games. If the player is reduced to four counters or less, these are arranged one to a hole and any empty holes are not used for the game (by either player). The player who captures all the counters wins. \n\n###\n\n", "completion": "(define \"CapturedPiece\" (+ { (count Cell at:(handSite #1)) (count in:(forEach (sites Board) if:(= (state at:(site)) #1))) (count in:(forEach (sites #1) if:(= (state at:(site)) 0)))})) (define \"APlayerCanNotMove\" (and (not (is Next Mover)) (or (all Sites (sites P1) if:(or (not (is In (site) (\"PlayableSites\"))) (or (!= 0 (state at:(site))) (is Empty (site))))) (all Sites (sites P2) if:(or (not (is In (site) (\"PlayableSites\"))) (or (!= 0 (state at:(site))) (is Empty (site)))))))) (define \"PlayableSites\" (sites (values Remembered \"Playable\"))) (define \"Columns\" 6) (game \"Leyla Gobale (Gabradarre)\" (players 2) (equipment { (mancalaBoard 2 6 store:None (track \"TrackCCW\" \"0,E,N,W\" loop:True)) (piece \"Seed\" Shared) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (hand Each) (map \"CorrespondingHoles\" { (pair 0 11) (pair 1 10) (pair 2 9) (pair 3 8) (pair 4 7) (pair 5 6) (pair 6 5) (pair 7 4) (pair 8 3) (pair 9 2) (pair 10 1) (pair 11 0)})}) (rules (start { (set RememberValue \"Playable\" (union (sites Top) (sites Bottom))) (set Count 5 to:(sites Track))}) phases:{ (phase \"Sowing\" (play (or { (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (sites Mover)) if:(and { (is Occupied (from)) (= 0 (state at:(from))) (is In (from) (\"PlayableSites\"))})) (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)))))) (if (< (\"CapturedPiece\" P1) (\"CapturedPiece\" P2)) (set NextPlayer (player 1)) (set NextPlayer (player 2))) (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 (move (from (handSite Mover)) (to (forEach (sites Mover) if:(= (count at:(site)) (min (results from:(sites Mover) to:(sites Mover) (count at:(to))))))) count:1 (then (and (remember Value \"Playable\" (last To) unique:True) (if (< 0 (count Cell at:(handSite Mover))) (moveAgain) (forEach Site (sites Mover) (if (is Occupied (site)) (fromTo (from (handSite Next)) (to (mapEntry \"CorrespondingHoles\" (site))) count:(count at:(site)))))))))) (nextPhase (or (is Empty (handSite P1)) (is Empty (handSite P2))) \"Sowing\"))})) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6 board. Three counters in each hole. Play begins with a stylized move. One player takes all of the counters from their leftmost hole, and proceeding in an anti-clockwise direction, takes all of the counters from the holes in their row. They then begin sowing these counters into the opponent's row, proceeding around the board in an anti-clockwise direction. When the final counter lands in an occupied hole, these counters are picked up and sowing continues. When the final counter lands in an empty hole, the turn ends. The main phase of the game begins, in which sowing continues in the same manner, but the player may begin their turn from any hole in their row. At the end of sowing, any holes containing four counters are captured by the owner of the row in which the hole is located, unless it is the hole in which the final counter fell, in which case the player captures them and the turn ends. If at the end of the game there are not sufficient counters to cause a hole to contain four, the players decide how the counters are allocated, and a new round begins. The players fill as many of their holes with four counters as they are able. The player with more counters will capture as many holes from the opponent in which they can place three or counters. If the player has two remaining counters after holes are filled with three, the opponent would cede their one remaining counter to the player to make three and the player captures one further hole. The player who played second in the previous round begins the new round with the same stylized move, and play continues as before after that. Play continues until one player owns no holes; the opponent wins. \n\n###\n\n", "completion": "(define \"NumPiecesOnBoard\" (count in:(sites Board))) (define \"RememberOwnedHolesRandom\" (if (< 50 (value Random (range 1 100))) (remember Value \"OwnedP1\" #1) (remember Value \"OwnedP2\" #1))) (define \"LeftMostEmpty\" (trackSite FirstSite \"Track\" from:(mapEntry \"LeftMost\" Mover) if:(is Empty (to)))) (define \"RemmemberOwnedHoles\" (if (is Mover P1) (remember Value \"OwnedP1\" #1) (remember Value \"OwnedP2\" #1))) (define \"OpponentOwnedHoles\" (if (is Mover P1) (sites (values Remembered \"OwnedP2\")) (sites (values Remembered \"OwnedP1\")))) (define \"OwnedHoles\" (if (is Mover P1) (sites (values Remembered \"OwnedP1\")) (sites (values Remembered \"OwnedP2\")))) (game \"Gabata (Wuqro)\" (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)) (map \"LeftMost\" {(pair P1 0) (pair P2 11)})}) (rules (start { (set RememberValue \"OwnedP1\" (sites Bottom)) (set RememberValue \"OwnedP2\" (sites Top)) (set Count 3 to:(sites Track))}) phases:{ (phase \"Opening\" (play (if (\"SameTurn\") (move Select (from (var \"Replay\")) (then (sow apply:(if (< 1 (count at:(to))) (and (moveAgain) (set Var \"Replay\" (to))) (set Var \"Round\" (+ 1 (var \"Round\"))))))) (move (from 0) (to 11) count:(count at:(to)) (then (and { (forEach Site (sites Mover) (if (is Occupied (site)) (fromTo (from (site)) (to 11) count:(count at:(site))))) (moveAgain) (set Var \"Replay\" 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 apply:(if (< 1 (count at:(to))) (if (= 4 (count at:(to))) (fromTo (from (to)) (to (handSite Mover)) count:4) (and (moveAgain) (set Var \"Replay\" (to)))))) (then (and (forEach Site (sites Track from:(last From) to:(trackSite Move from:(last From) \"Track\" steps:(- (var \"NumSowed\") 1))) (if (= 4 (count at:(site))) (fromTo (from (site)) (to (handSite Mover)) count:4))) (set Var \"NumSowed\" 0))))))} (then (if (= 4 (\"NumPiecesOnBoard\")) (and { (forEach Site (sites Board) (fromTo (from (site)) (to (handSite Mover)) count:(count at:(site)))) (forget Value \"OwnedP1\" All) (forget Value \"OwnedP2\" All) (set Var \"Round\" (+ 1 (var \"Round\")))}) (if (\"NoPieceOnBoard\") (and { (forget Value \"OwnedP1\" All) (forget Value \"OwnedP2\" All) (set Var \"Round\" (+ 1 (var \"Round\")))})))))) (end (if (\"NoPieceOnBoard\") { (if (> 2 (count Cell at:(handSite P1))) (result P2 Win)) (if (> 2 (count Cell at:(handSite P2))) (result P1 Win))})) (nextPhase (\"NoPieceOnBoard\") \"BetweenRounds\")) (phase \"BetweenRounds\" (play (if (<= 3 (count Cell at:(handSite Mover))) (move (from (handSite Mover)) (to (\"LeftMostEmpty\")) count:3 (then (and { (\"RemmemberOwnedHoles\" (last To)) (if (<= 3 (count Cell at:(handSite Mover))) (moveAgain) (if (= 2 (count Cell at:(handSite Mover))) (and { (fromTo (from (handSite Mover)) (to (\"LeftMostEmpty\")) count:2) (fromTo (from (handSite Next)) (to (\"LeftMostEmpty\")) count:1) (\"RemmemberOwnedHoles\" (\"LeftMostEmpty\"))})))}))) (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))) \"Opening\"))})) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game is played on a 4x4 board -> The game is played on a 5x5 board\n(define \"ReachesRegion\" (> Infinity (count Steps Orthogonal (step (to if:(or (is Empty (to)) (is In (to) #2)))) #1 #2))) (define \"CaptureSurroundedGroup\" (enclose (from (last To)) Orthogonal (between if:(is #1 (who at:(between))) (apply (remove (between)))) #2)) (game \"Cavity\" (players 2) (equipment { (board (square 4) use:Vertex) (piece \"Marker\" Each)}) (rules (meta (swap)) phases:{ (phase \"Opening\" (play (move Add (to (sites Empty)))) (nextPhase (and (= 1 (count Sites in:(sites Occupied by:P1))) (= 1 (count Sites in:(sites Occupied by:P2)))) \"Play\")) (phase \"Play\" (play (move Add (to (sites Empty) if:(\"ReachesRegion\" (to) (sites Occupied by:Mover))) (then (if (can Move (\"CaptureSurroundedGroup\" Enemy)) (\"CaptureSurroundedGroup\" Enemy) (\"CaptureSurroundedGroup\" Mover))))))} (end (forEach Player if:(and (< 2 (count Moves)) (no Pieces Player)) (result Player Loss)))))\n\n###\n\n", "completion": "(define \"ReachesRegion\" (> Infinity (count Steps Orthogonal (step (to if:(or (is Empty (to)) (is In (to) #2)))) #1 #2))) (define \"CaptureSurroundedGroup\" (enclose (from (last To)) Orthogonal (between if:(is #1 (who at:(between))) (apply (remove (between)))) #2)) (game \"Cavity\" (players 2) (equipment { (board (square 5) use:Vertex) (piece \"Marker\" Each)}) (rules (meta (swap)) phases:{ (phase \"Opening\" (play (move Add (to (sites Empty)))) (nextPhase (and (= 1 (count Sites in:(sites Occupied by:P1))) (= 1 (count Sites in:(sites Occupied by:P2)))) \"Play\")) (phase \"Play\" (play (move Add (to (sites Empty) if:(\"ReachesRegion\" (to) (sites Occupied by:Mover))) (then (if (can Move (\"CaptureSurroundedGroup\" Enemy)) (\"CaptureSurroundedGroup\" Enemy) (\"CaptureSurroundedGroup\" Mover))))))} (end (forEach Player if:(and (< 2 (count Moves)) (no Pieces Player)) (result Player Loss))))) 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\n10x10 board. The black player starts by removing one black piece either from one of the central four spaces of the board or from one of the four corners. The white player then must remove a white piece that is orthogonally adjacent to the empty space. Play proceeds by orthogonally jumping an opposing piece and capturing it. All moves must be capturing moves. Multiple captures can be made only by continuing in the same direction. The first player unable to move loses. The game is played on a 10x10 board.\n\n###\n\n", "completion": "(define \"HopSequence\" (\"HopCapture\" (from #1) #2 (then (\"ReplayIfCanMove\" (\"HopCapture\" (from (last To)) SameDirection))))) (game \"Konane\" (players 2) (equipment { (board (square 10)) (piece \"Marker\" Each)}) (rules (start { (place \"Marker1\" (sites Phase 1)) (place \"Marker2\" (sites Phase 0))}) phases:{ (phase \"OpeningP1\" P1 (play (move Remove (intersection (union (sites Corners) (sites Centre)) (sites Phase 1)))) (nextPhase Mover \"Movement\")) (phase \"OpeningP2\" P2 (play (move Remove (sites Around (last To) Own))) (nextPhase Mover \"Movement\")) (phase \"Movement\" (play (if \"SameTurn\" (or (\"HopSequence\" (last To) SameDirection) (move Pass)) (forEach Piece \"Marker\" (\"HopSequence\" (from) Orthogonal)))))} (end (\"NoMoves\" Loss)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nTwo rows of six holes with two stores. Each player owns the store to their right. Four counters in each hole. Sowing occurs from any hole in the player's row in an anti-clockwise direction. Sowing includes the player's store but not the opponent's. When the final counter lands into the player's store, they play again. When a player has no more counters in their row, they win, even if it is now the opponent's turn and they could place counters in the player's row. \n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (+ (count at:(mapEntry #1)) (count in:(sites #1)))) (game \"Waurie\" (players 2) (equipment { (mancalaBoard 2 6 (track \"Track\" \"0,ESE,E,ENE,WNW,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)) skipIf:(= (to) (mapEntry Next)))))) (end (if (all Sites (sites Mover) if:(= 0 (count at:(site)))) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe rules are the same as in Chess, without checkmate. The game is won either after 100 turns or when one player can no longer move, by the player with the most pieces. \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 { \"KingInTheInitialPlace\" (\"HasNeverMoved\" \"King\")}) (or (if (and (\"HasNeverMoved\" \"RookLeft\") (can Move (\"DoCastle\" \"RookLeft\" E 3 (is Empty (to))))) \"BigCastling\") (if (and (\"HasNeverMoved\" \"RookRight\") (can Move (\"DoCastle\" \"RookRight\" W 2 (is Empty (to))))) \"SmallCastling\")))) (define \"BigCastling\" (\"DoCastle\" \"King\" W 2 (is Empty (to)) (then (and (\"PieceHasMoved\") (\"DoCastle\" \"RookLeft\" E 3 True))))) (define \"SmallCastling\" (\"DoCastle\" \"King\" E 2 (is Empty (to)) (then (and (\"PieceHasMoved\") (\"DoCastle\" \"RookRight\" W 2 True))))) (define \"DoCastle\" (move Slide (from (mapEntry #1 (mover))) #2 (between (exact #3) if:#4) #5)) (define \"RememberPieceHasMoved\" (then (if (= (state at:(last To)) 1) \"PieceHasMoved\"))) (define \"PieceHasMoved\" (set State at:(last To) 0)) (define \"HasNeverMoved\" (= (state at:(mapEntry #1 (mover))) 1)) (define \"KingInTheInitialPlace\" (\"IsPieceAt\" \"King\" Mover (mapEntry \"King\" (mover)))) (game \"Skirmish (GDL)\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (\"ChessPawn\" \"Pawn\" (or \"InitialPawnMove\" \"EnPassant\") (then (\"ReplayInMovingOn\" (sites Mover \"Promotion\")))) (\"ChessRook\" \"Rook\" ~ (\"RememberPieceHasMoved\")) (\"ChessKing\" \"King\" ~ (\"RememberPieceHasMoved\")) (\"ChessBishop\" \"Bishop\") (\"ChessKnight\" \"Knight\") (\"ChessQueen\" \"Queen\") (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) (or (forEach Piece) (\"Castling\")))) (end (if (or (no Moves Next) (= (count Moves) 100)) (byScore { (score P1 (count Pieces P1)) (score P2 (count Pieces P2))}))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x5 board. Five pieces per player. Pieces played on the end of the lines. Two dice. Central line marked. Pieces move from the \\ No capture.\n\n###\n\n", "completion": "(define \"SacredLine\" 10) (define \"EnterToBoard\" (\"NextSiteOnTrack\" (- (count Pips) 1) from:(handSite Mover))) (define \"SiteToMoveOnTrack\" (trackSite Move steps:(count Pips))) (game \"Pente Grammai\" (players 2) (equipment { (board (add (scale 1.5 (merge { (shift 2 0 (rectangle 2 1)) (shift 1.5 0 (rectangle 2 1)) (shift 1 0 (rectangle 2 1)) (shift 0.5 0 (rectangle 2 1)) (rectangle 2 1)})) vertices:{{1.5 0.75}}) { (track \"Track1\" \"8,6,4,2,0,1,3,5,7,9\" loop:True P1) (track \"Track2\" \"1,3,5,7,9,8,6,4,2,0\" loop:True P2)} use:Vertex) (piece \"Marker\" Each (if (and (!= (from) \"SacredLine\") (is Empty \"SiteToMoveOnTrack\")) (move (from) (to \"SiteToMoveOnTrack\")))) (hand Each) (dice d:6 num:1) (map \"Goal\" {(pair P1 5) (pair P2 4)})}) (rules (start { (place Stack \"Marker1\" (handSite P1) count:5) (place Stack \"Marker2\" (handSite P2) count:5)}) (play (\"RollMove\" (priority { (if (and (\"HandOccupied\" Mover) (is Empty (\"EnterToBoard\"))) (move (from (handSite Mover)) (to (\"EnterToBoard\")))) (forEach Piece)} (then (if (= (mapEntry \"Goal\" Mover) (last To)) (fromTo (from (last To)) (to \"SacredLine\"))))))) (end (if (all Sites (sites Occupied by:Mover) if:(= (site) \"SacredLine\")) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThis game is a variant of classic Chess, which adds a random factor to the strategy. The following list describes all differences of the rules:\n There is no check or checkmate, it is allowed to move the king to a square attacked by opponent's piece. The goal is to capture opponent's king.\n \n A die is rolled for every move. The number determines which piece can be used to make the move. 1 - pawn, 2 - knight, 3 - bishop, 4 - rook, 5 - queen, 6 - king.\n If a pawn is to be promoted (would advance to the last row), the player can move it even if the die does not show 1. However, he can only promote it to the piece chosen by the die roll - for example, if 3 is rolled, the pawn can be promoted to a bishop only. If 1 is rolled, the pawn can be promoted to any piece. The game is played on a 8x8 board.\n\n###\n\n", "completion": "(define \"NoEnemyKings\" (no Pieces Next \"King_noCross\")) (define \"PlayAPiece\" (or (forEach Die (if (= (pips) 6) (forEach Piece \"King_noCross\") (if (= (pips) 5) (forEach Piece \"Queen\") (if (= (pips) 4) (forEach Piece \"Rook\") (if (= (pips) 2) (forEach Piece \"Knight\") (if (= (pips) 3) (forEach Piece \"Bishop\") (if (= (pips) 1) (forEach Piece \"Pawn\")))))))) (forEach Site (sites Direction from:(sites Mover) (if (is Mover P1) S N) distance:1) (if (= (what at:(site)) (id \"Pawn\" Mover)) (or (if (can Move (\"CaptureForwardDiagonal\" (from (site)))) (\"CaptureForwardDiagonal\" (from (site)))) (if (can Move (\"StepForwardToEmpty\" (from (site)))) (\"StepForwardToEmpty\" (from (site)))) (then (if (is In (last To) (sites Mover \"Promotion\")) (moveAgain)))))))) (define \"StepForwardToEmpty\" (move Step #1 Forward (to if:(is Empty (to))))) (define \"PromoteTo\" (move Promote (last To) (piece #1) Mover)) (define \"CaptureForwardDiagonal\" (move Step #1 (directions {FR FL}) (to if:(\"IsEnemyAt\" (to)) (apply (remove (to)))))) (game \"Dice Chess\" (players {(player N) (player S)}) (equipment { (board (square 8)) (dice d:6 from:1 num:1) (piece \"Pawn\" Each (or { (if (is In (from) (sites Start (piece (what at:(from))))) (\"DoubleStepForwardToEmpty\")) (\"StepForwardToEmpty\") (\"CaptureForwardDiagonal\")} (then (\"ReplayInMovingOn\" (sites Mover \"Promotion\"))))) (\"ChessBishop\" \"Bishop\") (\"ChessKnight\" \"Knight\") (\"ChessRook\" \"Rook\") (\"ChessQueen\" \"Queen\") (\"ChessKing\" \"King_noCross\") (regions \"Promotion\" P1 (sites Top)) (regions \"Promotion\" P2 (sites Bottom))}) (rules (start { (place \"Pawn1\" {\"A2\" \"B2\" \"C2\" \"D2\" \"E2\" \"F2\" \"G2\" \"H2\"}) (place \"Pawn2\" {\"H7\" \"G7\" \"E7\" \"F7\" \"D7\" \"C7\" \"B7\" \"A7\"}) (place \"Bishop1\" {\"C1\" \"F1\"}) (place \"Bishop2\" {\"C8\" \"F8\"}) (place \"Knight1\" {\"B1\" \"G1\"}) (place \"Knight2\" {\"G8\" \"B8\"}) (place \"Rook1\" {\"A1\" \"H1\"}) (place \"Rook2\" {\"H8\" \"A8\"}) (place \"Queen1\" coord:\"D1\") (place \"Queen2\" coord:\"D8\") (place \"King_noCross1\" coord:\"E1\") (place \"King_noCross2\" coord:\"E8\")}) (play (do (if (\"NewTurn\") (roll)) next:(if (\"SameTurn\") (if (= (count Pips) 1) (or { (\"PromoteTo\" \"Bishop\") (\"PromoteTo\" \"Knight\") (\"PromoteTo\" \"Rook\") (\"PromoteTo\" \"Queen\") (\"PromoteTo\" \"King_noCross\")}) (if (= (count Pips) 2) (\"PromoteTo\" \"Knight\") (if (= (count Pips) 3) (\"PromoteTo\" \"Bishop\") (if (= (count Pips) 4) (\"PromoteTo\" \"Rook\") (if (= (count Pips) 5) (\"PromoteTo\" \"Queen\") (\"PromoteTo\" \"King_noCross\")))))) \"PlayAPiece\"))) (end (if \"NoEnemyKings\" (result Next Loss))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nKeep-a-riding -> Conflagration, Firestorm Variant (longer)\nOrder 5 board -> Order 6 board\n(define \"ColourBackground\" (colour 245 245 245)) (define \"Last2MoveEnd\" (\"BlockWin\")) (define \"AMSEnd\" (if (no Moves Next) (result Mover Loss))) (define \"StandardEnd\" (if (or { (no Moves Next) (\"IsSingleGroupOf\" Mover) (\"IsSingleGroupOf\" Next)}) { (if (\"IsSingleGroupOf\" Mover) (result Mover Win)) (if (\"IsSingleGroupOf\" Next) (result Next Win)) (\"Last2MoveEnd\")})) (define \"IsSingleGroupOf\" (= 1 (count Groups Cell Orthogonal if:(is #1 (who at:(to)))))) (define \"Shakattrition\" (do (set Var \"OriginGroupSize\" (size Group at:(from)) (then (set Var \"From\" (from)))) next:(move (from (from)) (to (intersection (sites Board) (sites Around (from) if:(is Empty (to)))) if:(<= (var \"OriginGroupSize\") (\"DestinationGroupSize\")))))) (define \"PriorityCaptureOverMoveByPiece\" (forEach Piece (priority (move (from) (to (sites LineOfSight Piece at:(from)) if:(is Next (who at:(to))) (apply (remove (to))))) (\"Shakattrition\")))) (define \"PriorityMoveOverCaptureByPiece\" (forEach Piece (priority (\"Shakattrition\") (move (from) (to (sites LineOfSight Piece at:(from)) if:(is Next (who at:(to))) (apply (remove (to)))))))) (define \"MoveOrLOSCapture\" (forEach Piece (or (move (from) (to (sites LineOfSight Piece at:(from)) if:(is Next (who at:(to))) (apply (remove (to))))) (\"Shakattrition\")))) (define \"FirstFriend\" (sites To (move Hop #1 (between (min 0) if:(or { (= (from) (between)) (is Next (who at:(between))) (is Empty (between))})) (to (sites Board) if:(is Mover (who at:(to))))))) (define \"ValueAtFrom\" (set Var \"MaxSizeFrom\" (max 1 (max (results from:(from) to:(\"FirstFriend\" Orthogonal) (size Group at:(to) Orthogonal if:(= (mover) (who at:(to))))))))) (define \"ValueAtTo\" (max 1 (max (results from:(last To) to:(\"FirstFriend\" Orthogonal) (size Group at:(to) Orthogonal if:(= (mover) (who at:(to)))))))) (define \"MoveToSiteWithFriendVisible\" (< 1 (count Pieces Mover in:(sites LineOfSight Piece at:(to) Orthogonal)))) (define \"MoveTowardFriendInSameLine\" (< 0 (count Pieces Mover in:(\"FurtherAlongLine\" #1)))) (define \"FurtherAlongLine\" (sites Distance (step #1 (to if:True)) from:(to) (min 1))) (define \"AlongLine\" (sites Distance (step #1 (to if:True)) from:(from) (min 1))) (define \"IsPlayableSiteType\" (is In (to) (\"PlayableSite\"))) (define \"PlayableSite\" (difference (sites Board) (sites Occupied by:Mover))) (define \"DestinationGroupSize\" (count Sites in:(sites Distance Orthogonal (step (to if:(and (!= (var \"From\") (to)) (is Mover (who at:(to)))))) from:(to) (min 0)))) (game \"Conflagration and Keep-a-riding\" (players 2) (equipment { (board (hex Hexagon 5) use:Cell) (piece \"Disc\" Each)}) (rules (start {(place \"Disc1\" {0 3 7 10 12 15 18 21 24 28 31 34 35 38 41 44 47 52 55 56 59}) (place \"Disc2\" {1 4 5 8 13 16 19 22 25 26 29 32 36 39 42 45 48 50 53 57 60})}) (play \"PriorityMoveOverCaptureByPiece\") (end \"Last2MoveEnd\")))\n\n###\n\n", "completion": "(define \"ColourBackground\" (colour 245 245 245)) (define \"Last2MoveEnd\" (\"BlockWin\")) (define \"AMSEnd\" (if (no Moves Next) (result Mover Loss))) (define \"StandardEnd\" (if (or { (no Moves Next) (\"IsSingleGroupOf\" Mover) (\"IsSingleGroupOf\" Next)}) { (if (\"IsSingleGroupOf\" Mover) (result Mover Win)) (if (\"IsSingleGroupOf\" Next) (result Next Win)) (\"Last2MoveEnd\")})) (define \"IsSingleGroupOf\" (= 1 (count Groups Cell Orthogonal if:(is #1 (who at:(to)))))) (define \"Shakattrition\" (do (set Var \"OriginGroupSize\" (size Group at:(from)) (then (set Var \"From\" (from)))) next:(move (from (from)) (to (intersection (sites Board) (sites Around (from) if:(is Empty (to)))) if:(<= (var \"OriginGroupSize\") (\"DestinationGroupSize\")))))) (define \"PriorityCaptureOverMoveByPiece\" (forEach Piece (priority (move (from) (to (sites LineOfSight Piece at:(from)) if:(is Next (who at:(to))) (apply (remove (to))))) (\"Shakattrition\")))) (define \"PriorityMoveOverCaptureByPiece\" (forEach Piece (priority (\"Shakattrition\") (move (from) (to (sites LineOfSight Piece at:(from)) if:(is Next (who at:(to))) (apply (remove (to)))))))) (define \"MoveOrLOSCapture\" (forEach Piece (or (move (from) (to (sites LineOfSight Piece at:(from)) if:(is Next (who at:(to))) (apply (remove (to))))) (\"Shakattrition\")))) (define \"FirstFriend\" (sites To (move Hop #1 (between (min 0) if:(or { (= (from) (between)) (is Next (who at:(between))) (is Empty (between))})) (to (sites Board) if:(is Mover (who at:(to))))))) (define \"ValueAtFrom\" (set Var \"MaxSizeFrom\" (max 1 (max (results from:(from) to:(\"FirstFriend\" Orthogonal) (size Group at:(to) Orthogonal if:(= (mover) (who at:(to))))))))) (define \"ValueAtTo\" (max 1 (max (results from:(last To) to:(\"FirstFriend\" Orthogonal) (size Group at:(to) Orthogonal if:(= (mover) (who at:(to)))))))) (define \"MoveToSiteWithFriendVisible\" (< 1 (count Pieces Mover in:(sites LineOfSight Piece at:(to) Orthogonal)))) (define \"MoveTowardFriendInSameLine\" (< 0 (count Pieces Mover in:(\"FurtherAlongLine\" #1)))) (define \"FurtherAlongLine\" (sites Distance (step #1 (to if:True)) from:(to) (min 1))) (define \"AlongLine\" (sites Distance (step #1 (to if:True)) from:(from) (min 1))) (define \"IsPlayableSiteType\" (is In (to) (\"PlayableSite\"))) (define \"PlayableSite\" (difference (sites Board) (sites Occupied by:Mover))) (define \"DestinationGroupSize\" (count Sites in:(sites Distance Orthogonal (step (to if:(and (!= (var \"From\") (to)) (is Mover (who at:(to)))))) from:(to) (min 0)))) (game \"Conflagration and Keep-a-riding\" (players 2) (equipment { (board (hex Hexagon 6) use:Cell) (piece \"Disc\" Each)}) (rules (start {(place \"Disc1\" {0 3 8 11 14 17 20 21 24 27 32 35 38 41 44 47 50 53 56 59 61 64 67 71 74 77 80 83 85 88}) (place \"Disc2\" {2 5 7 10 13 16 19 23 26 29 31 34 37 40 43 46 49 52 55 58 63 66 69 70 73 76 79 82 87 90})}) (play \"PriorityMoveOverCaptureByPiece\") (end \"AMSEnd\"))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game involves 2 players. -> The game involves 3 players.\n(define \"Goal\" 12) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" (\"ThrowValue\"))) (define \"ThrowValue\" (mapEntry \"ThrowDiceValue\" (count Pips))) (game \"Main Pacheh\" (players 2) (equipment { (board (square 5) { (track \"Track1\" \"2,E,N,W,S,E1,N3,E2,S2,W1,12\" P1 directed:True) (track \"Track2\" \"22,W,S,E,N,W1,S3,W2,N2,E1,12\" P2 directed:True)}) (piece \"Marker\" Each (if (\"IsNotOffBoard\" \"SiteToMoveOnTrack\") (if (or (is Empty \"SiteToMoveOnTrack\") (\"IsEnemyAt\" \"SiteToMoveOnTrack\")) (move (from (from) level:(level)) (to \"SiteToMoveOnTrack\" (\"HittingCapture\" (mapEntry \"StartingPoint\" (who at:(to))))))) (then (if (= \"Goal\" (last To)) (remove (last To)))))) (map \"ThrowDiceValue\" {(pair 0 8) (pair 1 1) (pair 2 2) (pair 3 3) (pair 4 4)}) (map \"StartingPoint\" {(pair 1 2) (pair 2 22) (pair 3 14) (pair 4 10)}) (\"StickDice\" 4)}) (rules (start { (place Stack \"Marker1\" 2 count:4) (place Stack \"Marker2\" 22 count:4)}) (play (\"RollMove\" (if (can Move (forEach Piece)) (forEach Piece (then (if (= (\"ThrowValue\") 8) (moveAgain)))) (move Pass (then (if (= (\"ThrowValue\") 8) (moveAgain))))))) (end (\"EscapeWin\"))))\n\n###\n\n", "completion": "(define \"Goal\" 12) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" (\"ThrowValue\"))) (define \"ThrowValue\" (mapEntry \"ThrowDiceValue\" (count Pips))) (game \"Main Pacheh\" (players 3) (equipment { (board (square 5) { (track \"Track1\" \"2,E,N,W,S,E1,N3,E2,S2,W1,12\" P1 directed:True) (track \"Track2\" \"22,W,S,E,N,W1,S3,W2,N2,E1,12\" P2 directed:True) (track \"Track3\" \"14,N,W,S,E,N1,W3,N2,E2,S1,12\" P3 directed:True)}) (piece \"Marker\" Each (if (\"IsNotOffBoard\" \"SiteToMoveOnTrack\") (if (or (is Empty \"SiteToMoveOnTrack\") (\"IsEnemyAt\" \"SiteToMoveOnTrack\")) (move (from (from) level:(level)) (to \"SiteToMoveOnTrack\" (\"HittingCapture\" (mapEntry \"StartingPoint\" (who at:(to))))))) (then (if (= \"Goal\" (last To)) (remove (last To)))))) (map \"ThrowDiceValue\" {(pair 0 8) (pair 1 1) (pair 2 2) (pair 3 3) (pair 4 4)}) (map \"StartingPoint\" {(pair 1 2) (pair 2 22) (pair 3 14) (pair 4 10)}) (\"StickDice\" 4)}) (rules (start { (place Stack \"Marker1\" 2 count:4) (place Stack \"Marker2\" 22 count:4) (place Stack \"Marker3\" 14 count:4)}) (play (\"RollMove\" (if (can Move (forEach Piece)) (forEach Piece (then (if (= (\"ThrowValue\") 8) (moveAgain)))) (move Pass (then (if (= (\"ThrowValue\") 8) (moveAgain))))))) (end (\"EscapeWin\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\nSquare board, divided into eight equal triangles, and a circle around the square, touching it at the corners, One player plays as the hare, the other player as three hounds. Players take turns placing one of their pieces on the board. When a player has placed all their pieces, they move to an adjacent empty spot. When the hounds block the hare from being able to move, the hounds win. The First player moves only when all the pieces are placed.\n\n###\n\n", "completion": "(game \"Hyvn aetter Hare\" (players 2) (equipment { (board (splitCrossings (merge (shift .5 .5 (scale 0.707 (concentric {1 8}))) (square 2))) use:Vertex) (piece \"Hare\" P1 \"StepToEmpty\") (piece \"Dog\" P2 \"StepToEmpty\") (hand Each)}) (rules (start { (place \"Hare1\" (handSite P1) count:1) (place \"Dog2\" (handSite P2) count:3)}) phases:{ (phase \"Placement\" (play (if (\"HandOccupied\" Mover) (move (from (handSite Mover)) (to (sites Empty))))) (nextPhase (\"HandEmpty\" P2) \"Movement\")) (\"PhaseMovePiece\" \"Movement\" (end (\"NoMoves\" Loss)))})) END" }, { "prompt": "Construct a Ludii game based on the following description\nTwo rows of six holes with two stores. Four counters in each hole. Players sow in an anti-clockwise direction from a hole in their row. Sowing ends when the last counter falls into a hole, making it contain four counters, which are taken. Sowing also ends when the last counter falls into an empty hole. Sowing continues in any other scenario by picking up the contents of the hole where the last counter was dropped and continuing to sow. The game ends when one player can no longer move. The remaining counters are taken by the last player that was able to move and put into the store. A new round begins: The winner of the previous round now owns seven holes - the six in his row and the next hole in the opponent's row. Player takes fours from the extra hole. \n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (+ (count at:(mapEntry #1)) (count in:(sites #1)))) (game \"Whyo\" (players 2) (equipment { (mancalaBoard 2 6 (track \"TrackCCW\" \"1,E,N,W\" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece \"Seed\" Shared) (map {(pair P1 FirstSite) (pair P2 LastSite)})}) (rules (start (set Count 4 to:(sites Track))) (play (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (if (= (score P1) 1) (if (is Mover P1) (union (sites Mover) (sites {12})) (difference (sites Mover) (sites {12}))) (if (= (score P2) 1) (if (is Mover P2) (union (sites Mover) (sites {1})) (difference (sites Mover) (sites {1}))) (sites Mover)))) if:(> (count at:(from)) 0)) (then (sow apply:(if (= (count at:(to)) 4) (fromTo (from (to)) (to (mapEntry Mover)) count:(count at:(to))) (if (< (count at:(to)) 1) (moveAgain))) (then (if (no Moves Next) (and (forEach Site (union (sites P1) (sites P2)) (if (> (count at:(site)) 0) (fromTo (from (site)) (to (mapEntry Mover)) count:(count at:(site)))) (then (and { (if (< (\"PiecesOwnedBy\" P1) (\"PiecesOwnedBy\" P2)) (addScore P2 1)) (if (< (\"PiecesOwnedBy\" P2) (\"PiecesOwnedBy\" P1)) (addScore P1 1)) (if (< (var) 0) (and { (forEach Site (sites Board) (if (> (count at:(site)) 0) (remove (site)))) (forEach Site (union (sites P1) (sites P2)) (add (piece (id \"Seed\" Shared)) (to (site)) count:4))}))}))) (set Var (+ (var) 1))))))))) (end (if (= (var) 1) (byScore))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayed by two to five players. Each player has three heaps of counters, with twelve counters per heap. Sowing occurs in an anti-clockwise direction. When a player creates a heap containing three counters in an opponent's heap, a circle is drawn around the heap and the player captures the counters in it and every counter sown into it for the rest of the game. When there are no heaps left, the player with the most counters wins. Each hole contains initially 12 seeds. The game is played with 5 players.\n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (count Cell at:(handSite #1))) (define \"NumPlayers\" 5) (game \"Pic\" (players \"NumPlayers\") (equipment { (board (concentric {(* 3 \"NumPlayers\")}) (track \"Track\" {0 1 3 5 7 9 11 13 14 12 10 8 6 4 2} loop:True) use:Vertex) (piece \"Seed\" Shared) (hand Each) (regions P1 (sites {0 1 3})) (regions P2 (sites {5 7 9})) (regions P3 (sites {11 13 14})) (regions P4 (sites {12 10 8})) (regions P5 (sites {6 4 2}))}) (rules (start (set Count 12 to:(sites Track))) (play (or { (move Select (from (sites Mover) if:(is Occupied (from))) (then (sow apply:(if (and (not (is In (to) (sites Mover))) (= 3 (count at:(to)))) (and (fromTo (from (to)) (to (handSite Mover)) count:3) (set State at:(to) (mover)))))))} (then (forEach Site (sites Board) (if (and (is Occupied (site)) (!= 0 (state at:(site)))) (and (fromTo (from (site)) (to (handSite (state at:(site)))) count:(count at:(site))) (set State at:(site) (state at:(site))))))))) (end (if (\"NoPieceOnBoard\") (byScore { (score P1 (\"PiecesOwnedBy\" P1)) (score P2 (\"PiecesOwnedBy\" P2)) (score P3 (\"PiecesOwnedBy\" P3)) (score P4 (\"PiecesOwnedBy\" P4)) (score P5 (\"PiecesOwnedBy\" P5))}))))) 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": "Describe the mechanics of the following Ludii game\n(game \"Yaguarete Kora\" (players 2) (equipment { (board (rotate 180 (\"AlquerqueGraphWithBottomTriangle\")) use:Vertex) (piece \"Jaguar\" P1 (or (\"StepToEmpty\") (\"HopCapture\"))) (piece \"Dog\" P2 (\"StepToEmpty\"))}) (rules (start { (place \"Jaguar1\" coord:\"C6\") (place \"Dog2\" (expand (sites Bottom) steps:2))}) (play (forEach Piece)) (end { (if (no Moves P1) (result P1 Loss)) (if (<= (count Pieces P2) 6) (result P1 Win))})))\n\n###\n\n", "completion": "5x5 intersecting lines with diagonals in each quadrant. A triangle, the apex intersecting with the apex of one of the sides. A line is drawn from the apex to the midpoint of the base of the triangle. A line bisects this line, connecting the midpoints of the sides of the triangle, One player plays as one jaguar, which begins on the center of the base of the large triangle's base. The other player plays as fifteen dogs, which begin on the points of the three ranks of the bottom half of the square portion of the board. The jaguar moves first. Pieces move to an empty adjacent space along the lines of the board. The jaguar may hop over an adjacent dog to an empty space immediately on the opposite side of it, capturing the dog. Dogs cannot capture. The dogs win by blocking the jaguar so it cannot move; the jaguar wins when only six dogs remain. END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6 board. Four counters in each hole. Sowing occurs in a clockwise direction. When the final counter of a sowing lands in an occupied hole, the contents of the hole are picked up and sowing continues. If this occupied hole is in the opponent's row and is made to contain four with the final counter, this hole and the one opposite it are captured, the counters remaining in the holes. Players may not sow from these holes. If on a subsequent turn the final counter of a sowing falls into an opponent's captured hole, one counter from the hole is captured, as well as the final counter of the sowing, and the turn ends. When the final counter of a sowing lands in an empty hole, the turn ends. Play continues until one of the players can no longer move, the opponent taking any remaining counters in free holes on their side of the board and each player taking the counters in their captured holes. A new round begins. Players attempt to fill their holes with four counters each. If a player has two extra counters, they may loan them to the other player, to be repaid when they can in a subsequent round. If a player has one extra counter, it is surrendered to the opponent. The player with more counter would only fill as many hole as the opponent is able to fill, retaining their extra counters for future rounds. Play continues until one player cannot fill any holes. \n\n###\n\n", "completion": "(define \"NoPieceOnBoard\" (no Pieces All in:(sites Board))) (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\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" 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))) phases:{ (phase \"Sowing\" (play (or { (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (sites Mover)) if:(and (is Occupied (from)) (= 0 (state at:(from))))) (then (sow apply:(if (!= 0 (state at:(to))) (if (= (next) (state at:(to))) (and (fromTo (from (to)) (to (handSite Mover)) count:(min 2 (count at:(to)))) (set State at:(to) (next)))) (if (and (is In (to) (sites Next)) (= 4 (count at:(to)))) (and (set State at:(to) (mover)) (set State at:(\"OppositePitTwoRows\" (to)) (mover))) (if (< 1 (count at:(to))) (and (moveAgain) (set Var \"Replay\" (to)))))))))} (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) (and (fromTo (from (site)) (to (handSite P1)) count:(count at:(site))) (set State at:(site) 0)) (if (= (state at:(site)) P2) (and (fromTo (from (site)) (to (handSite P2)) count:(count at:(site))) (set State at:(site) 0)))))}))))) (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 (<= 4 (count Cell at:(handSite Mover))) (move (from (handSite Mover)) (to (sites Mover) if:(is Empty (to))) count:4 (then (if (= 1 (count Cell at:(handSite Mover))) (fromTo (from (handSite Mover)) (to (handSite Next)) count:1) (if (= 2 (count Cell at:(handSite Mover))) (fromTo (from (handSite Next)) (to (handSite Mover)) count:2) (if (= 3 (count Cell at:(handSite Mover))) (fromTo (from (handSite Next)) (to (handSite Mover)) count:1)))))))) (nextPhase (and (= (count Sites in:(forEach (sites P1) if:(is Occupied (site)))) (count Sites in:(forEach (sites P2) if:(is Occupied (site))))) (or (is Empty (handSite P1)) (is Empty (handSite P2)))) \"Sowing\"))})) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6 board. Four counters in each hole. The first player takes three counters from each of their holes, and sows them beginning in the opponent's first hole. Sowing proceeds in an anti-clockwise direction, and when the final counter lands in an occupied hole, these are picked up and sowing continues. While sowing, if a hole is made to contain four counters, these are captured by the player. When the final counter falls into an empty hole, the turn ends, unless the player was able to make a capture during the sowing, in which case they may play again. A player with no counters on their side must pass, and may continue playing when there are counters in their holes again. Play continues until all the counters are captured, and the player with the most counters wins. 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 \"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\")))) (game \"Lam Waladach\" (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 \"Opening\" (play (move Select (from 11) (then (and (forEach Site (sites Mover) (fromTo (from (site)) (to 11) count:3)) (sow count:18 \"TrackCCW\" apply:(if (< 1 (count at:(to))) (and (moveAgain) (set Var \"Replay\" (to)))) origin:True))))) (nextPhase \"Sowing\")) (phase \"Sowing\" (play (or { (move Select (from (if (and (not (is Pending)) (\"SameTurn\")) (sites {(var \"Replay\")}) (\"OwnedHoles\")) if:(> (count at:(from)) 0)) (then (do (set Var \"NumSowed\" (count at:(last To))) next:(sow \"TrackCCW\" apply:(if (< 1 (count at:(to))) (and (moveAgain) (set Var \"Replay\" (to))))) (then (and (forEach Site (sites Track from:(last From) to:(trackSite Move from:(last From) \"Track\" steps:(var \"NumSowed\"))) (if (= 4 (count at:(site))) (and (fromTo (from (site)) (to (handSite Mover)) count:4) (and (moveAgain) (set Pending))))) (set Var \"NumSowed\" 0))))))} (then (if (\"NoPieceOnBoard\") (and (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 Ludii game based on the following description\nViking Chess is played on a board with 12 files and 7 ranks. The pieces are set up with both sides starting on the same side of board. Both sides' Pawns move in the same direction, and all Pawns promote normally upon reaching the (same) 7th rank. There is no Pawn double-move or en passant capture. There is no castling. \n\n###\n\n", "completion": "(game \"Viking Chess\" (players {(player N) (player N)}) (equipment { (board (rectangle 7 12)) (\"ChessPawn\" \"Pawn\" ~ (then (and (\"ReplayInMovingOn\" (sites Mover \"Promotion\")) (set Counter)))) (\"ChessRook\" \"Rook\") (\"ChessKing\" \"King\") (\"ChessBishop\" \"Bishop\") (\"ChessKnight\" \"Knight\") (\"ChessQueen\" \"Queen\") (regions \"Promotion\" P1 (sites Top)) (regions \"Promotion\" P2 (sites Top))}) (rules (start { (place \"Pawn1\" {\"B2\" \"B3\" \"C3\" \"D3\" \"E3\" \"E2\" \"F2\" \"F1\"}) (place \"Rook1\" {\"A1\" \"A2\"}) (place \"Knight1\" {\"C2\" \"D2\"}) (place \"Bishop1\" {\"B1\" \"E1\"}) (place \"Queen1\" coord:\"D1\") (place \"King1\" coord:\"C1\") (place \"Pawn2\" {\"G1\" \"G2\" \"H2\" \"H3\" \"I3\" \"J3\" \"K3\" \"K2\"}) (place \"Rook2\" {\"L1\" \"L2\"}) (place \"Knight2\" {\"J2\" \"I2\"}) (place \"Bishop2\" {\"K1\" \"H1\"}) (place \"Queen2\" coord:\"I1\") (place \"King2\" coord:\"J1\")}) (play (if \"SameTurn\" (move Promote (last To) (piece {\"Queen\" \"Knight\" \"Bishop\" \"Rook\"}) Mover) (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King\" Mover))))) (end { (\"Checkmate\" \"King\") (if (or (no Moves Mover) (= (counter) 100)) (result Mover Draw))}))) 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": "Describe the mechanics of the following Ludii game\n(define \"SafeTeleportation\" (fromTo (from (where (id \"Human\"))) (to (sites Random (difference (sites Empty) (sites Around (sites Occupied by:Shared))))) (then (\"RobotThreat\")))) (define \"Teleportation\" (fromTo (from (where (id \"Human\"))) (to (sites Random)) (then (\"RobotThreat\")))) (define \"KillRobotsIfColliding\" (forEach Site (sites Occupied by:Shared) (if (>= (count at:(site)) 2) (and (remove (site)) (add (piece \"Rubble0\") (to (site))))))) (define \"RobotThreat\" (forEach Site (sites Occupied by:Shared) (\"GoCloser\" NE (\"GoCloser\" NW (\"GoCloser\" SW (\"GoCloser\" SE (\"GoCloser\" E (\"GoCloser\" W (\"GoCloser\" N (\"GoCloser\" S)))))))))) (define \"GoCloser\" (if (\"CloserToHuman\" #1) (\"MoveRobot\" #1) #2)) (define \"MoveRobot\" (if (\"IsPieceAt\" \"Rubble\" Neutral (ahead (site) #1)) (remove (site)) (fromTo (from (site)) (to (ahead (site) #1) (apply (if (\"IsPieceAt\" \"Human\" P1 (to)) (remove (to)))))))) (define \"CloserToHuman\" (> (count Steps Orthogonal (site) (where (id \"Human\"))) (count Steps Orthogonal (ahead (site) #1) (where (id \"Human\"))))) (define \"NumSafeTeleportation\" 5) (define \"NumRobots\" 20) (game \"Chase\" (players 1) (equipment { (board (rectangle 10 20)) (piece \"Human\" P1 (\"StepToEmpty\" ~ (then (\"RobotThreat\")))) (piece \"Robot\" Shared) (piece \"Rubble\" Neutral)}) (rules (start { (place Random {\"Human\"}) (place Random {\"Robot\"} count:(\"NumRobots\")) (set Score P1 (\"NumSafeTeleportation\"))}) (play (or { (forEach Piece) (move Pass (then (\"Teleportation\"))) (if (< 0 (score P1)) (move Select (from (where (id \"Human\"))) (then (and (set Score Mover (- (score P1) 1)) (\"SafeTeleportation\")))))} (then (\"KillRobotsIfColliding\")))) (end { (if (no Pieces Mover) (result Mover Loss)) (if (no Pieces \"Robot\") (result Mover Win))})))\n\n###\n\n", "completion": "Chase is played on a two-dimensional rectangular grid. The objective of the game is to escape from a number of robots, which have been programmed to kill the player.\n \n The game is turn-based. The player character and the robots start at randomly selected locations. Every time the player character moves a square in any direction (horizontally, vertically, or diagonally), each robot moves one square closer to their new location, in whichever direction is the shortest path. If the player character collides with a robot, they die and the game ends.\n \n The player attempts to survive by causing the robots to kill themselves by colliding with other objects on the map. When two robots collide each other a pile of rubble is created.\n \n The player can also teleport into a randomly selected location. Teleportation counts as a move, and the robots will respond by moving towards the new location. Because the location is randomly selected, it is possible that the player teleports right into the path of a robot. A safe teleport is also possible for the player but can be used only a limited number of times.\n \n The game is won when all of the robots are destroyed. \n \n In Ludii, the number of safe teleportations available is the score of the player. In clicking on the player a safe teleportation will be applied. To make a non safe teleportation, the button Pass has to be pressed. The board has 10 rows. The board has 20 columns. The player has 5 safe teleportations. 20 robots. END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game is played on a 13x13 board -> The game is played on a 15x15 board\n1 capture to win. -> 2 captures to win.\n(define \"RemoveSurrounded\" (forEach Site (sites Occupied by:Next) (if (= (count Liberties at:(site) Orthogonal) 0) (move Remove (site) (then (addScore Mover 1)))))) (game \"BlooGo\" (players 2) (equipment { (board (square 13) use:Vertex) (piece \"Ball\" Each)}) (rules (meta (no Repeat)) (play (move Add (to (sites Empty)) (then \"RemoveSurrounded\"))) (end { (if (>= (score Mover) 1) (result Mover Win))})))\n\n###\n\n", "completion": "(define \"RemoveSurrounded\" (forEach Site (sites Occupied by:Next) (if (= (count Liberties at:(site) Orthogonal) 0) (move Remove (site) (then (addScore Mover 1)))))) (game \"BlooGo\" (players 2) (equipment { (board (square 15) use:Vertex) (piece \"Ball\" Each)}) (rules (meta (no Repeat)) (play (move Add (to (sites Empty)) (then \"RemoveSurrounded\"))) (end { (if (>= (score Mover) 2) (result Mover Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\n8x8 board. 8 Bhata (or Padati; move like Chess pawns but without being able to move two on the first turn); 2 Ashva (horses; move like Chess knights); 2 Gaja (elephants; two spaces in any orthogonal direction, jumping over the first square); 2 Ratha (chariots; moves like a rook in chess); 1 Mantri (counselor; moves one square diagonally in any direction); 1 Raja (king; moves one square in any direction). These are set up along one edge of the board: Gaja-Ratha-Ashva-Mantri-Raja-Ashva-Ratha-Gaja, with the eight Bhata lined up in the row in front of these. Players take turns moving. When one piece lands on the space occupied by another piece, it is captured. When a Raja can be captured by an opponent's piece on the next turn, it is in check. The Raja must not be in check at the end of the player's turn. When this is unavoidable, it is checkmate and the opponent wins. A Raja that is stalemated wins. A player who reduces their opponent to only the Raja wins.\n \n\n###\n\n", "completion": "(game \"Chaturanga (al-Adli)\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (piece \"King_noCross\" (\"StepToNotFriend\")) (\"ChessRook\" \"Rook\") (piece \"Elephant\" (move Hop Orthogonal (between (exact 1) if:True) (to if:(not (\"IsFriendAt\" (to))) (apply (if (\"IsEnemyAt\" (to)) (remove (to))))))) (\"ChessKnight\" \"Knight\") (\"ChessPawn\" \"Pawn\") (piece \"Queen\" (\"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 \"Elephant1\" {\"A1\" \"H1\"}) (place \"Rook1\" {\"B1\" \"G1\"}) (place \"Knight1\" {\"C1\" \"F1\"}) (place \"Queen1\" coord:\"D1\") (place \"King_noCross1\" coord:\"E1\") (place \"Elephant2\" {\"A8\" \"H8\"}) (place \"Rook2\" {\"B8\" \"G8\"}) (place \"Knight2\" {\"C8\" \"F8\"}) (place \"Queen2\" coord:\"E8\") (place \"King_noCross2\" coord:\"D8\")}) (play (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King_noCross\" Mover)))) (end { (\"Checkmate\" \"King_noCross\") (if (= (count Pieces Next) 1) (result Mover Loss))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nStart on an empty board. \n \n On a turn either enter a piece not in line of sight of your own pieces, or move a piece a number of independent single steps not to exceed the count of that piece's enemy neighbours. \n \n If one player passes, to avoid ending the game with a 2nd pass, the opponent must place a piece if possible, or if unable to place, he may move in a way that enables his future placement. Otherwise, he must pass and the game ends.\n \n The winner is the player with the most pieces in play. If equal, the last to pass loses. Order 5 board Hex N / N+1 Grid\n\n###\n\n", "completion": "(define \"BoardUsed\" (hex Limping 5)) (define \"StepIteration\" (if (<= #2 (count Pieces Next in:(sites Around (from)))) (move (from (from)) (to (#1))))) (define \"S5\" (intersection (sites Empty) (sites Around (\"S4\")))) (define \"S4\" (intersection (sites Empty) (sites Around (\"S3\")))) (define \"S3\" (intersection (sites Empty) (sites Around (\"S2\")))) (define \"S2\" (intersection (sites Empty) (sites Around (\"S1\")))) (define \"S1\" (intersection (sites Empty) (sites Around (from)))) (define \"StepMoves\" (or { (\"StepIteration\" \"S1\" 1) (\"StepIteration\" \"S2\" 2) (\"StepIteration\" \"S3\" 3) (\"StepIteration\" \"S4\" 4) (\"StepIteration\" \"S5\" 5)})) (define \"PlaceOutOfSight\" (move Add (to (sites Empty) if:(not (is Within (id \"Disc\" Mover) in:(sites LineOfSight Piece at:(to))))) (then (addScore Mover 1)))) (game \"Infuse\" (players 2) (equipment { (board \"BoardUsed\" use:Cell) (piece \"Disc\" Each)}) (rules (start (set Score Each 0)) (play (if (was Pass) (or (move Pass) (priority (\"PlaceOutOfSight\") (forEach Piece (do (\"StepMoves\") ifAfterwards:(can Move (add (to (sites Empty) if:(not (is Within (id \"Disc\" Mover) in:(sites LineOfSight Piece at:(to))))))))))) (or { (\"PlaceOutOfSight\") (forEach Piece (\"StepMoves\")) (move Pass)}))) (end { (if (and (all Passed) (> (score Mover) (score Next))) (result Mover Win)) (if (and (all Passed) (<= (score Mover) (score Next))) (result Next Win))}))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game uses square tiles -> The game uses triangle tiles\n(define \"NumTiles\" 24) (game \"Bravalath\" (players 2) (equipment { (boardless Square) (tile \"Square\" Each numSides:4)}) (rules (start { (place \"Square1\" (centrePoint)) (place \"Square2\" (ahead (centrePoint) E))}) (play (move Add (to (sites Playable) if:(<= 1 (count Sites in:(sites Around (to) NotEmpty)))))) (end { (if (is Line 4) (result Mover Win)) (if (is Line 3) (result Mover Loss))})))\n\n###\n\n", "completion": "(define \"NumTiles\" 24) (game \"Bravalath\" (players 2) (equipment { (boardless Triangular) (tile \"Triangle\" Each numSides:3)}) (rules (start { (place \"Triangle1\" (centrePoint)) (place \"Triangle2\" (ahead (centrePoint) E))}) (play (move Add (to (sites Playable) if:(<= 1 (count Sites in:(sites Around (to) NotEmpty)))))) (end { (if (is Line 4) (result Mover Win)) (if (is Line 3) (result Mover Loss))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nA series of three parallel lines are drawn, with diagonals connecting the outer lines at intervals, crossing each other at the central line. Eight in the outer rows, nine in the central. Pieces are moved along the intersections, and they are placed on the board on opposing sides, leaving the central spot empty. The first player moves to this spot along one of the lines, and the opponent jumps this pieces, thereby capturing it. \n\n###\n\n", "completion": "(game \"Awithlaknan Mosona\" (players 2) (equipment { (board (merge { (repeat 1 1 step:{{0.5 0} {1 0}} (poly {{0.5 0} {0 0} {0 0.5}})) (repeat 1 1 step:{{0.5 0} {1 0}} (poly {{0.5 0} {0 0} {0 -0.5}})) (repeat 7 1 step:{{0.5 0} {1 0}} (poly {{0.5 0} {0 0.5} {1 0.5}})) (repeat 7 1 step:{{0.5 0} {1 0}} (poly {{0.5 0} {0 -0.5} {1 -0.5}})) (shift (- 7 1) 0 (repeat 1 1 step:{{0.5 0} {1 0}} (poly {{0.5 0} {1 0.5} {1 0}}))) (shift (- 7 1) 0 (repeat 1 1 step:{{0.5 0} {1 0}} (poly {{0.5 0} {1 0} {1 -0.5}}))) (shift 0.5 0 (rectangle 1 7))}) use:Vertex) (piece \"Counter\" Each (or (\"HopCapture\") (\"StepToEmpty\")))}) (rules (start { (place \"Counter1\" (union (sites Bottom) (sites Direction from:(centrePoint) W))) (place \"Counter2\" (union (sites Direction from:(centrePoint) E) (sites Top)))}) (play (forEach Piece)) (end (\"NoMoves\" Loss)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayed on a 3x4 board with an extension of 8 in the middle row. Spaces are unmarked. Rules from Seleucid.\n\n###\n\n", "completion": "(define \"MoveTo\" (\"NextSiteOnTrack\" (\"CountPips\"))) (define \"RemoveAPiece\" (move Remove (from))) (define \"CountPips\" (if (= 0 (face 23)) (face 22) (if (= 1 (face 22)) (+ (face 22) 5) (if (= 2 (face 22)) (+ (face 22) 6) (if (= 3 (face 22)) (+ (face 22) 7) (+ (face 22) 10)))))) (game \"20 Squares\" (players 2) (equipment { (board (merge (rectangle 3 4) (shift 0 1 (rectangle 1 12))) { (track \"Track1\" \"20,3,W,N1,E,End\" P1 directed:True) (track \"Track2\" \"21,12,W,S1,E,End\" P2 directed:True)}) (dice facesByDie:{{1 2 3 4} {0 1}} num:2) (hand Each) (regions \"Replay\" (sites {\"A1\" \"A3\" \"D2\" \"H2\" \"L2\"})) (piece \"UrPiece\" Each (if (\"IsEndTrack\" (\"MoveTo\")) \"RemoveAPiece\" (if (\"IsNotOffBoard\" (\"MoveTo\")) (if (or (is Empty (\"MoveTo\")) (and (not (\"IsFriendAt\" (\"MoveTo\"))) (not (is In (\"MoveTo\") (sites \"Replay\"))))) (move (from) (to (\"MoveTo\") (\"HittingCapture\" (handSite (who at:(to))))) (then (\"ReplayInMovingOn\" (sites \"Replay\"))))))))}) (rules (start { (place \"UrPiece1\" (handSite P1) count:7) (place \"UrPiece2\" (handSite P2) count:7)}) (play (\"RollMove\" (or (forEach Piece) (forEach Piece container:(mover))))) (end (\"EscapeWin\")))) 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": "Describe the mechanics of the following Ludii game\n(define \"AllCountersInRumba\" (= 8 (count at:\"Rumba\"))) (define \"LastHole\" (last To afterConsequence:True)) (define \"AllSitesNotRumba\" (difference (sites Board) \"Rumba\")) (define \"Rumba\" 0) (game \"Chuka\" (players 1) (equipment { (board (concentric {5}) (track \"Track\" {0 1 3 4 2} loop:True) use:Vertex) (piece \"Seed\" Shared)}) (rules (start (set Count 2 to:\"AllSitesNotRumba\")) (play (move Select (from (if (!= (\"Rumba\") (value Pending)) (sites {\"LastHole\"}) (\"AllSitesNotRumba\")) if:(!= 0 (count at:(from)))) (then (sow apply:(if (> (count at:(to)) 1) (set Pending (to))))))) (end { (if (\"AllCountersInRumba\") (result Mover Win)) (if (and (= 1 (count at:(\"LastHole\"))) (!= (\"LastHole\") (\"Rumba\"))) (result Mover Loss))})))\n\n###\n\n", "completion": "Five holes arranged in a circle. One hole is called the Rumba. Two counters in each hole, except the Rumba. The player sows the counters in one direction. When the final counter lands in an occupied hole, the counters in that hole are picked up and sowing continues. When the final counter lands in the Rumba, the player may pick up the counters from any one of the other holes and continue sowing. If the final counter lands in an empty hole that is not the Rumba, they lose. The goal of the player is to accumulate all of the counters into the Rumba. END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe board has 19 columns. -> The board has 21 columns.\n(define \"AllPieceInOpponentHome\" (and (= (count Sites in:(difference (sites Occupied by:P1) (sites P2))) 0) (= (count Sites in:(difference (sites Occupied by:P2) (sites P1))) 0))) (define \"CreateAKing\" (move (from) (to (\"NextSiteOnTrack\" (\"ThrowValue\"))))) (define \"UncoupledKing\" (\"Move\" (\"ThrowValue\"))) (define \"KingMove\" (\"Move\" (count at:(from)))) (define \"Move\" (move (from) (to (\"NextSiteOnTrack\" (\"ThrowValue\")) \"CaptureEnemyPiece\") count:#1)) (define \"ThrowEqualSizeKingMinusOne\" (= (+ (\"ThrowValue\") 1) (count at:(from)))) (define \"OpponentPieceAtHome\" (= (count Sites in:(intersection (sites Occupied by:Next) (sites Next))) 0)) (define \"InOpponentHome\" (is In (from) (sites Next))) (define \"InactivePiece\" (= (state at:(from)) 1)) (define \"ActivatedPiece\" (= (state at:(from)) 0)) (define \"ActivatePiece\" (set State at:(last To) 0)) (define \"CaptureEnemyPiece\" (apply if:(\"IsEnemyAt\" (to)) (remove (to) (then (addScore Mover 1))))) (define \"ThrowValue\" (mapEntry (count Pips))) (game \"At-Tab wa-d-Dukk\" (players 2) (equipment { (board (rectangle 4 19) { (track \"Track1\" \"0,E,N1,W,N1,E,N1,W\" P1 directed:True) (track \"Track2\" \"51,W,S1,E,S1,W,S1,E\" P2 directed:True)}) (\"StickDice\" 4) (map {(pair 0 6) (pair 1 1) (pair 2 2) (pair 3 3) (pair 4 4)}) (piece \"Marker\" Each (if (or (\"ActivatedPiece\") (and (= 1 (\"ThrowValue\")) (\"InactivePiece\"))) (if (\"IsNotOffBoard\" (\"NextSiteOnTrack\" (\"ThrowValue\"))) (if (or (not (\"InOpponentHome\")) (and (\"InOpponentHome\") (\"OpponentPieceAtHome\"))) (if (or (is In (\"NextSiteOnTrack\" (\"ThrowValue\")) (sites Empty)) (\"IsEnemyAt\" (\"NextSiteOnTrack\" (\"ThrowValue\")))) (or (if (\"ThrowEqualSizeKingMinusOne\") (\"UncoupledKing\")) (\"KingMove\")) (if (and (is In (\"NextSiteOnTrack\" (\"ThrowValue\")) (sites \"CentralRows\")) (\"IsFriendAt\" (\"NextSiteOnTrack\" (\"ThrowValue\")))) (\"CreateAKing\")))) (then (\"ActivatePiece\"))))) (regions \"AnotherThrow\" (sites {1 4 6})) (regions \"CentralRows\" (union (sites Row 1) (sites Row 2))) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start { (place \"Marker1\" (sites Bottom) state:1) (place \"Marker2\" (sites Top) state:1)}) (play (\"RollMove\" (if (can Move (forEach Piece)) (forEach Piece (then (if (is In (\"ThrowValue\") (sites \"AnotherThrow\")) (moveAgain)))) (move Pass (then (if (is In (\"ThrowValue\") (sites \"AnotherThrow\")) (moveAgain))))))) (end (if (or (\"AllPieceInOpponentHome\") (no Pieces Mover)) (byScore)))))\n\n###\n\n", "completion": "(define \"AllPieceInOpponentHome\" (and (= (count Sites in:(difference (sites Occupied by:P1) (sites P2))) 0) (= (count Sites in:(difference (sites Occupied by:P2) (sites P1))) 0))) (define \"CreateAKing\" (move (from) (to (\"NextSiteOnTrack\" (\"ThrowValue\"))))) (define \"UncoupledKing\" (\"Move\" (\"ThrowValue\"))) (define \"KingMove\" (\"Move\" (count at:(from)))) (define \"Move\" (move (from) (to (\"NextSiteOnTrack\" (\"ThrowValue\")) \"CaptureEnemyPiece\") count:#1)) (define \"ThrowEqualSizeKingMinusOne\" (= (+ (\"ThrowValue\") 1) (count at:(from)))) (define \"OpponentPieceAtHome\" (= (count Sites in:(intersection (sites Occupied by:Next) (sites Next))) 0)) (define \"InOpponentHome\" (is In (from) (sites Next))) (define \"InactivePiece\" (= (state at:(from)) 1)) (define \"ActivatedPiece\" (= (state at:(from)) 0)) (define \"ActivatePiece\" (set State at:(last To) 0)) (define \"CaptureEnemyPiece\" (apply if:(\"IsEnemyAt\" (to)) (remove (to) (then (addScore Mover 1))))) (define \"ThrowValue\" (mapEntry (count Pips))) (game \"At-Tab wa-d-Dukk\" (players 2) (equipment { (board (rectangle 4 21) { (track \"Track1\" \"0,E,N1,W,N1,E,N1,W\" P1 directed:True) (track \"Track2\" \"51,W,S1,E,S1,W,S1,E\" P2 directed:True)}) (\"StickDice\" 4) (map {(pair 0 6) (pair 1 1) (pair 2 2) (pair 3 3) (pair 4 4)}) (piece \"Marker\" Each (if (or (\"ActivatedPiece\") (and (= 1 (\"ThrowValue\")) (\"InactivePiece\"))) (if (\"IsNotOffBoard\" (\"NextSiteOnTrack\" (\"ThrowValue\"))) (if (or (not (\"InOpponentHome\")) (and (\"InOpponentHome\") (\"OpponentPieceAtHome\"))) (if (or (is In (\"NextSiteOnTrack\" (\"ThrowValue\")) (sites Empty)) (\"IsEnemyAt\" (\"NextSiteOnTrack\" (\"ThrowValue\")))) (or (if (\"ThrowEqualSizeKingMinusOne\") (\"UncoupledKing\")) (\"KingMove\")) (if (and (is In (\"NextSiteOnTrack\" (\"ThrowValue\")) (sites \"CentralRows\")) (\"IsFriendAt\" (\"NextSiteOnTrack\" (\"ThrowValue\")))) (\"CreateAKing\")))) (then (\"ActivatePiece\"))))) (regions \"AnotherThrow\" (sites {1 4 6})) (regions \"CentralRows\" (union (sites Row 1) (sites Row 2))) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start { (place \"Marker1\" (sites Bottom) state:1) (place \"Marker2\" (sites Top) state:1)}) (play (\"RollMove\" (if (can Move (forEach Piece)) (forEach Piece (then (if (is In (\"ThrowValue\") (sites \"AnotherThrow\")) (moveAgain)))) (move Pass (then (if (is In (\"ThrowValue\") (sites \"AnotherThrow\")) (moveAgain))))))) (end (if (or (\"AllPieceInOpponentHome\") (no Pieces Mover)) (byScore))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nDefinitions:\n 1 A group is a stone along with all stones one can reach from it through a series of steps onto adjacent stones of the same color.\n 1.1 The size of a group is the number of stones in it.\n \n 2 A brood is a group along with all other groups of identical color, size and shape. Shapes are considered identical across rotational and mirror-symmetries.\n 2.1 The size of a brood is the number of groups in it.\n 2.2 The order of a brood is the size of the groups in it.\n \n Play:\n On the very first turn of the game, Black places one stone of their color on any hex.\n After, that \u2013 starting with White \u2013 take turns doing one of the following:\n \u2022 Pass.\n \u2022 Place two stones of your color on empty hexes.\n \n When the players pass consecutively, the winner is the player with the higher score.\n \n Scoring:\n For each of your odd-sized broods, you score 1 point if its order is odd and 2 points if its order is even. A board of size 5 is currently selected. Nothing is currently printed on the pieces.\n\n###\n\n", "completion": "(define \"PlaceHex\" (do (forEach Site (sites Occupied by:Mover) (set State at:(site) 0)) next:(move Add (piece (id \"Hex\" Mover)) (to (sites Empty)) (then (\"RecordShapeVectorsAsValues\"))) (then (\"ScorePlayer\" (mover))))) (define \"ScorePlayer\" (forEach Group if:(= #1 (who at:(to))) (remember Value (regionSite (sites) index:0) unique:True) (then (and { (\"CountShapesOf\" #1) (set Score Mover 0 (then (forEach Piece (addScore Mover (state at:(from))))))})))) (define \"CountShapesOf\" (forEach Value (values Remembered) (and { (set Var \"KeySite\" (value) (then (forEach Group if:(= #1 (who at:(to))) (\"IfShapessMatchDo\" (remember Value \"ShapeCount\" (+ (if (> (var \"KeySite\") (regionSite (sites) index:0)) 0 1000) (var \"KeySite\"))) (var \"KeySite\")))))} (then (\"RecordMultiplier\"))) (then (forget Value All)))) (define \"RecordMultiplier\" (if (= 0 \"BroodSize\") (set State at:(var \"KeySite\") (* (% \"ManifoldBroodSize\" 2) (- 2 (% \"GroupSize\" 2)))) (set State at:(var \"KeySite\") 0))) (define \"ManifoldBroodSize\" (+ (count Value (var \"KeySite\") in:(values Remembered \"ShapeCount\")) (count Value (+ 1000 (var \"KeySite\")) in:(values Remembered \"ShapeCount\")))) (define \"BroodSize\" (count Value (var \"KeySite\") in:(values Remembered \"ShapeCount\"))) (define \"GroupSize\" (size Group at:(var \"KeySite\"))) (define \"RecordShapeVectorsAsValues\" (set Var \"LastRow\" (row of:(max (array (sites Group at:(last To))))) (then (set Var \"LastCol\" (max (results from:(sites Group at:(last To)) to:(from) (column of:(from)))) (then (forEach Site (sites Group at:(last To)) (set Value at:(site) (+ (* 32 (- (var \"LastRow\") (row of:(site)))) (- (var \"LastCol\") (column of:(site))))))))))) (define \"IfShapessMatchDo\" (if (\"IsSameSizeAsShapeAtValue\" #2) (priority { (\"IfThisRotationDo\" (\"DRow\") (\"DCol\") #1 #2) (\"IfThisRotationDo\" (\"DRow\") (- \"DRow\" \"DCol\") #1 #2) (\"IfThisRotationDo\" (- \"DRow\" \"DCol\") (\"DRow\") #1 #2) (\"IfThisRotationDo\" (\"DCol\") (\"DRow\") #1 #2) (\"IfThisRotationDo\" (- \"DCol\") (- \"DRow\" \"DCol\") #1 #2) (\"IfThisRotationDo\" (- \"DCol\" \"DRow\") (\"DCol\") #1 #2) (\"IfThisRotationDo\" (- \"DRow\") (- \"DCol\") #1 #2) (\"IfThisRotationDo\" (- \"DRow\") (- \"DCol\" \"DRow\") #1 #2) (\"IfThisRotationDo\" (- \"DCol\" \"DRow\") (- \"DRow\") #1 #2) (\"IfThisRotationDo\" (- \"DCol\") (- \"DRow\") #1 #2) (\"IfThisRotationDo\" (\"DCol\") (- \"DCol\" \"DRow\") #1 #2) (\"IfThisRotationDo\" (- \"DRow\" \"DCol\") (- \"DCol\") #1 #2)}))) (define \"IsSameSizeAsShapeAtValue\" (= (size Array (array (sites))) (size Array (array (sites Group at:#1))))) (define \"DCol\" (% (value Piece at:(from)) 32)) (define \"DRow\" (/ (value Piece at:(from)) 32)) (define \"IfThisRotationDo\" (if (= 0 (size Array (difference (results from:(sites Group at:#4) to:(from) (+ (+ (* 32 #1) (#2)) (+ (max (results from:(sites Group at:#4) to:(from) (- (* 32 #1)))) (max (results from:(sites Group at:#4) to:(from) (- (#2))))))) (results from:(sites) to:(from) (value Piece at:(from)))))) #3)) (game \"Manifold\" (players 2) (equipment { (board (hex Hexagon 5) use:Cell) (piece \"Hex\" Each maxState:7 maxValue:1023) (piece \"Disc\" Neutral)}) (rules (play (if (or (= 0 (count Moves)) (!= 0 (count MovesThisTurn))) (\"PlaceHex\") (or (move Pass) (and { (\"PlaceHex\")} (then (moveAgain)))) (then (forget Value All)))) (end (if (all Passed) (byScore))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n4x8 board, occasionally 4x9 or 10. 29 counters in each player's leftmost hole in their outer row, two in the hole to the right of it and one in the hole to the right of that one. Sowing occurs in an anti-clockwise direction in the player's two rows. Each player begins with a stylised move, by sowing the contents of the hole with two counters. Players alternate turns sowing only from their hole with two counters. When finally a single counter is sown into an inner-row hole that is opposite a hole with a single counter in the opponent's inner row, this counter is captured. The opponent then sows their two remaining counters, capturing two from the opponent. Then, the players sow from their hole with 29 counters, picking up the contents of a hole when the final counter lands in an occupied hole, ending the turn when the final counter lands in an empty hole. When both players have completed this phase, the main phase of the game begins. Players sow from any hole in their two rows. When the final counter lands in an occupied hole, these counters are picked up and sowing continues. When the final counter lands in an empty hole in the inner row, the counters in the opponent's opposite hole in their inner row are captured. If there are also counters in the opponent's opposite hole in the outer row, these are also captured, but only when a capture from the inner row was also made. Players cannot sow single counters, unless there are no holes with multiple counters left, in which case single counters may be sown into an empty hole. Play continues until one player has captured all of the opponent's counters, thus winning the game. Each row has 8 holes.\n\n###\n\n", "completion": "(define \"AllSitesNoMoreThanOne\" (all Sites (sites Mover \"Home\") if:(>= 1 (count at:(site))))) (define \"NoSiteWith2Seeds\" (all Sites (sites Mover \"Home\") if:(!= 2 (count at:(site))))) (define \"NextHole\" (\"NextSiteOnTrack\" #2 from:#1 \"Track\")) (define \"NoPiece\" (all Sites (sites Player) if:(= 0 (count at:(site))))) (define \"Columns\" 8) (game \"Njombwa\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"0,E,N1,W\" loop:True P1) (track \"Track2\" \"16,E,N1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"Track1\")) (regions \"Home\" P2 (sites Track \"Track2\")) (regions \"Inner\" P1 (difference (sites Track \"Track1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"Track2\") (sites Top))) (piece \"Seed\" Shared)}) (rules (start { (set Count 29 to:(sites {0 (- (* 4 8) 1)})) (set Count 2 to:(sites {1 (- (* 4 8) 2)})) (set Count 1 to:(sites {2 (- (* 4 8) 3)}))}) phases:{ (phase \"Opening1\" (play (move Select (from (forEach (sites Mover \"Home\") if:(= 2 (count at:(site))))) (then (sow \"Track\" owner:(mover) apply:(if (and (is In (to) (sites Mover \"Inner\")) (is Occupied (\"OppositePit\" (to)))) (remove (\"OppositePit\" (to)))))))) (nextPhase (\"NoSiteWith2Seeds\") \"Opening2\")) (phase \"Opening2\" (play (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (forEach (sites Mover \"Home\") if:(= 29 (count at:(site))))) if:(> (count at:(from)) 0)) (then (sow \"Track\" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain)))))) (nextPhase (not (is Next Mover)) \"Sowing\")) (phase \"Sowing\" (play (if (\"AllSitesNoMoreThanOne\") (move Select (from (sites Mover \"Home\") if:(and (is Occupied (from)) (is Empty (\"NextHole\" (from) 1)))) (then (sow \"Track\" owner:(mover)))) (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(> (count at:(from)) 1)) (then (sow \"Track\" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (and (is In (to) (sites Mover \"Inner\")) (is Occupied (\"OppositePit\" (to)))) (and (remove (\"OppositePit\" (to))) (if (is Occupied (\"OppositeOuterPit\" (to))) (remove (\"OppositeOuterPit\" (to)))))))))))))} (end (forEach NonMover if:(\"NoPiece\") (result Player Loss))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"NoPiece\" (all Sites (sites Player \"Home\") if:(= 0 (count at:(site))))) (define \"Columns\" 7) (game \"Namudilakunze\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"TrackCCW1\" \"0,E,N1,W\" loop:True P1) (track \"TrackCCW2\" \"14,E,N1,W\" loop:True P2) (track \"TrackCW1\" \"6,W,N1,E\" loop:True P1) (track \"TrackCW2\" \"20,W,N1,E\" loop:True P2)}) (piece \"Seed\" Shared) (regions \"Home\" P1 (sites Track \"TrackCCW1\")) (regions \"Home\" P2 (sites Track \"TrackCCW2\")) (regions \"Inner\" P1 (difference (sites Track \"TrackCCW1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"TrackCCW2\") (sites Top))) (hand Each)}) (rules (start (set Count 1 to:(difference (sites Board) (sites { 0 (- (* (\"Columns\") 4) 1)})))) phases:{ (phase \"FirstTurn\" (play (move Select (from (if (\"SameTurn\") (\"LastHoleSowed\") (sites Mover \"Home\")) if:(is Occupied (from))) (then (sow \"TrackCW\" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover \"Inner\")) (if (is Occupied (\"OppositePit\" (to))) (remove (\"OppositePit\" (to))) (if (is Occupied (\"OppositeOuterPit\" (to))) (remove (\"OppositeOuterPit\" (to))))))))))) (nextPhase Mover (not (is Next Mover)) \"Main\")) (phase \"Main\" (play (or (if (or (>= 0 (value Player Mover)) (= (value Player Mover) 1)) (move Select (from (if (\"SameTurn\") (\"LastHoleSowed\") (sites Mover \"Home\")) if:(is Occupied (from))) (then (sow \"TrackCCW\" owner:(mover) apply:(and (if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover \"Inner\")) (if (is Empty (\"OppositePit\" (to))) (if (is Occupied (\"OppositeOuterPit\" (to))) (remove (\"OppositeOuterPit\" (to))))))) (if (!= 1 (value Player Mover)) (set Value Mover 1))))))) (if (or (>= 0 (value Player Mover)) (= (value Player Mover) 2)) (move Select (from (if (\"SameTurn\") (\"LastHoleSowed\") (sites Mover \"Home\")) if:(is Occupied (from))) (then (sow \"TrackCW\" owner:(mover) apply:(and (if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover \"Inner\")) (if (is Empty (\"OppositePit\" (to))) (if (is Occupied (\"OppositeOuterPit\" (to))) (remove (\"OppositeOuterPit\" (to))))))) (if (!= 2 (value Player Mover)) (set Value Mover 2))))))))))} (end (forEach NonMover if:(\"NoPiece\") (result Player Loss)))))\n\n###\n\n", "completion": "4x7-10 board (seven most common). One counter in each hole, with the player's leftmost hole in the outer row empty. On the first turn, sowing occurs in a clockwise direction. On the second turn, the player may sow in either direction, but must continue in the chosen direction for the rest of the game. Captures are made when the final counter of a sowing lands in an empty hole in the inner row. Captures are only made from the opponent's opposite outer row hole, and only when their inner row hole is empty. If the final counter lands in an occupied hole, the player picks up these counters and continues sowing. The player who captures all of the opponent's counters wins. Each player has 7 holes. END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"CrossLine\" (= (count Sites in:(sites Crossing at:(last To) All)) 1)) (game \"Crossline\" (players 2) (equipment { (board (graph vertices:{ {7 0.5} {12 2} {14.5 6} {14.5 10} {12 14} {7 15.5} {3 14} {0 10} {0 6} {3 2}} edges:{{0 1} {1 2} {2 3} {3 4} {4 5} {5 6} {6 7} {7 8} {8 9} {9 0} {0 2} {0 3} {0 4} {0 5} {0 6} {0 7} {0 8} {1 3} {1 4} {1 5} {1 6} {1 7} {1 8} {1 9} {2 4} {2 5} {2 6} {2 7} {2 8} {2 9} {3 5} {3 6} {3 7} {3 8} {3 9} {4 6} {4 7} {4 8} {4 9} {5 7} {5 8} {5 9} {6 8} {6 9} {7 9}}) use:Edge) (piece \"Marker\" Each) (piece \"Disc\" Shared)}) (rules (start (set Shared Edge (sites {0..9}))) phases:{ (phase \"Init\" P1 (play (move Add (to Edge (sites Empty Edge)))) (nextPhase \"Cross\")) (phase \"Cross\" P1 (play (do (move Add (to Edge (sites Empty Edge))) ifAfterwards:\"CrossLine\"))) (phase \"Continue\" P2 (play (do (move Add (to Edge (sites Empty Edge))) ifAfterwards:\"CrossLine\")))} (end (\"BlockWin\"))))\n\n###\n\n", "completion": "Players begin by drawing a circle with ten dots evenly spaced around it (the spacing can be approximate). The first player starts by drawing a straight line connecting any two dots that are not adjacent. After that, each player in turns draws a straight line that connects any two dots and that crosses exactly one (and only one) previously drawn line. The player who draws the last legal line is the winner. END" }, { "prompt": "Construct a Ludii game based on the following description\nTwo players make one of three signs with their hands at the same time, with one hand sign bating another (Rock beats Scissors, Scissors beats Paper, Paper beats Rock). \n\n###\n\n", "completion": "(game \"Rock-Paper-Scissors\" (players 2) (mode Simultaneous) (equipment { (board (union (square 1) (shift 0 2 (square 1)))) (hand Each size:3) (piece \"Rock\" Each) (piece \"Paper\" Each) (piece \"Scissors\" Each)}) (rules (start { (place \"Rock1\" (handSite P1)) (place \"Rock2\" (handSite P2)) (place \"Paper1\" (handSite P1 1)) (place \"Paper2\" (handSite P2 1)) (place \"Scissors1\" (handSite P1 2)) (place \"Scissors2\" (handSite P2 2))}) (play (or (move (from (sites Occupied by:P1)) (to 0) P1) (move (from (sites Occupied by:P2)) (to 1) P2))) (end { (if (or { (and (= (what at:0) (id \"Rock1\")) (= (what at:1) (id \"Rock2\"))) (and (= (what at:0) (id \"Paper1\")) (= (what at:1) (id \"Paper2\"))) (and (= (what at:0) (id \"Scissors1\")) (= (what at:1) (id \"Scissors2\")))}) (result Mover Draw)) (if (or { (and (= (what at:0) (id \"Rock1\")) (= (what at:1) (id \"Scissors2\"))) (and (= (what at:0) (id \"Paper1\")) (= (what at:1) (id \"Rock2\"))) (and (= (what at:0) (id \"Scissors1\")) (= (what at:1) (id \"Paper2\")))}) (result P1 Win)) (if (or { (and (= (what at:0) (id \"Paper1\")) (= (what at:1) (id \"Scissors2\"))) (and (= (what at:0) (id \"Scissors1\")) (= (what at:1) (id \"Rock2\"))) (and (= (what at:0) (id \"Rock1\")) (= (what at:1) (id \"Paper2\")))}) (result P2 Win))}))) 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 Ludii game based on the following description\nOne-Eyed Go follows the same rules as go (e.g. Japanese Rules) with the exception that it is never allowed to place a stone such that your own group has no liberties, even when they would capture other stones. This renders the ko rule superfluous. The game is played on a 19x19 board\n\n###\n\n", "completion": "(define \"CaptureSurroundedPiece\" (enclose (from (last To)) Orthogonal (between if:(\"IsEnemyAt\" (between)) (apply (and (addScore Mover 1) (remove (between))))))) (game \"One-Eyed Go\" (players 2) (equipment { (board (square 19) use:Vertex) (piece \"Marker\" Each)}) (rules (play (or (do (move Add (to (sites Empty))) ifAfterwards:(\"HasFreedom\" Orthogonal) (then \"CaptureSurroundedPiece\")) (move Pass))) (end (if (all Passed) (byScore { (score P1 (+ (score P1) (size Territory P1))) (score P2 (+ (score P2) (size Territory P2)))}))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThis game is played on an empty 8x8 square chess board. Use 6 checkers and 66 Go stones.\n \n The Counterinsurgent (COIN) player places his checkers on black squares in the middle of the board. The Guerrilla player starts with no pieces on the board, but begins by placing one stone anywhere on the board, then a second stone orthogonally adjacent to the first.\n \n The Guerrilla player does not move his pieces. Instead, he places two and only two stones per turn on the board, on the intersections of the squares.\n The first stone must be orthogonally adjacent to any stone on the board; the second stone must be orthogonally adjacent to the first stone placed.\n He may not place stones on the board edge points.\n He captures an enemy checker by surrounding it.\n \n COIN player moves one checker per turn, one square diagonally as a King in regular checkers, or makes captures by jumping over the point between two squares.\n He is not forced to capture if he does not want to, but if he does he must take all possible captures. Captured stones are removed from the board.\n \n GOAL - The player who clears the board of all enemy pieces at the end of his turn wins. The Guerrilla player loses if he runs out of stones \n\n###\n\n", "completion": "(define \"CaptureJumpAgain\" (\"CaptureJump\" (then (if (can Move \"CaptureJump\") (moveAgain))))) (define \"CaptureJump\" (move (from Cell (last To)) (to Cell (forEach (sites Around Cell (from) Diagonal) if:(and (is Empty Cell (site)) (\"HasAnEnemyToJump\")))) (then (forEach Site (\"VertexJumped\" (last From) (last To)) (if (\"IsEnemyAt\" (site)) (remove (site) #1)))))) (define \"HasAnEnemyToJump\" (!= 0 (count Sites in:(forEach (\"VertexJumped\" (site) (from)) if:(\"IsEnemyAt\" (site)))))) (define \"RemoveHoppedEnemyOnVertex\" (then (forEach Site (\"VertexJumped\" (last From) (last To)) (if (\"IsEnemyAt\" (site)) (remove (site) (then (if (can Move \"CaptureJump\") (moveAgain)))))))) (define \"VertexJumped\" (intersection (sites Incident Vertex of:Cell at:#1) (sites Incident Vertex of:Cell at:#2))) (define \"NextToOwnPiece\" (not (\"NoSites\" (sites Around (to) Own Orthogonal)))) (game \"Guerrilla Checkers\" (players 2) (equipment { (board (square 9) use:Vertex) (hand P1) (piece \"Marker\" P1) (piece \"Counter\" P2 (move Step (from Cell) Diagonal (to Cell if:(is Empty Cell (to))) (\"RemoveHoppedEnemyOnVertex\")))}) (rules (start { (place \"Counter2\" Cell {\"E3\" \"D4\" \"C5\" \"D6\" \"E5\" \"F4\"}) (place \"Marker1\" \"Hand1\" count:66)}) phases:{ (phase \"InitGuerrilla\" P1 (play (move (from (handSite Mover)) (to Vertex (difference (sites Empty Vertex) (sites Outer))) (then (moveAgain)))) (nextPhase (is Next Mover) \"GuerrillaMove\")) (phase \"GuerrillaMove\" P1 (play (if \"SameTurn\" (move (from (handSite Mover)) (to Vertex (difference (sites Around (last To) Orthogonal if:(is Empty (to))) (sites Outer))) (then (forEach Site (forEach (sites Occupied by:P2 on:Cell) if:(all Sites (sites Incident Vertex of:Cell at:(site)) if:(is Occupied Vertex (site)))) (remove Cell (site))))) (move (from (handSite Mover)) (to Vertex (difference (sites Empty Vertex) (sites Outer)) if:\"NextToOwnPiece\") (then (and (forEach Site (forEach (sites Occupied by:P2 on:Cell) if:(all Sites (sites Incident Vertex of:Cell at:(site)) if:(is Occupied Vertex (site)))) (remove Cell (site))) (moveAgain))))))) (phase \"CoinMove\" P2 (play (if \"SameTurn\" \"CaptureJumpAgain\" (forEach Piece))))} (end (\"BlockWin\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\n4x8 board. May have one or two stores per player. Stores are located to the right hand side of the player's two rows, centered with respect to the player's two rows. If each player has two stores, the second store is located between the fourth and fifth holes of the player's rows; i.e., in the center of the board. One counter in each hole except the stores. Opening play: Player sows from any one of their holes, thus making a pair. They then take the counter in the next hole and sow it, making another pair. This continues until the last pair is made. When the last pair is made, the player sows this pair normally. Main phase: Sowing occurs in an anti-clockwise direction. When the final counter falls into an occupied hole, these are picked up and sowing continues. The turn ends when the final counter falls into an empty hole. When this empty hole is in the inner row, the counters in the opponent's hole opposite are captured. If the opponent's inner row hole are occupied, then any contents in the outer row opposite are also captured. Several rules apply to the stores: They are not used during the opening play; They may only hold one counter at a time; The counter in the store cannot be captured; It is the player's choice whether to include the store in sowing; they are considered to be in the player's inner row of holes for the purposes of sowing. The game is played on a 4x8 board.\n\n###\n\n", "completion": "(define \"NextSite\" (trackSite Move from:#1 #2 steps:#3)) (define \"PiecesOwnedBy\" (+ (count at:(mapEntry #1)) (count in:(sites #1 \"Home\")))) (define \"OppositeOuterPit\" (if (is Mover P1) (+ (to) (* \"Rows\" 2)) (- (to) (* \"Rows\" 2)))) (define \"OppositePit\" (if (is Mover P1) (+ (to) \"Rows\") (- (to) \"Rows\"))) (define \"Rows\" 4) (game \"Tchela\" (players 2) (equipment { (board (merge { (square 4) (shift 5 0 (square 4)) (shift 4 0.5 (square 1)) (shift 4 2.5 (square 1)) (shift -1 2.5 (square 1)) (shift 9 0.5 (square 1))}) { (track \"TrackCCW1\" {0..3 16..19 23..20 7..4} loop:True P1) (track \"TrackCCW2\" {8..11 24..27 31..28 15..12} loop:True P2) (track \"TrackExtendedCCW1\" {0..3 16..19 23..20 32 7..4} loop:True P1) (track \"TrackExtendedCCW2\" {8..11 33 24..27 31..28 15..12} loop:True P2)} use:Vertex) (piece \"Seed\" Shared) (regions \"HomeNotExtented\" P1 (sites Track \"TrackCCW1\")) (regions \"HomeNotExtented\" P2 (sites Track \"TrackCCW2\")) (regions \"Home\" P1 (sites Track \"TrackExtendedCCW1\")) (regions \"Home\" P2 (sites Track \"TrackExtendedCCW2\")) (regions \"Inner\" P1 (difference (sites Track \"TrackCCW1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"TrackCCW2\") (sites Top))) (map {(pair P1 34) (pair P2 35)}) (map \"ExtraStore\" {(pair P1 32) (pair P2 33)})}) (rules (start (set Count 1 to:(difference (sites Board) (sites {32..35})))) phases:{ (phase \"Opening\" (play (move Select (from (if (< (value Player Mover) 0) (sites Mover \"HomeNotExtented\") (sites {(\"NextSite\" (value Player Mover) \"TrackCCW\" 2)}))) (then (and (sow \"TrackCCW\" owner:(mover)) (set Value Mover (last To)))))) (nextPhase Mover (= 0 (count at:(\"NextSite\" (value Player Mover) \"TrackCCW\" 2))) \"OpeningPair\")) (phase \"OpeningPair\" (play (move Select (from (sites {(\"NextSite\" (value Player Mover) \"TrackCCW\" 1)})) (then (sow \"TrackCCW\" owner:(mover))))) (nextPhase Mover \"Playing\")) (phase \"Playing\" (play (or (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"HomeNotExtented\")) if:(< 0 (count at:(from)))) (then (sow \"TrackCCW\" owner:(mover) apply:(if (> (count at:(to)) 1) (moveAgain) (if (and (is In (to) (sites Mover \"Inner\")) (> (count at:\"OppositePit\") 0)) (and (fromTo (from \"OppositePit\") (to (mapEntry Mover)) count:(count at:\"OppositePit\")) (if (> (count at:\"OppositePit\") 0) (fromTo (from (\"OppositeOuterPit\")) (to (mapEntry Mover)) count:(count at:(\"OppositeOuterPit\")))))))))) (do (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(< 0 (count at:(from)))) (then (sow \"TrackExtendedCCW\" owner:(mover) apply:(if (!= (to) (mapEntry \"ExtraStore\" Mover)) (if (> (count at:(to)) 1) (moveAgain) (if (and (is In (to) (sites Mover \"Inner\")) (> (count at:\"OppositePit\") 0)) (and (fromTo (from \"OppositePit\") (to (mapEntry Mover)) count:(count at:\"OppositePit\")) (if (> (count at:\"OppositePit\") 0) (fromTo (from (\"OppositeOuterPit\")) (to (mapEntry Mover)) count:(count at:(\"OppositeOuterPit\"))))))))))) ifAfterwards:(<= (count at:(mapEntry \"ExtraStore\" Mover)) 1)))))} (end (\"MancalaByScoreWhen\" (no Moves Mover))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nSquare 8 x 8, one row -> Square 8 x 8, two rows\n(define \"ThrowStonetoEnemy\" (move Hop (from if:(and (is Mover (who at:(from))) (= (size Stack at:(from)) 3))) (difference All Backwards) (between (range 1 2) if:True) (to if: (\"IsEnemyAt\" (to))) (then (and (remove (last To)) (remove (last To)))))) (define \"ThrowStonetoEmpty\" (move Hop (from if:(and (is Mover (who at:(from))) (= (size Stack at:(from)) 3))) (difference All Backwards) (between (range 1 2) if:True) (to if: (and (not (\"IsEnemyAt\" (to))) (not (is Mover (who at:(to)))))))) (define \"SacrificeCaptureCatapult\" (move Step (from if:(and (is Mover (who at:(from))) (= (size Stack at:(from)) 2))) (to if:(and (\"IsEnemyAt\" (to)) (= (size Stack at:(to)) 3)) (apply (remove (to)))) stack:True (then (and { (fromTo (from (last To)) (to (last From))) (remove (last To)) (moveAgain)})))) (define \"SacrificeCaptureWall\" (move Step (from if:(and (is Mover (who at:(from))) (= (size Stack at:(from)) 2))) (to if:(and (\"IsEnemyAt\" (to)) (\"IsSingletonStack\" (to))) (apply (remove (to)))) stack:True (then (and (fromTo (from (last To)) (to (last From))) (remove (last To)))))) (define \"MoveTower\" (move Hop (from if:(and (is Mover (who at:(from))) (= (size Stack at:(from)) 2))) (between if:(or (is Empty (between)) (and (is Mover (who at:(between))) (< (size Stack at:(between)) 2))) (apply (fromTo (from) (to (between))))) (to if:(or (is Empty (to)) (and (is Mover (who at:(to))) (< (size Stack at:(to)) 2)))) stack:True)) (game \"Murus Gallicus\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (piece \"Counter_isometric\" Each) (regions \"RomanGoal1\" P1 (sites Top)) (regions \"GaulGoal2\" P2 (sites Bottom))}) (rules (start { (place Stack \"Counter_isometric1\" (sites {0..7}) count:2) (place Stack \"Counter_isometric2\" (sites {56..63}) count:2)}) (play (if (\"SameTurn\") (or (move (from (last From)) (to (last To)) stack:True (then (and (remove (last To)) (remove (last To))))) (move Pass)) (forEach Piece \"Counter_isometric\" (or { \"MoveTower\" \"SacrificeCaptureWall\" \"SacrificeCaptureCatapult\" \"ThrowStonetoEmpty\" \"ThrowStonetoEnemy\"}) top:True))) (end { (\"BlockWin\") (if (and { (is In (last To) (sites Mover)) (not (\"IsEnemyAt\" (last To))) (is Mover (who at:(last To)))}) (result Mover Win))})))\n\n###\n\n", "completion": "(define \"ThrowStonetoEnemy\" (move Hop (from if:(and (is Mover (who at:(from))) (= (size Stack at:(from)) 3))) (difference All Backwards) (between (range 1 2) if:True) (to if: (\"IsEnemyAt\" (to))) (then (and (remove (last To)) (remove (last To)))))) (define \"ThrowStonetoEmpty\" (move Hop (from if:(and (is Mover (who at:(from))) (= (size Stack at:(from)) 3))) (difference All Backwards) (between (range 1 2) if:True) (to if: (and (not (\"IsEnemyAt\" (to))) (not (is Mover (who at:(to)))))))) (define \"SacrificeCaptureCatapult\" (move Step (from if:(and (is Mover (who at:(from))) (= (size Stack at:(from)) 2))) (to if:(and (\"IsEnemyAt\" (to)) (= (size Stack at:(to)) 3)) (apply (remove (to)))) stack:True (then (and { (fromTo (from (last To)) (to (last From))) (remove (last To)) (moveAgain)})))) (define \"SacrificeCaptureWall\" (move Step (from if:(and (is Mover (who at:(from))) (= (size Stack at:(from)) 2))) (to if:(and (\"IsEnemyAt\" (to)) (\"IsSingletonStack\" (to))) (apply (remove (to)))) stack:True (then (and (fromTo (from (last To)) (to (last From))) (remove (last To)))))) (define \"MoveTower\" (move Hop (from if:(and (is Mover (who at:(from))) (= (size Stack at:(from)) 2))) (between if:(or (is Empty (between)) (and (is Mover (who at:(between))) (< (size Stack at:(between)) 2))) (apply (fromTo (from) (to (between))))) (to if:(or (is Empty (to)) (and (is Mover (who at:(to))) (< (size Stack at:(to)) 2)))) stack:True)) (game \"Murus Gallicus\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (piece \"Counter_isometric\" Each) (regions \"RomanGoal1\" P1 (sites Top)) (regions \"GaulGoal2\" P2 (sites Bottom))}) (rules (start { (place Stack \"Counter_isometric1\" (sites {0..15}) count:2) (place Stack \"Counter_isometric2\" (sites {48..63}) count:2)}) (play (if (\"SameTurn\") (or (move (from (last From)) (to (last To)) stack:True (then (and (remove (last To)) (remove (last To))))) (move Pass)) (forEach Piece \"Counter_isometric\" (or { \"MoveTower\" \"SacrificeCaptureWall\" \"SacrificeCaptureCatapult\" \"ThrowStonetoEmpty\" \"ThrowStonetoEnemy\"}) top:True))) (end { (\"BlockWin\") (if (and { (is In (last To) (sites Mover)) (not (\"IsEnemyAt\" (last To))) (is Mover (who at:(last To)))}) (result Mover Win))}))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"Sumi Naga Game (Hunt)\" (players 2) (equipment { (\"AlquerqueBoard\" 5 5) (piece \"Goat\" P1 \"StepToEmpty\") (piece \"Tiger\" P2 (or (\"StepToEmpty\") (\"HopSequenceCapture\"))) (hand P1)}) (rules (start { (place \"Goat1\" (handSite P1) count:20) (place \"Tiger2\" (sites Corners))}) phases:{ (phase \"Placement\" P1 (play (move (from (handSite P1)) (to (sites Empty)))) (nextPhase Mover (\"HandEmpty\" Mover) \"Moving\")) (phase \"Moving\" (play (forEach Piece)))} (end (\"NoMovesP2NoPiecesP1\"))))\n\n###\n\n", "completion": "5x5 intersecting lines, with diagonals drawn in each quadrant. One player plays as four tigers, which begin on the four corners of the board. The other player plays as twenty goats, which begin off the board. Play begins by placing one of the goats on an empty spot. The other player then moves the tiger to an empty adjacent spot along the lines on the board. The tiger may hop over an adjacent goat, to an empty space on the opposite adjacent side of the goat along the lines. Play continues like this until all of the goats are placed, after which the goats also move to one adjacent spot along the lines. The tigers win by capturing all of the goats; the goats win by blocking the tigers from being able to move. END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(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 \"ThrowValue\" (count Pips)) (game \"Aj Sayil\" (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 (if (< 0 (size Array (values Remembered \"Throws\"))) (moveAgain))))) (nextPhase (= 0 (size Array (values Remembered \"Throws\"))) \"ThrowPhase\"))} (end (\"CaptureAllTeam\"))))\n\n###\n\n", "completion": "Six 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. Sticks are used to play, (five per player), and are played in the spaces between corn kernels. Dice are also corn kernels, with one side marked with a black dot. Four dice are used, the value of a move determined by the number of black dots that land face up. Each player has two throws on their turn, and moves after the second throw. The throws both must be used, and can be used in any order. Each team's home is the side of the board to their left. Each team moves toward the opposite end of the track, and then back to home. All of the players on one team play in succession, and then the players on the other team play next. Players enter the men on their throws and move along the track. Each player may have only one piece on the board at a time. When a player reaches the team's home field, the piece may be re-entered. Reaching the home field does not require an exact throw, and if one throw brings a player home, they may use the second throw to enter it again. If a piece lands on that of an opponent, it is captured. The captures piece is placed on top of the piece that captured it, and the stack now moves toward the capturing player's home space. If the player successfully carries the captured piece to the team's home space, the piece is permanently captured and removed from play. If the opposing side lands on the same space as the stack, they are stacked with the opponent's piece, and the opponent begins carrying the stack to the opposing team's side. Any pieces captured belonging to the team which brings them back to their home are returned to their players. Pieces belonging to the same team may occupy the same space with no consequence for the game. When one team has no more counters left to enter, the winner is the team that captured most of the opposing team's pieces. The game has 6 players. END" }, { "prompt": "Construct a Ludii game based on the following description\n5x5 board. Twelve pieces per player. Players alternate turns placing two pieces on the board, leaving the central space empty. Once all the pieces have been placed, players alternate turns moving one space orthogonally to an empty space. An opponent's piece may be captured by hopping over it to an empty space immediately on the opposite side of it in an orthogonal direction. Multiple captures are allowed, and a player is allowed to land on a space already landed on during the chain of captures. Captures are not compulsory. A player wins when they capture all of their opponent's pieces or the opponent cannot move. \n\n###\n\n", "completion": "(define \"HopCounter\" (\"HopCapture\" (from #1) Orthogonal #2)) (game \"Mraha wa Bwe\" (players 2) (equipment { (board (square 5)) (piece \"Counter\" Each) (hand Each)}) (rules (start (place \"Counter\" \"Hand\" count:12)) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (difference (sites Empty) (sites Centre))) (then (if (\"NewTurn\") (moveAgain))))) (nextPhase Mover (is Empty (handSite Mover)) \"Play\")) (phase \"Play\" (play (if \"SameTurn\" (or (\"HopCounter\" (last To) (then (\"ReplayIfCanMove\" (\"HopCounter\" (last To))))) (move Pass)) (or (forEach Piece \"Counter\" (\"HopCounter\" (from) (then (\"ReplayIfCanMove\" (\"HopCounter\" (last To)))))) (forEach Piece \"Counter\" (\"StepOrthogonalToEmpty\"))))))} (end (if (no Moves Mover) (result Mover Loss))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x7 board, with one store at either end. Each player owns the store to their left. Seven counters in each hole. The first turn is played simultaneously by both players; at the point which one player's sowing lasts longer than the others, the player whose turn was shorter plays next and turns alternate from this point. Players sow in a clockwise direction from one of the holes in their row, also sowing into their store, but not in their opponent's store. When the final counter lands in an empty hole or in the store, the turn ends. When the final counter falls into an occupied hole, the player picks up the contents of this hole and continues to sow. If this occupied hole is in the player's row, they have the option to instead place the final counter in the opposite hole in the opponent's row, and to place this last counter as well as the contents of that hole into the store. When all of the counters are in the stores, a new game begins. The players take the counters from their stores and place seven in each hole, beginning from their right. Any player which cannot fill a hole with seven counters places the remaining counters in their store. Any holes which are left empty are out of play for this game. Play continues as before. Multiple games are played like this until all of the holes on one side are left empty. This player loses. \n\n###\n\n", "completion": "(define \"NoPieceOnBoard\" (all Sites (union (sites Top) (sites Bottom)) if:(is Empty (site)))) (define \"PlayableSites\" (sites (values Remembered \"Playable\"))) (define \"RightMostEmpty\" (trackSite FirstSite from:(mapEntry \"RightMost\" Mover) if:(is Empty (to)))) (define \"Columns\" 7) (game \"Papan Dakon\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" { (track \"Track1\" \"0,8,E,S,W\" loop:True P1) (track \"Track2\" \"15,7,W,N,E\" loop:True P2)}) (piece \"Seed\" Shared) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 FirstSite) (pair P2 LastSite)}) (map \"RightMost\" {(pair P1 7) (pair P2 8)})}) (rules (start { (set Count 7 to:(union (sites P1) (sites P2))) (set RememberValue \"Playable\" (union (sites Top) (sites Bottom)))}) phases:{ (phase \"Sowing\" (play (or (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover)) if:(and (> (count at:(from)) 0) (is In (from) (\"PlayableSites\")))) (then (sow \"Track\" owner:(mover) apply:(if (and (!= (to) (mapEntry Mover)) (< 1 (count at:(to)))) (moveAgain)) skipIf:(if (!= (to) (mapEntry Mover)) (not (is In (to) (\"PlayableSites\"))))))) (if (and (is In (last To afterConsequence:True) (sites Mover)) (\"SameTurn\")) (if (is In (last To afterConsequence:True) (\"PlayableSites\")) (move (from (last To afterConsequence:True)) (to (\"OppositePit\" (last To afterConsequence:True))) count:1 (then (fromTo (from (last To)) (to (mapEntry Mover)) count:(count at:(last To))))))) (then (if (\"NoPieceOnBoard\") (forget Value \"Playable\" All))))) (end (if (\"NoPieceOnBoard\") { (if (> 7 (count at:(mapEntry P1))) (result P2 Win)) (if (> 7 (count at:(mapEntry P2))) (result P1 Win))})) (nextPhase (\"NoPieceOnBoard\") \"BetweenRounds\")) (phase \"BetweenRounds\" (play (if (not (all Sites (sites Mover) if:(is Occupied (site)))) (if (<= 7 (count at:(mapEntry Mover))) (move (from (mapEntry Mover)) (to \"RightMostEmpty\") count:7 (then (remember Value \"Playable\" (last To))))))) (nextPhase (all Passed) \"Sowing\"))})) END" }, { "prompt": "Construct a Ludii game based on the following description\n4x12 board. Twelve pieces per player. Pieces begin in the outer rows of the board. Four sticks serve as dice, painted on one side and blank on the other. The throws are as follows: one blank side up = 2; two blank sides up = 0; three blank sides up = 0; four blank sides up = 8; four painted sides up = 12. Throws of 2, 8, and 12 give the player another throw. Players must use each throw to move a piece. They may only subdivide a throw in half to move two pieces, otherwise they must use one full throw to move a piece. The first move for each piece must be a throw of 2. This can be divided into two throws of 1 to move two pieces. Play moves from left to right in the player's home row, from right to left in the second row, left to right in the third row, and right to left in the opponent's home row. When a piece enters the opponent's home row, it can no longer move. When a player's piece lands on a space occupied by an opponent's piece, the opponent's piece is captured. A player may not land on the same space as another of the player's pieces. The player which fills up the most of the opponent's home row wins. \n\n###\n\n", "completion": "(define \"NumPieceNotInEnemyHome\" (count Sites in:(forEach (sites Occupied by:#1) if:(not (is In (site) (sites #2 \"Home\")))))) (define \"PiecesOwnedOnEnemyHomedBy\" (count Sites in:(forEach (sites #1 \"Home\") if:(= (who at:(site)) #2)))) (define \"PlayedHalfThrow\" (= 1 (var))) (define \"CaptureMove\" (if (\"IsEnemyAt\" (to)) (remove (to)))) (define \"ActivePiece\" (set State at:#1 1)) (define \"ActivatedPiece\" (= (state at:#1) 1)) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" #1)) (define \"ThrowToActivate\" (= 2 (\"ThrowValue\"))) (define \"IsSpecialThrow\" (is In (\"ThrowValue\") (sites {2 8 12}))) (define \"ThrowValue\" (mapEntry \"Throw\" (count Pips))) (game \"Tablan\" (players 2) (equipment { (board (rectangle 4 12) { (track \"Track1\" \"0,E,N1,W,N1,E,N1,W\" P1 directed:True) (track \"Track2\" \"47,W,S1,E,S1,W,S1,E\" P2 directed:True)} use:Vertex) (piece \"Stick\" Each (if (and (not (is In (from) (sites Next \"Home\"))) (!= 0 (\"ThrowValue\"))) (or (if (not (\"PlayedHalfThrow\")) (move (from (from) if:(if (\"ActivatedPiece\" (from)) True (\"ThrowToActivate\"))) (to (\"SiteToMoveOnTrack\" (\"ThrowValue\")) if:(not (\"IsFriendAt\" (to))) (apply \"CaptureMove\")) (then (if (not (\"ActivatedPiece\" (last To))) (\"ActivePiece\" (last To)))))) (move (from (from) if:(if (\"ActivatedPiece\" (from)) True (\"ThrowToActivate\"))) (to (\"SiteToMoveOnTrack\" (/ (\"ThrowValue\") 2)) if:(not (\"IsFriendAt\" (to))) (apply \"CaptureMove\")) (then (and (if (not (\"ActivatedPiece\" (last To))) (\"ActivePiece\" (last To))) (if (not (\"PlayedHalfThrow\")) (and (set Var 1) (moveAgain)) (set Var 0)))))))) (regions \"Home\" P1 (sites Bottom)) (regions \"Home\" P2 (sites Top)) (map \"Throw\" {(pair 0 8) (pair 1 0) (pair 2 0) (pair 3 2) (pair 4 12)}) (dice d:2 from:0 num:4)}) (rules (start { (place \"Stick1\" (sites Bottom)) (place \"Stick2\" (sites Top))}) (play (do (if (not (\"PlayedHalfThrow\")) (roll)) next:(if (can Move (forEach Piece)) (forEach Piece) (move Pass (then (set Var 0)))) (then (if (\"IsSpecialThrow\") (moveAgain))))) (end (if (and (= 0 (\"NumPieceNotInEnemyHome\" P1 P2)) (= 0 (\"NumPieceNotInEnemyHome\" P2 P1))) (byScore { (score P1 (\"PiecesOwnedOnEnemyHomedBy\" P2 P1)) (score P2 (\"PiecesOwnedOnEnemyHomedBy\" P1 P2))}))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPieces move as knights in Chess. The goal is to be the first player to reach the opposite side of the board from the starting position. \n\n###\n\n", "completion": "(game \"Knightthrough\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (piece \"Knight\" Each (move Leap \"KnightWalk\" forward:True (to if:(not (\"IsFriendAt\" (to))) (apply (remove (to)))))) (regions P1 (sites Top)) (regions P2 (sites Bottom))}) (rules (start { (place \"Knight1\" (expand (sites Bottom))) (place \"Knight2\" (expand (sites Top)))}) (play (forEach Piece)) (end (\"ReachWin\" (sites Mover) Mover)))) 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\nForty stones, arranged in a circle, with a larger gap after every tenth stone. The gaps between the stones are the playing spaces. Two to four players. One stick per player. Three sticks, each with one flat marked side and one round side, used as dice. The throws are as follows: one marked side up = 2; two marked sides up = 3; all marked sides up = 5; no marked sides up =10. Throws of 10 grant the player another throw. Each player starts at one of the larger gaps, and any players facing each other play on a team. Teams play in opposite directions: The player starting from the left or right space moves in a clockwise direction; the player(s) sitting at the top or bottom play anticlockwise). When a player's piece moves past or onto the space occupied by a piece belonging to the opposing team, the opposing team's piece is sent back to the starting space. The first team to circle the board three times wins. The game has 4 players.\n\n###\n\n", "completion": "(define \"Move\" (move (from (from) level:(level)) (to (\"SiteToMoveOnTrack\" (\"ThrowValue\")) if:True (\"HittingCapture\" (mapEntry \"Start\" (who at:(to))))) (then (forEach Site (sites Track Mover \"Track\" from:(\"NextSite\" (last From) \"Track\") to:(last To)) (if (\"IsEnemyAt\" (site)) (forEach Level (site) (move (from (site) level:(level)) (to (mapEntry \"Start\" (who at:(site) level:(level))))))))))) (define \"MadeACompleteCircuit\" (is In (mapEntry \"Start\" Mover) (sites Track Mover \"Track\" from:(\"NextSite\" (last From) \"Track\") to:(last To)))) (define \"NextSite\" (\"NextSiteOnTrack\" 1 from:#1 #2)) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" #1)) (define \"ThrowValue\" (mapEntry \"Throw\" (count Pips))) (game \"Set Dilth'\" (players 4) (equipment { (\"FortyStonesWithFourGapsBoard\" { (track \"Track1\" {39 34 32 30 28 26 24 22 20 18 36 16 14 12 10 8 6 4 2 0 37 1 3 5 7 9 11 13 15 17 38 19 21 23 25 27 29 31 33 35} loop:True P1) (track \"Track2\" {39 35 33 31 29 27 25 23 21 19 38 17 15 13 11 9 7 5 3 1 37 0 2 4 6 8 10 12 14 16 36 18 20 22 24 26 28 30 32 34} loop:True P2) (track \"Track3\" {39 34 32 30 28 26 24 22 20 18 36 16 14 12 10 8 6 4 2 0 37 1 3 5 7 9 11 13 15 17 38 19 21 23 25 27 29 31 33 35} loop:True P3) (track \"Track4\" {39 35 33 31 29 27 25 23 21 19 38 17 15 13 11 9 7 5 3 1 37 0 2 4 6 8 10 12 14 16 36 18 20 22 24 26 28 30 32 34} loop:True P4)}) (regions \"AllSites\" (sites Board)) (map \"Throw\" {(pair 0 10) (pair 1 2) (pair 2 3) (pair 3 5)}) (map \"Start\" {(pair 1 37) (pair 2 38) (pair 3 39) (pair 4 36)}) (piece \"Stick\" Each (\"Move\")) (\"StickDice\" 3)}) (rules (start { (set Team 1 {P1 P3}) (set Team 2 {P2 P4}) (place Stack \"Stick1\" 37) (place Stack \"Stick2\" 38) (place Stack \"Stick3\" 39) (place Stack \"Stick4\" 36)}) (play (\"RollMove\" (forEach Piece) (then (do (if (\"MadeACompleteCircuit\") (addScore Mover 1) (then (if (= (score Mover) 3) (remove (last To))))) next:(if (and (!= 3 (score Mover)) (= 10 (\"ThrowValue\"))) (moveAgain)))))) (end (if (>= (score Mover) 4) (result Mover Win))))) 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": "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. When a player succeeds in making a line of three with their pieces, they win. \n\n###\n\n", "completion": "(game \"Ngre E E\" (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\")))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nEach row has 5 holes. -> Each row has 6 holes.\n(define \"AllPieceInOpponentHome\" (and (= (count Sites in:(difference (sites Occupied by:P1) (sites P2))) 0) (= (count Sites in:(difference (sites Occupied by:P2) (sites P1))) 0))) (define \"CaptureEnemyPiece\" (apply if:(\"IsEnemyAt\" (to)) (remove (to)))) (define \"InactivePiece\" (= (state at:(from)) 1)) (define \"ActivatedPiece\" (= (state at:(from)) 0)) (define \"ActivatePiece\" (if (= (state at:(last To)) 1) (set State at:(last To) 0))) (define \"ThrowValue\" (mapEntry (count Pips))) (game \"Sig (Mzab)\" (players 2) (equipment { (board (rectangle 4 5) { (track \"Track1\" \"0,E,N1,W,N1,E,N1,W\" P1 directed:True) (track \"Track2\" \"19,W,S1,E,S1,W,S1,E\" P2 directed:True)} use:Vertex) (piece \"Stick\" Each (if (or (\"ActivatedPiece\") (and (or (= 1 (\"ThrowValue\")) (= 6 (\"ThrowValue\"))) (\"InactivePiece\"))) (if (\"IsNotOffBoard\" (\"NextSiteOnTrack\" (if (\"InactivePiece\") 1 (\"ThrowValue\")))) (if (or (is In (\"NextSiteOnTrack\" (if (\"InactivePiece\") 1 (\"ThrowValue\"))) (sites Empty)) (\"IsEnemyAt\" (\"NextSiteOnTrack\" (if (\"InactivePiece\") 1 (\"ThrowValue\"))))) (move (from) (to (\"NextSiteOnTrack\" (if (\"InactivePiece\") 1 (\"ThrowValue\"))) \"CaptureEnemyPiece\"))) (then (\"ActivatePiece\"))))) (regions \"AllSites\" (sites Board)) (\"StickDice\" 6) (map {(pair 0 6) (pair 1 0) (pair 2 2) (pair 3 1) (pair 4 1) (pair 5 0) (pair 6 6)}) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start { (place \"Stick1\" (sites Bottom) state:1) (place \"Stick2\" (sites Top) state:1)}) (play (\"RollMove\" (forEach Piece))) (end { (\"CaptureAll\" Next) (if (\"AllPieceInOpponentHome\") (result Mover Draw))})))\n\n###\n\n", "completion": "(define \"AllPieceInOpponentHome\" (and (= (count Sites in:(difference (sites Occupied by:P1) (sites P2))) 0) (= (count Sites in:(difference (sites Occupied by:P2) (sites P1))) 0))) (define \"CaptureEnemyPiece\" (apply if:(\"IsEnemyAt\" (to)) (remove (to)))) (define \"InactivePiece\" (= (state at:(from)) 1)) (define \"ActivatedPiece\" (= (state at:(from)) 0)) (define \"ActivatePiece\" (if (= (state at:(last To)) 1) (set State at:(last To) 0))) (define \"ThrowValue\" (mapEntry (count Pips))) (game \"Sig (Mzab)\" (players 2) (equipment { (board (rectangle 4 6) { (track \"Track1\" \"0,E,N1,W,N1,E,N1,W\" P1 directed:True) (track \"Track2\" \"23,W,S1,E,S1,W,S1,E\" P2 directed:True)} use:Vertex) (piece \"Stick\" Each (if (or (\"ActivatedPiece\") (and (or (= 1 (\"ThrowValue\")) (= 6 (\"ThrowValue\"))) (\"InactivePiece\"))) (if (\"IsNotOffBoard\" (\"NextSiteOnTrack\" (if (\"InactivePiece\") 1 (\"ThrowValue\")))) (if (or (is In (\"NextSiteOnTrack\" (if (\"InactivePiece\") 1 (\"ThrowValue\"))) (sites Empty)) (\"IsEnemyAt\" (\"NextSiteOnTrack\" (if (\"InactivePiece\") 1 (\"ThrowValue\"))))) (move (from) (to (\"NextSiteOnTrack\" (if (\"InactivePiece\") 1 (\"ThrowValue\"))) \"CaptureEnemyPiece\"))) (then (\"ActivatePiece\"))))) (regions \"AllSites\" (sites Board)) (\"StickDice\" 6) (map {(pair 0 6) (pair 1 0) (pair 2 2) (pair 3 1) (pair 4 1) (pair 5 0) (pair 6 6)}) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start { (place \"Stick1\" (sites Bottom) state:1) (place \"Stick2\" (sites Top) state:1)}) (play (\"RollMove\" (forEach Piece))) (end { (\"CaptureAll\" Next) (if (\"AllPieceInOpponentHome\") (result Mover Draw))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nReversi is played on an 8x8 board. Pieces are double-sided, with each side distinct in some way from the other. Each side designates ownership of that pieces to a certain player when face-up. Play begins with the players taking turns placing pieces into the central four squares until they are full. Then players may place their pieces next to an opponent's piece, a long as a straight line can be drawn between the new piece and an existing piece belonging to that player that goes through the opponent's piece. The opponent's pieces between the new piece and the old piece are then flipped and now belong to the player who just played. If a player cannot make a legal move, they pass. Play continues until the board is full or neither player cannot make a legal move. The player with the most pieces on the board wins. The pieces are placed on the board. The board is a square board of size 8x8.\n\n###\n\n", "completion": "(define \"ReverseBoundedPieces\" (custodial (from (site)) (between if:(is Enemy (state at:(between))) (apply (allCombinations (add (piece \"Disc0\" state:(mover)) (to (site))) (flip (between))))) (to if:(is Friend (state at:(to)))))) (game \"Reversi\" (players 2) (equipment { (board (square 8)) (piece \"Disc\" Neutral (flips 1 2))}) (rules (start { (place \"Disc0\" (difference (sites Centre) (sites Phase 1)) state:1) (place \"Disc0\" (difference (sites Centre) (sites Phase 0)) state:2)}) phases:{ (phase \"Playing\" (play (forEach Site (sites Empty) (append \"ReverseBoundedPieces\" (then (and (set Score P1 (count Sites in:(sites State 1))) (set Score P2 (count Sites in:(sites State 2)))))))))} (end (if (all Passed) (byScore))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x7 board, with two stores. Seven counters per hole. The first player may choose the direction of sowing, which must be maintained throughout the game. Sowing includes the player's store, which is the store following the last hole in the player's row, according to the direction of sowing. When the final counter of a sowing falls into an occupied hole, the counters in that hole are picked up and sowing continues. When the final counter of a sowing falls into an empty hole, that counter is captured along with any counters in the hole in the row opposite it. When the final counter falls into the player's store, the turn ends. The player who first captures half of the counters wins.\n Sowing occurs in CCW.\n\n###\n\n", "completion": "(define \"GoalNumCapturedCounters\" (/ (* 7 (- (count Sites in:(sites Board)) 2)) 2)) (define \"Columns\" 7) (game \"Chonka\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" { (track \"Track1\" \"1,E,ENE,WNW,W\" loop:True P1) (track \"Track2\" \"1,E,N,W,WSW\" loop:True P2)}) (piece \"Seed\" Shared) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 LastSite) (pair P2 FirstSite)})}) (rules (start (set Count 7 to:(union (sites P1) (sites P2)))) (play (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover)) if:(> (count at:(from)) 0)) (then (sow apply:(if (!= (to) (mapEntry Mover)) (if (> (count at:(to)) 1) (moveAgain) (and (fromTo (from (\"OppositePitTwoRows\" (to))) (to (mapEntry Mover)) count:(count at:(\"OppositePitTwoRows\" (to)))) (fromTo (from (to)) (to (mapEntry Mover)) count:(count at:(to)))))))))) (end (if (<= (\"GoalNumCapturedCounters\") (count at:(mapEntry Mover))) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nSame rules as Chess, just a different setup. \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 \"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 \"Official Football Chess\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (\"ChessPawn\" \"Pawn\" (or \"InitialPawnMove\" \"EnPassant\") (then (and (\"ReplayInMovingOn\" (sites Mover \"Promotion\")) (set Counter)))) (\"ChessRook\" \"Rook\" (then (set Counter)) (\"RememberPieceHasMoved\")) (\"ChessKing\" \"King\" (then (set Counter)) (\"RememberPieceHasMoved\")) (\"ChessBishop\" \"Bishop\" (then (set Counter))) (\"ChessKnight\" \"Knight\" (then (set Counter))) (\"ChessQueen\" \"Queen\" (then (set Counter))) (map \"King\" {(pair 1 \"D1\") (pair 2 \"D8\")}) (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 {\"B2\" \"C2\" \"E2\" \"F2\"})) (place \"Pawn2\" (sites {\"B7\" \"C7\" \"E7\" \"F7\"})) (place \"Rook1\" {\"A1\" \"H1\"} state:1) (place \"Knight1\" {\"D2\"}) (place \"Bishop1\" {\"A2\" \"H2\"}) (place \"Queen1\" coord:\"E1\") (place \"King1\" coord:\"D1\" state:1) (place \"Rook2\" {\"A8\" \"H8\"} state:1) (place \"Knight2\" {\"D7\"}) (place \"Bishop2\" {\"A7\" \"H7\"}) (place \"Queen2\" coord:\"E8\") (place \"King2\" coord:\"D8\" state:1)}) (play (if \"SameTurn\" (move Promote (last To) (piece {\"Queen\" \"Knight\" \"Bishop\" \"Rook\"}) Mover) (do (or (forEach Piece) (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\")))) ifAfterwards:(not (\"IsInCheck\" \"King\" Mover))))) (end { (\"Checkmate\" \"King\") (if (or (no Moves Mover) (= (counter) 99)) (result Mover Draw))}))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"Custodial\" (custodial (from (last To)) Orthogonal (between (max 1) if:(= (what at:(between)) (id #1)) (apply (remove (between)))) (to if:(\"FriendOrCentre\")))) (define \"JarlButNotTheExpandedCentre\" (and (= (what at:(between)) (id \"Jarl2\")) (and (!= (between) (\"Castle\")) (not (is In (between) (sites \"OrthogonalSitesCentre\")))))) (define \"JarlAndExpandedCentre\" (and (= (what at:(between)) (id \"Jarl2\")) (or (= (between) (\"Castle\")) (is In (between) (sites \"OrthogonalSitesCentre\"))))) (define \"FriendOrCentre\" (or (\"IsFriendAt\" (to)) (= (to) (\"Castle\")))) (define \"CaptureJarl\" (apply (trigger \"Surrounded\" P2))) (define \"JarlWasCaptured\" (is Triggered \"Surrounded\" P2)) (define \"Castle\" (centrePoint)) (game \"Tablut\" (players 2) (equipment { (board (square 9)) (piece \"Thrall\" P1 (move Slide Orthogonal (between if:(and (!= (between) (\"Castle\")) (is Empty (between)))) (then (or { (\"Custodial\" \"Thrall2\") (surround (from (last To)) Orthogonal (between if:\"JarlAndExpandedCentre\" \"CaptureJarl\") (to if:\"FriendOrCentre\")) (custodial (from (last To)) Orthogonal (between (max 1) if:\"JarlButNotTheExpandedCentre\" \"CaptureJarl\") (to if:(\"IsFriendAt\" (to))))})))) (piece \"Thrall\" P2 (move Slide Orthogonal (between if:(and (!= (between) (\"Castle\")) (is Empty (between)))) (then (\"Custodial\" \"Thrall1\")))) (piece \"Jarl\" P2 (move Slide Orthogonal (between if:(and (!= (between) (\"Castle\")) (is Empty (between)))) (then (\"Custodial\" \"Thrall1\")))) (regions \"OrthogonalSitesCentre\" (difference (expand origin:(\"Castle\") Orthogonal) (\"Castle\")))}) (rules (start { (place \"Thrall1\" {\"D1\" \"E1\" \"F1\" \"E2\" \"A4\" \"A5\" \"A6\" \"B5\" \"I4\" \"I5\" \"I6\" \"H5\" \"E8\" \"D9\" \"E9\" \"F9\" \"E8\"}) (place \"Thrall2\" {\"E3\" \"E4\" \"E6\" \"E7\" \"C5\" \"D5\" \"F5\" \"G5\"}) (place \"Jarl2\" (centrePoint))}) (play (forEach Piece)) (end { (\"PieceTypeReachWin\" \"Jarl2\" (sites Outer) P2) (if \"JarlWasCaptured\" (result P1 Win))})))\n\n###\n\n", "completion": "The central square is the castle, which cannot be entered by pieces or by the king once it has left. There are two sides: one with the king and 8 pieces, another with 16 undifferentiated pieces. The king begins on the castle space, and his associated pieces are arranged with two pieces on each orthogonal side of the king. The opposing side is arranged on the sides of the board, one piece on each of the three central squares on each of the four sides, and one further piece on the next row in on the central square of the row. Pieces move orthogonally any number of squares. Pieces cannot jump. If a piece is caught between two opposing pieces, it is removed from play. A piece may also be captured by trapping it between an enemy piece and the castle. The king, when in the castle, can only be captured when surrounded on four sides. If it is in a space adjacent to one of the sides, it can be captured when the opponent surrounds it on the remaining three sides. Otherwise, it is captured like any other piece. If the king moves to the edge of the board, the player controlling the king wins. If the opposing side captures the king, they win. The king is captured if the enemy flanks him, except on the castle where he should be surrounded. END" }, { "prompt": "Construct a Ludii game based on the following description\nThe king player receives one king piece and an army of 18. The mob player gets 26 pieces. Play is set on a star shape board. Captures are done by jumping adjacent enemy pieces and are compulsory but not multiple. Only the King can move to one of the star point cells (the blue cells). If no possible capture, a player moves a pawn to an adjacent empty cell.\n The mob wins if the king is captured and the king player wins by getting the king piece to any of the points of the star. \n\n###\n\n", "completion": "(game \"Louis XVI\" (players 2) (equipment { (board (remove (hex 7) cells:{ 0 1 2 4 5 6 7 8 9 12 13 14 15 16 22 23 57 45 70 34 58 82 46 71 69 81 56 44 68 92 55 80 120 121 122 124 125 126 112 113 114 117 118 119 103 104 110 111})) (piece \"Pawn\" Each) (piece \"King\" P2) (regions \"GoalKing\" (difference (sites Corners) (expand (sites Centre) steps:4)))}) (rules (start { (place \"Pawn1\" (difference (expand (sites Centre) steps:4) (expand (sites Centre) steps:3))) (place \"Pawn2\" (difference (expand (sites Centre) steps:2) (sites Centre))) (place \"Pawn1\" (difference (expand (sites Centre) steps:4) (expand (sites Centre) steps:3))) (place \"King2\" (sites Centre))}) (play (priority { (or (forEach Piece \"Pawn\" (move Hop (between if:(\"IsEnemyAt\" (between))) (to if:(and (not (is In (to) (sites \"GoalKing\"))) (is Empty (to))) (apply (remove (between)))))) (forEach Piece \"King\" (move Hop (between if:(\"IsEnemyAt\" (between))) (to if:(is Empty (to)))))) (or (forEach Piece \"Pawn\" (move Step (to if:(and (not (is In (to) (sites \"GoalKing\"))) (is Empty (to))) (apply (remove (between)))))) (forEach Piece \"King\" (\"StepToEmpty\")))})) (end { (if (\"IsOffBoard\" (where \"King\" P2)) (result P1 Win)) (\"PieceTypeReachWin\" \"King2\" (sites \"GoalKing\") P2)}))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x12 board, divided in half. Spaces on each side take the form of semi-circular sockets, into which the pieces fit. Fifteen pieces per player. Three 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. Both players begin in the same quadrant of the board. One player's pieces are arranged as follows: Eight on the first point of the quadrant to their left, four on the fifth, and three on the sixth. The other player places five on the second, third, and fourth space of the same quadrant. The track proceeds in a clockwise direction around the board. When a player's piece lands on a space occupied by a single piece of the opponent, it is sent back to the beginning of the quadrant to the right of the starting quadrant. Pieces bear off from the quadrant diagonal from the starting quadrant. The first player to bear off all their pieces wins. \n\n###\n\n", "completion": "(define \"NextSiteFrom\" (\"NextSiteOnTrack\" #2 from:#1)) (game \"Seys Dos y As\" (players 2) (equipment { (\"TableBoard\" { (track \"Track1\" {24 11..0 12..17} P1 directed:True) (track \"Track2\" {25 11..0 12..17} P2 directed:True)}) (dice d:6 num:3) (piece \"Disc\" Each (forEach Die if:(\"DieNotUsed\") (if (\"IsOffBoard\" (\"NextSiteFrom\" (from) (pips))) (move Remove (from)) (move (from (from)) (to (\"NextSiteFrom\" (from) (pips)) if:(\"NoEnemyOrOnlyOne\" (to)) (\"HittingCapture\" (handSite Next))))) (then (\"ReplayNotAllDiceUsed\")))) (hand Each)}) (rules (start { (place Stack \"Disc1\" 11 count:8) (place Stack \"Disc1\" 6 count:3) (place Stack \"Disc1\" 7 count:4) (place Stack \"Disc2\" (sites {10..8}) count:5)}) (play (\"RollEachNewTurnMove\" (or (forEach Piece top:True) (forEach Piece container:(mover) top:True)))) (end (\"EscapeWin\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe rules of TRAX are simple: \n - Place tiles adjacent to those already in play such that the colours of the tracks match. \n - The objective is to get a loop or line of your colour while attempting to stop your opponent in their colour. \n - A line is a continuous path of track that connects opposite and outermost edges of the tiles in play, over at least 8 rows of tiles, across or down.\n - What gives Trax its strategic depth is the forced play rule which allows (or even requires) multiple tiles to be played in a turn.\n \n\n###\n\n", "completion": "(define \"PlaceATileTo\" (or (move \"PositionOfTileX\" (to #1 (rotations {N E})) copy:True) (move \"PositionOfTileCurved\" (to #1 (rotations Orthogonal)) copy:True))) (define \"AnotherConnectedTile\" (sites Around (sites Occupied by:All) Orthogonal if:(is Empty (to)))) (define \"PositionOfTileCurved\" (from (handSite Shared 1))) (define \"PositionOfTileX\" (from (handSite Shared))) (define \"PathLength\" (/ \"NumTiles\" 4)) (define \"NumTiles\" 32) (game \"Trax\" (players 2) (equipment { (boardless Square) (hand Shared size:2) (tile \"TileX\" numSides:4 { (path from:0 to:2 colour:1) (path from:1 to:3 colour:2)}) (tile \"TileCurved\" numSides:4 { (path from:0 to:1 colour:1) (path from:2 to:3 colour:2)})}) (rules (meta (automove)) (start { (place \"TileX\" (handSite Shared)) (place \"TileCurved\" (handSite Shared 1))}) phases:{ (phase \"Opening\" (play (\"PlaceATileTo\" (centrePoint))) (nextPhase \"Connection\")) (phase \"Connection\" (play (do (\"PlaceATileTo\" \"AnotherConnectedTile\") ifAfterwards:(is SidesMatch))) (end { (if (or (is Loop (mover) path:True) (<= \"PathLength\" (pathExtent (mover)))) (result Mover Win)) (if (or (is Loop (next) path:True) (<= \"PathLength\" (pathExtent (next)))) (result Next Win)) (if (>= (count Sites in:(sites Occupied by:All)) (* (count Players) \"NumTiles\")) (result Mover Draw))}))})) END" }, { "prompt": "Construct a Ludii game based on the following description\nAll the rules of Go apply, except that passing is not allowed. A player loses if he has no legal move. A player wins if they successfully connect two opposite sides of the board. The game is played on a 13x13 board\n\n###\n\n", "completion": "(game \"Gonnect\" (players 2) (equipment { (board (square 13) use:Vertex) (piece \"Marker\" Each) (regions P1 {(sites Side N) (sites Side S)}) (regions P2 {(sites Side W) (sites Side E)})}) (rules (meta { (swap) (no Repeat)}) (play (do (move Add (to (sites Empty)) (then (\"EncloseCapture\" Orthogonal))) ifAfterwards:(\"HasFreedom\" Orthogonal))) (end { (if (is Connected Mover) (result Mover Win)) (\"BlockWin\")}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayed on an 8x8 board. One player plays as one Raja, the other with the following pieces: 8 Bhata (or Padati; move like Chess pawns but without being able to move two on the first turn); 2 Ashva (horses; move like Chess knights); 2 Gaja (elephants; two spaces in any orthogonal direction, jumping over the first square); 2 Ratha (chariots; moves like a rook in chess); 1 Mantri (counselor; moves one square diagonally in any direction); 1 Raja (king; moves one square in any direction). These are set up along one edge of the board: Ratha-Ashva-Gaja-Mantri-Raja-Gaja-Ashva-Ratha, with the eight Bhata lined up in the row in front of these, as in chess. The player with the full complement of pieces rolls a six-sided die to determine which piece to move: 6=Raja, 5= Mantri, 4=Gaja, 3 = Ashva, 2=Ratha, 1= Bhata. The player with the single Raja can move it according to the moves of any piece. Players take turns moving. When one piece lands on the space occupied by another piece, it is captured. The goal of the player with a full complement of pieces is to block the single Raja so that it cannot move. The Goal of the single Raja is to checkmate the opponent's Raja. \n\n###\n\n", "completion": "(define \"ElephantMove\" (move Hop Orthogonal (between if:True) (to if:(not (\"IsFriendAt\" (to))) (apply (if (\"IsEnemyAt\" (to)) (remove (to))))))) (define \"RookMove\" (\"SlideCapture\" Orthogonal)) (define \"QueenMove\" (\"StepToNotFriend\" Diagonal)) (define \"KnightMove\" (\"LeapCapture\" \"KnightWalk\")) (define \"KingMove\" (\"StepToNotFriend\")) (define \"NextCanNotMove\" (not (can Move (do (forEach Piece Next) ifAfterwards:(not (\"IsInCheck\" \"King_noCross\" Next (forEach Piece))))))) (define \"CaptureForwardDiagonal\" (\"StepToEnemy\" (directions {FR FL}))) (game \"Sarvatobhadra\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (dice d:6 from:1 num:1) (piece \"King_noCross\" P1 (\"KingMove\")) (piece \"Ferz_noCross\" P1 (\"QueenMove\")) (piece \"Knight\" P1 (\"KnightMove\")) (piece \"Elephant\" P1 (\"ElephantMove\")) (piece \"Rook\" P1 (\"RookMove\")) (piece \"Pawn\" P1 (or \"StepForwardToEmpty\" \"CaptureForwardDiagonal\" (then (\"PromoteIfReach\" (sites Top) \"Ferz_noCross\")))) (piece \"King_noCross\" P2 (or { (\"RookMove\") (\"KnightMove\") (\"ElephantMove\") (\"QueenMove\") (\"QueenMove\") (\"KingMove\")}))}) (rules (start { (place \"Pawn1\" (sites Row 1)) (place \"Rook1\" {\"A1\" \"H1\"}) (place \"Knight1\" {\"B1\" \"G1\"}) (place \"Elephant1\" {\"C1\" \"F1\"}) (place \"Ferz_noCross1\" coord:\"D1\") (place \"King_noCross1\" coord:\"E1\") (place \"King_noCross2\" coord:\"E8\")}) (play (do (if (is Mover P1) (do (roll) next:(if (= (count Pips) 6) (forEach Piece \"King_noCross\") (if (= (count Pips) 5) (forEach Piece \"Ferz_noCross\") (if (= (count Pips) 4) (forEach Piece \"Elephant\") (if (= (count Pips) 3) (forEach Piece \"Knight\") (if (= (count Pips) 2) (forEach Piece \"Rook\") (forEach Piece \"Pawn\"))))))) (forEach Piece)) ifAfterwards:(not (\"IsInCheck\" \"King_noCross\" Mover (forEach Piece Next))))) (end { (if (and { (is Mover P2) (\"IsInCheck\" \"King_noCross\" Next) (\"NextCanNotMove\")}) (result P2 Win)) (if (and (is Mover P1) (no Moves P2)) (result P1 Win)) (if (and { (is Mover P1) (\"IsInCheck\" \"King_noCross\" P1) (no Moves P1)}) (result P2 Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe board is a rectilinear track with two rows, of any number. Six or seven players, seven are preferred. One piece per player. Two seashells, used as dice. The throws are as follows: two backs = 20; two hollow sides = 10, one of each = 0. The player to reach the end of the track wins. The game involves 7 players. Each row has 50 holes.\n\n###\n\n", "completion": "(define \"SiteToMove\" (if (= (from) (handSite Mover)) (\"SiteToMoveOnTrack\" from:0 (- (\"ThrowValue\") 1)) (\"SiteToMoveOnTrack\" from:(from) (\"ThrowValue\")))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" #2 #1)) (define \"ThrowValue\" (mapEntry (count Pips))) (game \"Uturu Uturu Kaida\" (players 7) (equipment { (board (rectangle 2 50) (track \"Track\" {0..49 99..50} directed:True) use:Vertex) (hand Each) (piece \"Horse\" Each (if (\"IsOffBoard\" (\"SiteToMove\")) (move Remove (from) level:(level)) (move (from (from) level:(level)) (to (\"SiteToMove\")) stack:True))) (\"StickDice\" 2) (map {(pair 0 10) (pair 1 0) (pair 2 20)})}) (rules (start (place \"Horse\" \"Hand\")) (play (\"RollMove\" (if (< 0 (\"ThrowValue\")) (or (forEach Piece) (forEach Piece container:(mover)))))) (end (\"EscapeWin\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlay begins with all holes filled except the central hole. The player moves a peg by orthogonally jumping an adjacent peg and removing it from the board. The goal is to remove all but one peg, leaving it in the central hole. The game is played on the English board.\n\n###\n\n", "completion": "(game \"Peg Solitaire\" (players 1) (equipment { (board (merge (shift 0 2 (rectangle 3 7)) (shift 2 0 (rectangle 7 3))) use:Vertex) (piece \"Marker\" P1 (\"HopFriendCapture\" Orthogonal))}) (rules (start { (place \"Marker\" (difference (sites Board) (sites {\"D4\"})))}) (play (forEach Piece)) (end (if (and (is Friend (who at:(centrePoint))) (= 1 (count Pieces All))) (result P1 Win))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nA 5x5 playing area is currently selected -> A 9x9 playing area is currently selected\n(game \"Flume\" (players 2) (equipment { (board (square 7)) (piece \"Disc\" Each) (piece \"Disc\" Neutral)}) (rules (meta (swap)) (start (place \"Disc0\" (sites Outer))) (play (move Add (to (sites Empty)) (then (and (addScore Mover 1) (if (< 2 (count Sites in:(sites Around (last To) NotEmpty Orthogonal))) (moveAgain)))))) (end (if (is Full) (byScore)))))\n\n###\n\n", "completion": "(game \"Flume\" (players 2) (equipment { (board (square 11)) (piece \"Disc\" Each) (piece \"Disc\" Neutral)}) (rules (meta (swap)) (start (place \"Disc0\" (sites Outer))) (play (move Add (to (sites Empty)) (then (and (addScore Mover 1) (if (< 2 (count Sites in:(sites Around (last To) NotEmpty Orthogonal))) (moveAgain)))))) (end (if (is Full) (byScore))))) 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 \"RemoveDeadPieces\" (forEach Site (forEach (sites Occupied by:#1 container:\"Board\") if:(= (size Stack at:(site)) 2)) (and {(remove (site)) (remove (site)) (add (piece (id \"Marker\" #1)) (to (site)))}))) (define \"PlaceOnTop\" (move (from (handSite Mover)) (to (forEach (sites Occupied by:Next container:\"Board\") if:(= (size Stack at:(site)) 1))))) (game \"Sam K'i\" (players 2) (equipment { (board (concentric Square rings:3 joinCorners:True) use:Vertex) (hand Each) (piece \"Marker\" Each (\"StepToEmpty\" ~ (then (\"ReplayIfLine3\" if:(\"IsSingletonStack\" (to))))))}) (rules (start { (place Stack \"Marker1\" (handSite P1) count:12) (place Stack \"Marker2\" (handSite P2) count:12)}) phases:{ (phase \"Placement\" (play (if \"SameTurn\" \"PlaceOnTop\" (if (\"HandOccupied\" Mover) (move (from (handSite Mover)) (to (sites Empty)) (then (\"ReplayIfLine3\" if:(\"IsSingletonStack\" (to)))))) (then (if (and (not (is Next Mover)) (and (\"HandEmpty\" P1) (\"HandEmpty\" P2))) (and (\"RemoveDeadPieces\" P1) (\"RemoveDeadPieces\" P2)))))) (nextPhase (and (not (is Next Mover)) (and (\"HandEmpty\" P1) (\"HandEmpty\" P2))) \"Movement\")) (phase \"Movement\" (play (if \"SameTurn\" \"RemoveAnyEnemyPiece\" (if (> (count Pieces Mover) 3) (forEach Piece) (move (from (sites Occupied by:Mover)) (to (sites Empty)))))) (end (\"BlockWin\")))}))\n\n###\n\n", "completion": "Three concentric squares, with lines connecting the corners and the midpoints of the sides. Twelve pieces per player. Players alternate turns placing a piece on the board. When a player places three pieces in a row along the lines of the board, the player places another of their pieces on top of one of the opponent's pieces; the opponent's piece is considered \\ END" }, { "prompt": "Construct a Ludii game based on the following description\n5x5 lines, intersecting to form a square. Diagonals are drawn in the four quadrants of the board. One triangle, its apex intersecting the main board at the midpoint of one side. The base of the triangle is bisected by a line drawn from the apex, and this line is bisected and intersects with the other two sides of the triangle. One player plays as the tiger, placed on the central point of the triangle, and the other plays as twelve goats, which begin on the first two rows of points opposite the triangle and on the outer two points in the third row. The tiger moves first. Pieces move to an empty adjacent spot along the lines on the board. The tiger alone may capture a goat by hopping over it to an empty spot immediately opposite a goat. The tiger wins by capturing all the goats; the goats win by blocking the tiger from being able to move. \n\n###\n\n", "completion": "(game \"Orissa Tiger Game (One Tiger)\" (players 2) (equipment { (board (rotate 180 (\"AlquerqueGraphWithBottomTriangle\")) use:Vertex) (piece \"Tiger\" P1 (or (\"StepToEmpty\") (\"HopCapture\"))) (piece \"Goat\" P2 (\"StepToEmpty\"))}) (rules (start { (place \"Tiger1\" (sites {\"C6\"})) (place \"Goat2\" (union (expand (sites Bottom)) (sites {\"A3\" \"E3\"})))}) (play (forEach Piece)) (end (\"NoMovesP1NoPiecesP2\")))) 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": "Modify the Ludii game according to the following option changes:\nPlayed on a size 5 board. -> Played on a size 6 board.\n(define \"Skip\" (move Set NextPlayer (player (next)))) (define \"IsPlayingPhase\" (= 1 (var))) (define \"BlackVC\" (or (is Connected Orthogonal {(sites Side N) (sites Side S)}) (is Connected Orthogonal {(sites Side E) (sites Side W)}))) (define \"WhiteVC\" (is Connected All {(sites Side N) (sites Side S) (sites Side E) (sites Side W)})) (game \"Pippinzip (Zipline variant)\" (players 2) (equipment { (board (square 5) use:Vertex) (piece \"Disc\" Each)}) (rules phases:{ (phase \"Opening\" (play (or (or (move Add (piece (id \"Disc\" P2)) (to (sites Empty)) (then (if (< (count MovesThisTurn) 2) (moveAgain)))) \"Skip\") (if (= (count MovesThisTurn) 0) (move Pass (then (if (is Mover P1) (swap Players P1 P2 (then (note \"Player 1 is now White. Player 2 is now Black.\" to:All))) (note \"Player 1 is now Black. Player 2 is now White.\" to:All) (then (do (set NextPlayer (player 1)) next:(set Var 1))))))))) (nextPhase (\"IsPlayingPhase\") \"Playing\")) (phase \"Playing\" (play (or (move Add (to (sites Empty) if:(= (id P1) (mover))) (then (if (= 0 (count MovesThisTurn)) (moveAgain)))) (move Add (to (sites Empty) if:(= (id P2) (mover)))))))} (end { (if (and (not (\"IsPlayingPhase\")) (\"WhiteVC\")) (result Mover Win)) (if (and {(= (id P1) (mover)) (\"BlackVC\")}) (result P1 Win)) (if (and {(= (id P2) (mover)) (\"WhiteVC\")}) (result P2 Win))})))\n\n###\n\n", "completion": "(define \"Skip\" (move Set NextPlayer (player (next)))) (define \"IsPlayingPhase\" (= 1 (var))) (define \"BlackVC\" (or (is Connected Orthogonal {(sites Side N) (sites Side S)}) (is Connected Orthogonal {(sites Side E) (sites Side W)}))) (define \"WhiteVC\" (is Connected All {(sites Side N) (sites Side S) (sites Side E) (sites Side W)})) (game \"Pippinzip (Zipline variant)\" (players 2) (equipment { (board (square 6) use:Vertex) (piece \"Disc\" Each)}) (rules phases:{ (phase \"Opening\" (play (or (or (move Add (piece (id \"Disc\" P2)) (to (sites Empty)) (then (if (< (count MovesThisTurn) 2) (moveAgain)))) \"Skip\") (if (= (count MovesThisTurn) 0) (move Pass (then (if (is Mover P1) (swap Players P1 P2 (then (note \"Player 1 is now White. Player 2 is now Black.\" to:All))) (note \"Player 1 is now Black. Player 2 is now White.\" to:All) (then (do (set NextPlayer (player 1)) next:(set Var 1))))))))) (nextPhase (\"IsPlayingPhase\") \"Playing\")) (phase \"Playing\" (play (or (move Add (to (sites Empty) if:(= (id P1) (mover))) (then (if (= 0 (count MovesThisTurn)) (moveAgain)))) (move Add (to (sites Empty) if:(= (id P2) (mover)))))))} (end { (if (and (not (\"IsPlayingPhase\")) (\"WhiteVC\")) (result Mover Win)) (if (and {(= (id P1) (mover)) (\"BlackVC\")}) (result P1 Win)) (if (and {(= (id P2) (mover)) (\"WhiteVC\")}) (result P2 Win))}))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nA size 4 board is currently selected -> A size 6 board is currently selected\n(define \"OpponentHas\" (> (min (count Sites in:(if (< 0 (count Sites in:(intersection (sites Occupied by:Mover) (sites Direction from:(to) #1 stop:(= (mover) (who at:(to))) stopIncluded:True)))) (sites Direction from:(to) #1 stop:(= (mover) (who at:(to)))) (sites Board))) (count Sites in:(if (< 0 (count Sites in:(intersection (sites Occupied by:Mover) (sites Direction from:(to) #2 stop:(= (mover) (who at:(to))) stopIncluded:True)))) (sites Direction from:(to) #2 stop:(= (mover) (who at:(to)))) (sites Board)))) (min (count Sites in:(if (< 0 (count Sites in:(intersection (sites Occupied by:Next) (sites Direction from:(to) #1 stop:(= (next) (who at:(to))) stopIncluded:True)))) (sites Direction from:(to) #1 stop:(= (next) (who at:(to)))) (sites Board))) (count Sites in:(if (< 0 (count Sites in:(intersection (sites Occupied by:Next) (sites Direction from:(to) #2 stop:(= (next) (who at:(to))) stopIncluded:True)))) (sites Direction from:(to) #2 stop:(= (next) (who at:(to)))) (sites Board)))))) (define \"Placeable\" (not (or { (and (\"OpponentHas\" E W) (\"OpponentHas\" NNW SSE)) (and (\"OpponentHas\" E W) (\"OpponentHas\" NNE SSW)) (and (\"OpponentHas\" NNW SSE) (\"OpponentHas\" NNE SSW))}))) (game \"Mity\" (players 2) (equipment { (board (hex 4)) (piece \"Disc\" Each)}) (rules (meta (swap)) (play (move Add (to (sites Empty) if:(\"Placeable\")))) (end (\"BlockWin\"))))\n\n###\n\n", "completion": "(define \"OpponentHas\" (> (min (count Sites in:(if (< 0 (count Sites in:(intersection (sites Occupied by:Mover) (sites Direction from:(to) #1 stop:(= (mover) (who at:(to))) stopIncluded:True)))) (sites Direction from:(to) #1 stop:(= (mover) (who at:(to)))) (sites Board))) (count Sites in:(if (< 0 (count Sites in:(intersection (sites Occupied by:Mover) (sites Direction from:(to) #2 stop:(= (mover) (who at:(to))) stopIncluded:True)))) (sites Direction from:(to) #2 stop:(= (mover) (who at:(to)))) (sites Board)))) (min (count Sites in:(if (< 0 (count Sites in:(intersection (sites Occupied by:Next) (sites Direction from:(to) #1 stop:(= (next) (who at:(to))) stopIncluded:True)))) (sites Direction from:(to) #1 stop:(= (next) (who at:(to)))) (sites Board))) (count Sites in:(if (< 0 (count Sites in:(intersection (sites Occupied by:Next) (sites Direction from:(to) #2 stop:(= (next) (who at:(to))) stopIncluded:True)))) (sites Direction from:(to) #2 stop:(= (next) (who at:(to)))) (sites Board)))))) (define \"Placeable\" (not (or { (and (\"OpponentHas\" E W) (\"OpponentHas\" NNW SSE)) (and (\"OpponentHas\" E W) (\"OpponentHas\" NNE SSW)) (and (\"OpponentHas\" NNW SSE) (\"OpponentHas\" NNE SSW))}))) (game \"Mity\" (players 2) (equipment { (board (hex 6)) (piece \"Disc\" Each)}) (rules (meta (swap)) (play (move Add (to (sites Empty) if:(\"Placeable\")))) (end (\"BlockWin\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\n9x9 board, with the central square of each side marked, as well as the central space of the board. Two to four players, each player with two pieces. Played with two four-sided dice, marked 1, 3, 4, 6. Throws may be divided as the players see fit between their pieces. Doubles allow another throw. Players start with their pieces on the marked square on their side of the board. Pieces move along a spiraling track, starting in an anti-clockwise direction around the outer edges of the board, then changing to a clockwise direction when reaching the 32nd space in the track, and continuing in this direction in a spiral pattern until reaching the central square. If a player lands on a space occupied by an opponent's piece, the opponent's piece is removed from the board, and the player must throw a double 1 to enter it again on their starting square. Pieces resting on a marked space are safe from being sent to the start. The goal is to reach the central square with both pieces, which must be reached by an exact throw. If a piece is 1, 3, or 4 spaces from the center, the player must throw doubles of that number to reach the goal.\n The game is played with 4 players.\n\n###\n\n", "completion": "(define \"AllReachedCenter\" (= 2 (count Pieces Mover in:(sites Centre)))) (define \"Move\" (or (if (and { (is Occupied (handSite Mover)) (all DiceEqual) (= 2 (value Player Mover))}) (move (from (handSite Mover)) (to (mapEntry \"Entry\" Mover)) (then (and (moveAgain) (set Var \"Double\" 1))))) (forEach Piece))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" #2 #1)) (define \"ThrowValue\" (count Pips)) (game \"Saturankam\" (players 4) (equipment { (board (square 9) { (track \"Track1\" \"81,4,E,N,W,S,E1,N7,E6,S6,W5,N5,E4,S4,W3,N3,E2,S2,W1,N1\" P1 directed:True) (track \"Track2\" \"83,36,S,E,N,W,S1,E7,S6,W6,N5,E5,S4,W4,N3,E3,S2,W2,N1,E1\" P2 directed:True) (track \"Track3\" \"83,76,W,S,E,N,W1,S7,W6,N6,E5,S5,W4,N4,E3,S3,W2,N2,E1,S1\" P3 directed:True) (track \"Track4\" \"84,44,N,W,S,E,N1,W7,N6,E6,S5,W5,N4,E4,S3,W3,N2,E2,S1,W1\" P4 directed:True)}) (dice d:4 faces:{1 3 4 6} num:2) (piece \"Marker\" Each (if (and (or { (= (\"SiteToMoveOnTrack\" from:(from) 1) (centrePoint)) (= (\"SiteToMoveOnTrack\" from:(from) 3) (centrePoint)) (= (\"SiteToMoveOnTrack\" from:(from) 4) (centrePoint))}) (= (value Player Mover) (\"ThrowValue\"))) (if (and (all DiceEqual) (= (\"SiteToMoveOnTrack\" from:(from) (/ (\"ThrowValue\") 2)) (centrePoint))) (move (from (from)) (to (centrePoint)) (then (and (moveAgain) (set Var \"Double\" 1))))) (forEach Value min:1 max:(value Player Mover) (move (from (from) level:(level)) (to (\"SiteToMoveOnTrack\" from:(from) (value)) if:True (apply (and (if (and (not (is In (to) (sites \"SafeSites\"))) (\"IsEnemyAt\" (to))) (forEach Level (to) FromTop (fromTo (from (to) level:(level)) (to (handSite (who at:(to) level:(level))))))) (if (< 0 (- (value Player Mover) (value))) (and (moveAgain) (set Value Mover (- (value Player Mover) (value)))) (and (set Value Mover 0) (if (all DiceEqual) (and (moveAgain) (set Var \"Double\" 1)))))))))))) (hand Each) (regions \"SafeSites\" (sites {4 44 76 36 40})) (map \"Entry\" {(pair P1 4) (pair P2 36) (pair P3 76) (pair P4 44)})}) (rules (start { (place Stack \"Marker1\" 4 count:2) (place Stack \"Marker2\" 36 count:2) (place Stack \"Marker3\" 76 count:2) (place Stack \"Marker4\" 44 count:2)}) (play (if (or (= 1 (var \"Double\")) (\"NewTurn\")) (\"RollMove\" (move Pass (then (and { (set Value Mover (\"ThrowValue\")) (if (= 1 (var \"Double\")) (set Var \"Double\" 0)) (moveAgain)})))) (if (can Move (\"Move\")) (\"Move\") (move Pass (then (and (set Var \"Double\" 0) (set Value Mover 0))))))) (end (if (\"AllReachedCenter\") (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nOne player is the rabbit, and the other player plays with twelve other pieces. They may also play with either ten or eleven pieces instead of twelve. The pieces move along the lines. The goal is to corner the rabbit so that it cannot move. The rabbit may hop over the other pieces to capture them. The rabbit wins by reducing the opponent to nine pieces. Played on a Alquerque Board. The hare can jump to capture.\n\n###\n\n", "completion": "(game \"Cercar La Liebre\" (players 2) (equipment { (\"AlquerqueBoard\" 5 5) (piece \"Counter\" P1 \"StepToEmpty\") (piece \"Hare\" P2 (or \"HopCapture\" (if \"SameTurn\" (move Pass) \"StepToEmpty\")))}) (rules (start { (place \"Counter1\" (union {(expand (sites Bottom)) (sites {\"A3\" \"E3\"})})) (place \"Hare2\" (centrePoint))}) (play (forEach Piece)) (end (\"NoMovesLossAndLessNumPiecesPlayerLoss\" P1 9)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayed on an 8x8 board with 12 pieces per side. Pieces move one space diagonally. Capturing occurs when an opponent's piece is adjacent to a player's piece and there is an open space on the other side of the opponent and the player's piece jumps the opponent's. Capturing can happen either forwards or backwards. Capturing must happen if it is possible. Multiple jumps can be made in a turn, and the maximum number of jumps must be made. Pieces become kings when they reach the opposite side of the board from which they started at the end of its turn. Kings can move multiple spaces in one direction. \n\n###\n\n", "completion": "(define \"IsUnpromoted\" (\"IsPieceAt\" \"Counter\" Mover (last To))) (game \"Brazilian Draughts\" (players 2) (\"DraughtsEquipment\" (square 8)) (rules (\"BlackCellsSetup\" 3) (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 Ludii game based on the following description\nThe tiles are each given a number from 1 to n-1. By sliding the tiles into the open space, the object is to placed the tiles in order based on their numbering. \n\n###\n\n", "completion": "(game \"N Puzzles\" (players 1) (equipment { (board (square 3)) (piece \"1\" P1 \"StepOrthogonalToEmpty\") (piece \"2\" P1 \"StepOrthogonalToEmpty\") (piece \"3\" P1 \"StepOrthogonalToEmpty\") (piece \"4\" P1 \"StepOrthogonalToEmpty\") (piece \"5\" P1 \"StepOrthogonalToEmpty\") (piece \"6\" P1 \"StepOrthogonalToEmpty\") (piece \"7\" P1 \"StepOrthogonalToEmpty\") (piece \"8\" P1 \"StepOrthogonalToEmpty\")}) (rules (start (place Random {\"1\" \"2\" \"3\" \"4\" \"5\" \"6\" \"7\" \"8\"})) (play (forEach Piece)) (end (if (is Target {7 8 0 4 5 6 1 2 3}) (result P1 Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThree concentric squares, the corners and 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 orthogonal lines (not along the diagonal lines), the player removes any one of the opponent's pieces. When a player is reduced to four pieces, they may move a piece to any open spot on the board. The player who reduces the opponent to two pieces wins.\n \n\n###\n\n", "completion": "(define \"IfLine3MoveAgain\" (then (if (or { (is Line 3 N exact:True) (is Line 3 S exact:True) (is Line 3 E exact:True) (is Line 3 W exact:True)}) (moveAgain)))) (game \"Marelle Triple\" (players 2) (equipment { (board (concentric Square rings:3 joinCorners:True) use:Vertex) (hand Each) (piece \"Marker\" Each (\"StepToEmpty\" ~ \"IfLine3MoveAgain\"))}) (rules (start (place \"Marker\" \"Hand\" count:9)) phases:{ (phase \"Placement\" (play (if \"SameTurn\" (\"RemoveAnyEnemyPiece\") (move (from (handSite Mover)) (to (sites Empty)) \"IfLine3MoveAgain\"))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (phase \"Movement\" (play (if \"SameTurn\" (\"RemoveAnyEnemyPiece\") (if (> (count Pieces Mover) 4) (forEach Piece) (move (from (sites Occupied by:Mover)) (to (sites Empty)))))))} (end (\"HavingLessPiecesLoss\" Next 2)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nHoshi Sudoku consists of six large triangles. You must place the numbers 1-9 into the triangular cells of each large triangle. Every line, even an uncontinuous line, contains every number only once. \n\n###\n\n", "completion": "(game \"Hoshi\" (players 1) (equipment { (board (union { (tri 3) (shift 1 0.87 (rotate 180 (tri 3))) (shift 0 3.47 (tri 3)) (shift -2 2.6 (rotate 180 (tri 3))) (shift -3 1.73 (tri 3)) (shift -2 -0.87 (rotate 180 (tri 3)))}) (values Cell (range 1 9))) (regions {0 3 1 4 2 5 7 6 8}) (regions {17 16 14 15 11 13 10 12 9}) (regions {18 19 20 21 22 23 24 25 26}) (regions {27 28 29 30 31 32 33 34 35}) (regions {36 37 38 39 40 41 42 43 44}) (regions {45 46 47 48 49 50 51 52 53}) (regions {36 39 41 43 44 33 31 28}) (regions {47 37 40 42 35 34 32 30 27}) (regions {51 49 46 38 18 21 23 25 26}) (regions {53 52 50 48 45 11 19 22 24}) (regions {0 3 5 7 8 15 13 10 20}) (regions {1 4 6 17 16 14 12 9}) (regions {53 52 51 49 47 37 39 41}) (regions {0 50 48 46 38 40 42 43 44}) (regions {1 3 5 45 35 34 33 31 29}) (regions {2 4 6 7 8 18 32 30 28}) (regions {17 16 15 13 11 19 21 23 27}) (regions {14 12 10 20 22 24 25 26}) (regions {2 4 1 3 0 50 52 51}) (regions {17 6 7 5 45 48 46 49 47}) (regions {14 16 15 8 38 40 37 39 36}) (regions {9 12 10 13 11 35 42 43 41}) (regions {20 22 19 21 18 32 34 33 44}) (regions {24 25 23 27 30 28 31 29})}) (rules (start (set { {53 5} {51 2} {48 3} {5 2} {1 3} {2 7} {17 5} {14 1} {9 7} {13 4} {21 3} {24 6} {26 8} {21 3} {32 6} {28 2} {29 8} {42 9} {41 6} {36 5} {42 9}})) (play (satisfy { (all Different)})) (end (if (is Solved) (result P1 Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPhase Chess is a variant of Chess played on standard Chess board and Chess set, with same rules as Chess except the next player must move from a cell of the same colour just moved to if they can. It they can not, they can move any piece. \n\n###\n\n", "completion": "(define \"InitialPawnMove\" (if (is In (from) (sites Start (piece (what at:(from))))) (\"DoubleStepForwardToEmpty\" \"SetEnPassantLocation\"))) (define \"QueenMove\" (move Slide (to if:(\"IsEnemyAt\" (to)) \"CaptureToPieceAndResetCounter\"))) (define \"KnightMove\" (move Leap \"KnightWalk\" (to if:(not (\"IsFriendAt\" (to))) \"CaptureToPieceAndResetCounter\"))) (define \"BishopMove\" (move Slide Diagonal (to if:(\"IsEnemyAt\" (to)) \"CaptureToPieceAndResetCounter\"))) (define \"KingMove\" (move Step (to if:(not (\"IsFriendAt\" (to))) \"CaptureToPieceAndResetCounter\") \"RememberPieceHasMoved\")) (define \"RookMove\" (move Slide Orthogonal (to if:(\"IsEnemyAt\" (to)) \"CaptureToPieceAndResetCounter\") \"RememberPieceHasMoved\")) (define \"PawnMove\" (or { (if (is In (from) (sites Start (piece (what at:(from))))) (\"DoubleStepForwardToEmpty\" \"SetEnPassantLocation\")) \"StepForwardToEmpty\" \"CaptureForwardDiagonal\" \"EnPassant\"} (then (and (if (is In (last To) (sites Mover \"Promotion\")) (moveAgain)) (set Counter))))) (define \"CaptureForwardDiagonal\" (move Step (directions {FR FL}) (to if:(\"IsEnemyAt\" (to)) (apply (remove (to)))))) (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 \"BigCastling\" (\"DoCastle\" \"King\" W 2 \"KingNotCheckedAndToEmpty\" (then (and (\"PieceHasMoved\") (\"DoCastle\" \"RookLeft\" E 3 True))))) (define \"SmallCastling\" (\"DoCastle\" \"King\" E 2 \"KingNotCheckedAndToEmpty\" (then (and (\"PieceHasMoved\") (\"DoCastle\" \"RookRight\" W 2 True))))) (define \"DoCastle\" (move Slide (from (mapEntry #1 (mover))) #2 (between (exact #3) if:#4) #5)) (define \"KingNotCheckedAndToEmpty\" (and (is Empty (to)) (not (\"IsInCheck\" \"King\" Mover at:(to))))) (define \"CaptureToPieceAndResetCounter\" (apply (if (\"IsEnemyAt\" (to)) (remove (to) (then (set Counter)))))) (define \"RememberPieceHasMoved\" (then (if (= (state at:(last To)) 1) \"PieceHasMoved\"))) (define \"PieceHasMoved\" (set State at:(last To) 0)) (define \"HasNeverMoved\" (= (state at:(mapEntry #1 (mover))) 1)) (define \"KingInTheInitialPlace\" (\"IsPieceAt\" \"King\" Mover (mapEntry \"King\" (mover)))) (define \"NextCanNotMove\" (not (can Move (do (forEach Piece Next) ifAfterwards:(not (\"IsInCheck\" \"King\" Next (forEach Piece))))))) (game \"Phase Chess\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (\"ChessPawn\" \"Pawn\" (or \"InitialPawnMove\" \"EnPassant\") (then (and (\"ReplayInMovingOn\" (sites Mover \"Promotion\")) (set Counter)))) (\"ChessRook\" \"Rook\" (then (set Counter)) (\"RememberPieceHasMoved\")) (\"ChessKing\" \"King\" (then (set Counter)) (\"RememberPieceHasMoved\")) (\"ChessBishop\" \"Bishop\" (then (set Counter))) (\"ChessKnight\" \"Knight\" (then (set Counter))) (\"ChessQueen\" \"Queen\" (then (set Counter))) (map \"King\" {(pair 1 \"E1\") (pair 2 \"E8\")}) (map \"RookLeft\" {(pair 1 \"A1\") (pair 2 \"A8\")}) (map \"RookRight\" {(pair 1 \"H1\") (pair 2 \"H8\")}) (regions \"Promotion\" P1 (sites Top)) (regions \"Promotion\" P2 (sites Bottom))}) (rules (start { (place \"Pawn1\" (sites Row 1)) (place \"Pawn2\" (sites Row 6)) (place \"Rook1\" {\"A1\" \"H1\"} state:1) (place \"Knight1\" {\"B1\" \"G1\"}) (place \"Bishop1\" {\"C1\" \"F1\"}) (place \"Queen1\" coord:\"D1\") (place \"King1\" coord:\"E1\" state:1) (place \"Rook2\" {\"A8\" \"H8\"} state:1) (place \"Knight2\" {\"B8\" \"G8\"}) (place \"Bishop2\" {\"C8\" \"F8\"}) (place \"Queen2\" coord:\"D8\") (place \"King2\" coord:\"E8\" state:1)}) (play (if \"SameTurn\" (move Promote (last To) (piece {\"Queen\" \"Knight\" \"Bishop\" \"Rook\"}) Mover) (priority { (if (!= 0 (count Moves)) (do (or { (forEach Piece \"Queen\" (if (= (phase of:(from)) (phase of:(last To))) (\"QueenMove\"))) (forEach Piece \"Knight\" (if (= (phase of:(from)) (phase of:(last To))) (\"KnightMove\"))) (forEach Piece \"Bishop\" (if (= (phase of:(from)) (phase of:(last To))) (\"BishopMove\"))) (forEach Piece \"King\" (if (= (phase of:(from)) (phase of:(last To))) (\"KingMove\"))) (forEach Piece \"Rook\" (if (= (phase of:(from)) (phase of:(last To))) (\"RookMove\"))) (forEach Piece \"Pawn\" (if (= (phase of:(from)) (phase of:(last To))) (\"PawnMove\"))) (if (\"IsPhaseZero\" (last To)) (if (and { \"KingInTheInitialPlace\" (\"HasNeverMoved\" \"King\") (not (\"IsInCheck\" \"King\" Mover))}) (or (if (and (\"HasNeverMoved\" \"RookLeft\") (can Move (\"DoCastle\" \"RookLeft\" E 3 (is Empty (to))))) \"BigCastling\") (if (and (\"HasNeverMoved\" \"RookRight\") (can Move (\"DoCastle\" \"RookRight\" W 2 (is Empty (to))))) \"SmallCastling\"))))}) ifAfterwards:(not (\"IsInCheck\" \"King\" Mover (forEach Piece))))) (do (or (forEach Piece) (if (and { \"KingInTheInitialPlace\" (\"HasNeverMoved\" \"King\") (not (\"IsInCheck\" \"King\" Mover))}) (or (if (and (\"HasNeverMoved\" \"RookLeft\") (can Move (\"DoCastle\" \"RookLeft\" E 3 (is Empty (to))))) \"BigCastling\") (if (and (\"HasNeverMoved\" \"RookRight\") (can Move (\"DoCastle\" \"RookRight\" W 2 (is Empty (to))))) \"SmallCastling\")))) ifAfterwards:(not (\"IsInCheck\" \"King\" Mover)))}))) (end { (if (and (\"IsInCheck\" \"King\" Next) (\"NextCanNotMove\")) (result Mover Win)) (if (or (no Moves Mover) (= (counter) 100)) (result Mover Draw))}))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game is played on a 7x7 board. -> The game is played on a 9x9 board.\nLook and feel: Black&White -> Look and feel: Garden\n(define \"DroppableFromDirection\" (and ( (= 0 (count Pieces All in:(sites LineOfSight at:(site) #1))) (= 1 (count Pieces in:(sites Around (site) #2)))))) (game \"Centripetal Force\" (players 2) (equipment { (board (square 7)) (piece \"Cross\" P1) (piece \"Disc\" P2) (piece \"Square\" Neutral)}) (rules (start (place \"Square0\" coord:\"D4\")) (play (move Add (to (forEach (sites Empty) if: (and ( (< 0 (count Pieces in:(sites Around (site) Orthogonal))) (or { (\"DroppableFromDirection\" N S) (\"DroppableFromDirection\" S N) (\"DroppableFromDirection\" W E) (\"DroppableFromDirection\" E W)}))))))) (end { (if (is Line 5) (result Mover Win)) (if (no Moves Next) (result All Draw))})))\n\n###\n\n", "completion": "(define \"DroppableFromDirection\" (and ( (= 0 (count Pieces All in:(sites LineOfSight at:(site) #1))) (= 1 (count Pieces in:(sites Around (site) #2)))))) (game \"Centripetal Force\" (players 2) (equipment { (board (square 9)) (piece \"Cross\" P1) (piece \"Disc\" P2) (piece \"Square\" Neutral)}) (rules (start (place \"Square0\" coord:\"E5\")) (play (move Add (to (forEach (sites Empty) if: (and ( (< 0 (count Pieces in:(sites Around (site) Orthogonal))) (or { (\"DroppableFromDirection\" N S) (\"DroppableFromDirection\" S N) (\"DroppableFromDirection\" W E) (\"DroppableFromDirection\" E W)}))))))) (end { (if (is Line 5) (result Mover Win)) (if (no Moves Next) (result All Draw))}))) 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. Two six-sided dice. Play occurs only in two quadrants of the board, opposite one another, a player's pieces only leaving their quadrant to bear off. Two pieces are stacked each on the first three points, and three are stacked in the second three points. Players use throws to unstack pieces on their points, unstacking one piece per die which corresponds to that point. Doubles allow the player to unstack or bear off a number of pieces equal to the total number of the throw. When all of the pieces are unstacked, that player may begin bearing their pieces off. Players move according to the number on each die by moving one piece the value on one die then another piece the value on the other die, or by moving one piece the value of one die and then the value of the other. Once a player has borne off all of their pieces, they must re-enter them onto the points and replicate the starting position. The first player to bear off all their pieces and then place them in the starting position again wins.\n \n\n###\n\n", "completion": "(define \"UnstackHalf\" (forEach Level (last To) (set State at:(last To) level:(level) 1))) (define \"UnstackFull\" (forEach Level (last To) (set State at:(last To) level:(level) 2))) (define \"PieceStacked\" (or (\"PieceFullStacked\" #1) (\"PieceHalfStacked\" #1))) (define \"PieceHalfStacked\" (= (state at:#1) 1)) (define \"PieceFullStacked\" (= (state at:#1) 0)) (define \"PieceUnstacked\" (= (state at:#1) 2)) (define \"BearOff\" (move (from #1) (to (handSite Mover)))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" (pips))) (define \"SiteToSelect\" (\"NextSiteOnTrack\" (- (pips) 1) from:(mapEntry \"StartTrack\" (mover)))) (game \"Tables Rabbatuees\" (players 2) (equipment { (\"BackgammonBoard\" { (track \"Track1\" {0..5} P1 directed:True) (track \"Track2\" {13..18} P2 directed:True)}) (dice d:6 num:2) (piece \"Disc\" Each (forEach Die if:(\"DieNotUsed\") (if (\"IsOffBoard\" \"SiteToMoveOnTrack\") (\"BearOff\" (from)) (move (from) (to \"SiteToMoveOnTrack\"))))) (hand Each) (map \"StartTrack\" {(pair P1 0) (pair P2 13)})}) (rules (start { (place Stack \"Disc1\" (sites {0..2}) count:2) (place Stack \"Disc1\" (sites {3..5}) count:3) (place Stack \"Disc2\" (sites {13..15}) count:2) (place Stack \"Disc2\" (sites {16..18}) count:3)}) phases:{ (phase \"UnStacking\" (play (\"RollEachNewTurnMove\" (if (or (< 0 (var \"Double\")) (all DiceEqual)) (do (if (>= 0 (var \"Double\")) (set Var \"Double\" (count Pips))) next:(forEach Site (sites Occupied by:Mover) (if (\"PieceFullStacked\" (site)) (move Select (from (site)) (then (if (= 3 (size Stack at:(last To))) (\"UnstackHalf\") (\"UnstackFull\")))) (if (\"PieceHalfStacked\" (site)) (move Select (from (site)) (then (\"UnstackFull\"))))) (then (and (if (< 1 (var \"Double\")) (moveAgain)) (set Var \"Double\" (- (var \"Double\") 1)))))) (forEach Die if:(\"DieNotUsed\") (or (if (\"PieceFullStacked\" \"SiteToSelect\") (move Select (from (\"SiteToSelect\")) (then (and (if (= 3 (size Stack at:(last To))) (\"UnstackHalf\") (\"UnstackFull\")) (\"ReplayNotAllDiceUsed\"))))) (if (\"PieceHalfStacked\" \"SiteToSelect\") (move Select (from (\"SiteToSelect\")) (then (and (\"UnstackFull\") (\"ReplayNotAllDiceUsed\")))))))))) (nextPhase Mover (all Sites (sites Occupied by:Mover) if:(not (\"PieceStacked\" (site)))) \"BearingOff\")) (phase \"BearingOff\" (play (\"RollEachNewTurnMove\" (if (or (< 0 (var \"Double\")) (all DiceEqual)) (do (if (>= 0 (var \"Double\")) (set Var \"Double\" (count Pips))) next:(forEach Site (sites Occupied by:Mover) (\"BearOff\" (site)) (then (and (if (< 1 (var \"Double\")) (moveAgain)) (set Var \"Double\" (- (var \"Double\") 1)))))) (forEach Piece top:True)) (then (\"ReplayNotAllDiceUsed\")))) (nextPhase Mover (no Pieces Mover in:(sites Board)) \"Placing\")) (phase \"Placing\" (play (\"RollEachNewTurnMove\" (if (is Occupied (handSite Mover)) (forEach Die if:(\"DieNotUsed\") (if (if (< (pips) 4) (< (size Stack at:\"SiteToSelect\") 2) (< (size Stack at:\"SiteToSelect\") 3)) (move (from (handSite Mover)) (to (\"SiteToSelect\")))) (then (and (\"ReplayNotAllDiceUsed\") (if (!= 0 (state at:(last To))) (set State at:(last To) 0)))))))) (end (if (is Empty (handSite Mover)) (result Mover Win))))})) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayers take turns placing pieces of any colour. They can't create groups of more than five pieces which are adjacent to each other. \n \n A group of 4 pieces is called a quart. A group of 5 pieces is called a quint.\n \n Players win if they finish their turn with a friendly quint, but lose if they finish their turn with a friendly quart on the board.\n \n Note: The winning and losing conditions for a player are checked after their move, only on their own turn.\n \n An end condition (win or loss) is effective when it occurred first and cannot be averted. \n\n###\n\n", "completion": "(game \"Manalath\" (players 2) (equipment { (board (rotate 90 (hex 5))) (piece \"Marker\" Each) (hand Shared size:2)}) (rules (start { (place \"Marker1\" (handSite Shared)) (place \"Marker2\" (handSite Shared 1))}) (play (do (move (from (sites Hand Shared)) (to (sites Empty)) copy:True) ifAfterwards:(< (size Group at:(last To)) 6) (then (forEach Site (sites Occupied by:Mover container:\"Board\") (if (= (size Group at:(site)) 5) (set Var \"Group5\" 1) (if (= (size Group at:(site)) 4) (set Var \"Group4\" 1))))))) (end { (if (= (var \"Group4\") 1) (result Mover Loss)) (if (= (var \"Group5\") 1) (result Mover Win))}))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nPlayed on a size 12 board. -> Played on a size 13 board.\n(game \"Unfair\" (players 2) (equipment { (board (square 12) use:Vertex) (piece \"Ball\" Each)}) (rules (play (or (move Add (to (sites Empty) if:(= (id P1) (mover))) (then (if (= 0 (count MovesThisTurn)) (moveAgain)))) (move Add (to (sites Empty) if:(= (id P2) (mover))) (then (if (< (count MovesThisTurn) 3) (moveAgain)))))) (end { (if (and ((= (id P1) (mover)) (is Line 4 Orthogonal))) (result Mover Win)) (if (and ((= (id P2) (mover)) (is Line 7 Orthogonal))) (result Mover Win))})))\n\n###\n\n", "completion": "(game \"Unfair\" (players 2) (equipment { (board (square 13) use:Vertex) (piece \"Ball\" Each)}) (rules (play (or (move Add (to (sites Empty) if:(= (id P1) (mover))) (then (if (= 0 (count MovesThisTurn)) (moveAgain)))) (move Add (to (sites Empty) if:(= (id P2) (mover))) (then (if (< (count MovesThisTurn) 3) (moveAgain)))))) (end { (if (and ((= (id P1) (mover)) (is Line 4 Orthogonal))) (result Mover Win)) (if (and ((= (id P2) (mover)) (is Line 7 Orthogonal))) (result Mover Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayers take turns moving a piece of their colour as follows:\n \n 1. A piece on a vertex can move either:\n \n 1a. To an adjacent empty vertex. The edge it travels over may be empty or occupied (if occupied by an enemy piece, that piece is captured and removed).\n \n 1b. To an empty cell that vertex is part of.\n \n 2. A piece on an edge can move either:\n \n 2a. To a connected empty edge. The vertex it travels over may be empty or occupied (if occupied by an enemy piece, that piece is captured and removed).\n \n 2b. To an empty cell that edge is part of.\n \n 3. A piece in a cell can move either:\n \n 3a. To a neighbouring empty cell which may be connected by an edge or a vertex. The connecting edge or vertex that the piece travels over may be empty or occupied (if occupied by an enemy piece, that piece is captured and removed).\n \n 3b. To step over one of its empty edges into an adjacent cell containing an enemy piece (which is captured), then step out over a different empty edge to another empty cell.\n \n 3c. To an empty vertex or edge belonging to that cell.\n \n Aim: A player wins if their opponent is reduced to a single piece. An empty edge has no piece on its midpoint. An empty cell has no piece on its centroid.\n \n Three Player Version:\n In the three player version, any player reduced to a single piece is removed from the game (along with their piece). Last remaining player wins. The game is played with 2 players.\n\n###\n\n", "completion": "(define \"RemoveLastPiece\" (and { (\"RemovePlayerLastPiece\" P1) (\"RemovePlayerLastPiece\" P2) (\"RemovePlayerLastPiece\" P3)})) (define \"RemovePlayerLastPiece\" (if (= 1 (\"CountPiecesAllSiteTypes\" #1)) (and { (\"RemoveSiteTypeOccupiedPiece\" #1 Vertex) (\"RemoveSiteTypeOccupiedPiece\" #1 Cell) (\"RemoveSiteTypeOccupiedPiece\" #1 Edge)}))) (define \"CountPiecesAllSiteTypes\" (+ { (count Pieces Vertex #1) (count Pieces Edge #1) (count Pieces Cell #1)})) (define \"RemoveSiteTypeOccupiedPiece\" (forEach Site (sites Occupied by:#1 container:\"Board\" on:#2) (remove #2 (site)))) (define \"MoveCellToVertex\" (move (from Cell) (to Vertex (intersection (sites Empty Vertex) (sites Incident Vertex of:Cell at:(from)))))) (define \"MoveCellToEdge\" (move (from Cell) (to Edge (intersection (sites Empty Edge) (sites Incident Edge of:Cell at:(from)))))) (define \"MoveCellToEmptyCellOverVertex\" (move (from Cell) (to Cell (forEach (sites Empty Cell) if:(= 1 (count Sites in:(intersection (sites Incident Vertex of:Cell at:(from)) (sites Incident Vertex of:Cell at:(site))))))) (then (forEach Site (intersection (sites Incident Vertex of:Cell at:(last From)) (sites Incident Vertex of:Cell at:(last To))) (if (is Enemy (who Vertex at:(site))) (remove Vertex (site))))))) (define \"MoveCellToEnemyCellOverEmptyEdge\" (move (from Cell) (to Cell (sites Incident Cell of:Cell at:(from)) if:(and (is Enemy (who Cell at:(to))) (= 1 (count Sites in:(intersection { (sites Empty Edge) (sites Incident Edge of:Cell at:(from)) (sites Incident Edge of:Cell at:(to))})))) (apply (remove Cell (to)))) (then (moveAgain)))) (define \"MoveCellToEmptyCellOverEdge\" (move (from Cell) (to Cell (intersection (sites Empty Cell) (sites Incident Cell of:Cell at:(from)))) (then (forEach Site (intersection (sites Incident Edge of:Cell at:(last From)) (sites Incident Edge of:Cell at:(last To))) (if (is Enemy (who Edge at:(site))) (remove Edge (site))))))) (define \"MoveEdgetoCell\" (move (from Edge) (to Cell (intersection (sites Empty Cell) (sites Incident Cell of:Edge at:(from)))))) (define \"MoveEdgetoEdge\" (move Step (from Edge) (to if:(is Empty Edge (to))) (then (forEach Site (intersection (sites Incident Vertex of:Edge at:(last From)) (sites Incident Vertex of:Edge at:(last To))) (if (is Enemy (who Vertex at:(site))) (remove Vertex (site))))))) (define \"MoveLastCellToEmptyCellOverEmptyEdge\" (move (from Cell (last To)) (to Cell (intersection (sites Empty Cell) (sites Incident Cell of:Cell at:(from))) if:(and (= 1 (count Sites in:(intersection { (sites Empty Edge) (sites Incident Edge of:Cell at:(from)) (sites Incident Edge of:Cell at:(to))}))) (!= (last From) (to)))))) (define \"MoveVertexToCell\" (move (from Vertex) (to Cell (intersection (sites Empty Cell) (sites Incident Cell of:Vertex at:(from)))))) (define \"MoveVertexToVertex\" (move Step (from Vertex) (to if:(is Empty Vertex (to))) (then (forEach Site (intersection (sites Incident Edge of:Vertex at:(last From)) (sites Incident Edge of:Vertex at:(last To))) (if (is Enemy (who Edge at:(site))) (remove Edge (site))))))) (game \"Triple Tangle\" (players 2) (equipment { (board (tiling T3464 1) use:Vertex) (piece \"Disc\" Each)}) (rules (start { (place \"Disc1\" (sites {4 5 0 1})) (place \"Disc1\" Cell 1) (place \"Disc1\" Edge (sites {0 3 4 9})) (place \"Disc2\" (sites {16 17 12 13})) (place \"Disc2\" Cell 11) (place \"Disc2\" Edge (sites {25 29 26 20}))}) (play (if (\"SameTurn\") (\"MoveLastCellToEmptyCellOverEmptyEdge\") (or { (forEach Piece on:Vertex (or (\"MoveVertexToVertex\") (\"MoveVertexToCell\"))) (forEach Piece on:Edge (or (\"MoveEdgetoEdge\") (\"MoveEdgetoCell\"))) (forEach Piece on:Cell (or { (\"MoveCellToEmptyCellOverEdge\") (\"MoveCellToEnemyCellOverEmptyEdge\") (\"MoveCellToEmptyCellOverVertex\") (\"MoveCellToEdge\") (\"MoveCellToVertex\")}))}))) (end (if (>= 1 (\"CountPiecesAllSiteTypes\" Next)) (result Mover Win))))) 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 Ludii game based on the following description\nPlayers take turns placing their pieces on a space on the board, with the goal of connecting all three sides of the triangle with their pieces. Corners count as belonging to both sides they touch. \n\n###\n\n", "completion": "(game \"Y (Hex)\" (players 2) (equipment { (board (tri Hexagon 7) use:Vertex) (piece \"Marker\" Each) (regions \"SSW\" {(sites Side S) (sites Side SW)}) (regions \"NNW\" {(sites Side NW) (sites Side N)}) (regions \"NESE\" {(sites Side NE) (sites Side SE)})}) (rules (play (move Add (to (sites Empty)))) (end (if (is Connected { (sites \"SSW\") (sites \"NNW\") (sites \"NESE\")}) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n4x20-25 board. Player on two teams of two players. Each team has a number of pieces which are equal to the number of holes in one of the rows. Pieces baring in the outer rows of the board. Eight sticks used as dice, painted red on one side. The throws are as follows: All sides of one color = 8; seven of one color = 1; six of one color = 6; five of one color = 5; four of one color= 4. Throws of 4 and 1 allow the player another throw. Pieces are moved after the throws are made. Each throw must be used to move a piece; the value of a throw cannot be subdivided between pieces. Pieces move from left to right in the team's home row, the right to left in the second row, left to right in the third row, and then right to left in the opposing team's home row. Pieces may not move past other pieces belonging to the team, but may move past the opponent's pieces. Then a piece lands in a spot occupied by a piece belonging to the opposing team, the opposing team's piece is captured. Once a player places their pieces in the opponent's home row, they cannot be taken. The team continue until all of the pieces are in the opponents' home rows, and the team with the most remaining pieces wins. Each row has 20 holes.\n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (count Sites in:(sites Occupied by:#1))) (define \"AllPiecesInOpponentHome\" (and (= 0 (count Sites in:(difference (sites Occupied by:Team1) (sites P2 \"Home\")))) (= 0 (count Sites in:(difference (sites Occupied by:Team2) (sites P1 \"Home\")))))) (define \"Move\" (move (from (site)) (to (\"NextSiteOnTrack\" \"ThrowValue\") if:(and (or (is Empty (to)) (and (not (is In (to) (sites Next \"Home\"))) (\"IsEnemyAt\" (to)))) (\"NoFriendPieceInBetween\" #1)) \"CaptureEnemyPiece\"))) (define \"NoFriendPieceInBetween\" (= 1 (count Sites in:(intersection (sites Occupied by:#1) (sites Track Mover \"Track\" from:(from) to:(\"NextSiteOnTrack\" \"ThrowValue\")))))) (define \"CaptureEnemyPiece\" (apply if:(\"IsEnemyAt\" (to)) (remove (to)))) (define \"SpecialThrows\" (is In (\"ThrowValue\") (sites {1 4}))) (define \"ThrowValue\" (mapEntry (count Pips))) (game \"Sig (Western Sahara)\" (players 4) (equipment { (board (rectangle 4 20) { (track \"Track1\" \"0,E,N1,W,N1,E,N1,W\" P1 directed:True) (track \"Track2\" \"79,W,S1,E,S1,W,S1,E\" P2 directed:True) (track \"Track3\" \"0,E,N1,W,N1,E,N1,W\" P3 directed:True) (track \"Track4\" \"79,W,S1,E,S1,W,S1,E\" P4 directed:True)} use:Vertex) (piece \"Stick\" Each) (regions \"AllSites\" (sites Board)) (\"StickDice\" 8) (map \"Throw\" {(pair 0 8) (pair 1 1) (pair 2 6) (pair 3 5) (pair 4 4) (pair 5 5) (pair 6 6) (pair 7 1) (pair 8 8)}) (regions \"Home\" P1 (sites Bottom)) (regions \"Home\" P2 (sites Top)) (regions \"Home\" P3 (sites Bottom)) (regions \"Home\" P4 (sites Top))}) (rules (start { (set Team 1 {P1 P3}) (set Team 2 {P2 P4}) (place \"Stick1\" (sites Bottom)) (place \"Stick2\" (sites Top))}) (play (\"RollMove\" (if (or (is Mover P1) (is Mover P3)) (forEach Site (sites Occupied by:Team1) (\"Move\" Team1)) (forEach Site (sites Occupied by:Team2) (\"Move\" Team2))) (then (if (\"SpecialThrows\") (moveAgain))))) (end (if (\"AllPiecesInOpponentHome\") { (if (= (\"PiecesOwnedBy\" Team1) (\"PiecesOwnedBy\" Team2)) (result Mover Draw)) (if (< (\"PiecesOwnedBy\" Team1) (\"PiecesOwnedBy\" Team2)) (result Team2 Win)) (if (> (\"PiecesOwnedBy\" Team1) (\"PiecesOwnedBy\" Team2)) (result Team1 Win))})))) END" }, { "prompt": "Construct a Ludii game based on the following description\n5x5 board. Players begin by placing their pieces in prescribed spaces, and then alternating two-by-two in places as they see fit, except for the central space. Once all the spaces except the central one are filled, the first player moves a piece one space orthogonally to the empty space. Pieces are captured by surrounding them on either side by a player's own pieces. The player to capture all of the opponent's pieces wins. The game is played on a 5x5 board.\n\n###\n\n", "completion": "(game \"Seega\" (players 2) (equipment { (board (square 5)) (hand Each) (piece \"Marker\" Each (\"StepToEmpty\" Orthogonal (then (\"CustodialCapture\" Orthogonal (max 1)))))}) (rules (start (place \"Marker\" \"Hand\" count:12)) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (difference (sites Empty) (centrePoint))) (then (if (\"NewTurn\") (moveAgain))))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (\"PhaseMovePiece\" \"Movement\")} (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPortes, Plakoto, and Fevga are played in succession. One point is awarded to the winner of each game, two points if the opponent hasn't moved pieces out of their starting quadrant. It is typically played to five or seven points. \n\n###\n\n", "completion": "(games { (subgame \"Portes\" next:1 result:(score Mover)) (subgame \"Plakoto\" next:2 result:(score Mover)) (subgame \"Fevga\" next:0 result:(score Mover))}) 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(define \"EatTopLeftCorner\" (is In (last To) (intersection (sites Top) (sites Left)))) (define \"EatChocolate\" (move Remove (sites Occupied by:Shared) (then (\"EatBottomRight\")))) (define \"EatBottomRight\" (forEach Site (sites Occupied by:Shared) (if (and (>= (row of:(last To)) (row of:(site))) (<= (column of:(last To)) (column of:(site)))) (remove (site))))) (game \"Chomp\" (players 2) (equipment { (board (rectangle 1 2)) (piece \"Chocolate\" Shared)}) (rules (start (place \"Chocolate\" (sites Board))) (play (\"EatChocolate\")) (end (if (\"EatTopLeftCorner\") (result Mover Loss)))))\n\n###\n\n", "completion": "(define \"EatTopLeftCorner\" (is In (last To) (intersection (sites Top) (sites Left)))) (define \"EatChocolate\" (move Remove (sites Occupied by:Shared) (then (\"EatBottomRight\")))) (define \"EatBottomRight\" (forEach Site (sites Occupied by:Shared) (if (and (>= (row of:(last To)) (row of:(site))) (<= (column of:(last To)) (column of:(site)))) (remove (site))))) (game \"Chomp\" (players 2) (equipment { (board (rectangle 2 3)) (piece \"Chocolate\" Shared)}) (rules (start (place \"Chocolate\" (sites Board))) (play (\"EatChocolate\")) (end (if (\"EatTopLeftCorner\") (result Mover Loss))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n4x5 board. Five counters per hole. Players can sow from any hole. Sowing occurs orthogonally in any direction, and a player can change direction orthogonally at any point in the move, but can never double back. When the last counter falls into a hole, sowing continues if there are counters in the following holes; these are picked up and sowing continues from there. The hole from which the sowing continues will always be the next one in the opposite direction from the penultimate hole in which a counter was dropped. Therefore, if the sowing ends when a sowing hits an edge or corner, sowing does not continue. When the hole after the end of a sowing is empty, the counters in the next hole following it are captured, but captures cannot be made when the final counter falls into a hole from which a new direction must be chosen. Captures cannot be made from the central two holes of the board. The player who captures the most counters wins.\n \n\n###\n\n", "completion": "(define \"SowAgainMove\" (move Select (from (last To)) (to (difference (sites Around (last To)) (\"SitesSowed\"))) (then (and (add (piece (id \"Seed\" Shared)) (to (last To))) (if (< 1 (var \"NumToSow\")) (and { (set Var \"NumToSow\" (- (var \"NumToSow\") 1)) (moveAgain) (remember Value \"SowedSites\" (last From))}) (and { (forget Value \"SowedSites\" All) (set Var \"NumToSow\" 0) (if (\"NextSiteExist\" 1) (if (is Occupied (\"NextSite\" 1)) (moveAgain) (if (\"NextSiteExist\" 2) (if (is Occupied (\"NextSite\" 2)) (and (fromTo (from (\"NextSite\" 2)) (to (handSite Mover)) count:(count at:(\"NextSite\" 2))) (if (and (\"NextSiteExist\" 3) (\"NextSiteExist\" 4)) (if (and (is Occupied (\"NextSite\" 4)) (is Empty (\"NextSite\" 3))) (fromTo (from (\"NextSite\" 4)) (to (handSite Mover)) count:(count at:(\"NextSite\" 4))))))))))})))))) (define \"NextSite\" (ahead (last To) steps:#1 (\"LastDirection\" Vertex))) (define \"NextSiteExist\" (!= (last To) (\"NextSite\" #1))) (define \"SitesSowed\" (sites (values Remembered \"SowedSites\"))) (define \"PiecesOwnedBy\" (count Cell at:(handSite #1))) (define \"Columns\" 5) (game \"Dongjintian (Four Players)\" (players 4) (equipment { (mancalaBoard 4 \"Columns\" store:None) (piece \"Seed\" Shared) (hand Each) (regions \"ProtectingHoles\" (sites {7 12}))}) (rules (start (set Count 5 to:(sites Board))) (play (if (and (\"SameTurn\") (!= 0 (var \"NumToSow\"))) (if (can Move (\"SowAgainMove\")) (\"SowAgainMove\") (do (and { (add (piece (id \"Seed\" Shared)) (to (last To)) count:(var \"NumToSow\")) (forget Value \"SowedSites\" All) (set Var \"NumToSow\" 0)}) next:(move Pass))) (if (\"SameTurn\") (move (from (\"NextSite\" 1)) (to (sites Around (from))) (then (and { (if (is Occupied (last From)) (and { (moveAgain) (set Var \"NumToSow\" (count at:(last From))) (remember Value \"SowedSites\" (last From))}) (if (\"NextSiteExist\" 1) (if (is Occupied (\"NextSite\" 1)) (moveAgain) (if (\"NextSiteExist\" 2) (if (is Occupied (\"NextSite\" 2)) (and (fromTo (from (\"NextSite\" 2)) (to (handSite Mover)) count:(count at:(\"NextSite\" 2))) (if (and (\"NextSiteExist\" 3) (\"NextSiteExist\" 4)) (if (and (is Occupied (\"NextSite\" 4)) (is Empty (\"NextSite\" 3))) (fromTo (from (\"NextSite\" 4)) (to (handSite Mover)) count:(count at:(\"NextSite\" 4))))))))))) (remove (last From) count:(count at:(last From)))}))) (move (from (sites Board) if:(is Occupied (from))) (to (sites Around (from))) (then (and { (if (is Occupied (last From)) (and { (moveAgain) (set Var \"NumToSow\" (count at:(last From))) (remember Value \"SowedSites\" (last From))}) (if (\"NextSiteExist\" 1) (if (is Occupied (\"NextSite\" 1)) (moveAgain) (if (\"NextSiteExist\" 2) (if (is Occupied (\"NextSite\" 2)) (and (fromTo (from (\"NextSite\" 2)) (to (handSite Mover)) count:(count at:(\"NextSite\" 2))) (if (and (\"NextSiteExist\" 3) (\"NextSiteExist\" 4)) (if (and (is Occupied (\"NextSite\" 4)) (is Empty (\"NextSite\" 3))) (fromTo (from (\"NextSite\" 4)) (to (handSite Mover)) count:(count at:(\"NextSite\" 4))))))))))) (remove (last From) count:(count at:(last From)))})))))) (end (if (<= (count Pieces All in:(sites Board)) 1) (byScore { (score P1 (\"PiecesOwnedBy\" P1)) (score P2 (\"PiecesOwnedBy\" P2)) (score P3 (\"PiecesOwnedBy\" P3)) (score P4 (\"PiecesOwnedBy\" P4))}))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayed on cross-shaped board, made of five squares, each divided into four squares and with the diagonals of the larger squares drawn. One player plays with one larger piece, the Oke-mow, placed on the central point, and the other player with thirteen pieces situated on every point of one arm of the cross and along the line immediately perpendicular to that arm. Pieces move along the lines to an adjacent empty spot. The Oke-mow may jump over an adjacent piece to capture it. Multiple captures are allowed. The Oke-mow wins if it can capture all the opponent's pieces, the other player wins by blocking the Oke-mow from moving.\n \n\n###\n\n", "completion": "(game \"Musinaykahwhanmetowaywin\" (players 2) (equipment { (\"CrossBoard\" 3 7 use:Vertex diagonals:Alternating) (piece \"Marker\" P1 (or (\"HopSequenceCapture\") (\"StepToEmpty\"))) (piece \"Disc\" P2 (\"StepToEmpty\"))}) (rules (start { (place \"Disc2\" (union (expand (sites Bottom)) (sites Row 2))) (place \"Marker1\" (centrePoint))}) (play (if \"SameTurn\" (or (\"HopSequenceCaptureAgain\") (move Pass)) (forEach Piece))) (end (\"NoMovesP1NoPiecesP2\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\n3x3 intersecting lines, with diagonals. Three pieces per player. Players alternate turns placing pieces on the board. Once all of the pieces have been placed, the players alternate turns moving a piece to an empty adjacent spot on the board. The first player to place their pieces in a row along one of the lines wins. \n\n###\n\n", "completion": "(game \"Engijn Zirge\" (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": "Describe the mechanics of the following Ludii game\n(define \"RemmemberOwnedHoles\" (if (is Mover P1) (remember Value \"OwnedP1\" #1) (remember Value \"OwnedP2\" #1))) (define \"LeftMostEmpty\" (trackSite FirstSite from:(mapEntry \"LeftMost\" Mover) if:(is Empty (to)))) (define \"NoPiecesInP1Side\" (all Sites (sites P1) if:(= 0 (count at:(site))))) (define \"NoOwnedHoles\" (if (= #1 P1) (= 0 (size Array (values Remembered \"OwnedP1\"))) (= 0 (size Array (values Remembered \"OwnedP2\"))))) (define \"ForgetValue\" (if (is Mover P1) (forget Value \"OwnedP1\" #1) (forget Value \"OwnedP2\" #1))) (define \"OneRowIsEmpty\" (or (all Sites (sites P1) if:(= 0 (count at:(site)))) (all Sites (sites P2) if:(= 0 (count at:(site)))))) (define \"OwnedHoles\" (if (is Mover P1) (sites (values Remembered \"OwnedP1\")) (sites (values Remembered \"OwnedP2\")))) (define \"PlayFromNextHole\" (sites {(\"NextHoleFrom\" (last To afterConsequence:True) 1)})) (define \"NextHoleFrom\" (\"NextSiteOnTrack\" #2 from:#1)) (game \"Gabata (Adegrat)\" (players 2) (equipment { (mancalaBoard 2 6 store:None (track \"Track\" \"0,E,N,W\" loop:True)) (piece \"Seed\" Shared) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (hand Each) (map \"LeftMost\" {(pair P1 0) (pair P2 11)})}) (rules (start { (set Count 3 to:(sites Track)) (set RememberValue \"OwnedP1\" (sites Bottom)) (set RememberValue \"OwnedP2\" (sites Top))}) phases:{ (phase \"Sowing\" (play (or { (move Select (from (if (\"SameTurn\") \"PlayFromNextHole\" (\"OwnedHoles\")) if:(> (count at:(from)) 0)) (then (sow apply:(if (> (count at:(to)) 1) (if (>= (count at:(\"NextHoleFrom\" (to) 1)) 1) (moveAgain)) (if (>= (count at:(\"NextHoleFrom\" (to) 1)) 1) (fromTo (from (\"NextHoleFrom\" (to) 1)) (to (handSite Mover)) count:(count at:(\"NextHoleFrom\" (to) 1))))))))} (then (if (\"OneRowIsEmpty\") (and { (if (\"NoPiecesInP1Side\") (forEach Site (sites Board) (if (< 0 (count at:(site))) (fromTo (from (site)) (to (handSite P2)) count:(count at:(site))))) (forEach Site (sites Board) (if (< 0 (count at:(site))) (fromTo (from (site)) (to (handSite P1)) 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 (\"LeftMostEmpty\")) count:3 (then (\"RemmemberOwnedHoles\" (last To)))))) (nextPhase (all Passed) \"Sowing\"))}))\n\n###\n\n", "completion": "2x6 board. Three counters in each hole. Sowing occurs in an anti-clockwise direction. When the final counter falls into an occupied hole, the player picks up the counters in the next hole and continues sowing from it. If that next hole is empty, the turn ends. If the final counter falls into an empty hole, the contents of the following hole are captured. Play continues until one player can no longer play because there are no counters left on their side. The opponent then takes the remainder of the counters on the board. For the next round, each player counts out the counters they captured, placing three each of the holes in their row. For every three in excess of the amount required to fill all of the holes in a row, the player claims one hole from the opponent's row. Play continues in this fashion until one player captures all of the holes on the board. END" }, { "prompt": "Construct a Ludii game based on the following description\n5x5 intersecting lines, forming a grid Diagonals in each quadrant. A triangular appendage, the apex being the midpoint of one of the sides of the grid. A line from the apex to the midpoint of the base, and a line bisecting this line and intersecting with the midpoints of the two sides of the triangle. There are fourteen \\ The objective of the player 1 is to capture all the dogs.\n\n###\n\n", "completion": "(game \"Adugo\" (players 2) (equipment { (\"AlquerqueBoardWithBottomTriangle\") (piece \"Jaguar\" P1 (or \"HopCapture\" \"StepToEmpty\")) (piece \"Dog\" P2 \"StepToEmpty\")}) (rules (start { (place \"Dog2\" (difference (expand (sites Top) steps:2) (sites {\"C5\"}))) (place \"Jaguar1\" coord:\"C5\")}) (play (forEach Piece)) (end (\"NoMovesLossAndLessNumPiecesPlayerLoss\" P2 0)))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6 board with two stores. Four counters in each hole. Sowing occurs in a clockwise direction. When the final counter of a sowing lands in an occupied hole, these are picked up and sowing continues. When the final counter lands in an empty hole in the player's own row, the contents of the hole opposite it in the opponent's row are captured. If the final counter lands in an empty hole in the opponent's row, the opponent captures the counters in the hole opposite it in the player's row. The player who captures the most counters wins. \n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (+ (count at:(mapEntry #1)) (count in:(sites #1)))) (define \"Columns\" 6) (game \"Yovodi\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" (track \"Track\" \"6,W,N,E\" 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\") (\"LastHoleSowed\") (sites Mover)) if:(< 0 (count at:(from)))) (then (sow apply:(if (> (count at:(to)) 1) (moveAgain) (if (is In (to) (sites Mover)) (fromTo (from (\"OppositePitTwoRows\" (to))) (to (mapEntry (mover))) count:(count at:(\"OppositePitTwoRows\" (to)))) (fromTo (from (\"OppositePitTwoRows\" (to))) (to (mapEntry (next))) count:(count at:(\"OppositePitTwoRows\" (to)))))))))) (end (\"MancalaByScoreWhen\" (no Moves Mover))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nOpen anywhere. -> White's second move must be 3 points away from the centre.\n(define \"Custodial\" (custodial (from (last To)) All (between if:(is Next (who at:(between))) (apply (remove (between)))) (to if:(and (= 3 (count Steps Vertex All (last To) (to))) (is Mover (who at:(to))))) (then (addScore Mover 1)))) (game \"Pente\" (players 2) (equipment { (board (square 19) use:Vertex) (piece \"Ball\" Each)}) (rules (start (set Score Each 0)) (play (move Add (to (sites Empty)))) (end { (if (is Line 5 All) (result Mover Win)) (if (> (score Mover) 9) (result Mover Win))})))\n\n###\n\n", "completion": "(define \"Custodial\" (custodial (from (last To)) All (between if:(is Next (who at:(between))) (apply (remove (between)))) (to if:(and (= 3 (count Steps Vertex All (last To) (to))) (is Mover (who at:(to))))) (then (addScore Mover 1)))) (game \"Pente\" (players 2) (equipment { (board (square 19) use:Vertex) (piece \"Ball\" Each)}) (rules (start (set Score Each 0)) phases:{ (phase \"First Move\" (play (move Add (to (sites \"J10\")))) (nextPhase \"Second Move\")) (phase \"Second Move\" (play (move Add (to (sites Empty)))) (nextPhase \"Third Move\")) (phase \"Third Move\" (play (move Add (to (intersection (sites Empty) (sites Distance All from:(coord \"J10\") (range 3 15)))))) (nextPhase \"General\")) (phase \"General\" (play (move Add (to (sites Empty)))))} (end { (if (is Line 5 All) (result Mover Win)) (if (> (score Mover) 9) (result Mover Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe board graph is initially coloured with a neutral colour. Players take turns removing colour from a coloured edge. The game is won by the player who removes the last cycle from the coloured graph. The game is played on the Graph1.\n\n###\n\n", "completion": "(game \"Nedilmarth\" (players 2) (equipment { (board (merge (scale 0.707 (concentric {1 8})) (shift -.5 -.5 (square 2))) use:Edge) (piece \"Marker\" Neutral)}) (rules (start { (set Neutral Edge (sites Board Edge))}) (play (move Remove (sites Occupied by:Neutral on:Edge))) (end (if (is Tree Neutral) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nCounters are placed in piles: two rows of four piles. Six counters in each pile. A player sows from any of the piles in the player's row in an anti-clockwise direction. Any pile which contains 2, 4, or 6 counters is captured. The player with the most counters captured wins. \n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (count Cell at:(handSite #1))) (game \"Wore\" (players 2) (equipment { (mancalaBoard 2 4 store:None (track \"Track\" \"0,E,N,W\" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 6 to:(sites Track))) (play (move Select (from (sites Mover) if:(< 0 (count at:(from)))) (then (sow if:(or { (= (count at:(to)) 2) (= (count at:(to)) 4) (= (count at:(to)) 6)}) apply:(fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))))))) (end (\"MancalaByScoreWhen\" (no Moves Mover))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nGlinski Chess is played on a hexagonal board with each side having length 6, and each space oriented horizontally. The board has 91 spaces.\n \n Piece Movement:\n * Kings can move one space in any of the 12 directions from the current space. There is no castling.\n * Rooks can slide in any of the six 'adjacent' directions from their current space---North, South, or 60 degrees off either of those.\n * Bishops can slide in the six 'diagonal' directions: West, East, or 30 degrees off due North or 30 degrees off due South. Note that, given the 3-colour colouring of the board, each of the three Bishops remains on the same colour that it started the game on.\n * Queens can make any move that would be available to a Rook or a Bishop on the current space.\n * Knights can leap to any space that is two spaces away in an adjacent direction (North, South, or 60 degrees off either of those), plus one more space 60 degrees off of that direction. Note that a Knight always moves to a space of a different colour than the space it moved from.\n * Pawns can advance one space forward without capturing. They capture by moving to one of the two adjacent spaces 60 degrees left or right of forward. A Pawn on a Pawn start space can advance two spaces forward without capturing, even if it has previously moved (by capturing) to a different Pawn start space than it started the game on. A Pawn can capture an opponent Pawn 'en passant' if the opponent Pawn just advanced two spaces on its previous turn, and the capture direction of the current player's Pawn lands it on the space that the opponent Pawn just skipped over. On reaching the farthest rank in a given file, Pawns are promoted to a Queen, Rook, Bishop, or Knight, as the player chooses.\n \n The game ends on a checkmate or stalemate. By convention, the player that causes the stalemate is awarded 3/4 of a point, while the other player is awarded 1/4 of a point.\n \n Variations: Shift the innermost 3 or 5 Pawns toward the edge of the board by one space, as proposed in A Player's Guide to Table Games, by John Jackson, Stackpole Books, 1975. Pawns in the starting position chosen by W\u0142adys\u0142aw Gli\u0144ski in 1936\n\n###\n\n", "completion": "(define \"PromoteTo\" (move Promote (last To) #1 Mover)) (define \"IsEnPassantCapture\" (and (is Pending) (= (to) (value Pending)))) (define \"EnPassant_Ortho\" (\"EnPassant_Base\" (\"Directions\" {WNW ENE} {WSW ESE}))) (define \"EnPassant_Base\" (move Step #1 (to if:\"IsEnPassantCapture\") (then (remove (var))))) (define \"PawnStep_To\" (\"StepToEnemy\" #1)) (define \"PawnStep_Double\" (\"PawnHop\" Forward Backward)) (define \"PawnCapture_Ortho\" (\"PawnStep_To\" (\"Directions\" {WNW ENE} {WSW ESE}))) (define \"PawnHop\" (move Hop #1 (between if:(is In (between) (sites Empty))) (to if:\"IsToEmpty\") (then (and { (set Pending (ahead (last To) #2)) (set Var (last To))})))) (define \"IsFromInStartCell\" (is In (from) (sites Start (piece (what at:(from)))))) (define \"KingCaptureStep\" (move Step #1 (to if:\"IsToEmptyOrEnemy\" \"CaptureToPieceAndResetCounter\") #2)) (define \"SlideCaptureMove\" (move Slide #1 (to if:(\"IsEnemyAt\" (to)) \"CaptureToPieceAndResetCounter\") #2)) (define \"P12\" (if (is Mover P1) #1 #2)) (define \"IsToEmptyOrEnemy\" (or \"IsToEmpty\" (\"IsEnemyAt\" (to)))) (define \"IsToEmpty\" (is In (to) (sites Empty))) (define \"Directions\" (\"P12\" (directions #1) (directions #2))) (define \"CaptureToPieceAndResetCounter\" (apply (if (\"IsEnemyAt\" (to)) (remove (to) (then (set Counter)))))) (game \"Glinski Chess\" (\"TwoPlayersNorthSouth\") (equipment { (board (rotate 90 (hex 6))) (piece \"King\" Each (\"KingCaptureStep\" All ~)) (piece \"Queen\" Each (\"SlideCaptureMove\" All ~)) (piece \"Rook\" Each (\"SlideCaptureMove\" Orthogonal ~)) (piece \"Bishop\" Each (\"SlideCaptureMove\" Diagonal ~)) (piece \"Knight\" Each (move Leap \"KnightWalk\" (to if:\"IsToEmptyOrEnemy\" \"CaptureToPieceAndResetCounter\"))) (piece \"Pawn\" Each (or { \"StepForwardToEmpty\" (if \"IsFromInStartCell\" \"PawnStep_Double\") \"PawnCapture_Ortho\" \"EnPassant_Ortho\"} (then (and (if (is In (last To) (sites Mover \"PromotionZone\")) (moveAgain)) (set Counter))))) (regions \"PromotionZone\" P1 (union (sites Side NW) (sites Side NE))) (regions \"PromotionZone\" P2 (union (sites Side SW) (sites Side SE))) (regions \"Region-Dark\" (sites Phase 0)) (regions \"Region-Light\" (sites Phase 2)) (regions \"Region-Medium\" (sites Phase 1))}) (rules (start { (place \"King1\" coord:\"B1\") (place \"Queen1\" coord:\"A2\") (place \"Rook1\" {\"A4\" \"D1\"}) (place \"Bishop1\" {\"A1\" \"B2\" \"C3\"}) (place \"Knight1\" {\"A3\" \"C1\"}) (place \"King2\" coord:\"K10\") (place \"Queen2\" coord:\"J11\") (place \"Rook2\" {\"H11\" \"K8\"}) (place \"Bishop2\" {\"K11\" \"J10\" \"I9\"}) (place \"Knight2\" {\"I11\" \"K9\"}) (place \"Pawn1\" {\"A5\" \"B5\" \"C5\" \"D5\" \"E5\" \"E4\" \"E3\" \"E2\" \"E1\"}) (place \"Pawn2\" {\"G11\" \"G10\" \"G9\" \"G8\" \"G7\" \"H7\" \"I7\" \"J7\" \"K7\"})}) phases:{ (phase \"Movement\" (play (if (\"SameTurn\") (\"PromoteTo\" (piece {\"Queen\" \"Rook\" \"Bishop\" \"Knight\"})) (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King\" Mover))))) (end { (\"Checkmate\" \"King\") (if (or (no Moves Mover) (= (counter) 100)) (result Mover Draw))}))})) END" }, { "prompt": "Construct a Ludii game based on the following description\n8x8 checkered board. Pieces move according to specialized moves, as follows: Piyatha (x8): can move one space forward, and one space forward diagonally to capture. When they reach the final rank, they may be promoted to the piece belonging to that rank, as long as it has already been captured by the opponent; Rukh (castle), (x2): can move any number of spaces orthogonally; Fil (elephant), (x2): can move any number of spaces diagonally; Ghoda (horse), (2): moves in any direction, one space orthogonally with one space forward diagonally; Farthir (x1): can move any number of spaces orthogonally or diagonally; Shah (x1): can move one space orthogonally or diagonally, and can also move like the horse if it has not yet been checked. The pieces are arranged as in Chess. Players capture pieces by moving onto a space occupied by an opponent's piece. When a player can capture the opponent's Shah on the next turn, the Shah is in Check, the opponent's next move must free the Shah from Check. If the opponent cannot, it is Checkmate and the player wins. Stalemate is allowed.\n \n\n###\n\n", "completion": "(define \"PromotedPiece\" (if (and (is In (last To) (sites Corners)) (< (count Sites in:(sites Occupied by:Mover component:\"Castle\")) 2)) (promote (last To) (piece (id \"Castle\" Mover))) (if (and (or (= (column of:(last To)) 1) (= (column of:(last To)) 6)) (< (count Sites in:(sites Occupied by:Mover component:\"Horse\")) 2)) (promote (last To) (piece (id \"Horse\" Mover))) (if (and (or (= (column of:(last To)) 2) (= (column of:(last To)) 5)) (< (count Sites in:(sites Occupied by:Mover component:\"Elephant\")) 2)) (promote (last To) (piece (id \"Elephant\" Mover))) (if (and (= (column of:(last To)) 3) (< (count Sites in:(sites Occupied by:Mover component:\"Queen\")) 1)) (promote (last To) (piece (id \"Queen\" Mover)))))))) (define \"KingNotCheckedAndToEmpty\" (and (is Empty (to)) (not (\"IsInCheck\" \"King_noCross\" Mover at:(to))))) (game \"Shatren\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (\"ChessPawn\" \"Pawn\" ~ (then (if (is In (last To) (sites Mover \"Promotion\")) (\"PromotedPiece\")))) (\"ChessRook\" \"Castle\") (piece \"King_noCross\" Each (or (\"StepToNotFriend\") (if (not (\"IsInCheck\" \"King_noCross\" Mover)) (\"LeapCapture\" \"KnightWalk\")))) (\"ChessBishop\" \"Elephant\") (\"ChessKnight\" \"Horse\") (\"ChessQueen\" \"Queen\") (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\"} state:1) (place \"Horse1\" {\"B1\" \"G1\"}) (place \"Elephant1\" {\"C1\" \"F1\"}) (place \"Queen1\" coord:\"D1\") (place \"King_noCross1\" coord:\"E1\" state:1) (place \"Castle2\" {\"A8\" \"H8\"} state:1) (place \"Horse2\" {\"B8\" \"G8\"}) (place \"Elephant2\" {\"C8\" \"F8\"}) (place \"Queen2\" coord:\"D8\") (place \"King_noCross2\" coord:\"E8\" state:1)}) (play (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King_noCross\" Mover)))) (end (\"Checkmate\" \"King_noCross\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\n8x8 checkered board, the dark spaces placed so that the bottom right corner is a dark space. Twelve pieces per player, placed on the dark spaces of the first three rows closest to the players. Players alternate turns moving a piece forward diagonally to an empty space. Pieces may capture an opponent's piece by hopping over it to an empty adjacent space, in a forwards or backwards direction. Captures are not compulsory, multiple captures are possible, the maximum capture possible is not required. When a piece reaches the opposite edge of the board from where it started at the end of its turn, it it promoted. If it lands on the edge of the board in the middle of a capturing sequence, it is not promoted. Promoted pieces may move any distance diagonally forward or backward, and may capture any number of opponent's pieces it leaps over. The player who captures all of the opponent's pieces wins.\n \n\n###\n\n", "completion": "(define \"IsUnpromoted\" (\"IsPieceAt\" \"Counter\" Mover (last To))) (define \"HopDiagonalDoubleCounter\" (\"HopCaptureDistance\" (from) Diagonal (range 1 (count Rows)) (then (\"ReplayIfCanMove\" (\"HopCaptureDistance\" (from (last To)) Diagonal (range 1 (count Rows))))))) (define \"HopDiagonalCounter\" (\"HopCapture\" (from) Diagonal (then (\"ReplayIfCanMove\" (\"HopCapture\" (from (last To)) Diagonal) (\"PromoteIfReach\" (sites Next) \"DoubleCounter\"))))) (game \"Damspel\" (\"TwoPlayersNorthSouth\") (\"DraughtsEquipment\" (square 8)) (rules (\"WhiteCellsSetup\" 3) (play (if (\"SameTurn\") (if (\"IsUnpromoted\") (or (move Pass (then (forEach Site (sites Next) (if (\"IsPieceAt\" \"Counter\" Mover (site)) (promote (site) (piece \"DoubleCounter\") Mover))))) (\"HopCapture\" (from (last To)) Diagonal (then (\"ReplayIfCanMove\" (\"HopCapture\" (from (last To)) Diagonal) (\"PromoteIfReach\" (sites Next) \"DoubleCounter\"))))) (or (move Pass) (\"HopCaptureDistance\" (from (last To)) Diagonal (range 1 (count Rows)) (then (\"ReplayIfCanMove\" (\"HopCaptureDistance\" (from (last To)) Diagonal (range 1 (count Rows)))))))) (or (forEach Piece \"Counter\" (or (\"StepToEmpty\" (directions {FR FL}) (then (\"PromoteIfReach\" (sites Next) \"DoubleCounter\"))) \"HopDiagonalCounter\")) (forEach Piece \"DoubleCounter\" (or (move Slide Diagonal) (\"HopDiagonalDoubleCounter\")))))) (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6 board with two stores. Seven counters in each hole. Play moves in an anti-clockwise direction and players sow into the store on their right hand side. A move may begin from any of the player's holes except their store. If the last counter falls into the store, they can sow again from any of the holes in their row. If it lands in a hole with counters in it, these are picked up and sowing continues. If the last counter falls into an empty hole the move ends, but if the hole is in the player's own row, any counters in the hole opposite it are captured and placed in the store. When no more moves can be made, a new round begins and each player fills as many holes as they can by putting seven in each. Surplus counters are placed in the store. Any unfilled holes are excluded from play. Play continues until one player cannot fill a hole with seven counters, and the opponent wins. \n\n###\n\n", "completion": "(define \"NoLegalMoves\" (all Sites (forEach (difference (union (sites Bottom) (sites Top)) (sites Empty)) if:(is In (site) (values Remembered))) if:(= 0 (count at:(site))))) (define \"AllPossibleHolesFilled\" (or (and (> 7 (count at:(mapEntry P2))) (= 42 (count in:(sites Bottom)))) (and (> 7 (count at:(mapEntry P1))) (= 42 (count in:(sites Top)))))) (define \"PlayableSites\" (forEach (sites Mover \"Home\") if:(is In (site) (values Remembered)))) (define \"CaptureEnoughSeed\" (> 7 (count in:(difference (sites Board) (mapEntry Mover))))) (define \"Columns\" 6) (game \"Galatjang\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" { (track \"Track1\" \"1,E,ENE,WNW,W\" loop:True P1) (track \"Track2\" \"12,W,WSW,ESE,E\" loop:True P2)}) (piece \"Seed\" Shared) (regions \"Home\" P1 (sites Bottom)) (regions \"Home\" P2 (sites Top)) (map {(pair P1 LastSite) (pair P2 FirstSite)})}) (rules (start { (set Count 7 to:(union (sites Bottom) (sites Top))) (forEach Value min:1 max:12 (set RememberValue (value)))}) phases:{ (phase \"Round\" (play (move Select (from (if (and (not (is Pending)) (\"SameTurn\")) (\"LastHoleSowed\") (\"PlayableSites\")) if:(> (count at:(from)) 0)) (then (sow \"Track\" owner:(mover) apply: (if (= (to) (mapEntry Mover)) (and (moveAgain) (set Pending)) (if (> (count at:(to)) 1) (moveAgain) (if (and (is In (to) (sites Mover \"Home\")) (> (count at:(\"OppositePit\" (to))) 0)) (fromTo (from (\"OppositePit\" (to))) (to (mapEntry Mover)) count:(count at:(\"OppositePit\" (to))))))) (then (if (\"NoLegalMoves\") (and (forEach Site (difference (sites P1 \"Home\") (sites Empty)) (fromTo (from (site)) (to (mapEntry P1)) count:(count at:(site)))) (forEach Site (difference (sites P2 \"Home\") (sites Empty)) (fromTo (from (site)) (to (mapEntry P2)) count:(count at:(site))))))))))) (nextPhase (\"NoLegalMoves\") \"BetweenRound\")) (phase \"BetweenRound\" (play (if (>= (count at:(mapEntry Mover)) 7) (move (from (mapEntry Mover)) (to (intersection (sites Empty) (sites Mover \"Home\"))) count:7) (then (if (\"AllPossibleHolesFilled\") (and (forget Value All) (forEach Site (sites Board) (if (= 7 (count at:(site))) (remember Value (site))))))))) (nextPhase (\"AllPossibleHolesFilled\") \"Round\"))} (end (if (\"CaptureEnoughSeed\") (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nGoal: Score the most points: \n -- One point for each stone in one's largest group.\n -- Bonus points are also awarded according to the selected option.\n \n The board starts empty.\n Players take alternating turns placing one of their stones onto an empty site.\n Directly after placement, every site of the board must remain connected to an empty perimeter site via a continuous path of empty sites, and the stone that was placed must be next to any 2 empty sites. \n \n Capture \n After placement, simultaneously remove all the stones adjacent to the placed stone that are no longer next to 2 empty sites.\n \n There is no passing. The game ends when no more placements can be made. \n \n Players score one point for every stone in their largest group, then, if applicable, score bonus points according to the selected option.\n \n Bonus Options are:\n -- Captured opponent's stones\n -- Count of one's own groups\n -- Count of the opponent's groups\n -- No Bonus\n \n The player with the higher score wins. If the scores are tied, the game is decided by the tie-breaker option that was selected before the game: \n A: Cascading largest group LOSES -- i.e. negative scores -- This excludes tied pairs; If all groups are paired, last to place. \n B: Last player to have placed a stone. Order 5 board - about 17 moves each Hex N / N-1 Grid, about 5% less moves Scoring Option: Score a point for each piece in your largest group and each opponent piece you capture Tiebreaker is largest group (excluding tied pairs) LOSES. If all are paired, last placement wins.\n\n###\n\n", "completion": "(define \"ColourBackground\" (colour 126 130 156)) (define \"TriSquare\" (board (tiling T33434 (- 5 2)) use:Vertex)) (define \"HexCell\" (board (hex Hexagon 5) use:Cell)) (define \"Hex2Limp\" (board (hex (- 5 1) (+ 5 1)) use:Cell)) (define \"HexLimp\" (board (hex Limping (- 5 1)) use:Cell)) (define \"BoardUsed\" \"HexLimp\") (define \"ConnectionDirection\" Orthogonal) (define \"ScoreConnectionDirection\" Orthogonal) (define \"AllHave1Connection2Edge\" (all Sites #1 if:(or (and (is Empty (site)) (is In (site) (sites Outer))) (!= Infinity (count Steps (step \"ConnectionDirection\" (to if:(is Empty (to)))) (site) (difference (sites Outer) (site))))))) (define \"Capture\" (forEach Value (array #1) (if (> 2 (count Sites in:(sites Around (value) \"ConnectionDirection\" if:(is Empty (to))))) (remove (value))))) (define \"CaptureScores\" (forEach Value (array #1) (if (> 2 (count Sites in:(sites Around (value) \"ConnectionDirection\" if:(is Empty (to))))) (if (is Mover (who at:(value))) (remove (value)) (remove (value) (then (if (is Empty (handSite Mover)) (add (piece (id \"Disc\" Next)) (to (handSite Mover)) (then (set Value at:(handSite Mover) (+ 1 (value Piece at:(handSite Mover)))))) (set Value at:(handSite Mover) (+ 1 (value Piece at:(handSite Mover))))))))))) (define \"CascadeTiebreaker\" (if (= (var \"MoverScore\") (var \"NextScore\")) (and (set Score Mover (- 0 (\"CascadeScore\" Mover Next))) (set Score Next (- 0 (\"CascadeScore\" Next Mover)))) (\"NoTiebreaker\"))) (define \"NoTiebreaker\" (and (set Score Mover (var \"MoverScore\")) (set Score Next (var \"NextScore\")))) (define \"CascadeScore\" (max 0 (max (difference (sizes Group \"ScoreConnectionDirection\" #1) (sizes Group \"ScoreConnectionDirection\" #2))))) (define \"BonusOpponent\" (set Var \"MoverScore\" (+ (\"GroupCount\" Mover) (count Groups \"ScoreConnectionDirection\" if:(= (who at:(to)) (next)))) (then (set Var \"NextScore\" (+ (\"GroupCount\" Next) (count Groups \"ScoreConnectionDirection\" if:(= (who at:(to)) (mover)))) (then (\"CascadeTiebreaker\")))))) (define \"BonusMover\" (set Var \"MoverScore\" (+ (\"GroupCount\" Mover) (count Groups \"ScoreConnectionDirection\" if:(= (who at:(to)) (mover)))) (then (set Var \"NextScore\" (+ (\"GroupCount\" Next) (count Groups \"ScoreConnectionDirection\" if:(= (who at:(to)) (next)))) (then (\"CascadeTiebreaker\")))))) (define \"PlusCaptureScore\" (set Var \"MoverScore\" (+ (value Piece at:(handSite Mover)) (\"GroupCount\" Mover)) (then (set Var \"NextScore\" (+ (value Piece at:(handSite Next)) (\"GroupCount\" Next)) (then (\"CascadeTiebreaker\")))))) (define \"GroupScore\" (set Var \"MoverScore\" (\"GroupCount\" Mover) (then (set Var \"NextScore\" (\"GroupCount\" Next) (then (\"CascadeTiebreaker\")))))) (define \"GroupCount\" (max 0 (max (sizes Group \"ScoreConnectionDirection\" #1)))) (game \"Branching Coral\" (players 2) (equipment { \"BoardUsed\" (piece \"Ball\" Each) (piece \"Disc\" Each) (hand Each size:1)}) (rules (start (set Score Each 0)) (play (do (move Add (to (sites Empty) if:(< 1 (count Sites in:(intersection (sites Around (to) \"ConnectionDirection\") (sites Empty)))))) ifAfterwards:(\"AllHave1Connection2Edge\" (intersection (sites Around (last To) \"ConnectionDirection\") (sites Empty))) (then (do (\"CaptureScores\" (intersection (sites Occupied by:All) (sites Around (last To) \"ConnectionDirection\"))) next:(\"PlusCaptureScore\"))))) (end (if (no Moves Next) { (if (= (score Mover) (score Next)) (result Mover Win)) (if (!= (score Mover) (score Next)) (byScore))})))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"CounterMove\" (or { (\"StepToEmpty\" Diagonal) (move Slide Orthogonal (between (exact 2))) (\"HopCapture\" (from) Diagonal (\"MoveAgainIfCanCaptureAgain\")) (\"OrthogonalHopCaptureCounter\" (from) (\"MoveAgainIfCanCaptureAgain\"))})) (define \"MoveAgainIfCanCaptureAgain\" (then (\"ReplayIfCanMove\" (or (\"HopCapture\" (from (last To)) Diagonal) (\"OrthogonalHopCaptureCounter\" (from (last To))))))) (define \"OrthogonalHopCaptureCounter\" (do (move Hop #1 Orthogonal (between before:2 after:2 if:(and (= 2 (count Steps (from) (between))) (\"IsEnemyAt\" (between))) (apply (remove (between)))) (to if:(is Empty (to)))) ifAfterwards:(is In (last To) (sites Phase 1)) #2)) (game \"The Babylonian\" (players 2) (equipment { (board (square 10)) (piece \"Counter\" Each \"CounterMove\") (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (\"WhiteCellsSetup\" 4) (play (if (\"SameTurn\") (or { (\"HopCapture\" (from (last To)) Diagonal (\"MoveAgainIfCanCaptureAgain\")) (\"OrthogonalHopCaptureCounter\" (from (last To)) (\"MoveAgainIfCanCaptureAgain\")) (move Pass)}) (forEach Piece))) (end (\"CaptureAll\" Next))))\n\n###\n\n", "completion": "10x10 checkered board. Twenty pieces per player, arranged on the four rows closest to the player. Pieces move orthogonally or diagonally in any direction, only on the white spaces. Pieces may capture by jumping over an enemy piece to an empty space on the other side of it. Multiple captures in one turn are allowed. The player to capture all of the opponent's pieces wins. 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 Ludii game based on the following description\nPlayed on a board with 36 holes arranged in a square, with a gap in the center of each side. There are two semi circles of five holes on the outside of two opposite corners of the board. The central space of these semicircles is marked. One or two pieces per player. Four stick dice are used, with one marked side. Each die is marked differently for a different value: 4, 6, 14, 15. The throws are as follows: All marked sides up = 5; three marked sides up = 3; two marked sides up = 2, one marked side up = the value of the marked side; zero marked sides up = 10. Players\u2019 pieces enter on the branching arcs. The second piece cannot enter before the first one leaves the arc. Players move in opposite directions around the board. If a player lands on the same spot as the opponent, the opponent\u2019s piece is removed from the board and must re-enter. Player must make an exact throw to get a piece off the board. The player to get both of their pieces around the board, and then to reach the marked space with an exact throw. When a piece is in the hole before the marked space, they may throw anything but 14 or 15 to exit the board. The first player to remove their piece(s) from the board wins. Each player has 2 pieces.\n\n###\n\n", "completion": "(define \"PieceCanEnterOnlyIfNoPieceOnArc\" (and (= (from) (handSite Mover)) (all Sites (sites Occupied by:Mover) if:(not (is In (site) (sites Mover \"Arc\")))))) (define \"PieceAlreadyEntered\" (!= (from) (handSite Mover))) (define \"Movement\" (if (\"IsEndTrack\" (\"SiteToMoveOnTrack\")) \"RemoveAPiece\" (if (\"IsNotOffBoard\" (\"SiteToMoveOnTrack\")) (if (not (\"IsFriendAt\" (\"SiteToMoveOnTrack\"))) (move (from) (to (\"SiteToMoveOnTrack\") \"CaptureEnemyPiece\")))))) (define \"RemoveAPiece\" (move Remove (from))) (define \"CaptureEnemyPiece\" (\"HittingCapture\" (handSite Next))) (define \"ThrowValue\" (mapEntry \"Throw\" (count Pips))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" (\"ThrowValue\"))) (game \"Kints\" (players 2) (equipment { (\"KintsBoard\" { (track \"Track1\" \"46,5,SSE,N,E,S,W,NNW2,End\" P1 directed:True) (track \"Track2\" \"47,41,NNW,W,S,E,N,SSE2,End\" P2 directed:True)}) (regions \"AllSites\" (sites Board)) (regions \"Arc\" P1 (sites {1..5})) (regions \"Arc\" P2 (sites {41..45})) (dice d:2 facesByDie:{{0 4} {0 6} {0 14} {0 15}} num:4) (piece \"Marker\" Each (if (or (\"PieceAlreadyEntered\") (\"PieceCanEnterOnlyIfNoPieceOnArc\")) (\"Movement\"))) (hand Each) (map \"Throw\" { (pair 0 10) (pair 39 5) (pair 24 3) (pair 25 3) (pair 35 3) (pair 33 3) (pair 10 2) (pair 18 2) (pair 19 2) (pair 20 2) (pair 21 2) (pair 29 2)})}) (rules (start (place \"Marker\" \"Hand\" count:2)) (play (\"RollMove\" (or (forEach Piece) (forEach Piece container:(mover))))) (end (\"EscapeWin\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x8 board, with a store on either end. Each player owns the store to their right. Eight counters in each hole. Players alternate turns sowing in an anti-clockwise direction from one of the holes on their side of the board. Sowing always includes the player's store (but not the opponent's store), and sowing cannot begin from the store. When the final counter lands in an occupied hole, the contents of that hole are picked up and sowing continues. If the last counter lands in the player's store, they may choose any of the holes on their side of the board and continue sowing from it. When the final counter lands in an empty hole, the counters in the opposite hole are captured. Play continues until all of the counters are captured. A new round begins. Players fill the holes on their side of the board with their captured counters. If a player cannot fill a hole with the required number of counters, the hole is closed and is out of play for that round. Play continues as before. Play continues in successive rounds until one player closes all of their opponent's holes and wins. \n\n###\n\n", "completion": "(define \"Stores\" (sites {(mapEntry P1) (mapEntry P2)})) (define \"NoPieceOnBoard\" (no Pieces All in:(union (sites Top) (sites Bottom)))) (define \"PlayableSites\" (sites (values Remembered \"Playable\"))) (define \"Columns\" 8) (game \"Ovalhu\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" { (track \"Track1\" \"1,E,17,16,W\" loop:True P1) (track \"Track2\" \"1,E,N,W,0\" loop:True P2)}) (piece \"Seed\" Shared) (map {(pair P1 LastSite) (pair P2 FirstSite)}) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start { (set RememberValue \"Playable\" (union (sites Top) (sites Bottom))) (set Count 8 to:(union (sites Bottom) (sites Top)))}) phases:{ (phase \"Sowing\" (play (or { (move Select (from (if (and (is Pending) (\"SameTurn\")) (sites {(var \"Replay\")}) (sites Mover)) if:(and (is Occupied (from)) (is In (from) (\"PlayableSites\")))) (then (sow \"Track\" owner:(mover) apply:(if (or (is In (to) (\"Stores\")) (< 1 (count at:(to)))) (and (moveAgain) (if (not (is In (to) (\"Stores\"))) (and (set Pending) (set Var \"Replay\" (to))))) (if (is Occupied (\"OppositePitTwoRows\" (to))) (fromTo (from (\"OppositePitTwoRows\" (to))) (to (mapEntry Mover)) count:(count at:(\"OppositePitTwoRows\" (to)))))) skipIf:(and (not (is In (to) (\"Stores\"))) (not (is In (to) (\"PlayableSites\")))))))} (then (if (\"NoPieceOnBoard\") (forget Value \"Playable\" All))))) (end (if (\"NoPieceOnBoard\") { (if (> 8 (count at:(mapEntry P1))) (result P2 Win)) (if (> 8 (count at:(mapEntry P2))) (result P1 Win))})) (nextPhase (\"NoPieceOnBoard\") \"BetweenRounds\")) (phase \"BetweenRounds\" (play (if (not (all Sites (sites Mover) if:(is Occupied (site)))) (if (<= 8 (count at:(mapEntry Mover))) (move (from (mapEntry Mover)) (to (sites Mover) if:(is Empty (to))) count:8 (then (remember Value \"Playable\" (last To))))))) (nextPhase (all Passed) \"Sowing\"))})) END" }, { "prompt": "Construct a Ludii game based on the following description\n4 or 6x10 board. Six pieces per player, with one piece placed on each of the three spaces on either end of the long row closest to the player. Three casting sticks, each with a round and a flat side, are used as dice. The throws are as follows: One flat side up = 1; two flat sides up = 2; three flat sides up = 4, zero flat sides up = 6. A player must throw a 1 to move each piece for the first time. Players move according to the throws, except on throws of 1, which are tabulated for use later. Players continue to throw until they throw 2. Pieces move along a boustrophedon path, beginning from left to right in the row closest to them. Pieces are captured when an player's piece lands on a spot occupied by an opponent's piece. Players may used tabulated throws to supplement a throw in order to make a capture. The player who captured the most pieces wins. 6 rows.\n\n###\n\n", "completion": "(define \"ActiveInactivedPiece\" (move Select (from (sites Occupied by:Mover) if:(\"InactivedPiece\")) (then (and (\"ActivePiece\") (moveAgain))))) (define \"ActivePiece\" (set State at:(last From) 1)) (define \"InactivedPiece\" (= (state at:(from)) 0)) (define \"ReinitTabule\" (set Value Mover 0)) (define \"TabuleThrowOne\" (if (> (value Player Mover) 0) (set Value Mover (+ 1 (value Player Mover))) (set Value Mover 1))) (define \"CapturesAreImpossible\" (and (= (count Sites in:(difference (sites Occupied by:P1) (sites Top))) 0) (= (count Sites in:(difference (sites Occupied by:P2) (sites Bottom))) 0))) (define \"CaptureEnemyPiece\" (apply if:(\"IsEnemyAt\" (to)) (remove (to) (then (addScore Mover 1))))) (define \"ThrowValue\" (mapEntry (count Pips))) (define \"StartSites\" (union (intersection (sites #1) (expand (sites Left) steps:2)) (intersection (sites #1) (expand (sites Right) steps:2)))) (game \"Sijat El Taba\" (players 2) (equipment { (board (rectangle 6 10) { (track \"Track1\" \"0,E,N1,W,N1,E,N1,W,N1,E,N1,W\" P1 directed:True) (track \"Track2\" \"59,W,S1,E,S1,W,S1,E,S1,W,S1,E\" P2 directed:True)}) (piece \"Marker\" Each (if (= (state at:(from)) 1) (or (if (\"IsNotOffBoard\" (\"NextSiteOnTrack\" (\"ThrowValue\"))) (if (or (is In (\"NextSiteOnTrack\" (\"ThrowValue\")) (sites Empty)) (\"IsEnemyAt\" (\"NextSiteOnTrack\" (\"ThrowValue\")))) (move (from) (to (\"NextSiteOnTrack\" (\"ThrowValue\")) \"CaptureEnemyPiece\")))) (if (\"IsNotOffBoard\" (\"NextSiteOnTrack\" (+ (value Player Mover) (\"ThrowValue\")))) (if (\"IsEnemyAt\" (\"NextSiteOnTrack\" (+ (value Player Mover) (\"ThrowValue\")))) (move (from) (to (\"NextSiteOnTrack\" (+ (value Player Mover) (\"ThrowValue\"))) \"CaptureEnemyPiece\") (then (\"ReinitTabule\")))))))) (\"StickDice\" 3) (map {(pair 1 1) (pair 2 2) (pair 3 4) (pair 0 6)})}) (rules (start { (place \"Marker1\" (\"StartSites\" Bottom)) (place \"Marker2\" (\"StartSites\" Top))}) (play (\"RollMove\" (if (= (mapEntry (count Pips)) 1) (or (move Pass (then (and (\"TabuleThrowOne\") (moveAgain)))) (\"ActiveInactivedPiece\")) (if (= (mapEntry (count Pips)) 2) (forEach Piece) (forEach Piece (then (moveAgain))))))) (end (if (\"CapturesAreImpossible\") (byScore))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"Knight's Tour\" (players 1) (equipment { (board (square 8)) (piece \"Knight\" P1)}) (rules phases:{ (phase \"Placement\" (play (move Add (to (sites Empty)))) (nextPhase \"Movement\")) (phase \"Movement\" (play (move Leap (from (last To)) \"KnightWalk\" (to if:(is Empty (to))) (then (add (to (last From)))))))} (end { (if (>= (count Moves) (count Sites \"Board\")) (result P1 Win)) (if (no Moves P1) (result P1 Loss))})))\n\n###\n\n", "completion": "Played with one knight on a Chess board. The goal is to move the knight onto every square of the board only once using its typical move as in Chess. 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": "Describe the mechanics of the following Ludii game\n(define \"IsKing\" (= 3 (size Stack at:#1))) (define \"IsGeneral\" (= 2 (size Stack at:#1))) (define \"IsSoldier\" (\"IsSingletonStack\" #1)) (define \"DoesNotHaveThreeGeneral\" (!= 3 (count Sites in:(forEach (sites Occupied by:Mover) if:(= 2 (size Stack at:(site))))))) (define \"NoKing\" (all Sites (sites Occupied by:Mover) if:(!= 3 (size Stack at:(site))))) (define \"HopGeneral\" (move Hop #1 Orthogonal (between #2 #3 if:(and (not (is In (between) (sites ToClear))) (\"IsEnemyAt\" (between))) (apply (remove (between) at:EndOfTurn count:(size Stack at:(between))))) (to if:(is Empty (to))) stack:True (then (if (can Move (hop (from (last To)) Orthogonal (between #2 #3 if:(and (not (is In (between) (sites ToClear))) (\"IsEnemyAt\" (between)))) (to if:(is Empty (to))))) (moveAgain))))) (define \"Hop\" (move Hop (from #1) #2 (between if:(and (not (is In (between) (sites ToClear))) (\"IsEnemyAt\" (between))) (apply (remove (between) at:EndOfTurn count:(size Stack at:(between))))) (to if:(is Empty (to))) stack:True #3)) (game \"Fenix\" (players 2) (equipment { (board (square 9)) (piece \"Fenix\" Each)}) (rules (start { (place \"Fenix1\" (expand (intersection (sites Bottom) (sites Right)) steps:6 Orthogonal) value:1) (place \"Fenix2\" (expand (intersection (sites Top) (sites Left)) steps:6 Orthogonal) value:1)}) phases:{ (phase \"Setup\" (play (move (from (sites Occupied by:Mover) if:(\"IsSingletonStack\" (from))) (to (sites Around (from) Own Orthogonal) if:(and { (!= (from) (to)) (< (size Stack at:(to)) 3) (if (\"NoKing\") True (< (size Stack at:(to)) 2)) (if (\"DoesNotHaveThreeGeneral\") True (not (\"IsSingletonStack\" (to))))})))) (nextPhase Mover (and (not (\"NoKing\")) (not (\"DoesNotHaveThreeGeneral\"))) \"Play\")) (phase \"Play\" (play (if (\"SameTurn\") (max Moves withValue:True (if (\"IsSoldier\" (last To)) (\"Hop\" (last To) Orthogonal (then (\"ReplayIfCanMove\" (\"Hop\" (last To) Orthogonal)))) (if (\"IsKing\" (last To)) (\"Hop\" (last To) ~ (then (\"ReplayIfCanMove\" (\"Hop\" (last To))))) (if (\"IsGeneral\" (last To)) (\"HopGeneral\" (from (last To)) before:(count Columns) after:(count Columns) at:EndOfTurn))))) (if (\"NoKing\") (forEach Piece (if (\"IsSoldier\" (from)) (move Step Orthogonal (to if:(and (\"IsFriendAt\" (to)) (= 2 (size Stack at:(to))))) stack:True))) (priority { (max Moves withValue:True (forEach Piece (if (\"IsSoldier\" (from)) (\"Hop\" (from) Orthogonal (then (\"ReplayIfCanMove\" (\"Hop\" (last To) Orthogonal)))) (if (\"IsKing\" (from)) (\"Hop\" (from) ~ (then (\"ReplayIfCanMove\" (\"Hop\" (last To))))) (if (\"IsGeneral\" (from)) (\"HopGeneral\" (from) before:(count Columns) after:(count Columns) at:EndOfTurn)))))) (forEach Piece (if (\"IsSoldier\" (from)) (or (move Step Orthogonal (to if:(is Empty (to))) stack:True) (if (\"DoesNotHaveThreeGeneral\") (move Step Orthogonal (to if:(and (\"IsFriendAt\" (to)) (\"IsSingletonStack\" (to)))) stack:True))) (if (\"IsGeneral\" (from)) (move Slide Orthogonal stack:True) (if (\"IsKing\" (from)) (\"StepToEmpty\" ~ stack:True)))))})))) (end (if (\"NoKing\") (result Mover Loss))))}))\n\n###\n\n", "completion": "Each player, on their first five turns, uses some of their own pieces to create one King and three Generals, in any preferred order. A General is made by placing any single piece on top of an orthogonally adjacent piece, and a King is made by placing any single piece on top of an orthogonally adjacent General. \n \n - Soldiers move orthogonally one step to an adjacent square.\n - Generals move any distance in a straight line orthogonally, like a Chess Rook.\n - The King moves one step to any adjacent square, like a Chess King\n \n Capture is compulsory if possible.\n \n - A Soldier or King captures by jumping over an enemy piece occupying a square to which it can legally move and landing on the square immediately beyond it in the same direction, provided that the landing square is vacant.\n - A General captures in the same way, but may move any number of vacant squares before the captured piece, and may land on any successive vacant square in line of travel beyond the captured piece.\n \n If the capturing piece can then make another capture, it must, and it must continue doing so until all possible consecutive captures have been made. An enemy piece can only be jumped once in a single turn. If it is reached a second time it forms a block and ends the turn. At the end of a capturing turn all captured pieces must be removed from the board before the next player moves.\n \n If more than one capture is possible you must choose that which captures the greatest number of pieces, counting a King as three, a General as two, and a Soldier as one. If two possible capturing moves offer an equal number of pieces, you may freely choose between them.\n \n If one or more of your Generals is captured in one turn, you may create just one General (not more) from two orthogonally adjacent Soldiers anywhere on the board.\n \n If your King is captured you must, if possible, use your next turn to create another King by placing a Soldier on top of an adjacent General. \n \n If you are unable to create another King, when your King is captured, you lose the game. The game is played on a 9x9 square board. END" }, { "prompt": "Construct a Ludii game based on the following description\n5x5 intersecting lines, with diagonals in each quadrant. At the midpoint of each side, the apex of a triangle. A line is drawn from the apex to the base of each triangle, and another line bisecting this one and the two opposite sides of the triangle. One player plays as two tigers, the other as 25 people. One tiger begins on the central point, and the other may be placed anywhere on the board. Players alternate turns, with the person playing as the people first placing a person on the board, and then one of the tigers moving to an empty adjacent spot along the lines of the board. When all of the people have been placed, the people move on the board in the same fashion. The tigers may capture one of the people by jumping over it to an empty adjacent spot immediately on the opposite side of one of the people along the lines of the board. The tigers win when they capture enough people so that the people cannot block the tiger, the people win when they can block the tiger from being able to move.\n \n\n###\n\n", "completion": "(game \"Mysore Tiger Game (Two Tigers)\" (players 2) (equipment { (\"AlquerqueBoardWithFourTriangles\") (hand Each) (piece \"Human\" P2 (\"StepToEmpty\")) (piece \"Tiger\" P1 (or (\"StepToEmpty\") (\"HopCapture\")))}) (rules (start { (place \"Human2\" (handSite P2) count:25) (place \"Tiger1\" (sites Centre)) (place \"Tiger1\" (handSite P1))}) phases:{ (phase \"Opening\" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (\"PhaseMovePiece\" \"Movement\")} (end (\"NoMovesP1NoPiecesP2\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\n3x3 intersecting lines, with triangles extending on opposite ends of the large square and the central line extending to the apices. One player plays as three notched sticks, called hares, and the other as three sharp sticks, known as the hounds. Players alternate turns placing a piece on the board. When the players have placed all of their pieces on the board, they move one of their pieces to an empty adjacent spot along the lines. The first player to block their opponent from being able to move wins. \n\n###\n\n", "completion": "(game \"Janes Soppi (Symmetrical)\" (players 2) (equipment { (board (remove (\"ThreeMensMorrisGraphWithLeftAndRightTriangles\") edges:{{6 4} {4 2} {0 4} {4 8}}) use:Vertex) (hand Each) (piece \"Hound\" P1 \"StepToEmpty\") (piece \"Hare\" P2 \"StepToEmpty\")}) (rules (start { (place \"Hound1\" (handSite P1) count:3) (place \"Hare2\" (handSite P2) count:3)}) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (\"PhaseMovePiece\" \"Movement\")} (end (\"BlockWin\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\n12x12 checkered board. Thirty pieces per player, placed on the white spaces in the first five ranks on each player's side. Pieces move diagonally forward or backward. The opponent's pieces are captured by hopping over them. Multiple hops by one piece are allowed in one turn if they are possible. When they reach the opposite edge of the board from where they started, they become Kings. Kings may move diagonally any number of spaces. They may capture pieces proceeding along its diagonal in one direction, as long as the next space beyond the piece to be captured is empty. It may not hop over any pieces which belong to the same player, or those belonging to the opponent except to capture them. Multiple captures for the King can only be made along the same diagonal, except when it makes a capture that brings it to the edge of the board, it can make another capture along the next available diagonal, if possible. The player who captures all of the opponent's pieces wins. \n\n###\n\n", "completion": "(define \"DoubleCounterHopAgain\" (\"HopDistance\" (from (last To)) (if (is In (last To) (sites Outer)) (difference Diagonal OppositeDirection) SameDirection))) (define \"DoubleCounterHop\" (\"HopDistance\" Diagonal)) (define \"HopDistance\" (move Hop #1 #2 (between before:(count Rows) if:(\"IsEnemyAt\" (between)) (apply (remove (between)))) (to if:(is Empty (to))) (then (\"ReplayIfCanMove\" (hop (from (last To)) (if (is In (last To) (sites Outer)) (difference Diagonal OppositeDirection) SameDirection) (between before:(count Rows) if:(and (not (is In (between) (sites ToClear))) (\"IsEnemyAt\" (between))) (apply (remove (between)))) (to if:(is Empty (to)))))))) (define \"JumpToPromotionZone\" (is In (last To) (sites Next))) (define \"IsUnpromoted\" (\"IsPieceAt\" \"Counter\" Mover (last To))) (game \"Dam\" (players 2) (\"DraughtsEquipment\" (square 12)) (rules (\"WhiteCellsSetup\" 5) (play (if \"SameTurn\" (or (if \"IsUnpromoted\" (\"HopDiagonalSequenceCaptureAgain\") (\"DoubleCounterHopAgain\")) (move Pass)) (or (forEach Piece \"Counter\" (or (\"HopDiagonalSequenceCapture\") (\"StepToEmpty\" Diagonal))) (forEach Piece \"DoubleCounter\" (or (\"DoubleCounterHop\") (move Slide (directions Diagonal))))) (then (if (and \"IsUnpromoted\" \"JumpToPromotionZone\") (promote (last To) (piece \"DoubleCounter\") Mover))))) (end (\"BlockWin\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\nTwo rows of four piles. Six counters in each pile. A player picks up the counters in one of her piles and sows them anti-clockwise, beginning in the place from which the pile originated. Any piles containing 2, 4, or 6 counters at the end of sowing are captured. Play continues until all of the counters have been captured. The player who captures the most counters wins. \n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (count Cell at:(handSite #1))) (define \"NumPiecesOnBoard\" (count in:(sites Track))) (game \"Oure Ngat\" (players 2) (equipment { (mancalaBoard 2 4 store:None (track \"Track\" \"0,E,N,W\" loop:True)) (piece \"Seed\" Shared) (regions \"Home\" P1 (sites Bottom)) (regions \"Home\" P2 (sites Top)) (hand Each)}) (rules (start (set Count 6 to:(sites Track))) (play (move Select (from (sites Mover \"Home\") if:(> (count at:(from)) 0)) (then (sow origin:True (then (forEach Site (sites Track) (if (is In (count at:(site)) (sites {2 4 6})) (fromTo (from (site)) (to (handSite Mover)) count:(count at:(site)))))))))) (end (\"MancalaByScoreWhen\" (= 0 (\"NumPiecesOnBoard\")))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6 board, which two stores. Four counters in each hole. Sowing proceeds in an anti-clockwise direction. When the final counter of a sowing falls in to an occupied hole, these counters are picked up and sowing continues. When the final hole lands in an empty hole, if the hole is in the player's row, the contents of the opponent's opposite hole are captured. If the empty hole is in the opponent's row, the turn ends. A player must play so that the opponent is able to play on their next turn, if possible. The player who captures the most counters wins. \n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (+ (count at:(mapEntry #1)) (count in:(sites #1)))) (define \"Columns\" 6) (game \"J'odu\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" (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 (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover)) if:(< 0 (count at:(from)))) (then (sow apply:(if (> (count at:(to)) 1) (moveAgain) (if (is In (to) (sites Mover)) (fromTo (from (\"OppositePit\" (to))) (to (mapEntry (mover))) count:(count at:(\"OppositePit\" (to))))))))) ifAfterwards:(< 0 (count in:(if (is Mover P1) (sites P2) (sites P1)))))) (end (\"MancalaByScoreWhen\" (no Moves Mover))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"IsUnpromoted\" (\"IsPieceAt\" \"Counter\" Mover (last To))) (define \"HopMan\" (\"HopCapture\" (from #1) (directions {Forward Rightward Leftward}) #2)) (define \"PromotedHopOrthogonalSequenceCapture\" (\"HopCaptureDistance\" #1 #2 ~ (then (\"ReplayIfCanMove\" (\"HopCaptureDistanceNotAlreadyHopped\" (from (last To)) (difference Orthogonal OppositeDirection)))))) (game \"Dama (Comoros)\" (players 2) (\"DraughtsEquipment\" (square 8)) (rules (start { (place \"Counter1\" (union (sites Row 1) (sites Row 2))) (place \"Counter2\" (union (sites Row 5) (sites Row 6)))}) (play (if \"SameTurn\" (or (if \"IsUnpromoted\" (\"HopMan\" (last To) (then (\"ReplayIfCanMove\" (\"HopMan\" (last To)) (\"PromoteIfReach\" (sites Next) \"DoubleCounter\")))) (\"PromotedHopOrthogonalSequenceCapture\" (from (last To)) (difference Orthogonal OppositeDirection))) (move Pass)) (or { (forEach Piece \"Counter\" (\"HopMan\" (from) (then (\"ReplayIfCanMove\" (\"HopMan\" (last To)) (\"PromoteIfReach\" (sites Next) \"DoubleCounter\"))))) (forEach Piece \"DoubleCounter\" (\"PromotedHopOrthogonalSequenceCapture\" (from) Orthogonal)) (forEach Piece \"Counter\" (\"StepToEmpty\" (directions {Forward Rightward Leftward})) (then (\"PromoteIfReach\" (sites Next) \"DoubleCounter\"))) (forEach Piece \"DoubleCounter\" (move Slide Orthogonal))}))) (end (\"BlockWin\"))))\n\n###\n\n", "completion": "8x8 board. 16 pieces per player, lined up in the second and third rows (first row on each side is empty). Pieces move forward or horizontally one space, and capture opponents' pieces by jumping in these directions. When they reach the opposite side, they become a king and can jump opponents' pieces from any distance orthogonally. Multiple captures cannot be made by moving 180 degrees from the previous jump. Pieces can be promoted to king mid-jump. Winning is achieved by capturing all of the other player's pieces or by blocking them so they cannot move.\n END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayed on a 19x19 board. The 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 may be placed in a position where they are surrounded. Stones cannot be placed to recreate a previous position. The game ends when both players pass consecutively. Players then fill in the spaces in their captured territory with their own pieces. Players total the number of intersections their pieces occupy. The player with the highest total wins.\n \n\n###\n\n", "completion": "(game \"Weiqi\" (players 2) (equipment { (board (square 19) use:Vertex) (piece \"Marker\" Each)}) (rules (meta (no Repeat)) (play (or (move Add (to (sites Empty)) (then (\"EncloseCapture\" Orthogonal))) (move Pass))) (end (if (all Passed) (byScore { (score P1 (+ (count Pieces P1) (size Territory P1))) (score P2 (+ (count Pieces P2) (size Territory P2)))}))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n8x8 checkered board, with the left corner black for each player. Pieces with specialized moves, as follows: Noyion (x1): moves one space in any direction; Merz\u00e9 (x1, \\ \n\n###\n\n", "completion": "(define \"NextCanNotMove\" (not (can Move (do (forEach Piece Next) ifAfterwards:(not (\"IsInCheck\" \"King_noCross\" Next)))))) (game \"Shodra\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (hand Each size:5) (\"ChessKing\" \"King_noCross\") (\"ChessRook\" \"Rook\") (piece \"Camel\" Each (move Hop Diagonal (between if:True) (to if:(or (is Empty (to)) (\"IsEnemyAt\" (to))) (apply (remove (to)))))) (\"ChessKnight\" \"Knight\") (\"ChessPawn\" \"Pawn\" (if (is In (from) (sites Start (piece (what at:(from))))) (\"DoubleStepForwardToEmpty\")) (then (\"PromoteIfReach\" (sites Mover \"Promotion\") \"Dog\"))) (piece \"Dog\" Each (\"StepToNotFriend\" Diagonal)) (regions \"Promotion\" P1 (sites Top)) (regions \"Promotion\" P2 (sites Bottom))}) (rules (start { (place \"Pawn1\" (sites Row 1)) (place \"Pawn2\" (sites Row 6)) (place \"Rook1\" {\"A1\" \"H1\"}) (place \"Knight1\" {\"B1\" \"G1\"}) (place \"Camel1\" {\"C1\" \"F1\"}) (place \"Dog1\" coord:\"D1\") (place \"King_noCross1\" coord:\"E1\") (place \"Rook2\" {\"A8\" \"H8\"}) (place \"Knight2\" {\"B8\" \"G8\"}) (place \"Camel2\" {\"C8\" \"F8\"}) (place \"Dog2\" coord:\"D8\") (place \"King_noCross2\" coord:\"E8\")}) (play (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King_noCross\" Mover)))) (end (if (and (\"IsInCheck\" \"King_noCross\" Next) (\"NextCanNotMove\")) { (if (no Pieces Next \"Pawn\") (result Mover Win)) (if (!= (count Pieces Next \"Pawn\") 0) (result Mover Draw))})))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\n12 Holes per row. -> 15 Holes per row.\n1 extra capture. -> 2 extra captures.\n(define \"HaveToMakeExtraCapture\" (set Var \"ExtraCapture\" 1)) (define \"NumCapture\" (var \"ExtraCapture\")) (define \"NextHoleFrom\" (\"NextSiteOnTrack\" 1 from:#1 #2)) (define \"AHoleHasMoreThanOneCounter\" (not (all Sites (forEach (sites Mover) if:(< 1 (count at:(site)))) if:(= 0 (count at:(site)))))) (define \"LastHoleSowed\" (sites {(var)})) (define \"NoPiece\" (all Sites (sites Player \"Home\") if:(= 0 (count at:(site))))) (define \"Columns\" 12) (game \"Misoro Tsoro (Additional Capture)\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"0,E,N1,W\" loop:True P1) (track \"Track2\" \"24,E,N1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"Track1\")) (regions \"Home\" P2 (sites Track \"Track2\")) (regions \"Inner\" P1 (difference (sites Track \"Track1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"Track2\") (sites Top))) (regions \"Outer\" P1 (sites Bottom)) (regions \"Outer\" P2 (sites Top)) (piece \"Seed\" Shared)}) (rules (start (set Count 2 to:(union (sites Top) (sites Bottom)))) phases:{ (phase \"Misoro\" (play (move Select (from (forEach (sites Mover \"Outer\") if:(= 0 (state at:(site))))) (then (set State at:(last To) (mover))))) (nextPhase (= 4 (count Turns)) \"Playing\")) (phase \"Playing\" (play (if (< 0 (\"NumCapture\")) (move Select (from (forEach (sites Next) if:(and (= 0 (state at:(site))) (< 0 (count at:(site)))))) (then (and { (if (< 1 (\"NumCapture\")) (moveAgain)) (set Var \"ExtraCapture\" (- (\"NumCapture\") 1)) (remove (last To)) (forEach Site (sites Board) (if (!= 0 (state at:(site))) (set State at:(site) (state at:(site)))))}))) (or (if (and (!= 0 (state at:(var))) (\"SameTurn\")) (move Pass)) (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(if \"AHoleHasMoreThanOneCounter\" (> (count at:(from)) 1) (and (= (count at:(from)) 1) (= 0 (count at:(\"NextHoleFrom\" (from) Mover)))))) (then (and (sow \"Track\" owner:(mover) apply:(if (= (count at:(to)) 1) (if (is In (to) (sites Mover \"Inner\")) (if (> (count at:(\"OppositePit\" (to))) 0) (and { (remove (\"OppositePit\" (to))) (if (> (count at:(\"OppositeOuterPit\" (to))) 0) (remove (\"OppositeOuterPit\" (to)))) (moveAgain) (\"HaveToMakeExtraCapture\")}))) (and (moveAgain) (set Var (to))))) (forEach Site (sites Board) (if (!= 0 (state at:(site))) (set State at:(site) (state at:(site))))))))))))} (end (forEach NonMover if:(\"NoPiece\") (result Player Loss)))))\n\n###\n\n", "completion": "(define \"HaveToMakeExtraCapture\" (set Var \"ExtraCapture\" 2)) (define \"NumCapture\" (var \"ExtraCapture\")) (define \"NextHoleFrom\" (\"NextSiteOnTrack\" 1 from:#1 #2)) (define \"AHoleHasMoreThanOneCounter\" (not (all Sites (forEach (sites Mover) if:(< 1 (count at:(site)))) if:(= 0 (count at:(site)))))) (define \"LastHoleSowed\" (sites {(var)})) (define \"NoPiece\" (all Sites (sites Player \"Home\") if:(= 0 (count at:(site))))) (define \"Columns\" 15) (game \"Misoro Tsoro (Additional Capture)\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"0,E,N1,W\" loop:True P1) (track \"Track2\" \"30,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 2 to:(union (sites Top) (sites Bottom)))) phases:{ (phase \"Misoro\" (play (move Select (from (forEach (sites Mover \"Outer\") if:(= 0 (state at:(site))))) (then (set State at:(last To) (mover))))) (nextPhase (= 4 (count Turns)) \"Playing\")) (phase \"Playing\" (play (if (< 0 (\"NumCapture\")) (move Select (from (forEach (sites Next) if:(and (= 0 (state at:(site))) (< 0 (count at:(site)))))) (then (and { (if (< 1 (\"NumCapture\")) (moveAgain)) (set Var \"ExtraCapture\" (- (\"NumCapture\") 1)) (remove (last To)) (forEach Site (sites Board) (if (!= 0 (state at:(site))) (set State at:(site) (state at:(site)))))}))) (or (if (and (!= 0 (state at:(var))) (\"SameTurn\")) (move Pass)) (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(if \"AHoleHasMoreThanOneCounter\" (> (count at:(from)) 1) (and (= (count at:(from)) 1) (= 0 (count at:(\"NextHoleFrom\" (from) Mover)))))) (then (and (sow \"Track\" owner:(mover) apply:(if (= (count at:(to)) 1) (if (is In (to) (sites Mover \"Inner\")) (if (> (count at:(\"OppositePit\" (to))) 0) (and { (remove (\"OppositePit\" (to))) (if (> (count at:(\"OppositeOuterPit\" (to))) 0) (remove (\"OppositeOuterPit\" (to)))) (moveAgain) (\"HaveToMakeExtraCapture\")}))) (and (moveAgain) (set Var (to))))) (forEach Site (sites Board) (if (!= 0 (state at:(site))) (set State at:(site) (state at:(site))))))))))))} (end (forEach NonMover if:(\"NoPiece\") (result Player Loss))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayed on a board similar to Surakarta, but smaller. Players begin with four pieces, arranged in the square of spaces in their bottom right corner. Players take turns moving a piece to one adjacent spot. To capture an opponent's piece, you must move along the curved loops. The spot at the immediate end of the loop must be empty, but the piece may continue as far as the player wishes, including moving along successive loops, or until they make a capture or are stopped by their own piece. The pieces are placed in the corners.\n\n###\n\n", "completion": "(define \"SlideToCapture\" (move Slide \"AllTracks\" (between if:(or (= (between) (from)) (is Empty (between)))) (to if:(\"IsEnemyAt\" (to)) (apply if:False (remove (to)))))) (game \"Ja-Jeon-Geo-Gonu\" (players 2) (equipment { (board (square 4) { (track \"Track1\" {14 14 11 10 9 8 8 13 9 5 1 1 4 5 6 7 7 2 6 10} loop:True directed:True) (track \"Track2\" {11 11 14 10 6 2 2 7 6 5 4 4 1 5 9 13 13 8 9 10} loop:True directed:True)} use:Vertex) (piece \"Disc\" Each (or { (\"StepToEmpty\" Orthogonal) (\"SlideToCapture\")}))}) (rules (start { (place \"Disc1\" {\"A3\" \"B3\" \"A4\" \"B4\"}) (place \"Disc2\" {\"C1\" \"D1\" \"C2\" \"D2\"})}) (play (forEach Piece)) (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"RemoveEnemyPiece\" (if (is Mover P1) (\"IsSingletonStack\" (\"EnemySite\" P2 \"Track2\")) (\"IsSingletonStack\" (\"EnemySite\" P1 \"Track1\")))) (define \"EnemySite\" (\"NextSiteFrom\" (mapEntry \"Start\" #1) #2 (- (pips) 1))) (define \"NextSiteFrom\" (\"NextSiteOnTrack\" #3 from:#1 #2)) (game \"Ketch-Dolt\" (players 2) (equipment { (\"BackgammonBoard\" { (track \"Track1\" {26 12..7} P1 directed:True) (track \"Track2\" {27 25..20} P2 directed:True)}) (dice d:6 num:2) (piece \"Disc\" Each (or (if (is Empty (handSite Mover)) (forEach Die if:(\"DieNotUsed\") (if (\"IsOffBoard\" (\"NextSiteFrom\" (from) \"Track\" (pips))) (do (if (\"RemoveEnemyPiece\") (trigger \"ShouldCapture\" Mover)) next:(move Remove (from)))) (then (\"ReplayNotAllDiceUsed\")))) (forEach Die if:(\"DieNotUsed\") (or (if (\"RemoveEnemyPiece\") (move (from (if (is Mover P1) (\"EnemySite\" P2 \"Track2\") (\"EnemySite\" P1 \"Track1\"))) (to (handSite Next)))) (move (from (from)) (to (\"NextSiteFrom\" (from) \"Track\" (pips)) (apply (if (\"RemoveEnemyPiece\") (trigger \"ShouldCapture\" Mover)))))) (then (\"ReplayNotAllDiceUsed\"))))) (hand Each) (map \"Start\" {(pair P1 12) (pair P2 25)})}) (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 { (if (is Triggered \"ShouldCapture\" P1) (result P1 Loss)) (if (is Triggered \"ShouldCapture\" P2) (result P2 Loss)) (\"EscapeWin\")})))\n\n###\n\n", "completion": "2x12 board, divided in half, where the spaces are rendered as points. Fifteen pieces per player. 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. The players enter their pieces on the board on the points corresponding to the throws of the dice. A player who rolls a number corresponding to a point on the opponent's side of the board that contains a piece should remove the piece from the opponent's point, which must be reentered. If the player fails to do so, they lose instantly. Otherwise, players continue to place their pieces until all are on the board, and they then bear the pieces off from the same quadrant of the board. The first player to bear off all their pieces wins. END" }, { "prompt": "Modify the Ludii game according to the following option changes:\n9 x 9 board -> 10 x 10 board\n(define \"HopCounter\" (move Hop (from #1) #2 (between if:(and (not (is In (between) (sites ToClear))) (\"IsEnemyAt\" (between))) (apply (remove (between) at:EndOfTurn))) (to if:(is Empty (to))) #3)) (game \"Gauntlet\" (players {(player N) (player W)}) (equipment { (board (square 9)) (piece \"Counter\" Each) (piece \"DoubleCounter\" Each) (regions \"RunnerGoal\" P1 (difference (sites Top) (sites Corners))) (regions \"RunnerGoalRed\" Neutral (intersection (difference (sites Top) (sites Corners)) (sites Phase 0))) (regions \"RunnerGoalPink\" Neutral (intersection (difference (sites Top) (sites Corners)) (sites Phase 1)))}) (rules (start { (place \"Counter1\" (difference (sites Bottom) (sites Corners))) (place \"DoubleCounter2\" (difference (sites Left) (sites Corners))) (place \"Counter2\" (difference (sites Right) (sites Corners)))}) (play (priority { (max Moves (or (forEach Piece \"Counter\" (\"HopCounter\" (from) Forward (then (if (can Move (\"HopCounter\" (last To) Forward)) (moveAgain))))) (forEach Piece \"DoubleCounter\" (\"HopCounter\" (from) Backward (then (if (can Move (\"HopCounter\" (last To) Backward)) (moveAgain))))))) (or (forEach Piece \"Counter\" (move Step (directions Forward) (to if:(is Empty (to))))) (forEach Piece \"DoubleCounter\" (move Step (directions Backward) (to if:(is Empty (to))))))})) (end { (if (no Moves Next) (result Next Loss)) (if (is In (last To) (sites Mover)) (result Mover Win))})))\n\n###\n\n", "completion": "(define \"HopCounter\" (move Hop (from #1) #2 (between if:(and (not (is In (between) (sites ToClear))) (\"IsEnemyAt\" (between))) (apply (remove (between) at:EndOfTurn))) (to if:(is Empty (to))) #3)) (game \"Gauntlet\" (players {(player N) (player W)}) (equipment { (board (square 10)) (piece \"Counter\" Each) (piece \"DoubleCounter\" Each) (regions \"RunnerGoal\" P1 (difference (sites Top) (sites Corners))) (regions \"RunnerGoalRed\" Neutral (intersection (difference (sites Top) (sites Corners)) (sites Phase 0))) (regions \"RunnerGoalPink\" Neutral (intersection (difference (sites Top) (sites Corners)) (sites Phase 1)))}) (rules (start { (place \"Counter1\" (difference (sites Bottom) (sites Corners))) (place \"DoubleCounter2\" (difference (sites Left) (sites Corners))) (place \"Counter2\" (difference (sites Right) (sites Corners)))}) (play (priority { (max Moves (or (forEach Piece \"Counter\" (\"HopCounter\" (from) Forward (then (if (can Move (\"HopCounter\" (last To) Forward)) (moveAgain))))) (forEach Piece \"DoubleCounter\" (\"HopCounter\" (from) Backward (then (if (can Move (\"HopCounter\" (last To) Backward)) (moveAgain))))))) (or (forEach Piece \"Counter\" (move Step (directions Forward) (to if:(is Empty (to))))) (forEach Piece \"DoubleCounter\" (move Step (directions Backward) (to if:(is Empty (to))))))})) (end { (if (no Moves Next) (result Next Loss)) (if (is In (last To) (sites Mover)) (result Mover Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\n8x8 board. The pieces move as follows: King (x1): one space in any direction' Queen (x1): moves one square diagonally. On its first move, the Queen may jump diagonally two squares. The Queen cannot capture when making this move. Bishop (x2): jumps exactly two squares diagonally; Knight (x2): moves one space orthogonally and then one space diagonally, jumping over the intervening spaces; Rook (x2): moves any distance orthogonally; Pawns (x8): move one square forward orthogonally or one square forward diagonally to capture. Pawns may move two squares on their first move, but only if there have been no captures yet in the game. When reaching the opposite edge of the board, pawns may be promoted to Queen if the Queen has already been taken. If the King can be captured on the opponent's next move, it is in check. The King must not be in check at the end of the player's turn. If this is impossible, it is checkmate, and the opponent wins. \n\n###\n\n", "completion": "(define \"CaptureForwardDiagonal\" (move Step (directions {FR FL}) (to if:(\"IsEnemyAt\" (to)) \"CaptureToPiece\"))) (define \"RememberMoved\" (set State at:#1 1)) (define \"MovedBefore\" (= 1 (state at:#1))) (define \"HadACapture\" (= (var) 1)) (define \"CaptureToPiece\" (apply (if (\"IsEnemyAt\" (to)) (remove (to) (then (set Var 1)))))) (game \"Acedrex (Alfonso)\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (\"ChessKing\" \"King\" (then (set Var 1))) (piece \"Queen\" Each (or (move Step Diagonal (to if:(not (\"IsFriendAt\" (to))) \"CaptureToPiece\")) (if (not (\"MovedBefore\" (from))) (move Hop Diagonal (between if:True) (to if:(is Empty (to))))) (then (if (not (\"MovedBefore\" (last To))) (\"RememberMoved\" (last To)))))) (piece \"Bishop\" Each (move Hop Diagonal (between if:True) (to if:(not (\"IsFriendAt\" (to))) \"CaptureToPiece\"))) (\"ChessKnight\" \"Knight\" (then (set Var 1))) (\"ChessRook\" \"Rook\" (then (set Var 1))) (piece \"Pawn\" Each (or { (if (and (not (\"HadACapture\")) (is In (from) (sites Start (piece (what at:(from)))))) (\"DoubleStepForwardToEmpty\")) \"StepForwardToEmpty\" \"CaptureForwardDiagonal\"} (then (if (and (\"IsOffBoard\" (where \"Queen\" Mover)) (is In (last To) (sites Mover \"Promotion\"))) (promote (last To) (piece \"Queen\") Mover))))) (regions \"Promotion\" P1 (sites Top)) (regions \"Promotion\" P2 (sites Bottom))}) (rules (start { (place \"Pawn1\" (sites Row 1)) (place \"Pawn2\" (sites Row 6)) (place \"Rook1\" {\"A1\" \"H1\"} 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 (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King\" Mover)))) (end (\"Checkmate\" \"King\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThis game is played on an empty 1row x n column board with m stones on each side. At each turn, each player must do one of the following actions. Move a stone forward (i.e., left to one player, right to the other) or jump over one enemy stone, landing on the immediate empty cell. The player who makes the last move wins the game. The game is played on a 1x5 board.\n\n###\n\n", "completion": "(define \"MoveOfThePiece\" (or (move Hop Forward (between if:(\"IsEnemyAt\" (between))) (to if:(is Empty (to)))) (\"StepForwardToEmpty\"))) (game \"Toads and Frogs\" (players 2) (equipment { (board (rectangle 1 5)) (piece \"Toad\" P1 E \"MoveOfThePiece\") (piece \"Frog\" P2 W \"MoveOfThePiece\")}) (rules (start { (place \"Toad1\" (expand (sites Left) steps:(- 2 1))) (place \"Frog2\" (expand (sites Right) steps:(- 2 1)))}) (play (forEach Piece)) (end (\"BlockWin\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\n5x12 board, played on the intersections of lines. Twelve pieces per player, arranged along the side of twelve closest to the player. Pieces move along a boustrophedon track, one player starting from left to right in their starting row and the other from right to left in their starting row. Moves are determined by the throw of six cowries: one mouth up = 1, two mouth up = 2, three mouths up = 3, four mouths up = 4, five mouths up = 1 (0 and 6 mouths up are not specified, but are between 10 and 20 and the move can be split to make captures). A player must roll 1 or (0 or 6) to begin. When a piece moves to a spot occupied by an opponent's piece, it is captured. The goal of the game is to reduce the other player to one or two pieces. 0 or 6 mouths correspond to 10.\n\n###\n\n", "completion": "(define \"RemovePiece\" (apply (if (\"IsEnemyAt\" (to)) (remove (to))))) (define \"CanMove\" (= (value Player Mover) 1)) (define \"AllowToBegin\" (is In (count Pips) (sites {0 1 5 6}))) (game \"Awangdu\" (players 2) (equipment { (board (rectangle 5 12) { (track \"Track1\" \"0,E,N1,W,N1,E,N1,W,N1,E\" P1 directed:True) (track \"Track2\" \"59,W,S1,E,S1,W,S1,E,S1,W\" P2 directed:True)} use:Vertex) (\"StickDice\" 6) (piece \"Disc\" Each (if (not (\"IsFriendAt\" (\"NextSiteOnTrack\" (mapEntry (var))))) (move (from) (to (\"NextSiteOnTrack\" (mapEntry (var))) (\"RemovePiece\"))))) (map {(pair 0 10) (pair 1 1) (pair 2 2) (pair 3 3) (pair 4 4) (pair 5 1) (pair 6 10)})}) (rules (start { (place \"Disc1\" (sites Bottom)) (place \"Disc2\" (sites Top))}) (play (\"RollMove\" (if (or (\"CanMove\") (\"AllowToBegin\")) (do (set Var (count Pips)) next:(forEach Piece (then (if (not (\"CanMove\")) (set Value Mover 1)))))))) (end (\"HavingLessPiecesLoss\" Next 2)))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe board is a square 8x8 -> The board is a square 10x10\n(define \"SizeStart\" 2) (game \"Bajr\" (players {(player NE) (player SW)}) (equipment { (board (square 8)) (piece \"Counter\" Each (\"StepToEmpty\" (directions {Forwards Leftward Rightward}))) (regions \"Home\" P1 (expand (intersection (sites Bottom) (sites Left)) steps:\"SizeStart\" Orthogonal)) (regions \"Home\" P2 (expand (intersection (sites Top) (sites Right)) steps:\"SizeStart\" Orthogonal)) (map {(pair P1 P2) (pair P2 P1)})}) (rules (start { (place \"Counter1\" (sites P1)) (place \"Counter2\" (sites P2))}) (play (forEach Piece)) (end (\"FillWin\" (sites (player (mapEntry (mover))))))))\n\n###\n\n", "completion": "(define \"SizeStart\" 3) (game \"Bajr\" (players {(player NE) (player SW)}) (equipment { (board (square 10)) (piece \"Counter\" Each (\"StepToEmpty\" (directions {Forwards Leftward Rightward}))) (regions \"Home\" P1 (expand (intersection (sites Bottom) (sites Left)) steps:\"SizeStart\" Orthogonal)) (regions \"Home\" P2 (expand (intersection (sites Top) (sites Right)) steps:\"SizeStart\" Orthogonal)) (map {(pair P1 P2) (pair P2 P1)})}) (rules (start { (place \"Counter1\" (sites P1)) (place \"Counter2\" (sites P2))}) (play (forEach Piece)) (end (\"FillWin\" (sites (player (mapEntry (mover)))))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"Three Men's Morris\" (players 2) (equipment { (\"ThreeMensMorrisBoard\") (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\"))))\n\n###\n\n", "completion": "3x3 intersecting lines with diagonals. Play occurs on the intersections of the lines. Each player has three pieces. Play begins with each player placing pieces on empty points. If they make three in a row along the lines, they win. Once all pieces are place, players take turns moving pieces one spot to an adjacent point along the lines trying to make three in a row. The pieces can move to any empty adjacent sites. END" }, { "prompt": "Construct a Ludii game based on the following description\nCross-shaped board, made of four 3x3 intersecting lines with diagonals. One player plays as the fox, which begins on the central space of the board. The other player plays as the lambs, who start in the spaces of one arm of the cross and the line of seven spots in front of that arm. Players alternate turns moving their pieces along the lines. The fox may capture one lamb by hopping over it in a straight line to an empty space on the opposite side of it. The fox wins by capturing seven lambs, the lambs win by blocking the fox so it cannot move. \n\n###\n\n", "completion": "(game \"Refskak\" (players 2) (equipment { (\"CrossBoard\" 3 7 use:Vertex diagonals:Alternating) (piece \"Lamb\" P1 \"StepToEmpty\") (piece \"Fox\" P2 (or \"HopCapture\" \"StepToEmpty\"))}) (rules (start { (place \"Fox2\" (centrePoint)) (place \"Lamb1\" (union (expand (sites Bottom) steps:2) (sites {\"A3\" \"B3\" \"F3\" \"G3\"})))}) (play (forEach Piece)) (end (\"NoMovesLossAndLessNumPiecesPlayerLoss\" P1 6)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nA board is dead if it contains at least one set of three stones in a straight orthogonal or diagonal line.\n \n A board that is not dead is alive.\n \n On their turn, a player must place a piece on an empty square of a living board.\n \n When all boards are dead, the player who made the last placement loses. \n\n###\n\n", "completion": "(game \"Notakto\" (players 2) (equipment { (board (union { (square 3) (shift 0 4 (square 3)) (shift 0 8 (square 3)) (shift 0 12 (square 3)) (shift 4 0 (square 3)) (shift 4 4 (square 3)) (shift 4 8 (square 3)) (shift 4 12 (square 3)) (shift 8 0 (square 3)) (shift 8 4 (square 3)) (shift 8 8 (square 3)) (shift 8 12 (square 3)) (shift 12 0 (square 3)) (shift 12 4 (square 3)) (shift 12 8 (square 3)) (shift 12 12 (square 3))})) (piece \"Marker\" Each)}) (rules (play (move Add (to (sites Empty) if:(= 0 (state at:(to)))) (then (if (is Line 3) (forEach Site (expand origin:(last To) steps:2) (set State at:(site) 1)))))) (end (if (no Moves Next) (result Mover Loss))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game is played on a 4x4 board. -> The game is played on a 5x5 board.\n(game \"Breakthrough\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 4)) (piece \"Pawn\" Each (or { \"StepForwardToEmpty\" (move Step (directions {FR FL}) (to if:(or (is Empty (to)) (\"IsEnemyAt\" (to))) (apply (remove (to)))))})) (regions P1 (sites Top)) (regions P2 (sites Bottom))}) (rules (start { (place \"Pawn1\" (expand (sites Bottom))) (place \"Pawn2\" (expand (sites Top)))}) (play (forEach Piece)) (end (\"ReachWin\" (sites Mover) Mover))))\n\n###\n\n", "completion": "(game \"Breakthrough\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 5)) (piece \"Pawn\" Each (or { \"StepForwardToEmpty\" (move Step (directions {FR FL}) (to if:(or (is Empty (to)) (\"IsEnemyAt\" (to))) (apply (remove (to)))))})) (regions P1 (sites Top)) (regions P2 (sites Bottom))}) (rules (start { (place \"Pawn1\" (expand (sites Bottom))) (place \"Pawn2\" (expand (sites Top)))}) (play (forEach Piece)) (end (\"ReachWin\" (sites Mover) Mover)))) 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 \"Chameleon\" (players 2) (equipment { (board (hex Diamond 10)) (piece \"Marker\" Each) (hand Shared size:2) (regions P1 {(sites Side NE) (sites Side SW)}) (regions P2 {(sites Side NW) (sites Side SE)})}) (rules (meta (swap)) (start { (place \"Marker1\" (handSite Shared)) (place \"Marker2\" (handSite Shared 1))}) (play (move (from (sites Hand Shared)) (to (sites Empty)) copy:True)) (end { (if (is Connected Mover) (result Mover Win)) (if (is Connected Next) (result Next Win))})))\n\n###\n\n", "completion": "(game \"Chameleon\" (players 2) (equipment { (board (hex Diamond 14)) (piece \"Marker\" Each) (hand Shared size:2) (regions P1 {(sites Side NE) (sites Side SW)}) (regions P2 {(sites Side NW) (sites Side SE)})}) (rules (meta (swap)) (start { (place \"Marker1\" (handSite Shared)) (place \"Marker2\" (handSite Shared 1))}) (play (move (from (sites Hand Shared)) (to (sites Empty)) copy:True)) (end { (if (is Connected Mover) (result Mover Win)) (if (is Connected Next) (result Next Win))}))) 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 \"PiecesOwnedBy\" (count at:(mapEntry #1))) (define \"Columns\" 7) (game \"Chongka'\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" { (track \"Track1\" \"7,W,WNW,ENE,E\" loop:True P1) (track \"Track2\" \"7,W,N,E,ESE\" loop:True P2)}) (piece \"Seed\" Shared) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 FirstSite) (pair P2 LastSite)})}) (rules (start (set Count 7 to:(union (sites P1) (sites P2)))) (play (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover)) if:(> (count at:(from)) 0)) (then (sow \"Track\" owner:(mover) apply:(if (and { (> (count at:(to)) 1) (is In (to) (union (sites P1) (sites P2)))}) (moveAgain) (if (and (is In (to) (sites Mover)) (> (count at:(\"OppositePit\" (to))) 0)) (fromTo (from (\"OppositePit\" (to))) (to (mapEntry Mover)) count:(count at:(\"OppositePit\" (to)))))))))) (end (\"MancalaByScoreWhen\" (and (no Moves Mover) (no Moves Next))))))\n\n###\n\n", "completion": "2x7 board with two stores. Seven counters in each hole. Players move from one of the holes in their row, sowing in a clockwise direction, and including the player's store, which is to the left, but not the opponent's store. If the final counter of a sowing lands in an occupied hole (not a store), sowing continues. If it lands into an empty hole, the turn is over. If the empty hole is in the player's own row, the contents of the hole opposite in the opponent's row are captured and placed in the store. The person who captures the most counters wins. END" }, { "prompt": "Construct a Ludii game based on the following description\nOverflow is played on a checkered board initially filled with neutral stackable pieces, one per square.\n The dark squares make up the house of the Dark player, and the light squares make up the house of the Light player. The goal is to empty your opponent's house.\n \n There are two types of moves in Overflow, both of which are sowing moves, somewhat akin to what you see in mancalas. All moves are bound by the restriction that there must always be exactly one orthodiagonally connected group of stacks on the board. The one kind of sowing only drops pieces onto already occupied squares and the other kind spills out of both the group of already occupied squares and out of the board itself, hence the names: contained moves and overflow moves.\n \n Sowing in general:\n Sowing in general is picking up a stack from any square and distributing its pieces along one of the 8 directions onto a contiguous line of squares \u2013 usually placing one of the N pieces from the chosen stack in each of the N or so squares in the sowing direction. The details are given below.\n \n Overflow moves:\n An overflow move involves sowing into empty squares \u2013 possibly in addition to occupied squares \u2013 and over the edge of the board. It's important to remember that these two things always go together in this game, namely (1) sowing over the edge and (2) sowing into empty squares. That is to say, if you are to sow into one or more empty squares, the number of squares in the chosen sowing direction must be smaller than the number of stones in the chosen stack. The pieces that end up outside the board are removed from the game.\n \n Contained moves:\n Contained moves only sow onto already occupied squares. A contained move must sow the chosen stack as far as possible. If it's impossible to sow each of the pieces in the stack into an occupied square of its own, you place the remainder of the pieces on the last occupied square you reached. You are not obligated to chose the stack that can be sown the farthest, but whatever stack you chose, if you do not make an overflow move move with it, you must chose a sowing direction that allows you to sow onto as many occupied squares as possible.\n \n You may always chose freely between contained moves and overflow moves when both kinds are available.\n \n Note that no stack will have both a contained move and an overflow move available in the same direction. All moves are completely determined by the choice of stack and direction. A 6x6 board is currently selected\n\n###\n\n", "completion": "(define \"UpdateScores\" (and (set Score P1 (count Sites in:(forEach (sites Phase 1) if:(is Occupied (site))))) (set Score P2 (count Sites in:(forEach (sites Phase 0) if:(is Occupied (site))))))) (define \"DistanceToEndSquare\" (count Sites in:(sites Direction from:(last From) (\"LastDirection\" Cell) stop:(is Empty (to)) distance:(size Stack at:(last From))))) (define \"EnoughSpaceInDirection\" (<= (size Stack at:(from)) (count Sites in:(sites Direction from:(from) (directions Cell from:(from) to:#1) distance:(size Stack at:(from)))))) (define \"ZeroEmptyInRangeInDirection\" (= 0 (count Sites in:(intersection (sites Empty) (sites Direction from:(from) (directions Cell from:(from) to:#1) distance:(size Stack at:(from))))))) (define \"ContainedMove\" (move Select (from (sites Occupied by:P1)) (to (sites Around (from) NotEmpty) if:(and (or (\"EnoughSpaceInDirection\" (to)) (\"ZeroEmptyInRangeInDirection\" (to))) (all Sites (sites Around (from) NotEmpty) if:(not (and (< (count Sites in:(sites Direction from:(from) (directions Cell from:(from) to:(to)) stop:(is Empty (to)) distance:(size Stack at:(from)))) (count Sites in:(sites Direction from:(from) (directions Cell from:(from) to:(site)) stop:(is Empty (to)) distance:(size Stack at:(from))))) (or (\"EnoughSpaceInDirection\" (site)) (\"ZeroEmptyInRangeInDirection\" (site)))))))) (then (forEach Site (sites Direction from:(last From) (\"LastDirection\" Cell) stop:(is Empty (to)) distance:(size Stack at:(last From))) (if (= (\"DistanceToEndSquare\") (count Steps (last From) (site))) (add (piece \"Disc1\") (to (site)) count:(- (size Stack at:(last From)) (- (\"DistanceToEndSquare\") 1)) stack:True) (add (piece \"Disc1\") (to (site)) stack:True)))))) (define \"OverflowMove\" (move Select (from (sites Occupied by:P1)) (to (sites Around (from)) if:(and (not (\"EnoughSpaceInDirection\" (to))) (not (\"ZeroEmptyInRangeInDirection\" (to))))) (then (forEach Site (sites Direction from:(last From) (\"LastDirection\" Cell) distance:(size Stack at:(last From))) (add (piece \"Disc1\") (to (site)) stack:True))))) (game \"Overflow\" (players 2) (equipment { (board (square 6)) (piece \"Disc\" P1)}) (rules (start { (place \"Disc1\" (sites Board)) (set Score P1 (count Sites in:(sites Phase 1))) (set Score P2 (count Sites in:(sites Phase 0)))}) (play (do (or (\"ContainedMove\") (\"OverflowMove\") (then (remove (last From) count:(size Stack at:(last From))))) ifAfterwards:(= 1 (count Groups)) (then (\"UpdateScores\")))) (end (if (= 0 (* (score P1) (score P2))) (byScore))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6 board with two stores. Four counters in each hole. Sowing occurs in an anti-clockwise direction from a hole in the player's row. If the final counter falls into a hole in the opponent's row containing two counters, making it contain three, they are captured. Any holes containing three counters in an unbroken line behind it in the opponent's row are also captured. A player cannot sow into a hole from which they sowed until it has been sown into by the opponent. Play continues until no more captures are possible, and the players win the counters they captured and the counters on their side of the board. A new round begins. The player with fewer counters fills up their holes from right to left with four counters. The opponent fills the same number of holes, and continues to play, holding any remaining counters for future rounds, if necessary. Play proceeds as before with the present number of holes in play. Play continues until one player cannot fill any holes. \n\n###\n\n", "completion": "(define \"NoMoreCapturePossible\" (not (can Move (or (move Select (from (sites (values Remembered \"OwnedP1\")) if:(and (not (is In (from) (values Remembered \"P1SowFrom\"))) (< 0 (count at:(from)))))) (move Select (from (sites (values Remembered \"OwnedP2\")) if:(and (not (is In (from) (values Remembered \"P2SowFrom\"))) (< 0 (count at:(from)))))))))) (define \"RemmemberNextOwnedHoles\" (if (is Next P1) (remember Value \"OwnedP1\" #1) (remember Value \"OwnedP2\" #1))) (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 \"ForgetValue\" (if (is Mover P1) (forget Value \"OwnedP1\" #1) (forget Value \"OwnedP2\" #1))) (define \"RightMostEmpty\" (trackSite FirstSite \"TrackCW\" from:(mapEntry \"RightMost\" Mover) if:(is Empty (to)))) (define \"NoPieceOnBoard\" (all Sites (union (sites P1) (sites P2)) if:(= 0 (count at:(site))))) (define \"NextHole\" (\"NextSiteOnTrack\" #2 from:#1 \"Track\")) (define \"PossibleSowFrom\" (if (is Mover P1) (not (is In (from) (values Remembered \"P1SowFrom\"))) (not (is In (from) (values Remembered \"P2SowFrom\"))))) (define \"PiecesOwnedBy\" (+ (count at:(mapEntry #1)) (count in:(sites #1)))) (define \"Columns\" 6) (game \"Adi\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" { (track \"TrackCCW\" \"1,E,N,W\" loop:True) (track \"TrackCW\" \"6,W,N,E\" loop:True)}) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 FirstSite) (pair P2 LastSite)}) (piece \"Seed\" Shared) (map \"RightMost\" {(pair P1 6) (pair P2 7)}) (map \"CorrespondingHoles\" {(pair 1 12) (pair 2 11) (pair 3 10) (pair 4 9) (pair 5 8) (pair 6 7) (pair 7 6) (pair 8 5) (pair 9 4) (pair 10 3) (pair 11 2) (pair 12 1)})}) (rules (start { (set Count 4 to:(sites Track)) (set RememberValue \"OwnedP1\" (sites Bottom)) (set RememberValue \"OwnedP2\" (sites Top))}) phases:{ (phase \"Sowing\" (play (or { (move Select (from (\"OwnedHoles\") if:(and (\"PossibleSowFrom\") (< 0 (count at:(from))))) (then (and { (sow \"TrackCCW\" if:(and (is In (to) (sites Next)) (= (count at:(to)) 3)) apply:(fromTo (from (to)) (to (mapEntry (mover))) count:(count at:(to))) backtracking:True) (forEach Value (array (sites Track from:(last From) to:(\"NextHole\" (last From) (min 12 (count at:(last From)))))) (if (is Mover P1) (if (is In (value) (values Remembered \"P2SowFrom\")) (forget Value \"P2SowFrom\" (value))) (if (is In (value) (values Remembered \"P1SowFrom\")) (forget Value \"P1SowFrom\" (value))))) (if (is Mover P1) (remember Value \"P1SowFrom\" (last From)) (remember Value \"P2SowFrom\" (last From)))})))} (then (if (\"NoMoreCapturePossible\") (and { (forEach Site (sites P1) (if (< 0 (count at:(site))) (fromTo (from (site)) (to (mapEntry P1)) count:(count at:(site))))) (forEach Site (sites P2) (if (< 0 (count at:(site))) (fromTo (from (site)) (to (mapEntry P2)) count:(count at:(site))))) (forget Value \"OwnedP1\" All) (forget Value \"OwnedP2\" All) (forget Value \"P1SowFrom\" All) (forget Value \"P2SowFrom\" All) (if (>= (+ (count at:(mapEntry P2)) (count in:(sites P2))) (+ (count at:(mapEntry P1)) (count in:(sites P1)))) (set NextPlayer (player 1)) (set NextPlayer (player 2)))}))))) (end (if (\"NoPieceOnBoard\") { (if (> 4 (count at:(mapEntry P1))) (result P2 Win)) (if (> 4 (count at:(mapEntry P2))) (result P1 Win))})) (nextPhase (\"NoPieceOnBoard\") \"BetweenRounds\")) (phase \"BetweenRounds\" (play (if (<= 4 (count at:(mapEntry Mover))) (move (from (mapEntry Mover)) (to (\"RightMostEmpty\")) count:4 (then (and (\"RemmemberOwnedHoles\" (last To)) (if (<= 4 (count at:(mapEntry Mover))) (moveAgain) (forEach Site (sites Mover) (if (is Occupied (site)) (and (fromTo (from (mapEntry Next)) (to (mapEntry \"CorrespondingHoles\" (site))) count:(count at:(site))) (\"RemmemberNextOwnedHoles\" (mapEntry \"CorrespondingHoles\" (site)))))))))))) (nextPhase (> 4 (count at:(mapEntry Mover))) \"Sowing\"))})) 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 King (king): moves one space orthogonally or diagonally. 1 x Queen: One square diagonally. 2 x Rook: Any number of spaces orthogonally. 2 x Fil (elephant): Two squares diagonally, jumping over the first. Cannot capture another Fil. 2 x Knight: Moves as a chess knight. 8 x Pawn: Moves one space forward orthogonally; one space forward diagonally to capture. No en passant. Promoted to Queen when reaching the eighth rank. The pieces begin in the following position: Fils on the third and sixth spaces of the first row, King on the fifth space of the first row, Rooks on the third and sixth spaces of the second row, Knights on the fourth and fifth spaces of the second row, Pawns on the third row, the Queen sharing a space with the Pawn in the fifth space. Kings are on the same column. The only time two pieces can be on the same space is in this initial arrangement. No castling. An opponent's piece is captured by moving a player's own piece onto a space occupied by the opponent's piece. When a King can be captured on the next turn by an opponent's piece, it is in check. The King must not be in check at the end of the player's turn. If this is not possible, it is checkmate and the opponent wins. Stalemate results in a win for that player causing it. Capturing all of an opponent's pieces except the King also results in a win.\n \n\n###\n\n", "completion": "(define \"NextCanNotMove\" (not (can Move (do (forEach Piece Next) ifAfterwards:(not (\"IsInCheck\" \"King\" Next)))))) (define \"CaptureForwardDiagonal\" (move Step (from (from) level:(level)) (directions {FR FL}) (to if:(\"IsEnemyAt\" (to)) (apply (forEach Level (to) (remove (to) level:(level))))))) (define \"CaptureToPiece\" (apply (if (\"IsEnemyAt\" (to)) (forEach Level (to) (remove (to) level:(level)))))) (game \"Short Assize\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (piece \"King\" Each (move Step (from (from) level:(level)) (to if:(not (\"IsFriendAt\" (to))) \"CaptureToPiece\"))) (piece \"Rook\" Each (move Slide (from (from) level:(level)) Orthogonal (to if:(\"IsEnemyAt\" (to)) \"CaptureToPiece\"))) (piece \"Bishop\" Each (move Hop (from (from) level:(level)) Diagonal (between if:True) (to if:(not (\"IsFriendAt\" (to))) \"CaptureToPiece\"))) (piece \"Knight\" Each (move Leap (from (from) level:(level)) \"KnightWalk\" (to if:(not (\"IsFriendAt\" (to))) \"CaptureToPiece\"))) (piece \"Queen\" Each (move Step (from (from) level:(level)) Diagonal (to if:(not (\"IsFriendAt\" (to))) \"CaptureToPiece\"))) (piece \"Pawn\" Each (or (move Step (from (from) level:(level)) Forward (to if:(is Empty (to)))) \"CaptureForwardDiagonal\" (then (if (is In (last To) (sites Mover \"Promotion\")) (promote (last To) (piece (id \"Queen\" Mover))))))) (regions \"Promotion\" P1 (sites Top)) (regions \"Promotion\" P2 (sites Bottom))}) (rules (start { (place \"Bishop1\" (sites {\"C1\" \"F1\"})) (place \"Rook1\" (sites {\"C2\" \"F2\"})) (place \"Knight1\" (sites {\"D2\" \"E2\"})) (place \"King1\" coord:\"E1\") (place Stack \"Pawn1\" (sites Row 2)) (place Stack \"Queen1\" (sites {\"D3\"})) (place \"Bishop2\" (sites {\"C8\" \"F8\"})) (place \"Rook2\" (sites {\"C7\" \"F7\"})) (place \"Knight2\" (sites {\"D7\" \"E7\"})) (place \"King2\" coord:\"E8\") (place Stack \"Pawn2\" (sites Row 5)) (place Stack \"Queen2\" (sites {\"D6\"}))}) (play (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King\" Mover)))) (end { (if (and (\"IsInCheck\" \"King\" Next) (\"NextCanNotMove\")) (result Mover Win)) (\"BlockWin\") (if (= (count Pieces Next) 1) (result Mover Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe player must color in the circles on the intersections. Numbers in the squares indicate the number of adjacent circles which should be colored. \n\n###\n\n", "completion": "(game \"Squaro\" (players 1) (equipment { (board (square 6) (values Vertex (range 0 1)) use:Vertex) (hints { (hint 0 3) (hint 1 3) (hint 2 2) (hint 3 0) (hint 4 2) (hint 5 3) (hint 6 2) (hint 7 1) (hint 8 0) (hint 9 2) (hint 10 2) (hint 11 1) (hint 12 2) (hint 13 2) (hint 14 3) (hint 15 3) (hint 16 3) (hint 17 4) (hint 18 3) (hint 19 2) (hint 20 3) (hint 21 4) (hint 22 4) (hint 23 3) (hint 24 1)} Cell) (regions \"AllSites\" (sites Board))}) (rules (play (satisfy (forAll Cell (is Count Vertex (sites Incident Vertex of:Cell at:(from)) of:1 (hint Cell at:(from)))))) (end (if (is Solved) (result P1 Win))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nSeega rules applied to a 17x17 board. -> Kharebga rules applied to a 17x18 board.\n(define \"Custodial\" (custodial (from (last To)) Orthogonal (between (max 1) if:(= (what at:(between)) (id #1)) (apply (remove (between)))) (to if:(\"FriendOrCentre\")))) (define \"JarlButNotTheExpandedCentre\" (and (= (what at:(between)) (id \"Jarl2\")) (and (!= (between) (\"Castle\")) (not (is In (between) (sites \"OrthogonalSitesCentre\")))))) (define \"JarlAndExpandedCentre\" (and (= (what at:(between)) (id \"Jarl2\")) (or (= (between) (\"Castle\")) (is In (between) (sites \"OrthogonalSitesCentre\"))))) (define \"FriendOrCentre\" (or (\"IsFriendAt\" (to)) (= (to) (\"Castle\")))) (define \"CaptureJarl\" (apply (trigger \"Surrounded\" P2))) (define \"JarlWasCaptured\" (is Triggered \"Surrounded\" P2)) (define \"Castle\" (centrePoint)) (define \"Custodial\" (custodial (from (last To)) Orthogonal (between (max 1) if:(= (what at:(between)) (id #1)) (apply (remove (between)))) (to if:(\"FriendOrCentre\")))) (define \"JarlButNotTheExpandedCentre\" (and (= (what at:(between)) (id \"Jarl2\")) (and (!= (between) (\"Castle\")) (not (is In (between) (sites \"OrthogonalSitesCentre\")))))) (define \"JarlAndExpandedCentre\" (and (= (what at:(between)) (id \"Jarl2\")) (or (= (between) (\"Castle\")) (is In (between) (sites \"OrthogonalSitesCentre\"))))) (define \"FriendOrCentre\" (or (\"IsFriendAt\" (to)) (= (to) (\"Castle\")))) (define \"CaptureJarl\" (apply (trigger \"Surrounded\" P2))) (define \"JarlWasCaptured\" (is Triggered \"Surrounded\" P2)) (define \"Castle\" (centrePoint)) (define \"NoRepetition\" (meta (no Repeat))) (game \"Poprad Game\" (players 2) (equipment { (board (square 17)) (piece \"Marker\" Each (\"StepToEmpty\" Orthogonal (then (\"CustodialCapture\" Orthogonal (max 1))))) (hand Each)}) (rules (\"NoRepetition\") (start (place \"Marker\" \"Hand\" count:144)) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (difference (sites Board) (centrePoint)) if:(is Empty (to))) (then (if (and (is Occupied (handSite Mover)) (\"NewTurn\")) (moveAgain))))) (nextPhase Mover (is Empty (handSite Mover)) \"Capture\")) (\"PhaseMovePiece\" \"Capture\")} (end (\"HavingLessPiecesLoss\" Next 1))))\n\n###\n\n", "completion": "(define \"Custodial\" (custodial (from (last To)) Orthogonal (between (max 1) if:(= (what at:(between)) (id #1)) (apply (remove (between)))) (to if:(\"FriendOrCentre\")))) (define \"JarlButNotTheExpandedCentre\" (and (= (what at:(between)) (id \"Jarl2\")) (and (!= (between) (\"Castle\")) (not (is In (between) (sites \"OrthogonalSitesCentre\")))))) (define \"JarlAndExpandedCentre\" (and (= (what at:(between)) (id \"Jarl2\")) (or (= (between) (\"Castle\")) (is In (between) (sites \"OrthogonalSitesCentre\"))))) (define \"FriendOrCentre\" (or (\"IsFriendAt\" (to)) (= (to) (\"Castle\")))) (define \"CaptureJarl\" (apply (trigger \"Surrounded\" P2))) (define \"JarlWasCaptured\" (is Triggered \"Surrounded\" P2)) (define \"Castle\" (centrePoint)) (define \"Custodial\" (custodial (from (last To)) Orthogonal (between (max 1) if:(= (what at:(between)) (id #1)) (apply (remove (between)))) (to if:(\"FriendOrCentre\")))) (define \"JarlButNotTheExpandedCentre\" (and (= (what at:(between)) (id \"Jarl2\")) (and (!= (between) (\"Castle\")) (not (is In (between) (sites \"OrthogonalSitesCentre\")))))) (define \"JarlAndExpandedCentre\" (and (= (what at:(between)) (id \"Jarl2\")) (or (= (between) (\"Castle\")) (is In (between) (sites \"OrthogonalSitesCentre\"))))) (define \"FriendOrCentre\" (or (\"IsFriendAt\" (to)) (= (to) (\"Castle\")))) (define \"CaptureJarl\" (apply (trigger \"Surrounded\" P2))) (define \"JarlWasCaptured\" (is Triggered \"Surrounded\" P2)) (define \"Castle\" (centrePoint)) (define \"NoRepetition\" (meta (no Repeat))) (game \"Poprad Game\" (players 2) (equipment { (board (rectangle 17 18)) (piece \"Marker\" Each (move Slide Orthogonal (then (\"CustodialCapture\" Orthogonal (max 1))))) (hand Each)}) (rules (\"NoRepetition\") (start (place \"Marker\" \"Hand\" count:152)) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (difference (sites Board) (centrePoint)) if:(is Empty (to))) (then (if (and (is Occupied (handSite Mover)) (\"NewTurn\")) (moveAgain))))) (nextPhase Mover (is Empty (handSite Mover)) \"Capture\")) (\"PhaseMovePiece\" \"Capture\")} (end (\"HavingLessPiecesLoss\" Next 1)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe game is played on a cruciform board adapted from an Alquerque board. One player plays as the fox, the other as the geese. The geese begin in a set starting position; the person playing as the fox may choose any available spot to place the fox as their first move. Players move as in Alquerque, but only the fox can hop to capture. The goal of the geese is to block the fox from being able to move; the fox's goal is to capture all of the geese. The game starts with 13 geese.\n\n###\n\n", "completion": "(game \"Fox and Geese\" (players 2) (equipment { (\"CrossBoard\" 3 7 use:Vertex diagonals:Alternating) (hand P1) (piece \"Fox\" P1 (or (\"HopCapture\") \"StepToEmpty\")) (piece \"Goose\" P2 \"StepToEmpty\")}) (rules (start { (place \"Goose2\" (union (expand (sites Bottom)) (sites Row 2))) (place \"Fox1\" (handSite P1))}) phases:{ (phase \"Placement\" P1 (play (move (from (handSite P1)) (to (sites Empty)))) (nextPhase (\"HandEmpty\" P1) \"Movement\")) (phase \"Movement\" (play (forEach Piece)))} (end (\"NoMovesLossAndNoPiecesPlayerLoss\" P2)))) 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 King (king): moves one space orthogonally or diagonally. The King may leap to the second or third square on its first move, or move as a Knight, and does not hop over an opponent's piece. The King also cannot capture with this move. 1 x Queen: One square diagonally. On its first move, the Queen may jump diagonally two squares. The Queen cannot capture when making this move. 2 x Rook: Any number of spaces orthogonally. 2 x Bishop: Two squares diagonally, jumping over the first. Cannot capture another Bishop. 2 x Knight: Moves one space orthogonally and then one space diagonally, jumping over any intervening pieces. 8 x Pawn: Moves one space forward orthogonally; one space forward diagonally to capture. May move two spaces on its first move. En passant is not allowed. Promoted to Queen when reaching the eighth rank, and may make the Queen's leap on its first move after being promoted. If this promotion is made with the opponent's King at the distance of the extended move, it does not give check on that turn. No castling. An opponent's piece is captured by moving a player's own piece onto a space occupied by the opponent's piece. When a King can be captured on the next turn by an opponent's piece, it is in check. The King must not be in check at the end of the player's turn. If this is not possible, it is checkmate and the opponent wins. Stalemate results in a draw. \n \n\n###\n\n", "completion": "(define \"PieceHasMoved\" (set State at:#1 0)) (define \"RememberPieceHasMoved\" (then (if (= (state at:(last To)) 1) (\"PieceHasMoved\" (last To))))) (game \"Lombard Chess\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (piece \"King\" Each (or (\"StepToNotFriend\") (if (= 1 (state at:(from))) (or (move Hop (between (range 1 2) if:(not (\"IsEnemyAt\" (between)))) (to if:(is Empty (to)))) (\"LeapToEmpty\" \"KnightWalk\"))) (\"RememberPieceHasMoved\"))) (\"ChessRook\" \"Rook\") (piece \"Bishop\" Each (move Hop Diagonal (between if:True) (to if:(not (\"IsFriendAt\" (to))) (apply (if (\"IsEnemyAt\" (to)) (remove (to))))))) (\"ChessKnight\" \"Knight\") (piece \"Queen\" Each (or (\"StepToNotFriend\" Diagonal \"RememberPieceHasMoved\") (if (= 1 (state at:(from))) (move Hop Diagonal (between if:True) (to if:(is Empty (to))))) (\"RememberPieceHasMoved\"))) (\"ChessPawn\" \"Pawn\" (if (is In (from) (sites Start (piece (what at:(from))))) (\"DoubleStepForwardToEmpty\")) (then (if (is In (last To) (sites Mover \"Promotion\")) (and (promote (last To) (piece (id \"Queen\" Mover))) (set State at:(last To) 1))))) (regions \"Promotion\" P1 (sites Top)) (regions \"Promotion\" P2 (sites Bottom))}) (rules (start { (place \"Pawn1\" (sites Row 1)) (place \"Pawn2\" (sites Row 6)) (place \"Rook1\" {\"A1\" \"H1\"}) (place \"Knight1\" {\"B1\" \"G1\"}) (place \"Bishop1\" {\"C1\" \"F1\"}) (place \"Queen1\" coord:\"D1\" state:1) (place \"King1\" coord:\"E1\" state:1) (place \"Rook2\" {\"A8\" \"H8\"}) (place \"Knight2\" {\"B8\" \"G8\"}) (place \"Bishop2\" {\"C8\" \"F8\"}) (place \"Queen2\" coord:\"D8\" state:1) (place \"King2\" coord:\"E8\" state:1)}) (play (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King\" Mover)) (then (if (and (= 1 (state at:(where \"King\" Next))) (\"IsInCheck\" \"King\" Next)) (\"PieceHasMoved\" (where \"King\" Next)))))) (end { (\"Checkmate\" \"King\") (\"DrawIfNoMoves\" Next)}))) 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.\nChecks if a site is phase 0.\n\n###\n\n", "completion": "(define \"IsPhaseZero\" (= 0 (phase of:#1))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2048 is played on a plain 4\u00d74 grid, with numbered tiles that slide when a player moves them. Every turn, a new tile randomly appears in an empty spot on the board with a value of either 2 or 4. Tiles slide as far as possible in the chosen direction until they are stopped by either another tile or the edge of the grid. If two tiles of the same number collide while moving, they will merge into a tile with the total value of the two tiles that collided. The resulting tile cannot merge with another tile again in the same move. The game is won when a tile with a value of 2048 appears on the board. \n\n###\n\n", "completion": "(define \"ApplySlideS\" (seq { (\"ApplySlideLine\" Row 1 S) (\"ApplySlideLine\" Row 2 S) (\"ApplySlideLine\" Row 3 S) (\"ResetState\")})) (define \"ApplySlideN\" (seq { (\"ApplySlideLine\" Row 2 N) (\"ApplySlideLine\" Row 1 N) (\"ApplySlideLine\" Row 0 N) (\"ResetState\")})) (define \"ApplySlideE\" (seq { (\"ApplySlideLine\" Column 2 E) (\"ApplySlideLine\" Column 1 E) (\"ApplySlideLine\" Column 0 E) (\"ResetState\")})) (define \"ApplySlideW\" (seq { (\"ApplySlideLine\" Column 1 W) (\"ApplySlideLine\" Column 2 W) (\"ApplySlideLine\" Column 3 W) (\"ResetState\")})) (define \"ResetState\" (forEach Site (sites State 1) (set State at:(site) 0))) (define \"ApplySlideLine\" (forEach Site (sites #1 #2) (if (is Occupied (site)) (if (and (= (what at:(site)) (what at:(\"LineOfSightPiece\" #3))) (= 0 (state at:(\"LineOfSightPiece\" #3)))) (and { (remove (site)) (remove (\"LineOfSightPiece\" #3)) (add (piece (mapEntry \"Promotion\" (what at:(site)))) (to (\"LineOfSightPiece\" #3))) (set State at:(\"LineOfSightPiece\" #3) 1) (addScore P1 (mapEntry \"Score\" (mapEntry \"Promotion\" (what at:(site)))))}) (if (!= 0 (count Sites in:(\"LineOfSightEmpty\" #3))) (fromTo (from (site)) (to (\"LineOfSightEmpty\" #3)))))))) (define \"LineOfSightEmpty\" (sites LineOfSight Farthest at:(site) #1)) (define \"LineOfSightPiece\" (regionSite (sites LineOfSight Piece at:(site) #1) index:0)) (define \"SlideS\" (move Select (from 10) (to 6) (then #1))) (define \"SlideN\" (move Select (from 6) (to 10) (then #1))) (define \"SlideE\" (move Select (from 5) (to 6) (then #1))) (define \"SlideW\" (move Select (from 6) (to 5) (then #1))) (define \"CanSlideS\" (\"CanSlide\" Bottom S)) (define \"CanSlideN\" (\"CanSlide\" Top N)) (define \"CanSlideE\" (\"CanSlide\" Right E)) (define \"CanSlideW\" (\"CanSlide\" Left W)) (define \"CanSlide\" (not (all Sites (difference (sites Occupied by:Shared) (sites #1)) if:(and (= 0 (count Sites in:(sites LineOfSight Farthest at:(site) #2))) (!= (what at:(site)) (what at:(regionSite (sites LineOfSight Piece at:(site) #2) index:0))))))) (game \"2048\" (players 1) (equipment { (board (square 4)) (piece \"Square2\" Shared) (piece \"Square4\" Shared) (piece \"Square8\" Shared) (piece \"Square16\" Shared) (piece \"Square32\" Shared) (piece \"Square64\" Shared) (piece \"Square128\" Shared) (piece \"Square256\" Shared) (piece \"Square512\" Shared) (piece \"Square1024\" Shared) (piece \"Square2048\" Shared) (map \"Promotion\" { (pair (id \"Square2\" Shared) (id \"Square4\" Shared)) (pair (id \"Square4\" Shared) (id \"Square8\" Shared)) (pair (id \"Square8\" Shared) (id \"Square16\" Shared)) (pair (id \"Square16\" Shared) (id \"Square32\" Shared)) (pair (id \"Square32\" Shared) (id \"Square64\" Shared)) (pair (id \"Square64\" Shared) (id \"Square128\" Shared)) (pair (id \"Square128\" Shared) (id \"Square256\" Shared)) (pair (id \"Square256\" Shared) (id \"Square512\" Shared)) (pair (id \"Square512\" Shared) (id \"Square1024\" Shared)) (pair (id \"Square1024\" Shared) (id \"Square2048\" Shared))}) (map \"Score\" { (pair (id \"Square2\" Shared) 2) (pair (id \"Square4\" Shared) 4) (pair (id \"Square8\" Shared) 8) (pair (id \"Square16\" Shared) 16) (pair (id \"Square32\" Shared) 32) (pair (id \"Square64\" Shared) 64) (pair (id \"Square128\" Shared) 128) (pair (id \"Square256\" Shared) 256) (pair (id \"Square512\" Shared) 512) (pair (id \"Square1024\" Shared) 1024) (pair (id \"Square2048\" Shared) 2048)})}) (rules (start (place Random {\"Square2\"} count:2)) (play (or { (if (\"CanSlideW\") (\"SlideW\" (\"ApplySlideW\"))) (if (\"CanSlideE\") (\"SlideE\" (\"ApplySlideE\"))) (if (\"CanSlideN\") (\"SlideN\" (\"ApplySlideN\"))) (if (\"CanSlideS\") (\"SlideS\" (\"ApplySlideS\")))} (then (if (< (value Random (range 1 8)) 2) (add (piece \"Square4\") (to (sites Random (sites Empty) num:1))) (add (piece \"Square2\") (to (sites Random (sites Empty) num:1))))))) (end { (if (\"IsNotOffBoard\" (where \"Square2048\" Shared)) (result Mover Win)) (if (no Moves Next) (result Mover Loss))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\n5x5 intersecting lines, with diagonals drawn in each quadrant. Ten pieces per player, which begin on the two rows closes to the player. Players alternate turns moving a piece to an empty adjacent spot along the lines. A piece may capture an opponent's piece by hopping over it along the lines of the board to an empty spot immediately on the opposite side of the opponent's piece. The player who captures all of the opponent's pieces wins. Each player has 10 pieces.\n\n###\n\n", "completion": "(game \"Terhuchu (Small)\" (players 2) (equipment { (\"AlquerqueBoard\" 5 5) (piece \"Marker\" Each (or (\"StepToEmpty\") (\"HopCapture\")))}) (rules (start { (place \"Marker1\" (expand (sites Bottom))) (place \"Marker2\" (expand (sites Top)))}) (play (forEach Piece)) (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nA triangle, with a point in the center and lines connecting it to the apex and the midpoints of the two sides which meet at the apex. One person plays as the tiger, which begins on the apex. The other person plays as three people. Players alternate turns, with the person playing as the people first placing a person on the board, and then the tiger moving to an empty adjacent spot along the lines of the board. When all of the people have been placed, the people move on the board in the same fashion. The tiger may capture one of the people by jumping over it to an empty adjacent spot immediately on the opposite side of one of the people along the lines of the board. The tiger wins when it captures one person, the people win when they can block the tiger from being able to move. \n\n###\n\n", "completion": "(game \"Mysore Tiger Game\" (players 2) (equipment { (board (add (remove (scale 1 2 (wedge 3)) vertices:{5}) edges:{{4 5}}) use:Vertex) (hand P1) (piece \"Human\" P1 (\"StepToEmpty\")) (piece \"Tiger\" P2 (or (\"StepToEmpty\") (\"HopCapture\")))}) (rules (start { (place \"Human1\" (handSite P1) count:3) (place \"Tiger2\" (sites Top))}) phases:{ (phase \"Opening\" P1 (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (\"PhaseMovePiece\" \"Movement\")} (end { (if (no Moves P2) (result P1 Win)) (if (< (count Pieces P1) 3) (result P2 Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\n4x8 board. 32 counters per player. Players may arrange the counters however they like in their holes. Players sow by taking the counters from one of their holes and dropping them one by one in an anti-clockwise direction only in the two rows closest to them. When the last counter lands in an empty hole, the turn is over. When the last counter falls into an occupied hole, the contents of this hole are picked up and sowing continues. If the final counter falls into an occupied hole in the inner row, and the two holes opposite it in the opponent's rows are occupied, the counters in these two rows of the opponent are taken. They are then sown on the player's side of the board beginning from the hole that received the first counter of the sowing that led to the capture. Both of the opponent's holes must be occupied to capture. Clockwise sowing is allowed in certain circumstances. If a clockwise move from the four holes on the left hand side of the players board (i.e., the left two holes in the outer row or the left two hole in the inner row) can lead to a capture, a clockwise move is allowed. Sowing cannot occur with single counters. The player who can no longer move loses. \n\n###\n\n", "completion": "(define \"NextHole\" (\"NextSiteOnTrack\" #3 from:#1 #2)) (define \"Columns\" 8) (game \"Mweso\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" 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\" \"24,E,S1,W\" loop:True P2)}) (piece \"Seed\" Shared) (regions \"Home\" P1 (sites Track \"TrackCCW1\")) (regions \"Home\" P2 (sites Track \"TrackCCW2\")) (regions \"Inner\" P1 (difference (sites Track \"TrackCCW1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"TrackCCW2\") (sites Top))) (regions \"Left\" P1 (intersection (sites Track \"TrackCCW1\") (expand (sites Left)))) (regions \"Left\" P2 (intersection (sites Track \"TrackCCW2\") (expand (sites Right)))) (hand Each)}) (rules (start { (set Count 32 at:(handSite P1)) (set Count 32 at:(handSite P2))}) phases:{ (phase \"Placing\" (play (move (from (handSite Mover)) (to (sites Mover \"Home\")) count:1)) (nextPhase Mover (is Empty (handSite Mover)) \"Sowing\")) (phase \"Sowing\" (play (or { (if (!= 2 (var \"Direction\")) (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (sites Mover \"Home\")) if:(< 1 (count at:(from)))) (then (sow \"TrackCCW\" owner:(mover) apply:(if (< 1 (count at:(to))) (and { (set Var \"Direction\" 1) (moveAgain) (set Var \"Replay\" (to)) (if (is In (to) (sites Mover \"Inner\")) (if (and (is Occupied (\"OppositePit\" (to))) (is Occupied (\"OppositeOuterPit\" (to)))) (and { (fromTo (from (\"OppositePit\" (to))) (to (last From)) count:(count at:(\"OppositePit\" (to)))) (fromTo (from (\"OppositeOuterPit\" (to))) (to (last From)) count:(count at:(\"OppositeOuterPit\" (to)))) (sow (last From) count:(+ (count at:(\"OppositePit\" (to))) (count at:(\"OppositeOuterPit\" (to)))) \"TrackCCW\" owner:(mover))})))}) (set Var \"Direction\" 0)))))) (if (!= 1 (var \"Direction\")) (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (sites Mover \"Left\")) if:(and (< 1 (count at:(from))) (if (\"SameTurn\") True (if (is In (\"NextHole\" (from) \"TrackCW\" (count at:(from))) (sites Mover \"Inner\")) (and (is Occupied (\"OppositePit\" (\"NextHole\" (from) \"TrackCW\" (count at:(from))))) (is Occupied (\"OppositeOuterPit\" (\"NextHole\" (from) \"TrackCW\" (count at:(from)))))) False)))) (then (sow \"TrackCW\" owner:(mover) apply:(if (< 1 (count at:(to))) (and { (set Var \"Direction\" 2) (moveAgain) (set Var \"Replay\" (to)) (if (is In (to) (sites Mover \"Inner\")) (if (and (is Occupied (\"OppositePit\" (to))) (is Occupied (\"OppositeOuterPit\" (to)))) (and { (fromTo (from (\"OppositePit\" (to))) (to (last From)) count:(count at:(\"OppositePit\" (to)))) (fromTo (from (\"OppositeOuterPit\" (to))) (to (last From)) count:(count at:(\"OppositeOuterPit\" (to)))) (sow (last From) count:(+ (count at:(\"OppositePit\" (to))) (count at:(\"OppositeOuterPit\" (to)))) \"TrackCCW\" owner:(mover))})))}) (set Var \"Direction\" 0))))))})) (end (if (and (not (is Next Mover)) (no Moves Next)) (result Mover Win))))})) END" }, { "prompt": "Construct a Ludii game based on the following description\nCiri Amber can be played on any undirected and weighted graph. Initially, all the edges have the same colour. Each turn, a player removes a coloured edge and gets a score equals to the cost of that edge. The game is over when the graph becomes regular. The game is won by the player with the highest score. The version of the game played with 2 players.\n\n###\n\n", "completion": "(game \"Ciri Amber\" (players 2) (equipment { (board (complete (regular Star 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 Cost 3 Edge at:12) (set Cost 1 Edge at:13) (set Cost 2 Edge at:14) (set Cost 3 Edge at:15) (set Cost 1 Edge at:16) (set Cost 2 Edge at:17) (set Cost 3 Edge at:18) (set Cost 3 Edge at:19) (set Cost 1 Edge at:20)}) (play (move Remove (sites Occupied by:Neutral) (then (addScore Mover (cost Edge at:(last To)))))) (end (if (is RegularGraph Neutral) (byScore))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe version of the game played with 3 players. -> The version of the game played with 4 players.\n(game \"Radran\" (players 3) (equipment { (board (graph vertices:{{0 0} {5 0} {10 0} {0 5} {5 5} {10 5} {0 10} {5 10} {10 10}} edges:{{0 1} {0 2} {0 3} {0 4} {0 5} {0 6} {0 7} {1 2} {1 3} {1 4} {1 5} {1 6} {1 8} {2 3} {2 4} {2 5} {2 7} {2 8} {3 4} {3 6} {3 7} {3 8} {4 5} {4 6} {4 7} {4 8} {5 6} {5 8} {5 7} {6 7} {6 8} {7 8}}) use:Edge) (piece \"Marker\" Neutral)}) (rules (start { (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 Cost 3 Edge at:12) (set Cost 1 Edge at:13) (set Cost 2 Edge at:14) (set Cost 3 Edge at:15) (set Cost 1 Edge at:16) (set Cost 2 Edge at:17) (set Cost 3 Edge at:18) (set Cost 3 Edge at:19) (set Cost 1 Edge at:20) (set Cost 2 Edge at:21) (set Cost 3 Edge at:22) (set Cost 1 Edge at:23) (set Cost 2 Edge at:24) (set Cost 3 Edge at:25) (set Cost 1 Edge at:26) (set Cost 2 Edge at:27) (set Cost 3 Edge at:28) (set Cost 3 Edge at:29) (set Cost 1 Edge at:30) (set Cost 2 Edge at:31)}) (play (move Add (piece \"Marker0\") (to Edge (sites Empty Edge)) (then (addScore Mover (cost Edge at:(last To)))))) (end (if (is RegularGraph Neutral) (byScore)))))\n\n###\n\n", "completion": "(game \"Radran\" (players 4) (equipment { (board (graph vertices:{{0 0} {5 0} {10 0} {0 5} {5 5} {10 5} {0 10} {5 10} {10 10}} edges:{{0 1} {0 2} {0 3} {0 4} {0 5} {0 6} {0 7} {1 2} {1 3} {1 4} {1 5} {1 6} {1 8} {2 3} {2 4} {2 5} {2 7} {2 8} {3 4} {3 6} {3 7} {3 8} {4 5} {4 6} {4 7} {4 8} {5 6} {5 8} {5 7} {6 7} {6 8} {7 8}}) use:Edge) (piece \"Marker\" Neutral)}) (rules (start { (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 Cost 3 Edge at:12) (set Cost 1 Edge at:13) (set Cost 2 Edge at:14) (set Cost 3 Edge at:15) (set Cost 1 Edge at:16) (set Cost 2 Edge at:17) (set Cost 3 Edge at:18) (set Cost 3 Edge at:19) (set Cost 1 Edge at:20) (set Cost 2 Edge at:21) (set Cost 3 Edge at:22) (set Cost 1 Edge at:23) (set Cost 2 Edge at:24) (set Cost 3 Edge at:25) (set Cost 1 Edge at:26) (set Cost 2 Edge at:27) (set Cost 3 Edge at:28) (set Cost 3 Edge at:29) (set Cost 1 Edge at:30) (set Cost 2 Edge at:31)}) (play (move Add (piece \"Marker0\") (to Edge (sites Empty Edge)) (then (addScore Mover (cost Edge at:(last To)))))) (end (if (is RegularGraph Neutral) (byScore))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n9x9 intersecting lines. Forty pieces per player. Players alternate turns placing a piece on an empty space on the board. When all of the pieces are placed, players alternate turns moving a piece to an empty adjacent spot on the board. When a player places three of their pieces in an orthogonal or diagonal line, they remove one of the opponent's pieces. Players also remove one of the opponent's pieces when they place four pieces so that they are one the four corners of one of the squares on the board. Pieces which are in these patterns cannot be removed from the board. The player who removes all of the opponent's pieces wins. \n\n###\n\n", "completion": "(define \"IfLine3OrSquareMoveAgain\" (then (if (or (is Line 3 All) (\"SquarePattern\")) (moveAgain)))) (define \"RemoveEnemyPieceNotInLine3AndNotInSquare\" (move Remove (forEach (sites Occupied by:Next container:\"Board\") if:(and (not (is Line 3 All through:(site))) (not (\"SquarePattern\" from:(site))))))) (define \"SquarePattern\" (is Pattern {F R F R F R F} #1)) (game \"Xanan Zirge\" (players 2) (equipment { (board (square 9) use:Vertex) (hand Each) (piece \"Marker\" Each (\"StepToEmpty\" ~ \"IfLine3OrSquareMoveAgain\"))}) (rules (start (place \"Marker\" \"Hand\" count:40)) phases:{ (phase \"Placement\" (play (if \"SameTurn\" \"RemoveEnemyPieceNotInLine3AndNotInSquare\" (move (from (handSite Mover)) (to (sites Empty)) \"IfLine3OrSquareMoveAgain\"))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (phase \"Movement\" (play (if \"SameTurn\" \"RemoveEnemyPieceNotInLine3AndNotInSquare\" (forEach Piece))))} (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Construct a Ludii game based on the following description\n5x5 board. Players begin by placing their pieces two-by-two in places as they see fit, except for the central space. Once all the spaces except the central one are filled, the player who placed their pieces last moves a piece one space orthogonally to the empty space. Pieces are captured by surrounding them on either side by a player's own pieces. Multiple captures are allowed, and multiple pieces can be captured in a single move. A player may move their piece between two of the opponent's pieces without it resulting in a capture. Pieces in the central spot cannot be captured. If a player cannot move, the opponent must move so that the player can move on their next turn. The player to capture all of the opponent's pieces wins.\n \n\n###\n\n", "completion": "(define \"Custodial\" (custodial #1 Orthogonal (between (max 1) if:\"EnemyOutsideCentre\" #2) (to if:(\"IsFriendAt\" (to))))) (define \"CaptureAndMoveAgain\" (apply (and (remove (between)) (if \"FlankFromOrthogonalStep\" (moveAgain) (if (no Moves Next) (and (set Pending) (moveAgain))))))) (define \"FlankFromOrthogonalStep\" (or { (can Move (\"Custodial\" (from (ahead (last To) N)))) (can Move (\"Custodial\" (from (ahead (last To) E)))) (can Move (\"Custodial\" (from (ahead (last To) W)))) (can Move (\"Custodial\" (from (ahead (last To) S))))})) (define \"EnemyOutsideCentre\" (and (\"IsEnemyAt\" (between)) (!= (centrePoint) (between)))) (game \"Shantarad\" (players 2) (equipment { (board (square 5)) (hand Each) (piece \"Marker\" Each (\"StepToEmpty\" Orthogonal (then (\"Custodial\" (from (last To)) \"CaptureAndMoveAgain\"))))}) (rules (start (place \"Marker\" \"Hand\" count:12)) phases:{ (phase \"Placement\" (play (if (= (count Moves) 24) (forEach Piece) (move (from (handSite Mover)) (to (difference (sites Empty) (centrePoint))) (then (if (or (= (count Moves) 24) (\"NewTurn\")) (moveAgain)))))) (nextPhase (= (count Moves) 25) \"Movement\")) (phase \"Movement\" (play (if \"SameTurn\" (move Step (from (last To)) Orthogonal (to if:(and (is Empty (to)) (or { (and (\"IsEnemyAt\" (ahead (to) W)) (\"IsFriendAt\" (ahead (ahead (to) W) W))) (and (\"IsEnemyAt\" (ahead (to) E)) (\"IsFriendAt\" (ahead (ahead (to) E) E))) (and (\"IsEnemyAt\" (ahead (to) N)) (\"IsFriendAt\" (ahead (ahead (to) N) N))) (and (\"IsEnemyAt\" (ahead (to) S)) (\"IsFriendAt\" (ahead (ahead (to) S) S)))}))) (then (\"Custodial\" (from (last To)) \"CaptureAndMoveAgain\"))) (do (forEach Piece) ifAfterwards:(not (no Moves Next))))))} (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayed on an 8x8 board with pieces with specialized moves. The pieces are as follows, and placed on the outer rank in the following order, starting from the left corner and moving in, with the placement mirrored on the right side (the Mantri is placed to the right of the Rajah): Tor (2): can move any number of spaces orthogonally; Kudah (2): moves in any direction, one space orthogonally with one space forward diagonally, jumping over any intervening pieces; Gajah (2): can move any number of spaces diagonally; Rajah (1): can move one space orthogonally or diagonally; Mantri (1): can move any number of spaces orthogonally or diagonally; Bidah (8), placed in front of the other pieces: can move one space forward, or one space diagonally to capture. A Bidah may move two squares on its first move. Bidahs may capture en passant only when it is blocked from moving forward by another of the opponent's Bidahs; the blocked Bidah has the option in this scenario of capturing with an en passant move, with the option of capturing either of the two Bidahs in question.\n The Rajah, for its first move may move like a Kudah as long as it has never been checked. \n \n Players capture pieces by moving onto a space occupied by an opponent's piece. \n \n Castling occurs by moving the Rajah to the left or the right two squares, regardless of any intervening pieces; the Tor is not moved as part of this move. \n \n Promotion of Bidahs occur when they reach the opposite edge of the board, but only immediately if they reach the Tor's square. If it captures on the square next to the Tor's square, from the square in front of the Tor's square, it must move backward diagonally to the square in front of the Tor's square on a subsequent turn and continue before promotion. A Bidah reaching the Kudah's square must move backward diagonally once, to the right or left, before being promoted; a Bidah reaching the Gajah's square must move backward diagonally right or left two spaces, and a Bidah reaching the Raja or Mantri's square must move backward diagonally three squares before being promoted. Bidah's can be promoted to whatever piece the player wishes. \n \n If the Rajah can be captured on the opponent's next turn, it is in check. The Rajah must not be in check at the end of the player's turn. If this is impossible, it is checkmate and the opponent wins. \n \n If a player is reduced to only their Rajah, it can make the move of any piece. \n \n\n###\n\n", "completion": "(define \"EnPassant\" (move Step (directions {FR FL}) (to if:(and (\"InLocationEnPassant\") (= (id \"Pawn\" Next) (what at:(ahead (from) Forward))))) (then (remove (ahead (last To) Backward))))) (define \"InLocationEnPassant\" (and (is Pending) (= (to) (value Pending)))) (define \"SetEnPassantLocation\" (then (set Pending (ahead (last To) Backward)))) (define \"RememberPieceHasMoved\" (then (if (= (state at:(last To)) 1) (\"PieceHasMoved\" (last To))))) (define \"PieceHasMoved\" (set State at:#1 0)) (define \"HasNeverMoved\" (= (state at:#1) 1)) (game \"Main Chator (Selangor)\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (piece \"Pawn\" Each (if (= 0 (state at:(from))) (or { (if (is In (from) (sites Start (piece (what at:(from))))) (\"DoubleStepForwardToEmpty\" \"SetEnPassantLocation\")) \"StepForwardToEmpty\" (\"StepToEnemy\" (directions {FR FL})) \"EnPassant\" (move Step (directions {FR FL}) (to if:(and (\"InLocationEnPassant\") (= (id \"Pawn\" Next) (what at:(ahead (from) Forward))))) (then (remove (ahead (last From) (if (is Mover P1) N S)))))} (then (if (is In (last To) (sites Mover \"Promotion\")) (if (is In (last To) (sites Corners)) (moveAgain) (if (is In (last To) (intersection (sites Mover \"Promotion\") (expand (sites Corners)))) (set State at:(last To) 1) (if (is In (last To) (intersection (sites Mover \"Promotion\") (expand (sites Corners) steps:2))) (set State at:(last To) 2) (set State at:(last To) 3))))))) (\"StepToEmpty\" (directions {BR BL}) (then (and (if (= 1 (state at:(last To))) (moveAgain)) (set State at:(last To) (- (state at:(last To)) 1))))))) (\"ChessRook\" \"Rook\") (piece \"King_noCross\" Each (if (= (count Pieces Mover) 1) (or (\"LeapCapture\" \"KnightWalk\") (\"SlideCapture\")) (or { (\"StepToNotFriend\") (if (and (\"HasNeverMoved\" (from)) (!= (value Player Mover) (mover))) (\"LeapToEmpty\" \"KnightWalk\" (then (set Value Mover (mover))))) (if (\"HasNeverMoved\" (from)) (move Hop (directions {E W}) (between if:True) (to if:(is Empty (to)))))} \"RememberPieceHasMoved\"))) (\"ChessBishop\" \"Elephant\") (\"ChessKnight\" \"Knight\") (\"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 \"Rook1\" {\"A1\" \"H1\"}) (place \"Knight1\" {\"B1\" \"G1\"}) (place \"Elephant1\" {\"C1\" \"F1\"}) (place \"King_noCross1\" coord:\"D1\" state:1) (place \"Ferz_noCross1\" coord:\"E1\") (place \"Rook2\" {\"A8\" \"H8\"}) (place \"Knight2\" {\"B8\" \"G8\"}) (place \"Elephant2\" {\"C8\" \"F8\"}) (place \"King_noCross2\" coord:\"E8\" state:1) (place \"Ferz_noCross2\" coord:\"D8\")}) (play (if \"SameTurn\" (move Promote (last To) (piece {\"Knight\" \"Elephant\" \"Rook\" \"Ferz_noCross\"}) Mover) (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King_noCross\" Mover)) (then (if (!= (next) (value Player Next)) (if (\"IsInCheck\" \"King_noCross\" Next) (set Value Next (next)))))))) (end { (\"Checkmate\" \"King_noCross\") (\"MisereBlockWin\") (if (= (count Pieces Next) 1) (result Mover Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayers alternate their turns using one piece to either move or capture exclusively per turn.\n Pieces may only move one space per turn either straight forward, diagonally forward, or sideways along a line onto a vacant adjacent intersection point. They cannot move backwards in any direction until they are promoted to Kings. However, pieces can make capturing moves backward.\n Captures are compulsory.\n Captured pieces are removed from the board.\n For pieces that have not yet been promoted to King, their captures are done by the short leap as in draughts and Alquerque. A piece leaps over an adjacent enemy piece onto a vacant adjacent intersection point on the other side. The leap must be in a straight line following the pattern on the board. Even pieces that are not yet promoted to King can capture enemy pieces backwards. A player's piece must continue to capture within a turn provided each capture meets the criteria of the short leap.\n A piece is promoted to King when it reaches the other player's first rank.\n Kings can move any number of unoccupied spaces in any available direction following the pattern of the board like the King in international draughts.\n Kings can leap over an enemy piece (and only one enemy piece per leap) from any distance and land any distance behind it onto a vacant intersection point as in the King in international draughts. The King must continue to capture within the turn if it is able to do so.\n The player who captures all of their opponent's pieces is the winner. \n\n###\n\n", "completion": "(define \"HopSequenceCapture\" (move Hop Adjacent (between #1 #2 if:(\"IsEnemyAt\" (between)) (apply (remove (between) #3))) (to if:(is Empty (to))) (then (if (can Move (hop (from (last To)) Adjacent (between #1 #2 if:(and (not (is In (between) (sites ToClear))) (\"IsEnemyAt\" (between)))) (to if:(is Empty (to))))) (moveAgain))))) (define \"HopSequenceCaptureAgain\" (move Hop (from (last To)) Adjacent (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)) Adjacent (between #1 #2 if:(and (not (is In (between) (sites ToClear))) (\"IsEnemyAt\" (between)))) (to if:(is Empty (to))))) (moveAgain))))) (define \"HopStyle\" (move Hop #1 #2 (between if:(and (not (is In (between) (sites ToClear))) (\"IsEnemyAt\" (between))) (apply (remove (between)))) (to if:(is Empty (to))) #3)) (define \"IsUnpromoted\" (\"IsPieceAt\" \"Counter\" Mover (last To))) (game \"Permainan-Tabal\" (\"TwoPlayersNorthSouth\") (equipment { (\"AlquerqueBoardWithBottomAndTopTriangles\") (piece \"Counter\" P1 N) (piece \"Counter\" P2 S) (piece \"DoubleCounter\" Each) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start { (place \"Counter1\" (difference (expand (sites Bottom) steps:4) (sites Row 4))) (place \"Counter2\" (difference (expand (sites Top) steps:4) (sites Row 4)))}) (play (if \"SameTurn\" (if \"IsUnpromoted\" (\"HopStyle\" (from (last To)) Adjacent (then (\"ReplayIfCanMove\" (\"HopStyle\" (from (last To)) Adjacent) (\"PromoteIfReach\" (sites Next) \"DoubleCounter\")))) (\"HopSequenceCaptureAgain\" before:(count Rows) after:(count Rows))) (priority { (or (forEach Piece \"Counter\" (\"HopStyle\" (from) Adjacent (then (\"ReplayIfCanMove\" (\"HopStyle\" (from (last To)) Adjacent) (\"PromoteIfReach\" (sites Next) \"DoubleCounter\"))))) (forEach Piece \"DoubleCounter\" (\"HopSequenceCapture\" before:(count Rows) after:(count Rows)))) (or (forEach Piece \"Counter\" (\"StepToEmpty\" (directions {Forwards Rightward Leftward})) (then (\"PromoteIfReach\" (sites Next) \"DoubleCounter\"))) (forEach Piece \"DoubleCounter\" (move Slide Adjacent)))}))) (end (\"BlockWin\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\nTwo rows of seven holes. Twelve counters in each hole, except in the central hole of each row, one of which has one counter and the other is empty. Players do not own a row of holes, rather each player owns the six holes on one side of the central holes. Sowing occurs in an anti-clockwise direction. Neither player may begin sowing from the central holes. When sowing ends, if the next hole after the hole in which the final counter was placed is occupied, these counters are picked up and sown. If this hole is empty, the counters in the hole opposite it are captured. Play continues until all of the counters have been captured. The player who captures the most pieces wins. \n\n###\n\n", "completion": "(define \"LastHolePlayed\" (last To afterConsequence:True)) (define \"NextHole\" (\"NextSiteOnTrack\" 1 from:#1)) (define \"NumPiecesOnBoard\" (count in:(sites Track))) (define \"PiecesOwnedBy\" (count Cell at:(handSite #1))) (define \"Columns\" 7) (game \"Kanji Guti\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" store:None (track \"Track\" \"0,E,N,W\" loop:True)) (piece \"Seed\" Shared) (hand Each) (regions \"Home\" P1 (expand (sites Left) steps:2)) (regions \"Home\" P2 (expand (sites Right) steps:2))}) (rules (start { (set Count 1 at:(coord \"D1\")) (set Count 12 to:(difference (sites Track) (sites Centre)))}) (play (move Select (from (if (\"SameTurn\") (sites {(\"NextHole\" \"LastHolePlayed\")}) (sites Mover)) if:(< 0 (count at:(from)))) (then (sow apply:(if (> (count at:(\"NextHole\" (to))) 0) (moveAgain) (if (> (count at:(\"OppositePitTwoRows\" (\"NextHole\" (to)))) 0) (fromTo (from (\"OppositePitTwoRows\" (\"NextHole\" (to)))) (to (handSite Mover)) count:(count at:(\"OppositePitTwoRows\" (\"NextHole\" (to))))))))))) (end (\"MancalaByScoreWhen\" (= 0 (\"NumPiecesOnBoard\")))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n5x5 intersecting lines, with the diagonals of every 2x2 square formed. On one side, a diamond intersects with the central point of that side, with diagonals drawn in the diamond. One player plays as the monk, placed at the intersection of the diamond and the main board. The other player plays as fifteen water pieces, placed on each point along the perimeter of the main board. Players take turns moving their pieces to one adjacent point following the lines on the board. The monk may capture two water pieces by moving to an empty space between two water pieces. The goal of the water pieces is to trap the monk on the far point of the diamond. The monk wins by capturing all of the water. \n\n###\n\n", "completion": "(game \"Shui Yen Ho-Shang\" (players 2) (equipment { (board (merge (rotate 45 (shift 1.5 4.2 (square 2 diagonals:Solid))) (square 5 diagonals:Alternating)) use:Vertex) (piece \"Marker\" P1 \"StepToEmpty\") (piece \"Marker\" P2 (move Step (to if:(is Empty (to))) (then (\"InterveneCapture\"))))}) (rules (start { (place \"Marker2\" coord:\"C5\") (place \"Marker1\" (difference (sites Outer) (sites {\"B6\" \"C7\" \"D6\"})))}) (play (forEach Piece)) (end { (if (no Pieces P1) (result P2 Win)) (if (and (no Moves P2) (is In (where \"Marker\" P2) (sites {\"C7\"}))) (result P1 Win))}))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"NextNoPieceInRegion\" (all Sites (sites Occupied by:Next) if:(not (is In (site) #1)))) (define \"AgressiveMoves\" (forEach Piece (if (is In (from) (\"AgressiveRegion\")) (or (move Slide (\"LastDirection\" Cell) (between (exact \"LastDistance\") if:(is Empty (between))) (to if:(or (is Empty (to)) (and (\"IsEnemyAt\" (to)) (or (is Empty (ahead (to) (\"LastDirection\" Cell))) (= (ahead (to) (\"LastDirection\" Cell)) (to))))) (apply (if (\"IsEnemyAt\" (to)) (if (= (ahead (to) (\"LastDirection\" Cell)) (to)) (remove (to)) (fromTo (from (to)) (to (ahead (to) (\"LastDirection\" Cell))))))))) (if (and { (= (\"LastDistance\") 2) (\"IsEnemyAt\" (ahead (from) (\"LastDirection\" Cell))) (is Empty (ahead (from) steps:2 (\"LastDirection\" Cell))) (if (= (from) (ahead (from) steps:3 (\"LastDirection\" Cell))) True (is Empty (ahead (from) steps:3 (\"LastDirection\" Cell))))}) (move (from (from)) (to (ahead (from) steps:2 (\"LastDirection\" Cell))) (then (if (= (ahead (last To) (\"LastDirection\" Cell)) (last To)) (remove (ahead (last From) (\"LastDirection\" Cell))) (fromTo (from (ahead (last From) (\"LastDirection\" Cell))) (to (ahead (last To) (\"LastDirection\" Cell)))))))))))) (define \"AgressiveRegion\" (if (is In (last To) (sites \"Dark\")) (sites \"Light\") (sites \"Dark\"))) (game \"Shobu\" (players 2) (equipment { (board (merge { (square 4) (shift 5 0 (square 4)) (shift 0 5 (square 4)) (shift 5 5 (square 4))})) (piece \"Ball\" Each) (regions \"BottomDark\" (expand origin:(coord \"A1\") steps:3)) (regions \"TopDark\" (expand origin:(coord \"A5\") steps:3)) (regions \"BottomLight\" (expand origin:(coord \"E1\") steps:3)) (regions \"TopLight\" (expand origin:(coord \"E5\") steps:3)) (regions \"Home\" P1 (union (sites \"BottomDark\") (sites \"BottomLight\"))) (regions \"Home\" P2 (union (sites \"TopLight\") (sites \"TopDark\"))) (regions \"Light\" (expand (sites Right) steps:3)) (regions \"Dark\" (expand (sites Left) steps:3))}) (rules (start { (place \"Ball1\" (union (sites Bottom) (sites Row 4))) (place \"Ball2\" (union (sites Top) (sites Row 3)))}) phases:{ (phase \"Passive\" (play (do (forEach Piece (if (is In (from) (sites Mover \"Home\")) (move Slide (between (max 2) if:(is Empty (between))))) (then (moveAgain))) ifAfterwards:(can Move (\"AgressiveMoves\")))) (nextPhase Mover \"Aggressive\")) (phase \"Aggressive\" (play (\"AgressiveMoves\")) (nextPhase Mover \"Passive\"))} (end (if (or { (\"NextNoPieceInRegion\" (sites \"BottomDark\")) (\"NextNoPieceInRegion\" (sites \"TopDark\")) (\"NextNoPieceInRegion\" (sites \"BottomLight\")) (\"NextNoPieceInRegion\" (sites \"TopLight\"))}) (result Mover Win)))))\n\n###\n\n", "completion": "Your turn is in two parts. First, a player may move one of their stones up to two spaces in any direction, including diagonally, in what is called a passive (or set up) move. Second, they take a more aggressive move, which must be the same direction and number of spaces as the first move. It is this second move that allows you to push stones across the board - or off the board's edge. A passive move can be done only if it can be followed by an aggressive move. Remove all four of your opponent's stones from just one of the four boards to win. END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game is played on a 7x7 board. -> The game is played on a 9x9 board.\n(game \"Seega\" (players 2) (equipment { (board (square 7)) (hand Each) (piece \"Marker\" Each (\"StepToEmpty\" Orthogonal (then (\"CustodialCapture\" Orthogonal (max 1)))))}) (rules (start (place \"Marker\" \"Hand\" count:24)) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (difference (sites Empty) (centrePoint))) (then (if (\"NewTurn\") (moveAgain))))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (\"PhaseMovePiece\" \"Movement\")} (end (\"CaptureAll\" Next))))\n\n###\n\n", "completion": "(game \"Seega\" (players 2) (equipment { (board (square 9)) (hand Each) (piece \"Marker\" Each (\"StepToEmpty\" Orthogonal (then (\"CustodialCapture\" Orthogonal (max 1)))))}) (rules (start (place \"Marker\" \"Hand\" count:40)) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (difference (sites Empty) (centrePoint))) (then (if (\"NewTurn\") (moveAgain))))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (\"PhaseMovePiece\" \"Movement\")} (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nFour 3x8 rectangles, arranged in a cross. The third square in the outer rows of each arm, counting from the outer corners, are marked. Four players, each with four pieces. Pieces enter the board from the center of the board, down the central row of the player's arm, around the board in an anti-clockwise direction, and then back up the central row to the central space. Six cowries used as dice, the throws are as follows: one mouth up = 10; two mouths up = 2; three mouths up = 3; four mouths up = 4; five mouths up = 25; six mouths up = 12; zero mouths up = 6. Throws of 10 and 25 allow a player to enter a piece onto the board. When a piece lands on a space occupied by an opponent's piece, the opponent's piece is sent back to start. Pieces on the same spot as another piece belonging to the player and pieces on marked squares are safe from being sent to start. The player who moves all of their pieces off the board first wins. \n\n###\n\n", "completion": "(define \"IsSpecialThrow\" (is In (\"ThrowValue\") (array {10 25}))) (define \"EnterAPiece\" (move (from (handSite Mover)) (to (centrePoint) if:(not (\"IsFriendAt\" (to))) (\"HittingCapture\" (handSite (who at:(to))))))) (define \"ThrowValue\" (mapEntry \"Throw\" (count Pips))) (game \"Barjis\" (players 4) (equipment { (\"PachisiBoard\" { (track \"Track1\" \"96,9,S,E1,N,11,E,N,W,53,N,W,S,42,W,S,E,8,S,E1,N8\" 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,E8\" 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,S8\" 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,W8\" P4 directed:True)}) (hand Each) (\"StickDice\" 6) (piece \"Pawn\" Each (if (\"IsOffBoard\" (\"NextSiteOnTrack\" (\"ThrowValue\"))) (move Remove (from)) (move (from (from)) (to (\"NextSiteOnTrack\" (\"ThrowValue\")) if:(or (is Empty (to)) (and (\"IsEnemyAt\" (to)) (not (is In (to) (sites \"SafeSites\"))))) (\"HittingCapture\" (handSite (who at:(to)))))))) (map \"Throw\" {(pair 0 6) (pair 1 10) (pair 2 2) (pair 3 3) (pair 4 4) (pair 5 25) (pair 6 12)}) (regions \"SafeSites\" (sites {60 62 16 48 87 89 37 2}))}) (rules (start (place \"Pawn\" \"Hand\" count:4)) (play (\"RollMove\" (or (forEach Piece) (if (and (\"IsSpecialThrow\") (is Occupied (handSite Mover))) (\"EnterAPiece\"))))) (end (\"EscapeWin\")))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"ConnectedEdges\" (!= 0 (count Sites in:(forEach (sites Occupied by:#1) if:(is Connected at:(site) Orthogonal #1))))) (game \"Kanguruh\" (players 2) (equipment { (board (square 8)) (piece \"Kangaroo\" Each (move Hop (between if:(is Occupied (between))) (to if:(is Empty (to)) (apply (and { (if (\"IsEnemyAt\" (between)) (remove (between))) (remember Value (from)) (remember Value (to))}))) (then (\"ReplayIfCanMove\" (hop (from (last To)) (between if:(is Occupied (between))) (to if:(and (is Empty (to)) (not (is In (to) (values Remembered)))))) (forget Value All)))))}) (rules (start { (place \"Kangaroo1\" (expand (sites Bottom))) (place \"Kangaroo2\" (expand (sites Top)))}) (play (if (\"SameTurn\") (or (move Pass (then (forget Value All))) (move Hop (from (last To)) (between if:(is Occupied (between))) (to if:(and (is Empty (to)) (not (is In (to) (values Remembered)))) (apply (and (if (\"IsEnemyAt\" (between)) (remove (between))) (remember Value (to))))) (then (\"ReplayIfCanMove\" (hop (from (last To)) (between if:(is Occupied (between))) (to if:(and (is Empty (to)) (not (is In (to) (values Remembered)))))) (forget Value All))))) (forEach Piece))) (end (if (no Moves Next) (byScore { (score P1 (count Pieces P1)) (score P2 (count Pieces P2))})))))\n\n###\n\n", "completion": "TURNS - At each turn, each player must move one of his stones (called Kangaroos):\n - A stone must jump over one (orthogonal or diagonal) adjacent stone landing on the immediate next empty cell.\n - If the jumped enemy stones are captured and removed from the board.\n - Jumps can be multiple but are not mandatory.\n \n GOAL - The game ends when one player cannot move. The winner is the one with more stones. END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"StepMove\" (\"StepToEmpty\" (directions { Forward Leftward Rightward}))) (game \"Dodgem\" (players 2) (equipment { (board (square 3)) (piece \"Car\" P1 E (if (is In (from) (sites Right)) (move Remove (from)) (\"StepMove\"))) (piece \"Car\" P2 N (if (is In (from) (sites Top)) (move Remove (from)) (\"StepMove\")))}) (rules (start { (place \"Car1\" (difference (sites Left) (sites {\"A1\"}))) (place \"Car2\" (difference (sites Bottom) (sites {\"A1\"})))}) (play (forEach Piece)) (end (\"EscapeWin\"))))\n\n###\n\n", "completion": "Played on a nxn board. Each player has n-1 cars, that can move either forward or up and down. Cars can leave the board once they have reached the opposite edge. First player to run out of legal moves wins. The game is played on a 3x3 board. 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 Ludii game based on the following description\nThe players take it in turns to choose one block and \\ The board has 4 rows. The board has 5 columns.\n\n###\n\n", "completion": "(define \"EatTopLeftCorner\" (is In (last To) (intersection (sites Top) (sites Left)))) (define \"EatChocolate\" (move Remove (sites Occupied by:Shared) (then (\"EatBottomRight\")))) (define \"EatBottomRight\" (forEach Site (sites Occupied by:Shared) (if (and (>= (row of:(last To)) (row of:(site))) (<= (column of:(last To)) (column of:(site)))) (remove (site))))) (game \"Chomp\" (players 2) (equipment { (board (rectangle 4 5)) (piece \"Chocolate\" Shared)}) (rules (start (place \"Chocolate\" (sites Board))) (play (\"EatChocolate\")) (end (if (\"EatTopLeftCorner\") (result Mover Loss))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nBoard & size: Hexhex with edges alternating 4 and 5 -> Board & size: Equiversi Hexhex with edges alternating 5 and 7\n(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 \"Placement\" (do (forget Value All) next:(move Add (piece (id \"Disc\" Mover)) (to (sites Empty)) (then (if (can Move (\"OpponentHop\" (from if:(!= (from) (last To))))) (moveAgain)))))) (define \"ForcedHop\" (if (= 0 (size Array (values Remembered))) (\"OpponentHop\" (from if:(!= (from) (last To)))) (\"OpponentHop\" (from if:(= (from) (last To)))))) (define \"OpponentHop\" (forEach Piece (move Hop #1 Orthogonal (between if:(\"IsAJumpableSite\") (apply (set Pending (between)))) (to if:(is Empty (to))) (then (and { (remember Value (value Pending)) (remove (value Pending)) (add (piece (id \"Disc\" Mover)) (to (value Pending)))} (then (and { (set Pending) (if (\"CanHop\" (from (last To))) (moveAgain))}))))))) (define \"CanHop\" (can Move (forEach Piece (move Hop #1 Orthogonal (between if:(\"IsAJumpableSite\")) (to if:(is Empty (to))))))) (define \"IsAJumpableSite\" (is In (between) (difference (sites Occupied by:Next) (sites (values Remembered))))) (define \"SameTurn\" (is Prev Mover)) (game \"Claim Jumpers\" (players 2) (equipment { (board (tri {4 5 4 5 4}) use:Vertex) (piece \"Disc\" Each)}) (rules (start (set Score Each 0)) (play (if (\"SameTurn\") (\"ForcedHop\") (\"Placement\") (then (and (set Score Mover (count Pieces Mover)) (set Score Next (count Pieces Next)))))) (end { (if (and \"EndCondition\" (= (score Mover) (score Next))) (result Mover Win)) (if (and \"EndCondition\" (!= (score Mover) (score Next))) (byScore))})))\n\n###\n\n", "completion": "(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 \"Placement\" (do (forget Value All) next:(move Add (piece (id \"Disc\" Mover)) (to (sites Empty)) (then (if (can Move (\"OpponentHop\" (from if:(!= (from) (last To))))) (moveAgain)))))) (define \"ForcedHop\" (if (= 0 (size Array (values Remembered))) (\"OpponentHop\" (from if:(!= (from) (last To)))) (\"OpponentHop\" (from if:(= (from) (last To)))))) (define \"OpponentHop\" (forEach Piece (move Hop #1 Orthogonal (between if:(\"IsAJumpableSite\") (apply (set Pending (between)))) (to if:(is Empty (to))) (then (and { (remember Value (value Pending)) (remove (value Pending)) (add (piece (id \"Disc\" Mover)) (to (value Pending)))} (then (and { (set Pending) (if (\"CanHop\" (from (last To))) (moveAgain))}))))))) (define \"CanHop\" (can Move (forEach Piece (move Hop #1 Orthogonal (between if:(\"IsAJumpableSite\")) (to if:(is Empty (to))))))) (define \"IsAJumpableSite\" (is In (between) (difference (sites Occupied by:Next) (sites (values Remembered))))) (define \"SameTurn\" (is Prev Mover)) (game \"Claim Jumpers\" (players 2) (equipment { (board \"Tri57Bug\" use:Vertex) (piece \"Disc\" Each)}) (rules (start (set Score Each 0)) (play (if (\"SameTurn\") (\"ForcedHop\") (\"Placement\") (then (and (set Score Mover (count Pieces Mover)) (set Score Next (count Pieces Next)))))) (end { (if (and \"EndCondition\" (= (score Mover) (score Next))) (result Mover Win)) (if (and \"EndCondition\" (!= (score Mover) (score Next))) (byScore))}))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"Flowers\" (players 2) (equipment { (board (dual (tiling T33336 3))) (piece \"Marker\" P1) (piece \"Marker\" P2)}) (rules (play (move Add (to (sites Empty)))) (end (if (is Line 4 Orthogonal) (result Mover Win)))))\n\n###\n\n", "completion": "Players take turns placing a piece of their colour, and win by making an orthogonally connected line of 4 of their colour (diagonal steps don't count). END" }, { "prompt": "Construct a Ludii game based on the following description\nSetup: Pieces of each color start distributed symmetrically on every 3rd cell of the board. (For a game on an order 4 board, the outer cells are not used.)\n \n Play \n - Decide which player will play with which color (Dark or Light). \n - Light is the first player to play.\n - Passing is not allowed.\n - The game ends when a player cannot move. \n \n On each turn, the mover chooses a piece and slides it over empty cells towards a friendly piece in the same line (but not necessarily visible from the moving piece's point of view.) \n \n The sliding piece must either:\n - stop on an empty cell next to a friendly piece to form a group of friendly pieces that is larger than the group it started in, or \n - stop at the first opponent's piece and remove it. The Last Scavenger. A piece must slide toward a friendly piece, either to reach a location where it forms a group larger than where it started, or to reach an opponent's piece, which is then removed. Last to move wins. Order 4 board\n\n###\n\n", "completion": "(define \"ColourBackground\" (colour 245 245 245)) (define \"Last2MoveEnd\" (\"BlockWin\")) (define \"AMSEnd\" (if (no Moves Next) (result Mover Loss))) (define \"MoveByDirection\" (forEach Piece (or { (\"AdvancedSquishSlide\" NNE) (\"AdvancedSquishSlide\" E) (\"AdvancedSquishSlide\" SSE) (\"AdvancedSquishSlide\" SSW) (\"AdvancedSquishSlide\" W) (\"AdvancedSquishSlide\" NNW)}))) (define \"AdvancedSquishSlide\" (do (set Var \"OriginGroupSize\" (size Group at:(from)) (then (set Var \"From\" (from)))) next:(move (from (from)) (to (\"AlongLine\" #1) if:(and { (all Sites (sites Between from:(from) to:(to)) if:(is Empty (site))) (\"IsPlayableSiteType\") (\"MoveTowardFriendInSameLine\" #1) (or (is Next (who at:(to))) (<= (var \"OriginGroupSize\") (\"DestinationGroupSize\")))}) (apply (remove (to))))))) (define \"DestinationGroupSize\" (count Sites in:(sites Distance Orthogonal (step (to if:(and (!= (var \"From\") (to)) (is Mover (who at:(to)))))) from:(to) (min 0)))) (define \"FirstFriend\" (sites To (move Hop #1 (between (min 0) if:(or { (= (from) (between)) (is Next (who at:(between))) (is Empty (between))})) (to (sites Inner) if:(is Mover (who at:(to))))))) (define \"MoveTowardFriendInSameLine\" (< 0 (count Pieces Mover in:(\"FurtherAlongLine\" #1)))) (define \"FurtherAlongLine\" (sites Distance (step #1 (to if:True)) from:(to) (min 1))) (define \"AlongLine\" (sites Distance (step #1 (to if:True)) from:(from) (min 1))) (define \"IsPlayableSiteType\" (is In (to) (\"PlayableSite\"))) (define \"PlayableSite\" (difference (sites Inner) (sites Occupied by:Mover))) (game \"Don't Mosey and The Last Scavenger\" (players 2) (equipment { (board (hex Hexagon 5) use:Cell) (piece \"Disc\" Each)}) (rules (start {(place \"Disc1\" {7 12 15 21 24 28 31 38 41 44 47 52}) (place \"Disc2\" {8 13 16 19 22 29 32 36 39 45 48 53})}) (play \"MoveByDirection\") (end \"Last2MoveEnd\"))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game is played on the Graph2. -> The game is played on the Graph3.\n(game \"Oriath\" (players 1) (equipment { (board (remove (complete (regular Star 8)) edges:{ {0 1} {2 3}}) use:Edge)}) (rules (play (move Add (to Edge (sites Empty Edge)))) (end { (if (is RegularGraph Mover) (result Mover Win))})))\n\n###\n\n", "completion": "(game \"Oriath\" (players 1) (equipment { (board (graph vertices:{ {2 0} {9 0} {6 1} {4 2} {9 2} {3 3} {0 4} {3 5} {6 3} {8 5} {11 4} {2 8} {7 7} {9 8}} edges:{ {0 1} {0 2} {0 3} {0 4} {0 5} {0 6} {0 7} {0 8} {0 9} {0 10} {0 11} {0 12} {0 13} {1 2} {1 3} {1 4} {1 5} {1 6} {1 7} {1 8} {1 9} {1 10} {1 11} {1 12} {1 13} {2 3} {2 4} {2 5} {2 6} {2 7} {2 8} {2 9} {2 10} {2 11} {2 12} {2 13} {3 4} {3 5} {3 6} {3 7} {3 8} {3 9} {3 10} {3 11} {3 12} {3 13} {4 5} {4 6} {4 7} {4 8} {4 9} {4 10} {4 11} {4 12} {4 13} {5 6} {5 7} {5 8} {5 9} {5 10} {5 11} {5 12} {5 13} {6 7} {6 8} {6 9} {6 10} {6 11} {6 12} {6 13} {7 8} {7 9} {7 10} {7 11} {7 12} {7 13} {8 9} {8 10} {8 11} {8 12} {8 13} {9 10} {9 11} {9 12} {9 13} {10 11} {10 12} {10 13} {11 12} {11 13} {12 13}}) use:Edge)}) (rules (play (move Add (to Edge (sites Empty Edge)))) (end { (if (is RegularGraph Mover) (result Mover Win))}))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"InitTwoSeed\" 7 20) (define \"InitOneSeed\" 8 19) (define \"Columns\" 7) (game \"Chisolo\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"TrackCCW1\" \"0,E,N1,W\" loop:True P1) (track \"TrackCCW2\" \"14,E,N1,W\" loop:True P2) (track \"TrackCW1\" \"6,W,N1,E\" loop:True P1) (track \"TrackCW2\" \"21,E,S1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"TrackCCW1\")) (regions \"Home\" P2 (sites Track \"TrackCCW2\")) (regions \"Inner\" P1 (difference (sites Track \"TrackCCW1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"TrackCCW2\") (sites Top))) (regions \"FourLeftInner\" P1 (sites {7..10})) (regions \"FourLeftInner\" P2 (sites {17..20})) (piece \"Seed\" Shared) (hand Each)}) (rules (start { (set Count 3 to:(difference (union (sites P1 \"Home\") (sites P2 \"Home\")) (union (sites P1 \"FourLeftInner\") (sites P2 \"FourLeftInner\")))) (set Count 1 to:(sites {\"InitOneSeed\"})) (set Count 2 to:(sites {\"InitTwoSeed\"}))}) phases: { (phase \"SowingCW\" (play (if (and (\"SameTurn\") (= (var \"CaptureOther\") 1)) (move (from (sites Next) if:(is Occupied (from))) (to (handSite Mover)) count:(count at:(from)) (then (set Var \"CaptureOther\" 0))) (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(is Occupied (from))) (then (sow \"TrackCW\" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover \"Inner\")) (if (is Occupied (\"OppositePit\" (to))) (and { (fromTo (from (\"OppositePit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePit\" (to)))) (if (is Occupied (\"OppositeOuterPit\" (to))) (fromTo (from (\"OppositeOuterPit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositeOuterPit\" (to))))) (moveAgain) (set Var \"CaptureOther\" 1)}))))))))) (nextPhase Mover (not (is Next Mover)) \"Sowing\")) (phase \"Sowing\" (play (if (and (\"SameTurn\") (= (var \"CaptureOther\") 1)) (move (from (sites Next) if:(is Occupied (from))) (to (handSite Mover)) count:(count at:(from)) (then (set Var \"CaptureOther\" 0))) (or (if (or (<= (value Player Mover) 0) (= (value Player Mover) 1)) (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(is Occupied (from))) (then (and (sow \"TrackCW\" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover \"Inner\")) (if (is Occupied (\"OppositePit\" (to))) (and { (fromTo (from (\"OppositePit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePit\" (to)))) (if (is Occupied (\"OppositeOuterPit\" (to))) (fromTo (from (\"OppositeOuterPit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositeOuterPit\" (to))))) (moveAgain) (set Var \"CaptureOther\" 1)}))))) (set Value Mover 1))))) (if (or (<= (value Player Mover) 0) (= (value Player Mover) 2)) (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(is Occupied (from))) (then (and (sow \"TrackCCW\" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover \"Inner\")) (if (is Occupied (\"OppositePit\" (to))) (and { (fromTo (from (\"OppositePit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePit\" (to)))) (if (is Occupied (\"OppositeOuterPit\" (to))) (fromTo (from (\"OppositeOuterPit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositeOuterPit\" (to))))) (moveAgain) (set Var \"CaptureOther\" 1)}))))) (set Value Mover 2)))))))))} (end (\"ForEachPlayerNoMovesLoss\"))))\n\n###\n\n", "completion": "4x7-10 board (seven most common). Three counters in each hole, except the leftmost four in the inner row which have, from right to left: 0-0-1-2. On the first turn, sowing occurs in a clockwise direction. On the second turn, the player may sow in either direction, but must continue in the chosen direction for the rest of the game. When the final counter lands in an empty hole in the inner row, the contents of the hole in the opponent's inner row are also captured. If there are also contents in the opponent's outer row hole opposite, these are also taken. When a capture is made, the player may then capture the counters in any one of the opponent's holes as well. If the final counter lands in an occupied hole, the player picks up these counters and continues sowing. The player who captures all of the opponent's counters wins. Each player has 7 holes on each row. Starting positions of the Natatu ruleset. No Opening. Capture all the opposite holes. 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 Ludii game based on the following description\n4x8 board, occasionally 4x9 or 10. One counter in each hole. Sowing occurs in an anti-clockwise direction. The players start by each making a stylised move. Sowing begins from the rightmost hole in the outer row. When the final counter lands in an occupied hole, these counters are picked up and sowing continues. When the sowing reaches the hole immediately before the one from which the sowing began (I.e,, the second-to-right hole in the outer row), these two counters are picked up and both placed in the rightmost hole in the outer row. The player then removes the two counters in the second-to-right hole in the inner row from the board. When both players complete this move, the main phase of the game begins. Players sow from any hole in their two rows. When the final counter lands in an occupied hole, these counters are picked up and sowing continues. When the final counter lands in an empty hole in the inner row, the counters in the opponent's opposite hole in their inner row are captured. If there are also counters in the opponent's opposite hole in the outer row, these are also captured, but only when a capture from the inner row was also made. Players cannot sow single counters, unless there are no holes with multiple counters left, in which case single counters may be sown into an empty hole. Play continues until one player has captured all of the opponent's counters, thus winning the game. Each row has 8 holes.\n\n###\n\n", "completion": "(define \"AllSitesNoMoreThanOne\" (all Sites (sites Mover \"Home\") if:(>= 1 (count at:(site))))) (define \"SecondToRightInnerRow\" (if (is Mover P1) (intersection (sites Mover \"Inner\") (difference (expand (sites Right)) (sites Right))) (intersection (sites Mover \"Inner\") (difference (expand (sites Left)) (sites Left))))) (define \"RightMostHole\" (if (is Mover P1) (intersection (sites Mover \"Outer\") (sites Right)) (intersection (sites Mover \"Outer\") (sites Left)))) (define \"NextHole\" (\"NextSiteOnTrack\" #2 from:#1 \"Track\")) (define \"NoPiece\" (all Sites (sites Player) if:(= 0 (count at:(site))))) (define \"Columns\" 8) (game \"Njombwa (One Counter)\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"0,E,N1,W\" loop:True P1) (track \"Track2\" \"16,E,N1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"Track1\")) (regions \"Home\" P2 (sites Track \"Track2\")) (regions \"Inner\" P1 (difference (sites Track \"Track1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"Track2\") (sites Top))) (regions \"Outer\" P1 (sites Bottom)) (regions \"Outer\" P2 (sites Top)) (piece \"Seed\" Shared)}) (rules (start (set Count 1 to:(sites Board))) phases:{ (phase \"Opening1\" (play (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (\"RightMostHole\")) if:(> (count at:(from)) 0)) (then (sow \"Track\" owner:(mover) apply:(if (and (not (is In (\"NextHole\" (to) 1) (\"RightMostHole\"))) (< 1 (count at:(to)))) (moveAgain)))))) (nextPhase Mover (not (is Next Mover)) \"Opening2\")) (phase \"Opening2\" (play (move (from (sites Mover \"Home\") if:(is In (\"NextHole\" (from) 1) (\"RightMostHole\"))) (to (\"RightMostHole\")) count:2)) (nextPhase Mover \"Opening3\")) (phase \"Opening3\" (play (move Remove (\"SecondToRightInnerRow\"))) (nextPhase Mover \"Sowing\")) (phase \"Sowing\" (play (if (\"AllSitesNoMoreThanOne\") (move Select (from (sites Mover \"Home\") if:(and (is Occupied (from)) (is Empty (\"NextHole\" (from) 1)))) (then (sow \"Track\" owner:(mover)))) (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(> (count at:(from)) 1)) (then (sow \"Track\" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (and (is In (to) (sites Mover \"Inner\")) (is Occupied (\"OppositePit\" (to)))) (and (remove (\"OppositePit\" (to))) (if (is Occupied (\"OppositeOuterPit\" (to))) (remove (\"OppositeOuterPit\" (to)))))))))))))} (end (forEach NonMover if:(\"NoPiece\") (result Player Loss))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPieces begin on opposite sides of the square. Players take turns moving the piece to an empty spot either orthogonally or diagonally, but one orthogonal direction is forbidden. The player who blocks the other player from being able to move wins. The piece are already placed on the board.\n\n###\n\n", "completion": "(game \"Pong Hau K'i\" (players 2) (equipment { (board (add (remove (\"AlquerqueGraph\" 3 3) vertices:{1 3 5 7}) edges:{{3 0} {0 1} {1 4}}) use:Vertex) (hand Each) (piece \"Disc\" Each \"StepToEmpty\")}) (rules (start {(place \"Disc1\" {\"A3\" \"C3\"}) (place \"Disc2\" {\"A1\" \"C1\"})}) (play (forEach Piece)) (end (\"NoMoves\" Loss)))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game is played on a 6x6 board. -> The game is played on a 8x8 board.\n(define \"HopSequence\" (\"HopCapture\" (from #1) #2 (then (\"ReplayIfCanMove\" (\"HopCapture\" (from (last To)) SameDirection))))) (game \"Konane\" (players 2) (equipment { (board (square 6)) (piece \"Marker\" Each)}) (rules (start { (place \"Marker1\" (sites Phase 1)) (place \"Marker2\" (sites Phase 0))}) phases:{ (phase \"OpeningP1\" P1 (play (move Remove (intersection (union (sites Corners) (sites Centre)) (sites Phase 1)))) (nextPhase Mover \"Movement\")) (phase \"OpeningP2\" P2 (play (move Remove (sites Around (last To) Own))) (nextPhase Mover \"Movement\")) (phase \"Movement\" (play (if \"SameTurn\" (or (\"HopSequence\" (last To) SameDirection) (move Pass)) (forEach Piece \"Marker\" (\"HopSequence\" (from) Orthogonal)))))} (end (\"NoMoves\" Loss))))\n\n###\n\n", "completion": "(define \"HopSequence\" (\"HopCapture\" (from #1) #2 (then (\"ReplayIfCanMove\" (\"HopCapture\" (from (last To)) SameDirection))))) (game \"Konane\" (players 2) (equipment { (board (square 8)) (piece \"Marker\" Each)}) (rules (start { (place \"Marker1\" (sites Phase 1)) (place \"Marker2\" (sites Phase 0))}) phases:{ (phase \"OpeningP1\" P1 (play (move Remove (intersection (union (sites Corners) (sites Centre)) (sites Phase 1)))) (nextPhase Mover \"Movement\")) (phase \"OpeningP2\" P2 (play (move Remove (sites Around (last To) Own))) (nextPhase Mover \"Movement\")) (phase \"Movement\" (play (if \"SameTurn\" (or (\"HopSequence\" (last To) SameDirection) (move Pass)) (forEach Piece \"Marker\" (\"HopSequence\" (from) Orthogonal)))))} (end (\"NoMoves\" Loss)))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x9 board, with two stores in between the holes. Players own the store to their right. Nine counters in each hole. A player takes all of the counters from one of the holes in their row and sows them anti-clockwise. The first stone is dropped into the hole that was just emptied, except when there is only one stone, in which case it is moved to the next hole. If the last counter falls into an opponent's hole making this hole have an even number of counters, these counters are captured and placed in the player's store. Otherwise, the turn ends. When the last counter falls into an opponent's hole, making it contain three counters, it is made into a \\ \n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (+ (count at:(mapEntry #1)) (count in:(sites #1)))) (define \"CaptureFromTuzOf\" (if (and (> (\"Tuz\" #1) 0) (> (count at:(\"Tuz\" #1)) 0)) (fromTo (from (\"Tuz\" #1)) (to (mapEntry #1)) count:(count at:(\"Tuz\" #1))))) (define \"Tuz\" (value Player #1)) (define \"Columns\" 9) (game \"Toguz Kumalak\" (players 2) (equipment { (board (merge { (rectangle 1 9) (shift 2.5 1 (rectangle 1 1)) (shift 5.5 1 (rectangle 1 1)) (shift 0 2 (rectangle 1 9))}) (track \"Track\" \"0,E,19,W\" loop:True) use:Vertex) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 9) (pair P2 10)}) (piece \"Seed\" Shared)}) (rules (start (set Count 9 to:(sites Track))) (play (move Select (from (sites Mover) if:(> (count at:(from)) 0)) (then (sow apply:(if (and (is In (to) (sites Next)) (is Even (count at:(to)))) (fromTo (from (to)) (to (mapEntry (mover))) count:(count at:(to))) (if (and { (is In (to) (sites Next)) (= (count at:(to)) 3) (< (\"Tuz\" Mover) 0) (if (< (\"Tuz\" Next) 0) True (!= (+ (to) (\"Tuz\" Next)) 19))}) (and (set Value Mover (to)) (fromTo (from (to)) (to (mapEntry (mover))) count:(count at:(to)))))) origin:(!= (count at:(last From)) 1) (then (and (\"CaptureFromTuzOf\" P1) (\"CaptureFromTuzOf\" P2))))))) (end (\"MancalaByScoreWhen\" (no Moves Mover))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"Temeen Tavag\" (players 2) (equipment { (board (remove (rotate 45 (concentric {1 4})) edges:{{1 4}}) use:Vertex) (hand Each) (piece \"Disc\" Each \"StepToEmpty\")}) (rules (start (place \"Disc\" \"Hand\" count:2)) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (\"PhaseMovePiece\" \"Movement\")} (end (\"BlockWin\"))))\n\n###\n\n", "completion": "An X, with a rounded line connecting the four endpoints of the X, but leaving two unconnected. A circle is drawn between these two unconnected endpoints. Two pieces per player. Players alternate turns placing one of their pieces on an empty point on the board. When all of the pieces are placed, players alternate turns moving one of the pieces to an empty adjacent point on the board, moving along the lines. The player who blocks their opponent from being able to move wins. The board is a circle. END" }, { "prompt": "Construct a Ludii game based on the following description\nEach player has 24 pieces, which are placed on the intersections of the lines and move along the lines to an adjacent intersection. Players may capture opponents' pieces by jumping them. Captures are not obligatory. Multiple captures can be made. A player wins by capturing all of the opponent's pieces. \n\n###\n\n", "completion": "(game \"Peralikatuma\" (players 2) (equipment { (\"AlquerqueBoardWithFourTriangles\") (piece \"Marker\" Each)}) (rules (start { (place \"Marker1\" (union {(expand (sites Bottom) steps:2) (expand (sites Right) steps:3) (sites {\"F3\" \"G3\" \"F4\" \"F6\" \"F7\" \"G7\"})})) (place \"Marker2\" (union {(expand (sites Top) steps:2) (expand (sites Left) steps:3) (sites {\"C3\" \"D3\" \"D4\" \"D6\" \"D7\" \"C7\"})}))}) (play (if \"SameTurn\" (or (\"HopSequenceCaptureAgain\") (move Pass)) (forEach Piece \"Marker\" (or (\"HopSequenceCapture\") (\"StepToEmpty\"))))) (end (\"NoMoves\" Loss)))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"Move\" (if (no Pieces Mover) (if (is Mover P1) (forEach Piece (\"PieceMove\" \"Track3\") P3) (if (is Mover P3) (forEach Piece (\"PieceMove\" \"Track1\") P1) (if (is Mover P4) (forEach Piece (\"PieceMove\" \"Track2\") P2) (forEach Piece (\"PieceMove\" \"Track4\") P4)))) (forEach Piece))) (define \"PieceMove\" (or (if (and {(= 0 (count MovesThisTurn)) (\"Triple\") (\"HasASixThreeOrTwo\") (= 3 (\"CountPieceTypeInStack\" (mover) (from)))}) (move (from (from) level:(level)) (to (\"NextSiteOnTrack\" (* 2 (\"Die1\")) from:(from) #1)) (then (forEach Level (last From) FromTop (if (is Mover (who at:(last From) level:(level))) (fromTo (from (last From) level:(level)) (to (last To)))))))) (forEach Die if:(\"DieNotUsed\") (if (\"IsEndTrack\" (\"NextSiteOnTrack\" (pips) from:(from) #1)) (move Remove (from) level:(level)) (move (from (from) level:(level)) (to (\"NextSiteOnTrack\" (pips) from:(from) #1)))) (then (\"ReplayNotAllDiceUsed\"))) (then (forEach Level (last To) FromTop (if (and (\"IsEnemyAt\" (last To) level:(level)) (= 1 (\"CountPieceTypeInStack\" (who at:(last To) level:(level)) (last To)))) (fromTo (from (last To) level:(level)) (to (mapEntry \"Start\" (who at:(last To) level:(level)))))))))) (define \"HasASixThreeOrTwo\" (or { (is AnyDie 6) (is AnyDie 3) (is AnyDie 2)})) (define \"CountPieceTypeInStack\" (count Pieces of:#1 in:(sites {#2}))) (define \"HasDouble\" (or { (= (\"Die1\") (\"Die2\")) (= (\"Die1\") (\"Die3\")) (= (\"Die2\") (\"Die3\"))})) (define \"Die3\" (face 99)) (define \"Die2\" (face 98)) (define \"Die1\" (face 97)) (define \"Triple\" (all DiceEqual)) (game \"Chaupar\" (players 4) (equipment { (\"PachisiBoard\" { (track \"Track1\" \"61,S,E,N,11,E,N,W,53,N,W,S,42,W,S,E,8,54,E1,N7,End\" P1 directed:True) (track \"Track2\" \"21,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\" \"88,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\" \"32,E,N,W,53,N,W,S,42,W,S,E,8,S,E,N,11,E,N1,W7,End\" P4 directed:True)}) (dice d:4 faces:{1 2 5 6} num:3) (map \"Start\" {(pair P1 61) (pair P2 21) (pair P3 88) (pair P4 32)}) (piece \"Pawn\" Each (\"PieceMove\" \"Track\"))}) (rules (start { (set Team 1 {P1 P3}) (set Team 2 {P2 P4}) (place Stack \"Pawn1\" (sites {61 58 59 56})) (place Stack \"Pawn2\" (sites {21 20 0 1})) (place Stack \"Pawn3\" (sites {91 88 93 90})) (place Stack \"Pawn4\" (sites {33 32 49 50}))}) (play (\"RollEachNewTurnMove\" (\"Move\"))) (end (\"EscapeTeamWin\"))))\n\n###\n\n", "completion": "Four 3x8 rectangles arranged in a cross with a large empty square in the center. Two teams of two players, or by two players playing with two sets of pieces. The pieces move along the outer track of the board according to the throw of three four-sided dice with values of 1, 2, 5 and 6. The values of each die must be played individually, except in certain cases. Each player has four pieces, which begin on the sixth and seventh space of the central row and the seventh and eight space in the right hand row of the arm of the board belonging to the player. If a piece lands on a space occupied by an opponent, the opponent's piece is sent back to the starting position. If two of a player's pieces are on the same space, they cannot be sent to the beginning. In addition, when three pieces are on the same spaces, if triple sixes are thrown the pieces may move twelve spaces together. The same rule applies for threes and twos, moving six and four, respectively. After completing a circuit of the board, the pieces then move into the central row of squares in the arm where the player began. The player must then move off all of their pieces by an exact roll. If a player has removed all of their pieces from the board and their partner is still playing, the player rolls on what would be their turn and the partner moves according to these rolls in addition to their own turn. The player or team to remove all of their pieces from the board first wins.\n 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": "Describe the mechanics of the following Ludii game\n(game \"Sudoku\" (players 1) (equipment { (board (square 9) (values Cell (range 1 9))) (regions {Columns Rows SubGrids})}) (rules (start (set { {1 9} {6 4} {11 8} {12 5} {16 1} {20 1} {25 6} {26 8} {30 1} {34 3} {40 4} {41 5} {42 7} {46 5} {50 7} {55 7} {58 9} {60 2} {65 3} {66 6} {72 8}})) (play (satisfy (all Different))) (end (if (is Solved) (result P1 Win)))))\n\n###\n\n", "completion": "Played on a 9x9 grid divided into 3x3 groups of 9 or \\ END" }, { "prompt": "Construct a Ludii game based on the following description\n3x6 board. Each player owns the row closest to them and the half of the central row to their right. Play begins with three counters in each hole. During the first phase of the game, the players race each other (i.e., do not take turns) to be the first person to drop the last counter into an empty hole. Play moves from left to right in the row closest to the player, right to left in the central row, and left to right in the furthest row. Upon reaching the final hole in the opponent's row, play continues with the first hole in the player's own row. In the first phase, Players take counters from the leftmost hole in their row and sow them in the appropriate direction. When the final counter lands in a hole with counters, they are picked up and sowing continues until the last counter is dropped into an empty hole. Play continues in phase two in the same manner as before, but the players take turns and the player who \\ \n\n###\n\n", "completion": "(define \"OppositePit\" (if (is Mover P1) (+ (to) (* \"Columns\" 2)) (- (to) (* \"Columns\" 2)))) (define \"NextRowPit\" (if (is Mover P1) (+ (to) \"Columns\") (- (to) \"Columns\"))) (define \"Columns\" 6) (define \"HasCaptured\" (is Pending)) (define \"LastHoleSowed\" (if (is Pending) (\"LastPitSowed\") (sites {(last To afterConsequence:True)}))) (define \"LastPitSowed\" (sites Pending)) (define \"StoreLastPitSowed\" (set Pending (to))) (define \"PiecesOwnedBy\" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (game \"Abalala'e\" (players 2) (equipment { (mancalaBoard 3 \"Columns\" store:None { (track \"Track\" \"0,E,N1,W5,N1,E\" loop:True P1) (track \"Track\" \"17,W,S1,E5,S1,W\" loop:True P2)}) (regions \"Home\" P1 (union (sites Bottom) (sites {\"D2\" \"E2\" \"F2\"}))) (regions \"Home\" P2 (union (sites Top) (sites {\"A2\" \"B2\" \"C2\"}))) (regions \"LeftPart\" P1 (sites {\"A1\" \"B1\" \"C1\"})) (regions \"LeftPart\" P2 (sites {\"D3\" \"E3\" \"F3\"})) (regions \"MiddleRow\" (sites {\"A2\" \"B2\" \"C2\" \"D2\" \"E2\" \"F2\"})) (map \"LeftHole\" {(pair P1 0) (pair P2 17)}) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 3 to:(union (sites P1 \"Home\") (sites P2 \"Home\")))) (play (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(> (count at:(from)) 0)) (then (sow count:(if (\"HasCaptured\") 1 (count at:(last To))) \"Track\" owner:(mover) apply:(if (> (count at:(to)) 1) (moveAgain) (if (is In (to) (sites Mover \"Home\")) (if (is In (to) (sites \"MiddleRow\")) (if (> (count at:\"NextRowPit\") 0) (and { (fromTo (from \"NextRowPit\") (to (handSite Mover)) count:(count at:\"NextRowPit\")) (moveAgain) (\"StoreLastPitSowed\")})) (if (is In (to) (sites Mover \"LeftPart\")) (and { (if (> (count at:\"NextRowPit\") 0) (and { (fromTo (from \"NextRowPit\") (to (handSite Mover)) count:(count at:\"NextRowPit\")) (moveAgain) (\"StoreLastPitSowed\")})) (if (> (count at:\"OppositePit\") 0) (and { (fromTo (from \"OppositePit\") (to (handSite Mover)) count:(count at:\"OppositePit\")) (moveAgain) (\"StoreLastPitSowed\")}))}) (if (> (count at:\"OppositePit\") 0) (and { (fromTo (from \"OppositePit\") (to (handSite Mover)) count:(count at:\"OppositePit\")) (moveAgain) (\"StoreLastPitSowed\")})))))))))) (end (\"MancalaByScoreWhen\" (or { (all Sites (sites P1 \"Home\") if:(= 0 (count at:(site)))) (all Sites (sites P2 \"Home\") if:(= 0 (count at:(site))))}))))) 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 the base of the triangle, and another bisecting this line. Each player has sixteen pieces, which begin on the points of one triangle and the two rows of points in front of it, thus leaving the central row of points empty. Players alternate turns moving a piece to an empty adjacent spot along the lines. A piece may capture an opponent's piece by hopping over it to an empty space immediately on the opposite side of the piece, along the lines of the board. The first player to capture all of the opponent's pieces wins. \n\n###\n\n", "completion": "(game \"Dam (Singapore)\" (players 2) (equipment { (\"AlquerqueBoardWithBottomAndTopTriangles\") (piece \"Marker\" Each (or (\"HopCapture\") (\"StepToEmpty\")))}) (rules (start { (place \"Marker1\" (union {(sites Row 0) (sites Row 1) (sites Row 2) (sites Row 3)})) (place \"Marker2\" (union {(sites Row 5) (sites Row 6) (sites Row 7) (sites Row 8)}))}) (play (forEach Piece)) (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nSTONE PLACEMENT Players take turns adding their stones to the board, one stone per turn. Black makes the first placement of the game. Each player will always have a placement available on his turn and must\n make one.\n \n OBJECT OF THE GAME To win you must connect two of your islands, which are exactly opposite each other, with a contiguous sequence of your stones. The stones of your islands can be included in the sequence. \n\n###\n\n", "completion": "(game \"Atoll\" (players 2) (equipment { (board (remove (rotate 90 (hex Rectangle 13 12)) cells:{138 139 148 149 0 1 10 11 69 80})) (piece \"Marker\" Each)}) (rules (start { (place \"Marker1\" (sites {132 133 134 135 131 120 108 97 85 7 6 5 4 8 19 31 42 54})) (place \"Marker2\" (sites {136 137 138 139 64 53 41 30 18 3 2 1 0 121 109 98 86 75}))}) (play (move Add (to (sites Empty)))) (end (if (is Mover P1) { (if (or (is Connected {(sites {132..135}) (sites {4..7})}) (is Connected {(sites {131 120 108 97 85}) (sites {54 42 31 19 8})})) (result Mover Win)) (if (or (is Connected {(sites {121 109 98 86 75}) (sites {64 53 41 30 18})}) (is Connected {(sites {136..139}) (sites {0..3})})) (result Mover Win))})))) END" }, { "prompt": "Construct a Ludii game based on the following description\nTake turns placing stones on a hexhex board of size 4, or a square board of an odd size not larger than 9. The winner is the player who places a stone on the center cell. A placement N steps away from the perimeter must have at least N friendly pieces in sight. On the square board, pieces see in all 8 directions. A square board of size 9 is currently selected The pie rule is currently not in force.\n\n###\n\n", "completion": "(game \"Center\" (players 2) (equipment { (piece \"Marker\" Each)}) (rules (play (move Add (to (sites Empty) if:(<= (count Steps All (to) (sites Perimeter)) (count Sites in:(intersection (sites LineOfSight at:(to) All) (sites Occupied by:Mover))))))) (end (if (is Occupied (centrePoint)) (result Next Loss))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n5x5 board, with an X in the central square of each side of the board, as well as the central square of the board. Two players. Two pieces per player. Four cowrie shells used as dice. Throws have the value of the number of mouths that land face up, with no mouths up = 8. Players start on opposite sides of the board, the first point on their track being the marked square on that side. Players move in an anti-clockwise direction around the board, until reaching the space before the starting space, at which point they move into the space above it, and proceed around the inner part of the board in a clockwise direction, until below the central square. Players enter a piece with a throw of 1. Throws of 1 or 8 give the player another turn. When a player's piece lands on the same space as a space with an opponent's piece, the opponent's piece is removed from the board and must enter again, and the player causing this receives another throw. Pieces resting on a marked square cannot be sent back to start. To reach the central space, the player must throw the exact number required. The first player to move both pieces to the central space first wins. \n\n###\n\n", "completion": "(define \"AllPiecesOnCentre\" (and (= 1 (count Sites in:(sites Occupied by:#1 top:False))) (is In (centrePoint) (sites Occupied by:#1 top:False)))) (define \"Throw1\" (= (\"ThrowValue\") 1)) (define \"IsSpecialThrow\" (is In (\"ThrowValue\") (sites {1 8}))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" #2 #1)) (define \"ThrowValue\" (mapEntry \"Throw\" (count Pips))) (game \"Siga (Sri Lanka)\" (players 2) (equipment { (board (square 5) { (track \"Track1\" \"2,E,N,W,S,E1,N3,E2,S2,W1,N1\" P1 directed:True) (track \"Track2\" \"22,W,S,E,N,W1,S3,W2,N2,E1,S1\" P2 directed:True)}) (piece \"Marker\" Each (move (from (from) level:(level)) (to (\"SiteToMoveOnTrack\" from:(from) (\"ThrowValue\")) if:True (apply (if (and (not (is In (to) (sites \"SafeSites\"))) (\"IsEnemyAt\" (to))) (and (forEach Level (to) FromTop (fromTo (from (to) level:(level)) (to (handSite (who at:(to) level:(level)))))) (moveAgain))))))) (hand Each) (\"StickDice\" 4) (map \"Throw\" {(pair 0 8) (pair 1 1) (pair 2 2) (pair 3 3) (pair 4 4)}) (map \"Entry\" {(pair P1 2) (pair P2 22)}) (regions \"SafeSites\" (sites {2 10 12 14 22}))}) (rules (start { (place Stack \"Marker1\" (handSite P1) count:2) (place Stack \"Marker2\" (handSite P2) count:2)}) (play (\"RollMove\" (or (if (and (is Occupied (handSite Mover)) (\"Throw1\")) (move (from (handSite Mover)) (to (mapEntry \"Entry\" (mover))))) (forEach Piece)) (then (if (\"IsSpecialThrow\") (moveAgain))))) (end (if (\"AllPiecesOnCentre\" Mover) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayers alternate turns. A player's turn consists on either placing piece on an empty field on board, or sliding one of their pieces into an empty one on the board. Players cannot pass. If each player performs three slides in a row then the game ends immediately as a draw. A player wins when any of the opponent's pieces are surrounded and cannot move. If one of a player's own pieces is surrounded on their turn, they lose even if an opponent's stone is surrounded at the same time. \n\n###\n\n", "completion": "(define \"SurroundedMySelf\" (\"NoSites\" (sites Around (last To) if:(is Empty (to))))) (define \"SurroundedOver\" (is Triggered \"Surrounded\" #1)) (define \"ThreeSlideInARow\" (= (counter) 5)) (define \"SurroundedOf\" (surround (from (last To)) Orthogonal (between if:(is #1 (who at:(between))) (apply #2)) (to if:(is Occupied (to))))) (game \"Susan\" (players 2) (equipment { (board (hex 5)) (piece \"Marker\" Each \"StepOrthogonalToEmpty\")}) (rules (play (or (move Add (to (sites Empty)) (then (set Counter))) (forEach Piece) (then (priority (\"SurroundedOf\" Friend (trigger \"Surrounded\" (mover))) (\"SurroundedOf\" Enemy (trigger \"Surrounded\" (next))))))) (end { (if \"ThreeSlideInARow\" (result Mover Draw)) (if \"SurroundedMySelf\" (result Next Win)) (if (\"SurroundedOver\" P1) (result P2 Win)) (if (\"SurroundedOver\" P2) (result P1 Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6-9 holes with a store on either end. Play starts with same number of counters in each hole as number of holes in the row (6 counters if 6 holes in a row, etc). Store on either end. A player's store is the store to their left. Stores are included when sowing. Play begins from any hole belonging to the player. Counters are sowed clockwise: if the final counter lands in an empty hole, in player's own row, they take the counters in the opposite hole and place them in the store. If play ends in the store, they can then take counters from any of their holes and sow again. if play ends in an empty hole in the opponent's row, play ends. If play ends in a hole with counters, those are collected and sowing continues. A round ends when there are no counters left in a player's row. The opponent then takes all remaining counters and adds them to their store. Next round begins with each player taking the counters from their store and placing the same number of counters in the holes as when the game began, starting from right to left. Surplus counters are placed in the store. Unfilled holes are excluded from play in this round. Play continues as before. Play continues with as many rounds as needed until one player does not have enough counters to fill a single hole. Each player has 6 holes.\n\n###\n\n", "completion": "(define \"RightMostEmpty\" (trackSite FirstSite from:(mapEntry \"RightMost\" Mover) if:(is Empty (to)))) (define \"OneRowIsEmpty\" (or (all Sites (sites Bottom) if:(= 0 (count at:(site)))) (all Sites (sites Top) if:(= 0 (count at:(site)))))) (define \"NoPieceOnBoard\" (all Sites (union (sites Top) (sites Bottom)) if:(= 0 (count at:(site))))) (define \"PlayableSites\" (sites (values Remembered \"Playable\"))) (define \"Columns\" 6) (game \"Main Chongkak\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" (track \"Track\" \"0,ENE,E,ESE,WSW,W\" loop:True)) (piece \"Seed\" Shared) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 FirstSite) (pair P2 LastSite)}) (map \"RightMost\" {(pair P1 (\"Columns\")) (pair P2 (+ (\"Columns\") 1))})}) (rules (start { (set RememberValue \"Playable\" (union (sites Top) (sites Bottom))) (set Count \"Columns\" to:(union (sites Bottom) (sites Top)))}) phases:{ (phase \"Sowing\" (play (or { (move Select (from (if (and (not (is Pending)) (\"SameTurn\")) (sites {(var \"Replay\")}) (sites Mover)) if:(and (is Occupied (from)) (is In (from) (\"PlayableSites\")))) (then (sow apply:(if (and (is In (to) (sites Mover)) (= 1 (count at:(to)))) (if (is Occupied (\"OppositePit\" (to))) (fromTo (from (\"OppositePit\" (to))) (to (mapEntry Mover)) count:(count at:(\"OppositePit\" (to))))) (if (= (to) (mapEntry Mover)) (and (set Pending) (moveAgain)) (if (and (< 1 (count at:(to))) (!= (to) (mapEntry Next))) (and (moveAgain) (set Var \"Replay\" (to)))))) skipIf:(and {(not (is In (to) (\"PlayableSites\"))) (!= (to) (mapEntry P1)) (!= (to) (mapEntry P2))}))))} (then (if (\"OneRowIsEmpty\") (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)))) (forget Value \"Playable\" All)}))))) (end (if (\"NoPieceOnBoard\") { (if (> (\"Columns\") (count at:(mapEntry P1))) (result P2 Win)) (if (> (\"Columns\") (count at:(mapEntry P2))) (result P1 Win))})) (nextPhase (\"NoPieceOnBoard\") \"BetweenRounds\")) (phase \"BetweenRounds\" (play (if (not (all Sites (sites Mover) if:(is Occupied (site)))) (if (<= (\"Columns\") (count at:(mapEntry Mover))) (move (from (mapEntry Mover)) (to \"RightMostEmpty\") count:(\"Columns\") (then (remember Value \"Playable\" (last To))))))) (nextPhase (all Passed) \"Sowing\"))})) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x12 board, divided in half. Spaces on each side take the form of semi-circular sockets, into which the pieces fit. Twelve pieces per player. Two 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. Each player enters their pieces into their home section of the board (to the left of one player, to the right of the other player, and move pieces along a horseshoe-shaped track around the board toward the other player's home space. At the beginning of play, the first player will choose one quadrant of the board, and the goal of the game will be for one player to move two pieces onto each of the six places in that quadrant. When a piece lands on a space occupied by a single piece of the opponent, the opponent's piece is removed from the board, and must be reentered. The quadrant selected is the top left one.\n\n###\n\n", "completion": "(define \"RemoveAPiece\" (move Remove (from))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" (pips))) (game \"Los Doze Canes\" (players 2) (equipment { (\"TableBoard\" \"TableTracksOppositeWithHands\") (dice d:6 num:2) (piece \"Disc\" Each (forEach Die if:(\"DieNotUsed\") (if (\"NoEnemyOrOnlyOne\" (\"SiteToMoveOnTrack\")) (move (from) (to \"SiteToMoveOnTrack\" (\"HittingCapture\" (handSite Next))))))) (hand Each)}) (rules (start { (place Stack \"Disc1\" (handSite P1) count:12) (place Stack \"Disc2\" (handSite P2) count:12)}) (play (\"RollEachNewTurnMove\" (or (forEach Piece top:True) (forEach Piece container:(mover) top:True) (then (\"ReplayNotAllDiceUsed\"))))) (end { (if (and { (= 2 (size Stack at:18)) (= 2 (size Stack at:19)) (= 2 (size Stack at:20)) (= 2 (size Stack at:21)) (= 2 (size Stack at:22)) (= 2 (size Stack at:23)) (= 0 (count Sites in:(difference (sites Occupied by:Mover) (sites {18..23}))))}) (result Mover Win)) (if (and (< 2 (size Stack at:12)) (< 2 (size Stack at:0))) (result Mover Draw))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\n4x8 board. Two counters in each hole. Opening play: Two players play simultaneously, lifting and sowing counters from their outer rows. Rules for sowing and capturing are the same as in the main phase of the game except that all holes in each player's outer rows are considered to be in opposition and back captures can be made from them. Once a counter has been sown into the inner row, this ceases and captures can only be made from the inner row. The opening ends when both players reach an empty hole, and the first player to do so begins play in the main phase. Main phase: Play begins from any hole on the player's side of the board with counters in it. Singletons cannot move. Sowing happens in an anti-clockwise direction. If the last counter lands in an empty hole, the turn is over. For capturing: four holes are in opposition when one player has the front row hole occupied and the opponent has both of the holes opposite it occupied. If the last hole in a sowing is in opposition, the player takes the counters in both of the opponent's holes and places them in the empty hole from which the player lifted the counters. The player then sows the captured counters from this hole. Further captures in the sowing can occur in the same way. If the last counter lands on a hole that is occupied but not in opposition, these counters are picked up and sowing continues. Play ends when one player captures all the opponent's counters or one player cannot play. The player who cannot play loses. Each row has 8 holes.\n\n###\n\n", "completion": "(define \"NextHole\" (\"NextSiteOnTrack\" #3 from:#1 #2)) (define \"CorrespondingOuterPit\" (if (is Mover P1) (- #1 \"Columns\") (+ #1 \"Columns\"))) (define \"Columns\" 8) (game \"Pereauni\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"TrackCCW1\" \"0,E,N1,W\" loop:True P1) (track \"TrackCCW2\" \"16,E,N1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"TrackCCW1\")) (regions \"Home\" P2 (sites Track \"TrackCCW2\")) (regions \"Inner\" P1 (difference (sites Track \"TrackCCW1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"TrackCCW2\") (sites Top))) (regions \"Outer\" P1 (sites Bottom)) (regions \"Outer\" P2 (sites Top)) (piece \"Seed\" Shared)}) (rules (start (set Count 2 to:(union (sites P1 \"Home\") (sites P2 \"Home\")))) phases:{ (phase \"OuterPhase\" (play (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (sites Mover \"Outer\")) if:(if (\"SameTurn\") (< 0 (count at:(from))) (< 1 (count at:(from))))) (then (sow count:(if (\"SameTurn\") (var \"Count\") (count at:(last From))) \"TrackCCW\" owner:(mover) apply:(and (if (< 1 (count at:(to))) (and (moveAgain) (if (and (is Occupied (\"OppositePit\" (to))) (is In (to) (sites Mover \"Inner\"))) (and { (fromTo (from (\"OppositePit\" (to))) (to (\"CorrespondingOuterPit\" (to))) count:(count at:(\"OppositePit\" (to)))) (if (is Occupied (\"OppositeOuterPit\" (to))) (fromTo (from (\"OppositeOuterPit\" (to))) (to (\"CorrespondingOuterPit\" (to))) count:(count at:(\"OppositeOuterPit\" (to))))) (set Var \"Replay\" (\"CorrespondingOuterPit\" (to))) (if (= 1 (count at:(\"CorrespondingOuterPit\" (to)))) (set Var \"Count\" (+ { 1 (count at:(\"OppositePit\" (to))) (count at:(\"OppositeOuterPit\" (to)))})) (set Var \"Count\" (+ (count at:(\"OppositePit\" (to))) (count at:(\"OppositeOuterPit\" (to))))))}) (and (set Var \"Replay\" (to)) (set Var \"Count\" (count at:(to))))))) (if (!= 1 (value Player Mover)) (set Value Mover 1))))))) (nextPhase Mover (= 1 (count at:(last To afterConsequence:True))) \"MainPhase\")) (phase \"MainPhase\" (play (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (sites Mover)) if:(if (\"SameTurn\") (< 0 (count at:(from))) (< 1 (count at:(from))))) (then (sow count:(if (\"SameTurn\") (var \"Count\") (count at:(last From))) \"TrackCCW\" owner:(mover) apply: (if (< 1 (count at:(to))) (and (moveAgain) (if (and { (is Occupied (\"OppositePit\" (to))) (is In (to) (sites Mover \"Inner\"))}) (and { (fromTo (from (\"OppositePit\" (to))) (to (\"CorrespondingOuterPit\" (to))) count:(count at:(\"OppositePit\" (to)))) (if (is Occupied (\"OppositeOuterPit\" (to))) (fromTo (from (\"OppositeOuterPit\" (to))) (to (\"CorrespondingOuterPit\" (to))) count:(count at:(\"OppositeOuterPit\" (to))))) (set Var \"Replay\" (\"CorrespondingOuterPit\" (to))) (if (= 1 (count at:(\"CorrespondingOuterPit\" (to)))) (set Var \"Count\" (+ { 1 (count at:(\"OppositePit\" (to))) (count at:(\"OppositeOuterPit\" (to)))})) (set Var \"Count\" (+ (count at:(\"OppositePit\" (to))) (count at:(\"OppositeOuterPit\" (to))))))}) (and (set Var \"Replay\" (to)) (set Var \"Count\" (count at:(to))))))))))))} (end (\"BlockWin\")))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nEach player has 7 holes. -> Each player has 8 holes.\n(define \"RightMostEmpty\" (trackSite FirstSite from:(mapEntry \"RightMost\" Mover) if:(is Empty (to)))) (define \"OneRowIsEmpty\" (or (all Sites (sites Bottom) if:(= 0 (count at:(site)))) (all Sites (sites Top) if:(= 0 (count at:(site)))))) (define \"NoPieceOnBoard\" (all Sites (union (sites Top) (sites Bottom)) if:(= 0 (count at:(site))))) (define \"PlayableSites\" (sites (values Remembered \"Playable\"))) (define \"Columns\" 7) (game \"Main Chongkak\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" (track \"Track\" \"0,ENE,E,ESE,WSW,W\" loop:True)) (piece \"Seed\" Shared) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 FirstSite) (pair P2 LastSite)}) (map \"RightMost\" {(pair P1 (\"Columns\")) (pair P2 (+ (\"Columns\") 1))})}) (rules (start { (set RememberValue \"Playable\" (union (sites Top) (sites Bottom))) (set Count \"Columns\" to:(union (sites Bottom) (sites Top)))}) phases:{ (phase \"Sowing\" (play (or { (move Select (from (if (and (not (is Pending)) (\"SameTurn\")) (sites {(var \"Replay\")}) (sites Mover)) if:(and (is Occupied (from)) (is In (from) (\"PlayableSites\")))) (then (sow apply:(if (and (is In (to) (sites Mover)) (= 1 (count at:(to)))) (if (is Occupied (\"OppositePit\" (to))) (fromTo (from (\"OppositePit\" (to))) (to (mapEntry Mover)) count:(count at:(\"OppositePit\" (to))))) (if (= (to) (mapEntry Mover)) (and (set Pending) (moveAgain)) (if (and (< 1 (count at:(to))) (!= (to) (mapEntry Next))) (and (moveAgain) (set Var \"Replay\" (to)))))) skipIf:(and {(not (is In (to) (\"PlayableSites\"))) (!= (to) (mapEntry P1)) (!= (to) (mapEntry P2))}))))} (then (if (\"OneRowIsEmpty\") (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)))) (forget Value \"Playable\" All)}))))) (end (if (\"NoPieceOnBoard\") { (if (> (\"Columns\") (count at:(mapEntry P1))) (result P2 Win)) (if (> (\"Columns\") (count at:(mapEntry P2))) (result P1 Win))})) (nextPhase (\"NoPieceOnBoard\") \"BetweenRounds\")) (phase \"BetweenRounds\" (play (if (not (all Sites (sites Mover) if:(is Occupied (site)))) (if (<= (\"Columns\") (count at:(mapEntry Mover))) (move (from (mapEntry Mover)) (to \"RightMostEmpty\") count:(\"Columns\") (then (remember Value \"Playable\" (last To))))))) (nextPhase (all Passed) \"Sowing\"))}))\n\n###\n\n", "completion": "(define \"RightMostEmpty\" (trackSite FirstSite from:(mapEntry \"RightMost\" Mover) if:(is Empty (to)))) (define \"OneRowIsEmpty\" (or (all Sites (sites Bottom) if:(= 0 (count at:(site)))) (all Sites (sites Top) if:(= 0 (count at:(site)))))) (define \"NoPieceOnBoard\" (all Sites (union (sites Top) (sites Bottom)) if:(= 0 (count at:(site))))) (define \"PlayableSites\" (sites (values Remembered \"Playable\"))) (define \"Columns\" 8) (game \"Main Chongkak\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" (track \"Track\" \"0,ENE,E,ESE,WSW,W\" loop:True)) (piece \"Seed\" Shared) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 FirstSite) (pair P2 LastSite)}) (map \"RightMost\" {(pair P1 (\"Columns\")) (pair P2 (+ (\"Columns\") 1))})}) (rules (start { (set RememberValue \"Playable\" (union (sites Top) (sites Bottom))) (set Count \"Columns\" to:(union (sites Bottom) (sites Top)))}) phases:{ (phase \"Sowing\" (play (or { (move Select (from (if (and (not (is Pending)) (\"SameTurn\")) (sites {(var \"Replay\")}) (sites Mover)) if:(and (is Occupied (from)) (is In (from) (\"PlayableSites\")))) (then (sow apply:(if (and (is In (to) (sites Mover)) (= 1 (count at:(to)))) (if (is Occupied (\"OppositePit\" (to))) (fromTo (from (\"OppositePit\" (to))) (to (mapEntry Mover)) count:(count at:(\"OppositePit\" (to))))) (if (= (to) (mapEntry Mover)) (and (set Pending) (moveAgain)) (if (and (< 1 (count at:(to))) (!= (to) (mapEntry Next))) (and (moveAgain) (set Var \"Replay\" (to)))))) skipIf:(and {(not (is In (to) (\"PlayableSites\"))) (!= (to) (mapEntry P1)) (!= (to) (mapEntry P2))}))))} (then (if (\"OneRowIsEmpty\") (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)))) (forget Value \"Playable\" All)}))))) (end (if (\"NoPieceOnBoard\") { (if (> (\"Columns\") (count at:(mapEntry P1))) (result P2 Win)) (if (> (\"Columns\") (count at:(mapEntry P2))) (result P1 Win))})) (nextPhase (\"NoPieceOnBoard\") \"BetweenRounds\")) (phase \"BetweenRounds\" (play (if (not (all Sites (sites Mover) if:(is Occupied (site)))) (if (<= (\"Columns\") (count at:(mapEntry Mover))) (move (from (mapEntry Mover)) (to \"RightMostEmpty\") count:(\"Columns\") (then (remember Value \"Playable\" (last To))))))) (nextPhase (all Passed) \"Sowing\"))})) END" }, { "prompt": "Construct a Ludii game based on the following description\nEach piece has four dichotomous attributes \u2013 color, height, shape, and consistency \u2013 so each piece is either black or white, tall or short, square or round, and hollow or solid. The object is to place the fourth piece in a row in which all four pieces have at least one attribute in common. The twist is that your opponent gets to choose the piece you place on the board each turn. \n\n###\n\n", "completion": "(game \"Quarto\" (players 2) (equipment { (board (square 4) use:Vertex) (piece \"Disc\" Each) (piece \"Square\" Each) (hand Shared size:16)}) (rules (start { (place \"Disc1\" (handSite Shared 0)) (place \"Disc1\" (handSite Shared 1) value:1) (place \"Disc1\" (handSite Shared 2) state:1) (place \"Disc1\" (handSite Shared 3) state:1 value:1) (place \"Disc2\" (handSite Shared 4)) (place \"Disc2\" (handSite Shared 5) value:1) (place \"Disc2\" (handSite Shared 6) state:1) (place \"Disc2\" (handSite Shared 7) state:1 value:1) (place \"Square1\" (handSite Shared 8)) (place \"Square1\" (handSite Shared 9) value:1) (place \"Square1\" (handSite Shared 10) state:1) (place \"Square1\" (handSite Shared 11) state:1 value:1) (place \"Square2\" (handSite Shared 12)) (place \"Square2\" (handSite Shared 13) value:1) (place \"Square2\" (handSite Shared 14) state:1) (place \"Square2\" (handSite Shared 15) state:1 value:1)}) phases:{ (phase \"Select\" (play (move Select (from Cell (difference (sites Hand Shared) (sites Empty 1))))) (nextPhase \"Place\")) (phase \"Place\" (play (move (from Cell (last From)) (to (sites Empty)) (then (moveAgain)))) (end { (if (is Line 4 All whats:{(id \"Disc\" P1) (id \"Disc\" P2)}) (result Mover Win)) (if (is Line 4 All whats:{(id \"Square\" P1) (id \"Square\" P2)}) (result Mover Win)) (if (is Line 4 All P1) (result Mover Win)) (if (is Line 4 All P2) (result Mover Win)) (if (is Line 4 All whats:{(id \"Disc\" P1) (id \"Disc\" P2) (id \"Square\" P1) (id \"Square\" P2)} if:(= 0 (state at:(to)))) (result Mover Win)) (if (is Line 4 All whats:{(id \"Disc\" P1) (id \"Disc\" P2) (id \"Square\" P1) (id \"Square\" P2)} if:(= 1 (state at:(to)))) (result Mover Win)) (if (is Line 4 All whats:{(id \"Disc\" P1) (id \"Disc\" P2) (id \"Square\" P1) (id \"Square\" P2)} if:(= 0 (value Piece at:(to)))) (result Mover Win)) (if (is Line 4 All whats:{(id \"Disc\" P1) (id \"Disc\" P2) (id \"Square\" P1) (id \"Square\" P2)} if:(= 1 (value Piece at:(to)))) (result Mover Win))}) (nextPhase \"Select\"))})) END" }, { "prompt": "Construct a Ludii game based on the following description\n4x6-16 board. Play begins with two counters in each hole. The first move must be from the inner row. Play begins from any of the player's holes, sowing clockwise. When the final counter lands in an occupied hole, these are picked up and sowing continues. Captures are made when the final counter falls into an empty 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. If the final counter falls into an empty hole and a capture cannot happen, the turn is over. Play ends when one player cannot move. Each player has 6 holes.\n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (define \"PlayFrom\" (play (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover #1)) if:(> (count at:(from)) 0)) (then (sow \"Track\" owner:(mover) apply:(if (= (count at:(to)) 1) (if (is In (to) (sites Mover \"Inner\")) (if (> (count at:(\"OppositePit\" (to))) 0) (and (fromTo (from (\"OppositePit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePit\" (to)))) (if (> (count at:(\"OppositeOuterPit\" (to))) 0) (fromTo (from (\"OppositeOuterPit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositeOuterPit\" (to)))))))) (moveAgain))))))) (define \"Columns\" 6) (game \"Muvalavala (Luena)\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"5,W,N1,E\" loop:True P1) (track \"Track2\" \"17,W,N1,E\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"Track1\")) (regions \"Home\" P2 (sites Track \"Track2\")) (regions \"Inner\" P1 (difference (sites Track \"Track1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"Track2\") (sites Top))) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 2 to:(union (sites P1 \"Home\") (sites P2 \"Home\")))) phases:{ (phase \"Opening\" (\"PlayFrom\" \"Inner\") (nextPhase (>= (count Turns) 2) \"Playing\")) (phase \"Playing\" (\"PlayFrom\" \"Home\"))} (end (\"MancalaByScoreWhen\" (no Moves Mover))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nTwo rows of six holes encircling a larger hole in the center. Two counters in each hole, except the center hole. Players move by removing the counters from one of the holes in their row and sowing them in an anti-clockwise direction. If the final counter of the sowing falls into an occupied hole, these counters are picked up and sowing continues. When the final counter falls into an empty hole, the turn ends. If the final counter falls into a hole already containing two others, the player takes these counters and covers the hole. The three counters are sown beginning with the following hole. When sowing, if a player reaches a covered hole in their row, they skip it and continue sowing with the next available hole. If the player reaches a covered hole in the opponent's row, the counter that would fall into it is instead deposited into the central hole. If this is the final counter, the turn ends. It is possible to sow a single counter. The player who can no longer sow from their row loses. \n\n###\n\n", "completion": "(define \"EnemySites\" (if (is Mover P1) (sites P2) (sites P1))) (define \"NextHoleFrom\" (\"NextSiteOnTrack\" #2 from:#1)) (game \"Deka\" (players 2) (equipment { (board (merge { (rectangle 1 5) (rectangle 3 1) (shift 0 2 (rectangle 1 5)) (shift 4 0 (rectangle 3 1)) (shift 2 1 (square 1))}) (track \"Track\" \"0,E,N,W,S1\" loop:True) use:Vertex) (regions P1 (sites {0..4 11})) (regions P2 (sites {5..10})) (piece \"Seed\" Shared)}) (rules (start (set Count 2 to:(difference (sites Board) 12))) (play (or { (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (sites Mover)) if:(is Occupied (from))) (then (sow apply:(if (not (and (is In (to) (sites Next)) (= (next) (state at:(to))))) (if (= 3 (count at:(to))) (and { (fromTo (from (to)) (to (\"NextHoleFrom\" (to) 1)) count:3) (sow (\"NextHoleFrom\" (to) 1) count:3 skipIf:(and (is In (to) (sites Mover)) (= 1 (state at:(to))))) (set State at:(to) 1)}) (if (< 1 (count at:(to))) (and (moveAgain) (set Var \"Replay\" (to)))))) skipIf:(and (is In (to) (sites Mover)) (= (mover) (state at:(to)))))))} (then (forEach Site (\"EnemySites\") (if (= 1 (state at:(site))) (and (fromTo (from (site)) (to (centrePoint)) count:(count at:(site))) (set State at:(site) 1))))))) (end (\"ForEachPlayerNoMovesLoss\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\n3x5 intersecting lines. Six pieces per player, arranged on the two short rows on opposite sides of the board. Players alternate turns moving a piece to an empty adjacent spot. Pieces move orthogonally in a horizontal or forward direction only. To capture, a piece may jump over an adjacent opponent's piece to an empty spot immediately on the opposite side of the piece along the lines of the board. Pieces may capture in a backwards direction. The player who captures all of the opponent's pieces wins. \n\n###\n\n", "completion": "(game \"Xarajlt\" (\"TwoPlayersNorthSouth\") (equipment { (board (rectangle 5 3) use:Vertex) (piece \"Marker\" Each (or (\"StepToEmpty\" (directions {Forward FR FL})) (\"HopOrthogonalCapture\")))}) (rules (start { (place \"Marker1\" (expand (sites Bottom))) (place \"Marker2\" (expand (sites Top)))}) (play (forEach Piece)) (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nRectangular board, divided into three sections lengthwise. Ten lines divide the outer two sections widthwide. Twelve pieces per player, which begin on the outer intersections closest to the player. Four stick dice, with front and back sides distinguished one from the other. Throws are as follows: Four backs up = kiust. Three backs up = 6; two backs up = 3; one back up = 2; four fronts up = four throws of 6. A throw of kiust is required to enter the opponent's inner row. The pieces of the left hand player move from left to right and then right to left in the next row, then left to right in the following row, then proceeding to circulate in the central two rows in a clockwise direction. The right hand player's pieces move from right to left in their home row, then left to right in the next row, then right to left in the third row, circulating in an anti-clockwise direction. Pieces landing on an opponent's piece with a throw of 2 in the central rows capture the opponent's piece. A player may only pass an opponent's piece without capture with a throw of 3. The player who captures all of the opponent's pieces wins. \n\n###\n\n", "completion": "(define \"Move\" (if (is In (from) (\"MiddleSites\")) (move (from (from)) (to (\"NextSiteOnTrack\" (\"ThrowValue\") \"LoopTrack\") if:(and { (if (\"IsEnemyAt\" (to)) (= 2 (\"ThrowValue\")) (is Empty (to))) (if (is In (to) (sites Next \"Home\")) (= 1 (var \"Kiust\")) True) (if (or (and (= 2 (\"ThrowValue\")) (\"IsEnemyAt\" (to))) (= 3 (\"ThrowValue\"))) True (all Sites (sites Track from:(\"NextSiteOnTrack\" 1 from:(from) \"LoopTrack\") to:(\"NextSiteOnTrack\" (- (\"ThrowValue\") 1) from:(from) \"LoopTrack\")) if:(not (\"IsEnemyAt\" (site)))))}) (apply (\"CaptureMove\")))) (move (from (from)) (to (\"NextSiteOnTrack\" (\"ThrowValue\") \"Track\") if:(and { (if (is In (to) (\"MiddleSites\")) (if (\"IsEnemyAt\" (to)) (= 2 (\"ThrowValue\")) (is Empty (to))) (is Empty (to))) (if (is In (to) (sites Next \"Home\")) (= 1 (var \"Kiust\")) True) (if (or (and (= 2 (\"ThrowValue\")) (\"IsEnemyAt\" (to))) (= 3 (\"ThrowValue\"))) True (all Sites (sites Track from:(\"NextSiteOnTrack\" 1 from:(from) \"Track\") to:(\"NextSiteOnTrack\" (- (\"ThrowValue\") 1) from:(from) \"Track\")) if:(not (\"IsEnemyAt\" (site)))))}) (apply (\"CaptureMove\")))) (then (and (if (= (count Pips) 4) (and (if (!= 1 (value Player Mover)) (moveAgain)) (if (<= (value Player Mover) 0) (set Value Mover 3) (set Value Mover (- (value Player Mover) 1))))) (set Var \"Kiust\" 0))))) (define \"CanEnterKiust\" (= (var \"Kiust\") 1)) (define \"CaptureMove\" (if (\"IsEnemyAt\" (to)) (remove (to)))) (define \"MiddleSites\" (difference (sites Board) (union (sites Left) (sites Right)))) (define \"ThrowValue\" (mapEntry \"Throw\" (count Pips))) (game \"Kiust Oyun\" (players 2) (equipment { (board (merge { (scale 2 1 (rectangle 12 2)) (shift 2 0 (scale 4 1 (rectangle 12 2))) (shift 6 0 (scale 2 1 (rectangle 12 2)))}) { (track \"Track1\" \"22,S,E1,N,E1,S\" P1 directed:True) (track \"Track2\" \"47,S,W1,N,W1,S\" P2 directed:True) (track \"LoopTrack1\" \"1,N,E1,S\" loop:True P1) (track \"LoopTrack2\" \"24,N,W1,S\" loop:True P2)} use:Vertex) (\"StickDice\" 4) (piece \"Marker\" Each (\"Move\")) (map \"Throw\" {(pair 0 0) (pair 3 6) (pair 2 3) (pair 1 2) (pair 4 6)}) (regions \"Home\" P1 (expand (sites Left))) (regions \"Home\" P2 (expand (sites Right)))}) (rules (start { (place \"Marker1\" (sites Left)) (place \"Marker2\" (sites Right))}) (play (do (if (or (= (var \"Kiust\") 1) (\"NewTurn\")) (roll)) next:(if (= 0 (\"ThrowValue\")) (move Pass (then (and (moveAgain) (set Var \"Kiust\" 1)))) (forEach Piece)))) (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nSeven concentric circles or squares. Four players. One piece per player. One player has a stick, which is hidden in their fist. The next player attempts to guess which hand holds the stick. If the player guessing guesses correctly, they enter their piece in the first circle or advances it to the next circle, and the stick is passed to them. If the guessing player guesses incorrectly, the player holding the stick moves their piece into the first circle or advances it to the next circle. The player with the stick keeps it until the next player guesses the hand holding the stick. The first player to reach the central circle wins. \n\n###\n\n", "completion": "(define \"NextSitePrev\" (if (is Prev P1) (\"NextSite\" from:(where \"Marker\" Prev) \"Track1\") (if (is Prev P2) (\"NextSite\" from:(where \"Marker\" Prev) \"Track2\") (if (is Prev P3) (\"NextSite\" from:(where \"Marker\" Prev) \"Track3\") (\"NextSite\" from:(where \"Marker\" Prev) \"Track4\"))))) (define \"NextSite\" (\"NextSiteOnTrack\" 1 #1 #2)) (game \"Ashere\" (players 4) (equipment { (board (concentric {4 4 4 4 4 4 4 4}) { (track \"Track1\" {28 24 20 16 12 8 4 0} P1 directed:True) (track \"Track2\" {29 25 21 17 13 9 5 1} P2 directed:True) (track \"Track3\" {30 26 22 18 14 10 6 2} P3 directed:True) (track \"Track4\" {31 27 23 19 15 11 7 3} P4 directed:True)} use:Vertex) (piece \"Marker\" Each) (piece \"Stick\" Shared) (hand Each size:2)}) (rules (start { (place \"Marker1\" 28) (place \"Marker2\" 29) (place \"Marker3\" 30) (place \"Marker4\" 31)}) phases:{ (phase \"Hiding\" (play (move Add (piece (id \"Stick\" Shared)) (to Cell (sites Hand Mover)) (then (set Hidden Cell at:(last To) to:Next)))) (nextPhase \"Guessing\")) (phase \"Guessing\" (play (move Select (from Cell (sites Hand Prev)) (then (and (if (is Empty (last To)) (and (fromTo (from (where \"Marker\" Prev)) (to (\"NextSitePrev\"))) (if (not (is In (\"NextSitePrev\") (sites Centre))) (set NextPlayer (player (prev))))) (and { (moveAgain) (fromTo (from (where \"Marker\" Mover)) (to (\"NextSite\" from:(where \"Marker\" Mover))))})) (remove Cell (sites Hand Prev)))))) (nextPhase \"Hiding\"))} (end (if (!= (- (count Players) (count Active)) (count Sites in:(forEach (sites Centre) if:(is Occupied (site))))) { (if (and (is Active P1) (is In (where \"Marker\" P1) (sites Centre))) (result P1 Win)) (if (and (is Active P2) (is In (where \"Marker\" P2) (sites Centre))) (result P2 Win)) (if (and (is Active P3) (is In (where \"Marker\" P3) (sites Centre))) (result P3 Win)) (if (and (is Active P4) (is In (where \"Marker\" P4) (sites Centre))) (result P4 Win))})))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe rules are exactly the same as in Chess, except the Queen also has the ability to move as a knight. \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 \"Amazon Chess\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (\"ChessPawn\" \"Pawn\" (or \"InitialPawnMove\" \"EnPassant\") (then (and (\"ReplayInMovingOn\" (sites Mover \"Promotion\")) (set Counter)))) (\"ChessRook\" \"Rook\" (then (set Counter)) (\"RememberPieceHasMoved\")) (\"ChessKing\" \"King\" (then (set Counter)) (\"RememberPieceHasMoved\")) (\"ChessBishop\" \"Bishop\" (then (set Counter))) (\"ChessKnight\" \"Knight\" (then (set Counter))) (piece \"Queen\" Each (or (\"SlideCapture\" ~ ~ (then (set Counter))) (\"LeapCapture\" \"KnightWalk\" (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 { (\"Checkmate\" \"King\") (if (or (no Moves Mover) (= (counter) 100)) (result Mover Draw))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe object of the game is to be the first player to occupy the opponent's castle with two of your own pieces, or, to capture all of your opponent's pieces while retaining two or more of your own pieces. Both knights and pawns can move either horizontally, vertically, or diagonally in three ways, as follows: One space in any direction (like a king in chess). This is called a plain move. A leaping move (called cantering) over an adjacent friendly piece to a vacant space immediately beyond. Multiple leaps over a player's own pieces are permitted. Cantering is always optional (never obligatory). A jumping move over an adjacent enemy piece to a vacant space immediately beyond. The enemy piece is captured and removed from the board. As in checkers, multiple jumps are allowed, and capturing is obligatory whenever it is possible. Pawns may make any of the three moves, but only one type of move per turn. Knights have a fourth option: a combination move consisting of a canter immediately followed by a jump (capture). This is called the knight's charge. The knight may, in this single move, perform multiple canters (or just one), followed by multiple jumps (or just one); but the canter(s) must precede the jump(s). A knight may not combine a plain move with a canter or a jump. \n\n###\n\n", "completion": "(define \"GoalFilledby\" (= (sites #2) (sites Occupied by:#1))) (define \"NotEnoughPieceForTheMover\" (and (>= (count Pieces Mover) 2) (= (count Pieces Next) 0))) (define \"NotEnoughPieceForBothPlayer\" (and (< (count Pieces Mover) 2) (< (count Pieces Next) 2))) (define \"HopSequence\" (\"Hop\" #1 #2 (then (if (and (not (\"InTheGoal\" (last To))) (can Move (\"Hop\" (last To) #2))) #3)))) (define \"Hop\" (move Hop (from #1) #2 (to if:(and (is In (to) \"EmptyButNotEnemyGoal\") (not (is Visited (to))))) #3)) (define \"Step\" (move Step (to if:(if (\"InTheGoal\" (from)) (and (is Empty (to)) (\"InTheGoal\" (to))) (is In (to) \"EmptyButNotEnemyGoal\"))))) (define \"OnAnEnemy\" (between if:(\"IsEnemyAt\" (between)) (apply (remove (between))))) (define \"WasAKnight\" (\"IsPieceAt\" \"Knight\" Mover (last To))) (define \"WasJumpingAFriend\" (is Pending)) (define \"MoveAgainAfterJumpingEnemy\" (moveAgain)) (define \"MoveAgainAfterJumpingFriend\" (and (moveAgain) (set Pending))) (define \"OnAFriend\" (between if:(\"IsFriendAt\" (between)))) (define \"EmptyButNotEnemyGoal\" (difference (sites Empty) (sites Mover))) (define \"InTheGoal\" (is In #1 (sites Next))) (game \"Camelot\" (players 2) (equipment { (board (keep (rectangle 12 16) (poly { {0 7} {1 10} {4 13} {12 13} {15 10} {16 7} {16 5} {15 2} {13 0} {3 0} {1 2} {0 5}}))) (piece \"Pawn\" Each (or (if (not (\"InTheGoal\" (from))) (\"HopSequence\" (from) \"OnAFriend\" \"MoveAgainAfterJumpingFriend\")) \"Step\")) (piece \"Knight\" Each (or (if (not (\"InTheGoal\" (from))) (\"HopSequence\" (from) \"OnAFriend\" \"MoveAgainAfterJumpingFriend\")) \"Step\")) (regions P1 (sites {\"A6\" \"A7\"})) (regions P2 (sites {\"P6\" \"P7\"}))}) (rules (start { (place \"Pawn1\" {\"F4\" \"F5\" \"F6\" \"F7\" \"F8\" \"F9\" \"G5\" \"G6\" \"G7\" \"G8\"}) (place \"Knight1\" {\"F3\" \"G4\" \"G9\" \"F10\"}) (place \"Pawn2\" {\"K4\" \"K5\" \"K6\" \"K7\" \"K8\" \"K9\" \"J5\" \"J6\" \"J7\" \"J8\"}) (place \"Knight2\" {\"K3\" \"J4\" \"J9\" \"K10\"})}) (play (if \"SameTurn\" (if \"WasJumpingAFriend\" (if \"WasAKnight\" (priority { (\"HopSequence\" (last To) \"OnAnEnemy\" \"MoveAgainAfterJumpingEnemy\") (or (\"HopSequence\" (last To) \"OnAFriend\" \"MoveAgainAfterJumpingFriend\") (move Pass))}) (or (\"HopSequence\" (last To) \"OnAFriend\" \"MoveAgainAfterJumpingFriend\") (move Pass))) (\"HopSequence\" (last To) \"OnAnEnemy\" \"MoveAgainAfterJumpingEnemy\")) (priority { (forEach Site (sites Mover) (if (= (who at:(site)) (mover)) (priority { (\"HopSequence\" (site) \"OnAnEnemy\" \"MoveAgainAfterJumpingEnemy\") (or (\"HopSequence\" (site) \"OnAFriend\" \"MoveAgainAfterJumpingFriend\") \"Step\")}))) (forEach Piece (move Hop \"OnAnEnemy\" (to if:(if (\"InTheGoal\" (from)) (and (is Empty (to)) (\"InTheGoal\" (to))) (is In (to) \"EmptyButNotEnemyGoal\"))) (then (if (and (not (\"InTheGoal\" (last To))) (can Move (hop (from (last To)) \"OnAnEnemy\" (to if:(is Empty (to)))))) \"MoveAgainAfterJumpingEnemy\")))) (forEach Piece)}))) (end { (if (\"GoalFilledby\" P1 P2) (result P1 Win)) (if (\"GoalFilledby\" P2 P1) (result P2 Win)) (if \"NotEnoughPieceForTheMover\" (result Mover Win)) (if \"NotEnoughPieceForBothPlayer\" (result Mover Draw))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\n3x3 intersecting lines, with diagonals. Three pieces per player. Players alternate turns placing one of their pieces on the board. Once all of the pieces are placed, players take turns moving one of their pieces to an adjacent empty spot. The first player to make an orthogonal line with their pieces wins. \n\n###\n\n", "completion": "(game \"Wure Dune\" (players 2) (equipment { (\"ThreeMensMorrisBoard\") (hand Each) (piece \"Marker\" Each (\"StepToEmpty\" All))}) (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)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nGoal: Scoring is based on your largest group (x2), with an extra point given to the first player to create a given size. \n The player with the largest group at the end of the game thus wins, and ties go to the first player to achieve this goal.\n \n Setup: \n Yellow starts by creating a set-up, then Orange begins actual play - Pass to skip this phase\n \n To create a set-up, Yellow first places a black blocking stone on any intersection and then a Yellow stone on an empty edge position. Orange then either begins play, or else exchanges the yellow piece with his own.\n \n Play:\n Players take turns placing their piece on an empty intersection that is either along the edge or next to another friendly piece, but never adjacent to an enemy position.\n \n These placements are subject to 2 possible additional restrictions selected by the players before starting:\n \n A) The number range of friendly neighbors the piece being placed may have: (Standard is to play with no restriction.)\n \n and/or\n \n B) The maximum number of neighbors that are allowed for the pieces against which the piece may be placed, with 2 being standard play.\n \n Ending the game.\nPlay continues until both players pass consecutively, and then the final scores are compared. Board & size: Hexhex with edges alternating 4 and 6 Place next to any friendly piece(s), but not next to pieces that already have more than 2 neighbors.\n\n###\n\n", "completion": "(define \"ScoreUpdate\" (if (> (* 2 (size Group at:(last To))) (score Mover)) (if (> (* 2 (size Group at:(last To))) (score Next)) (set Score Mover (+ 1 (* 2 (size Group at:(last To))))) (set Score Mover (* 2 (size Group at:(last To))))))) (define \"SitesTooDense\" (forEach (sites Occupied by:Mover) if:(<= 3 (count Pieces Mover in:(sites Around (site)))))) (game \"RootZone\" (players 2) (equipment { (board (tri {4 6 4 7 4}) use:Vertex) (piece \"Disc\" Each) (piece \"Disc\" Neutral)}) (rules (play (if (= -1 (counter)) (or (move Pass) (move Add (piece \"Disc0\") (to (sites Board)))) (or { (if (= 1 (counter)) (move Select (from (sites Occupied by:Enemy)) (then (remove (last To) (then (add (to (last To)))))))) (move Pass) (move Add (to (difference (union (sites Outer) (sites Around (sites Occupied by:Mover))) (union { (sites Around (sites Occupied by:Enemy)) (sites Around \"SitesTooDense\") (sites Around (sites Occupied by:Neutral))})) if:(and (is Empty (to)) (>= 6 (count Pieces Mover in:(sites Around (to)))))) (then \"ScoreUpdate\"))}))) (end (if (all Passed) (byScore))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6 board. Five counters in each hole. Sowing occurs from any hole in the player's row in a clockwise direction. If the final counter lands into an empty hole, it is captured. If there is an unbroken line of holes behind it also having single counters, these are also captured. The player who captures the most counters wins. \n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (count Cell at:(handSite #1))) (game \"Vai Lung Thlan\" (players 2) (equipment { (mancalaBoard 2 6 store:None (track \"Track\" \"5,W,N,E\" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 5 to:(sites Track))) (play (move Select (from (sites Mover) if:(< 0 (count at:(from)))) (then (sow if:(= (count at:(to)) 1) apply:(fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))) backtracking:True)))) (end (\"MancalaByScoreWhen\" (no Moves Mover))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nP2 has 4 tries. -> The game is played on a 6x6 board.\n(define \"AddWhiteHint\" (\"AddHint\" \"Disc1\")) (define \"AddBlackHint\" (\"AddHint\" \"Disc2\")) (define \"AddHint\" (add (piece #1) (to (regionSite (\"HintPositions\") index:(value))))) (define \"CombinationFound\" (and (= 0 (count Sites in:(intersection (sites Empty) (sites Row (\"RowToCheck\"))))) (= \"NumColumn\" (count Sites in:(forEach (sites Row (\"RowToCheck\")) if:(\"PositionAndColorOK\")))))) (define \"PositionAndColorOK\" (= (what at:(site)) (what at:(coord row:0 column:(column of:(site)))))) (define \"CombinationToFindPlaced\" (= 0 (count Sites in:(intersection (sites Empty) (sites Bottom))))) (define \"CombinationPlaced\" (= 0 (count Sites in:(intersection (sites Empty) (sites Row (\"RowToPlace\")))))) (define \"ColorInSolution\" (is In (what at:(regionSite (sites Bottom) index:(value))) (results from:(sites Row (\"RowToPlace\")) to:0 (what at:(from))))) (define \"RightPositionAndColor\" (= (what at:(regionSite (sites Row (\"RowToPlace\")) index:(value))) (what at:(coord row:0 column:(value))))) (define \"HintPositions\" (union (sites Row (+ \"RowToPlace\" 1)) (sites Row (- \"RowToPlace\" 1)))) (define \"RowToCheck\" (- \"TopRow\" (* 3 (- (\"NumTry\") 1)))) (define \"RowToPlace\" (- \"TopRow\" (* 3 (\"NumTry\")))) (define \"NumTry\" (var)) (define \"TopRow\" (+ 2 (* 3 (- \"NumRow\" 1)))) (define \"NumColumn\" 4) (define \"NumRow\" 4) (game \"Mastermind\" (players 2) (equipment { (board (merge { (rectangle (+ 1 \"NumRow\") \"NumColumn\") (shift \"NumColumn\" 0.75 (repeat \"NumRow\" 1 step:{{1 0} {0 1}} (poly {{0 0} {0 0.5} {0.5 0.5} {0.5 0}})))}) use:Vertex) (piece \"Marker1\" Shared) (piece \"Marker2\" Shared) (piece \"Marker3\" Shared) (piece \"Marker4\" Shared) (piece \"Marker5\" Shared) (piece \"Marker6\" Shared) (piece \"Marker7\" Shared) (piece \"Marker8\" Shared) (piece \"Disc1\" Shared) (piece \"Disc2\" Shared) (hand Shared size:8)}) (rules (start { (place \"Marker1\" (handSite Shared)) (place \"Marker2\" (handSite Shared 1)) (place \"Marker3\" (handSite Shared 2)) (place \"Marker4\" (handSite Shared 3)) (place \"Marker5\" (handSite Shared 4)) (place \"Marker6\" (handSite Shared 5)) (place \"Marker7\" (handSite Shared 6)) (place \"Marker8\" (handSite Shared 7))}) phases:{ (phase \"Placement\" P1 (play (move (from (sites Hand Shared)) (to (intersection (sites Empty) (sites Bottom))) copy:True (then (and { (set Hidden at:(last To) to:P2) (if (\"CombinationToFindPlaced\") (set Var 0) (moveAgain))}))))) (phase \"Finding\" P2 (play (move (from (sites Hand Shared)) (to (intersection (sites Empty) (sites Row (\"RowToPlace\")))) copy:True (then (and (moveAgain) (if (\"CombinationPlaced\") (and (forEach Value min:0 max:(- \"NumColumn\" 1) (if (\"RightPositionAndColor\") (\"AddBlackHint\") (if (\"ColorInSolution\") (\"AddWhiteHint\")))) (set Var (+ 1 (\"NumTry\"))) (then (if (or (\"CombinationFound\") (>= \"NumTry\" \"NumRow\")) (forEach Site (sites Bottom) (set Hidden at:(site) False to:P2)))))))))) (end { (if (\"CombinationFound\") (result P2 Win)) (if (>= \"NumTry\" \"NumRow\") (result P1 Win))}))}))\n\n###\n\n", "completion": "(define \"AddWhiteHint\" (\"AddHint\" \"Disc1\")) (define \"AddBlackHint\" (\"AddHint\" \"Disc2\")) (define \"AddHint\" (add (piece #1) (to (regionSite (\"HintPositions\") index:(value))))) (define \"CombinationFound\" (and (= 0 (count Sites in:(intersection (sites Empty) (sites Row (\"RowToCheck\"))))) (= \"NumColumn\" (count Sites in:(forEach (sites Row (\"RowToCheck\")) if:(\"PositionAndColorOK\")))))) (define \"PositionAndColorOK\" (= (what at:(site)) (what at:(coord row:0 column:(column of:(site)))))) (define \"CombinationToFindPlaced\" (= 0 (count Sites in:(intersection (sites Empty) (sites Bottom))))) (define \"CombinationPlaced\" (= 0 (count Sites in:(intersection (sites Empty) (sites Row (\"RowToPlace\")))))) (define \"ColorInSolution\" (is In (what at:(regionSite (sites Bottom) index:(value))) (results from:(sites Row (\"RowToPlace\")) to:0 (what at:(from))))) (define \"RightPositionAndColor\" (= (what at:(regionSite (sites Row (\"RowToPlace\")) index:(value))) (what at:(coord row:0 column:(value))))) (define \"HintPositions\" (union (sites Row (+ \"RowToPlace\" 1)) (sites Row (- \"RowToPlace\" 1)))) (define \"RowToCheck\" (- \"TopRow\" (* 3 (- (\"NumTry\") 1)))) (define \"RowToPlace\" (- \"TopRow\" (* 3 (\"NumTry\")))) (define \"NumTry\" (var)) (define \"TopRow\" (+ 2 (* 3 (- \"NumRow\" 1)))) (define \"NumColumn\" 4) (define \"NumRow\" 6) (game \"Mastermind\" (players 2) (equipment { (board (merge { (rectangle (+ 1 \"NumRow\") \"NumColumn\") (shift \"NumColumn\" 0.75 (repeat \"NumRow\" 1 step:{{1 0} {0 1}} (poly {{0 0} {0 0.5} {0.5 0.5} {0.5 0}})))}) use:Vertex) (piece \"Marker1\" Shared) (piece \"Marker2\" Shared) (piece \"Marker3\" Shared) (piece \"Marker4\" Shared) (piece \"Marker5\" Shared) (piece \"Marker6\" Shared) (piece \"Marker7\" Shared) (piece \"Marker8\" Shared) (piece \"Disc1\" Shared) (piece \"Disc2\" Shared) (hand Shared size:8)}) (rules (start { (place \"Marker1\" (handSite Shared)) (place \"Marker2\" (handSite Shared 1)) (place \"Marker3\" (handSite Shared 2)) (place \"Marker4\" (handSite Shared 3)) (place \"Marker5\" (handSite Shared 4)) (place \"Marker6\" (handSite Shared 5)) (place \"Marker7\" (handSite Shared 6)) (place \"Marker8\" (handSite Shared 7))}) phases:{ (phase \"Placement\" P1 (play (move (from (sites Hand Shared)) (to (intersection (sites Empty) (sites Bottom))) copy:True (then (and { (set Hidden at:(last To) to:P2) (if (\"CombinationToFindPlaced\") (set Var 0) (moveAgain))}))))) (phase \"Finding\" P2 (play (move (from (sites Hand Shared)) (to (intersection (sites Empty) (sites Row (\"RowToPlace\")))) copy:True (then (and (moveAgain) (if (\"CombinationPlaced\") (and (forEach Value min:0 max:(- \"NumColumn\" 1) (if (\"RightPositionAndColor\") (\"AddBlackHint\") (if (\"ColorInSolution\") (\"AddWhiteHint\")))) (set Var (+ 1 (\"NumTry\"))) (then (if (or (\"CombinationFound\") (>= \"NumTry\" \"NumRow\")) (forEach Site (sites Bottom) (set Hidden at:(site) False to:P2)))))))))) (end { (if (\"CombinationFound\") (result P2 Win)) (if (>= \"NumTry\" \"NumRow\") (result P1 Win))}))})) END" }, { "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\n5x5 board, played on intersections of the lines, with diagonals for each quadrant of the board. One player plays with a tiger piece, placed anywhere on the board. The other player plays with 21 goats, placed on the central point of the board. The goats move first. Goats may move one at a time to any adjacent vacant spot along the lines of the board. The tiger moves in the same manner, but also may capture a piece by hopping over it to an empty space immediate on the opposite side of a goat. The tiger may hop the stack of goats, but may only capture one. The goal of the goats is to surround the tiger so it cannot move. The goal of the tiger is to capture all the goats.\n \n\n###\n\n", "completion": "(game \"Bagha Guti\" (players 2) (equipment { (\"AlquerqueBoard\" 5 5) (piece \"Goat\" P2 \"StepToEmpty\") (piece \"Tiger\" P1 (or (\"StepToEmpty\") (\"HopCapture\"))) (hand P1)}) (rules (start { (place Stack \"Goat2\" 12 count:21) (place \"Tiger1\" (handSite P1))}) phases:{ (phase \"Opening\" P1 (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase \"Movement\")) (phase \"Movement\" (play (forEach Piece top:True)))} (end (\"NoMovesP1NoPiecesP2\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe game is played on a triangle board divided in half on its height and then in thirds with lines crossing the height perpendicularly. One player plays as the tiger, and the other plays as seven leopards. The tiger plays their piece on a point where lines intersect first, and then on subsequent turns the leopards are placed one-by-one. Moves occur along the lines to an adjacent intersection. The tiger captures may capture a leopard by hopping over it. The tiger's goal is to capture four of the leopards; the leopards' goal is to block the tiger so it cannot move. Played on the board described in Ludovici and Parker.\n\n###\n\n", "completion": "(game \"Hat Diviyan Keliya\" (players 2) (equipment { (board (scale 1 2 (wedge 4)) use:Vertex) (hand Each) (piece \"Tiger\" P1 (or \"HopCapture\" \"StepToEmpty\")) (piece \"Leopard\" P2 \"StepToEmpty\")}) (rules (start { (place \"Tiger1\" (handSite P1) count:1) (place \"Leopard2\" (handSite P2) count:7)}) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (\"PhaseMovePiece\" \"Movement\" (end (\"NoMovesLossAndLessNumPiecesPlayerLoss\" P2 3)))})) END" }, { "prompt": "Construct a Ludii game based on the following description\n8x8 Draughts board. One player plays with a single fox, the other with twelve hens, played on the white squares. The hens begin on the first three rows; the fox may begin on whatever spot the player chooses. Hens move one space forward diagonally, the fox moves one space diagonally forward or backward. The fox may capture a hen by hopping over it to an empty space diagonally on the other side of it. The hens win by blocking the fox from being able to move; the fox wins by capturing all the hens. \n\n###\n\n", "completion": "(game \"Jeu de Renard\" (players 2) (equipment { (board (square 8)) (piece \"Fox\" P1 (or \"StepDiagonalToEmpty\" \"HopDiagonalCapture\")) (piece \"Hen\" P2 N (\"StepToEmpty\" (directions {FR FL}))) (hand P1)}) (rules (start { (place \"Fox1\" (handSite P1)) (place \"Hen2\" (difference (expand (sites Bottom) steps:2) (sites Phase 0)))}) phases:{ (phase \"Placement\" P1 (play (move (from (handSite Mover)) (to (difference (sites Empty) (sites Phase 0))))) (nextPhase \"Movement\")) (\"PhaseMovePiece\" \"Movement\")} (end (\"NoMovesP1NoPiecesP2\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6 board. Four counters in each hole. Sowing occurs in an anti-clockwise direction, beginning from any hole in the player's row. When the final counter lands in a hole in the opponent's row containing three (four counting the last counter dropped into it), these are taken. In addition, the contents of any hole in the opponent's row which a player causes to contain four counters are captured. When the final counter lands in an empty hole, the turn ends. When the final counter lands in an occupied hole containing a number of counters other than three, the counters are picked up and sowing continues. If sowing reaches the original hole from which the sowing began, this hole is skipped over. A player must play so that the opponent has counters with which to play, if possible. \n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (game \"Wouri\" (players 2) (equipment { (mancalaBoard 2 6 store:None (track \"Track\" \"0,E,N,W\" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 4 to:(sites Track))) (play (do (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover)) if:(< 0 (count at:(from)))) (then (sow apply:(if (and (is In (to) (sites Next)) (= (count at:(to)) 4)) (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to)) (then (forEach Site (if (is Mover P1) (sites P2) (sites P1)) (if (= (count at:(site)) 4) (fromTo (from (site)) (to (handSite Mover)) count:(count at:(site))))))) (if (< 1 (count at:(to))) (moveAgain))) includeSelf:False))) ifAfterwards:(< 0 (count in:(if (is Mover P1) (sites P2) (sites P1)))))) (end (\"MancalaByScoreWhen\" (no Moves Mover))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n9x9 board. Nine horse-shaped pieces per player. Pieces begin in the spaces along opposite sides of the board. Pieces move orthogonally one space and then diagonally another, jumping over any intervening pieces. A player may capture one of the opponent's pieces by moving onto a space occupied by the opponent's piece. The goal is to move to the central space on the board. To win a knight as to reach the central square.\n\n###\n\n", "completion": "(define \"CaptureToPieceAndCheckVictory\" (apply (if (\"IsEnemyAt\" (to)) (remove (to))))) (game \"Jeson Mor\" (players 2) (equipment { (board (square 9)) (piece \"Knight\" Each (move Leap \"KnightWalk\" (to if:(not (\"IsFriendAt\" (to))) \"CaptureToPieceAndCheckVictory\")))}) (rules (start { (place \"Knight1\" (sites Bottom)) (place \"Knight2\" (sites Top))}) (play (forEach Piece)) (end { (if (no Pieces Next) (result Mover Win)) (if (is In (last To) (sites Centre)) (result Mover Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayed on a standard Backgammon board. Each player starts with fifteen pieces on the starting point of their track. Two six-sided dice. The pieces move around the board in opposite directions in a horseshoe-shaped track.\n \n Each player rolls one die. The player who rolls highest goes first. The player then rolls two die to begin play. The numbers on the two dice constitute separate moves; i.e. a piece must move the full value of an individual die. One piece may move the combined total of the two die. Doubles are played twice. A player must use both numbers of a roll if possible, or all four numbers in the case of doubles. \n \n If a player lands on a point occupied by a single opposing piece, the opponent\u2019s piece is trapped until the trapping player removes their piece.\n \n A piece may not be moved to a point occupied by two or more of the opponent's pieces. The player cannot move a piece to a point where the opponent has trapped another of the player's pieces. \n \n Once a player has moved all fifteen of their pieces into the their home section of the board (that is, the six points at the end of the player's track), the player may begin bearing off. A player cannot bear off when the player has one or more pieces trapped inside the their home section. A player bears off by rolling a number equal to the number of points left in the track of a piece, plus one. If there is no piece on the point indicated by the roll, then the player must make a legal move using a piece that will not remove it from the board. If there are no pieces available to fulfill this condition, the player must remove a piece that is furthest from the goal. The first player to bear off all fifteen pieces wins the game.\n \n If the last piece belonging to player remains in the starting position is trapped by the opponent before it has left the starting position, the player loses. The only exception is if the opponent still has pieces on their starting position. A game in which both players' respective pieces in the starting position are trapped is a draw.\n \n In Tavli, in subsequent rounds, the winner of the previous round plays first.\n \n The game is also typically played with a point system, where points are lost based on the winning conditions. Players lose two points by losing if they haven't yet borne off any of their pieces, or one point if they have borne off at least one piece. A player who loses because their final piece in the starting position was trapped loses two points. \n\n###\n\n", "completion": "(define \"MotherCheckerP2Pinned\" (and (\"IsPieceAt\" \"Disc2\" P2 25 level:0) (\"IsPieceAt\" \"Disc1\" P1 25 level:1))) (define \"MotherCheckerP1Pinned\" (and (\"IsPieceAt\" \"Disc1\" P1 12 level:0) (\"IsPieceAt\" \"Disc2\" P2 12 level:1))) (define \"HaveAPieceAndCanEscape\" (and (\"IsFriendAt\" (site)) (< (trackSite Move from:(site) steps:(pips)) 0))) (define \"SetScoreOf\" (score #1 (if (is Mover #1) (if (= (\"NumPiece\" #2) 15) 2 1) 0))) (define \"NotEmptyAndNotOffTheBoard\" (and (is Occupied (site)) (\"IsNotOffBoard\" (\"NextSiteFrom\" (site))))) (define \"CanEscape\" (\"IsEndTrack\" (\"NextSiteFrom\" (site)))) (define \"NumPiece\" (size Stack in:(sites Occupied by:#1))) (define \"AllPieceEscaped\" (no Pieces Mover)) (define \"MoveAPieceIf\" (forEach Die replayDouble:True if:#1 (\"MoveAPiece\" #2))) (define \"MoveAPiece\" (move (from #1) (to (\"NextSiteFrom\" #1) if:(\"NoEnemyOrOnlyOne\" (to))))) (define \"DieNotUsedAndNoEscapeAndNotOffTheTrack\" (and { (\"DieNotUsed\") (\"IsNotOffBoard\" (\"NextSiteFrom\" (from))) (\"IsNotEndTrack\" (\"NextSiteFrom\" (from)))})) (define \"RemoveAPiece\" (move Remove (from))) (define \"AllPieceInHome\" (\"AllOwnedPiecesIn\" (sites Mover))) (define \"NextSiteFrom\" (\"NextSiteOnTrack\" (pips) from:#1)) (game \"Plakoto\" (players 2) (equipment { (\"BackgammonBoard\" \"BackgammonTracks\") (dice num:2) (regions P1 { 20..25}) (regions P2 { 7..12}) (piece \"Disc\" Each (\"MoveAPieceIf\" \"DieNotUsedAndNoEscapeAndNotOffTheTrack\" (from)))}) (rules (start { (place Stack \"Disc1\" 12 count:15) (place Stack \"Disc2\" 25 count:15)}) (play (\"RollEachNewTurnMove\" (if \"AllPieceInHome\" (forEach Die replayDouble:True if:(\"DieNotUsed\") (forEach Site (sites Occupied by:Mover) (if (\"NotEmptyAndNotOffTheBoard\") (if (\"CanEscape\") (\"RemoveAPiece\") (\"MoveAPiece\" (site)))) noMoveYet:(firstMoveOnTrack \"Track\" Mover (if \"HaveAPieceAndCanEscape\" \"RemoveAPiece\")) (then (\"ReplayNotAllDiceUsed\")))) (max Distance \"Track\" Mover (forEach Piece top:True (then (\"ReplayNotAllDiceUsed\"))))))) (end { (if (\"AllPieceEscaped\") (byScore { (\"SetScoreOf\" P1 P2) (\"SetScoreOf\" P2 P1)})) (if (\"MotherCheckerP1Pinned\") (byScore { (score P1 0) (score P2 2)})) (if (\"MotherCheckerP2Pinned\") (byScore { (score P1 2) (score P2 0)}))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe main track of the board is a row of eleven squares, with both end squares and the central square marked with an X. On the left side, a row of four squares runs under and adjacent to the first four squares of the central row. Perpendicular to the left end square of the central row, there is a square and then three triangles. On the opposite end, below and perpendicular to the right end of the central track is a row of four squares, curving slightly to the right. Above the end square of the central row, a triangular space, adjacent to an oval divided into three. Two teams with two players on each team. Players each start from a different point: one from the right square in the bottom left row, one from one of the triangle spaces on the left, one from the end of the curving track on the right, and the other from one of the spaces in the oval. Three pieces per player. Five sticks, with a flat side and a curved sides, used as dice. The value of a throw is equal to the number of flat sides that land face up; five curved sides up = 5. Players move their pieces from their entry points onto the central track of the board and progressing to the opposite end of the board from where they started. Pieces must move backward when they reach the end of the central track. When a player's piece lands on a space occupied by an opponent's piece, the opponent's piece is taken. A piece resting on a space marked with an X is safe from capture. The team to successfully capture all of their opponent's pieces wins. \n\n###\n\n", "completion": "(define \"UpdateState\" (if (and (= (state at:(last To)) 0) (is In (last To) (sites \"CentralTrack\"))) (if (or (is Mover P1) (is Mover P2)) (set State at:(last To) 2) (set State at:(last To) 1)))) (define \"SiteToMoveOnTrack\" (if (= (state at:(from)) 0) (\"NextSiteOnTrack\" (\"ThrowValue\") \"Track\") (if (= (state at:(from)) 1) (\"NextSiteOnTrack\" (\"ThrowValue\") \"TrackLeft\") (\"NextSiteOnTrack\" (\"ThrowValue\") \"TrackRight\")))) (define \"ThrowValue\" (mapEntry \"Throw\" (count Pips))) (game \"Los Palos\" (players 4) (equipment { (board (merge { (shift 11.3 -3.7 (graph vertices:{ {0 0} {1.3 -1} {2 0} {1.1 0.6}} edges:{{0 1} {1 2} {2 3} {3 0}})) (shift 10.4 -2.4 (graph vertices:{ {0 0} {0.9 -1.3} {2 -0.7} {1 0.4}} edges:{{0 1} {1 2} {2 3} {3 0}})) (shift 10.1 -1.1 (graph vertices:{ {0 0} {0.3 -1.3} {1.3 -0.9} {1 0.2}} edges:{{0 1} {1 2} {2 3} {3 0}})) (shift 10 0 (graph vertices:{ {0 0} {0.1 -1.1} {1.1 -0.9} {1 0}} edges:{{0 1} {1 2} {2 3} {3 0}})) (shift 11 1.87 (graph vertices:{ {0 0} {0.5 0.5} {0 1}} edges:{{0 1} {1 2} {2 0}})) (shift 10 1.87 (graph vertices:{ {0 0} {-0.5 0.5} {0 1}} edges:{{0 1} {1 2} {2 0}})) (shift 10 1.87 (square 1)) (shift 10 1 (tri 1)) (shift 1 2 (graph vertices:{ {1 0} {-0.5 0.87} {0 0}} edges:{{0 1} {1 2} {2 0}})) (shift 0 2 (graph vertices:{ {-1 0} {0.5 0.87} {0 0}} edges:{{0 1} {1 2} {2 0}})) (shift 0 2 (tri 1)) (shift 0 1 (square 1)) (rectangle 1 11) (shift 0 -1 (rectangle 1 4))}) { (track \"Track1\" \"20,W,N1,E\" P1 directed:True) (track \"Track2\" \"11,12,S2,E\" P2 directed:True) (track \"Track3\" \"6,E1,9,S1,W\" P3 directed:True) (track \"Track4\" \"0,1,2,3,4,W\" P4 directed:True) (track \"TrackRight\" \"14,E,W\" directed:True) (track \"TrackLeft\" \"4,W,E\" directed:True)}) (\"StickDice\" 5) (piece \"Marker\" Each (move (from (from)) (to (\"SiteToMoveOnTrack\") if:(or (and (not (is In (to) (sites \"SafeSites\"))) (\"IsEnemyAt\" (to))) (is Empty (to))) (apply (if (\"IsEnemyAt\" (to)) (remove (to))))) (then (\"UpdateState\")))) (map \"Throw\" {(pair 0 5) (pair 1 1) (pair 2 2) (pair 3 3) (pair 4 4) (pair 5 5)}) (map \"EntryPoint\" {(pair 1 20) (pair 2 11) (pair 3 6) (pair 4 0)}) (regions \"SafeSites\" (sites {4 14 23})) (regions \"CentralTrack\" (sites {4 5 14 15 19 21..26}))}) (rules (start { (place \"Marker1\" (mapEntry \"EntryPoint\" P1) count:3) (place \"Marker2\" (mapEntry \"EntryPoint\" P2) count:3) (place \"Marker3\" (mapEntry \"EntryPoint\" P3) count:3) (place \"Marker4\" (mapEntry \"EntryPoint\" P4) count:3) (set Team 1 {P1 P3}) (set Team 2 {P2 P4})}) (play (\"RollMove\" (forEach Piece))) (end (\"CaptureAllTeam\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe game is played in turns. White starts by placing the breadcrumb on any empty space on the board. Now, any and every duck in the six lines radiating out from the breadcrumb move straight toward the breadcrumb as far as they can. There will never be more than one duck in a space, and the ducks stop just before they reach the breadcrumb (a fish gets it first). Then the turn passes to the next player. From now on, on your turn, you must take the breadcrumb and place it on an empty space of the board that is not on any of the six lines radiating from the breadcrumb's previous location and then move the ducks toward the breadcrumb as usual. The game ends when all the ducks of one colour have gathered into a single connected group. In case of both groups (White and Black) are created simultaneously, the player who placed the game-ending breadcrumb wins. \n\n###\n\n", "completion": "(game \"Feed the Ducks\" (players 2) (equipment { (board (hex 5)) (piece \"Marker\" Each) (piece \"Disc\" Neutral)}) (rules (start { (place \"Marker1\" {\"A5\" \"C7\" \"D8\" \"F9\" \"H9\" \"I9\" \"I7\" \"I5\" \"F2\" \"C1\" \"A1\" \"A2\"}) (place \"Marker2\" {\"A4\" \"A3\" \"B1\" \"D1\" \"E1\" \"G3\" \"H4\" \"I6\" \"I8\" \"G9\" \"E9\" \"B6\"})}) phases:{ (phase \"Throw Bread\" (play (move Add (piece \"Disc0\") (to (sites Empty)) (then (attract (from (last To)))))) (nextPhase \"Move Bread\")) (phase \"Move Bread\" (play (move (from (sites Occupied by:Neutral)) (to (difference (sites Empty) (sites Direction from:(last To)))) (then (attract (from (last To)))))))} (end { (\"SingleGroupWin\" P1) (\"SingleGroupWin\" P2)}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nLava is a territorial stacking game for two players, Red and Black. Play using a Hexhex board size 4 or 5, and a sufficient supply of Red/Black stacking checkers. To setup, place one Red and one Black checker in opposite corners of the hex hex board.\n \n Definitions:\n Stack: One or more checkers occupying the same cell.\n Control: You control a stack if your color is on top of it.\n \n Players take turns, with Black moving first.\n \n Each turn, take N checkers (where N is any number from 1 to stack size) from the top of a stack you control and move them N spaces in a straight line to a destination containing N or less checkers. Then, add a new checker of your color to the destination. Stacks may not jump over enemies, but may land on enemy or friendly stacks, thereby burying them.\n \n If you at any point cannot make a move, you must pass. This does not end the game, only your turn.\n \n When the board is full, the player controlling more stacks wins the game. A size 4 board is currently selected The number of pieces in a stack is currently not shown on the top piece.\n\n###\n\n", "completion": "(define \"Move\" (and (fromTo (from (last From)) (to (last To)) count:(count Steps (last From) (last To)) stack:True) (add (to (last To)) stack:True))) (define \"Select\" (move Select (from (sites Occupied by:Mover top:True)) (to (sites Direction from:(from) Orthogonal stop:(= (next) (who at:(to))) stopIncluded:True distance:(size Stack at:(from))) if:(>= (count Steps (from) (to)) (size Stack at:(to)))) #1)) (game \"Lava\" (players 2) (equipment { (board (rotate 30 (hex 4))) (piece \"Disc\" Each)}) (rules (start { (place \"Disc1\" (min (array (sites Board)))) (place \"Disc2\" (max (array (sites Board))))}) (play (\"Select\" (then (\"Move\")))) (end (if (is Full) (byScore { (score P1 (count Sites in:(sites Occupied by:P1 top:True))) (score P2 (count Sites in:(sites Occupied by:P2 top:True)))}))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n12x12 board. Pieces move as follows: Raja (King, x1): moves one space in any direction; Mantri (Minister, placed to the left of the Raja, x1): moves any distance orthogonally or diagonally; Ushtra (Camel, x2): moves diagonally any distance; Chariot (x2), moves orthogonally any distance; Flagcar (x2), moves diagonally any distance; Vaha (Horse, x2): move orthogonally one space and then diagonally another, jumping over any intervening pieces; Danti (Elephant, x2): moves orthogonally any distance. Padati (Pawn, x12): move forward orthogonally one space or one space diagonally forward to capture. When a Padati reaches the opposite edge of the board, it is promoted to a Mantri and is moved immediately to the space it last moved from. An opponent's piece is captured by moving one of the player's own pieces onto the space occupied by the opponent's piece. If the Raja can be captured on the opponent's next turn, it is in check. The Raja cannot be in check at the end of the player's turn. If this is impossible, the opponent wins. When a player is reduced to only their Raja and Padati, the opponent wins. In the case of a stalemate, the player in stalemate may remove any of the opponent's pieces (except their Raja). \n\n###\n\n", "completion": "(game \"Chaturanga (12x12)\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 12)) (\"ChessPawn\" \"Pawn\" ~ (then (if (is In (last To) (sites Mover \"Promotion\")) (and (promote (last To) (piece \"Ferz_noCross\") Mover) (fromTo (from (last To)) (to (last From))))))) (\"ChessRook\" \"Rook\") (\"ChessBishop\" \"Camel\") (\"ChessKing\" \"King_noCross\") (\"ChessBishop\" \"Bishop_noCross\") (\"ChessRook\" \"Elephant\") (\"ChessKnight\" \"Knight\") (\"ChessQueen\" \"Ferz_noCross\") (regions \"Promotion\" P1 (sites Top)) (regions \"Promotion\" P2 (sites Bottom))}) (rules (start { (place \"Pawn1\" (sites Row 1)) (place \"Pawn2\" (sites Row 10)) (place \"Elephant1\" {\"A1\" \"L1\"}) (place \"Knight1\" {\"B1\" \"K1\"}) (place \"Bishop_noCross1\" {\"C1\" \"J1\"}) (place \"Rook1\" {\"D1\" \"I1\"}) (place \"Camel1\" {\"E1\" \"H1\"}) (place \"Ferz_noCross1\" coord:\"F1\") (place \"King_noCross1\" coord:\"G1\") (place \"Elephant2\" {\"A12\" \"L12\"}) (place \"Knight2\" {\"B12\" \"K12\"}) (place \"Bishop_noCross2\" {\"C12\" \"J12\"}) (place \"Rook2\" {\"D12\" \"I12\"}) (place \"Camel2\" {\"E12\" \"H12\"}) (place \"Ferz_noCross2\" coord:\"G12\") (place \"King_noCross2\" coord:\"F12\")}) (play (if (no Moves Mover) (move Remove (difference (sites Occupied by:Next) (where \"King_noCross\" Next))) (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King_noCross\" Mover))))) (end { (\"Checkmate\" \"King_noCross\") (if (and { (no Pieces Next \"Ferz_noCross\") (no Pieces Next \"Knight\") (no Pieces Next \"Bishop_noCross\") (no Pieces Next \"Elephant\") (no Pieces Next \"Rook\") (no Pieces Next \"Camel\")}) (result Mover Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\n3x12 board, with the outer rows of holes slightly curved to form the appearance of an arc. Twelve pieces per player, which start on the board in each of the holes in the outer row belonging to a player. Two four-sided dice, marked 2-4 and \\ \n\n###\n\n", "completion": "(define \"MoveAPiece\" (if (or (= (state at:(from)) 1) (and (= (state at:(from)) 0) (= 1 (pips)))) (move Slide #1 (between (exact (pips)) if:(is Empty (between))) (to if:(\"IsEnemyAt\" (to)) (apply if:(not (\"IsFriendAt\" (to))) (remove (to)))) (then (if (= (state at:(last To)) 0) (set State at:(last To) 1)))))) (game \"Daldosa\" (players 2) (equipment { (board (add (merge { (rectangle 1 8) (shift -4 1.5 (rectangle 1 12)) (shift 0 3 (rectangle 1 8))}) vertices:{{-1 0.1} {-2 0.3} {-2.9 0.5} {-3.6 0.8} {-1 2.9} {-2 2.7} {-2.9 2.5} {-3.6 2.2}}) { (track \"Track1\" {31..28 0..7 19..8 35..32 20..27 19..8} loop:True P1) (track \"Track2\" {35..32 20..27 19..8 31..28 0..7 19..8} loop:True P2)} use:Vertex) (regions \"AllSites\" (sites Board)) (dice d:4 num:2) (piece \"Minus\" P1 (\"MoveAPiece\" \"Track1\")) (piece \"Minus\" P2 (\"MoveAPiece\" \"Track2\"))}) (rules (start { (place \"Minus1\" (sites {0..7 28..31})) (place \"Minus2\" (sites {20..27 32..35}))}) (play (\"RollEachNewTurnMove\" (forEach Die replayDouble:(and (= (face 36) 1) (= (face 37) 1)) (forEach Piece (then (if (not (all DiceUsed)) (\"ReplayIfCanMove\" (forEach Die (forEach Piece))))))))) (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nA 4x4 board is currently selected -> A 5x5 board is currently selected\n(define \"Connect\" (do (move Add (to (sites Around (sites Occupied by:Mover) Empty) (apply (set Var \"NumberOfFriendlyGroupsBeforePlacement\" (count Groups Orthogonal if:(is Mover (who at:(to)))))))) ifAfterwards:(< (count Groups Orthogonal if:(is Mover (who at:(to)))) (var \"NumberOfFriendlyGroupsBeforePlacement\")))) (game \"Scaffold\" (players 2) (equipment { (board (square 4) use:Vertex) (piece \"Marker\" Each) (regions P1 {(sites Side N) (sites Side S)}) (regions P2 {(sites Side W) (sites Side E)})}) (rules (meta (swap)) (play (if (< 0 (count MovesThisTurn)) (\"Connect\") (move Add (to (sites Empty))) (then (if (can Move (\"Connect\")) (moveAgain))))) (end (if (is Connected Orthogonal Mover) (result Mover Win)))))\n\n###\n\n", "completion": "(define \"Connect\" (do (move Add (to (sites Around (sites Occupied by:Mover) Empty) (apply (set Var \"NumberOfFriendlyGroupsBeforePlacement\" (count Groups Orthogonal if:(is Mover (who at:(to)))))))) ifAfterwards:(< (count Groups Orthogonal if:(is Mover (who at:(to)))) (var \"NumberOfFriendlyGroupsBeforePlacement\")))) (game \"Scaffold\" (players 2) (equipment { (board (square 5) use:Vertex) (piece \"Marker\" Each) (regions P1 {(sites Side N) (sites Side S)}) (regions P2 {(sites Side W) (sites Side E)})}) (rules (meta (swap)) (play (if (< 0 (count MovesThisTurn)) (\"Connect\") (move Add (to (sites Empty))) (then (if (can Move (\"Connect\")) (moveAgain))))) (end (if (is Connected Orthogonal Mover) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayed on an 8x8 board with pieces with specialized moves: Pawns (8): can move one space forward, or one space diagonally forward to capture; Players agree at the beginning of the game whether pawns may move two spaces on their first turn. Two pawns may be moved by a player in their first turn of the game. Pawns may only be promoted to a piece that has already been captured. If none have been captured, the pawn must remain in place until a piece has been captured. Rooks (2): can move any number of spaces orthogonally; Bishops (2): can move any number of spaces diagonally; Knight (2): moves in any direction, one space orthogonally with one space forward diagonally, jumping over any intervening pieces; Queens (1): can move any number of spaces orthogonally or diagonally; Kings (1): can move one space orthogonally or diagonally. A King cannot castle if it has ever been checked. Players capture pieces by moving onto a space occupied by an opponent's piece. A player must say 'Gardez la reine' (Guard the Queen) when the queen is threatened. When a King can be captured on the next turn by an opponent's piece, it is in check. The King must not be in check at the end of the player's turn. If this is not possible, it is checkmate and the opponent wins. A player who causes a stalemate loses.\n The pawns can double step from the starting positions.\n\n###\n\n", "completion": "(define \"PromoteMove\" (or { (if (\"WasCaptured\" (id \"Queen\" Mover)) (move Promote #1 (piece {\"Queen\"}) Mover)) (if (\"WasCaptured\" (id \"Knight\" Mover)) (move Promote #1 (piece {\"Knight\"}) Mover)) (if (\"WasCaptured\" (id \"Rook\" Mover)) (move Promote #1 (piece {\"Rook\"}) Mover)) (if (\"WasCaptured\" (id \"Bishop\" Mover)) (move Promote #1 (piece {\"Bishop\"}) Mover))} #2)) (define \"CaptureForwardDiagonal\" (move Step (directions {FR FL}) (to if:(\"IsEnemyAt\" (to)) (apply (and (remember Value \"CapturedPieces\" (what at:(to))) (remove (to))))))) (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 \"AtLeastAStrongPieceWasCapture\" (or { (\"WasCaptured\" (id \"Queen\" Mover)) (\"WasCaptured\" (id \"Knight\" Mover)) (\"WasCaptured\" (id \"Rook\" Mover)) (\"WasCaptured\" (id \"Bishop\" Mover))})) (define \"WasCaptured\" (is In #1 (values Remembered \"CapturedPieces\"))) (define \"CaptureToPiece\" (apply (if (\"IsEnemyAt\" (to)) (and (remember Value \"CapturedPieces\" (what at:(to))) (remove (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 \"Korkserschach\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (piece \"Pawn\" Each (if (!= (last To) (from)) (or { (if (and (\"AtLeastAStrongPieceWasCapture\") (is In (from) (sites Mover \"Promotion\"))) (\"PromoteMove\" (from) (then (set Pending)))) (if (is In (from) (sites Start (piece (what at:(from))))) (\"DoubleStepForwardToEmpty\")) \"StepForwardToEmpty\" \"CaptureForwardDiagonal\"} (then (and (if (and (is In (last To) (sites Mover \"Promotion\")) (\"AtLeastAStrongPieceWasCapture\")) (moveAgain)) (if (and (\"NewTurn\") (<= (count Turns) 2)) (and (set Pending) (moveAgain)))))))) (piece \"Rook\" Each (move Slide Orthogonal (to if:(\"IsEnemyAt\" (to)) \"CaptureToPiece\") \"RememberPieceHasMoved\")) (piece \"King\" Each (move Step (to if:(not (\"IsFriendAt\" (to))) \"CaptureToPiece\") \"RememberPieceHasMoved\")) (piece \"Bishop\" Each (move Slide Diagonal (to if:(\"IsEnemyAt\" (to)) \"CaptureToPiece\"))) (piece \"Knight\" Each (move Leap \"KnightWalk\" (to if:(not (\"IsFriendAt\" (to))) \"CaptureToPiece\"))) (piece \"Queen\" Each (move Slide (to if:(\"IsEnemyAt\" (to)) \"CaptureToPiece\"))) (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 (and (not (is Pending)) \"SameTurn\") (\"PromoteMove\" (last To)) (do (if (is Pending) (or (move Pass) (forEach Piece \"Pawn\" Mover)) (or (forEach Piece) (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\"))))) ifAfterwards:(not (\"IsInCheck\" \"King\" Mover))) (then (and (if (or (\"IsInCheck\" \"Queen\" P1) (\"IsInCheck\" \"Queen\" P2)) (note \"Gardez la reine\")) (if (and (= (state at:(where \"King\" Next)) 1) (\"IsInCheck\" \"King\" Next)) (\"PieceHasMoved\" (where \"King\" Next))))))) (end (\"Checkmate\" \"King\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\nEach player has a pawn, that can move to any neighboring cell. After moving, the player places a block on the board to try to block the opponent's pawn. First player who cannot move loses. The game is played on a 7x7 board.\n\n###\n\n", "completion": "(game \"Isolation\" (players 2) (equipment { (board (rectangle 7 7)) (piece \"Pawn\" Each (move Step (to if:(is Empty (to))) (then (moveAgain)))) (piece \"Square\" Neutral)}) (rules (start { (place \"Pawn1\" {\"A4\"}) (place \"Pawn2\" {\"G4\"})}) (play (if (is Even (count Moves)) (forEach Piece) (move Add (piece \"Square0\") (to (sites Empty))))) (end (\"BlockWin\")))) 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": "Modify the Ludii game according to the following option changes:\nA size 7 board is currently selected -> A size 9 board is currently selected\nA group penalty of 0 points is currently selected -> A group penalty of 2 points is currently selected\n(define \"UpdateScore\" (set Score Mover (- (count Sites in:(sites Occupied by:Mover)) (* 0 (count Groups Orthogonal if:(is Mover (who at:(to)))))))) (define \"Grow\" (\"PlaceGrey\" (then (if (can Move (\"PlaceGrey\" ~)) (moveAgain) (do (\"ReplaceAllGrey\") next:(\"UpdateScore\")))))) (define \"ReplaceAllGrey\" (add (to (sites Occupied by:Neutral) (apply (remove (to)))) (then (if (!= 1 (var \"HasGrown\")) (and (set Var \"HasGrown\" 1) (if (= (id P2) (mover)) (and (set Var \"MoveThatMustBePlant\" (count Moves)) (moveAgain)))))))) (define \"PlaceGrey\" (do (move Add (piece \"Marker0\") (to (sites Empty) if:(< 0 (count Sites in:(sites Around (to) Own Orthogonal))))) ifAfterwards:(all Groups Orthogonal of:(is Mover (who at:(to))) if:(> 2 (count Sites in:(intersection (sites Around (sites) NotEmpty Orthogonal) (sites Occupied by:Neutral))))) #1)) (define \"Plant\" (move Add (to (sites Empty) if:(= 0 (count Sites in:(sites Around (to) Own Orthogonal)))) (then (\"UpdateScore\")))) (game \"Symple\" (players 2) (equipment { (board (square 7) use:Vertex) (piece \"Marker\" Each) (piece \"Marker\" Neutral)}) (rules (play (if (= (count Moves) (var \"MoveThatMustBePlant\")) (\"Plant\") (if (= 0 (count MovesThisTurn)) (or (\"Plant\") (\"Grow\")) (\"Grow\")))) (end (if (is Full) (byScore)))))\n\n###\n\n", "completion": "(define \"UpdateScore\" (set Score Mover (- (count Sites in:(sites Occupied by:Mover)) (* 2 (count Groups Orthogonal if:(is Mover (who at:(to)))))))) (define \"Grow\" (\"PlaceGrey\" (then (if (can Move (\"PlaceGrey\" ~)) (moveAgain) (do (\"ReplaceAllGrey\") next:(\"UpdateScore\")))))) (define \"ReplaceAllGrey\" (add (to (sites Occupied by:Neutral) (apply (remove (to)))) (then (if (!= 1 (var \"HasGrown\")) (and (set Var \"HasGrown\" 1) (if (= (id P2) (mover)) (and (set Var \"MoveThatMustBePlant\" (count Moves)) (moveAgain)))))))) (define \"PlaceGrey\" (do (move Add (piece \"Marker0\") (to (sites Empty) if:(< 0 (count Sites in:(sites Around (to) Own Orthogonal))))) ifAfterwards:(all Groups Orthogonal of:(is Mover (who at:(to))) if:(> 2 (count Sites in:(intersection (sites Around (sites) NotEmpty Orthogonal) (sites Occupied by:Neutral))))) #1)) (define \"Plant\" (move Add (to (sites Empty) if:(= 0 (count Sites in:(sites Around (to) Own Orthogonal)))) (then (\"UpdateScore\")))) (game \"Symple\" (players 2) (equipment { (board (square 9) use:Vertex) (piece \"Marker\" Each) (piece \"Marker\" Neutral)}) (rules (play (if (= (count Moves) (var \"MoveThatMustBePlant\")) (\"Plant\") (if (= 0 (count MovesThisTurn)) (or (\"Plant\") (\"Grow\")) (\"Grow\")))) (end (if (is Full) (byScore))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nEach player uses twelve pieces. Play begins with each player placing pieces on empty points. If they make three in a row along the lines, they can remove one of the opponent's pieces. They cannot remove an opponent's piece that is in a three in a row formation unless there are no other options. Once all pieces are place, players take turns moving pieces one spot to an adjacent point along the lines. If a player makes three in a row, an opponent's piece is removed as in the first phase of the game. Once a player is reduced to three pieces, that player may move to any open space on the board. The game is won when the opponent is reduced to two pieces. The board has some diagonals.\n\n###\n\n", "completion": "(define \"RemoveEnemyPiece\" (if (can Move (\"RemoveAnyEnemyPieceNotInLine3\" Orthogonal)) (\"RemoveAnyEnemyPieceNotInLine3\" Orthogonal) (\"RemoveAnyEnemyPiece\"))) (game \"Twelve Men's Morris\" (players 2) (equipment { (board (concentric Square rings:3 joinCorners:True) use:Vertex) (hand Each) (piece \"Marker\" Each (\"StepToEmpty\" ~ (then (\"ReplayIfLine3\" Orthogonal exact:True))))}) (rules (start (place \"Marker\" \"Hand\" count:12)) phases:{ (phase \"Placement\" (play (if \"SameTurn\" \"RemoveEnemyPiece\" (move (from (handSite Mover)) (to (sites Empty)) (then (\"ReplayIfLine3\" Orthogonal exact:True))))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (phase \"Movement\" (play (if \"SameTurn\" \"RemoveEnemyPiece\" (if (> (count Pieces Mover) 3) (forEach Piece) (move (from (sites Occupied by:Mover)) (to (sites Empty)))))))} (end (\"HavingLessPiecesLoss\" Next 2)))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nEach row has 20 holes. -> Each row has 25 holes.\n(define \"SiteToMove\" (if (= (from) (handSite Mover)) (\"SiteToMoveOnTrack\" from:0 (- (\"ThrowValue\") 1)) (\"SiteToMoveOnTrack\" from:(from) (\"ThrowValue\")))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" #2 #1)) (define \"ThrowValue\" (mapEntry (count Pips))) (game \"Uturu Uturu Kaida\" (players 7) (equipment { (board (rectangle 2 20) (track \"Track\" {0..19 39..20} directed:True) use:Vertex) (hand Each) (piece \"Horse\" Each (if (\"IsOffBoard\" (\"SiteToMove\")) (move Remove (from) level:(level)) (move (from (from) level:(level)) (to (\"SiteToMove\")) stack:True))) (\"StickDice\" 2) (map {(pair 0 10) (pair 1 0) (pair 2 20)})}) (rules (start (place \"Horse\" \"Hand\")) (play (\"RollMove\" (if (< 0 (\"ThrowValue\")) (or (forEach Piece) (forEach Piece container:(mover)))))) (end (\"EscapeWin\"))))\n\n###\n\n", "completion": "(define \"SiteToMove\" (if (= (from) (handSite Mover)) (\"SiteToMoveOnTrack\" from:0 (- (\"ThrowValue\") 1)) (\"SiteToMoveOnTrack\" from:(from) (\"ThrowValue\")))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" #2 #1)) (define \"ThrowValue\" (mapEntry (count Pips))) (game \"Uturu Uturu Kaida\" (players 7) (equipment { (board (rectangle 2 25) (track \"Track\" {0..24 49..25} directed:True) use:Vertex) (hand Each) (piece \"Horse\" Each (if (\"IsOffBoard\" (\"SiteToMove\")) (move Remove (from) level:(level)) (move (from (from) level:(level)) (to (\"SiteToMove\")) stack:True))) (\"StickDice\" 2) (map {(pair 0 10) (pair 1 0) (pair 2 20)})}) (rules (start (place \"Horse\" \"Hand\")) (play (\"RollMove\" (if (< 0 (\"ThrowValue\")) (or (forEach Piece) (forEach Piece container:(mover)))))) (end (\"EscapeWin\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThree concentric squares, the corners and 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\n", "completion": "(game \"Triodi (Diagonal)\" (players 2) (equipment { (board (concentric Square rings:3 joinCorners:True) use:Vertex) (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\n3x6 board, three counters per hole. Each player owns the row of holes closest to them, as well as the right half of the central row, with respect to their perspective. Sowing occurs from left to right in the player's complete row, right to left in the player's half of the central row, then continuing from right to left in the opponent's outer row, left to right in the opponent's holes in the central row, and then continuing as before into the player's outer row. Players sow from any of their holes, and when the final counter lands in an occupied hole, they pick up the contents and continue sowing. When the final counter falls into an empty hole, the turn ends. After the first turn, players may capture a hole when the final counter of a sowing falls into a hole containing three counters, increasing it to four. The counters in a captured hole cannot be sown. When a player drops their final counter into an occupied captured hole, two counters are captured from it. If the player captured counters from one of the holes that they had created, they begin sowing again from another of their holes, but if the capture was from a hole captured by the opponent, the turn ends. The leftmost holes in each player's row are special: a player may under no circumstance capture counters from this hole in their row, but may do so from the opponent's, gaining another turn when they do so. Play continues until all of the counters are captured or all of the counters are accumulated in captured holes. A new round begins. Players then collect the counters in their captured holes. They count their takings by filling their holes with three counters each as in the beginning, and the player would own every hole they could fill with three counters. If the player has two counters remaining, they also gain another hole and the opponent surrenders their extra counter. Play continues until one player cannot fill any holes. \n\n###\n\n", "completion": "(define \"NoEmptyHoleRow\" (all Sites (sites Mover) if:(is Occupied (site)))) (define \"SitesMarkedBy\" (forEach (sites Board) if:(= #1 (state at:(site))))) (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\")))) (define \"Columns\" 6) (game \"Selus (Massawa)\" (players 2) (equipment { (mancalaBoard 3 \"Columns\" store:None (track \"Track\" \"0,E,N1,W2,17,W,S1,E2\" loop:True)) (piece \"Seed\" Shared) (hand Each) (regions P1 (union (sites Bottom) (difference (expand (sites Right) steps:2) (sites Top)))) (regions P2 (union (sites Top) (difference (expand (sites Left) steps:2) (sites Bottom)))) (map \"LeftMostHole\" {(pair P1 0) (pair P2 17)})}) (rules (start { (set RememberValue \"OwnedP1\" (sites P1)) (set RememberValue \"OwnedP2\" (sites P2)) (set Count 3 to:(sites Track))}) phases:{ (phase \"Sowing\" (play (or { (move Select (from (if (and (not (is Pending)) (\"SameTurn\")) (\"LastHoleSowed\") (\"OwnedHoles\")) if:(and (< 0 (count at:(from))) (= 0 (state at:(from))))) (then (sow apply:(if (< 1 (count at:(to))) (if (and (!= (mapEntry \"LeftMostHole\" Mover) (to)) (!= 0 (state at:(to)))) (and { (if (or (= (mover) (state at:(to))) (= (mapEntry \"LeftMostHole\" Next) (to))) (and (moveAgain) (set Pending))) (fromTo (from (to)) (to (handSite Mover)) count:2) (set State at:(to) (state at:(to)))}) (if (and {(< 2 (count Turns)) (= 0 (state at:(to))) (= 4 (count at:(to)))}) (set State at:(to) (mover)) (moveAgain)))))))} (then (if (\"OnlyPiecesInMarked\") (and { (forEach Site (\"SitesMarkedBy\" 1) (fromTo (from (site)) (to (handSite P1)) count:(count at:(site)))) (forEach Site (\"SitesMarkedBy\" 2) (fromTo (from (site)) (to (handSite P2)) count:(count at:(site)))) (forget Value \"OwnedP1\" All) (forget Value \"OwnedP2\" All)}))))) (end (if (\"NoPieceOnBoard\") { (if (> 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 (if (\"NoEmptyHoleRow\") (sites Board) (sites Mover)) if:(is Empty (to))) count:3 (then (\"RemmemberOwnedHoles\" (last To)))) (if (= 2 (count Cell at:(handSite Mover))) (move (from (handSite Mover)) (to (if (\"NoEmptyHoleRow\") (sites Board) (sites Mover)) if:(is Empty (to))) count:2 (then (and (fromTo (from (handSite Next)) (to (last To)) count:1) (\"RemmemberOwnedHoles\" (last To)))))))) (nextPhase (and (is Empty (handSite P1)) (is Empty (handSite P2))) \"Sowing\"))})) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"RemoveEnemyPieceInMillOnlyIfNoOtherChoice\" (if (can Move (\"RemoveAnyEnemyPieceNotInLine3\" Orthogonal)) (\"RemoveAnyEnemyPieceNotInLine3\" Orthogonal) (\"RemoveAnyEnemyPiece\"))) (game \"Six Men's Morris\" (players 2) (equipment { (board (concentric Square rings:2) use:Vertex) (hand Each) (piece \"Marker\" Each (\"StepToEmpty\" ~ (then (\"ReplayIfLine3\" Orthogonal exact:True))))}) (rules (start (place \"Marker\" \"Hand\" count:6)) 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))))\n\n###\n\n", "completion": "Same rules as Murray, except a player cannot remove an opponent's piece that is in a three in a row formation unless there are no other options. The game starts with 6 pieces by player. Any Enemy piece can be captured. END" }, { "prompt": "Construct a Ludii game based on the following description\nThree vertical lines, and two horizontal lines intersecting them along their top end points and their midpoints. Three pieces per player, arranged on the intersections of opposite vertical lines. Players alternate turns moving one of their pieces to an adjacent spot. The object of the game is to block the opponent's pieces from moving. \n\n###\n\n", "completion": "(game \"Tugul Shodra\" (players 2) (equipment { (board (remove (square 3) edges:{{0 1} {1 2}}) use:Vertex) (piece \"Disc\" Each \"StepToEmpty\")}) (rules (start { (place \"Disc1\" {2 5 8}) (place \"Disc2\" {0 3 6})}) (play (forEach Piece)) (end (\"NoMoves\" Loss)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlay on an equilateral triangular hexagon-tessellated grid. Use a neutral pawn and black/white checkers. Players take turns moving a neutral pawn around on the board (passing is not allowed). The neutral pawn can move any number of empty points, in any direction in a straight line, but cannot move onto, or jump over occupied points. When a player moves the pawn, first they place a checker of their own color, onto the destination point. Then they move the pawn on top of it. When the pawn is trapped, the game is over. At the end of the game, each player gets a point for each checker of their own color adjacent to, or underneath, the pawn. The person with the highest score wins. Played on a size 13 board.\n\n###\n\n", "completion": "(define \"Nbors\" (count Sites in:(intersection (sites Around #1) (sites Occupied by:#2)))) (game \"Trike\" (players 2) (equipment { (board (hex Triangle 13)) (piece \"Marker\" Each)}) (rules (meta (swap)) phases:{ (phase \"Opening\" P1 (play (move Add (to (sites Empty)) (then (set Var (last To))))) (nextPhase)) (phase \"Play\" (play (move Add (to (sites LineOfSight Empty at:(var))) (then (set Var (last To))))))} (end (if (no Moves Next) (byScore { (score P1 (+ (if (is Mover P1) 1 0) (\"Nbors\" (last To) P1))) (score P2 (+ (if (is Mover P2) 1 0) (\"Nbors\" (last To) P2)))}))))) 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": "Describe the mechanics of the following Ludii game\n(define \"RemoveGroups\" (forEach Site (sites Around (sites Group at:(last To)) Enemy) (remove (sites Group at:(site))))) (define \"Captures\" (and (all Sites (sites Around (sites Group at:(last To)) Enemy) if:(> (size Group at:(last To)) (size Group at:(site)))) (< 0 (count Sites in:(sites Around (sites Group at:(last To)) Enemy))))) (define \"FriendlyAdjacent\" (< 0 (count Sites in:(sites Around (to) Own)))) (define \"NoFriendlyAdjacent\" (= 0 (count Sites in:(sites Around (to) Own)))) (game \"Oust\" (players 2) (equipment { (board (hex 7)) (piece \"Disc\" Each)}) (rules (play (or (move Add (to (sites Empty) if:\"NoFriendlyAdjacent\")) (do (move Add (to (sites Empty) if:\"FriendlyAdjacent\")) ifAfterwards:\"Captures\" (then (and (\"RemoveGroups\") (moveAgain)))))) (end (if (and (< 2 (count Moves)) (= 0 (count Sites in:(sites Occupied by:Enemy)))) (result Mover Win)))))\n\n###\n\n", "completion": "Oust is a game for two players, played on a hexagonally patterned board which is initially empty. The two players, Black and White, take turns placing stones of their color onto unoccupied cells on the board. A group is a set of interconnected, like-colored stones. A group can be a singleton, a single stone which is not connected to any other stones of its color. A group includes all the stones of its own color connected to it. There are two types of moves - non-capturing placements and capturing placements. Non-capturing placements either forms no connections (adjacencies) with any stones, or forms one or more connections with only enemy stones. A non-capturing placement does not form any connection with stones of its own color. Making a non-capturing placement concludes your turn. When you place a stone which forms one or more connections with your own groups, you will create a new, larger group of your own stones. You can only make such a placement if said new group will have one or more connections with enemy groups upon its creation and if all said enemy groups are smaller than said new group. Upon making such a placement, all said enemy groups are removed from the board. After capturing one or more enemy groups and while it is still your turn, you must continue to add stones until you make a non-capturing placement, at which time your turn is concluded. If you have a placement available on your turn you must make one. If you don't have any placements available, you must pass your turn. There will always be a placement available for at least one player. You win by making a placement which captures all of the enemy stones on the board. The game is played on a size 7 board END" }, { "prompt": "Construct a Ludii game based on the following description\n5x9 intersecting lines; with a triangle formed by lines drawn from the second and fourth line of one of the short sides of the rectangle, with the base and a line bisecting the base of the triangle. One player plays as the General, placed on the central space of the rectangle, and the other player plays as 26 Rebels, places on the intersections of the second, third, and fourth of the long lines. Pieces move one space orthogonally. The General may capture one of the Rebels by hopping over it to an empty space. The General wins by capturing all the Rebels. The Rebels win by blocking the General from moving. P1 wins in blocking P2 to move. P2 wins in capturing by hopping all the pieces of P1.\n\n###\n\n", "completion": "(game \"Yeung Luk Sz' Kon Tseung Kwan\" (players 2) (equipment { (board (merge (rectangle 9 5) (shift 1 8 (scale 0.5 (wedge 3)))) use:Vertex) (piece \"Marker\" P1 \"StepToEmpty\") (piece \"Marker\" P2 (or (\"HopCapture\") (\"StepToEmpty\")))}) (rules (start { (place \"Marker1\" (union {(sites Column 1) (difference (sites Column 3) (union (sites Centre) (expand (sites Top)))) (sites Column 5)})) (place \"Marker2\" (centrePoint))}) (play (forEach Piece)) (end { (if (no Pieces P1) (result P2 Win)) (if (no Moves P2) (result P1 Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6 board. Six counters in each hole. A player picks up all of the counters in one of the holes in their row and sows them one-by-one in a clockwise direction in consecutive holes from the hole the pieces originated. The starting hole is always left empty, even if a player sows in a complete circuit of the board, the original house is skipped and sowing continues in the next hole after it. Players capture counters when the final counter is sown in the opponent's row and the hole containing it has two or three counters (counting the counter just dropped into it). If the hole before it also has two or three counters, these are also captured and so on until reaching a hole without two or three counters or one not belonging to the opponent. A move which would capture all of the opponent's counters is not allowed. If an opponent's holes are all empty, the other player must make a move placing counters in the opponent's row. If not possible, the player captures all the counters in their row. The player who has captured the most counters wins. If the game continues in a repeating loop, the players can agree to end the game and capture the counters remaining in their row. \n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (game \"Woli\" (players 2) (equipment { (mancalaBoard 2 6 store:None (track \"Track\" \"5,W,N,E\" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 6 to:(sites Track))) (play (if (is Proposed \"End\") (or (move Vote \"End\") (move Vote \"No\")) (or (if (is Cycle) (move Propose \"End\")) (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 (handSite Mover)) count:(count at:(to))) includeSelf:False backtracking:True))) ifAfterwards:(< 0 (count in:(sites Next))))))) (end (\"MancalaByScoreWhen\" (or (no Moves Mover) (is Decided \"End\")))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nGoal: Connect your opposite sides with a continuous chain of stones on edge-to-edge ('orthogonally adjacent') cells.\n \n Achieving the goal ends the game.\n \n Players take turns. There is no passing.\n -- On a turn the mover either places a stone from their supply on an empty space, or uses it to replace an opponent's stone on a space that the mover controls. \n \n Edge spaces are controlled by two orthogonally adjacent mover stones that are also orthogonally adjacent to each other.\n \n All other spaces are controlled by having at least 3 orthogonally adjacent mover stones, one of which that is both orthogonally adjacent to the second, and diagonally adjacent to the third. Using an order 1 board with 48 cells A mutually adjacent pair of your pieces to an edge location gives control there. To control a site with your adjacent stones, one stone must connect to a second orthogonally, and to a third diagonally.\n\n###\n\n", "completion": "(define \"ColourP2\" (colour 252 255 234 #1)) (define \"ColourP1\" (colour 229 92 0 #1)) (define \"Check4Win\" (if (is Mover P1) (if (is Connected Orthogonal { (sites {43 44 45 46 47}) (sites {0 1 2 3 4})}) (trigger \"Win\" Mover)) (if (is Connected Orthogonal { (sites {6 13 21 27 37}) (sites {10 20 26 34 41})}) (trigger \"Win\" Mover)))) (define \"AdjacentPair\" (<= 1 (+ (results from:(to) to:(intersection (sites Around (from) Orthogonal) (sites Occupied by:Mover)) (if (< 0 (count Sites in:(intersection { (sites Around (to) Orthogonal) (sites Around (from) Orthogonal) (sites Occupied by:Mover)}))) 1 0))))) (define \"LobsidedVEmbrace\" (<= 1 (+ (results from:(to) to:(intersection (sites Around (from) Orthogonal) (sites Occupied by:Mover)) (if (and (< 0 (count Sites in:(intersection { (sites Around (to) Orthogonal) (sites Around (from) Orthogonal) (sites Occupied by:Mover)}))) (< 0 (count Sites in:(intersection { (\"DiagonallyAdjacent2\" (to)) (sites Around (from) Orthogonal) (sites Occupied by:Mover)})))) 1 0))))) (define \"Majority\" (<= 3 (count Pieces Mover in:(sites Around (to) Orthogonal)))) (define \"EdgeMajority\" (<= 2 (count Pieces Mover in:(sites Around (to) Orthogonal)))) (define \"DiagonallyAdjacent2\" (sites Direction from:#1 (difference (difference (difference (difference Diagonal N) S) E) W) distance:1)) (define \"SitesEdge\" (union { (sites {43 44 45 46 47}) (sites {0 1 2 3 4}) (sites {6 13 21 27 37}) (sites {10 20 26 34 41})})) (game \"Morpharaoh\" (players 2) (equipment { (board (trim (remove (dual (tiling T33434 5)) cells: {0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 20 21 24 27 28 29 35 36 39 40 44 45 46 47 53 54 55 59 60 64 65 71 72 76 79 85 90 93 94 95 96 97 98 99})) use:Cell) (piece \"Disc\" Each) (piece \"Disc\" Neutral)}) (rules (play (or { (move Add (to (sites Empty))) (move Add (to (intersection (sites Occupied by:Next) (\"SitesEdge\")) if:(\"AdjacentPair\") (apply (remove (to))))) (move Add (to (difference (sites Occupied by:Next) (\"SitesEdge\")) if:(\"LobsidedVEmbrace\") (apply (remove (to)))))} (then \"Check4Win\"))) (end (if (is Triggered \"Win\" Mover) (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": "Construct a Ludii game based on the following description\n2x6 board, with a storage hole on either end. The game starts with four counters in each hole. A player picks up all of the counters in one of the holes in their row and sows them one-by-one in a counterclockwise direction in consecutive holes from the hole the pieces originated. The starting hole is always left empty, even if a player sows in a complete circuit of the board, the original house is skipped and sowing continues in the next hole after it. Players capture counters when the final counter is sown in the opponent's row and the hole containing it has two or three counters (counting the counter just dropped into it). If the hole before it also has two or three counters, these are also captured and so on until reaching a hole without two or three counters or one not belonging to the opponent. A move which would capture all of the opponent's counters is not allowed. If an opponent's holes are all empty, the other player must make a move placing counters in the opponent's row. If not possible, the player captures all the counters in their row. Play continues until all of the counters are captured. The player who has captured the most counters wins. If the game continues in a repeating loop, the players can agree to end the game and capture the counters remaining in their row. The game ended when a player has no piece on his side or if the two players are agree on the end of the game in case a cycle.\n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (+ (count at:(mapEntry #1)) (count in:(sites #1)))) (game \"Oware\" (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 (if (is Proposed \"End\") (or (move Vote \"End\") (move Vote \"No\")) (or (if (is Cycle) (move Propose \"End\")) (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 (if (or (no Moves Mover) (is Decided \"End\")) (byScore { (score P1 (\"PiecesOwnedBy\" P1)) (score P2 (\"PiecesOwnedBy\" P2))}))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nInitially, the graph contains only uncoloured vertices. At each turn, a player chooses a vertex to colour with his own colour, or pass. If there is no other adjacent vertex with the same colour, the player receives the weight of the vertex as score. When all vertices are coloured, or all players pass, the player who with the maximum score wins. The version of the game played with 2 players.\n\n###\n\n", "completion": "(game \"Onek Rong\" (players 2) (equipment { (board (subdivide (hex 2)) use:Vertex) (piece \"Marker\" Each)}) (rules (start { (set Cost 1 Vertex at:0) (set Cost 2 Vertex at:1) (set Cost 3 Vertex at:2) (set Cost 1 Vertex at:3) (set Cost 2 Vertex at:4) (set Cost 3 Vertex at:5) (set Cost 1 Vertex at:6) (set Cost 2 Vertex at:7) (set Cost 3 Vertex at:8) (set Cost 3 Vertex at:9) (set Cost 1 Vertex at:10) (set Cost 2 Vertex at:11) (set Cost 3 Vertex at:12) (set Cost 1 Vertex at:13) (set Cost 2 Vertex at:14) (set Cost 3 Vertex at:15) (set Cost 1 Vertex at:16) (set Cost 2 Vertex at:17) (set Cost 3 Vertex at:18) (set Cost 3 Vertex at:19) (set Cost 1 Vertex at:20) (set Cost 2 Vertex at:21) (set Cost 3 Vertex at:22) (set Cost 1 Vertex at:23)}) (play (or (move Claim (to (sites Empty)) (then (if (= 1 (size Group at:(last To))) (addScore Mover (cost Vertex at:(last To)))))) (move Pass))) (end (if (or (= (count Sites in:(sites Empty)) 0) (all Passed)) (byScore))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n8x8 board. Pieces move as follows: Raja (x1): moves one space in any direction; Mantri (x1): moves any distance orthogonally or diagonally; Ushtra (x2): moves diagonally any distance; Vaha (x2): move orthogonally one space and then diagonally another, jumping over any intervening pieces; Danti (x2): moves orthogonally any distance. Padati (x8): move forward orthogonally one space or one space diagonally forward to capture. When a Padati reaches the opposite edge of the board, it is promoted to a Mantri and is moved immediately to the space it last moved from. An opponent's piece is captured by moving one of the player's own pieces onto the space occupied by the opponent's piece. If the Raja can be captured on the opponent's next turn, it is in check. The Raja cannot be in check at the end of the player's turn. If this is impossible, the opponent wins. When a player is reduced to only their Raja and Padati, the opponent wins. In the case of a stalemate, the player in stalemate may remove any of the opponent's pieces (except their Raja). \n\n###\n\n", "completion": "(define \"Move\" (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King_noCross\" Mover)))) (define \"OnlyRajaAndPadati\" (and { (no Pieces #1 \"Ferz_noCross\") (no Pieces #1 \"Knight\") (no Pieces #1 \"Elephant\") (no Pieces #1 \"Rook\")})) (game \"Chaturanga (Kridakausalya)\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (\"ChessKing\" \"King_noCross\") (\"ChessQueen\" \"Ferz_noCross\") (\"ChessKnight\" \"Knight\") (\"ChessBishop\" \"Elephant\") (\"ChessRook\" \"Rook\") (\"ChessPawn\" \"Pawn\" ~ (then (if (is In (last To) (sites Mover \"Promotion\")) (and (promote (last To) (piece \"Ferz_noCross\") Mover) (fromTo (from (last To)) (to (last From))))))) (regions \"Promotion\" P1 (sites Top)) (regions \"Promotion\" P2 (sites Bottom))}) (rules (start { (place \"Pawn1\" (sites Row 1)) (place \"Pawn2\" (sites Row 6)) (place \"Rook1\" {\"A1\" \"H1\"}) (place \"Knight1\" {\"B1\" \"G1\"}) (place \"Elephant1\" {\"C1\" \"F1\"}) (place \"Ferz_noCross1\" coord:\"D1\") (place \"King_noCross1\" coord:\"E1\") (place \"Rook2\" {\"A8\" \"H8\"}) (place \"Knight2\" {\"B8\" \"G8\"}) (place \"Elephant2\" {\"C8\" \"F8\"}) (place \"Ferz_noCross2\" coord:\"D8\") (place \"King_noCross2\" coord:\"E8\")}) (play (if (can Move (\"Move\")) (\"Move\") (move Remove (difference (sites Occupied by:Next) (sites Occupied by:Next component:\"King_noCross\"))))) (end { (\"Checkmate\" \"King_noCross\") (if (\"OnlyRajaAndPadati\" Next) (result Mover Win))}))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe towers can move forwards (including diagonal and orthogonal forward). -> The towers can move only forward.\nThe game is played according to the rules of Martin Gardner. The army can be placed anywhere. -> The game is played according to the rules of Martin Gardner with a slightly difference. The army can be placed anywhere except in the middle of the towers.\n(game \"Jeu Militaire\" (players 2) (equipment { (board (rotate 90 (\"ThreeMensMorrisGraphWithLeftAndRightTriangles\")) use:Vertex) (hand P1) (piece \"Pawn\" P1 (\"StepToEmpty\")) (piece \"Pawn\" P2 N (\"StepToEmpty\" Forwards)) (regions \"Home\" P2 (sites {\"B1\" \"C2\" \"A2\"})) (regions \"Home\" P1 (sites {\"B2\"}))}) (rules (start { (place \"Pawn1\" \"Hand1\") (place \"Pawn2\" (sites P2))}) phases:{ (phase \"Placement\" P1 (play (move (from (handSite P1)) (to (sites Empty)))) (nextPhase \"Movement\")) (\"PhaseMovePiece\" \"Movement\")} (end { (if (no Moves P1) (result P2 Win)) (if (is In (where \"Pawn\" P1) (sites P2)) (result P1 Win))})))\n\n###\n\n", "completion": "(game \"Jeu Militaire\" (players 2) (equipment { (board (rotate 90 (\"ThreeMensMorrisGraphWithLeftAndRightTriangles\")) use:Vertex) (hand P1) (piece \"Pawn\" P1 (\"StepToEmpty\")) (piece \"Pawn\" P2 N (\"StepToEmpty\" Forward)) (regions \"Home\" P2 (sites {\"B1\" \"C2\" \"A2\"})) (regions \"Home\" P1 (sites {\"B2\"}))}) (rules (start { (place \"Pawn1\" \"Hand1\") (place \"Pawn2\" (sites P2))}) phases:{ (phase \"Placement\" P1 (play (move (from (handSite P1)) (to (difference (sites Empty) (sites {\"B2\"}))))) (nextPhase \"Movement\")) (\"PhaseMovePiece\" \"Movement\")} (end { (if (no Moves P1) (result P2 Win)) (if (is In (where \"Pawn\" P1) (sites P2)) (result P1 Win))}))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nEach row has 12 holes. -> Each row has 14 holes.\n(define \"NextHoleFrom\" (\"NextSiteOnTrack\" 1 from:#1)) (define \"HaveHolesWithMoreThanOneCounter\" (not (all Sites (forEach (sites Mover \"Home\") if:(< 1 (count at:(site)))) if:(= 0 (count at:(site)))))) (define \"NoPiece\" (all Sites (sites Player \"Home\") if:(= 0 (count at:(site))))) (define \"Columns\" 12) (game \"Msuwa wa Kunja\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"0,E,N1,W\" loop:True P1) (track \"Track2\" \"24,E,N1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"Track1\")) (regions \"Home\" P2 (sites Track \"Track2\")) (regions \"Inner\" P1 (difference (sites Track \"Track1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"Track2\") (sites Top))) (piece \"Seed\" Shared)}) (rules (start (set Count 2 to:(union (sites Top) (sites Bottom)))) (play (if (and (\"SameTurn\") (< 0 (var))) (move Remove (forEach (sites Next \"Home\") if:(< 0 (count at:(site)))) (then (and (if (> (var) 1) (moveAgain)) (set Var (- (var) 1))))) (if (\"HaveHolesWithMoreThanOneCounter\") (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(< 1 (count at:(from)))) (then (sow \"Track\" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover \"Inner\")) (if (< 0 (count at:(\"OppositePit\" (to)))) (and (remove (\"OppositePit\" (to))) (if (< 0 (count at:(\"OppositeOuterPit\" (to)))) (and { (remove (\"OppositeOuterPit\" (to))) (set Var 2) (moveAgain)}))))))))) (move Select (from (sites Mover \"Home\") if:(and (= 1 (count at:(from))) (= 0 (count at:(\"NextHoleFrom\" (from)))))) (then (sow \"Track\" owner:(mover) apply: (if (is In (to) (sites Mover \"Inner\")) (if (< 0 (count at:(\"OppositePit\" (to)))) (and (remove (\"OppositePit\" (to))) (if (< 0 (count at:(\"OppositeOuterPit\" (to)))) (and { (remove (\"OppositeOuterPit\" (to))) (set Var 2) (moveAgain)}))))))))))) (end (forEach NonMover if:(\"NoPiece\") (result Player Loss)))))\n\n###\n\n", "completion": "(define \"NextHoleFrom\" (\"NextSiteOnTrack\" 1 from:#1)) (define \"HaveHolesWithMoreThanOneCounter\" (not (all Sites (forEach (sites Mover \"Home\") if:(< 1 (count at:(site)))) if:(= 0 (count at:(site)))))) (define \"NoPiece\" (all Sites (sites Player \"Home\") if:(= 0 (count at:(site))))) (define \"Columns\" 14) (game \"Msuwa wa Kunja\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"0,E,N1,W\" loop:True P1) (track \"Track2\" \"28,E,N1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"Track1\")) (regions \"Home\" P2 (sites Track \"Track2\")) (regions \"Inner\" P1 (difference (sites Track \"Track1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"Track2\") (sites Top))) (piece \"Seed\" Shared)}) (rules (start (set Count 2 to:(union (sites Top) (sites Bottom)))) (play (if (and (\"SameTurn\") (< 0 (var))) (move Remove (forEach (sites Next \"Home\") if:(< 0 (count at:(site)))) (then (and (if (> (var) 1) (moveAgain)) (set Var (- (var) 1))))) (if (\"HaveHolesWithMoreThanOneCounter\") (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(< 1 (count at:(from)))) (then (sow \"Track\" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover \"Inner\")) (if (< 0 (count at:(\"OppositePit\" (to)))) (and (remove (\"OppositePit\" (to))) (if (< 0 (count at:(\"OppositeOuterPit\" (to)))) (and { (remove (\"OppositeOuterPit\" (to))) (set Var 2) (moveAgain)}))))))))) (move Select (from (sites Mover \"Home\") if:(and (= 1 (count at:(from))) (= 0 (count at:(\"NextHoleFrom\" (from)))))) (then (sow \"Track\" owner:(mover) apply: (if (is In (to) (sites Mover \"Inner\")) (if (< 0 (count at:(\"OppositePit\" (to)))) (and (remove (\"OppositePit\" (to))) (if (< 0 (count at:(\"OppositeOuterPit\" (to)))) (and { (remove (\"OppositeOuterPit\" (to))) (set Var 2) (moveAgain)}))))))))))) (end (forEach NonMover if:(\"NoPiece\") (result Player Loss))))) 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 Shah (king): moves one space orthogonally or diagonally. 1 x Fers (counselor): One square diagonally. 2 x Rukh (rook): Any number of spaces orthogonally. 2 x Pil (elephant): Two squares diagonally, jumping over the first. Cannot capture another Pil. 2 x Asb (horse): Moves as a chess knight. 8 x Sarbaz (soldier): Moves one space forward orthogonally; one space forward diagonally to capture. No en passant. Promoted to Fers when reaching the eighth rank. No castling. Stalemate results in win for player causing it. The player who checkmates the king wins. \n\n###\n\n", "completion": "(game \"Shatranj\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (\"ChessPawn\" \"Pawn\" ~ (then (\"ReplayInMovingOn\" (sites Mover \"Promotion\")))) (\"ChessRook\" \"Rook\") (\"ChessKing\" \"King_noCross\") (piece \"Bishop_noCross\" Each (move Hop Diagonal (between if:True) (to if:(or (is Empty (to)) (\"IsEnemyAt\" (to))) (apply (remove (to)))))) (\"ChessKnight\" \"Knight\") (piece \"Ferz_noCross\" Each (\"StepToNotFriend\" Diagonal)) (regions \"Promotion\" P1 (sites Top)) (regions \"Promotion\" P2 (sites Bottom))}) (rules (start { (place \"Pawn1\" (sites Row 1)) (place \"Pawn2\" (sites Row 6)) (place \"Rook1\" {\"A1\" \"H1\"}) (place \"Knight1\" {\"B1\" \"G1\"}) (place \"Bishop_noCross1\" {\"C1\" \"F1\"}) (place \"Ferz_noCross1\" coord:\"D1\") (place \"King_noCross1\" coord:\"E1\") (place \"Rook2\" {\"A8\" \"H8\"}) (place \"Knight2\" {\"B8\" \"G8\"}) (place \"Bishop_noCross2\" {\"C8\" \"F8\"}) (place \"Ferz_noCross2\" coord:\"D8\") (place \"King_noCross2\" coord:\"E8\")}) (play (if \"SameTurn\" (move Promote (last To) (piece \"Ferz_noCross\") Mover) (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King_noCross\" Mover))))) (end { (\"Checkmate\" \"King_noCross\") (if (= (count Pieces Next) 1) (result Mover Win)) (\"BlockWin\")}))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nEach row has 9 holes. -> Each row has 10 holes.\n(define \"AllSitesNoMoreThanOne\" (all Sites (sites Mover \"Home\") if:(>= 1 (count at:(site))))) (define \"NoSiteWith2Seeds\" (all Sites (sites Mover \"Home\") if:(!= 2 (count at:(site))))) (define \"NextHole\" (\"NextSiteOnTrack\" #2 from:#1 \"Track\")) (define \"NoPiece\" (all Sites (sites Player) if:(= 0 (count at:(site))))) (define \"Columns\" 9) (game \"Njombwa\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"0,E,N1,W\" loop:True P1) (track \"Track2\" \"18,E,N1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"Track1\")) (regions \"Home\" P2 (sites Track \"Track2\")) (regions \"Inner\" P1 (difference (sites Track \"Track1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"Track2\") (sites Top))) (piece \"Seed\" Shared)}) (rules (start { (set Count 29 to:(sites {0 (- (* 4 9) 1)})) (set Count 2 to:(sites {1 (- (* 4 9) 2)})) (set Count 1 to:(sites {2 (- (* 4 9) 3)}))}) phases:{ (phase \"Opening1\" (play (move Select (from (forEach (sites Mover \"Home\") if:(= 2 (count at:(site))))) (then (sow \"Track\" owner:(mover) apply:(if (and (is In (to) (sites Mover \"Inner\")) (is Occupied (\"OppositePit\" (to)))) (remove (\"OppositePit\" (to)))))))) (nextPhase (\"NoSiteWith2Seeds\") \"Opening2\")) (phase \"Opening2\" (play (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (forEach (sites Mover \"Home\") if:(= 29 (count at:(site))))) if:(> (count at:(from)) 0)) (then (sow \"Track\" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain)))))) (nextPhase (not (is Next Mover)) \"Sowing\")) (phase \"Sowing\" (play (if (\"AllSitesNoMoreThanOne\") (move Select (from (sites Mover \"Home\") if:(and (is Occupied (from)) (is Empty (\"NextHole\" (from) 1)))) (then (sow \"Track\" owner:(mover)))) (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(> (count at:(from)) 1)) (then (sow \"Track\" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (and (is In (to) (sites Mover \"Inner\")) (is Occupied (\"OppositePit\" (to)))) (and (remove (\"OppositePit\" (to))) (if (is Occupied (\"OppositeOuterPit\" (to))) (remove (\"OppositeOuterPit\" (to)))))))))))))} (end (forEach NonMover if:(\"NoPiece\") (result Player Loss)))))\n\n###\n\n", "completion": "(define \"AllSitesNoMoreThanOne\" (all Sites (sites Mover \"Home\") if:(>= 1 (count at:(site))))) (define \"NoSiteWith2Seeds\" (all Sites (sites Mover \"Home\") if:(!= 2 (count at:(site))))) (define \"NextHole\" (\"NextSiteOnTrack\" #2 from:#1 \"Track\")) (define \"NoPiece\" (all Sites (sites Player) if:(= 0 (count at:(site))))) (define \"Columns\" 10) (game \"Njombwa\" (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))) (piece \"Seed\" Shared)}) (rules (start { (set Count 29 to:(sites {0 (- (* 4 10) 1)})) (set Count 2 to:(sites {1 (- (* 4 10) 2)})) (set Count 1 to:(sites {2 (- (* 4 10) 3)}))}) phases:{ (phase \"Opening1\" (play (move Select (from (forEach (sites Mover \"Home\") if:(= 2 (count at:(site))))) (then (sow \"Track\" owner:(mover) apply:(if (and (is In (to) (sites Mover \"Inner\")) (is Occupied (\"OppositePit\" (to)))) (remove (\"OppositePit\" (to)))))))) (nextPhase (\"NoSiteWith2Seeds\") \"Opening2\")) (phase \"Opening2\" (play (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (forEach (sites Mover \"Home\") if:(= 29 (count at:(site))))) if:(> (count at:(from)) 0)) (then (sow \"Track\" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain)))))) (nextPhase (not (is Next Mover)) \"Sowing\")) (phase \"Sowing\" (play (if (\"AllSitesNoMoreThanOne\") (move Select (from (sites Mover \"Home\") if:(and (is Occupied (from)) (is Empty (\"NextHole\" (from) 1)))) (then (sow \"Track\" owner:(mover)))) (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(> (count at:(from)) 1)) (then (sow \"Track\" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (and (is In (to) (sites Mover \"Inner\")) (is Occupied (\"OppositePit\" (to)))) (and (remove (\"OppositePit\" (to))) (if (is Occupied (\"OppositeOuterPit\" (to))) (remove (\"OppositeOuterPit\" (to)))))))))))))} (end (forEach NonMover if:(\"NoPiece\") (result Player Loss))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayed on a 8x8 board. Each player has two stones, who can jump over any other stone. Enemy stones jumped over are captured. First player unable to move loses. \n\n###\n\n", "completion": "(game \"Leap Frog\" (players 2) (equipment { (board (square 8)) (piece \"Marker\" Each (move Hop (between if:(is Occupied (between)) (apply (if (\"IsEnemyAt\" (between)) (remove (between))))) (to if:(is Empty (to)))))}) (rules (start { (place \"Marker1\" {\"B4\" \"C5\" \"C6\" \"D2\" \"D4\" \"D6\" \"E3\" \"E5\" \"E7\" \"F3\" \"F4\" \"G5\"}) (place \"Marker2\" {\"B5\" \"C3\" \"C4\" \"D3\" \"D5\" \"D7\" \"E2\" \"E4\" \"E6\" \"F5\" \"F6\" \"G4\"})}) (play (forEach Piece)) (end (\"BlockWin\")))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"BigHop\" (move Hop (between (range 1 9) if:#1 (apply (remove (between)))) (to if:(and (is Empty (to)) (\"NumCapturedPiecesIsOdd\"))))) (define \"NumCapturedPiecesIsOdd\" (is Even (count Steps (from) (to)))) (game \"Rimau-Rimau (One Tiger)\" (players 2) (equipment { (\"AlquerqueBoardWithBottomAndTopTriangles\") (hand Each) (piece \"Tiger\" P1 (or { (\"StepToEmpty\") (\"BigHop\" (\"IsEnemyAt\" (between)))})) (piece \"human\" P2 \"StepToEmpty\")}) (rules (start { (place \"human2\" (expand (sites Centre))) (place \"human2\" (handSite P2) count:15) (place \"Tiger1\" (handSite P1))}) phases:{ (phase \"PlacementTiger\" P1 (play (move (from (handSite P1)) (to (sites {\"C3\" \"C7\"})) (then (moveAgain)))) (nextPhase Mover \"MoveHuman\")) (phase \"MoveHuman\" P1 (play (move (from (intersection (expand (sites Centre)) (sites Occupied by:Next))) (to (difference (sites Empty) (expand (sites Centre)))) (then (if (< 6 (count Sites in:(intersection (expand (sites Centre)) (sites Occupied by:Next)))) (moveAgain))))) (nextPhase Mover (= 6 (count Sites in:(intersection (expand (sites Centre)) (sites Occupied by:Next)))) \"Movement\")) (phase \"PlacementHuman\" P2 (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase (\"HandEmpty\" P2) \"Movement\")) (\"PhaseMovePiece\" \"Movement\" (end (\"NoMovesP1NoPiecesP2\")))}))\n\n###\n\n", "completion": "5x5 intersecting lines, with diagonals in each quadrant. Two triangles, the apexes of which intersect with the square at the midpoint of opposite sides. One line bisecting the base of the triangle, and another bisecting this line. One player plays as the tiger, which is placed on the apex of either triangle. The other player plays as 24 people, nine of which begin on the nine central points of the board. To begin, the person playing as the tiger removes three of the people from their starting position and places them on any points on the board. The person playing as the people then places one of the remaining people on an empty spot on the board. The tiger then moves to an empty adjacent spot along the lines of the board. Play continues like this until all of the people are placed, at which point the people move to an adjacent empty spot on the board as well. On its turn, the tiger may hop over a line of people to an empty spot on the other side of the line, following the lines of the board and only if the number of people in the line is odd. The tiger wins if it captures all the people; the people win when they block the tiger from being able to move. END" }, { "prompt": "Construct a Ludii game based on the following description\n2x12 board, with the spaces rendered as points, divided into half. Fifteen pieces per player. 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. A throw of doubles forces the player to play the throw twice. Each player's pieces begin in three stacks of five, on the leftmost point (with respect to the opponent) on the opponent's side of the board. Play proceeds (with respect to the player) from right to left on the opponent's side of the board, and then from left to right on the player's side of the board. A player cannot place two pieces on a single point on any of the first twelve points of the board, except for those pieces in the starting position. A player cannot move a piece onto a point containing two or more pieces belonging to the opponent. When a piece lands on a point occupied by a single piece belonging to the opponent, it is removed from the board and must be entered again, and can only do so using the value of one die, not both, with the starting point considered to be point 1, the next point 2, etc. Opponent's pieces can be removed from the board in this way when reentering the board. If a player cannot reenter pieces on the board they lose their turn. When all of a player's pieces are on their final 6 points, they may start removing pieces from the board. They can do so by rolling a 6 to move from the 6th point, and so on down to 1. Players must use all available moves presented by the dice. The first player to remove all of their pieces wins. \n\n###\n\n", "completion": "(define \"AllPiecesInFinalQuadrant\" (\"AllOwnedPiecesIn\" (sites Mover \"FinalQuadrant\"))) (define \"NextSiteFrom\" (\"NextSiteOnTrack\" #2 from:#1)) (game \"Verquere\" (players 2) (equipment { (\"BackgammonBoard\" (\"BackgammonTracksSameDirectionOppositeCornersWithBars2\" End)) (dice d:6 num:2) (piece \"Disc\" Each (forEach Die replayDouble:True if:(\"DieNotUsed\") (if (\"IsEndTrack\" (\"NextSiteFrom\" (from) (pips))) (if (\"AllPiecesInFinalQuadrant\") (move Remove (from))) (move (from (from)) (to (\"NextSiteFrom\" (from) (pips)) if:(and (\"NoEnemyOrOnlyOne\" (to)) (if (not (is In (to) (sites Mover \"StartingSide\"))) True (is Empty (to)))) (\"HittingCapture\" (mapEntry \"Bar\" Next))))) (then (\"ReplayNotAllDiceUsed\")))) (regions \"FinalQuadrant\" P1 (sites {7..12})) (regions \"FinalQuadrant\" P2 (sites {13..18})) (regions \"StartingSide\" P1 (sites {25..20 18..13})) (regions \"StartingSide\" P2 (sites {0..5 7..12})) (map \"Bar\" {(pair P1 6) (pair P2 19)})}) (rules (start { (place Stack \"Disc1\" 25 count:15) (place Stack \"Disc2\" 0 count:15)}) (play (\"RollEachNewTurnMove\" (forEach Piece top:True))) (end (\"EscapeWin\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayed on a board with 9x10 intersecting lines. Pieces are placed on the intersections of the lines. Centered on opposite sides of the boards are two areas, known as the gong (\\ \n\n###\n\n", "completion": "(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 \"Xiangqi\" (\"TwoPlayersNorthSouth\") (equipment { (board (rectangle 10 9) use:Vertex) (piece \"Jiang\" Each (\"StepMoveOnThePalace\" Orthogonal)) (piece \"Shi\" Each (\"StepMoveOnThePalace\" Diagonal)) (piece \"Xiang\" Each (move Slide Diagonal (between (exact 2) if:(and { (is In (between) (sites Mover \"Home\")) (is Empty (between))})) (to if:(\"IsEnemyAt\" (to)) (apply (remove (to)))))) (piece \"Ma\" Each (forEach Direction Orthogonal (to if:(is Empty (to)) (apply (forEach Direction (from (to)) (directions {FR FL} of:All) (if (not (\"IsFriendAt\" (to))) (move (from) (to (apply if:(\"IsEnemyAt\" (to)) (remove (to))))))))))) (piece \"Ju\" Each (\"SlideCapture\" Orthogonal)) (piece \"Pao\" Each (or (move Slide Orthogonal) (move Hop Orthogonal (between before:(count Rows) after:(count Rows) if:(is Occupied (between))) (to if:(is Empty (to)) (apply if:(\"IsEnemyAt\" (to)) (remove (to))))))) (piece \"Zu\" Each (\"StepToNotFriend\" (if (is In (from) (sites Mover \"Home\")) Forward (directions {Forward Rightward Leftward})))) (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))}) (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 (forEach Piece) ifAfterwards:(and (\"JiangSameColumnWithNoPieceBetween\") (not (\"IsInCheck\" \"Jiang\" Mover))))) (end { (\"Checkmate\" \"Jiang\") (\"BlockWin\")}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayed on a Hex board. Players may play a piece of any color piece. The goal is to form a line connecting the player's two sides with either color. The game is played on a 11x11 board The first player to connect his two sides wins.\n\n###\n\n", "completion": "(game \"Chameleon\" (players 2) (equipment { (board (hex Diamond 11)) (piece \"Marker\" Each) (hand Shared size:2) (regions P1 {(sites Side NE) (sites Side SW)}) (regions P2 {(sites Side NW) (sites Side SE)})}) (rules (meta (swap)) (start { (place \"Marker1\" (handSite Shared)) (place \"Marker2\" (handSite Shared 1))}) (play (move (from (sites Hand Shared)) (to (sites Empty)) copy:True)) (end { (if (is Connected Mover) (result Mover Win)) (if (is Connected Next) (result Next Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nTURNS - At each turn, each player must move one of his stones\n - A stone moves (orthogonal and diagonal) forward to an empty cell.\n GOAL - A player wins by making a (orthogonal or diagonal) 4 in-a-row. \n\n###\n\n", "completion": "(game \"Roll-Ing to Four\" (\"TwoPlayersNorthSouth\") (equipment { (board (rectangle 10 4) use:Vertex) (piece \"Ball\" Each (\"StepToEmpty\" (directions Forwards of:All)))}) (rules (start { (place \"Ball1\" (sites {\"A1\" \"B1\" \"C1\" \"B6\" \"C6\" \"D6\"})) (place \"Ball2\" (sites {\"A5\" \"B5\" \"C5\" \"B10\" \"C10\" \"D10\"}))}) (play (forEach Piece)) (end (if (is Line 4 All) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n8x8 Draughts board. One player plays with two foxes, the other with twelve or more hens, played on the white squares. The hens begin on the rows closest to the player; the foxes begin, one each on the left and right end of the row farthest from the hens. Hens move one space forward diagonally, the foxes move one space diagonally forward or backward. Foxes must alternate turns, i.e., when one fox moves, the other fox must move on the next turn. The foxes may capture a hen by hopping over it to an empty space diagonally on the other side of it. The hens win by blocking the foxes from being able to move; the foxes win by capturing all the hens.\n \n\n###\n\n", "completion": "(game \"Jeu de Renard (Two Foxes)\" (players 2) (equipment { (board (square 8)) (piece \"Fox\" P1 (if (= (state at:(from)) 1) (or \"StepDiagonalToEmpty\" \"HopDiagonalCapture\") (then (and (forEach Site (sites Occupied by:Mover) (if (= (state at:(site)) 0) (set State at:(site) 1))) (set State at:(last To) 0))))) (piece \"Hen\" P2 N (\"StepToEmpty\" (directions {FR FL})))}) (rules (start { (place \"Fox1\" (intersection (sites Top) (union (sites Left) (difference (expand (sites Right)) (sites Right)))) state:1) (place \"Hen2\" (difference (expand (sites Bottom) steps:2) (sites Phase 0)))}) phases:{ (phase \"Opening\" P1 (play (forEach Piece (or \"StepDiagonalToEmpty\" \"HopDiagonalCapture\" (then (set State at:(last To) 0))))) (nextPhase \"Movement\")) (\"PhaseMovePiece\" \"Movement\")} (end (\"NoMovesP1NoPiecesP2\")))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"PiecesOwnedBy\" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (game \"Azigo\" (players 2) (equipment { (mancalaBoard 2 20 store:None { (track \"Track\" \"0,E,N,W\" loop:True) (track \"TrackSpecialHome1\" \"0,E\" loop:True P1) (track \"TrackSpecialHome2\" \"39,W\" loop:True P2)}) (piece \"Seed\" Shared) (hand Each) (map \"LeftMost\" {(pair P1 0) (pair P2 39)}) (regions \"OpeningRegion\" P1 (sites {8..11})) (regions \"OpeningRegion\" P2 (sites {28..31})) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start { (set Count 5 to:(sites {0 1 2 3 4 5 6 9 39 38 37 36 35 34 33 30})) (set Count 1 to:(sites {7 8 11 32 31 28})) (set Count 2 to:(sites {10 29}))}) phases: { (phase \"Opening\" (play (move (from (sites Mover \"OpeningRegion\") if:(is Occupied (from))) (to (handSite Mover)) count:(count at:(from)))) (nextPhase Mover (all Sites (sites Mover \"OpeningRegion\") if:(is Empty (site))) \"Sowing\")) (phase \"Sowing\" (play (or (move Select (from (sites Mover) if:(is Occupied (from))) (then (sow \"Track\" apply:(if (and (is In (to) (sites Next)) (or (= 2 (count at:(to))) (= 4 (count at:(to))))) (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to)))) origin:(< 1 (count at:(from))) backtracking:True))) (if (is Occupied Cell (handSite Mover)) (or (do (set Var \"NumToSow\" (count Cell at:(handSite Mover))) next:(move (from (handSite Mover)) (to (mapEntry \"LeftMost\" Mover)) count:(count Cell at:(handSite Mover)) (then (and (sow count:(var \"NumToSow\") \"Track\" if:(and (is In (to) (sites Next)) (or (= 2 (count at:(to))) (= 4 (count at:(to))))) apply:(if (and (is In (to) (sites Next)) (or (= 2 (count at:(to))) (= 4 (count at:(to))))) (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to)))) origin:True forward:True) (set Var \"NumToSow\" 0))))) (do (set Var \"NumToSow\" (count Cell at:(handSite Mover))) next:(move (from (handSite Mover)) (to (mapEntry \"LeftMost\" Mover)) count:(count Cell at:(handSite Mover)) (then (and (sow count:(var \"NumToSow\") \"TrackSpecialHome\" owner:(mover) origin:True) (set Var \"NumToSow\" 0))))))))))} (end (\"MancalaByScoreWhen\" (no Moves Mover)))))\n\n###\n\n", "completion": "2x20 board. Opening arrangement: Each player has this opening arrangement (number of counters in each hole, starting from the leftmost hole): 5-5-5-5-5-5-5-1-1-5-2-1-0-0-0-0-0-0-0-0. Opening phase: Players remove the counters in their final four holes with counters and conceals them from the opponent. Players take the counters from any of their holes and sow them in an anti-clockwise direction. When sowing, the first counter is dropped into the hole from which it just came, unless it is a single counter. If the last counter lands in the opponent's row and this hole contains one or three, counters, these are taken and added to the concealed store. Also, if the hole from which a capture was made is preceded by an unbroken sequence of holes with one or three counters, these are also taken. In place of a move, a player may add all of the counters from the concealed store, sowing from the leftmost hole in their row. If the sowing reaches the rightmost hole in this row, sowing may continue from the leftmost hole or may continue into the opponent's row. If the player continues into the opponent's row, subsequent holes after the one in which the final counter was dropped are captured if they contain one or three counters, in an unbroken sequence. END" }, { "prompt": "Construct a Ludii game based on the following description\n2x5 board, the right-most hole is the store. Four counters in each hole. Sowing in an anti-clockwise direction, including the store. Play begins by each player placing the counters in their fourth hole into their store. Moves may begin from any of a player's holes except the store. If the last counter of a sowing drops into a hole making it contain two or three counters, these are taken and placed in the store. As soon as a player has at least thirteen counters in their store, they are picked up and sown, omitting each player's store and takes any counters in the opponent's holes which now contain two or three counters. Each player performs this move only once. The player who captures the most counters wins. \n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (count at:(mapEntry #1))) (game \"I Pere\" (players 2) (equipment { (mancalaBoard 2 5 store:None (track \"Track\" \"0,E,N,W\" loop:True)) (piece \"Seed\" Shared) (hand Each) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 4) (pair P2 5)}) (map \"Fourth\" {(pair P1 3) (pair P2 6)})}) (rules (start (set Count 4 to:(sites Track))) phases:{ (phase \"Opening\" (play (move (from (mapEntry \"Fourth\" Mover)) (to (mapEntry Mover)) count:4)) (nextPhase Mover \"Sowing\")) (phase \"Sowing\" (play (if (and (<= 13 (count at:(mapEntry Mover))) (!= 1 (value Player Mover))) (or { (move Select (from (mapEntry Mover)) (then (and (sow skipIf:(or (= (to) (mapEntry P1)) (= (to) (mapEntry P2)))) (set Value Mover 1))))} (then (forEach Site (difference (sites Next) (mapEntry Next)) (if (or (= 2 (count at:(site))) (= 3 (count at:(site)))) (fromTo (from (site)) (to (mapEntry Mover)) count:(count at:(site))))))) (move Select (from (difference (sites Mover) (mapEntry Mover)) if:(is Occupied (from))) (then (sow apply:(if (or (= 2 (count at:(to))) (= 3 (count at:(to)))) (fromTo (from (to)) (to (mapEntry Mover)) count:(count at:(to))))))))))} (end (\"MancalaByScoreWhen\" (no Moves Next))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"Buudal\" (players 2) (equipment { (board (square 3 diagonals:Solid) use:Vertex) (hand Each) (piece \"Marker\" Each (move Hop (between if:True (apply (if (\"IsEnemyAt\" (between)) (remove (between))))) (to if:(is Empty (to)))))}) (rules (start (place \"Marker\" \"Hand\" count:6)) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (\"PhaseMovePiece\" \"Movement\")} (end (\"CaptureAll\" Next))))\n\n###\n\n", "completion": "3x3 intersecting lines, with diagonals in the four squares formed. Six pieces per player. Players alternate turns placing one of their pieces on the board. when all of the pieces have been placed, players alternate turns moving a piece by jumping over an adjacent spot to the next spot, along the lines of the board, which must be empty. If an opponent's piece is in the spot which was jumped, that piece is captured. The player who captures all of the opponent's pieces wins. END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nPlayed on a size 5 board. -> Played on a size 6 board.\n(define \"TerritoryP2\" (+ (count Sites in:(sites Occupied by:P2)) (count Sites in:(forEach (sites Empty) if:(> (count Sites in:(intersection (sites Occupied by:P2) (sites LineOfSight at:(site)))) (count Sites in:(intersection (sites Occupied by:P1) (sites LineOfSight at:(site))))))))) (define \"TerritoryP1\" (+ (count Sites in:(sites Occupied by:P1)) (count Sites in:(forEach (sites Empty) if:(> (count Sites in:(intersection (sites Occupied by:P1) (sites LineOfSight at:(site)))) (count Sites in:(intersection (sites Occupied by:P2) (sites LineOfSight at:(site))))))))) (define \"PlayableSites\" (forEach (sites Board) if:(> (count Sites in:(intersection (sites Occupied by:Mover) (sites LineOfSight at:(site)))) (size Stack at:(site))))) (define \"FriendlyInSight\" (count Sites in:(intersection (sites Occupied by:Mover) (sites LineOfSight at:(last From))))) (game \"Tumbleweed\" (players 2) (equipment { (board (hex 5)) (piece \"Disc\" Each) (piece \"Disc\" Neutral)}) (rules (start (place Stack \"Disc0\" (centrePoint) count:2)) phases:{ (phase \"Opening\" (play (if (= 0 (count Moves)) (move Add (piece \"Disc1\") (to (sites Empty)) (then (moveAgain))) (if (= 1 (count Moves)) (move Add (piece \"Disc2\") (to (sites Empty))) (move Select (from (union (sites Occupied by:P1) (sites Occupied by:P2))) (then (if (= 1 (who at:(last From))) (do (swap Players 1 2) next:(set NextPlayer (player 1))) (pass))))))) (nextPhase (= 3 (count Moves)) \"Play\")) (phase \"Play\" (play (or (move Select (from \"PlayableSites\") (then (add (to (last From)) count:(- \"FriendlyInSight\" ((size Stack at:(last From)))) stack:True))) (move Pass))))} (end (if (all Passed) (byScore { (score P1 \"TerritoryP1\") (score P2 \"TerritoryP2\")})))))\n\n###\n\n", "completion": "(define \"TerritoryP2\" (+ (count Sites in:(sites Occupied by:P2)) (count Sites in:(forEach (sites Empty) if:(> (count Sites in:(intersection (sites Occupied by:P2) (sites LineOfSight at:(site)))) (count Sites in:(intersection (sites Occupied by:P1) (sites LineOfSight at:(site))))))))) (define \"TerritoryP1\" (+ (count Sites in:(sites Occupied by:P1)) (count Sites in:(forEach (sites Empty) if:(> (count Sites in:(intersection (sites Occupied by:P1) (sites LineOfSight at:(site)))) (count Sites in:(intersection (sites Occupied by:P2) (sites LineOfSight at:(site))))))))) (define \"PlayableSites\" (forEach (sites Board) if:(> (count Sites in:(intersection (sites Occupied by:Mover) (sites LineOfSight at:(site)))) (size Stack at:(site))))) (define \"FriendlyInSight\" (count Sites in:(intersection (sites Occupied by:Mover) (sites LineOfSight at:(last From))))) (game \"Tumbleweed\" (players 2) (equipment { (board (hex 6)) (piece \"Disc\" Each) (piece \"Disc\" Neutral)}) (rules (start (place Stack \"Disc0\" (centrePoint) count:2)) phases:{ (phase \"Opening\" (play (if (= 0 (count Moves)) (move Add (piece \"Disc1\") (to (sites Empty)) (then (moveAgain))) (if (= 1 (count Moves)) (move Add (piece \"Disc2\") (to (sites Empty))) (move Select (from (union (sites Occupied by:P1) (sites Occupied by:P2))) (then (if (= 1 (who at:(last From))) (do (swap Players 1 2) next:(set NextPlayer (player 1))) (pass))))))) (nextPhase (= 3 (count Moves)) \"Play\")) (phase \"Play\" (play (or (move Select (from \"PlayableSites\") (then (add (to (last From)) count:(- \"FriendlyInSight\" ((size Stack at:(last From)))) stack:True))) (move Pass))))} (end (if (all Passed) (byScore { (score P1 \"TerritoryP1\") (score P2 \"TerritoryP2\")}))))) 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 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 Ludii game based on the following description\nOne horizontal row of eleven squares, the central square marked with an X. From this central square, extending vertically, eleven more squares, making a row of twelve in total. The fifth square and the final square in this row are marked with an X. An arc of five squares extend left and down from the final square of the vertical row. From the fifth row of the vertical row, a square with twelve squares per side. The corner squares are marked with an X, the central two squares of the left, right, and top side are marked with one X across both squares. Two or four players; when there are four players they play on two teams of two. Three cowrie shells per player, used as pieces. Six cowrie shells used as dice; the throws = the number of mouths that land face up. Players move their pieces onto the board and around the circuit according to the throws of the cowries. Teams start on opposite ends of the bottom row of squares, up the vertical line to the square, in opposite directions around the square, then up the remaining part of the vertical row and down the arc, and off the board. When a piece lands on a space occupied by an opponent's piece, the opponent's piece is sent back and must enter the board again. Pieces are safe from being sent back if they rest on a marked square. The first team to remove all of their pieces from the board wins. The game involves 4 players.\n\n###\n\n", "completion": "(define \"CaptureEnemyPiece\" (\"HittingCapture\" (handSite (who at:(to))))) (define \"RemoveAPiece\" (move Remove (from))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" (count Pips))) (game \"Kawade Kelia\" (players 4) (equipment { (board (merge { (rectangle 1 12) (shift 3.5 3.25 (scale 1 1.5 (rotate 90 (rectangle 1 4)))) (shift 0 7 (rectangle 1 12)) (shift -5.5 12.5 (rotate 90 (rectangle 1 12))) (shift 2.5 10.5 (rotate 90 (rectangle 1 6))) (shift 5.5 12.5 (rotate 90 (rectangle 1 12))) (shift 0 18 (rectangle 1 11)) (shift 1 11 (rotate 45 (rectangle 1 4))) (shift 5 13 (graph vertices:{ { 0 0} {0 1} {-0.94 0.26} {-0.23 -0.44}} edges:{ {0 1} {1 2} {2 3} {3 0}}))}) { (track \"Track1\" \"71,0,E5,N5,E,N,W,S,E5,N,WSW,SW,End\" P1 directed:True) (track \"Track2\" \"72,11,W6,N5,W,N,E,S,W6,N,WSW,SW,End\" P2 directed:True) (track \"Track3\" \"73,0,E5,N5,E,N,W,S,E5,N,WSW,SW,End\" P3 directed:True) (track \"Track4\" \"74,11,W6,N5,W,N,E,S,W6,N,WSW,SW,End\" P4 directed:True)}) (piece \"Paddle\" Each (if (\"IsEndTrack\" \"SiteToMoveOnTrack\") \"RemoveAPiece\" (if (\"IsNotOffBoard\" \"SiteToMoveOnTrack\") (if (or { (is Empty \"SiteToMoveOnTrack\") (\"IsFriendAt\" \"SiteToMoveOnTrack\") (and (\"IsEnemyAt\" \"SiteToMoveOnTrack\") (not (is In \"SiteToMoveOnTrack\" (sites \"Protect\"))))}) (move (from (from) level:(level)) (to \"SiteToMoveOnTrack\" \"CaptureEnemyPiece\")))))) (\"StickDice\" 6) (hand Each) (regions \"Protect\" (sites {5 17 19 27 41 57 46 62 63 34 35 51 52}))}) (rules (start { (place Stack \"Paddle1\" (handSite P1) count:3) (place Stack \"Paddle2\" (handSite P2) count:3) (place Stack \"Paddle3\" (handSite P3) count:3) (place Stack \"Paddle4\" (handSite P4) count:3) (set Team 1 {P1 P3}) (set Team 2 {P2 P4})}) (play (\"RollMove\" (or (forEach Piece) (forEach Piece container:(mover) top:True)))) (end { (\"EscapeTeamWin\")}))) 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": "Construct a Ludii game based on the following description\nKing piece. Four defenders with the king. King starts in the central space, with one defender on each side. The rules are describing with the Nielsen ruleset.\n\n###\n\n", "completion": "(define \"JarlButNotTheExpandedCentre\" (and (\"IsPieceAt\" \"Jarl\" P2 (between)) (not (is In (between) (expand origin:(centrePoint) Orthogonal))))) (define \"JarlAndExpandedCentre\" (and (\"IsPieceAt\" \"Jarl\" P2 (between)) (is In (between) (expand origin:(centrePoint) Orthogonal)))) (define \"EmptyCentre\" (and (is In (to) (sites Centre)) (is Empty (to)))) (define \"FriendOrCentre\" (or (\"IsFriendAt\" (to)) (is In (to) (sites Centre)))) (define \"FriendOrFortress\" (or (\"IsFriendAt\" (to)) (is In (to) (sites \"Fortresses\")))) (define \"CentreOrFortress\" (is In (to) (union (sites Centre) (sites \"Fortresses\")))) (define \"JarlWasCaptured\" (is Triggered \"Surrounded\" P2)) (define \"JarlIsCaptured\" (apply (trigger \"Surrounded\" P2))) (define \"Custodial\" (custodial (from (last To)) Orthogonal (between (max 1) if:(= (what at:(between)) (id #1)) (apply (remove (between)))) (to if:(or { (\"IsFriendAt\" (to)) (is In (to) (sites \"Fortresses\")) \"EmptyCentre\"})))) (game \"Brandub\" (players 2) (equipment { (board (square 7)) (regions \"Fortresses\" (sites Corners)) (piece \"Thrall\" P1 (move Slide Orthogonal (to (apply if:(not \"CentreOrFortress\"))) (then (or { (\"Custodial\" \"Thrall2\") (surround (from (last To)) Orthogonal (between if:\"JarlAndExpandedCentre\" \"JarlIsCaptured\") (to if:\"FriendOrCentre\")) (custodial (from (last To)) Orthogonal (between (max 1) if:\"JarlButNotTheExpandedCentre\" \"JarlIsCaptured\") (to if:\"FriendOrFortress\"))})))) (piece \"Thrall\" P2 (move Slide Orthogonal (to (apply if:(not \"CentreOrFortress\"))) (then (\"Custodial\" \"Thrall1\")))) (piece \"Jarl\" P2 (move Slide Orthogonal (to (apply if:(not (= (to) (centrePoint))))) (then (\"Custodial\" \"Thrall1\"))))}) (rules (start { (place \"Thrall1\" {\"D1\" \"D2\" \"A4\" \"B4\" \"F4\" \"G4\" \"D6\" \"D7\"}) (place \"Thrall2\" {\"D3\" \"C4\" \"E4\" \"D5\"}) (place \"Jarl2\" (centrePoint))}) (play (forEach Piece)) (end { (\"PieceTypeReachWin\" \"Jarl2\" (sites \"Fortresses\") P2) (if \"JarlWasCaptured\" (result P1 Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\n4x6, 8, or 10 holes. Eight is most common. Two counters in each hole. Sowing begins from any hole on the player's side, in either direction, but the direction chosen on the first turn must be maintained throughout the game. If the final counter lands in an empty hole, the turn ends. If the final counter lands in the outer row in an occupied hole, these are picked up and sowing continues. If the final counter lands in an occupied hole in the inner row, and the opponent's inner row hole opposite contains more than one counter, these are captured and the sowing continues from the hole from which the capture was made using the captured counters and the final counter from the sowing that caused the capture. If the opponent has no counters in any of their inner row holes, the counters in their outer row holes can be captured, in the same manner.\n \n Evidence Map Each player has 8 holes on each row.\n\n###\n\n", "completion": "(define \"Columns\" 8) (game \"Katra\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" 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\" \"24,E,S1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"TrackCCW1\")) (regions \"Home\" P2 (sites Track \"TrackCCW2\")) (regions \"Outer\" P1 (sites Bottom)) (regions \"Outer\" P2 (sites Top)) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 2 to:(union (sites P1 \"Home\") (sites P2 \"Home\")))) (play (or (if (!= (value Player Mover) 2) (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (sites Mover \"Home\")) if:(> (count at:(from)) 0)) (then (and (sow \"TrackCCW\" owner:(mover) apply:(if (< 1 (count at:(to))) (if (is In (to) (sites Mover \"Outer\")) (and (moveAgain) (set Var \"Replay\" (to))) (if (< 1 (count at:(\"OppositePit\" (to)))) (and { (fromTo (from (\"OppositePit\" (to))) (to (to)) count:(count at:(\"OppositePit\" (to)))) (moveAgain) (set Var \"Replay\" (to))}) (if (< 1 (count at:(\"OppositeOuterPit\" (to)))) (and { (fromTo (from (\"OppositeOuterPit\" (to))) (to (to)) count:(count at:(\"OppositeOuterPit\" (to)))) (moveAgain) (set Var \"Replay\" (to))})))))) (if (!= (value Player Mover) 1) (set Value Mover 1)))))) (if (!= (value Player Mover) 1) (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (sites Mover \"Home\")) if:(> (count at:(from)) 0)) (then (and (sow \"TrackCW\" owner:(mover) apply:(if (< 1 (count at:(to))) (if (is In (to) (sites Mover \"Outer\")) (and (moveAgain) (set Var \"Replay\" (to))) (if (< 1 (count at:(\"OppositePit\" (to)))) (and { (fromTo (from (\"OppositePit\" (to))) (to (to)) count:(count at:(\"OppositePit\" (to)))) (moveAgain) (set Var \"Replay\" (to))}) (if (< 1 (count at:(\"OppositeOuterPit\" (to)))) (and { (fromTo (from (\"OppositeOuterPit\" (to))) (to (to)) count:(count at:(\"OppositeOuterPit\" (to)))) (moveAgain) (set Var \"Replay\" (to))})))))) (if (!= (value Player Mover) 2) (set Value Mover 2)))))))) (end \"ForEachNonMoverNoMovesLoss\"))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayed on a hexagonal board with five spaces per side. Players take turns placing stones on an empty space. The stone must be adjacent to the last stone played but cannot be adjacent to any other. The last player to be able to make a legal move wins. \n\n###\n\n", "completion": "(define \"AdjacentNotEmptySites\" (sites Around (to) if:(not (is In (to) (sites Empty))))) (game \"Blue Nile\" (players 2) (equipment { (board (hex 5)) (piece \"Marker\" Neutral)}) (rules phases:{ (phase \"start\" P1 (play (move Add (piece (id \"Marker0\")) (to (sites Empty)))) (nextPhase \"play\")) (phase \"play\" (play (move Add (piece \"Marker0\") (to (sites Around (last To) if:(and (is Empty (to)) (\"NoSites\" (difference (\"AdjacentNotEmptySites\") (last To)))))))))} (end (\"NoMoves\" Loss)))) END" }, { "prompt": "Construct a Ludii game based on the following description\n13x13 intersecting lines. Two players. Each player has 26 pieces. Pieces begin on the two lines closest to each player, opposite sides of the board. Pieces move along the lines of the board to an adjacent spot. A piece can be captured by hopping over an opponent's adjacent piece to an empty spot immediately on the opposite side of it. Multiple captures are allowed. The player who captures all of the opponent's pieces wins. \n\n###\n\n", "completion": "(game \"Tavelspel\" (players 2) (equipment { (board (square 13) use:Vertex) (piece \"Marker\" Each)}) (rules (start { (place \"Marker1\" (expand (sites Bottom))) (place \"Marker2\" (expand (sites Top)))}) (play (if \"SameTurn\" (or (\"HopSequenceCaptureAgain\") (move Pass)) (forEach Piece \"Marker\" (or (\"HopSequenceCapture\") (\"StepToEmpty\"))))) (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nEach player begins with nine pieces. Pieces moves along the lines to the next intersection point. Players may hop an opponent's piece to capture it. Captures can be made in sequence if another capture is available after the previous one is made. The player who captures all of their opponent's pieces wins. The player loses when he has no piece.\n\n###\n\n", "completion": "(game \"Pretwa\" (players 2) (equipment { (board (concentric {1 6 6 6}) use:Vertex) (piece \"Counter\" Each (or (\"HopRotationalSequenceCapture\") (\"StepRotationalToEmpty\")))}) (rules (start { (place \"Counter1\" (sites {2..4 8..10 14..16})) (place \"Counter2\" (sites {1 6 5 7 12 11 13 18 17}))}) (play (if \"SameTurn\" (or (\"HopRotationalSequenceCaptureAgain\") (move Pass)) (forEach Piece))) (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThis game is played on a square grid board of any size, though 13x13 or 19x19 are recommended. Then the players take it in turns to place 1-3 White stones each turn until one decides to pass; that player then becomes White, and the other becomes Black. After that, Black places two stones per turn on any empty point, while White places just one White stone per turn. If Black connects any two sides of the board with a single orthogonally-connected group, they win; White wins if they connect all four sides with a group connected either orthogonally or diagonally.\n \n During the initial chicken ballot phase, you may add stones by clicking on available spaces, or skip the rest of your placements (by choosing the Next Player action). Alternatively, you may Pass at the start of your turn to take White. After that, play continues with White playing one stone and Black playing two, until one player forms a connection (draws are impossible). Played on a size 13 board.\n\n###\n\n", "completion": "(define \"Skip\" (move Set NextPlayer (player (next)))) (define \"IsPlayingPhase\" (= 1 (var))) (define \"BlackVC\" (or (is Connected Orthogonal {(sites Side N) (sites Side S)}) (is Connected Orthogonal {(sites Side E) (sites Side W)}))) (define \"WhiteVC\" (is Connected All {(sites Side N) (sites Side S) (sites Side E) (sites Side W)})) (game \"Pippinzip (Zipline variant)\" (players 2) (equipment { (board (square 13) use:Vertex) (piece \"Disc\" Each)}) (rules phases:{ (phase \"Opening\" (play (or (or (move Add (piece (id \"Disc\" P2)) (to (sites Empty)) (then (if (< (count MovesThisTurn) 2) (moveAgain)))) \"Skip\") (if (= (count MovesThisTurn) 0) (move Pass (then (if (is Mover P1) (swap Players P1 P2 (then (note \"Player 1 is now White. Player 2 is now Black.\" to:All))) (note \"Player 1 is now Black. Player 2 is now White.\" to:All) (then (do (set NextPlayer (player 1)) next:(set Var 1))))))))) (nextPhase (\"IsPlayingPhase\") \"Playing\")) (phase \"Playing\" (play (or (move Add (to (sites Empty) if:(= (id P1) (mover))) (then (if (= 0 (count MovesThisTurn)) (moveAgain)))) (move Add (to (sites Empty) if:(= (id P2) (mover)))))))} (end { (if (and (not (\"IsPlayingPhase\")) (\"WhiteVC\")) (result Mover Win)) (if (and {(= (id P1) (mover)) (\"BlackVC\")}) (result P1 Win)) (if (and {(= (id P2) (mover)) (\"WhiteVC\")}) (result P2 Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6 board. Three counters per hole. Sowing occurs in an anti-clockwise direction when starting from the right three holes of a player's row, or in a clockwise direction when starting from the player's left three holes. When the final counter falls into an occupied hole, these are picked up and sowing continues, except when this hole is made to contain four counters, in which case these counters are captured and the player takes another turn. These captures may not be made on the first turn. When the final counter lands in an empty hole, the turn ends. Play continues until one player is without counters in their row. The opponent then captures the remaining counters in their row, and the player that has captured the most counters wins. \n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (count Cell at:(handSite #1))) (define \"OneRowEmpty\" (or (all Sites (sites P1 \"Home\") if:(= 0 (count at:(site)))) (all Sites (sites P2 \"Home\") if:(= 0 (count at:(site)))))) (game \"Wa'ache Waledat\" (players 2) (equipment { (mancalaBoard 2 6 store:None { (track \"TrackCCW\" \"0,E,N,W\" loop:True) (track \"TrackCW\" \"5,W,N,E\" loop:True)}) (piece \"Seed\" Shared) (regions \"Home\" P1 (sites Bottom)) (regions \"Home\" P2 (sites Top)) (regions \"RightHome\" P1 (intersection (expand (sites Right) steps:2) (sites Bottom))) (regions \"RightHome\" P2 (intersection (expand (sites Right) steps:2) (sites Top))) (regions \"LeftHome\" P1 (intersection (expand (sites Left) steps:2) (sites Bottom))) (regions \"LeftHome\" P2 (intersection (expand (sites Left) steps:2) (sites Top))) (hand Each)}) (rules (start (set Count 3 to:(sites Track))) (play (or (if (or (>= 0 (var \"Direction\")) (= 1 (var \"Direction\"))) (move Select (from (if (and (\"SameTurn\") (= 1 (var \"ContinueSowing\"))) \"LastHoleSowed\" (sites Mover \"RightHome\")) if:(> (count at:(from)) 0)) (then (sow \"TrackCCW\" apply:(if (< 1 (count at:(to))) (and { (moveAgain) (set Var \"Direction\" 1) (set Var \"ContinueSowing\" 1) (if (and (= 4 (count at:(to))) (< 2 (count Turns))) (and (fromTo (from (to)) (to (handSite Mover)) count:4) (set Var \"ContinueSowing\" 0)))}) (set Var \"Direction\" 0)))))) (if (or (>= 0 (var \"Direction\")) (= 2 (var \"Direction\"))) (move Select (from (if (and (\"SameTurn\") (= 1 (var \"ContinueSowing\"))) \"LastHoleSowed\" (sites Mover \"LeftHome\")) if:(> (count at:(from)) 0)) (then (sow \"TrackCW\" apply:(if (< 1 (count at:(to))) (and { (moveAgain) (set Var \"Direction\" 2) (set Var \"ContinueSowing\" 1) (if (and (= 4 (count at:(to))) (< 2 (count Turns))) (and (fromTo (from (to)) (to (handSite Mover)) count:4) (set Var \"ContinueSowing\" 0)))}) (set Var \"Direction\" 0)))))) (then (if (\"OneRowEmpty\") (and (forEach Site (sites P1 \"Home\") (fromTo (from (site)) (to (handSite P1)) count:(count at:(site)))) (forEach Site (sites P2 \"Home\") (fromTo (from (site)) (to (handSite P2)) count:(count at:(site))))))))) (end (\"MancalaByScoreWhen\" (\"NoPieceOnBoard\"))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n8x8 board. 16 pieces per player, lined up in the second and third rows (first row on each side is empty). Pieces move forward or horizontally one space, and capture opponents' pieces by jumping in these directions. When they reach the opposite side, they become a king and can jump opponents' pieces from any distance orthogonally. Captures must be taken if possible, and the maximum number of jumps must be made. In a situation where two pieces are able to make the maximum number of captures and one of them is a king, the king must make the captures. Multiple captures cannot be made by moving 180 degrees from the previous jump. Pieces can be promoted to king mid-jump. Winning is achieved by capturing all of the other player's pieces or by blocking them so they cannot move. \n\n###\n\n", "completion": "(define \"IsUnpromoted\" (\"IsPieceAt\" \"Counter\" Mover (last To))) (define \"HopMan\" (\"HopCapture\" (from #1) (directions {Forward Rightward Leftward}) #2)) (define \"PromotedHopOrthogonalSequenceCapture\" (\"HopCaptureDistance\" #1 #2 ~ (then (\"ReplayIfCanMove\" (\"HopCaptureDistanceNotAlreadyHopped\" (from (last To)) (difference Orthogonal OppositeDirection)))))) (game \"Dama (Kenya)\" (players 2) (\"DraughtsEquipment\" (square 8)) (rules (start { (place \"Counter1\" (union (sites Row 1) (sites Row 2))) (place \"Counter2\" (union (sites Row 5) (sites Row 6)))}) (play (if \"SameTurn\" (if \"IsUnpromoted\" (max Moves (\"HopMan\" (last To) (then (\"ReplayIfCanMove\" (\"HopMan\" (last To)) (\"PromoteIfReach\" (sites Next) \"DoubleCounter\"))))) (max Moves (\"PromotedHopOrthogonalSequenceCapture\" (from (last To)) (difference Orthogonal OppositeDirection)))) (priority { (max Moves (priority { (forEach Piece \"DoubleCounter\" (\"PromotedHopOrthogonalSequenceCapture\" (from) Orthogonal)) (forEach Piece \"Counter\" (\"HopMan\" (from) (then (\"ReplayIfCanMove\" (\"HopMan\" (last To)) (\"PromoteIfReach\" (sites Next) \"DoubleCounter\")))))})) (or (forEach Piece \"Counter\" (\"StepToEmpty\" (directions {Forward Rightward Leftward})) (then (\"PromoteIfReach\" (sites Next) \"DoubleCounter\"))) (forEach Piece \"DoubleCounter\" (move Slide Orthogonal)))}))) (end (\"BlockWin\")))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nEach player has 8 holes. -> Each player has 9 holes.\n(define \"NoPiece\" (all Sites (sites Player \"Home\") if:(= 0 (count at:(site))))) (define \"Columns\" 8) (game \"Namudilakunze\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" 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) (regions \"Home\" P1 (sites Track \"TrackCCW1\")) (regions \"Home\" P2 (sites Track \"TrackCCW2\")) (regions \"Inner\" P1 (difference (sites Track \"TrackCCW1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"TrackCCW2\") (sites Top))) (hand Each)}) (rules (start (set Count 1 to:(difference (sites Board) (sites { 0 (- (* (\"Columns\") 4) 1)})))) phases:{ (phase \"FirstTurn\" (play (move Select (from (if (\"SameTurn\") (\"LastHoleSowed\") (sites Mover \"Home\")) if:(is Occupied (from))) (then (sow \"TrackCW\" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover \"Inner\")) (if (is Occupied (\"OppositePit\" (to))) (remove (\"OppositePit\" (to))) (if (is Occupied (\"OppositeOuterPit\" (to))) (remove (\"OppositeOuterPit\" (to))))))))))) (nextPhase Mover (not (is Next Mover)) \"Main\")) (phase \"Main\" (play (or (if (or (>= 0 (value Player Mover)) (= (value Player Mover) 1)) (move Select (from (if (\"SameTurn\") (\"LastHoleSowed\") (sites Mover \"Home\")) if:(is Occupied (from))) (then (sow \"TrackCCW\" owner:(mover) apply:(and (if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover \"Inner\")) (if (is Empty (\"OppositePit\" (to))) (if (is Occupied (\"OppositeOuterPit\" (to))) (remove (\"OppositeOuterPit\" (to))))))) (if (!= 1 (value Player Mover)) (set Value Mover 1))))))) (if (or (>= 0 (value Player Mover)) (= (value Player Mover) 2)) (move Select (from (if (\"SameTurn\") (\"LastHoleSowed\") (sites Mover \"Home\")) if:(is Occupied (from))) (then (sow \"TrackCW\" owner:(mover) apply:(and (if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover \"Inner\")) (if (is Empty (\"OppositePit\" (to))) (if (is Occupied (\"OppositeOuterPit\" (to))) (remove (\"OppositeOuterPit\" (to))))))) (if (!= 2 (value Player Mover)) (set Value Mover 2))))))))))} (end (forEach NonMover if:(\"NoPiece\") (result Player Loss)))))\n\n###\n\n", "completion": "(define \"NoPiece\" (all Sites (sites Player \"Home\") if:(= 0 (count at:(site))))) (define \"Columns\" 9) (game \"Namudilakunze\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"TrackCCW1\" \"0,E,N1,W\" loop:True P1) (track \"TrackCCW2\" \"18,E,N1,W\" loop:True P2) (track \"TrackCW1\" \"8,W,N1,E\" loop:True P1) (track \"TrackCW2\" \"26,W,N1,E\" loop:True P2)}) (piece \"Seed\" Shared) (regions \"Home\" P1 (sites Track \"TrackCCW1\")) (regions \"Home\" P2 (sites Track \"TrackCCW2\")) (regions \"Inner\" P1 (difference (sites Track \"TrackCCW1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"TrackCCW2\") (sites Top))) (hand Each)}) (rules (start (set Count 1 to:(difference (sites Board) (sites { 0 (- (* (\"Columns\") 4) 1)})))) phases:{ (phase \"FirstTurn\" (play (move Select (from (if (\"SameTurn\") (\"LastHoleSowed\") (sites Mover \"Home\")) if:(is Occupied (from))) (then (sow \"TrackCW\" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover \"Inner\")) (if (is Occupied (\"OppositePit\" (to))) (remove (\"OppositePit\" (to))) (if (is Occupied (\"OppositeOuterPit\" (to))) (remove (\"OppositeOuterPit\" (to))))))))))) (nextPhase Mover (not (is Next Mover)) \"Main\")) (phase \"Main\" (play (or (if (or (>= 0 (value Player Mover)) (= (value Player Mover) 1)) (move Select (from (if (\"SameTurn\") (\"LastHoleSowed\") (sites Mover \"Home\")) if:(is Occupied (from))) (then (sow \"TrackCCW\" owner:(mover) apply:(and (if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover \"Inner\")) (if (is Empty (\"OppositePit\" (to))) (if (is Occupied (\"OppositeOuterPit\" (to))) (remove (\"OppositeOuterPit\" (to))))))) (if (!= 1 (value Player Mover)) (set Value Mover 1))))))) (if (or (>= 0 (value Player Mover)) (= (value Player Mover) 2)) (move Select (from (if (\"SameTurn\") (\"LastHoleSowed\") (sites Mover \"Home\")) if:(is Occupied (from))) (then (sow \"TrackCW\" owner:(mover) apply:(and (if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover \"Inner\")) (if (is Empty (\"OppositePit\" (to))) (if (is Occupied (\"OppositeOuterPit\" (to))) (remove (\"OppositeOuterPit\" (to))))))) (if (!= 2 (value Player Mover)) (set Value Mover 2))))))))))} (end (forEach NonMover if:(\"NoPiece\") (result Player Loss))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x7 board. Five counters in each hole. Players sow in a clockwise direction. When the final counter lands in a hole, the contents of the next hole are picked up and sowing continues. When the final counter is sown and the next hole is empty, the contents of the hole in the opposite row of the empty hole are captured. Play continues until all of the counters are captured. \n \n A new game begins. The players fill their holes with five counters in each, starting from their left. The player who has remaining counters after all of their holes are full puts the extra counters aside. The player who has fewer counters places the remainder in the next empty hole. Any empty holes are out of play for the round. Play begins with the same rules, with the following modifications: Each player, during their opponent's turn, also captures counters in any hole that are made to equal the number of extra counters they had at the beginning of this round (i.e., the number of counters set aside by the winning player or the number of counters less than five that placed in the final hole by the loser). The player who could fill their holes will capture one counter each time that player sows into the hole in which the opponent placed fewer than five counters at the beginning of the round. The opponent cannot sow in this hole. In addition, at the end of the round, the player who filled their holes at the beginning of the round will always capture pieces that accumulate in this hole. Subsequent rounds are played like this until one player captures all of the counters, and thus wins. \n\n###\n\n", "completion": "(define \"LeftMostEmpty\" (trackSite FirstSite \"TrackCCW\" from:(mapEntry \"LeftMost\" Mover) if:(is Empty (to)))) (define \"NoPieceOnBoard\" (all Sites (forEach (sites Board) if:(= 0 (state at:(site)))) if:(= 0 (count at:(site))))) (define \"PlayableSites\" (sites (values Remembered \"Playable\"))) (define \"NextHole\" (\"NextSiteOnTrack\" #2 from:#1 \"Track\")) (define \"Columns\" 7) (game \"Mawkar Katiya\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" store:None { (track \"TrackCW\" \"6,W,N,E\" loop:True) (track \"TrackCCW\" \"0,E,N,W\" loop:True)}) (piece \"Seed\" Shared) (hand Each) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map \"LeftMost\" {(pair P1 0) (pair P2 13)})}) (rules (start { (set Count 5 to:(sites Track \"TrackCW\")) (set RememberValue \"Playable\" (union (sites Top) (sites Bottom)))}) phases:{ (phase \"Sowing\" (play (or { (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (sites Mover)) if:(and { (is Occupied (from)) (is In (from) (\"PlayableSites\")) (!= (next) (state at:(from)))})) (then (do (and (set Var \"NumSowed\" (count at:(last To))) (set Var \"StateSowFrom\" (state at:(last To)))) next:(sow \"TrackCW\" apply:(if (is Occupied (\"NextHole\" (to) 1)) (and (moveAgain) (set Var \"Replay\" (\"NextHole\" (to) 1))) (if (is Occupied (\"OppositePitTwoRows\" (\"NextHole\" (to) 1))) (and (fromTo (from (\"OppositePitTwoRows\" (\"NextHole\" (to) 1))) (to (handSite Mover)) count:(count at: (\"OppositePitTwoRows\" (\"NextHole\" (to) 1)))) (set State at:(\"OppositePitTwoRows\" (\"NextHole\" (to) 1)) (state at:(\"OppositePitTwoRows\" (\"NextHole\" (to) 1))))))) skipIf:(or (and (!= (state at:(to)) (mover)) (!= (state at:(to)) 0)) (not (is In (to) (\"PlayableSites\"))))) (then (and { (forEach Site (sites Track from:(last From) to:(trackSite Move from:(last From) \"Track\" steps:(var \"NumSowed\"))) (if (and (= (value Player Mover) (count at:(site))) (or (= (state at:(site)) (mover)) (= (state at:(site)) 0))) (and (fromTo (from (site)) (to (handSite Mover)) count:(value Player Mover)) (set State at:(site) (state at:(site)))) (if (and (is Occupied (site)) (= (mover) (state at:(site)))) (and (fromTo (from (site)) (to (handSite Mover)) count:1) (set State at:(site) (state at:(site))))))) (set Var \"NumSowed\" 0) (if (< 0 (var \"StateSowFrom\")) (set State at:(last From) (var \"StateSowFrom\")))})))))} (then (if (\"NoPieceOnBoard\") (and { (forEach Site (sites Board) (and (if (= (state at:(site)) 1) (fromTo (from (site)) (to (handSite P1)) count:(count at:(site)))) (if (= (state at:(site)) 2) (fromTo (from (site)) (to (handSite P2)) count:(count at:(site)))))) (forget Value \"Playable\" All) (if (>= (count Cell at:(handSite P1)) (count Cell at:(handSite P2))) (set Var \"CurrentWinner\" 1) (set Var \"CurrentWinner\" 2)) (set Value P2 0) (set Value P1 0) (forEach Site (sites Board) (if (!= 0 (state at:(site))) (set State at:(site) 0)))}))))) (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 \"LeftMostEmpty\") count:5 (then (remember Value \"Playable\" (last To)))) (if (and (!= 0 (count Cell at:(handSite Mover))) (!= (mover) (var \"CurrentWinner\"))) (move (from (handSite Mover)) (to \"LeftMostEmpty\") count:(count Cell at:(handSite Mover)) (then (and { (remember Value \"Playable\" (last To)) (set Value Mover (count at:(last To))) (set State at:(last To) (next))}))))) (if (= (mover) (var \"CurrentWinner\")) (move Pass (then (set Value Mover (count Cell at:(handSite Mover)))))))) (nextPhase (all Passed) \"Sowing\"))})) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe quadrant selected is the bottom left one. -> The quadrant selected is the bottom right one.\n(define \"RemoveAPiece\" (move Remove (from))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" (pips))) (game \"Los Doze Canes\" (players 2) (equipment { (\"TableBoard\" \"TableTracksOppositeWithHands\") (dice d:6 num:2) (piece \"Disc\" Each (forEach Die if:(\"DieNotUsed\") (if (\"NoEnemyOrOnlyOne\" (\"SiteToMoveOnTrack\")) (move (from) (to \"SiteToMoveOnTrack\" (\"HittingCapture\" (handSite Next))))))) (hand Each)}) (rules (start { (place Stack \"Disc1\" (handSite P1) count:12) (place Stack \"Disc2\" (handSite P2) count:12)}) (play (\"RollEachNewTurnMove\" (or (forEach Piece top:True) (forEach Piece container:(mover) top:True) (then (\"ReplayNotAllDiceUsed\"))))) (end { (if (and { (= 2 (size Stack at:0)) (= 2 (size Stack at:1)) (= 2 (size Stack at:2)) (= 2 (size Stack at:3)) (= 2 (size Stack at:4)) (= 2 (size Stack at:5)) (= 0 (count Sites in:(difference (sites Occupied by:Mover) (sites {0..5}))))}) (result Mover Win)) (if (and (< 2 (size Stack at:12)) (< 2 (size Stack at:0))) (result Mover Draw))})))\n\n###\n\n", "completion": "(define \"RemoveAPiece\" (move Remove (from))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" (pips))) (game \"Los Doze Canes\" (players 2) (equipment { (\"TableBoard\" \"TableTracksOppositeWithHands\") (dice d:6 num:2) (piece \"Disc\" Each (forEach Die if:(\"DieNotUsed\") (if (\"NoEnemyOrOnlyOne\" (\"SiteToMoveOnTrack\")) (move (from) (to \"SiteToMoveOnTrack\" (\"HittingCapture\" (handSite Next))))))) (hand Each)}) (rules (start { (place Stack \"Disc1\" (handSite P1) count:12) (place Stack \"Disc2\" (handSite P2) count:12)}) (play (\"RollEachNewTurnMove\" (or (forEach Piece top:True) (forEach Piece container:(mover) top:True) (then (\"ReplayNotAllDiceUsed\"))))) (end { (if (and { (= 2 (size Stack at:6)) (= 2 (size Stack at:7)) (= 2 (size Stack at:8)) (= 2 (size Stack at:9)) (= 2 (size Stack at:10)) (= 2 (size Stack at:11)) (= 0 (count Sites in:(difference (sites Occupied by:Mover) (sites {6..11}))))}) (result Mover Win)) (if (and (< 2 (size Stack at:12)) (< 2 (size Stack at:0))) (result Mover Draw))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nForty stones, placed in a circle with a larger space after every tenth stone. The spaces between the stones are the playing spaces. Two to four players, each with one counter. Three sticks, round on one side and flat on the other, used as dice. The throws are as follows: three round sides = 10; three flat sides up = 5; one round and two flat = 3; two round and one flat = 1 or 2. Players move from one of the wider spaces around the board in opposite directions. When a player lands on the same spot as the opponent's piece, the opponent's piece is sent back to the beginning. The first player to complete a circuit of the board wins.\n The game has 2 players.\n\n###\n\n", "completion": "(define \"MadeACompleteCircuit\" (if (= 1 (state at:(where \"Stick\" Mover))) (is In (value Piece at:(where \"Stick\" Mover)) (sites Track \"TrackCCW\" from:(\"NextSite\" (last From) \"TrackCCW\") to:(last To))) (is In (value Piece at:(where \"Stick\" Mover)) (sites Track \"TrackCW\" from:(\"NextSite\" (last From) \"TrackCW\") to:(last To))))) (define \"MoveOn\" (if (\"IsNotOffBoard\" #1) (if (or (is Empty #1) (\"IsEnemyAt\" #1)) (move (from (from) level:(level)) (to #1 (\"HittingCapture\" (value Piece at:((to))))))))) (define \"NextSite\" (\"NextSiteOnTrack\" 1 from:#1 #2)) (define \"SiteToMoveOnSelectedTrack\" (if (= (state at:(from)) 1) (\"NextSiteOnTrack\" #1 \"TrackCCW\") (\"NextSiteOnTrack\" #1 \"TrackCW\"))) (define \"ThrowValue\" (mapEntry \"ThrowDiceValue\" (count Pips))) (game \"Tsaydithl\" (players 2) (equipment { (\"FortyStonesWithFourGapsBoard\" { (track \"TrackCW\" {39 35 33 31 29 27 25 23 21 19 38 17 15 13 11 9 7 5 3 1 37 0 2 4 6 8 10 12 14 16 36 18 20 22 24 26 28 30 32 34} loop:True) (track \"TrackCCW\" {39 34 32 30 28 26 24 22 20 18 36 16 14 12 10 8 6 4 2 0 37 1 3 5 7 9 11 13 15 17 38 19 21 23 25 27 29 31 33 35} loop:True)}) (piece \"Stick\" Each (or (if (= 2 (\"ThrowValue\")) (\"MoveOn\" (\"SiteToMoveOnSelectedTrack\" (- (\"ThrowValue\") 1)))) (\"MoveOn\" (\"SiteToMoveOnSelectedTrack\" (\"ThrowValue\"))))) (regions \"Gates\" (sites {36..39})) (map \"ThrowDiceValue\" {(pair 0 5) (pair 1 3) (pair 2 2) (pair 3 10)}) (\"StickDice\" 3) (hand Each)}) (rules (start { (place \"Stick1\" 36 state:1 value:36) (place \"Stick2\" 38 state:2 value:38)}) (play (\"RollMove\" (forEach Piece))) (end (if (\"MadeACompleteCircuit\") (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n6x7 lines forming a grid. Diagonals in each small square, with a point where the diagonals cross. 28 pieces, which begin on opposite sides of the board. In addition, each player has a Prince piece, which begins on the rightmost point immediately in front of the other pieces, and a King piece, which begins on the rightmost point in the line in front of the Prince. All pieces move one space to an empty adjacent spot along the lines. A piece may capture an adjacent opponent's piece by hopping over it to an empty adjacent spot on the opposite side of it. Multiple captures are allowed. Captures are not compulsory and neither are the maximum number of captures. Pieces may only capture other pieces of the same rank or lower. A player wins when they capture all of the opponent's pieces, or by blocking a higher ranking piece from being able to move if it is the only remaining piece belonging to the opponent. If players are left with only one piece each of the same rank, one player may declare single combat, and both pieces must move toward one another until one captures the other. If only the Kings are left on the board the game is a draw. \n\n###\n\n", "completion": "(define \"StepToEmptyToward\" (move Step (to if:(and (is Empty (to)) (< (count Steps (to) (regionSite (sites Occupied by:Next) index:0)) (count Steps (from) (regionSite (sites Occupied by:Next) index:0))))))) (define \"OneSinglePieceSameRank\" (and { (\"OneSinglePiece\" P1) (\"OneSinglePiece\" P2) (= (\"HigherValue\" P1) (\"HigherValue\" P2))})) (define \"SingleEnemyHigherPieceBlocked\" (and { (< (\"HigherValue\" Mover) (\"HigherValue\" Next)) (\"OneSinglePiece\" Next) (no Moves Next)})) (define \"OneSinglePiece\" (= 1 (count Pieces #1))) (define \"HigherValue\" (max (results from:(sites Occupied by:#1) to:(sites Occupied by:#1) (value Piece at:(to))))) (define \"OnlyKings\" (and { (= 1 (count Pieces P1)) (\"IsNotOffBoard\" (where \"King\" P1)) (= 1 (count Pieces P2)) (\"IsNotOffBoard\" (where \"King\" P2))})) (define \"HopSequenceCapture\" (move Hop #1 (between if:(and (\"IsEnemyAt\" (between)) (>= (value Piece at:(from)) (value Piece at:(between)))) (apply (remove (between)))) (to if:(is Empty (to))) (then (\"ReplayIfCanMove\" (hop (from (last To)) (between if:(and (\"IsEnemyAt\" (between)) (>= (value Piece at:(from)) (value Piece at:(between)))) (apply (remove (between)))) (to if:(is Empty (to)))))))) (game \"Dablot Prejjesne\" (players {(player S) (player N)}) (equipment { (board (rectangle 7 6 diagonals:Solid) use:Vertex) (piece \"Cone\" Each (or (\"StepToEmpty\") (\"HopSequenceCapture\"))) (piece \"Prince\" Each (or (\"StepToEmpty\") (\"HopSequenceCapture\"))) (piece \"King\" Each (or (\"StepToEmpty\") (\"HopSequenceCapture\"))) (regions P1 (sites Top)) (regions P2 (sites Bottom))}) (rules (start { (place \"Cone1\" (expand (sites Bottom) steps:2)) (place \"Cone2\" (expand (sites Top) steps:2)) (place \"Prince1\" coord:\"H4\" value:1) (place \"Prince2\" coord:\"E9\" value:1) (place \"King1\" coord:\"I4\" value:2) (place \"King2\" coord:\"D9\" value:2)}) (play (if (\"SameTurn\") (or (\"HopSequenceCapture\" (from (last To))) (move Pass)) (if (\"OneSinglePieceSameRank\") (forEach Piece (priority (\"HopCapture\") (\"StepToEmptyToward\"))) (forEach Piece)))) (end { (\"CaptureAll\" Next) (if (\"SingleEnemyHigherPieceBlocked\") (result Mover Win)) (if (\"OnlyKings\" Next) (result Mover Draw))}))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game is played on a 2x2 board -> The game is played on a 3x3 board\n(define \"NoEdgeBetweenCells\" (not (\"NoSites\" (sites Around (to) Own Orthogonal if:(\"NoSites\" (difference \"EdgeInCommon\" (sites Empty Edge))))))) (define \"EdgeInCommon\" (intersection (sites Incident Edge of:Cell at:(from)) (sites Incident Edge of:Cell at:(to)))) (define \"NumContainmentByTurn\" 4) (define \"NumContagionByTurn\" 3) (game \"Contagion\" (players 2) (equipment { (board (rectangle 2 2))}) (rules (start (set Score P2 (* (count Rows) (count Columns)))) phases:{ (phase \"InitContagion\" P1 (play (move Add (to Cell (sites Empty Cell)) (then (and (if (< (count MovesThisTurn) (- \"NumContagionByTurn\" 1)) (moveAgain)) (addScore {P1 P2} {1 -1}))))) (nextPhase (not (is Next Mover)) \"ContagionGrowth\")) (phase \"ContagionGrowth\" P1 (play (move Add (to Cell (sites Empty Cell) if:(\"NoEdgeBetweenCells\")) (then (and (if (< (count MovesThisTurn) (- \"NumContagionByTurn\" 1)) (moveAgain)) (addScore {P1 P2} {1 -1})))))) (phase \"Containment\" P2 (play (move Add (to Edge (sites Empty Edge)) (then (if (< (count MovesThisTurn) (- \"NumContainmentByTurn\" 1)) (moveAgain))))))} (end { (if (> (score P1) (/ (* (count Rows) (count Columns)) 2)) (result P1 Win)) (if (no Moves P1) (result P2 Win))})))\n\n###\n\n", "completion": "(define \"NoEdgeBetweenCells\" (not (\"NoSites\" (sites Around (to) Own Orthogonal if:(\"NoSites\" (difference \"EdgeInCommon\" (sites Empty Edge))))))) (define \"EdgeInCommon\" (intersection (sites Incident Edge of:Cell at:(from)) (sites Incident Edge of:Cell at:(to)))) (define \"NumContainmentByTurn\" 4) (define \"NumContagionByTurn\" 3) (game \"Contagion\" (players 2) (equipment { (board (rectangle 3 3))}) (rules (start (set Score P2 (* (count Rows) (count Columns)))) phases:{ (phase \"InitContagion\" P1 (play (move Add (to Cell (sites Empty Cell)) (then (and (if (< (count MovesThisTurn) (- \"NumContagionByTurn\" 1)) (moveAgain)) (addScore {P1 P2} {1 -1}))))) (nextPhase (not (is Next Mover)) \"ContagionGrowth\")) (phase \"ContagionGrowth\" P1 (play (move Add (to Cell (sites Empty Cell) if:(\"NoEdgeBetweenCells\")) (then (and (if (< (count MovesThisTurn) (- \"NumContagionByTurn\" 1)) (moveAgain)) (addScore {P1 P2} {1 -1})))))) (phase \"Containment\" P2 (play (move Add (to Edge (sites Empty Edge)) (then (if (< (count MovesThisTurn) (- \"NumContainmentByTurn\" 1)) (moveAgain))))))} (end { (if (> (score P1) (/ (* (count Rows) (count Columns)) 2)) (result P1 Win)) (if (no Moves P1) (result P2 Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThere are three red ships and three black ships. The remainder\n of the cells contain white icebergs. The two players, Red and Black, take turns\n moving one of their own ships, one move per turn, starting with Red. Players are\n not allowed to pass.\n \n MOVES:\n You must move one of your ships to an adjacent cell which doesn't contain\n another ship. By moving to a cell containing an iceberg, you capture the iceberg,\n and your score increases by 1.\n \n MOVE DIRECTION:\n You must select one of your ships to move, and move it closer to its closest\n iceberg. Distance is measured by the number of cells between ship and iceberg\n along the shortest path of cells that connects them, going around other ships. If\n the ship you've chosen to move has icebergs adjacent to it, you must capture one\n of them.\n \n OBJECT OF THE GAME:\n The goal is to capture the majority of the icebergs. On the default size 5 board, there are 55 icebergs starting out. If you capture 28 of them, you\n win. A size 5 board is currently selected\n\n###\n\n", "completion": "(define \"OntoEmptyOrIceberg\" (step (to if:(or (= (id Neutral) (who at:(to))) (is Empty (to)))))) (define \"NearestIcebergs\" (intersection (sites Occupied by:Neutral) (sites Distance (\"OntoEmptyOrIceberg\") from:(from) (exact (\"DistanceToNearestIceberg\"))))) (define \"DistanceToNearestIceberg\" (count Steps (\"OntoEmptyOrIceberg\") (from) (sites Occupied by:Neutral))) (game \"Icebreaker\" (players 2) (equipment { (board (hex 5)) (piece \"Disc\" Each (move Step (to if:(and (or (= (id Neutral) (who at:(to))) (is Empty (to))) (= 1 (- (count Steps (\"OntoEmptyOrIceberg\") (from) (\"NearestIcebergs\")) (count Steps (\"OntoEmptyOrIceberg\") (to) (\"NearestIcebergs\"))))) (apply (if (is Occupied (to)) (and (remove (to)) (addScore Mover 1))))))) (piece \"Disc\" Neutral)}) (rules (start { (place \"Disc0\" (difference (sites Board) (sites Corners))) (place \"Disc1\" (sites Around (centrePoint) distance:(- 5 1) NNW)) (place \"Disc1\" (sites Around (centrePoint) distance:(- 5 1) E)) (place \"Disc1\" (sites Around (centrePoint) distance:(- 5 1) SSW)) (place \"Disc2\" (sites Around (centrePoint) distance:(- 5 1) NNE)) (place \"Disc2\" (sites Around (centrePoint) distance:(- 5 1) W)) (place \"Disc2\" (sites Around (centrePoint) distance:(- 5 1) SSE))}) (play (forEach Piece Mover)) (end (if (or (< (/ (- (count Sites in:(sites Board)) 6) 2) (score P1)) (< (/ (- (count Sites in:(sites Board)) 6) 2) (score P2))) (byScore))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe graph is initially empty. Players alternate turns colouring an uncoloured edge between two of the vertices. Both players share a common colour for this gameplay. Radran is a score-based game. At each turn, a player gets a score, which is equal to the cost of his last coloured edge. The game ends when the coloured graph is regular. The player with the highest score wins. The version of the game played with 2 players.\n\n###\n\n", "completion": "(game \"Radran\" (players 2) (equipment { (board (graph vertices:{{0 0} {5 0} {10 0} {0 5} {5 5} {10 5} {0 10} {5 10} {10 10}} edges:{{0 1} {0 2} {0 3} {0 4} {0 5} {0 6} {0 7} {1 2} {1 3} {1 4} {1 5} {1 6} {1 8} {2 3} {2 4} {2 5} {2 7} {2 8} {3 4} {3 6} {3 7} {3 8} {4 5} {4 6} {4 7} {4 8} {5 6} {5 8} {5 7} {6 7} {6 8} {7 8}}) use:Edge) (piece \"Marker\" Neutral)}) (rules (start { (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 Cost 3 Edge at:12) (set Cost 1 Edge at:13) (set Cost 2 Edge at:14) (set Cost 3 Edge at:15) (set Cost 1 Edge at:16) (set Cost 2 Edge at:17) (set Cost 3 Edge at:18) (set Cost 3 Edge at:19) (set Cost 1 Edge at:20) (set Cost 2 Edge at:21) (set Cost 3 Edge at:22) (set Cost 1 Edge at:23) (set Cost 2 Edge at:24) (set Cost 3 Edge at:25) (set Cost 1 Edge at:26) (set Cost 2 Edge at:27) (set Cost 3 Edge at:28) (set Cost 3 Edge at:29) (set Cost 1 Edge at:30) (set Cost 2 Edge at:31)}) (play (move Add (piece \"Marker0\") (to Edge (sites Empty Edge)) (then (addScore Mover (cost Edge at:(last To)))))) (end (if (is RegularGraph Neutral) (byScore))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"NumEnemyOppositeCorners\" (count Sites in:(forEach (sites Around (site)) if:(and (is In (site) (sites Around (last To))) (\"IsEnemyAt\" (site)))))) (define \"NumEnemyCorners\" (count Sites in:(forEach (sites Around (site)) if:(\"IsEnemyAt\" (site))))) (define \"AllCornersSquareOccupied\" (all Sites (sites Around (site)) if:(is Occupied (site)))) (define \"AllCornersSquareEmpty\" (all Sites (sites Around (site)) if:(is Empty (site)))) (define \"MidpointSquares\" (forEach (sites Board) if:(and (= 4 (count Sites in:(sites Around (site)))) (not (is In (site) (sites Outer)))))) (game \"Onyx\" (players 2) (equipment { (board (keep (rotate -45 (subdivide (tiling T33434 7 7) min:4)) (poly {{-6.5 1.75} {-6.5 12.75} {4.5 12.75} {4.5 1.75}})) use:Vertex) (piece \"Disc\" Each) (regions P1 {(sites Side W) (sites Side E)}) (regions P2 {(sites Side N) (sites Side S)})}) (rules (start { (place \"Disc1\" (sites {15 24 119 128})) (place \"Disc2\" (sites {20 27 116 123}))}) (play (move Add (to (forEach (sites Empty) if:(if (is In (site) (\"MidpointSquares\")) (\"AllCornersSquareEmpty\") True))) (then (forEach Site (\"MidpointSquares\") (if (and { (is Empty (site)) (is In (last To) (sites Around (site))) (\"AllCornersSquareOccupied\") (= 2 (\"NumEnemyCorners\")) (= 2 (\"NumEnemyOppositeCorners\"))}) (remove (forEach (sites Around (site)) if:(\"IsEnemyAt\" (site))))))))) (end (if (is Connected Mover) (result Mover Win)))))\n\n###\n\n", "completion": "The initial setup has four black pieces and four white pieces pre-placed. Black moves first by placing a black piece on any empty point of the board. White follows suit. Turns continue to alternate. A piece can be placed on the midpoint of a square only if all four corners of that square are currently unoccupied. Once placed, pieces do not move. Captured pieces are immediately removed from the game.\n \n The rule for capturing allows a player to capture two enemy pieces in a single turn. All of the following conditions must be met:\n - the two enemy pieces occupy opposite corners of a square;\n - a third corner of the square is already occupied by a piece owned by the capturing player;\n - the square's midpoint is unoccupied.\n \n The capture is executed by placing a piece on the remaining unoccupied corner of the square. If the capturing move also simultaneously completes a second square on the board where the same conditions prevail, then the move results in the capture of four enemy pieces instead of two.\n \n Black tries to connect the two horizontal (black) sides with an unbroken chain of black pieces, while White tries to connect the two vertical (white) sides with an unbroken chain of white pieces. The first to do so wins the game. END" }, { "prompt": "Construct a Ludii game based on the following description\n4x12 board. Four counters in each hole. Players alternate turns sowing the counters from one hole in an anti-clockwise direction. When the counters fall into a hole in their inner row, the contents of the opponent's opposite inner row hole are captured, as are any in the opponent's corresponding outer row hole, but only if counters were captured from the inner row hole. The player who captures the most counters wins. \n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (count Cell at:(handSite #1))) (define \"Columns\" 12) (game \"Moruba\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"0,E,N1,W\" loop:True P1) (track \"Track2\" \"24,E,N1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"Track1\")) (regions \"Home\" P2 (sites Track \"Track2\")) (regions \"Inner\" P1 (difference (sites Track \"Track1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"Track2\") (sites Top))) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 4 to:(union (sites P1 \"Home\") (sites P2 \"Home\")))) (play (move Select (from (sites Mover \"Home\") if:(> (count at:(from)) 0)) (then (sow \"Track\" owner:(mover) if:(and { (is In (to) (sites Mover \"Inner\")) (> (count at:(\"OppositePit\" (to))) 0)}) apply:(and (fromTo (from (\"OppositePit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePit\" (to)))) (if (> (count at:(\"OppositeOuterPit\" (to))) 0) (fromTo (from (\"OppositeOuterPit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositeOuterPit\" (to)))))))))) (end (\"MancalaByScoreWhen\" (no Moves Mover))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"Columns\" 8) (game \"Lobudok\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"0,E,N1,W\" loop:True P1) (track \"Track2\" \"16,E,N1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"Track1\")) (regions \"Home\" P2 (sites Track \"Track2\")) (regions \"Inner\" P1 (difference (sites Track \"Track1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"Track2\") (sites Top))) (regions \"SideHoles\" P1 (intersection (sites Track \"Track1\") (union (sites Left) (sites Right)))) (regions \"SideHoles\" P2 (intersection (sites Track \"Track2\") (union (sites Right) (sites Left)))) (piece \"Seed\" Shared) (hand Each)}) (rules (start { (set Count 1 to:(sites {2 5 13 10 29 26 18 21})) (set Count 8 to:(sites {15 16 8 23})) (set Count 6 to:(sites {6 9 22 25}))}) (play (or (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (difference (sites Mover \"Home\") (sites Mover \"SideHoles\"))) if:(> (count at:(from)) 1)) (then (sow \"Track\" owner:(mover) apply:(if (and { (is In (to) (sites Mover \"Inner\")) (< 1 (count at:(to))) (is Occupied (\"OppositeOuterPit\" (to))) (is Occupied (\"OppositePit\" (to)))}) (and { (fromTo (from (\"OppositeOuterPit\" (to))) (to (last From)) count:(count at:(\"OppositeOuterPit\" (to)))) (fromTo (from (\"OppositePit\" (to))) (to (last From)) count:(count at:(\"OppositePit\" (to)))) (sow (last From) count:(+ (count at:(\"OppositePit\" (to))) (count at:(\"OppositeOuterPit\" (to)))) \"Track\" owner:(mover) skipIf:(and (!= 1 (value Player Mover)) (is In (to) (sites \"SideHoles\"))))}) (if (< 1 (count at:(to))) (moveAgain))) skipIf:(and (!= 1 (value Player Mover)) (is In (to) (sites \"SideHoles\")))))) (if (if (= 1 (value Player Mover)) True (all Sites (difference (sites Mover \"Home\") (sites Mover \"SideHoles\")) if:(<= (count at:(site)) 1))) (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"SideHoles\")) if:(> (count at:(from)) 1)) (then (and (sow \"Track\" owner:(mover) apply:(if (and { (is In (to) (sites Mover \"Inner\")) (< 1 (count at:(to))) (is Occupied (\"OppositeOuterPit\" (to))) (is Occupied (\"OppositePit\" (to)))}) (and { (fromTo (from (\"OppositeOuterPit\" (to))) (to (last From)) count:(count at:(\"OppositeOuterPit\" (to)))) (fromTo (from (\"OppositePit\" (to))) (to (last From)) count:(count at:(\"OppositePit\" (to)))) (sow (last From) count:(+ (count at:(\"OppositePit\" (to))) (count at:(\"OppositeOuterPit\" (to)))) \"Track\" owner:(mover))}) (if (< 1 (count at:(to))) (moveAgain)))) (if (= 0 (value Player Mover)) (set Value Mover 1)))))))) (end (\"ForEachPlayerNoMovesLoss\"))))\n\n###\n\n", "completion": "4x8 board. The counters begin in the following arrangement, starting from a player's left most hole in the outer row and proceeding anticlockwise: 0,0,1,0,0,1,6,0,8,0,1,0,0,1,6,8. To start, players may not sow into or sow from the leftmost and rightmost holes in both of their rows. When it is no longer possible for the player to make a legal move using only these twelve holes, they may then play using all of the holes. The opponent must continue using only twelve holes until they also cannot make a legal move with them. Sowing proceeds in an anti-clockwise direction. When the final counter falls into an occupied hole in the player's inner row and both of the opposite holes on the opponent's side of the board are occupied, the counters in the opposite holes are captured and sown beginning in the first hole that was sown into to begin the sowing that caused the capture. When the final counter falls into an occupied hole and a capture is not possible, the contents of the hole are picked up and sowing continues. When the final counter lands in an empty hole, the turn ends. Players cannot sow from a hole containing a single counter. The player who captures all of their opponent's counters wins.\n END" }, { "prompt": "Construct a Ludii game based on the following description\n3x5 intersecting lines, with diagonals in the four quadrants created. On either short end, an arc connects the two corner points, and the center line is extended to the arc. One player plays as four hounds, which begin on the four points to the left side of the board. The other player plays as one hare, which begins on the point where the center line and the second line cross. Players alternate turns moving a piece to an empty adjacent spot along the lines. The hounds may only move forward. The hounds win when they block the hare from being able to move. The game has an ending condition only for P2.\n\n###\n\n", "completion": "(game \"Hund efter Hare (Thy)\" (players 2) (equipment { (board (remove (add (merge { (rectangle 3 5) (shift 1 0 (scale 0.5 (rectangle 5 1))) (shift 3 0 (scale 0.5 (rectangle 5 1))) (shift -1 1 (rectangle 1 7))}) edges:{ {0 15} {15 7} {7 18} {18 14} {17 4} {7 17} {7 16} {16 10} {19 10} {0 19} {20 14} {20 4} {12 16} {16 5} {5 15} {15 2} {2 17} {17 9} {9 18} {18 12}}) edges:{{11 6} {6 1} {13 8} {8 3}}) use:Vertex) (piece \"Hare\" P1 \"StepToEmpty\") (piece \"Dog\" P2 E \"StepForwardsToEmpty\")}) (rules (start { (place \"Hare1\" coord:\"C3\") (place \"Dog2\" (sites {\"B3\" \"B1\" \"A3\" \"B5\"}))}) (play (forEach Piece)) (end { (if (no Moves P1) (result P2 Win))}))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"T'oki\" (players 2) (equipment { (board (square 5)) (piece \"Marker\" Each (or (\"StepOrthogonalToEmpty\") (move Hop Orthogonal (between (range 1 (count Rows)) if:(\"IsEnemyAt\" (between)) (apply (remove (between)))) (to if:(or (and (is In (to) (sites Outer)) (\"IsEnemyAt\" (to))) (is Empty (to))))))) (hand Each)}) (rules (start (place \"Marker\" \"Hand\" count:20)) (play (or (move (from (handSite Mover)) (to (sites Empty)) count:2) (forEach Piece))) (end (if (and (\"HandEmpty\" Next) (no Pieces Next)) (result Mover Win)))))\n\n###\n\n", "completion": "5x5 board. Twenty pieces per player. Players alternate turns placing pieces on the board, two at a time into the same square. At any time, a player may move one piece from a square one spot in an orthogonal direction. Pieces may capture opponent's pieces when either a single square or an unbroken line of squares with opponent's pieces has an empty space beyond it; the player's piece hops over the opponent's pieces and captures them all. When the unbroken line ends at the edge of the board, it is treated as though there were an empty square beyond the edge of the board, and the capturing piece is placed on the last space on the board in that line. Players may enter any reserved pieces on any turn as they see fit. The player to capture all of the opponent's pieces wins. END" }, { "prompt": "Construct a Ludii game based on the following description\nGoal: Form an orthogonally connected path of friendly stones that surrounds at least one non-friendly stone.\n \n Set-up:\n Two stones, one of each colour, are placed next to each other adjacent to the center of the board. \n Then Black starts by taking one turn. After that players take DOUBLE turns in alternation.\n \n Play: \n Each turn has two parts that both must be completed: A PLACEMENT and a SWAP.\n \n -- The PLACEMENT is made a knight's leap away from a selected stone of the same color.\n \n -- The SWAP is done by exchanging the contents of the 2 squares that lie between the selected stone and the placed stone. For a SWAP to be valid, the contents of these squares must be different, i.e.: two stones of different color, or an empty space and a stone. \n \n If a turn cannot be completed with a placement to an empty position, the placement must be made by placing on top of an opponent's stone. \n The placement and swap rules apply to the visible stones and must still be followed.\n \n Voluntary passing is not allowed. When neither player can move, the game ends in a draw.\n \n To help visualise the moves, the 'Show Last Move' option shows an arrow from the placement site to the supporting friendly piece and the swap pieces are to either side of this arrow. \n \n Optional Variants: \n -- Larger Board to reduce the strategic effect of the edge squares. / Smaller board to focus on stacked play as a significant part of the game.\n -- Normal single turn alternation for a more fine-grained experience, but with a first player advantage. 8x8 Square First player takes one turn, then players alternate taking 2 turns each\n\n###\n\n", "completion": "(define \"KnightVector\" (sites (from) {{F R F L F} {F L F R F}})) (define \"UnconfinedStiesOf\" (forEach (sites Board) if:(!= Infinity (count Steps Adjacent (step Adjacent (to if:(or (is Empty (to)) (is #1 (who at:(to)))))) (site) (sites Outer))))) (define \"SetScoreOf\" (set Score #1 (- 0 (count Sites in:(difference (sites Occupied by:#1) (\"UnconfinedStiesOf\" #1)))))) (define \"MakeSwap\" (if (is Empty (\"SwapSite\" 1)) (fromTo (from (\"SwapSite\" 0)) (to (\"SwapSite\" 1))) (if (is Empty (\"SwapSite\" 0)) (fromTo (from (\"SwapSite\" 1)) (to (\"SwapSite\" 0))) (set Var \"Piece1\" (\"SwapPiece\" 1) (then (add (piece (\"SwapPiece\" 0)) (to (\"SwapSite\" 1) (apply (remove (to)))) (then (add (piece (var \"Piece1\")) (to (\"SwapSite\" 0) (apply (remove (to)))))))))) (then (and { (\"SetScoreOf\" Mover) (\"SetScoreOf\" Next) (forget Value All) (if (and (\"NewTurn\") (< -1 (counter))) (moveAgain))})))) (define \"SwapPiece\" (what at:(\"SwapSite\" #1) level:(topLevel at:(\"SwapSite\" #1)))) (define \"SwapSite\" (arrayValue (values Remembered) index:#1)) (define \"Placement\" (move Select (from #1 if:(> 2 (count Stack at:(from)))) (to \"KnightVector\" if:(and { (is In (to) (sites Occupied by:Mover top:True)) (= 2 (count Sites in:(\"SwapSites\" (to) (from)))) (or (= 1 (count Sites in:(intersection (\"SwapSites\" (to) (from)) (sites Occupied by:Mover top:True)))) (= 1 (count Sites in:(intersection (\"SwapSites\" (to) (from)) (sites Occupied by:Next top:True)))))})) (then (and { (add (piece (id \"Disc\" Mover)) (to (last From)) stack:True) (forEach Site (\"SwapSites\" (last To) (last From)) (remember Value (site)))})))) (define \"SwapSites\" (intersection (sites Around #1 Adjacent) (sites Around #2 Adjacent))) (game \"Veloop (Square)\" (players 2) (equipment { (board (renumber (rotate 90 (square Square 8))) use:Cell) (piece \"Disc\" Each)}) (rules (start { (place \"Disc1\" {28}) (place \"Disc2\" {36})}) (play (priority (\"Placement\" (sites Empty)) (\"Placement\" (sites Occupied by:Next)) (then (\"MakeSwap\")))) (end (if (!= 0 (+ (score P1) (score P2))) (byScore))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"CaptureMove\" (and (fromTo (from (\"NextHoleFrom\" (to) #1 2)) (to (handSite 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 (handSite 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 (handSite 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 (handSite Mover)) count:(count at:(\"NextHoleFrom\" (to) #1 8)))))))))) (define \"NextHoleFrom\" (\"NextSiteOnTrack\" #3 from:#1 #2)) (define \"LastHoleSowed\" (last To afterConsequence:True)) (define \"PiecesOwnedBy\" (count Cell at:(handSite #1))) (game \"Dongjintian\" (players 2) (equipment { (mancalaBoard 2 5 store:None { (track \"TrackCCW\" \"0,E,N,W\" loop:True) (track \"TrackCW\" \"4,W,N,E\" loop:True)}) (piece \"Seed\" Shared) (hand Each) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start (set Count 5 to:(sites Track))) (play (or (if (or (>= 0 (var \"Direction\")) (= (var \"Direction\") 1)) (move Select (from (if (\"SameTurn\") (sites {(\"NextHoleFrom\" \"LastHoleSowed\" \"TrackCCW\" 1)}) (sites Mover)) if:(is Occupied (from))) (then (sow \"TrackCCW\" apply:(if (is Occupied (\"NextHoleFrom\" (to) \"TrackCCW\" 1)) (and (moveAgain) (set Var \"Direction\" 1)) (if (and (is Empty (\"NextHoleFrom\" (to) \"TrackCCW\" 1)) (is Occupied (\"NextHoleFrom\" (to) \"TrackCCW\" 2))) (and (\"CaptureMove\" \"TrackCCW\") (set Var \"Direction\" 0)))))))) (if (or (>= 0 (var \"Direction\")) (= (var \"Direction\") 2)) (move Select (from (if (\"SameTurn\") (sites {(\"NextHoleFrom\" \"LastHoleSowed\" \"TrackCW\" 1)}) (sites Mover)) if:(is Occupied (from))) (then (sow \"TrackCW\" apply:(if (is Occupied (\"NextHoleFrom\" (to) \"TrackCW\" 1)) (and (moveAgain) (set Var \"Direction\" 2)) (if (and (is Empty (\"NextHoleFrom\" (to) \"TrackCW\" 1)) (is Occupied (\"NextHoleFrom\" (to) \"TrackCW\" 2))) (and (\"CaptureMove\" \"TrackCW\") (set Var \"Direction\" 0)))))))))) (end (\"MancalaByScoreWhen\" (<= (count Pieces All in:(sites Board)) 1)))))\n\n###\n\n", "completion": "2x5 board. Five counters per hole. Sowing can happen in either direction. When the last counter falls into a hole, sowing continues if there are counters in the following holes; these are picked up and sowing continues from there. When the hole after the end of a sowing is empty, the counters in the next hole following it are captured. If a pattern of alternating empty and occupied holes continues after this, the counters in the occupied holes are captured, until there are two occupied or two empty holes in a row. The player who captures the most counters wins. END" }, { "prompt": "Construct a Ludii game based on the following description\nPlay begins with the supply of pieces (30 of each colour) randomly distributed on the board, so each cell contains only one stone and there is one free space left. This free space can be anywhere except the centre space. Each player has an allocated colour. Before the game starts, Black can swap the positions of any two stones on the board. White then starts the game. Players alternate turns during the game until one of them cannot make a valid move, thereby losing the game. On a turn, a player must make one capture. A player makes a capture by leaping in a straight line in any of the 6 directions exactly as many spaces as friendly pieces surround its original position, and landing on an enemy piece, which is removed from the game. The player who cannot make a capture loses. \n\n###\n\n", "completion": "(define \"DistanceToMove\" (count Sites in:(sites Around (from) Orthogonal if:(\"IsFriendAt\" (to))))) (game \"Quantum Leap\" (players 2) (equipment { (board (hex 5)) (piece \"Marker\" Each (move Hop Orthogonal (between (exact (- \"DistanceToMove\" 1)) if:True) (to if:(\"IsEnemyAt\" (to)) (apply (remove (to))))))}) (rules (start { (place \"Marker2\" (centrePoint)) (place Random {\"Marker2\"} count:29) (place Random {\"Marker1\"} count:30)}) phases:{ (phase \"Swap\" (play (or (move Pass) (move Select (from (sites Occupied by:Mover)) (to (sites Occupied by:Next)) (then (swap Pieces (last From) (last To)))))) (nextPhase \"Play\")) (phase \"Play\" (play (forEach Piece)))} (end (\"NoMoves\" Loss)))) 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": "Modify the Ludii game according to the following option changes:\nThe game is played on a 9x9 board. -> The game is played on a 13x13 board.\n(define \"HasMadeACapture\" (is Triggered \"CaptureMade\" Next)) (define \"CaptureSurroundedPiece\" (enclose (from (last To)) Orthogonal (between if:(\"IsEnemyAt\" (between)) (apply (and (trigger \"CaptureMade\" Next) (remove (between))))))) (game \"Atari Go\" (players 2) (equipment { (board (square 9) use:Vertex) (piece \"Marker\" Each)}) (rules (play (do (move Add (to (sites Empty)) (then (\"CaptureSurroundedPiece\"))) ifAfterwards:(\"HasFreedom\" Orthogonal))) (end (if \"HasMadeACapture\" (result Mover Win)))))\n\n###\n\n", "completion": "(define \"HasMadeACapture\" (is Triggered \"CaptureMade\" Next)) (define \"CaptureSurroundedPiece\" (enclose (from (last To)) Orthogonal (between if:(\"IsEnemyAt\" (between)) (apply (and (trigger \"CaptureMade\" Next) (remove (between))))))) (game \"Atari Go\" (players 2) (equipment { (board (square 13) use:Vertex) (piece \"Marker\" Each)}) (rules (play (do (move Add (to (sites Empty)) (then (\"CaptureSurroundedPiece\"))) ifAfterwards:(\"HasFreedom\" Orthogonal))) (end (if \"HasMadeACapture\" (result Mover Win))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nOrder 5 board -> Order 7 board\n(define \"ColourBackground\" (colour 156 130 126)) (define \"ColourBackground2\" (colour 156 130 126)) (define \"ColourBackground1\" (colour 126 130 156)) (define \"SquareDiagonal\" (board (square 5) use:Vertex)) (define \"SquareGrid\" (board (square 5) use:Cell)) (define \"BoardUsed\" \"SquareDiagonal\") (define \"ConnectionDirection\" All) (define \"ScoreConnectionDirection\" Orthogonal) (define \"AllHave1Connection2Edge\" (all Sites #1 if:(or (and (is Empty (site)) (is In (site) (sites Outer))) (!= Infinity (count Steps (step \"ConnectionDirection\" (to if:(is Empty (to)))) (site) (difference (sites Outer) (site))))))) (define \"CapturingAtScoreWhat4Who\" (forEach Value (array #1) (if (> 2 (count Sites in:(sites Around (value) \"ConnectionDirection\" if:(is Empty (to))))) (if (is #2 (who at:(value))) (remove (value) (then (if (is Empty (handSite #3)) (add (piece (id \"Disc\" #2)) (to (handSite #3)) (then (set Value at:(handSite #3) (+ 1 (value Piece at:(handSite #3)))))) (set Value at:(handSite #3) (+ 1 (value Piece at:(handSite #3))))))) (remove (value)))))) (define \"Scoring\" (set Var \"MoverScore\" (+ (value Piece at:(handSite Mover)) (\"GroupCount\" Mover)) (then (set Var \"NextScore\" (+ (value Piece at:(handSite Next)) (\"GroupCount\" Next)) (then (\"CascadeTiebreaker\")))))) (define \"CascadeTiebreaker\" (if (= (var \"MoverScore\") (var \"NextScore\")) (and (set Score Mover (* -1 (\"CascadeScore\" Mover Next))) (set Score Next (* -1 (\"CascadeScore\" Next Mover)))) (\"CascadeTie\"))) (define \"CascadeTie\" (and (set Score Mover (var \"MoverScore\")) (set Score Next (var \"NextScore\")))) (define \"CascadeScore\" (max 0 (max (difference (sizes Group \"ScoreConnectionDirection\" #1) (sizes Group \"ScoreConnectionDirection\" #2))))) (define \"GroupCount\" (max 0 (max (sizes Group \"ScoreConnectionDirection\" #1)))) (game \"Watershed\" (players 2) (equipment { \"BoardUsed\" (piece \"Ball\" Each) (piece \"Disc\" Each) (hand Each size:1)}) (rules (start (set Score Each 0)) (play (do (move Add (to (sites Empty) if:(< 1 (count Sites in:(intersection (sites Around (to) \"ConnectionDirection\") (sites Empty)))))) ifAfterwards:(\"AllHave1Connection2Edge\" (intersection (sites Around (last To) \"ConnectionDirection\") (sites Empty))) (then (do (\"CapturingAtScoreWhat4Who\" (intersection (sites Occupied by:All) (sites Around (last To) \"ConnectionDirection\")) Next Mover) next:(\"Scoring\"))))) (end (if (no Moves Next) { (if (= (score Mover) (score Next)) (result Mover Win)) (if (!= (score Mover) (score Next)) (byScore))}))))\n\n###\n\n", "completion": "(define \"ColourBackground\" (colour 156 130 126)) (define \"ColourBackground2\" (colour 156 130 126)) (define \"ColourBackground1\" (colour 126 130 156)) (define \"SquareDiagonal\" (board (square 7) use:Vertex)) (define \"SquareGrid\" (board (square 7) use:Cell)) (define \"BoardUsed\" \"SquareDiagonal\") (define \"ConnectionDirection\" All) (define \"ScoreConnectionDirection\" Orthogonal) (define \"AllHave1Connection2Edge\" (all Sites #1 if:(or (and (is Empty (site)) (is In (site) (sites Outer))) (!= Infinity (count Steps (step \"ConnectionDirection\" (to if:(is Empty (to)))) (site) (difference (sites Outer) (site))))))) (define \"CapturingAtScoreWhat4Who\" (forEach Value (array #1) (if (> 2 (count Sites in:(sites Around (value) \"ConnectionDirection\" if:(is Empty (to))))) (if (is #2 (who at:(value))) (remove (value) (then (if (is Empty (handSite #3)) (add (piece (id \"Disc\" #2)) (to (handSite #3)) (then (set Value at:(handSite #3) (+ 1 (value Piece at:(handSite #3)))))) (set Value at:(handSite #3) (+ 1 (value Piece at:(handSite #3))))))) (remove (value)))))) (define \"Scoring\" (set Var \"MoverScore\" (+ (value Piece at:(handSite Mover)) (\"GroupCount\" Mover)) (then (set Var \"NextScore\" (+ (value Piece at:(handSite Next)) (\"GroupCount\" Next)) (then (\"CascadeTiebreaker\")))))) (define \"CascadeTiebreaker\" (if (= (var \"MoverScore\") (var \"NextScore\")) (and (set Score Mover (* -1 (\"CascadeScore\" Mover Next))) (set Score Next (* -1 (\"CascadeScore\" Next Mover)))) (\"CascadeTie\"))) (define \"CascadeTie\" (and (set Score Mover (var \"MoverScore\")) (set Score Next (var \"NextScore\")))) (define \"CascadeScore\" (max 0 (max (difference (sizes Group \"ScoreConnectionDirection\" #1) (sizes Group \"ScoreConnectionDirection\" #2))))) (define \"GroupCount\" (max 0 (max (sizes Group \"ScoreConnectionDirection\" #1)))) (game \"Watershed\" (players 2) (equipment { \"BoardUsed\" (piece \"Ball\" Each) (piece \"Disc\" Each) (hand Each size:1)}) (rules (start (set Score Each 0)) (play (do (move Add (to (sites Empty) if:(< 1 (count Sites in:(intersection (sites Around (to) \"ConnectionDirection\") (sites Empty)))))) ifAfterwards:(\"AllHave1Connection2Edge\" (intersection (sites Around (last To) \"ConnectionDirection\") (sites Empty))) (then (do (\"CapturingAtScoreWhat4Who\" (intersection (sites Occupied by:All) (sites Around (last To) \"ConnectionDirection\")) Next Mover) next:(\"Scoring\"))))) (end (if (no Moves Next) { (if (= (score Mover) (score Next)) (result Mover Win)) (if (!= (score Mover) (score Next)) (byScore))})))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"IsSpecialThrow\" (is In (\"ThrowValue\") (sites {7 25 30 14}))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" #2 #1)) (define \"ThrowValue\" (mapEntry \"Throw\" (count Pips))) (game \"Pachih\" (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)}) (\"StickDice\" 7) (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 (and (not (is In (to) (sites \"SafeSites\"))) (\"IsEnemyAt\" (to))) (forEach Level (to) FromTop (fromTo (from (to) level:(level)) (to (centrePoint)))))))))) (regions \"SafeSites\" (sites {60 62 2 37 87 89 16 48})) (map \"Throw\" {(pair 0 7) (pair 1 10) (pair 2 2) (pair 3 3) (pair 4 4) (pair 5 25) (pair 6 30) (pair 7 14)})}) (rules (start { (place Stack \"Pawn1\" 9 count:4) (place Stack \"Pawn2\" 26 count:4) (place Stack \"Pawn3\" 52 count:4) (place Stack \"Pawn4\" 27 count:4)}) (play (\"RollMove\" (forEach Piece) (then (if (and (< (value Player Mover) 2) (\"IsSpecialThrow\")) (and (moveAgain) (set Value Mover (+ 1 (value Player Mover)))) (set Value Mover Undefined))))) (end (\"EscapeWin\"))))\n\n###\n\n", "completion": "Four 3x8 rectangles, arranged in a cross shape around a large central square. The third space, counting from the outer corner, in the two outer rows of each arm of the board are marked with an \\ END" }, { "prompt": "Construct a Ludii game based on the following description\nThree concentric squares, with lines connecting the corners and the midpoints of the sides. Two diamonds drawn, one connecting the midpoints of the outer square and intersecting the corners of the second square; the second connecting the midpoints of the second square and intersecting the corners of the central square. Twelve pieces per plays. Players alternate turns placing a piece on an empty spot on the board. When all of the pieces are placed, 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, they remove one of the opponent's pieces. Pieces which are in a three-in-a-row pattern cannot be removed. The player who removes all of the opponent's pieces wins. \n\n###\n\n", "completion": "(game \"Xonin Shatar (Complex)\" (players 2) (equipment { (board (add (remove (merge { (shift 3 3 (remove (square 3) edges:{{1 4} {3 4} {4 7} {4 5}})) (shift 2 2 (scale 2 (remove (square 3) edges:{{1 4} {3 4} {4 7} {4 5}}))) (scale 4 (remove (square 3) edges:{{1 4} {3 4} {4 7} {4 5}}))}) vertices:{4}) edges:{ {17 19} {17 20} {20 22} {22 19} {17 9} {19 11} {22 14} {12 20} {21 13} {23 15} {18 10} {16 8} {11 9} {9 12} {12 14} {14 11} {9 1} {11 3} {6 14} {4 12} {0 8} {5 13} {7 15} {10 2}}) use:Vertex) (hand Each) (piece \"Marker\" Each (\"StepToEmpty\" ~ (then (\"ReplayIfLine3\"))))}) (rules (start (place \"Marker\" \"Hand\" count:12)) phases:{ (phase \"Placement\" (play (if \"SameTurn\" (\"RemoveAnyEnemyPieceNotInLine3\" Orthogonal) (move (from (handSite Mover)) (to (sites Empty)) (then (\"ReplayIfLine3\"))))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (phase \"Movement\" (play (if \"SameTurn\" (\"RemoveAnyEnemyPieceNotInLine3\" Orthogonal) (forEach Piece))))} (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe two players, Red and Blue, take turns coloring cells with their own color, one cell per turn, starting with Red.\n \n To win you must form a path of cells of your own color connecting the two border regions of your color. \n\n###\n\n", "completion": "(game \"Fractal\" (players 2) (equipment { (board (add (add (union (shift 3.45 6 (scale 3 (remove (remove (clip (hex 3) (poly { { 0 1} { 2 1} { 4 5} { 1 4}})) cells:{9}) vertices:{26 30 34 39 35 40 36 31 27 22 18 14 9 13 8 12 17 21 25}))) (union (remove (shift 5.77 10 (scale 0.333 (remove (remove (hex Star 5) cells:{0 1 2 3 4 5 6 7 8 9 30 29 45 28 44 59 27 43 58 72 165 164 149 163 148 134 162 147 133 120 180 178 179 175 176 177 171 172 173 174 150 135 151 152 136 121 108 122 137 153 15 16 31 17 32 46 18 33 47 60}) cells:{ 0 1 2 3 4 12 21 31 42 54 77 88 98 107 115 120 119 118 117 116 108 99 89 78 66 43 32 22 13 5 6 8 9 11 30 41 65 87 97 114 112 111 109 90 79 55 33 23}))) vertices:{0..40 42 43 45..50 62..67 80..84 97..100 113..116 128..131 143..146 158..160 173 174 187 200 212 224 366 237 250 263 264 276..278 290..293 305..308 321..324 337..340 353..357 369..374 375..380 382 383 385..425 358..363 341..345 325..328 309..312 294..297 279..282 265..267 251 252 238 225 213 201 188 175 161..162 147..149 132..135 117..120 101..104 85..88 68..72 51..56 59}) (remove (remove (remove (remove (remove (hex Star 5) cells:{0 1 2 3 4 5 6 7 8 9 30 29 45 28 44 59 27 43 58 72 165 164 149 163 148 134 162 147 133 120 180 178 179 175 176 177 171 172 173 174 150 135 151 152 136 121 108 122 137 153 15 16 31 17 32 46 18 33 47 60}) cells:{ 0 1 2 3 4 12 21 31 42 54 77 88 98 107 115 120 119 118 117 116 108 99 89 78 66 43 32 22 13 5 6 8 9 11 30 41 65 87 97 114 112 111 109 90 79 55 33 23}) cells:{ 26 27 35 36 37 45 46}) vertices:{ 193 180 167 181 168 182 195 208 220 232 245 258 244 257 243 230 217 205}) vertices:{188 198 199 208 209 219 0..40 42 43 59 45..50 62..67 80..84 97..100 113..116 128..131 143..146 158..160 171..172 182 193 203 213 224 234 245 246 258..260 272..275 287..290 303..306 319..322 335..339 351..362 364 365 367..407 340..345 323..327 307..310 291..294 276..279 261..264 247..249 235 236 225 214 204 194 183 173 161 162 147..149 132..135 117..120 101..104 85..88 68..72 51..56}))) edges:{ {216 4} {7 229} {217 5} {236 8} {12 282} {18 318} {22 364} {25 378} {24 377} {21 357} {17 311} {11 275} {91 286} {43 270} {30 262} {31 263} {50 271} {287 101} {307 154} {323 202} {331 215} {330 214} {322 195} {306 144}}) cells:{ {0 4 216 218 223 230 222 229 7 3} {4 1 5 217 220 226 233 225 232 224 219 216} {5 2 6 8 236 228 235 227 221 217} {8 10 12 282 274 281 273 266 258 251 244 236} {12 14 16 18 318 310 302 296 290 282} {18 20 22 364 356 348 341 334 325 317 326 318} {22 26 29 25 378 376 370 363 371 364} {25 28 24 377 373 367 360 368 361 369 375 378} {24 27 23 21 357 365 358 366 372 377} {21 19 17 311 319 312 320 327 335 342 349 357} {17 15 13 11 275 283 291 297 303 311} {275 11 9 7 229 237 245 252 259 268 276 267} {43 36 44 37 32 30 262 254 261 270} {30 33 38 46 39 47 40 34 31 263 255 262} {31 35 41 49 42 50 271 264 256 263} {50 58 65 72 80 89 100 90 101 287 279 271} {101 112 122 132 143 154 307 300 294 287} {202 323 315 307 154 164 153 163 172 179 186 194} {323 332 339 331 215 213 208 201 209 202} {338 331 215 212 207 199 206 198 205 211 214 330} {330 337 329 322 195 203 196 204 210 214} {322 314 306 144 155 145 156 165 173 180 187 195} {306 299 293 286 91 102 113 123 133 144} {286 278 270 43 51 59 66 73 82 92 81 91}})) (piece \"Marker\" Each) (regions P1 {(sites Side NW) (sites Side SE)}) (regions P2 {(sites Side NE) (sites Side SW)})}) (rules (play (move Claim (to (sites Empty)))) (end (if (is Connected Mover) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x4 board. Six counters in each hole. At the beginning of the game, each player chooses one hole to be their sowing hole, from which each move on their turn must begin. The players agree on a direction of play, which is maintained throughout the game. Players alternate turns sowing from their sowing hole. The players may choose to sow one-by-one, two-by-two, three-by-three, four-by-four, and so forth, into the following holes. When the final counter lands in a hole causing it to contain two, four, six, or eight counters, the contents of that hole are captured. If the preceding hole also contains two, four, six, or eight counters, these are also captured, proceeding until there is a no longer a hole with two, four, six, or eight counters. If at the end of a turn a player sowed into the opponent's row and any of the opponent's holes contain two, four, six, or eight counters, providing the player sowed into them, the opponent captures these counters. In a players own row, if either player sows into a hole with an odd number of counters, making it an even number of counters, the player who owns that row captures the counters. If a player's sowing hole is empty at the beginning of their turn, they pass. Play continues until all of the counters are captured, or there is only one left on the board. The single counter is captured by the player in whose row it is located. \n \n A new round begins. Players fill up as many holes as they can with six counters. If a player cannot, they fill as many as they can with six counters, and place the remainder in a hole, either between two with six counters or after them, and erases any empty holes. Play continues as before. When one player has erased all of their holes, the opponent wins. The game is played counter clockwise.\n\n###\n\n", "completion": "(define \"OneOrLessPieceOnBoard\" (> 2 (count in:(union (sites Top) (sites Bottom))))) (define \"PlayableSites\" (sites (values Remembered \"Playable\"))) (game \"Buqruru\" (players 2) (equipment { (mancalaBoard 2 4 store:None (track \"Track\" \"0,E,N,W\" loop:True)) (piece \"Seed\" Shared) (hand Each) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start { (set Count 6 to:(sites Track)) (set RememberValue \"Playable\" (sites Board))}) phases:{ (phase \"SelectingHole\" (play (move Select (from (sites Mover) if:(is In (from) (\"PlayableSites\"))) (then (set Value Mover (last To))))) (nextPhase Mover \"Sowing\")) (phase \"Sowing\" (play (if (is Occupied (value Player Mover)) (or { (move Select (from (value Player Mover) if:(is In (from) (\"PlayableSites\"))) (then (sow numPerHole:1 sowEffect:(if (and (is In (to) (sites Next)) (or { (= 1 (count at:(to))) (= 3 (count at:(to))) (= 5 (count at:(to))) (= 7 (count at:(to)))})) (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to)))) apply:(if (or { (= 2 (count at:(to))) (= 4 (count at:(to))) (= 6 (count at:(to))) (= 8 (count at:(to)))}) (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to)))) skipIf:(not (is In (to) (\"PlayableSites\"))) backtracking:True))) (if (= 0 (% (count at:(value Player Mover)) 2)) (move Select (from (value Player Mover)) (then (sow numPerHole:2 sowEffect:(if (and (is In (to) (sites Next)) (or { (= 0 (count at:(to))) (= 2 (count at:(to))) (= 4 (count at:(to))) (= 6 (count at:(to)))})) (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to)))) apply:(if (or { (= 2 (count at:(to))) (= 4 (count at:(to))) (= 6 (count at:(to))) (= 8 (count at:(to)))}) (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to)))) skipIf:(not (is In (to) (\"PlayableSites\"))) backtracking:True)))) (if (= 0 (% (count at:(value Player Mover)) 3)) (move Select (from (value Player Mover)) (then (sow numPerHole:3 sowEffect:(if (and (is In (to) (sites Next)) (or { (= 1 (count at:(to))) (= 3 (count at:(to))) (= 5 (count at:(to)))})) (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to)))) apply:(if (or { (= 2 (count at:(to))) (= 4 (count at:(to))) (= 6 (count at:(to))) (= 8 (count at:(to)))}) (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to)))) skipIf:(not (is In (to) (\"PlayableSites\"))) backtracking:True)))) (if (= 0 (% (count at:(value Player Mover)) 4)) (move Select (from (value Player Mover)) (then (sow numPerHole:4 sowEffect:(if (and (is In (to) (sites Next)) (or { (= 0 (count at:(to))) (= 2 (count at:(to))) (= 4 (count at:(to)))})) (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to)))) apply:(if (or { (= 2 (count at:(to))) (= 4 (count at:(to))) (= 6 (count at:(to))) (= 8 (count at:(to)))}) (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to)))) skipIf:(not (is In (to) (\"PlayableSites\"))) backtracking:True))))}) (then (if (\"OneOrLessPieceOnBoard\") (and { (forEach Site (sites P1) (if (is Occupied (site)) (fromTo (from (site)) (to (handSite P1)) count:(count at:(site))))) (forEach Site (sites P2) (if (is Occupied (site)) (fromTo (from (site)) (to (handSite P2)) count:(count at:(site))))) (forget Value \"Playable\" All)}))))) (end { (if (and (= 0 (count at:(value Player P1))) (= 0 (count at:(value Player P2)))) (result Mover Draw)) (if (\"OneOrLessPieceOnBoard\") { (if (= 0 (count Cell at:(handSite P1))) (result P2 Win)) (if (= 0 (count Cell at:(handSite P2))) (result P1 Win))})}) (nextPhase (\"OneOrLessPieceOnBoard\") \"BetweenRounds\")) (phase \"BetweenRounds\" (play (if (not (all Sites (sites Mover) if:(is Occupied (site)))) (if (<= 6 (count at:(handSite Mover))) (move (from (handSite Mover)) (to (sites Mover)) count:6 (then (remember Value \"Playable\" (last To)))) (move (from (handSite Mover)) (to (sites Mover)) count:(count at:(handSite Mover)) (then (remember Value \"Playable\" (last To))))))) (nextPhase (all Passed) \"SelectingHole\"))})) END" }, { "prompt": "Construct a Ludii game based on the following description\nA Latin Square puzzle is one in which an n x n grid is filled with n symbols, which cannot repeat in a row or column of the grid. \n\n###\n\n", "completion": "(game \"Latin Square\" (players 1) (equipment { (board (square 5) (values Cell (range 1 5))) (regions {Columns Rows})}) (rules (play (satisfy (all Different))) (end (if (is Solved) (result P1 Win))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"Gomoku\" (players 2) (equipment { (board (square 15) use:Vertex) (piece \"Marker\" Each)}) (rules (play (move Add (to (sites Empty)))) (end (if (is Line 5 All exact:True) (result Mover Win)))))\n\n###\n\n", "completion": "Played on a Go board, using 15x15 of the intersecting lines. The first player places 2 black and 1 white piece on the board. The second player can then choose to: play as black, play as white and place another white piece, or place two more stones and let the other player choose which color to play. Players take turns placing pieces in an attempt to make 5 in a row. In the Standard version, rows of more than five do not count. Played on a 15x15 board. Open anywhere. Win with a line of exactly five stones. END" }, { "prompt": "Construct a Ludii game based on the following description\n4x8 board. Two counters in each hole. Before play, players may arrange their counters as they see fit in their holes. Players alternate turns sowing the counters from one of their holes in an anticlockwise direction. When the final counter lands in an empty hole, their turn is over. If the final counter lands in an occupied hole, the contents of the two opposite hole in the opponent's rows are captured. If both do not have counters, then the player picks up the counters from the hole the last counter fell into and continues sowing. The player who captures all of the opponent's counters wins. \n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (count in:(sites #1 \"Home\"))) (define \"Columns\" 8) (game \"Lisolo\" (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)))}) (rules (start (set Count 2 to:(union (sites P1 \"Home\") (sites P2 \"Home\")))) phases:{ (phase \"Opening\" (play (or (forEach Site (sites Mover \"Home\") (if (is Occupied (site)) (move (from (site)) (to (forEach (sites Mover \"Home\") if:(!= (to) (site))))))) (move Pass))) (nextPhase (all Passed) \"Sowing\")) (phase \"Sowing\" (play (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover)) if:(> (count at:(from)) 0)) (then (sow \"Track\" owner:(mover) apply:(if (> (count at:(to)) 1) (if (not (is In (to) (sites Mover \"Inner\"))) (moveAgain) (if (and (= 0 (count at:(\"OppositePit\" (to)))) (= 0 (count at:(\"OppositeOuterPit\" (to))))) (moveAgain) (and (if (!= 0 (count at:(\"OppositePit\" (to)))) (remove (\"OppositePit\" (to)) count:(count at:(\"OppositePit\" (to))))) (if (!= 0 (count at:(\"OppositeOuterPit\" (to)))) (remove (\"OppositeOuterPit\" (to)) count:(count at:(\"OppositeOuterPit\" (to))))))))))))))} (end (forEach Player if:(= 0 (\"PiecesOwnedBy\" Player)) (result Player Loss))))) 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": "Modify the Ludii game according to the following option changes:\nEach row has 12 holes. -> Each row has 14 holes.\n(define \"PiecesOwnedBy\" (+ (count Cell at:(handSite #1)) (count in:(sites #1 \"Home\")))) (define \"Columns\" 12) (game \"Okwe (Nigeria)\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" store:None { (track \"Track\" \"0,E,N,W\" loop:True) (track \"TrackSpecialHome1\" \"0,E\" loop:True P1) (track \"TrackSpecialHome2\" \"23,W\" loop:True P2)}) (regions \"OpeningRegion\" P1 (sites {17..20})) (regions \"OpeningRegion\" P2 (sites {5..3})) (piece \"Seed\" Shared) (hand Each) (map \"LeftMost\" {(pair P1 0) (pair P2 (- (* (\"Columns\") 2) 1))}) (regions \"Home\" P1 (sites Bottom)) (regions \"Home\" P2 (sites Top))}) (rules (start { (set Count 5 to:((sites {0..2 5 23..21 18}))) (set Count 1 to:((sites {3 4 6 20 19 17})))}) phases: { (phase \"Opening\" (play (move (from (sites Mover \"OpeningRegion\") if:(is Occupied (from))) (to (handSite Mover)) count:(count at:(from)))) (nextPhase (all Sites (union (sites P1 \"OpeningRegion\") (sites P2 \"OpeningRegion\")) if:(is Empty (site))) \"Sowing\")) (phase \"Sowing\" (play (or (move Select (from (sites Mover \"Home\") if:(is Occupied (from))) (then (sow \"Track\" apply:(if (and (is In (to) (sites Next \"Home\")) (or { (= 1 (count at:(\"OppositePitTwoRows\" (to)))) (= 3 (count at:(\"OppositePitTwoRows\" (to)))) (= 5 (count at:(\"OppositePitTwoRows\" (to))))})) (fromTo (from (\"OppositePitTwoRows\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePitTwoRows\" (to))))) origin:(< 1 (count at:(from)))))) (if (is Occupied Cell (handSite Mover)) (do (set Var \"NumToSow\" (count Cell at:(handSite Mover))) next:(move (from (handSite Mover)) (to (mapEntry \"LeftMost\" Mover)) count:(count Cell at:(handSite Mover)) (then (and (sow count:(var \"NumToSow\") \"TrackSpecialHome\" owner:(mover) origin:True) (set Var \"NumToSow\" 0)))))))))} (end (if (all Sites (sites Board) if:(= 0 (count at:(site)))) { (if (is Empty (handSite P1)) (result P2 Win)) (if (is Empty (handSite P2)) (result P1 Win))}))))\n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (+ (count Cell at:(handSite #1)) (count in:(sites #1 \"Home\")))) (define \"Columns\" 14) (game \"Okwe (Nigeria)\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" store:None { (track \"Track\" \"0,E,N,W\" loop:True) (track \"TrackSpecialHome1\" \"0,E\" loop:True P1) (track \"TrackSpecialHome2\" \"27,W\" loop:True P2)}) (regions \"OpeningRegion\" P1 (sites {20..23})) (regions \"OpeningRegion\" P2 (sites {6..4})) (piece \"Seed\" Shared) (hand Each) (map \"LeftMost\" {(pair P1 0) (pair P2 (- (* (\"Columns\") 2) 1))}) (regions \"Home\" P1 (sites Bottom)) (regions \"Home\" P2 (sites Top))}) (rules (start { (set Count 5 to:((sites {0..3 6 27..24 21}))) (set Count 1 to:((sites {4 5 7 22 23 20})))}) phases: { (phase \"Opening\" (play (move (from (sites Mover \"OpeningRegion\") if:(is Occupied (from))) (to (handSite Mover)) count:(count at:(from)))) (nextPhase (all Sites (union (sites P1 \"OpeningRegion\") (sites P2 \"OpeningRegion\")) if:(is Empty (site))) \"Sowing\")) (phase \"Sowing\" (play (or (move Select (from (sites Mover \"Home\") if:(is Occupied (from))) (then (sow \"Track\" apply:(if (and (is In (to) (sites Next \"Home\")) (or { (= 1 (count at:(\"OppositePitTwoRows\" (to)))) (= 3 (count at:(\"OppositePitTwoRows\" (to)))) (= 5 (count at:(\"OppositePitTwoRows\" (to))))})) (fromTo (from (\"OppositePitTwoRows\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePitTwoRows\" (to))))) origin:(< 1 (count at:(from)))))) (if (is Occupied Cell (handSite Mover)) (do (set Var \"NumToSow\" (count Cell at:(handSite Mover))) next:(move (from (handSite Mover)) (to (mapEntry \"LeftMost\" Mover)) count:(count Cell at:(handSite Mover)) (then (and (sow count:(var \"NumToSow\") \"TrackSpecialHome\" owner:(mover) origin:True) (set Var \"NumToSow\" 0)))))))))} (end (if (all Sites (sites Board) if:(= 0 (count at:(site)))) { (if (is Empty (handSite P1)) (result P2 Win)) (if (is Empty (handSite P2)) (result P1 Win))})))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6 board. Four counters in each hole. Sowing occurs in an anti-clockwise direction. The first player sows from the hole on their right. When the final counter lands in an occupied hole, the turn ends. When the final counter lands in an empty hole, that counter is captured. The player who captures the most counters wins. The game is played with 6 holes per row.\n\n###\n\n", "completion": "(define \"Column\" 6) (define \"PiecesOwnedBy\" (count Cell at:(handSite #1))) (game \"Um el-Bil\" (players 2) (equipment { (mancalaBoard 2 \"Column\" store:None (track \"Track\" \"0,E,N,W\" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 4 to:(sites Track))) phases:{ (phase \"Opening\" (play (move Select (from (- (\"Column\") 1)) (then (sow if:(= (count at:(to)) 1) apply:(fromTo (from (to)) (to (handSite Mover)) count:1))))) (nextPhase \"Play\")) (phase \"Play\" (play (move Select (from (sites Mover) if:(< 0 (count at:(from)))) (then (sow if:(= (count at:(to)) 1) apply:(fromTo (from (to)) (to (handSite Mover)) count:1))))))} (end (\"MancalaByScoreWhen\" (all Sites (sites Board) if:(is Empty (site))))))) 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\n2x12 board, divided in half. Spaces on each side take the form of points. Fifteen pieces per player. Three 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. One player begins with all of their pieces on the space furthest to the left on their side, the other with their pieces on the point directly opposite it. Pieces move in opposite directions around the board, toward the point where the opponent's pieces begin, and bearing off the board from there. A player cannot have two of their pieces on the same spot in the starting quadrant. When a piece lands on the same space as a single opponent's piece, the opponent's piece is sent back to where it began. The first person to bear off all their pieces wins. \n\n###\n\n", "completion": "(define \"CanEscape\" (\"IsOffBoard\" #1)) (define \"AllPieceEscaped\" (no Pieces Mover)) (define \"NotEnemyOrOnlyOne\" (or (and (\"IsEnemyAt\" (to)) (\"IsSingletonStack\" (to))) (and (if (not (is In (to) (sites Mover))) True (is Empty (to))) (not (\"IsEnemyAt\" (to)))))) (define \"Bar\" (mapEntry (mover))) (define \"RemoveAPiece\" (move Remove (site))) (define \"NextSiteFromDist6\" (\"NextSiteOnTrack\" 6 from:#1)) (define \"NextSiteFrom\" (\"NextSiteOnTrack\" (pips) from:#1)) (game \"Ludus Anglicorum\" (players 2) (equipment { (\"BackgammonBoard\" { (track \"Track1\" {6 0..5 7..12 25..20 18..12} P1 directed:True) (track \"Track2\" {19 12..18 20..25 12..7 5..0} P2 directed:True)}) (dice num:3) (map {(pair 1 19) (pair 2 6)}) (piece \"Disc\" Each) (regions P1 { 0..5}) (regions P2 { 13..18})}) (rules (start { (place Stack \"Disc1\" 0 count:15) (place Stack \"Disc2\" 13 count:15)}) (play (\"RollEachNewTurnMove\" (forEach Die if:(\"DieNotUsed\") (forEach Site (sites Occupied by:Mover) (if (\"CanEscape\" (\"NextSiteFrom\" (site))) (\"RemoveAPiece\") (move (from (site)) (to (\"NextSiteFrom\" (site)) if:(\"NotEnemyOrOnlyOne\") (\"HittingCapture\" (\"Bar\")))))) (then (\"ReplayNotAllDiceUsed\"))))) (end (if (\"AllPieceEscaped\") (result Mover Win))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game is played on a board with 8 hexes per side. -> The game is played on a board with 9 hexes per side.\n(define \"IsPlayingPhase\" (= 1 (var))) (define \"LimpCorners\" (start { (place \"Disc2\" { 0 (- (/ (+ (* {3 #1 #1}) #1) 2) 1) (- (* 3 (* #1 #1)) #1)}) (place \"Disc2\" { #1 (/ (- (* {3 #1 #1}) (* 3 #1)) 2) (- (* 3 (* #1 #1)) 1)})})) (define \"Skip\" (move Set NextPlayer (player (next)))) (define \"HexCorners\" (start { (place \"Disc2\" { 0 (- (/ (- (* {3 #1 #1}) #1) 2) 1) (+ 1 (- (* {3 #1 #1}) (* 4 #1)))}) (place \"Disc2\" {(- #1 1) (+ 1 (/ (- (* {3 #1 #1}) (* 5 #1)) 2)) (- (* {3 #1 #1}) (* 3 #1))})})) (define \"BlackVC\" (is Loop)) (define \"WhiteVC\" (is Full)) (define \"NonAdjacent\" (not (is Within (id \"Disc\" P2) in:(sites Around (to))))) (define \"Size\" 8) (game \"Coil\" (players 2) (equipment { (board (hex Hexagon 8)) (piece \"Disc\" Each)}) (rules (\"HexCorners\" \"Size\") phases: { (phase \"Opening\" (play (or (or (move Add (piece (id \"Disc\" P2)) (to (sites Empty) if:\"NonAdjacent\") (then (if (< (count MovesThisTurn) 2) (moveAgain)))) \"Skip\") (if (= (count MovesThisTurn) 0) (move Pass (then (if (is Mover P1) (swap Players P1 P2 (then (note \"Player 1 is now Black. Player 2 is now White.\" to:All))) (note \"Player 1 remains White. Player 2 remains Black.\" to:All) (then (do (set NextPlayer (player 1)) next:(set Var 1))))))))) (nextPhase (\"IsPlayingPhase\") \"Playing\")) (phase \"Playing\" (play (move Add (to (sites Empty)))))} (end (forEach Player if:(and {(\"IsPlayingPhase\") (= (id Player) (mover)) (\"BlackVC\")}) (result Player Win)))))\n\n###\n\n", "completion": "(define \"IsPlayingPhase\" (= 1 (var))) (define \"LimpCorners\" (start { (place \"Disc2\" { 0 (- (/ (+ (* {3 #1 #1}) #1) 2) 1) (- (* 3 (* #1 #1)) #1)}) (place \"Disc2\" { #1 (/ (- (* {3 #1 #1}) (* 3 #1)) 2) (- (* 3 (* #1 #1)) 1)})})) (define \"Skip\" (move Set NextPlayer (player (next)))) (define \"HexCorners\" (start { (place \"Disc2\" { 0 (- (/ (- (* {3 #1 #1}) #1) 2) 1) (+ 1 (- (* {3 #1 #1}) (* 4 #1)))}) (place \"Disc2\" {(- #1 1) (+ 1 (/ (- (* {3 #1 #1}) (* 5 #1)) 2)) (- (* {3 #1 #1}) (* 3 #1))})})) (define \"BlackVC\" (is Loop)) (define \"WhiteVC\" (is Full)) (define \"NonAdjacent\" (not (is Within (id \"Disc\" P2) in:(sites Around (to))))) (define \"Size\" 9) (game \"Coil\" (players 2) (equipment { (board (hex Hexagon 9)) (piece \"Disc\" Each)}) (rules (\"HexCorners\" \"Size\") phases: { (phase \"Opening\" (play (or (or (move Add (piece (id \"Disc\" P2)) (to (sites Empty) if:\"NonAdjacent\") (then (if (< (count MovesThisTurn) 2) (moveAgain)))) \"Skip\") (if (= (count MovesThisTurn) 0) (move Pass (then (if (is Mover P1) (swap Players P1 P2 (then (note \"Player 1 is now Black. Player 2 is now White.\" to:All))) (note \"Player 1 remains White. Player 2 remains Black.\" to:All) (then (do (set NextPlayer (player 1)) next:(set Var 1))))))))) (nextPhase (\"IsPlayingPhase\") \"Playing\")) (phase \"Playing\" (play (move Add (to (sites Empty)))))} (end (forEach Player if:(and {(\"IsPlayingPhase\") (= (id Player) (mover)) (\"BlackVC\")}) (result Player Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nForty stones are arranged in a circle, with a larger gap between every tenth and eleventh stone. The gaps between the stones are the playing spaces. One piece per player. Any number of players. Three sticks used as dice, marked on one side and blank on the other. Throws are as follows: One marked side up = 3, two marked sides up = 2, three marked sides up = 10; all blank sides up = 5. Players enter their pieces from one of the wider gaps in the board, and chooses to move either clockwise or anti-clockwise. When a player's piece lands on a space occupied by the opponent, the opponent's piece is sent back to the space in which they entered. The first player to complete the circuit wins. The game has 2 players. Captures are possible.\n\n###\n\n", "completion": "(define \"MadeACompleteCircuit\" (if (= 1 (value Player Mover)) (is In (value Piece at:(where \"Marker\" Mover)) (sites Track \"TrackCW\" from:(\"NextSite\" (last From) \"TrackCW\") to:(last To))) (is In (value Piece at:(where \"Marker\" Mover)) (sites Track \"TrackCCW\" from:(\"NextSite\" (last From) \"TrackCCW\") to:(last To))))) (define \"MoveOn\" (if (\"IsNotOffBoard\" #1) (if (or (is In #1 (sites Empty)) (\"IsEnemyAt\" #1)) (move (from (from) level:(level)) (to #1 (\"HittingCapture\" (value Piece at:(to)))))) #2)) (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 \"NextSite\" (\"NextSiteOnTrack\" 1 from:#1 #2)) (define \"SiteToMoveOnSelectedTrack\" (if (= (value Player Mover) 2) (\"NextSiteOnTrack\" (\"ThrowValue\") \"TrackCCW\") (\"NextSiteOnTrack\" (\"ThrowValue\") \"TrackCW\"))) (define \"ThrowValue\" (mapEntry \"ThrowDiceValue\" (count Pips))) (game \"Patol\" (players 2) (equipment { (\"FortyStonesWithFourGapsBoard\" { (track \"TrackCW\" {39 35 33 31 29 27 25 23 21 19 38 17 15 13 11 9 7 5 3 1 37 0 2 4 6 8 10 12 14 16 36 18 20 22 24 26 28 30 32 34} loop:True) (track \"TrackCCW\" {39 34 32 30 28 26 24 22 20 18 36 16 14 12 10 8 6 4 2 0 37 1 3 5 7 9 11 13 15 17 38 19 21 23 25 27 29 31 33 35} loop:True)}) (regions \"Gates\" (sites {36..39})) (piece \"Marker\" Each (if (\"IsOffBoard\" (value Player Mover)) (or (\"MoveOn\" (\"SiteToMoveOnTrackCW\") (\"RememberSelectedTrack\" (\"SelectCW\"))) (\"MoveOn\" (\"SiteToMoveOnTrackCCW\") (\"RememberSelectedTrack\" (\"SelectCCW\")))) (\"MoveOn\" \"SiteToMoveOnSelectedTrack\"))) (\"StickDice\" 3) (map \"ThrowDiceValue\" {(pair 0 5) (pair 1 3) (pair 2 2) (pair 3 10)}) (hand Each)}) (rules (start (place \"Marker\" \"Hand\")) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (sites \"Gates\")) (then (set Value at:(last To) (last To))))) (nextPhase Mover \"Playing\")) (phase \"Playing\" (play (\"RollMove\" (forEach Piece))) (end (if (\"MadeACompleteCircuit\") (result Mover Win))))})) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"Custodial\" (custodial (from (last To)) All (between if:(is Next (who at:(between))) (apply (remove (between)))) (to if:(and (= 3 (count Steps Vertex All (last To) (to))) (is Mover (who at:(to))))) (then (addScore Mover 1)))) (game \"Pente\" (players 2) (equipment { (board (square 19) use:Vertex) (piece \"Ball\" Each)}) (rules (start (set Score Each 0)) phases:{ (phase \"Opening\" (play (move Add (to (sites \"J10\")))) (nextPhase \"General\")) (phase \"General\" (play (move Add (to (sites Empty)) (then \"Custodial\"))))} (end { (if (is Line 5 All) (result Mover Win)) (if (> (score Mover) 9) (result Mover Win))})))\n\n###\n\n", "completion": "Pente is played on a 19x19 Go board. White goes first, and plays their first move on the centre point (unless playing Freestyle). In the Pro Pente variation, White's second move must be at least 3 points away from the centre. After the opening, players alternate playing one stone of their colour onto any empty point. If their placement results in a pair of enemy stones being sandwiched between two of their own stones, those enemy stones are captured. The first player to form an orthogonal or diagonal line of five (or more) of their stones, or to capture 10 enemy stones, wins the game. Played on a 19x19 board. Open at the centre point. END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayed on an 8x8 board. 16 pieces per player, lined up in the second and third rows (first row on each side is empty). Pieces move forward or horizontally one space, and capture opponents' pieces by jumping in these directions. When they reach the opposite side, they become a king and can jump opponents' pieces from any distance orthogonally. Captures must be taken if possible, and the maximum number of jumps must be made. Multiple captures cannot be made by moving 180 degrees from the previous jump. Pieces can be promoted to king mid-jump. Winning is achieved by capturing all of the other player's pieces or by blocking them so they cannot move. \n\n###\n\n", "completion": "(define \"JumpToPromotionZone\" (is In (last To) (sites Next))) (define \"IsUnpromoted\" (\"IsPieceAt\" \"Counter\" Mover (last To))) (define \"HopMan\" (\"HopCapture\" (from #1) (directions {Forward Rightward Leftward}) #2)) (define \"PromotedHopOrthogonalSequenceCapture\" (\"HopCaptureDistance\" #1 #2 ~ (then (\"ReplayIfCanMove\" (\"HopCaptureDistanceNotAlreadyHopped\" (from (last To)) (difference Orthogonal OppositeDirection)))))) (game \"Dama\" (players 2) (\"DraughtsEquipment\" (square 8)) (rules (start { (place \"Counter1\" (union (sites Row 1) (sites Row 2))) (place \"Counter2\" (union (sites Row 5) (sites Row 6)))}) (play (if \"SameTurn\" (if \"IsUnpromoted\" (max Moves (\"HopMan\" (last To) (then (\"ReplayIfCanMove\" (\"HopMan\" (last To)) (\"PromoteIfReach\" (sites Next) \"DoubleCounter\"))))) (max Moves (\"PromotedHopOrthogonalSequenceCapture\" (from (last To)) (difference Orthogonal OppositeDirection)))) (priority { (max Moves (or (forEach Piece \"Counter\" (\"HopMan\" (from) (then (\"ReplayIfCanMove\" (\"HopMan\" (last To)) (\"PromoteIfReach\" (sites Next) \"DoubleCounter\"))))) (forEach Piece \"DoubleCounter\" (\"PromotedHopOrthogonalSequenceCapture\" (from) Orthogonal)))) (or (forEach Piece \"Counter\" (\"StepToEmpty\" (directions {Forward Rightward Leftward})) (then (\"PromoteIfReach\" (sites Next) \"DoubleCounter\"))) (forEach Piece \"DoubleCounter\" (move Slide Orthogonal)))}))) (end (\"BlockWin\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\n12x12 board. 24 pieces per player. Pieces begin on the board in the following arrangement, and with the following movements: Outer row, from left corner: Rukh: moves orthogonally any distance; Ghora: moves orthogonally one space and then diagonally another space, jumping over the first space; Dahja: moves orthogonally any distance; Ratha: moves orthogonally any distance; Fil: moves diagonally any distance; Wazir: moves diagonally or orthogonally any distance; Padshah: moves one space in any direction; Fil, Ratha, Dahja, Ghora, Rukh. In the second row are twelve Paidal: moves one square forward orthogonally or one diagonally to capture. Players alternate turns moving a piece to a space on the board. If one of the opponent's pieces is on the space to which a player moves their piece, the opponent's piece is captured. If the Padshah can be captured on the opponent's next turn, it is in check. The Padshah cannot remain in check at the end of the player's turn. If this is not possible, it is checkmate and the opponent wins.\n \n\n###\n\n", "completion": "(game \"Shatranj (12x12)\" (players 2) (equipment { (board (square 12)) (\"ChessPawn\" \"Pawn\") (\"ChessRook\" \"Rook\") (\"ChessRook\" \"Commoner\") (\"ChessRook\" \"Wazir\") (\"ChessKing\" \"King_noCross\") (\"ChessBishop\" \"Bishop_noCross\") (\"ChessKnight\" \"Knight\") (\"ChessQueen\" \"Queen\")}) (rules (start { (place \"Pawn1\" (sites Row 1)) (place \"Pawn2\" (sites Row 10)) (place \"Rook1\" {\"A1\" \"L1\"}) (place \"Knight1\" {\"B1\" \"K1\"}) (place \"Commoner1\" {\"C1\" \"J1\"}) (place \"Wazir1\" {\"D1\" \"I1\"}) (place \"Bishop_noCross1\" {\"E1\" \"H1\"}) (place \"Queen1\" coord:\"F1\") (place \"King_noCross1\" coord:\"G1\") (place \"Rook2\" {\"A12\" \"L12\"}) (place \"Knight2\" {\"B12\" \"K12\"}) (place \"Commoner2\" {\"C12\" \"J12\"}) (place \"Wazir2\" {\"D12\" \"I12\"}) (place \"Bishop_noCross2\" {\"E12\" \"H12\"}) (place \"Queen2\" coord:\"G12\") (place \"King_noCross2\" coord:\"F12\")}) (play (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King_noCross\" Mover)))) (end (\"Checkmate\" \"King_noCross\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\nChess-Breakthrough is played using a regular chess board and pieces and from the standard chess start position. The first player to place a pawn or a knight on the opponent\u2019s backrank wins (thus no promotions). The normal chess rules for piece movements have also been slightly modified to fit our simplified boardgame framework: castling, en-passant, and two-step pawn moves are not allowed; a king can be moved into and left in check (and thus captured); and the draw-by-threefold-repetition and 50-move rules do not apply. \n\n###\n\n", "completion": "(define \"LastMoveWasPawn\" (\"IsPieceAt\" \"Pawn\" Mover (last To))) (define \"LastMoveWasKnight\" (\"IsPieceAt\" \"Knight\" Mover (last To))) (define \"ReachedTarget\" (is In (last To) (sites Mover))) (game \"Breakthrough Chess\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (\"ChessPawn\" \"Pawn\") (\"ChessRook\" \"Rook\") (\"ChessKing\" \"King\") (\"ChessBishop\" \"Bishop\") (\"ChessKnight\" \"Knight\") (\"ChessQueen\" \"Queen\") (regions P1 (sites Top)) (regions 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 (forEach Piece)) (end (if (and \"ReachedTarget\" (or \"LastMoveWasKnight\" \"LastMoveWasPawn\")) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n3x6 board. Three counters per hole. Each player owns the row of holes closest to them, as well as the right half of the central row, with respect to their perspective. Sowing occurs from left to right in the player's complete row, right to left in the player's half of the central row, then continuing from right to left in the opponent's outer row, left to right in the opponent's holes in the central row, and then continuing as before into the player's outer row. In the opening phase, players play simultaneously. When the final counter of a sowing falls into an occupied hole, the contents are picked up and sowing continues. Each player plays until their final counter falls into an empty hole; the first player to do so begins the main phase. In the main phase, players alternate turns, and picking up the counters and continuing to sow when the final counter lands in an occupied hole, and stopping when the final counter lands in an empty hole. There are some restrictions with regard to sowing. Each of the player's three leftmost holes cannot be sown from to begin a turn if they contain three counters or less, unless there are no other options for play, in which case sowing must occur from a hole with one counter, and if none are available, then it must begin from a hole with two counters, or three counters if that is the only option. Separately, if the player's other holes only contain two or three counters, the player must play from a hole containing two counters, and these must be the option closest to the opponent's holes. Players must also play from holes containing more than three counters when available. During sowing, a player may not drop a counter into any of the opponent's holes which contain three counters (except when making a nedf, see below), skipping over them and sowing in the next available holes. When the final counter of a sowing lands in a hole in the opponent's row containing three counters, this hole becomes a \\ \n\n###\n\n", "completion": "(define \"OnlyHolesWithTwoOrThree\" (all Sites (intersection (sites Mover \"Home\") (sites Mover \"ThreeLeftMost\")) if:(or (= 2 (count at:(site))) (= 3 (count at:(site)))))) (define \"NextHole\" (\"NextSiteOnTrack\" #2 from:#1 \"Track\")) (define \"NoNedf\" (all Sites (sites Board) if:(!= (mover) (state at:(site))))) (define \"Columns\" 6) (game \"Selus\" (players 2) (equipment { (mancalaBoard 3 \"Columns\" store:None (track \"Track\" \"0,E,N1,W2,17,W,S1,E2\" loop:True)) (piece \"Seed\" Shared) (hand Each) (regions \"Home\" P1 (union (intersection (sites Row 1) (expand (sites Right) steps:2)) (sites Bottom))) (regions \"Home\" P2 (union (intersection (sites Row 1) (expand (sites Left) steps:2)) (sites Top))) (regions \"ThreeLeftMost\" P1 (intersection (sites Bottom) (expand (sites Left) steps:2))) (regions \"ThreeLeftMost\" P2 (intersection (sites Top) (expand (sites Right) steps:2)))}) (rules (start (set Count 3 to:(sites Board))) (play (priority { (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (sites Mover)) if:(< 3 (count at:(site)))) (then (do (set Var \"NumSowed\" (count at:(last From))) next:(sow apply:(if (< 1 (count at:(to))) (if (and { (= 0 (state at:(to))) (= 4 (count at:(to))) (\"NoNedf\") (is In (to) (sites Next))}) (set State at:(to) (mover)) (and (moveAgain) (set Var \"Replay\" (to))))) skipIf:(and (= 3 (count at:(to))) (is In (to) (sites Next))))))) (if (\"OnlyHolesWithTwoOrThree\") (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (sites Mover)) if:(= 2 (count at:(site)))) (then (do (set Var \"NumSowed\" (count at:(last From))) next:(sow apply:(if (< 1 (count at:(to))) (if (and { (= 0 (state at:(to))) (= 4 (count at:(to))) (\"NoNedf\") (is In (to) (sites Next))}) (set State at:(to) (mover)) (and (moveAgain) (set Var \"Replay\" (to))))) skipIf:(and (= 3 (count at:(to))) (is In (to) (sites Next)))))))) (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (sites Mover)) if:(and (is Occupied (from)) (if (\"SameTurn\") True (if (is In (to) (sites Mover \"ThreeLeftMost\")) (< 3 (count at:(to))) True)))) (then (do (set Var \"NumSowed\" (count at:(last From))) next:(sow apply:(if (< 1 (count at:(to))) (if (and { (= 0 (state at:(to))) (= 4 (count at:(to))) (\"NoNedf\") (is In (to) (sites Next))}) (set State at:(to) (mover)) (and (moveAgain) (set Var \"Replay\" (to))))) skipIf:(and (= 3 (count at:(to))) (is In (to) (sites Next))))))) (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (sites Mover \"ThreeLeftMost\")) if:(and (= 1 (count at:(from))) (is Occupied (from)))) (then (do (set Var \"NumSowed\" (count at:(last From))) next:(sow apply:(if (< 1 (count at:(to))) (if (and { (= 0 (state at:(to))) (= 4 (count at:(to))) (\"NoNedf\") (is In (to) (sites Next))}) (set State at:(to) (mover)) (and (moveAgain) (set Var \"Replay\" (to))))) skipIf:(and (= 3 (count at:(to))) (is In (to) (sites Next))))))) (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (sites Mover \"ThreeLeftMost\")) if:(and (= 2 (count at:(from))) (is Occupied (from)))) (then (do (set Var \"NumSowed\" (count at:(last From))) next:(sow apply:(if (< 1 (count at:(to))) (if (and { (= 0 (state at:(to))) (= 4 (count at:(to))) (\"NoNedf\") (is In (to) (sites Next))}) (set State at:(to) (mover)) (and (moveAgain) (set Var \"Replay\" (to))))) skipIf:(and (= 3 (count at:(to))) (is In (to) (sites Next))))))) (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (sites Mover \"ThreeLeftMost\")) if:(and (= 3 (count at:(from))) (is Occupied (from)))) (then (do (set Var \"NumSowed\" (count at:(last From))) next:(sow apply:(if (< 1 (count at:(to))) (if (and { (= 0 (state at:(to))) (= 4 (count at:(to))) (\"NoNedf\") (is In (to) (sites Next))}) (set State at:(to) (mover)) (and (moveAgain) (set Var \"Replay\" (to))))) skipIf:(and (= 3 (count at:(to))) (is In (to) (sites Next)))))))})) (end (\"BlockWin\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6 board, with stores on either end. The store to a player's left belongs to them. Four counters in each hole. Players sow in an anti-clockwise direction from any hole in their row. When the final counter lands in a hole in the opponent's row, causing it to contain two or four counters, these are captured and put in the store. The player also captures the contents of any adjacent holes in the opponent's row if they also contain two or four counters. Play continues until one player has no counters in their row, their opponent capturing the remaining counters. A new round begins. Players fill up their holes with four counters, beginning from the left. Any excess counters are placed in that player's store; the final hole of the player with fewer counters may contain fewer than four counters. Any empty holes are out of play. Play continues as before. The game repeats in this fashion until one player has no counters remaining, their opponent is the winner. \n\n###\n\n", "completion": "(define \"LeftMostEmpty\" (trackSite FirstSite from:(mapEntry \"LeftMost\" Mover) if:(is Empty (to)))) (define \"OneRowIsEmpty\" (or (all Sites (sites Bottom) if:(= 0 (count at:(site)))) (all Sites (sites Top) if:(= 0 (count at:(site)))))) (define \"NoPieceOnBoard\" (all Sites (union (sites Top) (sites Bottom)) if:(= 0 (count at:(site))))) (define \"EastHoleExist\" (!= (to) (\"EastHole\"))) (define \"EastHole\" (ahead (to) E)) (define \"WestHoleExist\" (!= (to) (\"WestHole\"))) (define \"WestHole\" (ahead (to) W)) (define \"PlayableSites\" (sites (values Remembered \"Playable\"))) (define \"PiecesOwnedBy\" (+ (count at:(mapEntry #1)) (count in:(sites #1)))) (game \"Erherhe\" (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)}) (map \"LeftMost\" {(pair P1 1) (pair P2 12)}) (piece \"Seed\" Shared)}) (rules (start { (set Count 4 to:(sites Track)) (set RememberValue \"Playable\" (union (sites Top) (sites Bottom)))}) phases:{ (phase \"Sowing\" (play (or { (move Select (from (sites Mover) if:(and (is Occupied (from)) (is In (from) (\"PlayableSites\")))) (then (sow apply:(if (and (is In (to) (sites Next)) (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\")))))})) skipIf:(not (is In (to) (\"PlayableSites\"))))))} (then (if (\"OneRowIsEmpty\") (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)))) (forget Value \"Playable\" All)}))))) (end (if (\"NoPieceOnBoard\") { (if (= 0 (count at:(mapEntry P1))) (result P2 Win)) (if (= 0 (count at:(mapEntry P2))) (result P1 Win))})) (nextPhase (\"NoPieceOnBoard\") \"BetweenRounds\")) (phase \"BetweenRounds\" (play (if (not (all Sites (sites Mover) if:(is Occupied (site)))) (if (<= 4 (count at:(mapEntry Mover))) (move (from (mapEntry Mover)) (to \"LeftMostEmpty\") count:4 (then (remember Value \"Playable\" (last To)))) (move (from (mapEntry Mover)) (to \"LeftMostEmpty\") count:(count at:(mapEntry Mover)) (then (remember Value \"Playable\" (last To))))))) (nextPhase (all Passed) \"Sowing\"))})) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\n5 Square -> 7 Square\n(define \"SquareGraphics\" (graphics { (board Style Go) (piece Background image:\"square.svg\" edgeColour:(colour 100 100 100 255)) (piece Foreground image:\"cross.svg\" edgeColour:(colour 100 100 100 255)) (piece Colour strokeColour:(colour 100 100 100 255)) (piece Scale .26) (show Piece Value CornerLeft valueOutline:True scale:1.5)})) (define \"HexGraphics\" (graphics { (board Colour OuterEdges (colour Black)) (board Colour InnerEdges (colour Black)) (board StyleThickness OuterEdges 1.5) (board StyleThickness InnerEdges 0.4) (board StyleThickness InnerVertices 0.4) (board StyleThickness OuterVertices 0.4) (board Colour Symbols (colour Black)) (player Colour P1 (colour Black)) (player Colour P2 (colour LightOrange)) (region Colour (sites Occupied by:P1) (colour 60 120 170 120)) (region Colour (sites Occupied by:P2) (colour 195 195 200 120)) (show Piece Value Middle valueOutline:False scale:.8)})) (define \"SetNewGroupValue\" (forEach Site (sites Group at:(last To) All) (set Value at:(site) (count Sites in:(sites Group at:(last To) All))))) (define \"ToToSites\" (to (difference (sites Empty) (forEach of:(sites Occupied by:Mover) (if (>= (value Piece at:(site)) (score Mover)) (sites Around (site) All)))))) (game \"Ecosys\" (players 2) (equipment { ((board (square Square 5) use:Vertex)) (piece \"Disc\" Each)}) (rules (start (set Score Each 0)) (play (move Add (\"ToToSites\") (then (and (\"SetNewGroupValue\") (set Score Mover (size Array (sizes Group All Mover))))))) (end (\"NoMoves\" Loss))))\n\n###\n\n", "completion": "(define \"SquareGraphics\" (graphics { (board Style Go) (piece Background image:\"square.svg\" edgeColour:(colour 100 100 100 255)) (piece Foreground image:\"cross.svg\" edgeColour:(colour 100 100 100 255)) (piece Colour strokeColour:(colour 100 100 100 255)) (piece Scale .26) (show Piece Value CornerLeft valueOutline:True scale:1.5)})) (define \"HexGraphics\" (graphics { (board Colour OuterEdges (colour Black)) (board Colour InnerEdges (colour Black)) (board StyleThickness OuterEdges 1.5) (board StyleThickness InnerEdges 0.4) (board StyleThickness InnerVertices 0.4) (board StyleThickness OuterVertices 0.4) (board Colour Symbols (colour Black)) (player Colour P1 (colour Black)) (player Colour P2 (colour LightOrange)) (region Colour (sites Occupied by:P1) (colour 60 120 170 120)) (region Colour (sites Occupied by:P2) (colour 195 195 200 120)) (show Piece Value Middle valueOutline:False scale:.8)})) (define \"SetNewGroupValue\" (forEach Site (sites Group at:(last To) All) (set Value at:(site) (count Sites in:(sites Group at:(last To) All))))) (define \"ToToSites\" (to (difference (sites Empty) (forEach of:(sites Occupied by:Mover) (if (>= (value Piece at:(site)) (score Mover)) (sites Around (site) All)))))) (game \"Ecosys\" (players 2) (equipment { ((board (square Square 7) use:Vertex)) (piece \"Disc\" Each)}) (rules (start (set Score Each 0)) (play (move Add (\"ToToSites\") (then (and (\"SetNewGroupValue\") (set Score Mover (size Array (sizes Group All Mover))))))) (end (\"NoMoves\" Loss)))) 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\nPlayed on an 8x8 board with pieces with specialized moves: Pawns (8): can move one space forward or two on their first turn, capture diagonally one space forward; Rooks (2): can move any number of spaces orthogonally; Bishops (2): can move any number of spaces diagonally; Knight (2): moves in any direction, one space orthogonally with one space forward diagonally; Queens (1): can move any number of spaces orthogonally or diagonally; Kings (1): can move one space orthogonally or diagonally. Players move three pieces on their first turn. Players capture pieces by moving onto a space occupied by an opponent's piece. When a king can be captured on the next turn, it is in check, and the king must not be in check at the beginning of the opponent's next turn. If this is not possible, it is checkmate, and the opponent wins.\n \n\n###\n\n", "completion": "(define \"CaptureForwardDiagonal\" (move Step (directions {FR FL}) (to if:(\"IsEnemyAt\" (to)) (apply (remove (to)))))) (define \"KingNotCheckedAndToEmpty\" (and (is Empty (to)) (not (\"IsInCheck\" \"King\" Mover at:(to))))) (define \"CaptureToPiece\" (apply (if (\"IsEnemyAt\" (to)) (remove (to))))) (define \"RememberPieceHasMoved\" (then (if (= (state at:(last To)) 1) (\"PieceHasMoved\" (last To))))) (define \"PieceHasMoved\" (set State at:#1 0)) (define \"HasNeverMoved\" (= (state at:(mapEntry #1 (mover))) 1)) (define \"NextCanNotMove\" (not (can Move (do (forEach Piece Next) ifAfterwards:(not (\"IsInCheck\" \"King\" Next)))))) (game \"Shatera\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (piece \"Pawn\" Each (or { (if (is In (from) (sites Start (piece (what at:(from))))) (\"DoubleStepForwardToEmpty\")) \"StepForwardToEmpty\" \"CaptureForwardDiagonal\"})) (piece \"Rook\" Each (move Slide Orthogonal (to if:(\"IsEnemyAt\" (to)) \"CaptureToPiece\"))) (piece \"King\" Each (move Step (to if:(not (\"IsFriendAt\" (to))) \"CaptureToPiece\"))) (piece \"Bishop\" Each (move Slide Diagonal (to if:(\"IsEnemyAt\" (to)) \"CaptureToPiece\"))) (piece \"Knight\" Each (move Leap \"KnightWalk\" (to if:(not (\"IsFriendAt\" (to))) \"CaptureToPiece\"))) (piece \"Queen\" Each (move Slide (to if:(\"IsEnemyAt\" (to)) \"CaptureToPiece\"))) (regions \"Promotion\" P1 (sites Top)) (regions \"Promotion\" P2 (sites Bottom))}) (rules (start { (place \"Pawn1\" (sites Row 1)) (place \"Pawn2\" (sites Row 6)) (place \"Rook1\" {\"A1\" \"H1\"}) (place \"Knight1\" {\"B1\" \"G1\"}) (place \"Bishop1\" {\"C1\" \"F1\"}) (place \"Queen1\" coord:\"D1\") (place \"King1\" coord:\"E1\") (place \"Rook2\" {\"A8\" \"H8\"}) (place \"Knight2\" {\"B8\" \"G8\"}) (place \"Bishop2\" {\"C8\" \"F8\"}) (place \"Queen2\" coord:\"D8\") (place \"King2\" coord:\"E8\")}) phases:{ (phase \"Opening\" (play (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King\" Mover)) (then (and (set Value Mover (+ 1 (value Player Mover))) (if (!= (value Player Mover) 1) (moveAgain)))))) (nextPhase Mover (= 2 (value Player Mover)) \"Playing\")) (phase \"Playing\" (play (if \"SameTurn\" (move Promote (last To) (piece {\"Queen\" \"Knight\" \"Bishop\" \"Rook\"}) Mover) (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King\" Mover))))))} (end (if (and (\"IsInCheck\" \"King\" Next) (\"NextCanNotMove\")) (result Mover Win))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"PiecesOwnedBy\" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (define \"Sow\" (move Select (from (sites Mover #1) if:(> (count at:(from)) 1)) (then (sow #2 if:(and (is In (to) (sites Next \"Home\")) (or (= (count at:(to)) 2) (= (count at:(to)) 4))) apply:(fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))) backtracking:True)))) (game \"Um el-Bagara\" (players 2) (equipment { (mancalaBoard 2 5 store:None { (track \"TrackCCW\" \"0,E,N,W\" loop:True) (track \"TrackCW\" \"4,W,N,E\" loop:True)}) (regions \"Home1\" P1 (sites Bottom)) (regions \"Home2\" P2 (sites Top)) (regions \"Left1\" P1 (sites {0..2})) (regions \"Left2\" P2 (sites {9..7})) (regions \"Right1\" P1 (sites {2..4})) (regions \"Right2\" P2 (sites {7..5})) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 5 to:(sites Track))) (play (or (\"Sow\" \"Left\" \"TrackCW\") (\"Sow\" \"Right\" \"TrackCCW\"))) (end (\"MancalaByScoreWhen\" (all Passed)))))\n\n###\n\n", "completion": "2x5 board. Play begins with five counters in each hole. Players sow from any one of their holes. Sowing can occur in the following directions: From the leftmost two holes: clockwise. From the rightmost two holes: anti-clockwise. from the center hole: the player may choose either direction. If the final counter falls into a hole in the opponent's row containing either one or three counters, making it now contain two or four, these are taken. If the holes before them also contain two or four, in an unbroken sequence, they may all be captured. Single counters cannot be sown. When neither player can move, the single counters in each player's rows are taken by the player belonging to those rows. The player with the most counters wins. END" }, { "prompt": "Construct a Ludii game based on the following description\n10x10 board. Twenty pieces per player, arrayed on the dark-colored spaces. The square in the left-hand corner closest to the player is a dark square. Pieces move one space forward diagonally. When a piece arrives at the furthest rank opposite their starting position, it becomes a king. Kings may move diagonally, forward or backward, any number of spaces (like a bishop in Chess). Captures are made by hopping over an adjacent piece in a diagonal or orthogonal direction, including backwards. Multiple captures are allowed, in which the player may change direction. Kings capture by flying leap. Captures are mandatory, and the maximum capture should be made based on the value of pieces. Kings are worth less than twice the number of regular pieces, but more than twice the number of pieces minus one. (e.g., three kings are worth less than six pieces, but more than five pieces). If more than one maximum capture has the same value, the one that captures more kings takes precedence. It is permitted to use the same space more than once, but not to hop over the same piece twice. Captured pieces are removed after the turn is complete. The maximum capture can be enforced when the opponent catches it, though the opponent may opt not to point it out. A king cannot make three non-capturing moves in a row without moving another king or piece. This rule does not apply if the player only has one king remaining. If one player has only two kings remaining and the opponent has only one king remaining, the player with two kings must win in seven turns. If they do not, the game is a draw. If both players have only one king remaining and neither of them is able to capture or will be forced into a position where their king will be captured on the next turn, the game is a draw. The player who captures all of their opponent's pieces wins, or if they cannot make a legal move. Standard Frisian draughts\n\n###\n\n", "completion": "(define \"TwoKingsMoverOneKingEnemy\" (and { (\"IsOffBoard\" (where \"Counter\" P1)) (\"IsOffBoard\" (where \"Counter\" P2)) (= 1 (count Pieces Next)) (= 2 (count Pieces Mover))})) (define \"CounterSimpleMove\" (\"StepToEmpty\" (directions {FR FL}))) (define \"HopFrisianSequenceCaptureAgain\" (do (move Hop (from (last To)) All (between #1 #2 if:(and (not (is In (between) (sites ToClear))) (\"IsEnemyAt\" (between))) (apply (remove (between) #3))) (to if:(is Empty (to))) (then (and (if (can Move (do (hop (from (last To)) All (between #1 #2 if:(and (not (is In (between) (sites ToClear))) (\"IsEnemyAt\" (between)))) (to if:(is Empty (to)))) ifAfterwards:(is In (last To) (sites Phase 0)))) (moveAgain)) (forEach Site (sites Occupied by:Mover) (if (!= 0 (state at:(site))) (set State at:(site) 0)))))) ifAfterwards:(is In (last To) (sites Phase 0)))) (define \"HopFrisianSequenceCapture\" (do (move Hop All (between #1 #2 if:(\"IsEnemyAt\" (between)) (apply (remove (between) #3))) (to if:(is Empty (to))) (then (and (if (can Move (do (hop (from (last To)) All (between #1 #2 if:(and (not (is In (between) (sites ToClear))) (\"IsEnemyAt\" (between)))) (to if:(is Empty (to)))) ifAfterwards:(is In (last To) (sites Phase 0)))) (moveAgain)) (forEach Site (sites Occupied by:Mover) (if (!= 0 (state at:(site))) (set State at:(site) 0)))))) ifAfterwards:(is In (last To) (sites Phase 0)))) (define \"IsUnpromoted\" (\"IsPieceAt\" \"Counter\" Mover (last To))) (define \"HopCounter\" (or (do (move Hop (from #1) Orthogonal (between before:1 after:1 if:(and (not (is In (between) (sites ToClear))) (\"IsEnemyAt\" (between))) (apply (remove (between) at:EndOfTurn))) (to if:(is Empty (to))) #2) ifAfterwards:(is In (last To) (sites Phase 0))) (\"HopInternationalDraughtsStyle\" (from #1) #2))) (game \"Frisian Draughts\" (players 2) (equipment { (board (square 10)) (piece \"Counter\" P1 N) (piece \"Counter\" P2 S) (piece \"DoubleCounter\" Each maxState:128) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start { (place \"Counter1\" (difference (expand (sites Bottom) steps: (- 4 1)) (sites Phase 1)) value:10) (place \"Counter2\" (difference (expand (sites Top) steps: (- 4 1)) (sites Phase 1)) value:10)}) (play (if \"SameTurn\" (if \"IsUnpromoted\" (max Moves withValue:True (\"HopCounter\" (last To) (then (and (\"ReplayIfCanMove\" (\"HopCounter\" (last To)) (\"PromoteIfReach\" (sites Next) \"DoubleCounter\" (then (set Value at:(last To) 19)))) (forEach Site (sites Occupied by:Mover) (if (!= 0 (state at:(site))) (set State at:(site) 0))))))) (max Moves withValue:True (\"HopFrisianSequenceCaptureAgain\" before:(count Rows) after:(count Rows) at:EndOfTurn))) (priority { (max Moves withValue:True (or { (forEach Piece \"DoubleCounter\" (\"HopFrisianSequenceCapture\" before:(count Rows) after:(count Rows) at:EndOfTurn)) (forEach Piece \"Counter\" (\"HopCounter\" (from) (then (and (\"ReplayIfCanMove\" (\"HopCounter\" (last To)) (\"PromoteIfReach\" (sites Next) \"DoubleCounter\" (then (set Value at:(last To) 19)))) (forEach Site (sites Occupied by:Mover) (if (!= 0 (state at:(site))) (set State at:(site) 0)))))))})) (or (forEach Piece \"Counter\" (\"CounterSimpleMove\") (then (and (\"PromoteIfReach\" (sites Next) \"DoubleCounter\" (then (set Value at:(last To) 19))) (forEach Site (sites Occupied by:Mover) (if (!= 0 (state at:(site))) (set State at:(site) 0)))))) (forEach Piece \"DoubleCounter\" (if (if (> 2 (state at:(from))) True (not (can Move (forEach Piece \"Counter\" (\"CounterSimpleMove\"))))) (move Slide Diagonal)) (then (if (\"IsNotOffBoard\" (where \"Counter\" Mover)) (and (set State at:(last To) (+ 1 (state at:(last To)))) (forEach Site (sites Occupied by:Mover) (if (and (!= (site) (last To)) (!= 0 (state at:(site)))) (set State at:(site) 0))))))))}) (then (and (if (and (\"TwoKingsMoverOneKingEnemy\") (= Undefined (value Player Mover))) (set Value Mover 0)) (if (and (\"NewTurn\") (!= Undefined (value Player Mover))) (set Value Mover (+ 1 (value Player Mover)))))))) (end { (\"BlockWin\") (if (= 7 (value Player Mover)) (result Mover Draw))}))) 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 \"Tabu Y\" (players 2) (equipment { (board (hex Triangle 3)) (piece \"Disc\")}) (rules (play (move Add (to (sites Empty) if:(not (is In (to) (sites Around (last To))))))) (end (if (is Connected 3 Sides) (result Mover Win)))))\n\n###\n\n", "completion": "(game \"Tabu Y\" (players 2) (equipment { (board (hex Triangle 4)) (piece \"Disc\")}) (rules (play (move Add (to (sites Empty) if:(not (is In (to) (sites Around (last To))))))) (end (if (is Connected 3 Sides) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n9x9 intersecting lines, with diagonals in each 3x3 square. Two triangles on opposite sides, the apices of which intersect the central point on that side of the square. A line from the apex bisects the base, and this line is bisected with another line which intersects with the other two sides of the triangle. Forty pieces per player, which start on the four rows closest to the player, and on half of the central row. The central space remains empty. Players alternate turns moving a piece to an empty adjacent spot along the lines. Pieces may capture the adjacent piece of an opponent by hopping over it to an empty space directly behind it in a straight line. Multiple hops can be made in one turn if possible, with direction changes allowed. The player who captures all of their opponent's pieces wins. \n\n###\n\n", "completion": "(define \"BoardSize\" 9) (game \"Satoel\" (players 2) (equipment { (board (merge { (square \"BoardSize\" diagonals:Alternating) (shift 2 8 (rotate 180 (wedge 3))) (shift 2 -2 (wedge 3))}) use:Vertex) (piece \"Marker\" Each (or (\"HopSequenceCapture\") (\"StepToEmpty\")))}) (rules (start { (place \"Marker1\" (forEach (sites Board) if:(< (site) (centrePoint)))) (place \"Marker2\" (forEach (sites Board) if:(and (> (site) (centrePoint)) (< (site) (* \"BoardSize\" \"BoardSize\")))))}) (play (if \"SameTurn\" (or (\"HopSequenceCaptureAgain\") (move Pass)) (forEach Piece))) (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"Dim\" 16) (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 \"Halma\" (players 2) (equipment { (board (square (\"Dim\"))) (piece \"Counter\" Each) (regions \"Home\" P1 (difference (expand (intersection (sites Bottom) (sites Right)) steps:(+ 1 (/ (\"Dim\") 4)) Orthogonal) (sites { (ahead (coord row:0 column:(- (\"Dim\") 1)) steps:(+ 1 (/ (\"Dim\") 4)) N) (ahead (coord row:0 column:(- (\"Dim\") 1)) steps:(+ 1 (/ (\"Dim\") 4)) W)}))) (regions \"Home\" P2 (difference (expand (intersection (sites Top) (sites Left)) steps:(+ 1 (/ (\"Dim\") 4)) Orthogonal) (sites { (ahead (coord row:(- (\"Dim\") 1) column:0) steps:(+ 1 (/ (\"Dim\") 4)) E) (ahead (coord row:(- (\"Dim\") 1) column:0) steps:(+ 1 (/ (\"Dim\") 4)) S)}))) (map {(pair P1 P2) (pair P2 P1)})}) (rules (start { (place \"Counter1\" (sites P1)) (place \"Counter2\" (sites P2))}) phases:{ (phase \"Movement\" (play (forEach Piece (or (\"HopSequence\" (from)) (move Step (to if:(and (is Empty (to)) (or (not (\"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": "Played on a 16x16 checkered board. Can be played with two or four players. It is played with nineteen pieces for a two-player game, thirteen for a four-player game. The pieces begin play in opposing corners of the board, called the \\ The version of the game played with 2 players. The game is played on a 16x16 board. END" }, { "prompt": "Construct a Ludii game based on the following description\nPlay on an equilateral hexagonal triangle-tessellated grid. The board is seeded randomly with a black stone, a white stone, and a neutral stone. Players take turn seeding new groups. Every placement triggers growth of all enemy groups, where growth is defined as adding a stone to all empty cells adjacent to a group. When the board fills up, the person who has more pieces on the board wins. Played on a size 7 board.\n\n###\n\n", "completion": "(game \"Inkblots\" (players 2) (equipment { (board (tri Hexagon 7)) (tile \"Triangle\" Each) (tile \"Triangle\" Neutral)}) (rules (meta (swap)) (start (place Random {\"Triangle1\" \"Triangle2\" \"Triangle0\"})) (play (move Add (to (sites Empty)) (then (add (piece (id \"Triangle\" Next)) (to (intersection (expand (sites Occupied by:Next) Orthogonal) (sites Empty))))))) (end (if (no Moves Next) (byScore { (score P1 (count Pieces P1)) (score P2 (count Pieces P2))}))))) END" }, { "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": "Modify the Ludii game according to the following option changes:\nTriangle-Square Omni-Grid - Recommended Variant -> Triangle-Square Grid\nOrder 4 board -> Order 5 board\nLargest orthogonal group scores 1 point per piece times the total count of the opponent's pieces -> Largest group scores 1 point per piece.\n(define \"Icosahedron\" (board (add (remove (tri Limping 4) vertices:{0 1 3 4 5 6 7 8 9 10 11 13 15 17 18 19 20 23 24 25 26 27 31 32 34 35 36 37 39 40 42 43 44 45 46 47}) edges:{ {0 1} {0 2} {0 3} {0 9} {0 10} {1 2} {1 4} {1 6} {6 11} {7 11} {8 11} {1 9} {2 3} {3 5} {3 8} {3 10} {6 9} {8 10} {9 10} {9 11} {10 11}}) use:Vertex)) (define \"HexCell\" (board (hex Hexagon 4) use:Cell)) (define \"HexHex\" (board (tri Hexagon 4) use:Vertex)) (define \"TriSquare\" (board (tiling T33434 (- 4 2)) use:Vertex)) (define \"HexLimp\" (board (tri Limping (- 4 1)) use:Vertex)) (define \"SquareGrid\" (board (square 4) use:Vertex)) (define \"BoardUsed\" \"TriSquare\") (define \"Connection\" All) (define \"PiePhase\" (phase \"Pie\" (play (if (is Mover P1) (or { (move Add (piece (mover)) (to (sites Empty))) (move Add (piece (next)) (to (sites Empty))) (move Pass)} (then (if (< 0 (counter)) (set NextPlayer (player (next))) (moveAgain)))) (or (move Propose \"Accept Pie Offer and Move\" (then (set NextPlayer (player (mover))))) (move Propose \"Swap Pieces\" (then (do (forEach Site (sites Occupied by:Mover) (remember Value (site))) next:(forEach Site (sites Occupied by:Next) (and (remove (site)) (add (piece (mover)) (to (site))))) (then (forEach Value (values Remembered) (and (remove (value)) (add (piece (next)) (to (value)))) (then (and (forget Value All) (set NextPlayer (player (next))))))))))))) (nextPhase (or (is Proposed \"Swap Pieces\") (is Proposed \"Accept Pie Offer and Move\")) \"Placement\"))) (define \"SpecialOrthoScoring\" (and (set Score Mover (* (max (sizes Group Orthogonal Mover)) (count Pieces Next))) (set Score Next (* (max (sizes Group Orthogonal Next)) (count Pieces Mover))))) (define \"SpecialScoring\" (and (set Score Mover (* (max (sizes Group All Mover)) (count Pieces Next))) (set Score Next (* (max (sizes Group All Next)) (count Pieces Mover))))) (define \"SimpleOrthoScoring\" (set Score Mover (max (sizes Group Orthogonal Mover)))) (define \"SimpleScoring\" (set Score Mover (max (sizes Group All Mover)))) (game \"Faraday\" (players 2) (equipment { \"BoardUsed\" (piece \"Ball\" P1) (piece \"Ball\" P2)}) (rules (meta (no Repeat Positional)) (start (set Score Each 0)) phases:{ \"PiePhase\" (phase \"Placement\" (play (move Add (piece (mover)) (to (sites Empty) if:(or (<= 4 (count Pieces Next in:(sites Around (to) All))) (< 0 (- (count Pieces Next in:(sites Around (to) All)) (count Pieces Mover in:(sites Around (to) All)))))) (then (and { (\"SpecialOrthoScoring\") (set Var \"Last2Move\" (mover)) (if (not (no Moves Mover)) (moveAgain))})))) (end (if (all Passed) { (if (!= (score Mover) (score Next)) (byScore)) (if (and (= (score Mover) (score Next)) (= (var \"Last2Move\") (mover))) (result Mover Loss)) (if (and (= (score Mover) (score Next)) (!= (var \"Last2Move\") (mover))) (result Mover Loss))} (byScore))))}))\n\n###\n\n", "completion": "(define \"Icosahedron\" (board (add (remove (tri Limping 4) vertices:{0 1 3 4 5 6 7 8 9 10 11 13 15 17 18 19 20 23 24 25 26 27 31 32 34 35 36 37 39 40 42 43 44 45 46 47}) edges:{ {0 1} {0 2} {0 3} {0 9} {0 10} {1 2} {1 4} {1 6} {6 11} {7 11} {8 11} {1 9} {2 3} {3 5} {3 8} {3 10} {6 9} {8 10} {9 10} {9 11} {10 11}}) use:Vertex)) (define \"HexCell\" (board (hex Hexagon 5) use:Cell)) (define \"HexHex\" (board (tri Hexagon 5) use:Vertex)) (define \"TriSquare\" (board (tiling T33434 (- 5 2)) use:Vertex)) (define \"HexLimp\" (board (tri Limping (- 5 1)) use:Vertex)) (define \"SquareGrid\" (board (square 5) use:Vertex)) (define \"BoardUsed\" \"TriSquare\") (define \"Connection\" Orthogonal) (define \"PiePhase\" (phase \"Pie\" (play (if (is Mover P1) (or { (move Add (piece (mover)) (to (sites Empty))) (move Add (piece (next)) (to (sites Empty))) (move Pass)} (then (if (< 0 (counter)) (set NextPlayer (player (next))) (moveAgain)))) (or (move Propose \"Accept Pie Offer and Move\" (then (set NextPlayer (player (mover))))) (move Propose \"Swap Pieces\" (then (do (forEach Site (sites Occupied by:Mover) (remember Value (site))) next:(forEach Site (sites Occupied by:Next) (and (remove (site)) (add (piece (mover)) (to (site))))) (then (forEach Value (values Remembered) (and (remove (value)) (add (piece (next)) (to (value)))) (then (and (forget Value All) (set NextPlayer (player (next))))))))))))) (nextPhase (or (is Proposed \"Swap Pieces\") (is Proposed \"Accept Pie Offer and Move\")) \"Placement\"))) (define \"SpecialOrthoScoring\" (and (set Score Mover (* (max (sizes Group Orthogonal Mover)) (count Pieces Next))) (set Score Next (* (max (sizes Group Orthogonal Next)) (count Pieces Mover))))) (define \"SpecialScoring\" (and (set Score Mover (* (max (sizes Group Orthogonal Mover)) (count Pieces Next))) (set Score Next (* (max (sizes Group Orthogonal Next)) (count Pieces Mover))))) (define \"SimpleOrthoScoring\" (set Score Mover (max (sizes Group Orthogonal Mover)))) (define \"SimpleScoring\" (set Score Mover (max (sizes Group Orthogonal Mover)))) (game \"Faraday\" (players 2) (equipment { \"BoardUsed\" (piece \"Ball\" P1) (piece \"Ball\" P2)}) (rules (meta (no Repeat Positional)) (start (set Score Each 0)) phases:{ \"PiePhase\" (phase \"Placement\" (play (move Add (piece (mover)) (to (sites Empty) if:(or (<= 3 (count Pieces Next in:(sites Around (to) Orthogonal))) (< 0 (- (count Pieces Next in:(sites Around (to) Orthogonal)) (count Pieces Mover in:(sites Around (to) Orthogonal)))))) (then (and { (\"SimpleScoring\") (set Var \"Last2Move\" (mover)) (if (not (no Moves Mover)) (moveAgain))})))) (end (if (all Passed) { (if (!= (score Mover) (score Next)) (byScore)) (if (and (= (score Mover) (score Next)) (= (var \"Last2Move\") (mover))) (result Mover Loss)) (if (and (= (score Mover) (score Next)) (!= (var \"Last2Move\") (mover))) (result Mover Loss))} (byScore))))})) END" }, { "prompt": "Construct a Ludii game based on the following description\nEach player has six pieces. They take turns placing the pieces on the intersections, attempting to make three in a row. If they are unsuccessful after all the pieces are placed, they then take turns moving their piece one spot along one of the lines until someone makes three in a row (Murray 1951: 43). The game is played according to the rules of Murray.\n\n###\n\n", "completion": "(game \"Achi\" (players 2) (equipment { (board (concentric Square rings:2) use:Vertex) (hand Each) (piece \"Marker\" Each (\"StepToEmpty\" ~ (then (\"ReplayIfLine3\" Orthogonal exact:True))))}) (rules (start (place \"Marker\" \"Hand\" count:6)) 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 (if (<= (count Pieces Next) 2) (result Mover Win))))) 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": "Describe the mechanics of the following Ludii game\n(define \"SowedHoles\" (if (is Mover P1) (values Remembered \"SowedHolesP1\") (values Remembered \"SowedHolesP2\"))) (define \"RemmemberSowedHoles\" (if (is Mover P1) (remember Value \"SowedHolesP1\" #1 unique:True) (remember Value \"SowedHolesP2\" #1 unique:True))) (define \"NextHole\" (\"NextSiteOnTrack\" #2 from:#1 \"Track\")) (game \"Adjiboto\" (players 2) (equipment { (mancalaBoard 2 5 store:None (track \"Track\" \"0,E,N,W\" loop:True)) (piece \"Seed\" Shared) (hand Each) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start (set Count 10 to:(sites Track))) phases:{ (phase \"Opening\" (play (move Select (from (difference (sites Mover) (sites (\"SowedHoles\"))) if:(< 1 (count at:(to)))) (then (and (sow origin:True) (\"RemmemberSowedHoles\" (last From)))))) (nextPhase Mover (< 8 (count Turns)))) (phase \"Main\" (play (move Select (from (sites Mover) if:(< 1 (count at:(to)))) (then (sow if:(or { (= 1 (count at:(\"NextHole\" (to) 1))) (= 3 (count at:(\"NextHole\" (to) 1))) (= 5 (count at:(\"NextHole\" (to) 1)))}) apply:(fromTo (from (\"NextHole\" (to) 1)) (to (handSite Mover)) count:(count at:(\"NextHole\" (to) 1))) origin:True forward:True)))) (end (if (no Moves Next) { (if (< (count Cell at:(handSite Next)) 50) (result Mover Win)) (if (>= (count Cell at:(handSite Next)) 50) (result Mover Draw))})))}))\n\n###\n\n", "completion": "2x5 board. Ten counters in each hole. Sowing occurs in an anti-clockwise direction, sowing first into the hole from which the counters originally came. Opening phase: In the first ten turns, each player must sow from each of their five holes. Main phase: Captures are made when the last counter of a sowing falls into a hole preceding a hole containing one, three, or five counters. These counters are taken. Any subsequent holes also containing one, three, or five counters are captured, until a hole is reached that does not have one of these numbers of counters. The exception to this is in the first move when no captures are made. Sowing cannot begin from a hole with a single counter. A player wins when his opponent can no longer sow. However, if a player can no longer move, they can redistribute their captured beans into their holes, and if all five can be filled with ten, the game is a draw. END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"Compart\" (players 2) (equipment { (board (square 11) use:Vertex) (piece \"Marker\" Each)}) (rules (meta (swap)) (play (move Add (to (sites Empty) if:(not (is In (to) (sites (values Remembered)))) (apply (addScore Mover 1))) (then (do (forEach Site (sites Group at:(last To) if:(not (is Enemy (who at:(to))))) (remember Value (site))) next:(if (< 0 (count Sites in:(difference (sites Empty) (sites (values Remembered))))) (moveAgain) (forget Value All)))))) (end (if (is Full) { (if (= (score P1) (score P2)) (result Mover Win)) (if True (byScore misere:True))}))))\n\n###\n\n", "completion": "Played with black and white stones on an initially empty square board. On your turn, for every viable area with one or more empty points, place a stone of your color on one of those points.\n \n A viable area is a viable point along with all other such points one can reach from it through a series of steps onto orthogonally adjacent viable points. A viable point is a point that is empty or occupied by a friendly stone.\n \n When the board is full, the player with fewer stones on the board wins. If there is a tie, whoever placed the last stone wins. Ties are only possible on even-sized boards.\n \n To make the game fair, the second player will have the option, on their first turn only, to swap sides with their opponent instead of making a regular move. An 11x11 board is currently selected. END" }, { "prompt": "Construct a Ludii game based on the following description\nGoal: \n You try to both reduce the number of your own groups as much as possible, and also to block your opponent's ability to reduce his groups down to fewer than yours. Whoever decides to end the game must fill the empty spaces with opponent's pieces, and only then, wins by having equal or fewer groups.\n \n Play:\n Starting with the board empty, player's take turns placing a piece of their color on an empty position that does not abut any friendly piece. If it is impossible to place a piece, the player, instead, moves a piece to the first empty position in any direction. But whenever a new opportunity for placement is available, the turn must be used for placement.\n \n Ending the Game:\n \n The game ends at the choice of the player about to move, but only at the beginning of a turn in which there is no forced placement. \n \n Before scoring, the empty spaces are filled with the opponent's pieces. The player who ended the game wins unless the opponent has fewer groups. Because the empty spaces are filled with opponent's pieces, a player who ends the game too soon will lose. On the other hand, since ties go to the player who ends the game, it is important to end the game as soon as you can actually win.\n \n Variations: \n Options are available to select the board size, and also to use other movement rules, instead of the standard one. Board & size: Hexhex with edges alternately 2 and 3 Movement: Pieces step or jump once, to the first empty position in that direction.\n\n###\n\n", "completion": "(define \"Jumping\" (forEach Piece (\"HopAllPiecesToEmpty\" ~ ~ (range 0 18)))) (define \"Stepping\" (forEach Piece (\"StepToEmpty\"))) (define \"Sliding\" (forEach Piece (move Slide))) (define \"Hopping\" (forEach Piece (or (\"HopAllPiecesToEmpty\") (\"StepToEmpty\")))) (define \"Shooting\" (forEach Piece (move (from) (to (sites LineOfSight Farthest at:(from)) if:(is Empty (to)))))) (game \"Abrobad\" (players 2) (equipment { (board (hex Limping 2)) (piece \"Hex\" Each)}) (rules (play (priority (move Add (to (sites Empty) if:(= 0 (count Sites in:(sites Around (to) Own))))) (or \"Jumping\" (move Propose \"Conclude\" (then (if (is Proposed \"Conclude\") (add (piece (next)) (to (sites Empty)) (then (and (set Score Mover (count Groups if:(= (who at:(to)) (mover)))) (set Score Next (count Groups if:(= (who at:(to)) (next))))))))))))) (end (if (is Proposed \"Conclude\") (if (<= (score Mover) (score Next)) (result Mover Win)) (result Next Win))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"1D Chess\" (players 2) (equipment { (board (rectangle 1 8)) (\"ChessRook\" \"Rook\") (\"ChessKing\" \"King\") (piece \"Knight\" Each (\"LeapCapture\" { {F F}}))}) (rules (start { (place \"Rook1\" coord:\"C1\") (place \"Knight1\" coord:\"B1\") (place \"King1\" coord:\"A1\") (place \"Rook2\" coord:\"F1\") (place \"Knight2\" coord:\"G1\") (place \"King2\" coord:\"H1\")}) (play (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King\" Mover)))) (end { (\"Checkmate\" \"King\") (if (or (no Moves Mover) (= (counter) 100)) (result Mover Draw))})))\n\n###\n\n", "completion": "Here, the King and Rook move as usual, and the knight moves exactly two squares, and may jump over a piece doing that. Gardner asks his readers whether white can win. (White can make a draw by taking the opponents rook and thus giving stalemate.). Board of length 8. END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nEach player has 6 holes on each row. -> Each player has 10 holes on each row.\n(define \"Columns\" 6) (game \"Katra\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"TrackCCW1\" \"0,E,N1,W\" loop:True P1) (track \"TrackCCW2\" \"12,E,N1,W\" loop:True P2) (track \"TrackCW1\" \"5,W,N1,E\" loop:True P1) (track \"TrackCW2\" \"18,E,S1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"TrackCCW1\")) (regions \"Home\" P2 (sites Track \"TrackCCW2\")) (regions \"Outer\" P1 (sites Bottom)) (regions \"Outer\" P2 (sites Top)) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 2 to:(union (sites P1 \"Home\") (sites P2 \"Home\")))) (play (or (if (!= (value Player Mover) 2) (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (sites Mover \"Home\")) if:(> (count at:(from)) 0)) (then (and (sow \"TrackCCW\" owner:(mover) apply:(if (< 1 (count at:(to))) (if (is In (to) (sites Mover \"Outer\")) (and (moveAgain) (set Var \"Replay\" (to))) (if (< 1 (count at:(\"OppositePit\" (to)))) (and { (fromTo (from (\"OppositePit\" (to))) (to (to)) count:(count at:(\"OppositePit\" (to)))) (moveAgain) (set Var \"Replay\" (to))}) (if (< 1 (count at:(\"OppositeOuterPit\" (to)))) (and { (fromTo (from (\"OppositeOuterPit\" (to))) (to (to)) count:(count at:(\"OppositeOuterPit\" (to)))) (moveAgain) (set Var \"Replay\" (to))})))))) (if (!= (value Player Mover) 1) (set Value Mover 1)))))) (if (!= (value Player Mover) 1) (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (sites Mover \"Home\")) if:(> (count at:(from)) 0)) (then (and (sow \"TrackCW\" owner:(mover) apply:(if (< 1 (count at:(to))) (if (is In (to) (sites Mover \"Outer\")) (and (moveAgain) (set Var \"Replay\" (to))) (if (< 1 (count at:(\"OppositePit\" (to)))) (and { (fromTo (from (\"OppositePit\" (to))) (to (to)) count:(count at:(\"OppositePit\" (to)))) (moveAgain) (set Var \"Replay\" (to))}) (if (< 1 (count at:(\"OppositeOuterPit\" (to)))) (and { (fromTo (from (\"OppositeOuterPit\" (to))) (to (to)) count:(count at:(\"OppositeOuterPit\" (to)))) (moveAgain) (set Var \"Replay\" (to))})))))) (if (!= (value Player Mover) 2) (set Value Mover 2)))))))) (end \"ForEachNonMoverNoMovesLoss\")))\n\n###\n\n", "completion": "(define \"Columns\" 10) (game \"Katra\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"TrackCCW1\" \"0,E,N1,W\" loop:True P1) (track \"TrackCCW2\" \"20,E,N1,W\" loop:True P2) (track \"TrackCW1\" \"9,W,N1,E\" loop:True P1) (track \"TrackCW2\" \"30,E,S1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"TrackCCW1\")) (regions \"Home\" P2 (sites Track \"TrackCCW2\")) (regions \"Outer\" P1 (sites Bottom)) (regions \"Outer\" P2 (sites Top)) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 2 to:(union (sites P1 \"Home\") (sites P2 \"Home\")))) (play (or (if (!= (value Player Mover) 2) (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (sites Mover \"Home\")) if:(> (count at:(from)) 0)) (then (and (sow \"TrackCCW\" owner:(mover) apply:(if (< 1 (count at:(to))) (if (is In (to) (sites Mover \"Outer\")) (and (moveAgain) (set Var \"Replay\" (to))) (if (< 1 (count at:(\"OppositePit\" (to)))) (and { (fromTo (from (\"OppositePit\" (to))) (to (to)) count:(count at:(\"OppositePit\" (to)))) (moveAgain) (set Var \"Replay\" (to))}) (if (< 1 (count at:(\"OppositeOuterPit\" (to)))) (and { (fromTo (from (\"OppositeOuterPit\" (to))) (to (to)) count:(count at:(\"OppositeOuterPit\" (to)))) (moveAgain) (set Var \"Replay\" (to))})))))) (if (!= (value Player Mover) 1) (set Value Mover 1)))))) (if (!= (value Player Mover) 1) (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (sites Mover \"Home\")) if:(> (count at:(from)) 0)) (then (and (sow \"TrackCW\" owner:(mover) apply:(if (< 1 (count at:(to))) (if (is In (to) (sites Mover \"Outer\")) (and (moveAgain) (set Var \"Replay\" (to))) (if (< 1 (count at:(\"OppositePit\" (to)))) (and { (fromTo (from (\"OppositePit\" (to))) (to (to)) count:(count at:(\"OppositePit\" (to)))) (moveAgain) (set Var \"Replay\" (to))}) (if (< 1 (count at:(\"OppositeOuterPit\" (to)))) (and { (fromTo (from (\"OppositeOuterPit\" (to))) (to (to)) count:(count at:(\"OppositeOuterPit\" (to)))) (moveAgain) (set Var \"Replay\" (to))})))))) (if (!= (value Player Mover) 2) (set Value Mover 2)))))))) (end \"ForEachNonMoverNoMovesLoss\"))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game is played with 2 players. -> The game is played with 3 players.\n(define \"PiecesOwnedBy\" (count Cell at:(handSite #1))) (define \"NumPlayers\" 2) (game \"Pic\" (players \"NumPlayers\") (equipment { (board (concentric {(* 3 \"NumPlayers\")}) (track \"Track\" {0 2 4 5 3 1} loop:True) use:Vertex) (piece \"Seed\" Shared) (hand Each) (regions P1 (sites {0 2 4})) (regions P2 (sites {5 3 1}))}) (rules (start (set Count 12 to:(sites Track))) (play (or { (move Select (from (sites Mover) if:(is Occupied (from))) (then (sow apply:(if (and (not (is In (to) (sites Mover))) (= 3 (count at:(to)))) (and (fromTo (from (to)) (to (handSite Mover)) count:3) (set State at:(to) (mover)))))))} (then (forEach Site (sites Board) (if (and (is Occupied (site)) (!= 0 (state at:(site)))) (and (fromTo (from (site)) (to (handSite (state at:(site)))) count:(count at:(site))) (set State at:(site) (state at:(site))))))))) (end (if (\"NoPieceOnBoard\") (byScore { (score P1 (\"PiecesOwnedBy\" P1)) (score P2 (\"PiecesOwnedBy\" P2))})))))\n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (count Cell at:(handSite #1))) (define \"NumPlayers\" 3) (game \"Pic\" (players \"NumPlayers\") (equipment { (board (concentric {(* 3 \"NumPlayers\")}) (track \"Track\" {0 1 3 5 7 8 6 4 2} loop:True) use:Vertex) (piece \"Seed\" Shared) (hand Each) (regions P1 (sites {0 1 3})) (regions P2 (sites {5 7 8})) (regions P3 (sites {6 4 2}))}) (rules (start (set Count 12 to:(sites Track))) (play (or { (move Select (from (sites Mover) if:(is Occupied (from))) (then (sow apply:(if (and (not (is In (to) (sites Mover))) (= 3 (count at:(to)))) (and (fromTo (from (to)) (to (handSite Mover)) count:3) (set State at:(to) (mover)))))))} (then (forEach Site (sites Board) (if (and (is Occupied (site)) (!= 0 (state at:(site)))) (and (fromTo (from (site)) (to (handSite (state at:(site)))) count:(count at:(site))) (set State at:(site) (state at:(site))))))))) (end (if (\"NoPieceOnBoard\") (byScore { (score P1 (\"PiecesOwnedBy\" P1)) (score P2 (\"PiecesOwnedBy\" P2)) (score P3 (\"PiecesOwnedBy\" P3))}))))) 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. Two six-sided dice. Both players begin on the same side of the board, one player (who plays first) with five pieces on the rightmost point of the starting row, four on the fifth and sixth points and two in the eleventh point in the opposite row. The other player has three pieces each on the right five points in the second row. 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. On each throw the player also plays a throw of 6 in addition to the throw presented by the dice. Pieces move in an anti-clockwise direction around the board. A piece cannot move to a point that is occupied by more than one of the opponent's pieces. If a piece lands on a point occupied by a single piece belonging to the opponent, the opponent's piece is removed from the board and must enter again from the leftmost point in the row where the pieces began. A piece may be borne off the board when a throw is greater than the number of points left on the board. The first player to bear all of their pieces off the board wins. \n\n###\n\n", "completion": "(define \"Move\" (forEach Site (sites Occupied by:Mover) (if (\"CanEscape\" #1) (\"RemoveAPiece\") (move (from (site)) (to #1 if:(\"NoEnemyOrOnlyOne\" (to)) (\"HittingCapture\" (\"Bar\"))))))) (define \"CanEscape\" (\"IsOffBoard\" #1)) (define \"AllPieceEscaped\" (no Pieces Mover)) (define \"Bar\" (mapEntry (mover))) (define \"RemoveAPiece\" (move Remove (site))) (define \"NextSiteFromDist6\" (\"NextSiteOnTrack\" 6 from:#1)) (define \"NextSiteFrom\" (\"NextSiteOnTrack\" (pips) from:#1)) (game \"Myles\" (players 2) (equipment { (\"BackgammonBoard\" (\"BackgammonTracksSameDirectionWithBar\")) (dice num:2) (map {(pair 1 19) (pair 2 6)}) (piece \"Disc\" Each)}) (rules (start { (place Stack \"Disc1\" 12 count:5) (place Stack \"Disc1\" 20 count:4) (place Stack \"Disc1\" 21 count:4) (place Stack \"Disc1\" 15 count:2) (place Stack \"Disc2\" 25 count:3) (place Stack \"Disc2\" 24 count:3) (place Stack \"Disc2\" 23 count:3) (place Stack \"Disc2\" 22 count:3) (place Stack \"Disc2\" 21 count:3)}) (play (\"RollEachNewTurnMove\" (if (all DiceUsed) (\"Move\" (\"NextSiteFromDist6\" (site))) (forEach Die if:(\"DieNotUsed\") (\"Move\" (\"NextSiteFrom\" (site))) (then (moveAgain)))))) (end (if (\"AllPieceEscaped\") (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThree rows of holes, arranged vertically, the outer two have twelve holes and the central one has thirteen. Twelve pieces per player, which begin in the outer rows. Four sticks, black on one side and white on the other, the number of white faces up is the value of the throw; all black faces up = 6. A player must throw a 1 (sig) to unlock a piece, which moves from the top hole in the player's row to the top hole of the central row. When a piece reaches the thirteenth space in the central row, they must throw a sig to enter the opponent's home row, at the bottom hole in that row, and proceed up that row to the top and then back into the central row. When entering the opponent's row, the opponent's piece in their bottom hole is sent to the next available hole in their row. In the central row, when a piece lands on a hole with an opponent's piece, the opponent's piece is sent back to start in their home row. A player landing on a hole occupied by an opponent in the home row captures the opponent's piece. The player who captures all of the opponent's pieces wins. The game is played with 4 dice.\n\n###\n\n", "completion": "(define \"Move\" (or (if (\"IsInTrack\" (from) \"HomeTrack\") (if (if (\"PieceActivated\" (from)) True (\"Sig\")) (if (not (\"IsFriendAt\" (\"NextSiteOnTrack\" (\"ThrowValue\") \"HomeTrack\"))) (move (from) (to (\"NextSiteOnTrack\" (\"ThrowValue\") \"HomeTrack\") \"CaptureEnemyPiece\") (then (if (and (not (\"PieceActivated\" (last To))) (\"Sig\")) (\"ActivatePiece\" (last To)))))))) (if (\"IsInTrack\" (from) \"EnemyTrack\") (if (not (\"IsFriendAt\" (\"NextSiteOnTrack\" (\"ThrowValue\") \"EnemyTrack\"))) (move (from) (to (\"NextSiteOnTrack\" (\"ThrowValue\") \"EnemyTrack\") \"CaptureEnemyPiece\")))))) (define \"CaptureEnemyPieceInEntering\" (apply if:(\"IsEnemyAt\" (to)) (if (\"IsOffBoard\" (\"FirstAvailableInHome\" Next)) (remove (to)) (fromTo (from (to)) (to (\"FirstAvailableInHome\" Next)))))) (define \"FirstAvailableInHome\" (min (array (intersection (sites Empty) (sites #1 \"Home\"))))) (define \"IsInTrack\" (is In #1 (sites Track Mover #2))) (define \"CaptureEnemyPiece\" (apply if:(\"IsEnemyAt\" (to)) (if (is In (to) (sites Next \"Home\")) (remove (to)) (if (\"IsOffBoard\" (\"FirstAvailableInHome\" Next)) (remove (to)) (fromTo (from (to)) (to (\"FirstAvailableInHome\" Next))))))) (define \"PieceActivated\" (!= 0 (state at:#1))) (define \"ActivatePiece\" (set State at:#1 1)) (define \"Sig\" (= 1 (\"ThrowValue\"))) (define \"ThrowValue\" (mapEntry \"Throw\" (count Pips))) (define \"BottomSite\" 36) (game \"Sig (Tidikelt)\" (players 2) (equipment { (board (merge { (rectangle 12 3) (shift 1 -1 (rectangle 13 1))}) { (track \"HomeTrack1\" \"0,N,E1,S\" P1 directed:True) (track \"HomeTrack2\" \"2,N,W1,S\" P2 directed:True) (track \"EnemyTrack1\" \"2,N,W1,S\" P1 directed:True) (track \"EnemyTrack2\" \"0,N,E1,S\" P2 directed:True)} use:Vertex) (piece \"Stick\" Each) (regions \"AllSites\" (sites Board)) (\"StickDice\" 4) (map \"Throw\" {(pair 0 6) (pair 1 1) (pair 2 2) (pair 3 3) (pair 4 4)}) (map \"FirstEnemySite\" {(pair P1 2) (pair P2 0)}) (regions \"Home\" P1 (sites Left)) (regions \"Home\" P2 (sites Right))}) (rules (start { (place \"Stick1\" (sites Left)) (place \"Stick2\" (sites Right))}) (play (\"RollMove\" (or (if (and (\"Sig\") (= (mover) (who at:(\"BottomSite\")))) (move (from (\"BottomSite\")) (to (mapEntry \"FirstEnemySite\" (mover)) if:(not (is Friend (mapEntry \"FirstEnemySite\" (mover)))) \"CaptureEnemyPieceInEntering\"))) (forEach Piece (\"Move\"))))) (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"Mbenga Alignment Game\" (players 2) (equipment { (board (rectangle 3 3 diagonals:Alternating) use:Vertex) (hand Each) (piece \"Marker\" Each)}) (rules (start (place \"Marker\" \"Hand\" count:3)) (play (move (from (handSite Mover)) (to (sites Empty)))) (end (if (is Line 3) (result Mover Win)))))\n\n###\n\n", "completion": "3x3 intersecting lines with diagonals. Three pieces per player. Players alternate turns placing a piece on the board. The first player to place three of their pieces in a row wins. END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(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 \"CaptureToPiece\" (apply (if (\"IsEnemyAt\" (to)) (remove (to))))) (define \"PieceHasMoved\" (set State at:#1 0)) (define \"RememberPieceHasMoved\" (then (if (= (state at:(last To)) 1) (\"PieceHasMoved\" (last To))))) (game \"Long Assize\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (piece \"King\" Each (or (\"StepToNotFriend\") (if (= 1 (state at:(from))) (move Hop (between if:(not (\"IsEnemyAt\" (between)))) (to if:(not (\"IsFriendAt\" (to))) \"CaptureToPiece\"))) (\"RememberPieceHasMoved\"))) (\"ChessRook\" \"Rook\") (piece \"Bishop\" Each (move Hop Diagonal (between if:True) (to if:(not (\"IsFriendAt\" (to))) \"CaptureToPiece\"))) (\"ChessKnight\" \"Knight\") (piece \"Queen\" Each (or (\"StepToNotFriend\" Diagonal \"RememberPieceHasMoved\") (if (= 1 (state at:(from))) (move Hop Diagonal (between if:True) (to if:(is Empty (to))))) (\"RememberPieceHasMoved\"))) (\"ChessPawn\" \"Pawn\" (or (if (is In (from) (sites Start (piece (what at:(from))))) (\"DoubleStepForwardToEmpty\" \"SetEnPassantLocation\")) \"EnPassant\") (then (if (is In (last To) (sites Mover \"Promotion\")) (and (promote (last To) (piece (id \"Queen\" Mover))) (set State at:(last To) 1))))) (regions \"Promotion\" P1 (sites Top)) (regions \"Promotion\" P2 (sites Bottom))}) (rules (start { (place \"Pawn1\" (sites Row 1)) (place \"Pawn2\" (sites Row 6)) (place \"Rook1\" {\"A1\" \"H1\"}) (place \"Knight1\" {\"B1\" \"G1\"}) (place \"Bishop1\" {\"C1\" \"F1\"}) (place \"Queen1\" coord:\"D1\" state:1) (place \"King1\" coord:\"E1\" state:1) (place \"Rook2\" {\"A8\" \"H8\"}) (place \"Knight2\" {\"B8\" \"G8\"}) (place \"Bishop2\" {\"C8\" \"F8\"}) (place \"Queen2\" coord:\"D8\" state:1) (place \"King2\" coord:\"E8\" state:1)}) (play (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King\" Mover)) (then (if (and (= 1 (state at:(where \"King\" Next))) (\"IsInCheck\" \"King\" Next)) (\"PieceHasMoved\" (where \"King\" Next)))))) (end { (\"Checkmate\" \"King\") (\"DrawIfNoMoves\" Next) (if (= (count Pieces Next) 1) (result Mover Win))})))\n\n###\n\n", "completion": "8x8 board. The pieces move as follows, with the number per player: 1 x King (king): moves one space orthogonally or diagonally. The King may leap to the second square on its first move if it has not yet been checked and does not hop over an opponent's piece. 1 x Queen: One square diagonally. On its first move, the Queen may jump diagonally two squares. The Queen cannot capture when making this move. 2 x Rook: Any number of spaces orthogonally. 2 x Fil (elephant): Two squares diagonally, jumping over the first. Cannot capture another Fil. 2 x Knight: Moves as a chess knight. 8 x Pawn: Moves one space forward orthogonally; one space forward diagonally to capture. May move two spaces on its first move. En passant is allowed. Promoted to Queen when reaching the eighth rank, and may make the Queen's leap on its first move after being promoted. No castling. An opponent's piece is captured by moving a player's own piece onto a space occupied by the opponent's piece. When a King can be captured on the next turn by an opponent's piece, it is in check. The King must not be in check at the end of the player's turn. If this is not possible, it is checkmate and the opponent wins. Stalemate results in a draw. Capturing all of an opponent's pieces except the King also results in a win. 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 \"Domineering\" (players 2) (equipment { (board (rectangle 1 2)) (tile \"Horz\" P1 {R F} numSides:4) (tile \"Vert\" P2 {F} numSides:4)}) (rules (play (move Add (piece (mover) state:0) (to (sites Empty)))) (end (\"NoMoves\" Loss))))\n\n###\n\n", "completion": "(game \"Domineering\" (players 2) (equipment { (board (rectangle 2 3)) (tile \"Horz\" P1 {R F} numSides:4) (tile \"Vert\" P2 {F} numSides:4)}) (rules (play (move Add (piece (mover) state:0) (to (sites Empty)))) (end (\"NoMoves\" Loss)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe goal is to place three mines in every row, column and region. The digits in the grid represent the number of mines in the neighbouring cells. \n\n###\n\n", "completion": "(game \"Sudoku Mine\" (players 1) (equipment { (board (square 9) (values Cell (range 0 1))) (hints { (hint 5 1) (hint 7 2) (hint 8 1) (hint 10 3) (hint 19 1) (hint 24 3) (hint 29 3) (hint 35 4) (hint 39 3) (hint 41 3) (hint 45 4) (hint 51 2) (hint 56 3) (hint 61 2) (hint 70 3) (hint 72 1) (hint 73 1) (hint 75 1)}) (regions {Columns Rows}) (piece \"Bomb\" P1)}) (rules (play (satisfy { (forAll Hint (is Count (sites Around (from)) of:1 (hint))) (forAll Hint (= (what at:(from)) 0)) (is Sum 3)})) (end (if (is Solved) (result P1 Win))))) 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 Ludii game based on the following description\n2x12 board, divided in half. Spaces on each side take the form of semi-circular sockets, into which the pieces fit. Fifteen pieces per player. Three 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. One player begins with all of their pieces on the space furthest to the left on their side, the other with their pieces on the point directly opposite it. Pieces move in opposite directions around the board, toward the point where the opponent's pieces begin, and bearing off the board from there. A player cannot have two of their pieces on the same spot in the starting quadrant. When a piece lands on the same space as a single opponent's piece, the opponent's piece is sent back to where it began. The first person to bear off all their pieces wins. If players move their pieces such that they fill up all the points in a quadrant, and the other fills up all of the points in an adjacent quadrant such that neither player can move, the game is a draw. It is a prime win when one player has twelve pieces arranged on consecutive points so that the other player cannot pass them. When the player sends four pieces back to the beginning while preserving this state, it is a prime win. \n\n###\n\n", "completion": "(define \"RemoveAPiece\" (move Remove (from))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" (pips))) (game \"Emperador\" (players 2) (equipment { (\"TableBoard\" \"TableTracksOppositeWithHands\") (dice d:6 num:3) (hand Each) (regions \"StartingQuadrant\" P1 (sites {0..5})) (regions \"StartingQuadrant\" P2 (sites {12..17})) (piece \"Disc\" Each (forEach Die if:(\"DieNotUsed\") (if (\"IsOffBoard\" \"SiteToMoveOnTrack\") \"RemoveAPiece\" (if (or { (is Empty (\"SiteToMoveOnTrack\")) (and (\"IsFriendAt\" \"SiteToMoveOnTrack\") (if (is In (to) (sites Mover \"StartingQuadrant\")) (not (\"IsSingletonStack\" \"SiteToMoveOnTrack\")) True)) (and (\"IsEnemyAt\" \"SiteToMoveOnTrack\") (\"IsSingletonStack\" \"SiteToMoveOnTrack\"))}) (move (from) (to \"SiteToMoveOnTrack\" (\"HittingCapture\" (handSite (who at:(to))))))))))}) (rules (start { (place Stack \"Disc1\" 0 count:15) (place Stack \"Disc2\" 12 count:15)}) (play (\"RollEachNewTurnMove\" (or (forEach Piece top:True) (forEach Piece container:(mover) top:True) (then (\"ReplayNotAllDiceUsed\"))))) (end { (\"EscapeWin\") (if (and (no Moves P1) (no Moves P2)) (result Mover Draw))}))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"Domineering\" (players 2) (equipment { (board (rectangle 6 6)) (tile \"Horz\" P1 {R F} numSides:4) (tile \"Vert\" P2 {F} numSides:4)}) (rules (play (move Add (piece (mover) state:0) (to (sites Empty)))) (end (\"NoMoves\" Loss))))\n\n###\n\n", "completion": "Two 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 board has 6 rows. The board has 6 columns. The Last player to play wins. END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"PlayAPiece\" (if (= (count Pips) 6) (forEach Piece \"King_noCross\") (if (= (count Pips) 5) (forEach Piece \"Queen\") (if (= (count Pips) 4) (forEach Piece \"Elephant\") (if (= (count Pips) 3) (forEach Piece \"Knight\") (if (= (count Pips) 2) (forEach Piece \"Rook\") (forEach Piece \"Pawn\"))))))) (game \"Shatranj al-Mustatila\" (\"TwoPlayersNorthSouth\") (equipment { (board (rectangle 16 4)) (\"ChessKing\" \"King_noCross\") (piece \"Queen\" Each (\"StepToNotFriend\" Diagonal)) (piece \"Elephant\" Each (move Hop Diagonal (between if:True) (to if:(or (is Empty (to)) (and (\"IsEnemyAt\" (to)) (not (\"IsPieceAt\" \"Elephant\" Next (to))))) (apply (remove (to)))))) (\"ChessKnight\" \"Knight\") (\"ChessRook\" \"Rook\") (\"ChessPawn\" \"Pawn\" ~ (then (\"PromoteIfReach\" (sites Mover \"Promotion\") \"Queen\"))) (regions \"Promotion\" P1 (sites Top)) (regions \"Promotion\" P2 (sites Bottom)) (dice d:6 from:1 num:1)}) (rules (start { (place \"Pawn1\" (union (sites Row 4) (sites Row 5))) (place \"Pawn2\" (union (sites Row 10) (sites Row 11))) (place \"Elephant1\" (sites {\"A1\" \"D1\"})) (place \"Knight1\" (sites {\"B2\" \"C2\"})) (place \"Rook1\" (sites {\"A2\" \"D2\"})) (place \"King_noCross1\" coord:\"B1\") (place \"Queen1\" coord:\"C1\") (place \"Elephant2\" (sites {\"A16\" \"D16\"})) (place \"Knight2\" (sites {\"B15\" \"C15\"})) (place \"Rook2\" (sites {\"A15\" \"D15\"})) (place \"King_noCross2\" coord:\"C16\") (place \"Queen2\" coord:\"B16\")}) (play (do (do (roll) next:(if (\"IsInCheck\" \"King_noCross\" Next (forEach Piece)) (move Pass (then (trigger \"NextCanNotEscape\" (next)))) (\"PlayAPiece\"))) ifAfterwards:(not (\"IsInCheck\" \"King_noCross\" Mover (forEach Piece Next))))) (end { (\"Checkmate\" \"King_noCross\") (if (is Triggered \"CanNotEscape\" Next) (result Mover Win)) (if (not (can Move (forEach Piece Next))) (result Mover Win))})))\n\n###\n\n", "completion": "4x16 board. The pieces move as follows, with the number per player: Shah (king)x1: moves one space orthogonally or diagonally. Fers (counselor)x1: one square diagonally; Rukh (rook)x2: any number of spaces orthogonally; Pil (elephant)x2: two squares diagonally, jumping over the first, cannot capture another Pil; Asb (horse)x2: moves orthogonally one space and then diagonally one space, jumping over any intervening pieces; Sarbaz (soldier)x8: moves one space forward orthogonally or one space forward diagonally to capture. No en passant, promoted to Fers when reaching the sixteenth rank. Pieces are placed with the Shah and Fers in the center of the row closest to the player (Shah to the right), a Pil on either side of them, the Asb on the two center squares in the second row, flanked by the Rukh, and the Sarbaz on the fifth and sixth rows. Movement of the pieces is determined by one six-sided die, with the following throws: 6=Shah, 5=Fers, 4=Pil, 3=Asb, 2=Rukh, 1=Sarbaz. No castling. Stalemate results in win for player causing it. When the Shah is in check, the opponent must roll a 6 for it to escape. The player who checkmates the Shah wins. \n 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": "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\nThe following rules are additionally used to the chess rules:\n - Pawns can only advance one space on their first move. There is no en passant capturing.\n - A pawn can only promote to a captured piece.\n - There is no castling.\n - If 20 moves are played without a capture or promotion, the player with the most `points' on the board wins. (Pawn=1 pt., Bishop/Knight=3, Rook=5, Queen = 9.) The game starts like in the encyclopedia of Chess Variants.\n\n###\n\n", "completion": "(define \"PromoteMove\" (or { (if (\"WasCaptured\" (id \"Queen\" Mover)) (move Promote #1 (piece {\"Queen\"}) Mover)) (if (\"WasCaptured\" (id \"Knight\" Mover)) (move Promote #1 (piece {\"Knight\"}) Mover)) (if (\"WasCaptured\" (id \"Rook\" Mover)) (move Promote #1 (piece {\"Rook\"}) Mover)) (if (\"WasCaptured\" (id \"Bishop\" Mover)) (move Promote #1 (piece {\"Bishop\"}) Mover))} #2)) (define \"WasCaptured\" (is In #1 (values Remembered \"CapturedPieces\"))) (define \"CaptureForwardDiagonal\" (move Step (directions {FR FL}) (to if:(\"IsEnemyAt\" (to)) (apply (and (remove (to)) (remember Value \"CapturedPieces\" (what at:(to)))))))) (define \"CaptureToPieceAndResetCounter\" (apply (if (\"IsEnemyAt\" (to)) (and (remove (to) (then (set Counter))) (remember Value \"CapturedPieces\" (what at:(to))))))) (game \"Quick Chess\" (\"TwoPlayersNorthSouth\") (equipment { (board (rectangle 6 5)) (piece \"Pawn\" Each (or { \"StepForwardToEmpty\" \"CaptureForwardDiagonal\"} (then (and (if (and (is In (last To) (sites Mover \"Promotion\")) (can Move (\"PromoteMove\" (last To)))) (moveAgain)) (set Counter))))) (piece \"Rook\" Each (move Slide Orthogonal (to if:(\"IsEnemyAt\" (to)) \"CaptureToPieceAndResetCounter\"))) (piece \"King\" Each (move Step (to if:(not (\"IsFriendAt\" (to))) \"CaptureToPieceAndResetCounter\"))) (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\"))) (regions \"Promotion\" P1 (sites Top)) (regions \"Promotion\" P2 (sites Bottom))}) (rules (start { (place \"Pawn1\" (sites Row 1)) (place \"Pawn2\" (sites Row 4)) (place \"Rook1\" {\"E1\"}) (place \"Knight1\" {\"A1\"}) (place \"Bishop1\" {\"D1\"}) (place \"Queen1\" coord:\"C1\") (place \"King1\" coord:\"B1\") (place \"Rook2\" {\"E6\"}) (place \"Knight2\" {\"A6\"}) (place \"Bishop2\" {\"D6\"}) (place \"Queen2\" coord:\"C6\") (place \"King2\" coord:\"B6\")}) (play (if \"SameTurn\" (\"PromoteMove\" (last To)) (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King\" Mover))) (then (if (= 19 (counter)) (and (forEach Player (forEach Site (sites Occupied by:Player) (if (= (what at:(site)) (id \"Pawn\" Player)) (addScore Player 1) (if (= (what at:(site)) (id \"Rook\" Player)) (addScore Player 5) (if (= (what at:(site)) (id \"Queen\" Player)) (addScore Player 9) (if (!= (what at:(site)) (id \"King\" Player)) (addScore Player 3))))))) (set Var \"NoEnoughCapture\" 1)))))) (end { (\"Checkmate\" \"King\") (if (no Moves Mover) (result Mover Draw)) (if (= (var \"NoEnoughCapture\") 1) (byScore))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nMonty Hall asks to choose one of three doors. One of the doors hides a car and the other two doors have a goat. You select which door you pick, but you don\u2019t open it right away.\n \n The game opens one of the other two doors, and there is no prize behind it.\n \n At this moment, there are two closed doors. You can keep the same choice or selecting the other door. If you get the car you win if not you loss. \n\n###\n\n", "completion": "(game \"Monty Hall Problem\" (players 1) (equipment { (board (rectangle 1 3)) (piece \"Car\" Shared) (piece \"Goat\" Shared)}) (rules (start { (place Random {\"Car\"}) (place Random {\"Goat\"} count:2) (set Hidden What (sites Board) to:P1)}) phases:{ (phase \"FirstChoice\" (play (move Select (from (sites Board)) (then (set Hidden What (sites Random (forEach (sites Board) if:(and (!= (site) (last To)) (!= (id \"Car\" Shared) (what at:(site))))) num:1) False to:P1)))) (nextPhase \"FinalChoice\")) (phase \"FinalChoice\" (play (move Select (from (sites Board)) (then (set Hidden What (sites Board) False to:P1)))) (end { (if (\"IsPieceAt\" \"Car\" Shared (last To)) (result P1 Win)) (if (\"IsPieceAt\" \"Goat\" Shared (last To)) (result P1 Loss))}))})) END" }, { "prompt": "Construct a Ludii game based on the following description\n8x8 board. The pieces move as follows, with the number per player: King (x1): moves one space orthogonally or diagonally; Counselor (x1): One square diagonally, but may move two spaces forward orthogonally on the first move, jumping over the Soldier in front of it on the first move of the game; Rook (x2): Any number of spaces orthogonally; Elephant (x2): Two squares diagonally, jumping over the first, cannot capture another Elephant; Horse (x2): Moves as a chess knight. Soldier (x8): Moves one space forward orthogonally; one space forward diagonally to capture. The Soldier in front of the Counselor may jump to the space in front of the Counselor when it has used its special move on the first turn, this must be done as the second move of the game, i.e. on the next turn after the Counselor had made its special move. No en passant. Soldiers promote to Counselor when reaching the eighth rank. No castling. Stalemate results in a win for player causing it. The player who checkmates the king wins.\n \n\n###\n\n", "completion": "(game \"Rumi Shatranj\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (hand Each size:5) (\"ChessKing\" \"King_noCross\") (\"ChessRook\" \"Rook\") (piece \"Elephant\" Each (move Hop Diagonal (between if:True) (to if:(or (is Empty (to)) (and (\"IsEnemyAt\" (to)) (not (\"IsPieceAt\" \"Elephant\" Next (to))))) (apply (remove (to)))))) (\"ChessKnight\" \"Knight\") (\"ChessPawn\" \"Pawn\" ~ (then (\"ReplayInMovingOn\" (sites Mover \"Promotion\")))) (piece \"Ferz_noCross\" Each (\"StepToNotFriend\" Diagonal)) (regions \"Promotion\" P1 (sites Top)) (regions \"Promotion\" P2 (sites Bottom))}) (rules (start { (place \"Pawn1\" (sites Row 1)) (place \"Pawn2\" (sites Row 6)) (place \"Rook1\" {\"A1\" \"H1\"}) (place \"Knight1\" {\"B1\" \"G1\"}) (place \"Elephant1\" {\"C1\" \"F1\"}) (place \"Ferz_noCross1\" coord:\"D1\") (place \"King_noCross1\" coord:\"E1\") (place \"Rook2\" {\"A8\" \"H8\"}) (place \"Knight2\" {\"B8\" \"G8\"}) (place \"Elephant2\" {\"C8\" \"F8\"}) (place \"Ferz_noCross2\" coord:\"D8\") (place \"King_noCross2\" coord:\"E8\")}) phases:{ (phase \"OpeningCounselor\" (play (forEach Piece \"Ferz_noCross\" (move Hop Forward (between if:True) (to if:(is Empty (to)) (apply (remove (to))))))) (nextPhase Mover \"OpeningSoldier\")) (phase \"OpeningSoldier\" (play (forEach Piece \"Pawn\" (if (is In (from) (sites {\"D2\" \"D7\"})) (move Hop Forward (between if:True) (to if:(is Empty (to)) (apply (remove (to)))))))) (nextPhase Mover \"Playing\")) (phase \"Playing\" (play (if \"SameTurn\" (move Promote (last To) (piece \"Ferz_noCross\") Mover) (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King_noCross\" Mover))))))} (end { (\"Checkmate\" \"King_noCross\") (\"BlockWin\")}))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x7 board. Six counters in each hole. Play begins from any one of a player's holes, even if there is just one. Sowing occurs in an anti-clockwise direction. If they end in a hole with counters, these are picked up and sowing continues. If sowing ends in an empty hole, the contents of the next hole are captured and the turn ends. When sowing, if the contents of a hole are brought to four, they are immediately captured by the player in whose row the counters are located. Play ends when a player has no counters in their holes, remaining player takes all the remaining counters. In the next round, the player with the smaller number of counters captured from the previous round fills as many of their holes as they can, starting from the left and filling each hole with six counters. Leftover counters are placed in the player's store. The opponent then does the same. Any holes remaining empty are out of play for this round, otherwise play continues as before. The right to begin alternates from round to round. Further rounds are played until one player has fewer than six counters. \n\n###\n\n", "completion": "(define \"NextHoleFrom\" (\"NextSiteOnTrack\" #2 from:#1)) (define \"LeftMostEmpty\" (trackSite FirstSite from:(mapEntry \"LeftMost\" Mover) if:(is Empty (to)))) (define \"OneRowIsEmpty\" (or (all Sites (sites Bottom) if:(= 0 (count at:(site)))) (all Sites (sites Top) if:(= 0 (count at:(site)))))) (define \"PlayableSites\" (sites (values Remembered \"Playable\"))) (define \"PiecesOwnedBy\" (+ (count at:(mapEntry #1)) (count in:(sites #1)))) (game \"Pallankuli\" (players 2) (equipment { (mancalaBoard 2 7 store:None (track \"Track\" \"0,E,N,W\" loop:True)) (piece \"Seed\" Shared) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map \"LeftMost\" {(pair P1 0) (pair P2 13)}) (hand Each)}) (rules (start { (set Count 6 to:(sites Track)) (set RememberValue \"Playable\" (union (sites Top) (sites Bottom)))}) phases:{ (phase \"Sowing\" (play (or { (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (sites Mover)) if:(and (is Occupied (from)) (is In (from) (\"PlayableSites\")))) (then (do (set Var \"NumSowed\" (count at:(last To))) next:(sow apply:(if (and (!= 4 (count at:(to))) (< 1 (count at:(to)))) (and (moveAgain) (set Var \"Replay\" (to))) (if (= 1 (count at:(to))) (if (is Occupied (\"NextHoleFrom\" (to) 1)) (fromTo (from (\"NextHoleFrom\" (to) 1)) (to (handSite Mover)) count:(count at:(\"NextHoleFrom\" (to) 1)))))) skipIf:(not (is In (to) (\"PlayableSites\")))) (then (and (forEach Site (sites Track from:(last From) to:(trackSite Move from:(last From) \"Track\" steps:(var \"NumSowed\"))) (if (= 4 (count at:(site))) (fromTo (from (site)) (to (if (is In (to) (sites P1)) (handSite P1) (handSite P2))) count:4))) (set Var \"NumSowed\" 0))))))} (then (if (\"OneRowIsEmpty\") (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)))) (forget Value \"Playable\" All)}))))) (end (if (\"NoPieceOnBoard\") { (if (> 6 (count Cell at:(handSite P1))) (result P2 Win)) (if (> 6 (count Cell at:(handSite P2))) (result P1 Win))})) (nextPhase (\"NoPieceOnBoard\") \"BetweenRounds\")) (phase \"BetweenRounds\" (play (if (<= 6 (count Cell at:(handSite Mover))) (move (from (handSite Mover)) (to (\"LeftMostEmpty\") if:(is In (to) (sites Mover))) count:6 (then (remember Value \"Playable\" (last To)))))) (nextPhase (all Passed) \"Sowing\"))})) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nA 8x8 board is currently selected -> A 6x6 board is currently selected\n(define \"Step\" (move Step (from) (to if:(and { (is Empty (to)) (= 0 (count Sites in:(difference (sites Around (to) Own Orthogonal) (sites {(from)})))) (not (and (< 0 (count Sites in:(sites Around (from) Enemy Orthogonal))) (= 0 (count Sites in:(sites Around (to) Enemy Orthogonal))))) (or { (and (= 0 (count Sites in:(sites Around (from) Enemy Orthogonal))) (< 0 (count Sites in:(sites Around (to) Enemy Orthogonal)))) (or { (and (or (= (from) (+ (to) 10)) (= (from) (- (to) 10))) (\"Inward\" N S)) (and (or (= (from) (+ (to) 1)) (= (from) (- (to) 1))) (\"Inward\" E W)) (and (or (= (from) (+ (to) (+ 10 1))) (= (from) (- (to) (+ 10 1)))) (\"Inward\" SW NE)) (and (or (= (from) (+ (to) (- 10 1))) (= (from) (- (to) (- 10 1)))) (\"Inward\" SE NW))})})})))) (define \"Hop\" (move Hop (from #1) Orthogonal (between if:(is Occupied (between)) (apply (remove (between)))) (to if:(and { (is Empty (to)) (= 0 (count Sites in:(sites Around (to) Own Orthogonal)))})) (then (and { (remove (sites Outer)) (set Var 1) (if (can Move (move Hop (from (last To)) Orthogonal (between if:(is Occupied (between)) (apply (remove (between)))) (to if:(and { (is Empty (to)) (= 0 (count Sites in:(sites Around (to) Own Orthogonal)))})))) (moveAgain) (set Var 0))})))) (define \"Inward\" (> (max (count Sites in:(sites Direction from:(from) #1)) (count Sites in:(sites Direction from:(from) #2))) (max (count Sites in:(sites Direction from:(to) #1)) (count Sites in:(sites Direction from:(to) #2))))) (game \"Cage\" (players 2) (equipment { (board (square 10)) (piece \"Disc\" Each)}) (rules (start { (place \"Disc1\" (difference (sites Phase 0) (sites Outer))) (place \"Disc2\" (difference (sites Phase 1) (sites Outer)))}) (play (forEach Piece (if (!= 1 (var)) (or (\"Hop\" ~) (\"Step\")) (\"Hop\" if:(= (from) (last To)))))) (end (if (or (= 0 (count Sites in:(sites Occupied by:P1))) (= 0 (count Sites in:(sites Occupied by:P2)))) (result Mover Win)))))\n\n###\n\n", "completion": "(define \"Step\" (move Step (from) (to if:(and { (is Empty (to)) (= 0 (count Sites in:(difference (sites Around (to) Own Orthogonal) (sites {(from)})))) (not (and (< 0 (count Sites in:(sites Around (from) Enemy Orthogonal))) (= 0 (count Sites in:(sites Around (to) Enemy Orthogonal))))) (or { (and (= 0 (count Sites in:(sites Around (from) Enemy Orthogonal))) (< 0 (count Sites in:(sites Around (to) Enemy Orthogonal)))) (or { (and (or (= (from) (+ (to) 8)) (= (from) (- (to) 8))) (\"Inward\" N S)) (and (or (= (from) (+ (to) 1)) (= (from) (- (to) 1))) (\"Inward\" E W)) (and (or (= (from) (+ (to) (+ 8 1))) (= (from) (- (to) (+ 8 1)))) (\"Inward\" SW NE)) (and (or (= (from) (+ (to) (- 8 1))) (= (from) (- (to) (- 8 1)))) (\"Inward\" SE NW))})})})))) (define \"Hop\" (move Hop (from #1) Orthogonal (between if:(is Occupied (between)) (apply (remove (between)))) (to if:(and { (is Empty (to)) (= 0 (count Sites in:(sites Around (to) Own Orthogonal)))})) (then (and { (remove (sites Outer)) (set Var 1) (if (can Move (move Hop (from (last To)) Orthogonal (between if:(is Occupied (between)) (apply (remove (between)))) (to if:(and { (is Empty (to)) (= 0 (count Sites in:(sites Around (to) Own Orthogonal)))})))) (moveAgain) (set Var 0))})))) (define \"Inward\" (> (max (count Sites in:(sites Direction from:(from) #1)) (count Sites in:(sites Direction from:(from) #2))) (max (count Sites in:(sites Direction from:(to) #1)) (count Sites in:(sites Direction from:(to) #2))))) (game \"Cage\" (players 2) (equipment { (board (square 8)) (piece \"Disc\" Each)}) (rules (start { (place \"Disc1\" (difference (sites Phase 0) (sites Outer))) (place \"Disc2\" (difference (sites Phase 1) (sites Outer)))}) (play (forEach Piece (if (!= 1 (var)) (or (\"Hop\" ~) (\"Step\")) (\"Hop\" if:(= (from) (last To)))))) (end (if (or (= 0 (count Sites in:(sites Occupied by:P1))) (= 0 (count Sites in:(sites Occupied by:P2)))) (result Mover Win))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"Surrounded\" (surround (from (last To)) Orthogonal (between if:(and (is In (between) (sites Corners)) (\"IsEnemyAt\" (between))) (apply (remove (between)))) (to if:(\"IsFriendAt\" (to))))) (game \"Dai Hasami Shogi\" (players 2) (equipment { (board (square 9)) (piece \"Marker\" Each (or (move Slide Orthogonal) (\"HopAllPiecesToEmpty\" Orthogonal) (then (or (\"CustodialCapture\" Orthogonal (max 1)) \"Surrounded\")))) (regions P1 (expand (sites Bottom))) (regions P2 (expand (sites Top)))}) (rules (start { (place \"Marker1\" (sites P1)) (place \"Marker2\" (sites P2))}) (play (forEach Piece)) (end { (if (is Line 5 Orthogonal if:(not (is In (to) (sites Mover)))) (result Mover Win)) (if (and (< (count Pieces P1) 5) (< (count Pieces P2) 5)) (result Mover Draw))})))\n\n###\n\n", "completion": "Played on a 9x9 board with nine Go pieces per player occupying their two nearest ranks. Pieces move as a rook in Shogi. Pieces may also move by hopping over an adjacent piece of any color. This does not capture the piece, and multiple hops are not allowed in on turn. The goal is to create an orthogonal line of five of a player's pieces outside the player's starting rows. The game is played on a Shogi board. END" }, { "prompt": "Construct a Ludii game based on the following description\n7x7 lines, intersecting to form a square. Diagonals are drawn in the four quadrants of the board. Two triangles, their apices intersecting the main board at opposite midpoints. The base of the triangle is bisected by a line drawn from the apex, and this line is bisected and intersects with the other two sides of the triangle. Twenty pieces per player, which begin on the points in the triangles and the first two rows of points in the square on the side closest to the player. Players alternate turns moving a piece to an empty adjacent spot along the lines of the board. A piece may capture an opponent's piece by hopping over it to an empty point on the opposite side of the opponent's piece along the lies of the board. Multiple captures are allowed. The player who captures all the opponent's pieces wins. \n\n###\n\n", "completion": "(game \"Mughal Pathan\" (players 2) (equipment { (board (add (merge { (square 7) (shift 1 6 (rotate 180 (wedge 3))) (shift 1 -2 (wedge 3))}) edges:{ {0 8} {8 16} {16 24} {24 32} {32 40} {40 48} {6 12} {12 18} {18 24} {24 30} {30 36} {36 42} {3 9} {9 15} {15 21} {21 29} {29 37} {37 45} {45 39} {39 33} {33 27} {27 19} {19 11} {11 3}}) use:Vertex) (piece \"Marker\" Each (or (\"HopSequenceCapture\") (\"StepToEmpty\")))}) (rules (start { (place \"Marker1\" (union (sites Bottom) (expand (sites Row 2)))) (place \"Marker2\" (union (sites Top) (expand (sites Row 8))))}) (play (if (\"SameTurn\") (or (\"HopSequenceCaptureAgain\") (move Pass)) (forEach Piece))) (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Construct a Ludii game based on the following description\n4x9 board. Two counters in each hole. Players alternate turns sowing from one of the holes in their rows in an anti-clockwise direction. When a counter falls into a hole in their inner row, the player captures the counters from both of the opposite holes on the opponent's side of the board; if one of the two opposite holes is empty, no capture is made. Captures counters are sown on the player's side of the board. Play continues until one player captures all of the counters or one player forfeits. \n\n###\n\n", "completion": "(define \"Columns\" 9) (define \"NoPieceNext\" (= (count in:(sites Next \"Home\")) 0)) (define \"LastHole\" (last To afterConsequence:True)) (game \"Ngolo\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"0,E,N1,W\" loop:True P1) (track \"Track2\" \"18,E,N1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"Track1\")) (regions \"Home\" P2 (sites Track \"Track2\")) (regions \"Inner\" P1 (difference (sites Track \"Track1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"Track2\") (sites Top))) (piece \"Seed\" Shared)}) (rules (start (set Count 2 to:(union (sites P1 \"Home\") (sites P2 \"Home\")))) (play (or (move Pass) (move Select (from (sites Mover \"Home\") if:(< 0 (count at:(from)))) (then (sow \"Track\" owner:(mover) apply:(if (and { (!= (count at:(\"OppositeOuterPit\" (to))) 0) (!= (count at:(\"OppositePit\" (to))) 0) (is In (to) (sites Mover \"Inner\"))}) (and { (fromTo (from (\"OppositeOuterPit\" (to))) (to (to)) count:(count at:(\"OppositeOuterPit\" (to)))) (fromTo (from (\"OppositePit\" (to))) (to (to)) count:(count at:(\"OppositePit\" (to)))) (sow (to) count:(+ (count at:(\"OppositePit\" (to))) (count at:(\"OppositeOuterPit\" (to)))) \"Track\" owner:(mover))}))))))) (end { (if (\"NoPieceNext\") (result Mover Win)) (if (was Pass) (result Next Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlay begins with six counters in each hole. Sowing is anti-clockwise. If the last counter of a sowing lands in the player's own hole making it even, the counters are captured. If the contents of the hole before it is also even, these are also taken, continuing until an odd or empty hole is reached. If the last counter makes a hole odd, the turn ends. If a player has no counters in their holes at the end of the turn, the opponent must play so that the player can play on the next turn. Play ends when neither player is able to move; the last player who was able to move takes the remaining counters and the player with the most counters captured wins. \n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (game \"Halusa\" (players 2) (equipment { (mancalaBoard 2 6 store:None (track \"Track\" \"0,E,N,W\" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 6 to:(sites Track))) (play (do (move Select (from (sites Mover) if:(> (count at:(from)) 0)) (then (sow if:(and (is In (to) (sites Mover)) (is Even (count at:(to)))) apply:(fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))) backtracking:True))) ifAfterwards:(> (count in:(sites Next)) 0))) (end (\"MancalaByScoreWhen\" (no Moves Mover))))) 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": "Construct a Ludii game based on the following description\n2x6 board with two stores. Four counters in each hole. Sowing occurs in an anti-clockwise direction. When the final counter lands in a hole containing one or two counters, thus making it contain two or three counters, these are captured. When this capture is made, other holes with two or three counters in them, in an uninterrupted sequence behind the hole from which the first capture was made, are captured. The player who captures the most counters wins. \n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (+ (count Cell at:(mapEntry #1)) (count in:(sites #1)))) (game \"Adidada\" (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 (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))) backtracking:True)))) (end (\"MancalaByScoreWhen\" (no Moves Mover))))) 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": "Modify the Ludii game according to the following option changes:\nA 3x3 board is currently selected -> A 4x4 board is currently selected\n(define \"UpdateScores\" (and (set Score P1 (count Sites in:(forEach (sites Phase 1) if:(is Occupied (site))))) (set Score P2 (count Sites in:(forEach (sites Phase 0) if:(is Occupied (site))))))) (define \"DistanceToEndSquare\" (count Sites in:(sites Direction from:(last From) (\"LastDirection\" Cell) stop:(is Empty (to)) distance:(size Stack at:(last From))))) (define \"EnoughSpaceInDirection\" (<= (size Stack at:(from)) (count Sites in:(sites Direction from:(from) (directions Cell from:(from) to:#1) distance:(size Stack at:(from)))))) (define \"ZeroEmptyInRangeInDirection\" (= 0 (count Sites in:(intersection (sites Empty) (sites Direction from:(from) (directions Cell from:(from) to:#1) distance:(size Stack at:(from))))))) (define \"ContainedMove\" (move Select (from (sites Occupied by:P1)) (to (sites Around (from) NotEmpty) if:(and (or (\"EnoughSpaceInDirection\" (to)) (\"ZeroEmptyInRangeInDirection\" (to))) (all Sites (sites Around (from) NotEmpty) if:(not (and (< (count Sites in:(sites Direction from:(from) (directions Cell from:(from) to:(to)) stop:(is Empty (to)) distance:(size Stack at:(from)))) (count Sites in:(sites Direction from:(from) (directions Cell from:(from) to:(site)) stop:(is Empty (to)) distance:(size Stack at:(from))))) (or (\"EnoughSpaceInDirection\" (site)) (\"ZeroEmptyInRangeInDirection\" (site)))))))) (then (forEach Site (sites Direction from:(last From) (\"LastDirection\" Cell) stop:(is Empty (to)) distance:(size Stack at:(last From))) (if (= (\"DistanceToEndSquare\") (count Steps (last From) (site))) (add (piece \"Disc1\") (to (site)) count:(- (size Stack at:(last From)) (- (\"DistanceToEndSquare\") 1)) stack:True) (add (piece \"Disc1\") (to (site)) stack:True)))))) (define \"OverflowMove\" (move Select (from (sites Occupied by:P1)) (to (sites Around (from)) if:(and (not (\"EnoughSpaceInDirection\" (to))) (not (\"ZeroEmptyInRangeInDirection\" (to))))) (then (forEach Site (sites Direction from:(last From) (\"LastDirection\" Cell) distance:(size Stack at:(last From))) (add (piece \"Disc1\") (to (site)) stack:True))))) (game \"Overflow\" (players 2) (equipment { (board (square 3)) (piece \"Disc\" P1)}) (rules (start { (place \"Disc1\" (sites Board)) (set Score P1 (count Sites in:(sites Phase 1))) (set Score P2 (count Sites in:(sites Phase 0)))}) (play (do (or (\"ContainedMove\") (\"OverflowMove\") (then (remove (last From) count:(size Stack at:(last From))))) ifAfterwards:(= 1 (count Groups)) (then (\"UpdateScores\")))) (end (if (= 0 (* (score P1) (score P2))) (byScore)))))\n\n###\n\n", "completion": "(define \"UpdateScores\" (and (set Score P1 (count Sites in:(forEach (sites Phase 1) if:(is Occupied (site))))) (set Score P2 (count Sites in:(forEach (sites Phase 0) if:(is Occupied (site))))))) (define \"DistanceToEndSquare\" (count Sites in:(sites Direction from:(last From) (\"LastDirection\" Cell) stop:(is Empty (to)) distance:(size Stack at:(last From))))) (define \"EnoughSpaceInDirection\" (<= (size Stack at:(from)) (count Sites in:(sites Direction from:(from) (directions Cell from:(from) to:#1) distance:(size Stack at:(from)))))) (define \"ZeroEmptyInRangeInDirection\" (= 0 (count Sites in:(intersection (sites Empty) (sites Direction from:(from) (directions Cell from:(from) to:#1) distance:(size Stack at:(from))))))) (define \"ContainedMove\" (move Select (from (sites Occupied by:P1)) (to (sites Around (from) NotEmpty) if:(and (or (\"EnoughSpaceInDirection\" (to)) (\"ZeroEmptyInRangeInDirection\" (to))) (all Sites (sites Around (from) NotEmpty) if:(not (and (< (count Sites in:(sites Direction from:(from) (directions Cell from:(from) to:(to)) stop:(is Empty (to)) distance:(size Stack at:(from)))) (count Sites in:(sites Direction from:(from) (directions Cell from:(from) to:(site)) stop:(is Empty (to)) distance:(size Stack at:(from))))) (or (\"EnoughSpaceInDirection\" (site)) (\"ZeroEmptyInRangeInDirection\" (site)))))))) (then (forEach Site (sites Direction from:(last From) (\"LastDirection\" Cell) stop:(is Empty (to)) distance:(size Stack at:(last From))) (if (= (\"DistanceToEndSquare\") (count Steps (last From) (site))) (add (piece \"Disc1\") (to (site)) count:(- (size Stack at:(last From)) (- (\"DistanceToEndSquare\") 1)) stack:True) (add (piece \"Disc1\") (to (site)) stack:True)))))) (define \"OverflowMove\" (move Select (from (sites Occupied by:P1)) (to (sites Around (from)) if:(and (not (\"EnoughSpaceInDirection\" (to))) (not (\"ZeroEmptyInRangeInDirection\" (to))))) (then (forEach Site (sites Direction from:(last From) (\"LastDirection\" Cell) distance:(size Stack at:(last From))) (add (piece \"Disc1\") (to (site)) stack:True))))) (game \"Overflow\" (players 2) (equipment { (board (square 4)) (piece \"Disc\" P1)}) (rules (start { (place \"Disc1\" (sites Board)) (set Score P1 (count Sites in:(sites Phase 1))) (set Score P2 (count Sites in:(sites Phase 0)))}) (play (do (or (\"ContainedMove\") (\"OverflowMove\") (then (remove (last From) count:(size Stack at:(last From))))) ifAfterwards:(= 1 (count Groups)) (then (\"UpdateScores\")))) (end (if (= 0 (* (score P1) (score P2))) (byScore))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game involves a pile of 5 pieces. -> The game involves a pile of 10 pieces.\n(define \"NumRemove\" (+ 1 (count MovesThisTurn))) (define \"Max\" (if (= 1 (count Turns)) (- 5 1) (* 2 (value Player (prev MoverLastTurn))))) (game \"Fibonacci Nim\" (players 2) (equipment { (board (square 1)) (piece \"Marker\" Neutral)}) (rules (start (set Count 5 at:0)) (play (if \"SameTurn\" (or (if (<= \"NumRemove\" \"Max\") (move Select (from (last To)) (then (if (= (count at:(last To)) 1) (remove (last To)) (and (set Count at:(last To) (- (count at:(last To)) 1)) (moveAgain)))))) (move Pass (then (set Value Mover (- (\"NumRemove\") 1))))) (move Select (from (sites Occupied by:Neutral)) (then (if (= (count at:(last To)) 1) (remove (last To)) (and (set Count at:(last To) (- (count at:(last To)) 1)) (moveAgain))))))) (end (if (no Moves Next) (result Mover Win)))))\n\n###\n\n", "completion": "(define \"NumRemove\" (+ 1 (count MovesThisTurn))) (define \"Max\" (if (= 1 (count Turns)) (- 10 1) (* 2 (value Player (prev MoverLastTurn))))) (game \"Fibonacci Nim\" (players 2) (equipment { (board (square 1)) (piece \"Marker\" Neutral)}) (rules (start (set Count 10 at:0)) (play (if \"SameTurn\" (or (if (<= \"NumRemove\" \"Max\") (move Select (from (last To)) (then (if (= (count at:(last To)) 1) (remove (last To)) (and (set Count at:(last To) (- (count at:(last To)) 1)) (moveAgain)))))) (move Pass (then (set Value Mover (- (\"NumRemove\") 1))))) (move Select (from (sites Occupied by:Neutral)) (then (if (= (count at:(last To)) 1) (remove (last To)) (and (set Count at:(last To) (- (count at:(last To)) 1)) (moveAgain))))))) (end (if (no Moves Next) (result Mover Win))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"StepMove\" (move Step #1 (to if:(and (= 0 (state at:(to))) (if (< (count MovesThisTurn) 2) (is Empty (to)) (is In (to) (union (sites Occupied by:Next) (sites Empty))))) (apply (if (\"IsEnemyAt\" (to)) (remove (to))))) (then (if (= 2 (count Sites in:(forEach (sites Board) if:(= 1 (state at:(site)))))) (forEach Site (sites Board) (if (= 1 (state at:(site))) (set State at:(site) 0))) (and (set State at:(last From) 1) (moveAgain)))))) (game \"Boxijn Barildaan\" (players 2) (equipment { (board (merge { (shift 1 0 (rectangle 4 2)) (shift 0 1 (rectangle 2 4))}) use:Vertex) (piece \"Marker\" Each (\"StepMove\"))}) (rules (start { (place \"Marker1\" (expand (sites Bottom))) (place \"Marker2\" (expand (sites Top)))}) (play (if (\"SameTurn\") (\"StepMove\" (from (last To))) (forEach Piece))) (end (\"CaptureAll\" Next))))\n\n###\n\n", "completion": "Four squares, arranged in a cross shape. The game is played along the lines. Four pieces per player, which begin on the corners of a square, opposite the square where the opponent's pieces are arranged. Players alternate turns moving their pieces. Pieces move three spaces along the lines on the board, capturing any piece on the third. The first two spaces in the move must be empty. Pieces may change direction in a turn, as long as the lines are followed and there is no backtracking. The player who captures all of the opponent's pieces wins. END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game is played on the Graph2. -> The game is played on the Graph3.\nThe players play on HackenbushR-B version. -> The players play on HackenbushR-G-B version.\n(define \"Ground\" (sites Bottom)) (define \"NotConnectedToTheGround\" (= 0 (count Sites in:(intersection (\"Ground\") (sites Group Edge at:(site) if:(is Occupied (to))))))) (define \"RemoveCutBranch\" (forEach Site (sites Group Edge at:(site)) (remove Edge (site)))) (game \"Hackenbush\" (players 2) (equipment { (board (graph vertices:{ {0 0} {2 0} {4 0} {6 0} {8 0} {10 0} {15 0} {4 2} {6 2} {10 2} {6 3} {4 4} {3 4} {3 5} {4 5} {6 5} {6 6} {7 6} {8 3} {8 4} {9 4} {9 5} {10 5} {10 4}} edges:{ {0 1} {1 2} {2 3} {4 3} {4 5} {6 5} {2 7} {3 8} {5 9} {8 10} {10 11} {11 12} {11 13} {11 14} {10 15} {15 16} {17 15} {8 18} {18 19} {18 20} {20 21} {20 22} {20 23}}) use:Edge) (piece \"Marker\" Each) (piece \"Disc\" Shared) (piece \"Cross\" Neutral) (regions All (expand (sites Bottom)))}) (rules (start { (set Neutral Edge (\"Ground\")) (set P1 Edge (sites {6..12})) (set P2 Edge (difference (sites Board Edge) (union (sites {6..12}) (sites {0..5}))))}) (play (move Remove (sites Occupied by:Mover) (then (forEach Site (sites Incident Edge of:Edge at:(last To)) (if (\"NotConnectedToTheGround\") (\"RemoveCutBranch\")))))) (end (if (no Moves Mover) (result Next Win)))))\n\n###\n\n", "completion": "(define \"Ground\" (sites Bottom)) (define \"NotConnectedToTheGround\" (= 0 (count Sites in:(intersection (\"Ground\") (sites Group Edge at:(site) if:(is Occupied (to))))))) (define \"RemoveCutBranch\" (forEach Site (sites Group Edge at:(site)) (remove Edge (site)))) (game \"Hackenbush\" (players 2) (equipment { (board (graph vertices:{ {0 0} {2 0} {4 0} {6 0} {8 0} {10 0} {15 0} {5 1} {4 3} {5 5} {9 1} {7 3} {7 5} {3 6} {10 4} {7 8} {8 11} {10 10} {10 9} {5 10} {4 11} {3 11} {3 12} {4 12} {7 12} {9 12} {8 13} {9 14} {11 14} {11 12} {13 12}} edges:{ {0 1} {1 2} {2 3} {4 3} {4 5} {6 5} {2 7} {7 8} {8 9} {4 10} {10 11} {11 12} {9 13} {9 12} {12 14} {13 15} {14 15} {15 16} {16 19} {19 20} {20 21} {21 22} {22 23} {20 23} {16 17} {17 18} {16 24} {24 26} {16 25} {25 26} {26 27} {27 28} {28 29} {29 30}}) use:Edge) (piece \"Marker\" Each) (piece \"Disc\" Shared) (piece \"Cross\" Neutral) (regions All (expand (sites Bottom)))}) (rules (start { (set Neutral Edge (\"Ground\")) (set P1 Edge (sites {6 8 10})) (set P2 Edge (sites {9 12 13})) (set Shared Edge (difference (sites Board Edge) (union (union (sites {6 8 10}) (sites {0..5})) (sites {9 12 13}))))}) (play (move Remove (difference (sites Occupied by:All on:Edge) (union (sites Occupied by:Neutral on:Edge) (sites Occupied by:Next on:Edge))) (then (forEach Site (sites Incident Edge of:Edge at:(last To)) (if (\"NotConnectedToTheGround\") (\"RemoveCutBranch\")))))) (end (if (no Moves Mover) (result Next Win))))) 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 Shah (king): moves one space orthogonally or diagonally. 1 x Fers (counselor): One square diagonally or, one the first turn, may jump two squares diagonally or orthogonally, over any pieces on the first square. There can be no capture with this move. 2 x Rukh (rook): Any number of spaces orthogonally. 2 x Pil (elephant): Two squares diagonally, jumping over the first. 2 x Asb (horse): Moves as a chess knight. 8 x Sarbaz (soldier): Moves one space forward orthogonally; one space forward diagonally to capture. No en passant. Promoted to Fers when reaching the eighth rank. On its first move, this promoted piece may also use the jumping move of the Fers. No castling. An opponent's piece is captured by moving a player's own piece onto a space occupied by the opponent's piece. When a Shah can be captured on the next turn by an opponent's piece, it is in check. The Shah must not be in check at the end of the player's turn. If this is not possible, it is checkmate and the opponent wins. Stalemate results in a win for that player causing it.\n \n\n###\n\n", "completion": "(define \"RememberMoved\" (set State at:#1 1)) (define \"MovedBefore\" (= 1 (state at:#1))) (game \"Shatranj (Turkey)\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (\"ChessKing\" \"King_noCross\") (piece \"Ferz_noCross\" (or (\"StepToNotFriend\" Diagonal) (if (not (\"MovedBefore\" (from))) (move Hop (between if:True) (to if:(is Empty (to))))) (then (if (not (\"MovedBefore\" (last To))) (\"RememberMoved\" (last To)))))) (piece \"Elephant\" (move Hop Diagonal (between if:True) (to if:(not (\"IsFriendAt\" (to))) (apply (if (\"IsEnemyAt\" (to)) (remove (to))))))) (\"ChessKnight\" \"Knight\") (\"ChessRook\" \"Rook\") (\"ChessPawn\" \"Pawn\" ~ (then (\"PromoteIfReach\" (sites Mover \"Promotion\") \"Ferz_noCross\"))) (regions \"Promotion\" P1 (sites Top)) (regions \"Promotion\" P2 (sites Bottom))}) (rules (start { (place \"Pawn1\" (sites Row 1)) (place \"Pawn2\" (sites Row 6)) (place \"Rook1\" {\"A1\" \"H1\"}) (place \"Knight1\" {\"B1\" \"G1\"}) (place \"Elephant1\" {\"C1\" \"F1\"}) (place \"Ferz_noCross1\" coord:\"D1\") (place \"King_noCross1\" coord:\"E1\") (place \"Rook2\" {\"A8\" \"H8\"}) (place \"Knight2\" {\"B8\" \"G8\"}) (place \"Elephant2\" {\"C8\" \"F8\"}) (place \"Ferz_noCross2\" coord:\"D8\") (place \"King_noCross2\" coord:\"E8\")}) (play (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King_noCross\" Mover)))) (end { (\"Checkmate\" \"King_noCross\") (if (no Moves Mover) (result Mover Loss))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThere is a large number of ak\u1e63as (beans) in a container, divisible by five. One player grasps a random number of them, and throws them onto a mat. The beans grabbed by the player is a \\ The game is played with the rules of Syed.\n\n###\n\n", "completion": "(define \"Treta\" (= 3 (% (count at:#1) 4))) (define \"Dvapara\" (= 2 (% (count at:#1) 4))) (define \"Kali\" (= 1 (% (count at:#1) 4))) (define \"Krta\" (= 0 (% (count at:#1) 4))) (game \"Aksadyuta\" (players 2) (equipment { (board (square 1)) (piece \"Bean\" Shared) (hand Each)}) (rules (start (place \"Bean\" 0 count:55)) (play (move (from (sites Board)) (to (handSite Mover)) count:(value Random (range 1 (count at:0))))) (end { (if (is Mover P2) { (if (and (\"Krta\" (handSite P1)) (not (\"Krta\" (handSite P2)))) (result P1 Win)) (if (and (\"Krta\" (handSite P2)) (not (\"Krta\" (handSite P1)))) (result P2 Win)) (if (and (\"Kali\" (handSite P1)) (not (\"Kali\" (handSite P2)))) (result P1 Loss)) (if (and (\"Kali\" (handSite P2)) (not (\"Kali\" (handSite P1)))) (result P2 Loss)) (if (and (\"Treta\" (handSite P1)) (\"Dvapara\" (handSite P2))) (result P1 Win)) (if (and (\"Treta\" (handSite P2)) (\"Dvapara\" (handSite P1))) (result P2 Win)) (if (and (\"Krta\" (handSite P1)) (\"Krta\" (handSite P2))) (result Mover Draw)) (if (and (\"Kali\" (handSite P1)) (\"Kali\" (handSite P2))) (result Mover Draw)) (if (and (\"Dvapara\" (handSite P1)) (\"Dvapara\" (handSite P2))) (result Mover Draw)) (if (and (\"Treta\" (handSite P1)) (\"Treta\" (handSite P2))) (result Mover Draw))})}))) 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": "Modify the Ludii game according to the following option changes:\n12 Holes per row. -> 15 Holes per row.\n(define \"NextHoleFrom\" (\"NextSiteOnTrack\" 1 from:#1 #2)) (define \"AHoleHasMoreThanOneCounter\" (not (all Sites (forEach (sites Mover) if:(< 1 (count at:(site)))) if:(= 0 (count at:(site)))))) (define \"NoPiece\" (all Sites (sites Player \"Home\") if:(= 0 (count at:(site))))) (define \"Columns\" 12) (game \"Tsoro\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"0,E,N1,W\" loop:True P1) (track \"Track2\" \"24,E,N1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"Track1\")) (regions \"Home\" P2 (sites Track \"Track2\")) (regions \"Inner\" P1 (difference (sites Track \"Track1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"Track2\") (sites Top))) (piece \"Seed\" Shared)}) (rules (start (set Count 2 to:(union (sites Top) (sites Bottom)))) (play (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(if \"AHoleHasMoreThanOneCounter\" (> (count at:(from)) 1) (and (= (count at:(from)) 1) (= 0 (count at:(\"NextHoleFrom\" (from) Mover)))))) (then (sow \"Track\" owner:(mover) apply:(if (= (count at:(to)) 1) (if (is In (to) (sites Mover \"Inner\")) (if (> (count at:(\"OppositePit\" (to))) 0) (and (remove (\"OppositePit\" (to))) (if (> (count at:(\"OppositeOuterPit\" (to))) 0) (remove (\"OppositeOuterPit\" (to))))))) (moveAgain)))))) (end (forEach NonMover if:(\"NoPiece\") (result Player Loss)))))\n\n###\n\n", "completion": "(define \"NextHoleFrom\" (\"NextSiteOnTrack\" 1 from:#1 #2)) (define \"AHoleHasMoreThanOneCounter\" (not (all Sites (forEach (sites Mover) if:(< 1 (count at:(site)))) if:(= 0 (count at:(site)))))) (define \"NoPiece\" (all Sites (sites Player \"Home\") if:(= 0 (count at:(site))))) (define \"Columns\" 15) (game \"Tsoro\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"0,E,N1,W\" loop:True P1) (track \"Track2\" \"30,E,N1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"Track1\")) (regions \"Home\" P2 (sites Track \"Track2\")) (regions \"Inner\" P1 (difference (sites Track \"Track1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"Track2\") (sites Top))) (piece \"Seed\" Shared)}) (rules (start (set Count 2 to:(union (sites Top) (sites Bottom)))) (play (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(if \"AHoleHasMoreThanOneCounter\" (> (count at:(from)) 1) (and (= (count at:(from)) 1) (= 0 (count at:(\"NextHoleFrom\" (from) Mover)))))) (then (sow \"Track\" owner:(mover) apply:(if (= (count at:(to)) 1) (if (is In (to) (sites Mover \"Inner\")) (if (> (count at:(\"OppositePit\" (to))) 0) (and (remove (\"OppositePit\" (to))) (if (> (count at:(\"OppositeOuterPit\" (to))) 0) (remove (\"OppositeOuterPit\" (to))))))) (moveAgain)))))) (end (forEach NonMover if:(\"NoPiece\") (result Player Loss))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"RevealAPiece\" (move Select (from (sites Hidden What to:Mover)) (then (and { (set Hidden What at:(last To) False to:P1) (set Hidden Who at:(last To) False to:P1) (set Hidden What at:(last To) False to:P2) (set Hidden Who at:(last To) False to:P2) #1})))) (define \"StepMove\" (move Step Orthogonal (to if:(or (is Empty (to)) (and { (not (is Hidden What at:(to) to:Mover)) (\"IsEnemyAt\" (to)) (or (\"ZuMovingOnJiang\") (and (\"HigherValue\") (not (\"JiangMovingOnZu\"))))})) (apply (remove (to)))))) (define \"JiangMovingOnZu\" (and (\"IsPieceAt\" \"Jiang\" Mover (from)) (\"IsPieceAt\" \"Zu\" Next (to)))) (define \"ZuMovingOnJiang\" (and (\"IsPieceAt\" \"Zu\" Mover (from)) (\"IsPieceAt\" \"Jiang\" Next (to)))) (define \"HigherValue\" (>= (value Piece at:(from)) (value Piece at:(to)))) (game \"Banqi\" (players 2) (equipment { (board (rectangle 4 8)) (piece \"Jiang\" Each (\"StepMove\")) (piece \"Ju\" Each (\"StepMove\")) (piece \"Ma\" Each (\"StepMove\")) (piece \"Pao\" Each (\"StepMove\")) (piece \"Shi\" Each (\"StepMove\")) (piece \"Xiang\" Each (\"StepMove\")) (piece \"Zu\" Each (\"StepMove\"))}) (rules (start { (place Random {\"Zu1\"} count:5 value:1) (place Random {\"Zu2\"} count:5 value:1) (place Random {\"Pao1\"} count:2 value:4) (place Random {\"Pao2\"} count:2 value:4) (place Random {\"Ju1\"} count:2 value:6) (place Random {\"Ju2\"} count:2 value:6) (place Random {\"Ma1\"} count:2 value:5) (place Random {\"Ma2\"} count:2 value:5) (place Random {\"Xiang1\"} count:2 value:2) (place Random {\"Xiang2\"} count:2 value:2) (place Random {\"Shi1\"} count:2 value:3) (place Random {\"Shi2\"} count:2 value:3) (place Random {\"Jiang1\"} count:1 value:7) (place Random {\"Jiang2\"} count:1 value:7) (set Hidden {What Who} (sites Board) to:P1) (set Hidden {What Who} (sites Board) to:P2)}) phases:{ (phase \"Opening\" P1 (play (\"RevealAPiece\" (set NextPlayer (player (who at:(last To)))))) (nextPhase Mover \"Play\")) (phase \"Play\" (play (or (forEach Piece) (\"RevealAPiece\"))))} (end (\"BlockWin\"))))\n\n###\n\n", "completion": "The 32 pieces are shuffled and randomly allocated face-down to squares on the board. \n \n The first player turns up a piece to begin the game. The color of that first uncovered piece is the color he or she will play in the game. The second player then makes a move, and the two alternate until the game is finished.\n \n There are three kinds of moves. A player may turn a piece face-up, move a piece, or capture an enemy piece. In some game variants, multiple captures may be made in one turn.\n \n Turning a piece face-up is a legal move if there are any face-down pieces on the board. Once revealed, a piece may move, capture, or be captured. \n \n A player may only move face-up pieces of their own color.\n \n Unlike Xiangqi, all pieces move identically: a piece may move only one square up, down, left, or right. A piece may never move onto a square that is already occupied unless such a move is a legal capture.\n \n A player may only capture with a face-up piece of their own color, and may only capture a face-up piece of the opposing color. In all captures, the captured piece is removed from the board and its square is occupied by the capturing piece.\n \n The pieces are ranked, forming a hierarchy with the general at the top and soldiers at the bottom. Only pieces of equal or lower rank may be captured, with one exception. For instance, a chariot may capture a horse, and the general may capture either, but a horse cannot capture a chariot, and neither can capture the general. The one exception concerns generals and soldiers: the general cannot capture soldiers, and soldiers can capture the general.\n \n In the Hong Kong version, the pieces are ranked in this order: General>Chariot>Horse>Cannon, Advisor>Minster>Soldier. This ranking reflects the approximate value of the corresponding pieces in Xiangqi (though the relative rank of horse and cannon is arguable). All pieces capture exactly as they move: one square up, down, left, or right.\n \n The game ends when a player cannot move, and that player is the loser. Most often, the game is lost because all of a player's pieces have been captured and so he has no pieces to move. However, it is possible for one player to surround all of the other player's remaining pieces in a manner that makes it impossible for them to move. END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe board in Wikipedia. -> The board in Wikipedia.\n(define \"MinotaurThreat\" (\"GoCloserToTheseus\" E (\"GoCloserToTheseus\" W (\"GoCloserToTheseus\" N (\"GoCloserToTheseus\" S))) (then (\"MinotaurThreatAgain\")))) (define \"MinotaurThreatAgain\" (\"GoCloserToTheseus\" E (\"GoCloserToTheseus\" W (\"GoCloserToTheseus\" N (\"GoCloserToTheseus\" S))))) (define \"GoCloserToTheseus\" (if (and (\"NoEdgeBetweenCells\" (where (id \"Minotaur0\")) (ahead (where (id \"Minotaur0\")) #1)) (\"OriginalCloserToTheseus\" #1)) (\"MoveMinotaur\" #1) #2 #3)) (define \"MoveMinotaur\" (fromTo (from (where (id \"Minotaur0\"))) (to (ahead (from) #1) (apply (if (= (id \"Theseus\") (what at:(to))) (remove (to))))))) (define \"SmartCloserToTheseus\" (> (count Steps (step (from (where (id \"Minotaur0\"))) Orthogonal (to if:(\"NoEdgeBetweenCells\" (from) (to)))) (where (id \"Minotaur0\")) (where (id \"Theseus\"))) (count Steps (step (from (ahead (where (id \"Minotaur0\")) #1)) Orthogonal (to if:(\"NoEdgeBetweenCells\" (from) (to)))) (ahead (where (id \"Minotaur0\")) #1) (where (id \"Theseus\"))))) (define \"OriginalCloserToTheseus\" (> (count Steps Orthogonal (where (id \"Minotaur0\")) (where (id \"Theseus\"))) (count Steps Orthogonal (ahead (where (id \"Minotaur0\")) #1) (where (id \"Theseus\"))))) (define \"NoEdgeBetweenCells\" (\"NoSites\" (intersection (sites Occupied by:Shared on:Edge) (\"EdgeInCommon\" #1 #2)))) (define \"EdgeInCommon\" (intersection (sites Incident Edge of:Cell at:#1) (sites Incident Edge of:Cell at:#2))) (game \"Theseus and the Minotaur\" (players 1) (equipment { (board (rectangle 4 7)) (piece \"Theseus\" P1 (move Step Orthogonal (to if:(and (is Empty (to)) (\"NoEdgeBetweenCells\" (from) (to)))))) (piece \"Minotaur\" Neutral) (piece \"Marker\" Shared) (regions \"Exit\" {1})}) (rules (start { (place \"Theseus\" coord:\"C3\") (place \"Minotaur0\" coord:\"A3\") (set Shared Edge (union (sites Outer Edge) (sites {31 38 39 20 27 28})))}) (play (or (forEach Piece) (move Pass) (then (if (not (is In (where (id \"Theseus\")) (sites \"Exit\"))) (\"MinotaurThreat\"))))) (end { (if (no Pieces Mover) (result Mover Loss)) (if (is In (where (id \"Theseus\")) (sites \"Exit\")) (result Mover Win))})))\n\n###\n\n", "completion": "(define \"MinotaurThreat\" (\"GoCloserToTheseus\" E (\"GoCloserToTheseus\" W (\"GoCloserToTheseus\" N (\"GoCloserToTheseus\" S))) (then (\"MinotaurThreatAgain\")))) (define \"MinotaurThreatAgain\" (\"GoCloserToTheseus\" E (\"GoCloserToTheseus\" W (\"GoCloserToTheseus\" N (\"GoCloserToTheseus\" S))))) (define \"GoCloserToTheseus\" (if (and (\"NoEdgeBetweenCells\" (where (id \"Minotaur0\")) (ahead (where (id \"Minotaur0\")) #1)) (\"OriginalCloserToTheseus\" #1)) (\"MoveMinotaur\" #1) #2 #3)) (define \"MoveMinotaur\" (fromTo (from (where (id \"Minotaur0\"))) (to (ahead (from) #1) (apply (if (= (id \"Theseus\") (what at:(to))) (remove (to))))))) (define \"SmartCloserToTheseus\" (> (count Steps (step (from (where (id \"Minotaur0\"))) Orthogonal (to if:(\"NoEdgeBetweenCells\" (from) (to)))) (where (id \"Minotaur0\")) (where (id \"Theseus\"))) (count Steps (step (from (ahead (where (id \"Minotaur0\")) #1)) Orthogonal (to if:(\"NoEdgeBetweenCells\" (from) (to)))) (ahead (where (id \"Minotaur0\")) #1) (where (id \"Theseus\"))))) (define \"OriginalCloserToTheseus\" (> (count Steps Orthogonal (where (id \"Minotaur0\")) (where (id \"Theseus\"))) (count Steps Orthogonal (ahead (where (id \"Minotaur0\")) #1) (where (id \"Theseus\"))))) (define \"NoEdgeBetweenCells\" (\"NoSites\" (intersection (sites Occupied by:Shared on:Edge) (\"EdgeInCommon\" #1 #2)))) (define \"EdgeInCommon\" (intersection (sites Incident Edge of:Cell at:#1) (sites Incident Edge of:Cell at:#2))) (game \"Theseus and the Minotaur\" (players 1) (equipment { (board (square 8)) (piece \"Theseus\" P1 (move Step Orthogonal (to if:(and (is Empty (to)) (\"NoEdgeBetweenCells\" (from) (to)))))) (piece \"Minotaur\" Neutral) (piece \"Marker\" Shared) (regions \"Exit\" {16})}) (rules (start { (place \"Theseus\" coord:\"H5\") (place \"Minotaur0\" coord:\"A8\") (set Shared Edge (union (sites Outer Edge) (sites {17 26 28 20 21 46 63 48 56 64 73 58 109 115 124 97 88})))}) (play (or (forEach Piece) (move Pass) (then (if (not (is In (where (id \"Theseus\")) (sites \"Exit\"))) (\"MinotaurThreat\"))))) (end { (if (no Pieces Mover) (result Mover Loss)) (if (is In (where (id \"Theseus\")) (sites \"Exit\")) (result Mover Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThree-Player Hex is played on the Hex board, typically with five cells per side. As in standard Hex, players take turn placing a piece of their color on an empty cell, and the first player to connect the opposite sides of the board marked his color with a chain of his pieces wins. As soon as it it no longer possible for a player to connect his edges, that player is eliminated from the game and may not place any more stones. The game is played on a 4x4 board The first player to connect his two sides wins.\n\n###\n\n", "completion": "(game \"Three-Player Hex\" (players 3) (equipment { (board (hex 4)) (piece \"Marker\" Each) (regions P1 {(sites Side N) (sites Side S)}) (regions P2 {(sites Side NW) (sites Side SE)}) (regions P3 {(sites Side SW) (sites Side NE)})}) (rules (play (move Add (to (sites Empty)))) (end { (forEach NonMover if:(is Blocked Player) (result Player Loss)) (if (is Connected Mover) (result Mover Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nGoal: Form an orthogonally connected path of friendly stones that surrounds at least one non-friendly stone.\n \n Set-up:\n Two stones, one of each colour, are placed next to each other adjacent to the center of the board. \n Then Black starts.\n \n Play: \n Each turn has two parts that both must be completed: A PLACEMENT and a SWAP.\n \n -- The PLACEMENT is made diagonally from a selected stone of the same color.\n \n -- The SWAP is done by exchanging the contents of the 2 cells that lie between the selected stone and the placed stone. For a SWAP to be valid, the contents of these cells must be different, i.e.: two stones of different color, or an empty space and a stone. \n \n If a turn cannot be completed with a placement to an empty position, the placement must be made by placing on top of an opponent's stone. \n The placement and swap rules apply to the visible stones and must still be followed.\n \n Voluntary passing is not allowed. When neither player can move, the game ends in a draw.\n \n To help visualise the moves, the 'Show Last Move' option shows an arrow from the placement site to the supporting friendly piece and the swap pieces are to either side of this arrow. \n \n Optional Variants: \n -- Larger Board to reduce the strategic effect of the edge cells. / Smaller board to focus on stacked play as a significant part of the game.\n -- Double move protocol for a shorter, more tactical game, that maintains a balance of material on every turn. Edge 343434 Hexagon Turns alternate\n\n###\n\n", "completion": "(define \"DiagonalVector\" (sites Around (from) Diagonal)) (define \"UnconfinedStiesOf\" (forEach (sites Board) if:(!= Infinity (count Steps Adjacent (step Adjacent (to if:(or (is Empty (to)) (is #1 (who at:(to)))))) (site) (sites Outer))))) (define \"SetScoreOf\" (set Score #1 (- 0 (count Sites in:(difference (sites Occupied by:#1) (\"UnconfinedStiesOf\" #1)))))) (define \"MakeSwap\" (if (is Empty (\"SwapSite\" 1)) (fromTo (from (\"SwapSite\" 0)) (to (\"SwapSite\" 1))) (if (is Empty (\"SwapSite\" 0)) (fromTo (from (\"SwapSite\" 1)) (to (\"SwapSite\" 0))) (set Var \"Piece1\" (\"SwapPiece\" 1) (then (add (piece (\"SwapPiece\" 0)) (to (\"SwapSite\" 1) (apply (remove (to)))) (then (add (piece (var \"Piece1\")) (to (\"SwapSite\" 0) (apply (remove (to)))))))))) (then (and { (\"SetScoreOf\" Mover) (\"SetScoreOf\" Next) (forget Value All)})))) (define \"SwapPiece\" (what at:(\"SwapSite\" #1) level:(topLevel at:(\"SwapSite\" #1)))) (define \"SwapSite\" (arrayValue (values Remembered) index:#1)) (define \"Placement\" (move Select (from #1 if:(> 2 (count Stack at:(from)))) (to \"DiagonalVector\" if:(and { (is In (to) (sites Occupied by:Mover top:True)) (= 2 (count Sites in:(\"SwapSites\" (to) (from)))) (or (= 1 (count Sites in:(intersection (\"SwapSites\" (to) (from)) (sites Occupied by:Mover top:True)))) (= 1 (count Sites in:(intersection (\"SwapSites\" (to) (from)) (sites Occupied by:Next top:True)))))})) (then (and { (add (piece (id \"Disc\" Mover)) (to (last From)) stack:True) (forEach Site (\"SwapSites\" (last To) (last From)) (remember Value (site)))})))) (define \"SwapSites\" (intersection (sites Around #1 Adjacent) (sites Around #2 Adjacent))) (game \"Veloop (Hex)\" (players 2) (equipment { (board (renumber (rotate 90 (hex Limping 3))) use:Cell) (piece \"Disc\" Each)}) (rules (start { (place \"Disc1\" 10) (place \"Disc2\" 16)}) (play (priority (\"Placement\" (sites Empty)) (\"Placement\" (sites Occupied by:Next)) (then (\"MakeSwap\")))) (end (if (!= 0 (+ (score P1) (score P2))) (byScore))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThis is basically 4-player Othello, albeit more \\ The game is playing with four players.\n\n###\n\n", "completion": "(define \"ReverseBoundedPieces\" (custodial (from (site)) (between if:(is Enemy (state at:(between))) (apply (allCombinations (add (piece \"Ball0\" state:(mover)) (to (site))) (set State at:(between) (mover))))) (to if:(is Friend (state at:(to)))))) (game \"Rolit\" (players 4) (equipment { (board (square 8)) (piece \"Ball\" Neutral)}) (rules (start { (place \"Ball0\" coord:\"D5\" state:1) (place \"Ball0\" coord:\"E5\" state:2) (place \"Ball0\" coord:\"E4\" state:3) (place \"Ball0\" coord:\"D4\" state:4)}) (play (priority (forEach Site (sites Empty) (append \"ReverseBoundedPieces\")) (move Add (piece \"Ball0\" state:(mover)) (to (sites Around (sites Occupied by:Neutral) Empty))) (then (forEach Player (set Score Player (count Sites in:(sites State (player)))))))) (end (if (all Passed) (byScore))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe mover loses if it does not have 2 pieces on each track. -> The mover loses if it does not have 3 pieces on each track.\nThe game is played on the Kolowis Awithlaknannai board. -> The game is played on an experimental 6x9 board.\n(define \"NPiecesOnTrack\" (end (forEach Track if:(> #1 (count Pieces Mover in:(sites Track))) (result Mover Loss)))) (define \"NoCaptureProposal\" 101) (define \"SlideToCapture\" (move Slide \"AllTracks\" (between if:(or (= (between) (from)) (is Empty (between)))) (to if:(\"IsEnemyAt\" (to)) (apply if:False (remove (to)))) (then (set Counter)))) (game \"Surakarta\" (players 2) (equipment { (surakartaBoard (square 7) loops:3) (piece \"Marker\" Each (or { (move Step All (to if:(is Empty (to)))) (\"SlideToCapture\")}))}) (rules (start { (place \"Marker1\" (expand (sites Bottom))) (place \"Marker2\" (expand (sites Top)))}) (play (if (is Proposed \"End\") (or (move Vote \"End\") (move Vote \"No\" (then (set Counter)))) (or (if (>= (counter) \"NoCaptureProposal\") (move Propose \"End\" (then (vote \"End\")))) (forEach Piece)))) (\"NPiecesOnTrack\" 2)))\n\n###\n\n", "completion": "(define \"NPiecesOnTrack\" (end (forEach Track if:(> #1 (count Pieces Mover in:(sites Track))) (result Mover Loss)))) (define \"NoCaptureProposal\" 101) (define \"SlideToCapture\" (move Slide \"AllTracks\" (between if:(or (= (between) (from)) (is Empty (between)))) (to if:(\"IsEnemyAt\" (to)) (apply if:False (remove (to)))) (then (set Counter)))) (game \"Surakarta\" (players 2) (equipment { (surakartaBoard (rectangle 6 9)) (piece \"Marker\" Each (or { (move Step All (to if:(is Empty (to)))) (\"SlideToCapture\")}))}) (rules (start { (place \"Marker1\" (expand (sites Bottom))) (place \"Marker2\" (expand (sites Top)))}) (play (if (is Proposed \"End\") (or (move Vote \"End\") (move Vote \"No\" (then (set Counter)))) (or (if (>= (counter) \"NoCaptureProposal\") (move Propose \"End\" (then (vote \"End\")))) (forEach Piece)))) (\"NPiecesOnTrack\" 3))) END" }, { "prompt": "Construct a Ludii game based on the following description\n5x5 grid, with diagonals in each quadrant. A triangle, with the apex connecting to the midpoint of one side of the grid. A line is drawn connecting the apex of the triangle to the midpoint of its base, and another triangle is drawn within the triangle connecting the midpoints of the larger triangle. One player plays as twelve dogs, arranged on the lower two rows of points and the two outer points on the central line; the other plays as one jaguar, placed on the apex of the smaller triangle. The jaguar moves first. Pieces move to an empty adjacent space along the lines of the board. The jaguar may hop over an adjacent dog to an empty space immediately on the opposite side of it, capturing the dog. Dogs cannot capture. The dogs win by blocking the jaguar so it cannot move; the jaguar wins when only six dogs remain.\n \n\n###\n\n", "completion": "(game \"La Yagua\" (players 2) (equipment { (board (add (rotate 180 (\"AlquerqueGraphWithBottomTriangle\")) edges:{{27 29} {29 25}}) use:Vertex) (piece \"Jaguar\" P1 (or \"HopCapture\" \"StepToEmpty\")) (piece \"Dog\" P2 \"StepToEmpty\")}) (rules (start { (place \"Dog2\" (union (expand (sites Bottom) steps:1) (sites {\"A3\" \"E3\"}))) (place \"Jaguar1\" coord:\"C7\")}) (play (forEach Piece)) (end (\"NoMovesLossAndLessNumPiecesPlayerLoss\" P2 6)))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"Challis Ghutia\" (players 2) (equipment { (board (square 9) use:Vertex) (piece \"Marker\" Each (or (\"HopSequenceCapture\") (\"StepToEmpty\")))}) (rules (start { (place \"Marker1\" (union (expand (sites Bottom) steps:3) (sites {\"F5\" \"G5\" \"H5\" \"I5\"}))) (place \"Marker2\" (union (expand (sites Top) steps:3) (sites {\"A5\" \"B5\" \"C5\" \"D5\"})))}) (play (if \"SameTurn\" (or (\"HopSequenceCaptureAgain\") (move Pass)) (forEach Piece))) (end (\"CaptureAll\" Next))))\n\n###\n\n", "completion": "9x9 intersecting lines forming a square. Forty pieces per player, lined up on the intersections on the rows closest to them, and the right half of the central line. Players alternate turns moving pieces to an empty adjacent spot along the lines. A piece may capture an opponent's piece by hopping over it to the empty spot immediately on the opposite side of it, following the lines of the board. Multiple captures are allowed. The player who captures all of the opponent's pieces wins. END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nEach player has 6 holes per row. -> Each player has 8 holes per row.\n(define \"PiecesOwnedBy\" (+ (count Cell at:(handSite #1)) (count in:(sites #1 \"Home\")))) (define \"Sow\" (then (sow \"Track\" owner:(mover) apply:(if (> (count at:(to)) 1) (moveAgain) (if (is In (to) (sites Mover \"Inner\")) (and { (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))) (if (> (count at:(\"OppositePit\" (to))) 0) (fromTo (from (\"OppositePit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePit\" (to))))) (if (> (count at:(\"OppositeOuterPit\" (to))) 0) (fromTo (from (\"OppositeOuterPit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositeOuterPit\" (to))))) (set Pending) (moveAgain)})))))) (define \"StylizedMove\" (if (is Mover P1) (difference (expand (intersection (sites Row 1) (sites Left)) steps:2 E) (expand (intersection (sites Row 1) (sites Left)) steps:1 E)) (difference (expand (intersection (sites Row 2) (sites Right)) steps:2 W) (expand (intersection (sites Row 2) (sites Right)) steps:1 W)))) (define \"MoveAgainAfterCapture\" (and (is Pending) (\"SameTurn\"))) (define \"Columns\" 6) (game \"Mefuvha\" (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)}) (regions \"Home\" P1 (sites Track \"Track1\")) (regions \"Home\" P2 (sites Track \"Track2\")) (regions \"Inner\" P1 (difference (sites Track \"Track1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"Track2\") (sites Top))) (piece \"Seed\" Shared) (hand Each)}) (rules (start { (set Count 2 to:(difference (union (sites P1 \"Home\") (sites P2 \"Home\")) (union (expand (intersection (sites Row 1) (sites Left)) steps:1 E) (expand (intersection (sites Row 2) (sites Right)) steps:1 W)))) (set Count 1 to:(union (difference (expand (intersection (sites Row 1) (sites Left)) steps:1 E) (sites Left)) (difference (expand (intersection (sites Row 2) (sites Right)) steps:1 W) (sites Right))))}) (play (if \"MoveAgainAfterCapture\" (move Select (from (sites Next \"Home\") if:(> (count at:(from)) 0)) (then (fromTo (from (last From)) (to (handSite Mover)) count:(count at:(last From))))) (priority (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (if (< (count Turns) 3) \"StylizedMove\" (sites Mover \"Home\"))) if:(> (count at:(from)) 1)) \"Sow\") (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(= (count at:(from)) 1)) \"Sow\")))) (end (\"MancalaByScoreWhen\" (no Moves Mover)))))\n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (+ (count Cell at:(handSite #1)) (count in:(sites #1 \"Home\")))) (define \"Sow\" (then (sow \"Track\" owner:(mover) apply:(if (> (count at:(to)) 1) (moveAgain) (if (is In (to) (sites Mover \"Inner\")) (and { (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))) (if (> (count at:(\"OppositePit\" (to))) 0) (fromTo (from (\"OppositePit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePit\" (to))))) (if (> (count at:(\"OppositeOuterPit\" (to))) 0) (fromTo (from (\"OppositeOuterPit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositeOuterPit\" (to))))) (set Pending) (moveAgain)})))))) (define \"StylizedMove\" (if (is Mover P1) (difference (expand (intersection (sites Row 1) (sites Left)) steps:2 E) (expand (intersection (sites Row 1) (sites Left)) steps:1 E)) (difference (expand (intersection (sites Row 2) (sites Right)) steps:2 W) (expand (intersection (sites Row 2) (sites Right)) steps:1 W)))) (define \"MoveAgainAfterCapture\" (and (is Pending) (\"SameTurn\"))) (define \"Columns\" 8) (game \"Mefuvha\" (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 2 to:(difference (union (sites P1 \"Home\") (sites P2 \"Home\")) (union (expand (intersection (sites Row 1) (sites Left)) steps:1 E) (expand (intersection (sites Row 2) (sites Right)) steps:1 W)))) (set Count 1 to:(union (difference (expand (intersection (sites Row 1) (sites Left)) steps:1 E) (sites Left)) (difference (expand (intersection (sites Row 2) (sites Right)) steps:1 W) (sites Right))))}) (play (if \"MoveAgainAfterCapture\" (move Select (from (sites Next \"Home\") if:(> (count at:(from)) 0)) (then (fromTo (from (last From)) (to (handSite Mover)) count:(count at:(last From))))) (priority (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (if (< (count Turns) 3) \"StylizedMove\" (sites Mover \"Home\"))) if:(> (count at:(from)) 1)) \"Sow\") (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(= (count at:(from)) 1)) \"Sow\")))) (end (\"MancalaByScoreWhen\" (no Moves Mover))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nObjectives\n One player has a gold fleet consisting of one large flagship and twelve escorts, with the objective of evading capture while breaking through his or her opponent's blockade to transport the flagship to the perimeter of the board. The other player has a silver fleet of twenty ships, and forms a blockade to trap the gold flagship and destroy the gold fleet's escorts with the objective of capturing the flagship.\n \n Setup\n Gold player places the flagship on the center square of the game board, and positions the rest of the ships anywhere within the boldly ruled central area of the board.\n \n Silver player then positions the silver ships on twenty squares in the lightly ruled peripheral area of the board.\n \n Play\n Gold player chooses who goes first. Players move alternately by making two moves or one capture anywhere on the board. When the flagship is moved, only one move or capture is made (thus only the flagship).\n \n Moves\n A player may move two of the smaller playing pieces any number of vacant squares either horizontally or vertically on the board (as a rook in Chess, except that no captures can be made with this move), although if the flagship is moved, the gold player may not move another playing piece.\n \n Captures\n A player may move any playing piece (including the flagship) one square diagonally to capture one of his opponent's playing pieces. (This move is similar to the capture-move of the pawn in Chess, except that captures can be made on any of the four diagonals.)\n \n This game uses displacement capture (like Chess), rather than custodial capture (like Hnefatafl), thus when a capture is made, the captured piece is removed from the board and the vacated square is occupied by the captor.\n \n Play continues until one player achieves his or her objective. If the flagship of the gold fleet reaches one of the outermost squares on the board, gold player wins. If the flagship is captured before it reaches the outer edge of the board, silver player wins. \n\n###\n\n", "completion": "(game \"Breakthru\" (players 2) (equipment { (board (square 11)) (piece \"Disc\" Each (or (if (\"NewTurn\") (\"StepToEnemy\" Diagonal)) (move Slide Orthogonal (then (if (\"NewTurn\") (moveAgain)))))) (piece \"Commander\" P1 (if (\"NewTurn\") (or (\"StepToEnemy\" Diagonal) (move Slide Orthogonal)))) (hand Each) (regions \"CentreSites\" (expand (sites Centre) steps:2))}) (rules (start { (place \"Commander1\" (sites Centre)) (place \"Disc1\" (handSite P1) count:12) (place \"Disc2\" (handSite P2) count:20)}) phases: { (phase \"PlacementP1\" (play (move (from (handSite P1)) (to (intersection (sites \"CentreSites\") (sites Empty))) (then (if (is Occupied (handSite P1)) (moveAgain))))) (nextPhase (is Empty (handSite P1)) \"PlacementP2\")) (phase \"PlacementP2\" (play (move (from (handSite P2)) (to (difference (sites Empty) (sites \"CentreSites\"))) (then (if (is Occupied (handSite P2)) (moveAgain))))) (nextPhase (is Empty (handSite P2)) \"Movement\")) (\"PhaseMovePiece\" \"Movement\" (end { (\"PieceTypeReachWin\" \"Commander1\" (sites Outer) P1) (if (\"IsOffBoard\" (where \"Commander\" P1)) (result P2 Win))}))})) END" }, { "prompt": "Construct a Ludii game based on the following description\n3x6 board. Six pieces per player, which begin one in each space in the row closest to the player. Six sticks, used as dice. One side is polished, and the other is rough. The value of a throw is equal to the number of polished sides which land face up. A throw of sig (five polished or five rough sides up) must be made to move a piece that has not yet been moved; a throw of sig moves it 1 and grants the player another throw. If six polished sides up are thrown, the player gets another throw. If this throw is a sig, the player's throw = 7 and the player may either free the first piece and move it seven spaces or free all six pieces, moving them each one, and moving the first piece the remaining one space. Also, if the player throws six rough sides on their first turn, they get three extra throws. If any of these three throws is a sig, the value of the throw = 13, and the player may free the first piece and move it thirteen spaces, or free all of the player's pieces, moving them each one space, and then moving the first piece the remainder of the spaces. Pieces move from left to right in the player's home row, right to left in the central row, left to right in the opponent's home row, right to left in the central row, and then left to right in the player's home row. When a player's piece lands on a space occupied by an opponent's piece, the opponent's piece is captured. The player who captures all of their opponent's pieces wins. \n\n###\n\n", "completion": "(define \"Move\" (move (from (from) if:(\"ActivatedPiece\" (from))) (to (\"NextSiteOnTrack\" (if (= 1 (var \"SpecialSig\")) (+ 1 (\"ThrowValue\")) (\"ThrowValue\"))) if:(not (\"IsFriendAt\" (to))) (apply \"CaptureMove\")))) (define \"MoveToActivate\" (move (from (from) if:(and (not (\"ActivatedPiece\" (from))) (or (\"Sig\") (= 1 (var \"SpecialSig\"))))) (to (\"NextSiteOnTrack\" 1) if:(not (\"IsFriendAt\" (to))) (apply \"CaptureMove\")) (then (and (\"ActivePiece\" (last To)) (if (= 1 (var \"SpecialSig\")) (and { (moveAgain) (set Var (+ (var) 1))})))))) (define \"CaptureMove\" (if (\"IsEnemyAt\" (to)) (remove (to)))) (define \"Sig\" (or (= 1 (\"ThrowValue\")) (= 5 (\"ThrowValue\")))) (define \"ActivePiece\" (set State at:#1 1)) (define \"ActivatedPiece\" (= (state at:#1) 1)) (define \"ExtraThrowValue\" (mapEntry \"ExtraThrow\" (count Pips))) (define \"ThrowValue\" (count Pips)) (game \"Sig (El Oued Capture)\" (players 2) (equipment { (board (rectangle 3 6) { (track \"Track1\" \"0,E,N1,W,N1,E,S1,W\" loop:True P1) (track \"Track2\" \"17,W,S1,E,S1,W,N1,E\" P2 directed:True)}) (piece \"Marker\" Each) (hand Each) (\"StickDice\" 6) (map \"ExtraThrow\" {(pair 0 3) (pair 1 1) (pair 2 0) (pair 3 0) (pair 4 0) (pair 5 1) (pair 6 1)})}) (rules (start { (place \"Marker1\" (sites Bottom)) (place \"Marker2\" (sites Top))}) (play (\"RollMove\" (priority (forEach Piece (\"MoveToActivate\")) (forEach Piece (\"Move\"))) (then (if (!= 0 (\"ExtraThrowValue\")) (and (if (= 3 (\"ExtraThrowValue\")) (if (<= (var) 0) (set Var 2))) (if (!= (mover) (prev)) (and (moveAgain) (if (!= 1 (\"ThrowValue\")) (set Var \"SpecialSig\" 1))))) (if (> (var) 0) (and { (set Var (- (var) 1)) (moveAgain)}) (set Var \"SpecialSig\" 0)))))) (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Construct a Ludii game based on the following description\n6x6 grid. Twelve pieces per player. In the first phase, players alternate turns placing their pieces on an empty space on the board. They are forbidden from placing two of their own pieces orthogonally adjacent to one another. Once all of the pieces are placed, players alternate turns moving the pieces in an orthogonal direction to an empty adjacent spot. When they place a piece so that two are in a row, they capture one of the opponent's pieces. The player who captures all of the opponent's pieces wins. \n\n###\n\n", "completion": "(define \"IfLine2OrthogonalMoveAgain\" (then (if (is Line 2 Orthogonal) (moveAgain)))) (game \"Bolotudu\" (players 2) (equipment { (board (square 6)) (hand Each) (piece \"Marker\" Each (\"StepToEmpty\" Orthogonal \"IfLine2OrthogonalMoveAgain\"))}) (rules (start (place \"Marker\" \"Hand\" count:12)) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (difference (sites Empty) (sites Around (sites Occupied by:Mover) Orthogonal))))) (nextPhase (\"HandEmpty\" P2) \"Movement\")) (phase \"Movement\" (play (if \"SameTurn\" (move Remove (sites Occupied by:Next)) (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 off board. \n\n###\n\n", "completion": "(define \"IsNotOffBoard\" (!= #1 Off)) END" }, { "prompt": "Construct a Ludii game based on the following description\nBoard starts empty. \n Place on an empty location, unless it is next to more of your own pieces. \n Passing is not allowed.\n You lose if at the end of your turn, one of your stones is surrounded. Hex N / N-1 Grid Order 4 board\n\n###\n\n", "completion": "(define \"Icosahedron\" (board (add (remove (tri Limping 4) vertices:{0 1 3 4 5 6 7 8 9 10 11 13 15 17 18 19 20 23 24 25 26 27 31 32 34 35 36 37 39 40 42 43 44 45 46 47}) edges:{ {0 1} {0 2} {0 3} {0 9} {0 10} {1 2} {1 4} {1 6} {6 11} {7 11} {8 11} {1 9} {2 3} {3 5} {3 8} {3 10} {6 9} {8 10} {9 10} {9 11} {10 11}}) use:Vertex)) (define \"HexCell\" (board (hex Hexagon 4) use:Cell)) (define \"HexHex\" (board (tri Hexagon 4) use:Vertex)) (define \"TriSquare\" (board (tiling T33434 (- 4 2)) use:Vertex)) (define \"HexLimpCell\" (board (hex Limping (- 4 1)) use:Cell)) (define \"HexLimp\" (board (tri Limping (- 4 1)) use:Vertex)) (define \"SquareGrid\" (board (square 4) use:Vertex)) (define \"BoardUsed\" \"HexLimp\") (define \"Connection\" Orthogonal) (game \"Claustro\" (players 2) (equipment { \"BoardUsed\" (piece \"Ball\" P1) (piece \"Ball\" P2)}) (rules (start (set Score Each 0)) (play (move Add (piece (mover)) (to (sites Empty) if:(<= 0 (- (count Pieces Next in:(sites Around (to) Orthogonal)) (count Pieces Mover in:(sites Around (to) Orthogonal))))) (then (if (not (all Sites (sites Occupied by:Mover) if:(can Move (step (from (site)) Orthogonal (to if:(is Empty (to))))))) (trigger \"End\" Mover) (if (not (all Sites (sites Occupied by:Next) if:(can Move (step (from (site)) Orthogonal (to if:(is Empty (to))))))) (trigger \"End\" Next)))))) (end (if (or (is Triggered \"End\" Mover) (is Triggered \"End\" Next)) (if (is Triggered \"End\" Mover) (result Mover Loss)) (result Mover Win))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"PiecesOwnedBy\" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (define \"Columns\" 40) (game \"En Gehe\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" store:None (track \"Track\" \"0,E,N,W\" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 4 to:(sites Track))) (play (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover)) if:(> (count at:(from)) 0)) (then (sow apply:(if (> (count at:(to)) 1) (moveAgain) (if (and (is In (to) (sites Mover)) (> (count at:(\"OppositePit\" (to))) 0)) (and (fromTo (from (\"OppositePit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePit\" (to)))) (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to)))))))))) (end (\"MancalaByScoreWhen\" (no Moves Mover)))))\n\n###\n\n", "completion": "2x40-50 board. Each team controls one row. Play begins with each hole containing four counters (usually seeds or pebbles). A player picks up the counters in a hole in his team's row and sows them in a counterclockwise fashion, one in each consecutive hole. If the last counter is deposited into a hole containing counter, those counters are picked up and the player continues sowing. The turn continues in this fashion until the last counter falls into an empty hole. If this empty hole is on the player's side, the counters in the opposite hole in the other team's row are captured. The counter also causing the capture is taken. Play continues until one team cannot move, and the remaining counters are captured by the other team. The team with the most seeds wins. Each row has 40 holes. 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": "Modify the Ludii game according to the following option changes:\nThe game is played on a 3x13 board. -> The game is played on a 3x14 board.\n(define \"CaptureEnemyPiece\" (apply if:(\"IsEnemyAt\" (to)) (remove (to)))) (define \"NumDiceAtOne\" (+ { (if (= 1 (face (+ 0 (count Sites in:(sites Board))))) 1 0) (if (= 1 (face (+ 1 (count Sites in:(sites Board))))) 1 0) (if (= 1 (face (+ 2 (count Sites in:(sites Board))))) 1 0) (if (= 1 (face (+ 3 (count Sites in:(sites Board))))) 1 0)})) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" #2 #1)) (define \"SumPips\" (count Pips)) (game \"Chong (Sakhalin)\" (players 2) (equipment { (board (rectangle 3 13) { (track \"Track1\" \"0,E,N1,W,N1,E\" P1 directed:True) (track \"Track2\" \"38,W,S1,E,S1,W\" P2 directed:True)}) (dice d:6 num:4) (piece \"Marker\" Each (move (from) (to (\"SiteToMoveOnTrack\" from:(from) (pips)) if:(or { (is Empty (to)) (and (\"IsEnemyAt\" (to)) (if (not (\"IsPieceAt\" \"King\" Next (to))) True (= 1 (abs (- (to) (from))))))}) (\"CaptureEnemyPiece\")))) (piece \"King\" Each (if (= 1 (pips)) (if (<= 2 (count Pieces Mover)) (if (and (!= 1 (value Player Mover)) (= 1 (count Pieces Mover))) (move (from (from)) (to (from)) (then (set Value Mover 1))) (move (from) (to (\"SiteToMoveOnTrack\" from:(from) (pips)) if:(or { (is Empty (to)) (and (\"IsEnemyAt\" (to)) (if (not (\"IsPieceAt\" \"King\" Next (to))) True (= 1 (abs (- (to) (from))))))}) (\"CaptureEnemyPiece\")))) (firstMoveOnTrack \"Track\" Mover (if (and (> (site) (from)) (is Mover (who at:(site)))) (move Swap Pieces (from) (site)))))))}) (rules (start { (place \"Marker1\" (sites Bottom)) (place \"King1\" 23) (place \"Marker2\" (sites Top)) (place \"King2\" 12)}) phases:{ (phase \"Opening\" (play (\"RollMove\" (if (!= 0 (\"NumDiceAtOne\")) (if (is Mover P1) (if (is Mover (who at:(- (where \"King\" Mover) (+ (- (count Sites in:(sites Bottom)) 1) (\"NumDiceAtOne\"))))) (move Swap Pieces (where \"King\" Mover) (- (where \"King\" Mover) (+ (- (count Sites in:(sites Bottom)) 1) (\"NumDiceAtOne\"))))) (if (is Mover (who at:(+ (where \"King\" Mover) (+ (- (count Sites in:(sites Bottom)) 1) (\"NumDiceAtOne\"))))) (move Swap Pieces (where \"King\" Mover) (+ (where \"King\" Mover) (+ (- (count Sites in:(sites Bottom)) 1) (\"NumDiceAtOne\"))))) (then (fromTo (from (last From)) (to (\"SiteToMoveOnTrack\" from:(last From) (- (\"SumPips\") (\"NumDiceAtOne\"))) (\"CaptureEnemyPiece\")))))))) (nextPhase Mover (not (was Pass)) \"Playing\")) (phase \"Playing\" (play (\"RollEachNewTurnMove\" (forEach Die if:(\"DieNotUsed\") (forEach Piece) (then (\"ReplayNotAllDiceUsed\"))))))} (end { (if (= (who at:0) P2) (result P2 Win)) (if (= (who at:(- (count Sites in:(sites Board)) 1)) P1) (result P1 Win))})))\n\n###\n\n", "completion": "(define \"CaptureEnemyPiece\" (apply if:(\"IsEnemyAt\" (to)) (remove (to)))) (define \"NumDiceAtOne\" (+ { (if (= 1 (face (+ 0 (count Sites in:(sites Board))))) 1 0) (if (= 1 (face (+ 1 (count Sites in:(sites Board))))) 1 0) (if (= 1 (face (+ 2 (count Sites in:(sites Board))))) 1 0) (if (= 1 (face (+ 3 (count Sites in:(sites Board))))) 1 0)})) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" #2 #1)) (define \"SumPips\" (count Pips)) (game \"Chong (Sakhalin)\" (players 2) (equipment { (board (rectangle 3 14) { (track \"Track1\" \"0,E,N1,W,N1,E\" P1 directed:True) (track \"Track2\" \"41,W,S1,E,S1,W\" P2 directed:True)}) (dice d:6 num:4) (piece \"Marker\" Each (move (from) (to (\"SiteToMoveOnTrack\" from:(from) (pips)) if:(or { (is Empty (to)) (and (\"IsEnemyAt\" (to)) (if (not (\"IsPieceAt\" \"King\" Next (to))) True (= 1 (abs (- (to) (from))))))}) (\"CaptureEnemyPiece\")))) (piece \"King\" Each (if (= 1 (pips)) (if (<= 2 (count Pieces Mover)) (if (and (!= 1 (value Player Mover)) (= 1 (count Pieces Mover))) (move (from (from)) (to (from)) (then (set Value Mover 1))) (move (from) (to (\"SiteToMoveOnTrack\" from:(from) (pips)) if:(or { (is Empty (to)) (and (\"IsEnemyAt\" (to)) (if (not (\"IsPieceAt\" \"King\" Next (to))) True (= 1 (abs (- (to) (from))))))}) (\"CaptureEnemyPiece\")))) (firstMoveOnTrack \"Track\" Mover (if (and (> (site) (from)) (is Mover (who at:(site)))) (move Swap Pieces (from) (site)))))))}) (rules (start { (place \"Marker1\" (sites Bottom)) (place \"King1\" 23) (place \"Marker2\" (sites Top)) (place \"King2\" 12)}) phases:{ (phase \"Opening\" (play (\"RollMove\" (if (!= 0 (\"NumDiceAtOne\")) (if (is Mover P1) (if (is Mover (who at:(- (where \"King\" Mover) (+ (- (count Sites in:(sites Bottom)) 1) (\"NumDiceAtOne\"))))) (move Swap Pieces (where \"King\" Mover) (- (where \"King\" Mover) (+ (- (count Sites in:(sites Bottom)) 1) (\"NumDiceAtOne\"))))) (if (is Mover (who at:(+ (where \"King\" Mover) (+ (- (count Sites in:(sites Bottom)) 1) (\"NumDiceAtOne\"))))) (move Swap Pieces (where \"King\" Mover) (+ (where \"King\" Mover) (+ (- (count Sites in:(sites Bottom)) 1) (\"NumDiceAtOne\"))))) (then (fromTo (from (last From)) (to (\"SiteToMoveOnTrack\" from:(last From) (- (\"SumPips\") (\"NumDiceAtOne\"))) (\"CaptureEnemyPiece\")))))))) (nextPhase Mover (not (was Pass)) \"Playing\")) (phase \"Playing\" (play (\"RollEachNewTurnMove\" (forEach Die if:(\"DieNotUsed\") (forEach Piece) (then (\"ReplayNotAllDiceUsed\"))))))} (end { (if (= (who at:0) P2) (result P2 Win)) (if (= (who at:(- (count Sites in:(sites Board)) 1)) P1) (result P1 Win))}))) 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 Ludii game based on the following description\nThree concentric squares, with lines connecting the corners and the midpoints of the sides. Twelve pieces per player. Players alternate turns placing a piece on the board. When a player makes a line of three of their pieces, they may remove one of the opponent's pieces. When all of the pieces have been placed, players alternate turns moving a piece to an empty adjacent spot along the lines of the board. A piece in the four outside corner spaces is allowed to move to any empty spot on the board. The player who captures all of the opponent's pieces wins. \n\n###\n\n", "completion": "(game \"Mulabalaba\" (players 2) (equipment { (board (concentric Square rings:3 joinCorners:True) use:Vertex) (hand Each) (piece \"Marker\" Each (if (is In (from) (sites Corners)) (move (from (from)) (to (sites Empty))) (\"StepToEmpty\") (then (\"ReplayIfLine3\"))))}) (rules (start (place \"Marker\" \"Hand\" count:12)) 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 (forEach NonMover if:(no Pieces Player) (result Player Loss))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayed on a square Alquerque board with 9x9 intersecting lines with diagonals. Each player has 40 pieces. Pieces are placed on the intersections of the lines, and move forward along the lines to an adjacent unoccupied intersection. Once pieces reach the opposite side of the board from their starting position at the end of their turn, they are promoted and can move in any direction and over any distance. Opponent's pieces are captured by jumping them. Captures are obligatory if possible. If a player does not capture when they are supposed to, the opponent may remove that piece immediately and then play as normal. The player who captures all of their opponent's pieces or blocks them from being able to move wins. \n\n###\n\n", "completion": "(define \"ShouldCapturedButMoved\" (and (is In (last From) (\"SitesWithPossibleCaptureInPreviousTurn\")) (is In (last From) (sites Empty)))) (define \"HuffOnePieceOf\" (move Select (from #1 if:(is Occupied (from))) (then (and { (remove (last To)) (moveAgain) (set Value Prev 0)})))) (define \"SitesWithPossibleCaptureInPreviousTurn\" (sites Pending)) (define \"RememberSiteWithPossibleCapture\" (set Pending (sites From (or (forEach Piece \"Disc\" (\"HopDisc\")) (forEach Piece \"DiscDouble\" (\"HopCaptureDistance\")))))) (define \"DidNotCaptured\" (= (value Player Prev) 1)) (define \"HasNotCaptured\" (set Value Mover 1)) (define \"HasCaptured\" (set Value Mover 0)) (define \"HopDiscDouble\" (\"HopCaptureDistance\" ~ ~ ~ (then (\"HasCaptured\")))) (define \"HopDisc\" (\"HopCapture\" ~ ~ (then (and (\"PromoteIfReach\" (sites Next) \"DiscDouble\") (\"HasCaptured\"))))) (game \"Zamma\" (\"TwoPlayersNorthSouth\") (equipment { (\"AlquerqueBoard\" 9 9) (piece \"Disc\" Each (or (\"HopDisc\") (\"StepToEmpty\" Forwards (then (\"HasNotCaptured\"))) (then (\"PromoteIfReach\" (sites Next) \"DiscDouble\")))) (piece \"DiscDouble\" Each (or (\"HopDiscDouble\") (move Slide (then (\"HasNotCaptured\"))))) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (\"BeforeAfterCentreSetup\" \"Disc1\" \"Disc2\") (play (or (if (\"DidNotCaptured\") (or (if (\"ShouldCapturedButMoved\") (\"HuffOnePieceOf\" (last To))) (\"HuffOnePieceOf\" (\"SitesWithPossibleCaptureInPreviousTurn\")))) (do (\"RememberSiteWithPossibleCapture\") next:(forEach Piece)))) (end (if (no Moves Mover) (result Next Win))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"InitialPawnMove\" (if (is In (from) (sites Start (piece (what at:(from))))) (\"DoubleStepForwardToEmpty\"))) (game \"Chandaraki\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (\"ChessPawn\" \"Pawn\" \"InitialPawnMove\") (\"ChessRook\" \"Rook\") (\"ChessKing\" \"King\") (\"ChessBishop\" \"Bishop\") (\"ChessKnight\" \"Knight\") (\"ChessQueen\" \"Queen\") (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 (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King\" Mover)))) (end { (\"Checkmate\" \"King\") (if (= 1 (count Pieces Next)) (result Mover Draw))})))\n\n###\n\n", "completion": "Played on an 8x8 board with pieces with specialized moves: Pawns (8): can move one space orthogonally forward, or two steps orthogonally forward only if it is the first move of any of that player's pawns, capture one space diagonally forward; Rooks (2): can move any number of spaces orthogonally; Bishops (2): can move any number of spaces diagonally; Knight (2): moves in any direction, one space orthogonally with one space forward diagonally; Queens (1): can move any number of spaces orthogonally or diagonally; Kings (1): can move one space orthogonally or diagonally. An opponent's piece is captured by moving a player's own piece onto a space occupied by the opponent's piece. When a King can be captured on the next turn by an opponent's piece, it is in check. The King must not be in check at the end of the player's turn. If this is not possible, it is checkmate and the opponent wins. When a player is reduced to a King without any other pieces, the game is a draw.\n END" }, { "prompt": "Construct a Ludii game based on the following description\nTwo concentric circles, with four radii from the outer circle to in the center, dividing the circles into four equal parts. There are four arcs, each of which bisects a radius between where each radius intersects the circumference of each circle, the arc also intersecting with the outer circle's circumference. One player plays as a bear, which begins on the central point, the other as three hunters, which begin on any three points on the inner circle. The bear plays first. Players alternate turns moving a piece to an empty adjacent spot along the lines. When the bear is unable to move, the game ends and the players play again, switching sides. The player who lasts longest while playing as the bear wins. The game has two rounds.\n\n###\n\n", "completion": "(game \"Gioco dell'Orso\" (players 2) (equipment { (board (add (concentric {1 4 12}) edges:{{6 8} {9 11} {12 14} {5 15}}) use:Vertex) (piece \"Human\" Each (\"StepToEmpty\")) (piece \"Bear\" Each (\"StepToEmpty\")) (hand Each)}) (rules (start { (place \"Human1\" (handSite P1) count:3) (place \"Bear2\" (sites Centre))}) phases:{ (phase \"PlacementP1\" (play (move (from (handSite P1)) (to (intersection (sites Empty) (sites {1..4}))) (then (if (\"HandOccupied\" P1) (moveAgain))))) (nextPhase (\"HandEmpty\" P1) \"HuntingP2\")) (phase \"HuntingP2\" (play (forEach Piece (then (if (not (can Move (\"StepToEmpty\" (from (where \"Bear\" P2))))) (and { (addScore P2 (- (count Moves) 3)) (remove (sites Occupied by:All container:\"Board\")) (add (piece \"Bear1\") (to (sites Centre))) (add (piece \"Human2\") (to (handSite P2)) count:3)}))))) (nextPhase (= 1 (count Sites in:(sites Occupied by:All container:\"Board\"))) \"PlacementP2\")) (phase \"PlacementP2\" (play (move (from (handSite P2)) (to (intersection (sites Empty) (sites {1..4}))) (then (if (\"HandOccupied\" P2) (moveAgain))))) (nextPhase (\"HandEmpty\" P2) \"HuntingP1\")) (phase \"HuntingP1\" (play (forEach Piece (then (if (not (can Move (\"StepToEmpty\" (from (where \"Bear\" P1))))) (addScore P1 (- (count Moves) (+ (score P2) 6))))))) (end (if (!= 0 (score P1)) (byScore))))})) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nSmall board (48 nodes) -> Medium board (72 nodes)\n(define \"Perf7\" (board (dual (remove (hex \"Jungle\") cells:{12 25 34 41 50 57 66 75 82 91 98 107 116 123 131 144 150 161})) use:Vertex)) (define \"Perf6\" (board (dual (remove (hex 8) cells:{0 4 5 6 7 8 13 17 20 27 28 35 44 49 54 61 62 65 72 76 77 84 91 92 96 103 106 107 114 119 124 133 140 141 148 151 155 160 161 162 163 164 168})) use:Vertex)) (define \"Perf5\" (board (dual (remove (hex 7 8) cells:{0 1 2 3 4 5 6 7 8 9 10 11 12 16 17 18 19 26 27 34 38 43 50 53 60 63 64 71 76 77 82 89 92 99 108 116 123 130 131 132 136 137 138 139 140 141 142 143 144 145 146})) use:Vertex)) (define \"Perf4\" (board (dual (remove (hex 6) cells:{0 1 5 12 17 23 30 37 40 45 50 53 60 67 73 78 85 89 90})) use:Vertex)) (define \"Perf3\" (board (dual (remove (hex 5 6) cells:{0 1 2 3 4 5 6 7 11 12 13 14 21 25 30 37 42 53 63 64 65 69 70 71 72 73 74})) use:Vertex)) (define \"Perf2\" (board (dual (remove (hex 4 5) cells:{0 1 15 20 25 32 36 39 44})) use:Vertex)) (define \"Jungle\" (poly { { -3.5 -11.75} { -10.0 -5.25} { -6.75 12.0} { 1.25 14.75} { 15.25 3.25} { 14.0 -5.75}})) (define \"BoardUsed\" \"Perf3\") (define \"LoSDirection\" Orthogonal) (define \"PassEnd\" (if (and (\"SameTurn\") (no Moves Next)) (result Mover Win))) (define \"ScoreTerritory\" (and (\"MPScoring\" Mover Next) (\"MPScoring\" Next Mover))) (define \"MPScoring\" (set Score #1 (+ (size Array (array (sites From (\"Movement\" #1)))) (count Sites in:(difference (\"SitesControlledBy\" #1) (\"SitesControlledBy\" #2)))))) (define \"Movement\" (forEach Piece (do (and (set Var \"LoSFrom\" (\"LoSAt\" (from))) (set Var \"QtyAroundFrom\" (\"QtyAround\" (from)))) next:(move Slide \"LoSDirection\") ifAfterwards:(or (> (\"QtyAround\" (last To)) (var \"QtyAroundFrom\")) (and (= (\"QtyAround\" (last To)) (var \"QtyAroundFrom\")) (> (\"LoSAt\" (last To)) (var \"LoSFrom\"))))) #1)) (define \"Placement\" (move Add (piece (mover)) (to (difference (sites Empty) (\"SitesControlledBy\" Next))))) (define \"SitesControlledBy\" (sites (results from:(sites Occupied by:#1) to:(sites LineOfSight Empty at:(from) \"LoSDirection\") (to)))) (define \"LoSAt\" (count Pieces Next in:(sites LineOfSight Piece at:#1 \"LoSDirection\"))) (define \"QtyAround\" (count Pieces Next in:(sites Around #1 \"LoSDirection\"))) (game \"Epoxy\" (players 2) (equipment { \"BoardUsed\" (piece \"Ball\" Each (move Slide))}) (rules (start (set Score Each 0)) (play (or { (\"Placement\") (\"Movement\" Mover) (if (and (not (is Prev Next)) (< 0 (counter))) (move Pass))} (then (if (is Prev Next) (moveAgain) (\"ScoreTerritory\"))))) (end \"PassEnd\")))\n\n###\n\n", "completion": "(define \"Perf7\" (board (dual (remove (hex \"Jungle\") cells:{12 25 34 41 50 57 66 75 82 91 98 107 116 123 131 144 150 161})) use:Vertex)) (define \"Perf6\" (board (dual (remove (hex 8) cells:{0 4 5 6 7 8 13 17 20 27 28 35 44 49 54 61 62 65 72 76 77 84 91 92 96 103 106 107 114 119 124 133 140 141 148 151 155 160 161 162 163 164 168})) use:Vertex)) (define \"Perf5\" (board (dual (remove (hex 7 8) cells:{0 1 2 3 4 5 6 7 8 9 10 11 12 16 17 18 19 26 27 34 38 43 50 53 60 63 64 71 76 77 82 89 92 99 108 116 123 130 131 132 136 137 138 139 140 141 142 143 144 145 146})) use:Vertex)) (define \"Perf4\" (board (dual (remove (hex 6) cells:{0 1 5 12 17 23 30 37 40 45 50 53 60 67 73 78 85 89 90})) use:Vertex)) (define \"Perf3\" (board (dual (remove (hex 5 6) cells:{0 1 2 3 4 5 6 7 11 12 13 14 21 25 30 37 42 53 63 64 65 69 70 71 72 73 74})) use:Vertex)) (define \"Perf2\" (board (dual (remove (hex 4 5) cells:{0 1 15 20 25 32 36 39 44})) use:Vertex)) (define \"Jungle\" (poly { { -3.5 -11.75} { -10.0 -5.25} { -6.75 12.0} { 1.25 14.75} { 15.25 3.25} { 14.0 -5.75}})) (define \"BoardUsed\" \"Perf4\") (define \"LoSDirection\" Orthogonal) (define \"PassEnd\" (if (and (\"SameTurn\") (no Moves Next)) (result Mover Win))) (define \"ScoreTerritory\" (and (\"MPScoring\" Mover Next) (\"MPScoring\" Next Mover))) (define \"MPScoring\" (set Score #1 (+ (size Array (array (sites From (\"Movement\" #1)))) (count Sites in:(difference (\"SitesControlledBy\" #1) (\"SitesControlledBy\" #2)))))) (define \"Movement\" (forEach Piece (do (and (set Var \"LoSFrom\" (\"LoSAt\" (from))) (set Var \"QtyAroundFrom\" (\"QtyAround\" (from)))) next:(move Slide \"LoSDirection\") ifAfterwards:(or (> (\"QtyAround\" (last To)) (var \"QtyAroundFrom\")) (and (= (\"QtyAround\" (last To)) (var \"QtyAroundFrom\")) (> (\"LoSAt\" (last To)) (var \"LoSFrom\"))))) #1)) (define \"Placement\" (move Add (piece (mover)) (to (difference (sites Empty) (\"SitesControlledBy\" Next))))) (define \"SitesControlledBy\" (sites (results from:(sites Occupied by:#1) to:(sites LineOfSight Empty at:(from) \"LoSDirection\") (to)))) (define \"LoSAt\" (count Pieces Next in:(sites LineOfSight Piece at:#1 \"LoSDirection\"))) (define \"QtyAround\" (count Pieces Next in:(sites Around #1 \"LoSDirection\"))) (game \"Epoxy\" (players 2) (equipment { \"BoardUsed\" (piece \"Ball\" Each (move Slide))}) (rules (start (set Score Each 0)) (play (or { (\"Placement\") (\"Movement\" Mover) (if (and (not (is Prev Next)) (< 0 (counter))) (move Pass))} (then (if (is Prev Next) (moveAgain) (\"ScoreTerritory\"))))) (end \"PassEnd\"))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game is played according to the rules of the source but the capture is allowed only horizontally and vertically. -> The game is played according to the rules described in Youtube. The two differences with the source is: Capture possible only horizontally and vertically and the pieces can slide.\n(game \"Boseog Gonu\" (players 2) (equipment { (board (remove (merge { (rectangle 3 3 diagonals:Alternating) (shift 0 -1 (rotate 180 (wedge 2))) (shift 0 2 (wedge 2)) (shift -1.5 0.5 (rotate 90 (wedge 2))) (shift 1.5 0.5 (rotate -90 (wedge 2)))}) edges:{ {{1 1} {0 0}} {{1 1} {2 2}} {{1 1} {2 0}} {{1 1} {0 2}}}) use:Vertex) (piece \"Disc\" Each (\"StepToEmpty\" ~ (then (custodial (from (last To)) Axial (between (max 1) if:(\"IsEnemyAt\" (between)) (apply (remove (between)))) (to if:(= (what at:(to)) (what at:(last To))))))))}) (rules (start { (place \"Disc1\" {\"A3\" \"B3\" \"B4\" \"B2\"}) (place \"Disc2\" {\"D2\" \"D3\" \"E3\" \"D4\"})}) (play (forEach Piece)) (end (\"HavingLessPiecesLoss\" Next 1))))\n\n###\n\n", "completion": "(game \"Boseog Gonu\" (players 2) (equipment { (board (remove (merge { (rectangle 3 3 diagonals:Alternating) (shift 0 -1 (rotate 180 (wedge 2))) (shift 0 2 (wedge 2)) (shift -1.5 0.5 (rotate 90 (wedge 2))) (shift 1.5 0.5 (rotate -90 (wedge 2)))}) edges:{ {{1 1} {0 0}} {{1 1} {2 2}} {{1 1} {2 0}} {{1 1} {0 2}}}) use:Vertex) (piece \"Disc\" Each (move Slide (then (custodial (from (last To)) Axial (between (max 1) if:(\"IsEnemyAt\" (between)) (apply (remove (between)))) (to if:(= (what at:(to)) (what at:(last To))))))))}) (rules (start { (place \"Disc1\" {\"A3\" \"B3\" \"B4\" \"B2\"}) (place \"Disc2\" {\"D2\" \"D3\" \"E3\" \"D4\"})}) (play (forEach Piece)) (end (\"HavingLessPiecesLoss\" Next 1)))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x12 board. The board begins with the following pattern of counters in the holes, beginning from the bottom left row and proceeding in an anti-clockwise direction: 0-0-4-0-4-0-4-0-4-0-4-0-4-0-4-0-4-0-4-0-4-0-4-0. One player starts with an additional four counters in their left hand hole. The player with fewer counters on their first move places the counters from their seventh hole into the opponent's opposite hole. Sowing occurs in an anti-clockwise direction, and may only happen when the final counter lands either in an empty hole in the player's own row or in any hole in the opponent's row. When the final counter lands in an empty hole in the player's own row, the contents of the opposite hole in the opponent's row are captured. When the final counter lands in an occupied hole in the opponent's row, these counters are picked up and sowing continues. The final counter of this sowing is allowed to fall into an occupied hole in the player's own row, and these are picked up and sowing continues. Sowing ends when the final counter lands in an empty hole. The game ends when one player has no counters on their side of the board, and the opponent wins. \n\n###\n\n", "completion": "(define \"NoPiecesInPlayerSide\" (all Sites (sites #1) if:(= 0 (count at:(site))))) (define \"NextHoleFrom\" (\"NextSiteOnTrack\" #2 from:#1)) (define \"Columns\" 12) (game \"Gamacha\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" store:None (track \"Track\" \"0,E,N,W\" loop:True)) (piece \"Seed\" Shared) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (hand Each)}) (rules (start (set Count 4 to:(sites {\"C1\" \"E1\" \"G1\" \"I1\" \"K1\" \"L2\" \"J2\" \"H2\" \"F2\" \"D2\" \"B2\"}))) phases:{ (phase \"Opening\" (play (move (from 6) (to 18) count:4)) (nextPhase \"Sowing\")) (phase \"Sowing\" (play (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover)) if:(if (\"SameTurn\") True (and (> (count at:(from)) 0) (if (is In (\"NextHoleFrom\" (from) (count at:(from))) (sites Next)) True (is Empty (\"NextHoleFrom\" (from) (count at:(from)))))))) (then (sow apply:(if (and (is In (to) (sites Mover)) (<= (count at:(to)) 1)) (if (!= 0 (count at:(\"OppositePit\" (to)))) (fromTo (from (\"OppositePit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePit\" (to))))) (if (> (count at:(to)) 1) (moveAgain))))))))} (end (forEach Player if:(\"NoPiecesInPlayerSide\" Player) (result Player Loss))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nHex 3,4 -> Hex 4,5\nCapture, Forced placement, Double moves -> Self Removals, Forced placement\n(define \"UpdateSurplusesToDisplayFor\" (forEach Group Adjacent if:(is In (to) (sites Occupied by:#1)) (forEach Value (array (sites)) (set Value at:(value) (\"SurplusGoodsChainAt\" (value)))))) (define \"SurplusGoodsChainAt\" (- (size Array (array (\"SuppliersAroundChainAt\" #1))) (size Array (array (\"WarehousesinChainAt\" #1))))) (define \"ScoreFor\" (set Score #1 (size Array (array (\"AllWarehousesOf\" #1))))) (define \"Score\" (and (\"ScoreFor\" P1) (\"ScoreFor\" P2))) (define \"AllWarehousesOf\" (forEach (sites Occupied by:#1) if:(\"IsWarehouseAt\" (site)))) (define \"DoubleTurnProtocol\" (set Var \"MoveInTurn\" (% (+ 3 (var \"MoveInTurn\")) 2) (then (if (= 1 (var \"MoveInTurn\")) (moveAgain))))) (define \"DeficitWarehousesOf\" (forEach (sites Occupied by:#1) if:(and (\"IsWarehouseAt\" (site)) (\"IsDeficitInChainAt\" (site))))) (define \"Place\" (do (move Add (to (sites Empty))) ifAfterwards:(not (\"IsDeficitInChainAt\" (last To))))) (define \"WarehousesinChainAt\" (forEach (\"ChainAt\" #1) if:(\"IsWarehouseAt\" (site)))) (define \"SuppliersAroundChainAt\" (sites Around (\"ChainAt\" #1) Adjacent if:(\"IsSupplierAt\" (to)))) (define \"ChainAt\" (sites Group at:#1 Adjacent)) (define \"IsDeficitInChainAt\" (< (size Array (array (\"SuppliersAroundChainAt\" #1))) (size Array (array (\"WarehousesinChainAt\" #1))))) (define \"IsWarehouseAt\" (< 2 (count Pieces of:(who at:#1) in:(sites Around #1 Adjacent)))) (define \"IsSupplierAt\" (and (not (is Empty #1)) (> 3 (count Pieces of:(who at:#1) in:(sites Around #1 Adjacent if:(not (is Empty (to)))))))) (game \"SupplyChains\" (players 2) (equipment { (board (hex 3 4) use:Cell) (piece \"Disc\" Each)}) (rules (play (priority { (move Remove (\"DeficitWarehousesOf\" Next)) (or { (\"Place\")})} (then (and { (\"UpdateSurplusesToDisplayFor\" Mover) (\"UpdateSurplusesToDisplayFor\" Next) (\"Score\") (if (can Move (move Remove (\"DeficitWarehousesOf\" Next))) (moveAgain) \"DoubleTurnProtocol\")})))) (end (if (or (all Passed) (no Moves Mover)) (byScore)))))\n\n###\n\n", "completion": "(define \"UpdateSurplusesToDisplayFor\" (forEach Group Adjacent if:(is In (to) (sites Occupied by:#1)) (forEach Value (array (sites)) (set Value at:(value) (\"SurplusGoodsChainAt\" (value)))))) (define \"SurplusGoodsChainAt\" (- (size Array (array (\"SuppliersAroundChainAt\" #1))) (size Array (array (\"WarehousesinChainAt\" #1))))) (define \"ScoreFor\" (set Score #1 (size Array (array (\"AllWarehousesOf\" #1))))) (define \"Score\" (and (\"ScoreFor\" P1) (\"ScoreFor\" P2))) (define \"AllWarehousesOf\" (forEach (sites Occupied by:#1) if:(\"IsWarehouseAt\" (site)))) (define \"DoubleTurnProtocol\" (set Var \"MoveInTurn\" (% (+ 3 (var \"MoveInTurn\")) 2) (then (if (= 1 (var \"MoveInTurn\")) (moveAgain))))) (define \"DeficitWarehousesOf\" (forEach (sites Occupied by:#1) if:(and (\"IsWarehouseAt\" (site)) (\"IsDeficitInChainAt\" (site))))) (define \"Place\" (do (move Add (to (sites Empty))) ifAfterwards:(not (\"IsDeficitInChainAt\" (last To))))) (define \"WarehousesinChainAt\" (forEach (\"ChainAt\" #1) if:(\"IsWarehouseAt\" (site)))) (define \"SuppliersAroundChainAt\" (sites Around (\"ChainAt\" #1) Adjacent if:(\"IsSupplierAt\" (to)))) (define \"ChainAt\" (sites Group at:#1 Adjacent)) (define \"IsDeficitInChainAt\" (< (size Array (array (\"SuppliersAroundChainAt\" #1))) (size Array (array (\"WarehousesinChainAt\" #1))))) (define \"IsWarehouseAt\" (< 2 (count Pieces of:(who at:#1) in:(sites Around #1 Adjacent)))) (define \"IsSupplierAt\" (and (not (is Empty #1)) (> 3 (count Pieces of:(who at:#1) in:(sites Around #1 Adjacent if:(not (is Empty (to)))))))) (game \"SupplyChains\" (players 2) (equipment { (board (hex 4 5) use:Cell) (piece \"Disc\" Each)}) (rules (play (priority { (move Remove (\"DeficitWarehousesOf\" Mover)) (or { (\"Place\")})} (then (and { (\"UpdateSurplusesToDisplayFor\" Mover) (\"UpdateSurplusesToDisplayFor\" Next) (\"Score\") (if (can Move (move Remove (\"DeficitWarehousesOf\" Mover))) (moveAgain))})))) (end (if (or (all Passed) (no Moves Mover)) (byScore))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(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 \"Dragonchess\" (\"TwoPlayersNorthSouth\") (equipment { (board (merge (square 10) (shift -3 3 (rectangle 4 16)))) (\"ChessPawn\" \"Pawn\" (or \"InitialPawnMove\" \"EnPassant\") (then (and (\"ReplayInMovingOn\" (sites Mover \"Promotion\")) (set Counter)))) (\"ChessRook\" \"Rook\" (then (set Counter)) (\"RememberPieceHasMoved\")) (\"ChessKing\" \"King\" (then (set Counter)) (\"RememberPieceHasMoved\")) (\"ChessBishop\" \"Bishop\" (then (set Counter))) (\"ChessKnight\" \"Knight\" (then (set Counter))) (\"ChessQueen\" \"Queen\" (then (set Counter))) (piece \"Dragon\" Each (move Slide (between (max 3) if:(is Empty (between))) (to if:(\"IsEnemyAt\" (to)) (apply (remove (to) (then (set Counter))))))) (map \"King\" {(pair 1 \"I1\") (pair 2 \"H10\")}) (map \"RookLeft\" {(pair 1 \"E1\") (pair 2 \"L10\")}) (map \"RookRight\" {(pair 1 \"L1\") (pair 2 \"E10\")}) (regions \"Promotion\" P1 (sites Top)) (regions \"Promotion\" P2 (sites Bottom))}) (rules (start { (place \"Pawn1\" (sites Row 1)) (place \"Pawn2\" (sites Row 8)) (place \"Dragon1\" {\"D1\" \"M1\"}) (place \"Rook1\" {\"E1\" \"L1\"} state:1) (place \"Knight1\" {\"F1\" \"K1\"}) (place \"Bishop1\" {\"G1\" \"J1\"}) (place \"Queen1\" coord:\"H1\") (place \"King1\" coord:\"I1\" state:1) (place \"Dragon2\" {\"D10\" \"M10\"}) (place \"Rook2\" {\"E10\" \"L10\"} state:1) (place \"Knight2\" {\"F10\" \"K10\"}) (place \"Bishop2\" {\"G10\" \"J10\"}) (place \"Queen2\" coord:\"I10\") (place \"King2\" coord:\"H10\" state:1)}) (play (if \"SameTurn\" (move Promote (last To) (piece {\"Queen\" \"Knight\" \"Bishop\" \"Rook\" \"Dragon\"}) Mover) (do (or (forEach Piece) (\"Castling\")) ifAfterwards:(not (\"IsInCheck\" \"King\" Mover))))) (end { (\"Checkmate\" \"King\") (if (or (no Moves Mover) (= (counter) 99)) (result Mover Draw))})))\n\n###\n\n", "completion": "Same rules as Chess. Dragons move like queens, but at most three squares. END" }, { "prompt": "Construct a Ludii game based on the following description\n4x8 board. Three counters in each hole. Players pick up counters from any of their holes and sow them in either direction. If the last counter falls into an occupied hole, they pick the counters in this hole up and continue sowing. Sowing ends when the last counter falls into an empty hole. If the empty hole is in the inner row, the player captures any of the counters in the opponent's two holes opposite it. Play ends when all of one player's seeds have been captured. \n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (+ (count Cell at:(handSite #1)) (count in:(sites #1 \"Home\")))) (define \"Sow\" (move Select (from (if (\"SameTurn\") (if #1 \"LastHoleSowed\") (sites Mover \"Home\")) if:(> (count at:(from)) 0)) (then (sow #2 owner:(mover) apply:(if (= (count at:(to)) 1) (if (is In (to) (sites Mover \"Inner\")) (and (if (> (count at:(\"OppositePit\" (to))) 0) (fromTo (from (\"OppositePit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePit\" (to))))) (if (> (count at:(\"OppositeOuterPit\" (to))) 0) (fromTo (from (\"OppositeOuterPit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositeOuterPit\" (to))))))) #3))))) (define \"Columns\" 8) (game \"Bao Ki Arabu (Zanzibar 1)\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" 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\" \"24,E,S1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"TrackCCW1\")) (regions \"Home\" P2 (sites Track \"TrackCCW2\")) (regions \"Inner\" P1 (difference (sites Track \"TrackCCW1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"TrackCCW2\") (sites Top))) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 3 to:(sites Board))) (play (or (\"Sow\" (is Pending) \"TrackCW\" (and (moveAgain) (set Pending))) (\"Sow\" (not (is Pending)) \"TrackCCW\" (moveAgain)))) (end (\"MancalaByScoreWhen\" (no Moves Mover))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe graph is initially coloured. The goal of the general version of the puzzle is to uncolour edges until the coloured graph is a regular graph. The goal of the parameter-k version of the puzzle is to uncolour edges until the coloured graph is a k-regular graph.\n The game is played on the Graph1. General version\n\n###\n\n", "completion": "(game \"Nein Ari\" (players 1) (equipment { (board (graph vertices:{ {0 0} {5 0} {10 0} {0 5} {5 5} {10 5}} edges:{ {0 1} {0 2} {0 3} {0 4} {0 5} {1 2} {1 3} {1 4} {1 5} {2 3} {2 4} {2 5} {3 4} {3 5} {4 5}}) use:Edge)}) (rules (start (set P1 Edge (sites Board Edge))) (play (move Remove (sites Occupied by:Mover on:Edge))) (end (if (is RegularGraph Mover) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n3x3 grid. Three pieces per player. Players alternate turns placing a piece on the board. When all of the pieces are placed, players alternate turns moving a piece to any empty space on the board. The player who places three pieces in an orthogonal row wins. \n\n###\n\n", "completion": "(game \"Dris at-Talata\" (players 2) (equipment { (board (square 3)) (hand Each) (piece \"Marker\" Each)}) (rules (start (place \"Marker\" \"Hand\" count:3)) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase (\"HandEmpty\" P2) \"Movement\")) (phase \"Movement\" (play (move (from (sites Occupied by:Mover)) (to (sites Empty)))))} (end (\"Line3Win\" Orthogonal)))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nEach player has 7 holes. -> Each player has 8 holes.\n(define \"PiecesOwnedBy\" (count Cell at:(handSite #1))) (game \"Hoyito\" (players 2) (equipment { (mancalaBoard 2 7 store:None (track \"Track\" \"0,E,N,W\" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 4 to:(sites Track))) (play (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover)) if:(> (count at:(from)) 0)) (then (sow apply:(if (= (count at:(to)) 4) (if (<= (count in:(sites Board)) 8) (forEach Site (sites Board) (if (> (count at:(site)) 0) (fromTo (from (site)) (to (handSite Mover)) count:(count at:(site))))) (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to)))) (if (< (count at:(to)) 1) (moveAgain))))))) (end (\"MancalaByScoreWhen\" (no Moves Mover)))))\n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (count Cell at:(handSite #1))) (game \"Hoyito\" (players 2) (equipment { (mancalaBoard 2 8 store:None (track \"Track\" \"0,E,N,W\" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 4 to:(sites Track))) (play (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover)) if:(> (count at:(from)) 0)) (then (sow apply:(if (= (count at:(to)) 4) (if (<= (count in:(sites Board)) 8) (forEach Site (sites Board) (if (> (count at:(site)) 0) (fromTo (from (site)) (to (handSite Mover)) count:(count at:(site))))) (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to)))) (if (< (count at:(to)) 1) (moveAgain))))))) (end (\"MancalaByScoreWhen\" (no Moves Mover))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe version of the game played with 3 players. -> The version of the game played with 4 players.\n(game \"Ciri Amber\" (players 3) (equipment { (board (complete (regular Star 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 Cost 3 Edge at:12) (set Cost 1 Edge at:13) (set Cost 2 Edge at:14) (set Cost 3 Edge at:15) (set Cost 1 Edge at:16) (set Cost 2 Edge at:17) (set Cost 3 Edge at:18) (set Cost 3 Edge at:19) (set Cost 1 Edge at:20)}) (play (move Remove (sites Occupied by:Neutral) (then (addScore Mover (cost Edge at:(last To)))))) (end (if (is RegularGraph Neutral) (byScore)))))\n\n###\n\n", "completion": "(game \"Ciri Amber\" (players 4) (equipment { (board (complete (regular Star 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 Cost 3 Edge at:12) (set Cost 1 Edge at:13) (set Cost 2 Edge at:14) (set Cost 3 Edge at:15) (set Cost 1 Edge at:16) (set Cost 2 Edge at:17) (set Cost 3 Edge at:18) (set Cost 3 Edge at:19) (set Cost 1 Edge at:20)}) (play (move Remove (sites Occupied by:Neutral) (then (addScore Mover (cost Edge at:(last To)))))) (end (if (is RegularGraph Neutral) (byScore))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayer 1 marks a cell. Then Players take turns marking any unmarked cell with exactly one marked neighbour. Player who can't move loses. \n\n###\n\n", "completion": "(define \"NumNeighbour\" (count Sites in:(sites Around (to) Orthogonal if:(is In (to) (sites Occupied by:Neutral))))) (game \"Snowpaque\" (players 2) (equipment { (board (hex 5)) (piece \"Marker\" Neutral)}) (rules phases:{ (phase \"start\" P1 (play (move Add (piece (id \"Marker0\")) (to (sites Empty)))) (nextPhase \"play\")) (phase \"play\" (play (move Add (piece \"Marker0\") (to (sites Empty) if:(= \"NumNeighbour\" 1)))))} (end (\"NoMoves\" Loss)))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6 board. Six counters in each hole. Players take the contents of one of their holes and sow in an anti-clockwise direction. When the final counter of a sowing lands in a hole, making it contain two, four, or six counters, these counters are taken. If the second to last hole also contains two, four, or six counters, these are also taken, continuing in an unbroken line until a hole with containing a number of counters other than two, four, or six. The game continues until all of the counters have been captured. The player who captured the most counters wins. \n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (count Cell at:(handSite #1))) (game \"Mankala\" (players 2) (equipment { (mancalaBoard 2 6 store:None (track \"Track\" \"0,E,N,W\" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 6 to:(sites Track))) (play (move Select (from (sites Mover) if:(< 0 (count at:(from)))) (then (sow if:(or { (= (count at:(to)) 2) (= (count at:(to)) 4) (= (count at:(to)) 6)}) apply:(fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))) backtracking:True)))) (end (\"MancalaByScoreWhen\" (and (no Moves Next) (no Moves Mover)))))) 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. There is a choice of stylised opening move. One player takes a counter from their rightmost hole, then another from the opposite hole in the opponent's row, then proceeding in this fashion in an anti-clockwise direction until the holes alternate with five and three counters, until reaching the hole from which sowing began, which will hold four. The original counter is sown into the next hole in the opponent's row, making four, thus creating a tuz, which behaves as explained below. Alternatively, the player may rearrange the counters in a similar manner, but creating an alternating pattern of holes with three and five counters, and not creating a tuz. After this, 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, a tuz, 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 in the tuz, in which case the opponent takes one counter from it, along with the final counter. The tuz remains in the ownership of the person who captured it. If it remains empty and the opponent drops their last counter into the tuz, the last counter is removed. Play then continues by picking up the contents of another hole and continuing to sow. 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 tuz 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, and if each player has two remaining counters ownership is determined by chance. Play continues in several rounds like this until one player takes all the counters. \n\n###\n\n", "completion": "(define \"SitesMarkedBy\" (forEach (sites Board) if:(= #1 (state at:(site))))) (define \"RememberOwnedHolesRandom\" (if (< 50 (value Random (range 1 100))) (remember Value \"OwnedP1\" #1) (remember Value \"OwnedP2\" #1))) (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 \"OpponentOwnedHoles\" (if (is Mover P1) (sites (values Remembered \"OwnedP2\")) (sites (values Remembered \"OwnedP1\")))) (define \"OwnedHoles\" (if (is Mover P1) (sites (values Remembered \"OwnedP1\")) (sites (values Remembered \"OwnedP2\")))) (define \"NextHole\" (\"NextSiteOnTrack\" #3 from:#1 #2)) (game \"Tuz\" (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 \"Opening\" (play (move Select (from (if (\"SameTurn\") (sites {(\"NextHole\" (last From) \"TrackCCW\" 2)}) (union (sites {10}) (intersection (sites Bottom) (sites Right))))) (then (sow count:1 \"TrackCCW\" apply:(if (not (is In (\"NextHole\" (from) \"TrackCCW\" 2) (intersection (sites Bottom) (sites Right)))) (moveAgain) (if (= 4 (count at:11)) (set State at:11 (mover)))))))) (nextPhase (is In (\"NextHole\" (last From) \"TrackCCW\" 2) (intersection (sites Bottom) (sites Right))) \"Sowing\")) (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))) (is In (to) (\"OpponentOwnedHoles\"))}) (set State at:(to) (mover)) (if (< 1 (count at:(to))) (if (= 0 (state at:(to))) (and (moveAgain) (set Var \"Replay\" (to))) (if (!= (mover) (state at:(to))) (and (fromTo (from (to)) (to (handSite Mover)) count:(min 2 (count at:(to)))) (set State at:(to) (state at:(to)))))))))))} (then (if (\"OnlyPiecesInMarked\") (and { (forEach Site (\"SitesMarkedBy\" 1) (fromTo (from (site)) (to (handSite P1)) count:(count at:(site)))) (forEach Site (\"SitesMarkedBy\" 2) (fromTo (from (site)) (to (handSite P2)) count:(count at:(site)))) (forget Value \"OwnedP1\" All) (forget Value \"OwnedP2\" All)}))))) (end (if (\"NoPieceOnBoard\") { (if (= 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 (\"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\"))}))))}))))) (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 is played on a 13x13 board -> The game is played on a 15x15 board\n(define \"MadeALegalMove\" (do (add (to (last To)) (then (and { \"CaptureSurroundedPiece\" (set Hidden at:(last To) to:Next) (note player:Mover \"has moved\") (note player:Next \"to play\")}))) ifAfterwards:(\"HasFreedom\" Orthogonal))) (define \"NotEmpty\" (not (is In (last To) (sites Empty)))) (define \"IllegalMove\" (and { (note player:Mover \"made an illegal move\") (note player:Mover \"to play\") (moveAgain)})) (define \"CaptureSurroundedPiece\" (enclose (from (last To)) Orthogonal (between if:(\"IsEnemyAt\" (between)) (apply (and (addScore Mover 1) (remove (between))))))) (game \"Phantom Go\" (players 2) (equipment { (board (square 13) use:Vertex) (piece \"Marker\" Each)}) (rules (play (or (move Select (from (union (sites Empty) (sites Hidden to:Mover))) (then (priority { (if (\"NotEmpty\") (\"IllegalMove\")) (\"MadeALegalMove\") (\"IllegalMove\")}))) (move Pass))) (end (if (all Passed) (byScore { (score P1 (+ (score P1) (size Territory P1))) (score P2 (+ (score P2) (size Territory P2)))})))))\n\n###\n\n", "completion": "(define \"MadeALegalMove\" (do (add (to (last To)) (then (and { \"CaptureSurroundedPiece\" (set Hidden at:(last To) to:Next) (note player:Mover \"has moved\") (note player:Next \"to play\")}))) ifAfterwards:(\"HasFreedom\" Orthogonal))) (define \"NotEmpty\" (not (is In (last To) (sites Empty)))) (define \"IllegalMove\" (and { (note player:Mover \"made an illegal move\") (note player:Mover \"to play\") (moveAgain)})) (define \"CaptureSurroundedPiece\" (enclose (from (last To)) Orthogonal (between if:(\"IsEnemyAt\" (between)) (apply (and (addScore Mover 1) (remove (between))))))) (game \"Phantom Go\" (players 2) (equipment { (board (square 15) use:Vertex) (piece \"Marker\" Each)}) (rules (play (or (move Select (from (union (sites Empty) (sites Hidden to:Mover))) (then (priority { (if (\"NotEmpty\") (\"IllegalMove\")) (\"MadeALegalMove\") (\"IllegalMove\")}))) (move Pass))) (end (if (all Passed) (byScore { (score P1 (+ (score P1) (size Territory P1))) (score P2 (+ (score P2) (size Territory P2)))}))))) END" }, { "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\nKing's Valley is a very simple and easy game to play. This is because all the pieces move the same. Any piece can move straight horizontal, vertical or diagonal, but always as far as possible. Pieces always stop their movement either at the sides of the board or before another piece in the same row, column, or diagonal.\n The winner is the first player that manages to move his king piece to the central square of the board, which represents the King's Valley. \n\n###\n\n", "completion": "(define \"Move\" (move (from) (to (sites LineOfSight Farthest at:(from))))) (game \"King's Valley\" (players 2) (equipment { (board (square 5)) (piece \"Disc\" Each \"Move\") (piece \"King\" Each \"Move\")}) (rules (start { (place \"King1\" (intersection (sites Bottom) (sites Column 2))) (place \"King2\" (intersection (sites Top) (sites Column 2))) (place \"Disc1\" (difference (sites Bottom) (sites Column 2))) (place \"Disc2\" (difference (sites Top) (sites Column 2)))}) (play (forEach Piece)) (end (if (is In (where \"King\" Mover) (sites Centre)) (result Mover Win))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game is played on a 6x6 board -> The game is played on a 10x10 board\n(define \"IsUnpromoted\" (\"IsPieceAt\" \"Counter\" Mover (last To))) (define \"HopCounter\" (move Hop (from #1) All (between if:(and (not (is In (between) (sites ToClear))) (\"IsEnemyAt\" (between))) (apply (remove (between) at:EndOfTurn))) (to if:(is Empty (to))) #2)) (game \"Omnidirectional Draughts\" (players 2) (\"DraughtsEquipment\" (square 6)) (rules (start { (place \"Counter1\" (expand (sites Bottom) steps: (- (/ 6 2) 2))) (place \"Counter2\" (expand (sites Top) steps: (- (/ 6 2) 2)))}) (play (if \"SameTurn\" (if \"IsUnpromoted\" (max Moves (\"HopCounter\" (last To) (then (\"ReplayIfCanMove\" (\"HopCounter\" (last To)) (\"PromoteIfReach\" (sites Next) \"DoubleCounter\"))))) (max Moves (\"HopSequenceCaptureAgain\" before:(count Rows) after:(count Rows) at:EndOfTurn))) (priority { (max Moves (or (forEach Piece \"Counter\" (\"HopCounter\" (from) (then (\"ReplayIfCanMove\" (\"HopCounter\" (last To)) (\"PromoteIfReach\" (sites Next) \"DoubleCounter\"))))) (forEach Piece \"DoubleCounter\" (\"HopSequenceCapture\" before:(count Rows) after:(count Rows) at:EndOfTurn)))) (or (forEach Piece \"Counter\" (\"StepToEmpty\" (directions Forwards)) (then (\"PromoteIfReach\" (sites Next) \"DoubleCounter\"))) (forEach Piece \"DoubleCounter\" (move Slide)))}))) (end (\"BlockWin\"))))\n\n###\n\n", "completion": "(define \"IsUnpromoted\" (\"IsPieceAt\" \"Counter\" Mover (last To))) (define \"HopCounter\" (move Hop (from #1) All (between if:(and (not (is In (between) (sites ToClear))) (\"IsEnemyAt\" (between))) (apply (remove (between) at:EndOfTurn))) (to if:(is Empty (to))) #2)) (game \"Omnidirectional Draughts\" (players 2) (\"DraughtsEquipment\" (square 10)) (rules (start { (place \"Counter1\" (expand (sites Bottom) steps: (- (/ 10 2) 2))) (place \"Counter2\" (expand (sites Top) steps: (- (/ 10 2) 2)))}) (play (if \"SameTurn\" (if \"IsUnpromoted\" (max Moves (\"HopCounter\" (last To) (then (\"ReplayIfCanMove\" (\"HopCounter\" (last To)) (\"PromoteIfReach\" (sites Next) \"DoubleCounter\"))))) (max Moves (\"HopSequenceCaptureAgain\" before:(count Rows) after:(count Rows) at:EndOfTurn))) (priority { (max Moves (or (forEach Piece \"Counter\" (\"HopCounter\" (from) (then (\"ReplayIfCanMove\" (\"HopCounter\" (last To)) (\"PromoteIfReach\" (sites Next) \"DoubleCounter\"))))) (forEach Piece \"DoubleCounter\" (\"HopSequenceCapture\" before:(count Rows) after:(count Rows) at:EndOfTurn)))) (or (forEach Piece \"Counter\" (\"StepToEmpty\" (directions Forwards)) (then (\"PromoteIfReach\" (sites Next) \"DoubleCounter\"))) (forEach Piece \"DoubleCounter\" (move Slide)))}))) (end (\"BlockWin\")))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"Shatranj at-Tamma\" (\"TwoPlayersNorthSouth\") (equipment { (\"ChessPawn\" \"Pawn\" ~ (then (if (is In (last To) (sites Mover \"Promotion\")) (if (\"IsOffBoard\" (where \"Queen\" Mover)) (promote (last To) (piece \"Queen\") Mover) (remove (last To)))))) (\"ChessKing\" \"King_noCross\") (piece \"Queen\" Each (\"StepToNotFriend\" Diagonal)) (\"ChessKnight\" \"Knight\") (\"ChessKing\" \"Wazir\") (\"ChessRook\" \"Rook\") (piece \"Elephant\" Each (move Hop Diagonal (between if:True) (to if:(or (is Empty (to)) (and (\"IsEnemyAt\" (to)) (not (\"IsPieceAt\" \"Elephant\" Next (to))))) (apply (remove (to)))))) (regions \"Promotion\" P1 (sites Top)) (regions \"Promotion\" P2 (sites Bottom)) (board (square 10))}) (rules (start { (place \"Pawn1\" (sites Row 2)) (place \"Pawn2\" (sites Row 7)) (place \"Rook1\" (sites {\"A1\" \"J1\"})) (place \"Rook2\" (sites {\"A10\" \"J10\"})) (place \"Knight1\" (sites {\"B1\" \"I1\"})) (place \"Knight2\" (sites {\"B10\" \"I10\"})) (place \"Elephant1\" (sites {\"C1\" \"H1\"})) (place \"Elephant2\" (sites {\"C10\" \"H10\"})) (place \"Wazir1\" (sites {\"D1\" \"G1\"})) (place \"Wazir2\" (sites {\"D10\" \"G10\"})) (place \"Queen1\" coord:\"E1\") (place \"Queen2\" coord:\"F10\") (place \"King_noCross1\" coord:\"F1\") (place \"King_noCross2\" coord:\"E10\")}) (play (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King_noCross\" Mover)))) (end { (\"Checkmate\" \"King_noCross\") (\"BlockWin\")})))\n\n###\n\n", "completion": "10x10 board. The pieces move as follows, with the number per player: 1 x Shah (king): one space orthogonally or diagonally; 1 x Fers (counselor): one square diagonally; 2 x Rukh (rook): any number of spaces orthogonally; 2x Dabbaba: one space orthogonally or diagonally; 2 x Pil (elephant): two squares diagonally, jumping over the first. Cannot capture another Pil; 2 x Asb (horse): one square orthogonally, and then one square diagonally, jumping over any intervening pieces; 10 x Sarbaz (soldier): one space forward orthogonally or one space forward diagonally to capture. No en passant. Sarbaz begins in the third rank, and is promoted to Fers when reaching the tenth rank, only if the Fers has been captured. Otherwise, the other player captures it. No castling. Stalemate results in win for player causing it. The player who checkmates the king wins. END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayed on a Backgammon board. Three pieces per player. Two dice. Only the lower value of the dice is used. One player plays from their let toward their right, and the other player from their right to their left. Pieces begin on the outer edge of the board. Pieces move according to the throw of the dice toward the point on the opposite side of their side of the board. No more than one piece can be on a point (except the final point) at any time. Pieces cannot pass each other. When a piece lands on an empty point that is opposite an opponent's point with a piece on it, the opponent's piece is sent back to start. The first player to place all three of their pieces on the final point wins. \n\n###\n\n", "completion": "(define \"ThreePiecesOnFinalPoint\" (= 3 (count Pieces Mover in:(sites {(mapEntry \"FinalPoint\" Mover)})))) (define \"NextSiteFrom\" (\"NextSiteOnTrack\" #2 from:#1)) (define \"ThrowValue\" (min (face 26) (face 27))) (game \"Tourne-Case\" (players 2) (equipment { (\"BackgammonBoard\" { (track \"Track1\" {6 0..5 7..12 25..20 18..13} P1 directed:True) (track \"Track2\" {19 13..18 20..25 12..7 5..0} P2 directed:True)}) (dice d:6 num:2) (piece \"Disc\" Each (move (from (from)) (to (\"NextSiteFrom\" (from) (\"ThrowValue\")) if:(and (or (is Empty (to)) (and (= (to) (mapEntry \"FinalPoint\" Mover)) (no Pieces Next in:(sites {(mapEntry \"FinalPoint\" Mover)})))) (if (< 1 (\"ThrowValue\")) (no Pieces Mover in:(sites Track Mover from:(\"NextSiteFrom\" (from) 1) to:(\"NextSiteFrom\" (from) (- (\"ThrowValue\") 1)))) True)) (apply (if (and (\"IsEnemyAt\" (mapEntry \"Opposite\" (to))) (\"IsSingletonStack\" (mapEntry \"Opposite\" (to)))) (fromTo (from (mapEntry \"Opposite\" (to))) (to (mapEntry \"Bar\" Next)))))))) (map \"FinalPoint\" {(pair P1 13) (pair P2 0)}) (map \"Bar\" {(pair P1 6) (pair P2 19)}) (map \"Opposite\" { (pair 0 13) (pair 1 14) (pair 2 15) (pair 3 16) (pair 4 17) (pair 5 18) (pair 7 20) (pair 8 21) (pair 9 22) (pair 10 23) (pair 11 24) (pair 12 25) (pair 13 0) (pair 14 1) (pair 15 2) (pair 16 3) (pair 17 4) (pair 18 5) (pair 20 7) (pair 21 8) (pair 22 9) (pair 23 10) (pair 24 11) (pair 25 12)})}) (rules (start { (place Stack \"Disc1\" 6 count:3) (place Stack \"Disc2\" 19 count:3)}) (play (\"RollMove\" (forEach Piece top:True))) (end (if (\"ThreePiecesOnFinalPoint\") (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x7 board, with three store holes. Three players. One player, the Raja, owns the three central holes in each row, one player owns the holes to the left and the other player the holes to the right. Seven counters in each hole. Players alternate turns sowing the counters in an anti-clockwise direction. When the final counter lands in a hole, the contents of the following hole are picked up, and sowing continues. If the following hole is empty, the contents of the next hole after that one are captured. Also, if at any point during the sowing a hole contains four counters, they are immediately captured. Play continues until all of the counters have been captured. If a player cannot play, they pass their turn, until captures are no longer possible, at which point the last person who played captures the remaining counters. A new round begins. The Raja gives each of the other players one counter. Players fill their holes with their captured counters, seven per hole. Any holes which can not be filled with seven counters are out of play. Play continues as before. A player plays as the Raja for three turns in a row, after which point it rotates to the next player. Play continues until only one player can fill holes on the board, this player becoming the winner. \n\n###\n\n", "completion": "(define \"FourOrLessPieceOnBoard\" (> 4 (count in:(difference (sites Board) (sites Row 1))))) (define \"HomeMover\" (if (is Mover P1) (\"HomeP1\") (if (is Mover P2) (\"HomeP2\") (\"HomeP3\")))) (define \"HomeP3\" (if (> 3 (% (+ 1 (var \"Round\")) 9)) (sites {5 6 12 13}) (if (> 6 (% (+ 1 (var \"Round\")) 9)) (sites {0 1 7 8}) (sites {2 3 4 9 10 11})))) (define \"HomeP2\" (if (> 3 (% (+ 1 (var \"Round\")) 9)) (sites {2 3 4 9 10 11}) (if (> 6 (% (+ 1 (var \"Round\")) 9)) (sites {5 6 12 13}) (sites {0 1 7 8})))) (define \"HomeP1\" (if (> 3 (% (+ 1 (var \"Round\")) 9)) (sites {0 1 7 8}) (if (> 6 (% (+ 1 (var \"Round\")) 9)) (sites {2 3 4 9 10 11}) (sites {5 6 12 13})))) (define \"NextHole\" (\"NextSiteOnTrack\" 1 from:#1 \"Track\")) (define \"PlayableSites\" (sites (values Remembered \"Playable\"))) (game \"Raja Pasu Mandiri\" (players 3) (equipment { (board (merge { (rectangle 1 7) (shift 0 2 (rectangle 1 7)) (shift 3 1 (square 1)) (shift 1 1 (square 1)) (shift 5 1 (square 1))}) { (track \"Track\" \"6,W,7,E\" loop:True)} use:Vertex) (piece \"Seed\" Shared) (map {(pair P1 15) (pair P2 14) (pair P3 16)})}) (rules (start { (set Count 7 to:(difference (sites Board) (sites Row 1))) (set RememberValue \"Playable\" (difference (sites Board) (sites Row 1)))}) phases:{ (phase \"Sowing\" (play (or { (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (\"HomeMover\")) if:(and (is Occupied (from)) (is In (from) (\"PlayableSites\")))) (then (do (set Var \"NumSowed\" (count at:(last To))) next:(sow apply:(if (< 1 (count at:(to))) (and (moveAgain) (set Var \"Replay\" (to))) (if (is Occupied (\"NextHole\" (to))) (fromTo (from (to)) (to (mapEntry Mover)) count:(count at:(to))))) skipIf:(not (is In (to) (\"PlayableSites\")))) (then (and (forEach Site (sites Track from:(last From) to:(\"NextSiteOnTrack\" (var \"NumSowed\") from:(last From) \"Track\")) (if (= 4 (count at:(site))) (fromTo (from (site)) (to (mapEntry Mover)) count:4))) (set Var \"NumSowed\" 0))))))} (then (if (\"FourOrLessPieceOnBoard\") (and { (forEach Site (difference (sites Board) (sites Row 1)) (if (is Occupied (site)) (fromTo (from (site)) (to (mapEntry Mover)) count:(count at:(site))))) (if (and (= 6 (count Sites in:(\"HomeP1\"))) (< 2 (count at:(mapEntry P1)))) (and (fromTo (from (mapEntry P1)) (to (mapEntry P2)) count:1) (fromTo (from (mapEntry P1)) (to (mapEntry P3)) count:1)) (if (and (= 6 (count Sites in:(\"HomeP2\"))) (< 2 (count at:(mapEntry P2)))) (and (fromTo (from (mapEntry P2)) (to (mapEntry P1)) count:1) (fromTo (from (mapEntry P2)) (to (mapEntry P3)) count:1)) (if (and (= 6 (count Sites in:(\"HomeP3\"))) (< 2 (count at:(mapEntry P3)))) (and (fromTo (from (mapEntry P3)) (to (mapEntry P1)) count:1) (fromTo (from (mapEntry P3)) (to (mapEntry P2)) count:1))))) (set Var \"Round\" (+ 1 (var \"Round\"))) (forget Value \"Playable\" All)}))))) (end { (if (\"FourOrLessPieceOnBoard\") { (if (> 7 (count at:(mapEntry P1))) (result P1 Loss)) (if (> 7 (count at:(mapEntry P2))) (result P2 Loss)) (if (> 7 (count at:(mapEntry P3))) (result P3 Loss))})}) (nextPhase (\"FourOrLessPieceOnBoard\") \"BetweenRounds\")) (phase \"BetweenRounds\" (play (if (not (all Sites (\"HomeMover\") if:(is Occupied (site)))) (if (<= 7 (count at:(mapEntry Mover))) (move (from (mapEntry Mover)) (to (\"HomeMover\")) count:7 (then (remember Value \"Playable\" (last To))))))) (nextPhase (all Passed) \"Sowing\"))})) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"NextHoleFrom\" (\"NextSiteOnTrack\" 1 from:#1)) (define \"HaveHolesWithMoreThanOneCounter\" (not (all Sites (forEach (sites Mover \"Home\") if:(< 1 (count at:(site)))) if:(= 0 (count at:(site)))))) (define \"NoPiece\" (all Sites (sites Player \"Home\") if:(= 0 (count at:(site))))) (define \"Columns\" 10) (game \"Msuwa wa Kunja\" (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))) (piece \"Seed\" Shared)}) (rules (start (set Count 2 to:(union (sites Top) (sites Bottom)))) (play (if (and (\"SameTurn\") (< 0 (var))) (move Remove (forEach (sites Next \"Home\") if:(< 0 (count at:(site)))) (then (and (if (> (var) 1) (moveAgain)) (set Var (- (var) 1))))) (if (\"HaveHolesWithMoreThanOneCounter\") (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(< 1 (count at:(from)))) (then (sow \"Track\" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover \"Inner\")) (if (< 0 (count at:(\"OppositePit\" (to)))) (and (remove (\"OppositePit\" (to))) (if (< 0 (count at:(\"OppositeOuterPit\" (to)))) (and { (remove (\"OppositeOuterPit\" (to))) (set Var 2) (moveAgain)}))))))))) (move Select (from (sites Mover \"Home\") if:(and (= 1 (count at:(from))) (= 0 (count at:(\"NextHoleFrom\" (from)))))) (then (sow \"Track\" owner:(mover) apply: (if (is In (to) (sites Mover \"Inner\")) (if (< 0 (count at:(\"OppositePit\" (to)))) (and (remove (\"OppositePit\" (to))) (if (< 0 (count at:(\"OppositeOuterPit\" (to)))) (and { (remove (\"OppositeOuterPit\" (to))) (set Var 2) (moveAgain)}))))))))))) (end (forEach NonMover if:(\"NoPiece\") (result Player Loss)))))\n\n###\n\n", "completion": "4x10-20 holes, with even numbers. Two counters in each hole in the outer row. 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 lands in an empty hole in the inner row, the counters in the opposite hole in the opponent's inner row are captured. If counters are captured from the inner row, and there are also counters in the outer row, the counters in the outer row are also captured. If counters in the inner and outer row are captured, the player may also capture counters from two other holes on the opponent's side of the board. Single counters cannot be sown until there are no holes with multiple counters on the player's side of the board, and then single counters may only be sown into empty holes. Play continues until one player captures all of their opponent's counters, thus winning the game.\n Each row has 10 holes. 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 Ludii game based on the following description\nDROP - A player, on his turn, can drop a stone on an empty cell.\n SHIFT - Instead of dropping a stone, the player may decide to shift one row or column, one cell left/right (for rows) or up/down (for columns). \n All stones are shifted on the chosen direction. If a stone is shifted off-board, it is placed on the other end of the shifted row/column (so, for shift purposes, the board is a Torus).\n KO rule- If a player has just shifted, the next player cannot shift that row/column.\n \n GOAL - A player wins when he makes a 5 in-a-row (orthogonal or diagonal). If a shift give both players a 5 in-a-row, wins the player that made that shift. \n\n###\n\n", "completion": "(define \"IsLine\" (not (all Sites (sites Occupied by:#1) if:(not (is Line 5 through:(site)))))) (define \"ShiftDown\" (move Select (from (forEach (sites Row (- (count Rows) 1)) if:(not (all Sites (sites Column (column of:(site))) if:(is Empty (site)))))) (to (ahead (from) S) if:(not (is In (+ (from) (to)) (sites Pending)))) (then (and { (forEach Site (sites Column (column of:(last From))) (remove (site))) (forEach Site (sites Column (column of:(last From))) (if (!= (ahead (site) S) (site)) (add (piece (what at:(site))) (to (ahead (site) S))) (add (piece (what at:(site))) (to (coord row:(- (count Rows) 1) column:(column of:(last From))))))) (set Pending (+ (last From) (last To))) (set Pending (+ (coord row:(- (count Rows) 1) column:0) (ahead (coord row:(- (count Rows) 1) column:0) N)))})))) (define \"ShiftUp\" (move Select (from (forEach (sites Row 0) if:(not (all Sites (sites Column (column of:(site))) if:(is Empty (site)))))) (to (ahead (from) N) if:(not (is In (+ (from) (to)) (sites Pending)))) (then (and { (forEach Site (sites Column (column of:(last From))) (remove (site))) (forEach Site (sites Column (column of:(last From))) (if (!= (ahead (site) N) (site)) (add (piece (what at:(site))) (to (ahead (site) N))) (add (piece (what at:(site))) (to (coord row:0 column:(column of:(last From))))))) (set Pending (+ (last From) (last To))) (set Pending (+ (coord row:(- (count Rows) 1) column:(column of:(last To))) (ahead (coord row:(- (count Rows) 1) column:(column of:(last To))) S)))})))) (define \"ShiftRight\" (move Select (from (forEach (sites Column 0) if:(not (all Sites (sites Row (row of:(site))) if:(is Empty (site)))))) (to (ahead (from) E) if:(not (is In (+ (from) (to)) (sites Pending)))) (then (and { (forEach Site (sites Row (row of:(last From))) (remove (site))) (forEach Site (sites Row (row of:(last From))) (if (!= (ahead (site) E) (site)) (add (piece (what at:(site))) (to (ahead (site) E))) (add (piece (what at:(site))) (to (coord row:(row of:(last From)) column:0))))) (set Pending (+ (last From) (last To))) (set Pending (+ (coord row:(row of:(last From)) column:(- (count Columns) 1)) (ahead (coord row:(row of:(last From)) column:(- (count Columns) 1)) W)))})))) (define \"ShiftLeft\" (move Select (from (forEach (sites Column (- (count Columns) 1)) if:(not (all Sites (sites Row (row of:(site))) if:(is Empty (site)))))) (to (ahead (from) W) if:(not (is In (+ (from) (to)) (sites Pending)))) (then (and { (forEach Site (sites Row (row of:(last From))) (remove (site))) (forEach Site (sites Row (row of:(last From))) (if (!= (ahead (site) W) (site)) (add (piece (what at:(site))) (to (ahead (site) W))) (add (piece (what at:(site))) (to (coord row:(row of:(last From)) column:(- (count Columns) 1)))))) (set Pending (+ (last From) (last To))) (set Pending (+ (coord row:(row of:(last From)) column:0) (ahead (coord row:(row of:(last From)) column:0) E)))})))) (game \"Kassle\" (players 2) (equipment { (board (square 5)) (piece \"Square\" Each)}) (rules (play (or { (move Add (to (sites Empty))) (\"ShiftLeft\") (\"ShiftRight\") (\"ShiftUp\") (\"ShiftDown\")})) (end { (if (and (\"IsLine\" P1) (\"IsLine\" P2)) (result Mover Win)) (if (\"IsLine\" P1) (result P1 Win)) (if (\"IsLine\" P2) (result P2 Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nDefinitions\n Group: Either a single stone (a group of one) or any number of stones of the same color connected through a continuous series of orthogonal adjacencies.\n \n Rules\n Scaffold is a drawless connection game played on the intersections of a square grid using stones (as in Go). Black is trying to connect N-S edges of the board, White E-W with an orthogonally connected group.\n \n First player places a single black stone on any grid intersection, after which the second player decides which color they will play (pie rule). Players then alternate taking turns.\n \n On your turn, place a stone of your color on an empty point. Then, if possible, place a stone of your color on an empty point that is orthogonally adjacent to two groups of your color, and keep making such placements until no more are possible. A 12x12 board is currently selected\n\n###\n\n", "completion": "(define \"Connect\" (do (move Add (to (sites Around (sites Occupied by:Mover) Empty) (apply (set Var \"NumberOfFriendlyGroupsBeforePlacement\" (count Groups Orthogonal if:(is Mover (who at:(to)))))))) ifAfterwards:(< (count Groups Orthogonal if:(is Mover (who at:(to)))) (var \"NumberOfFriendlyGroupsBeforePlacement\")))) (game \"Scaffold\" (players 2) (equipment { (board (square 12) use:Vertex) (piece \"Marker\" Each) (regions P1 {(sites Side N) (sites Side S)}) (regions P2 {(sites Side W) (sites Side E)})}) (rules (meta (swap)) (play (if (< 0 (count MovesThisTurn)) (\"Connect\") (move Add (to (sites Empty))) (then (if (can Move (\"Connect\")) (moveAgain))))) (end (if (is Connected Orthogonal Mover) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n9x9 board played on the intersections, with diagonals for each 3x3 square. 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 \"Ratti-Chitti-Bakri\" (players 2) (equipment { (\"AlquerqueBoard\" 9 9) (piece \"Marker\" Each (or (\"HopCapture\") (\"StepToEmpty\")))}) (rules (\"BeforeAfterCentreSetup\" \"Marker1\" \"Marker2\") (play (forEach Piece)) (end (\"ForEachPlayerNoPiecesLoss\")))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nOrder 3 board -> Order 5 board\nHex N+1 / N-1 Grid -> Square Grid 2N-2: Capture-compare all 8 adjacent directions. Scoring - groups connect only in the 4 edge-edge directions.\n3 players -> 4 players\n(define \"ColourBackground\" (colour 136 175 96)) (define \"SquareDiagonal\" (board (square (- (* 2 3) 2)) use:Vertex)) (define \"SquareGrid\" (board (square 3) use:Cell)) (define \"TriSquare\" (board (tiling T33434 (- 3 2)) use:Vertex)) (define \"HexCell\" (board (hex Hexagon 3) use:Cell)) (define \"Hex2Limp\" (board (hex (- 3 1) (+ 3 1)) use:Cell)) (define \"HexLimp\" (board (hex Limping (- 3 1)) use:Cell)) (define \"BoardUsed\" \"Hex2Limp\") (define \"ConnectionDirection\" Orthogonal) (define \"ScoreConnection\" Orthogonal) (define \"Anemone\" (or { (move Pass) (move Claim (to (sites Empty))) (forEach Site (difference (difference (sites Board) (sites Empty)) (sites Occupied by:Mover)) (if (\"LessQtyAroundSiteThanAnother\" (who at:(site))) (move Remove (site) (then (claim (to (last To)))))))} (then (\"Scoring\" (\"StoneCount\" (player)))))) (define \"LessQtyAroundSiteThanAnother\" (> (max 0 (count Pieces of:#1 in:(sites Around (site) \"ConnectionDirection\"))) (max 0 (count Pieces of:(mover) in:(sites Around (site) \"ConnectionDirection\"))))) (define \"StoneCount\" (count Sites in:(sites Occupied by:Player))) (define \"GroupCount\" (max 0 (max (sizes Group \"ScoreConnection\" of:#1)))) (define \"Tied4FirstPlace\" (= (#1) (max (difference (values Remembered \"Scores\") #1)))) (define \"LargerGroup\" (max 0 (max (difference (sizes Group \"ScoreConnection\" of:#1) (sizes Group \"ScoreConnection\" of:#2))))) (define \"CascadeLoses\" (max 0 (- (\"LargerGroup\" (value) (player)) (\"LargerGroup\" (player) (value))))) (define \"CascadeWins\" (max 0 (- (\"LargerGroup\" (player) (value)) (\"LargerGroup\" (value) (player))))) (define \"Scoring\" (if (all Passed) (do (forEach Player (remember Value \"Scores\" #1)) next:(do (forEach Player (if (\"Tied4FirstPlace\" #1) (and (remember Value \"Tied\" (player)) (set Score Player #1)) (set Score Player #1))) next:(do (forEach Value (values Remembered \"Tied\") (forEach (players All if:(is In (player) (values Remembered \"Tied\"))) (addScore (player (player)) (\"CascadeLoses\")))) next:(forget Value \"Scores\" All (then (forget Value \"Tied\" All)))))) (forEach Player (set Score Player #1)))) (game \"Windflowers\" (players 3) (equipment { \"BoardUsed\" (piece \"Ball\" Each)}) (rules (start (set Score Each 0)) (play \"Anemone\") (end (if (all Passed) (byScore)))))\n\n###\n\n", "completion": "(define \"ColourBackground\" (colour 136 175 96)) (define \"SquareDiagonal\" (board (square (- (* 2 5) 2)) use:Vertex)) (define \"SquareGrid\" (board (square 5) use:Cell)) (define \"TriSquare\" (board (tiling T33434 (- 5 2)) use:Vertex)) (define \"HexCell\" (board (hex Hexagon 5) use:Cell)) (define \"Hex2Limp\" (board (hex (- 5 1) (+ 5 1)) use:Cell)) (define \"HexLimp\" (board (hex Limping (- 5 1)) use:Cell)) (define \"BoardUsed\" \"SquareDiagonal\") (define \"ConnectionDirection\" All) (define \"ScoreConnection\" Orthogonal) (define \"Anemone\" (or { (move Pass) (move Claim (to (sites Empty))) (forEach Site (difference (difference (sites Board) (sites Empty)) (sites Occupied by:Mover)) (if (\"LessQtyAroundSiteThanAnother\" (who at:(site))) (move Remove (site) (then (claim (to (last To)))))))} (then (\"Scoring\" (\"StoneCount\" (player)))))) (define \"LessQtyAroundSiteThanAnother\" (> (max 0 (count Pieces of:#1 in:(sites Around (site) \"ConnectionDirection\"))) (max 0 (count Pieces of:(mover) in:(sites Around (site) \"ConnectionDirection\"))))) (define \"StoneCount\" (count Sites in:(sites Occupied by:Player))) (define \"GroupCount\" (max 0 (max (sizes Group \"ScoreConnection\" of:#1)))) (define \"Tied4FirstPlace\" (= (#1) (max (difference (values Remembered \"Scores\") #1)))) (define \"LargerGroup\" (max 0 (max (difference (sizes Group \"ScoreConnection\" of:#1) (sizes Group \"ScoreConnection\" of:#2))))) (define \"CascadeLoses\" (max 0 (- (\"LargerGroup\" (value) (player)) (\"LargerGroup\" (player) (value))))) (define \"CascadeWins\" (max 0 (- (\"LargerGroup\" (player) (value)) (\"LargerGroup\" (value) (player))))) (define \"Scoring\" (if (all Passed) (do (forEach Player (remember Value \"Scores\" #1)) next:(do (forEach Player (if (\"Tied4FirstPlace\" #1) (and (remember Value \"Tied\" (player)) (set Score Player #1)) (set Score Player #1))) next:(do (forEach Value (values Remembered \"Tied\") (forEach (players All if:(is In (player) (values Remembered \"Tied\"))) (addScore (player (player)) (\"CascadeLoses\")))) next:(forget Value \"Scores\" All (then (forget Value \"Tied\" All)))))) (forEach Player (set Score Player #1)))) (game \"Windflowers\" (players 4) (equipment { \"BoardUsed\" (piece \"Ball\" Each)}) (rules (start (set Score Each 0)) (play \"Anemone\") (end (if (all Passed) (byScore))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nOne player plays with one piece \\ The coyote can jump to capture.\n\n###\n\n", "completion": "(game \"Coyote\" (players 2) (equipment { (board (rectangle 5 5 diagonals:Radiating) use:Vertex) (piece \"Sheep\" P1 (\"StepToEmpty\")) (piece \"Coyote\" P2 (or (\"HopCapture\") (if (\"SameTurn\") (move Pass) (\"StepToEmpty\"))))}) (rules (start { (place \"Sheep1\" (union (expand (sites Bottom)) (sites {\"A3\" \"E3\"}))) (place \"Coyote2\" (centrePoint))}) (play (forEach Piece)) (end (\"NoMovesLossAndLessNumPiecesPlayerLoss\" P1 9)))) END" }, { "prompt": "Construct a Ludii game based on the following description\n4x12-20 board. Play begins with a number of counters that is three times the number of holes in a row minus two for a game with an even number of holes in a row; three times the number of holes minus one for odd. Counters are distributed beginning in the leftmost hole in the outer row, placing two counters in each hole in an anti-clockwise direction. 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 player has 12 holes.\n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (define \"MoveAgainAfterCapture\" (is Pending)) (define \"PlayFromNextHole\" (sites {(value Pending)})) (define \"NextHole\" (if (is Mover P1) (\"NextSiteOnTrack\" 1 from:(to) \"Track1\") (\"NextSiteOnTrack\" 1 from:(to) \"Track2\"))) (define \"Columns\" 12) (game \"Owela (Benguela)\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"0,E,N1,W\" loop:True P1) (track \"Track2\" \"24,E,N1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"Track1\")) (regions \"Home\" P2 (sites Track \"Track2\")) (regions \"Inner\" P1 (difference (sites Track \"Track1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"Track2\") (sites Top))) (regions \"Outer\" P1 (sites Bottom)) (regions \"Outer\" P2 (sites Top)) (regions \"InnerInit\" P1 (sites {19..23})) (regions \"InnerInit\" P2 (sites {24..28})) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 2 to:(union {(sites P1 \"Outer\") (sites P1 \"InnerInit\") (sites P2 \"Outer\") (sites P2 \"InnerInit\")}))) (play (move Select (from (if (\"SameTurn\") (if \"MoveAgainAfterCapture\" \"PlayFromNextHole\" \"LastHoleSowed\") (sites Mover \"Home\")) if:(> (count at:(from)) 1)) (then (sow \"Track\" owner:(mover) apply:(if (> (count at:(to)) 1) (if (and (is In (to) (sites Mover \"Inner\")) (> (count at:(\"OppositePit\" (to))) 0)) (and { (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))) (fromTo (from (\"OppositePit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePit\" (to)))) (if (> (count at:(\"OppositeOuterPit\" (to))) 0) (fromTo (from (\"OppositeOuterPit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositeOuterPit\" (to))))) (if (> (count at:\"NextHole\") 1) (and (set Pending \"NextHole\") (moveAgain)))}) (moveAgain))))))) (end (\"MancalaByScoreWhen\" (no Moves Mover))))) END" }, { "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": "Modify the Ludii game according to the following option changes:\nThe rules of the game II. -> The rules of the game III.\n(game \"Ratio\" (players {(player S) (player N)}) (equipment { (board (add (remove (merge { (rectangle 3 3 diagonals:Alternating) (shift 0 2 (wedge 2)) (shift 0 -1 (rotate 180 (wedge 2)))}) vertices:{3 5}) edges:{{0 4} {2 6}}) use:Vertex) (piece \"Foot\" P1 (move Step Adjacent (to if:(is Empty (to))))) (piece \"Gnome\" P2 (move Step (directions {Forwards Rightward Leftward}) (to if:(is Empty (to))))) (hand P1) (regions \"Home\" P2 (intersection (sites Outer) (expand (sites Bottom)))) (regions \"Home\" P1 (sites Top))}) (rules (start { (place \"Gnome2\" (intersection (sites Outer) (expand (sites Bottom)))) (place \"Foot1\" (handSite P1))}) phases:{ (phase \"Opening\" (play (move (from (handSite Mover)) (to (difference (sites Board) (intersection (sites Outer) (expand (sites Bottom))))) (then (moveAgain)))) (nextPhase \"Main\")) (phase \"Main\" (play (forEach Piece)))} (end { (if (no Moves P1) (result P2 Win)) (if (is In (where \"Foot\" P1) (sites P2)) (result P1 Win))})))\n\n###\n\n", "completion": "(game \"Ratio\" (players {(player S) (player N)}) (equipment { (board (add (remove (merge { (rectangle 3 3 diagonals:Alternating) (shift 0 2 (wedge 2)) (shift 0 -1 (rotate 180 (wedge 2)))}) vertices:{1}) edges:{{0 1} {3 9}}) use:Vertex) (piece \"Foot\" P1 (move Step Adjacent (to if:(is Empty (to))))) (piece \"Gnome\" P2 (move Step (directions {Forwards Rightward Leftward}) (to if:(is Empty (to))))) (hand P1) (regions \"Home\" P2 (intersection (sites Outer) (expand (sites Bottom)))) (regions \"Home\" P1 (sites Top))}) (rules (start { (place \"Gnome2\" (intersection (sites Outer) (expand (sites Bottom)))) (place \"Foot1\" (handSite P1))}) phases:{ (phase \"Opening\" (play (move (from (handSite Mover)) (to (difference (sites Board) (intersection (sites Outer) (expand (sites Bottom))))) (then (moveAgain)))) (nextPhase \"Main\")) (phase \"Main\" (play (forEach Piece)))} (end { (if (no Moves P1) (result P2 Win)) (if (is In (where \"Foot\" P1) (sites P2)) (result P1 Win))}))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nBoard: Muster order 2 board - 20 positions -> Board: Muster order 4 board - 80 positions\n(define \"Order6\" (poly { { 1 8} { 2 7} { 14 1} { 15 2} { 21 14} { 20 15} { 8 21} { 7 20}})) (define \"Order5\" (poly { { 1 7} { 2 6} { 12 1} { 13 2} { 18 12} { 17 13} { 7 18} { 6 17}})) (define \"Order4\" (poly { { 1 6} { 2 5} { 10 1} { 11 2} { 15 10} { 14 11} { 6 15} { 5 14}})) (define \"Order3\" (poly { { 1 5} { 2 4} { 8 1} { 9 2} { 12 8} { 11 9} { 5 12} { 4 11}})) (define \"Order2\" (poly { { 1 4} { 2 3} { 6 1} { 7 2} { 9 6} { 8 7} { 4 9} { 3 8}})) (define \"NoPlacementAvailable\" (all Sites (sites Empty) if:(not (no Pieces Mover in:(sites Around (site) All))))) (game \"Make Muster\" (players 2) (equipment { (board (rotate (- 90 62) (square \"Order2\")) use:Cell) (piece \"Disc\" Each (\"StepToEmpty\"))}) (rules (play (priority (move Add (to (sites Empty) if:(no Pieces Mover in:(sites Around (to) Adjacent)))) (forEach Piece))) (end (if (or (and { (\"IsSingleGroup\" Mover All) (< 1 (count Pieces Mover))}) (< 1 (count Groups All if:(!= (mover) (who at:(to)))))) (result Mover Win)))))\n\n###\n\n", "completion": "(define \"Order6\" (poly { { 1 8} { 2 7} { 14 1} { 15 2} { 21 14} { 20 15} { 8 21} { 7 20}})) (define \"Order5\" (poly { { 1 7} { 2 6} { 12 1} { 13 2} { 18 12} { 17 13} { 7 18} { 6 17}})) (define \"Order4\" (poly { { 1 6} { 2 5} { 10 1} { 11 2} { 15 10} { 14 11} { 6 15} { 5 14}})) (define \"Order3\" (poly { { 1 5} { 2 4} { 8 1} { 9 2} { 12 8} { 11 9} { 5 12} { 4 11}})) (define \"Order2\" (poly { { 1 4} { 2 3} { 6 1} { 7 2} { 9 6} { 8 7} { 4 9} { 3 8}})) (define \"NoPlacementAvailable\" (all Sites (sites Empty) if:(not (no Pieces Mover in:(sites Around (site) All))))) (game \"Make Muster\" (players 2) (equipment { (board (rotate (- 90 62) (square \"Order4\")) use:Cell) (piece \"Disc\" Each (\"StepToEmpty\"))}) (rules (play (priority (move Add (to (sites Empty) if:(no Pieces Mover in:(sites Around (to) Adjacent)))) (forEach Piece))) (end (if (or (and { (\"IsSingleGroup\" Mover All) (< 1 (count Pieces Mover))}) (< 1 (count Groups All if:(!= (mover) (who at:(to)))))) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n28 squares arranged in a cross-shaped board. Diagonals are drawn in each 2x2 square. Pieces are played on the lines of the board. One player plays as a single fox, placed on the center of the third line from the top of one arm of the cross. The other player plays as eighteen geese, placed on the points on the opposite arm of the cross and the first horizontal line of the horizontal arms of the cross. Players alternate turns moving a piece to an empty adjacent spot along the lines of the board. The geese may not move backward. The fox may capture a goose by hopping over it to an empty spot immediately on the opposite side of the goose along the lines of the board. The geese win by blocking the fox from being able to move. The fox wins by capturing all the geese.\n \n\n###\n\n", "completion": "(game \"Gasetavl (Gedved)\" (players 2) (equipment { (\"CrossBoard\" 3 9 use:Vertex diagonals:Alternating) (piece \"Fox\" P1 (or (\"HopCapture\") (\"StepToEmpty\"))) (piece \"Geese\" P2 N (\"StepToEmpty\" (directions {Rightward Forwards Leftward})))}) (rules (start { (place \"Fox1\" coord:\"E7\") (place \"Geese2\" (sites {\"D1\" \"E1\" \"F1\" \"D2\" \"E2\" \"F2\" \"D3\" \"E3\" \"F3\" \"A4\" \"B4\" \"C4\" \"D4\" \"E4\" \"F4\" \"G4\" \"H4\" \"I4\"}))}) (play (forEach Piece)) (end (\"NoMovesP1NoPiecesP2\")))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"OneRowIsEmpty\" (or (all Sites (sites P1) if:(= 0 (count at:(site)))) (all Sites (sites P2) if:(= 0 (count at:(site)))))) (define \"PiecesOwnedBy\" (count Cell at:(handSite #1))) (define \"Columns\" 6) (game \"Mangala (Bedouin)\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" store:None (track \"Track\" \"5,W,N,E\" loop:True)) (piece \"Seed\" Shared) (hand Each) (hand Shared) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map \"FourthHole\" {(pair P1 3) (pair P2 8)})}) (rules (start (place \"Seed\" (handSite Shared) count:17)) phases:{ (phase \"OpeningP1\" (play (move (from (handSite Shared)) (to (sites Centre)) (then (if (is Occupied (handSite Shared)) (moveAgain))))) (nextPhase (is Empty (handSite Shared)) \"OpeningP2\")) (phase \"OpeningP2\" (play (or (move Pass) (if (is Mover P2) (move Pass (then (and { (remove (sites Centre)) (add (piece (id \"Seed\" Shared)) (to 9) count:(count at:2)) (add (piece (id \"Seed\" Shared)) (to 2) count:(count at:9)) (add (piece (id \"Seed\" Shared)) (to 8) count:(count at:3)) (add (piece (id \"Seed\" Shared)) (to 3) count:(count at:8))})))))) (nextPhase (all Passed) \"SowingRestricted\")) (phase \"SowingRestricted\" (play (move Select (from (mapEntry Mover) if:(is Occupied (from))) (then (sow)))) (nextPhase Mover \"Sowing\")) (phase \"Sowing\" (play (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover)) if:(> (count at:(from)) 0)) (then (sow apply:(if (< 10 (count at:(to))) (moveAgain) (if (is Even (count at:(to))) (if (is Even (count at:(\"OppositePit\" (to)))) (and (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))) (fromTo (from (\"OppositePit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePit\" (to))))) (moveAgain)))))))) (end (\"MancalaByScoreWhen\" (\"OneRowIsEmpty\"))))}))\n\n###\n\n", "completion": "2x6 board. Seventy counters. One player distributes the counters unevenly in the central four holes (central two holes of each row). The opponent then has the option to flip the board around if they are not satisfied with the distribution. Opponent begins play. The first move must be from the fourth hole in the row. Sowing occurs in a clockwise direction. Capturing cannot happen on the first move. If the last counter is dropped into a hole, creating an odd number of counters in it, play ends. If the number is now even and the hole in the other player's row also has an even number, the contents of both holes are captured. If the final hole is now even but the other player's row does not have an even number of counters, the counters are picked up and a new sowing begins. If the final hole has more than ten counters it cannot be captured and sowing must continue from this hole whether the number is even or odd. Play ends when a player has no more counters on their side of the board. The player who has captured the greatest number of counters wins. END" }, { "prompt": "Construct a Ludii game based on the following description\nLike Go, Cavity is played on the points of a square grid, and groups (chains, more precisely) and liberties are defined the same way. \n An empty region is a group (chain) of empty points, and it is said to be adjacent to a stone if any of its points are.\n \n Setup: \n Starting with Black, place one stone each on any empty point. \n The setup is over as soon as the players have one stone each on the board.\n \n Play: \n On your turn, place a stone of your color on any point in an empty region that's adjacent to a stone of your color.\n After placement, first remove all enemy groups that have no liberties, then remove all friendly groups that have no liberties.\n In this phase, as soon as one player is the only one with stones on the board, the game is over and that player is the winner.\n \n The game is balanced with the pie rule. The game is played on an 11x11 board\n\n###\n\n", "completion": "(define \"ReachesRegion\" (> Infinity (count Steps Orthogonal (step (to if:(or (is Empty (to)) (is In (to) #2)))) #1 #2))) (define \"CaptureSurroundedGroup\" (enclose (from (last To)) Orthogonal (between if:(is #1 (who at:(between))) (apply (remove (between)))) #2)) (game \"Cavity\" (players 2) (equipment { (board (square 11) use:Vertex) (piece \"Marker\" Each)}) (rules (meta (swap)) phases:{ (phase \"Opening\" (play (move Add (to (sites Empty)))) (nextPhase (and (= 1 (count Sites in:(sites Occupied by:P1))) (= 1 (count Sites in:(sites Occupied by:P2)))) \"Play\")) (phase \"Play\" (play (move Add (to (sites Empty) if:(\"ReachesRegion\" (to) (sites Occupied by:Mover))) (then (if (can Move (\"CaptureSurroundedGroup\" Enemy)) (\"CaptureSurroundedGroup\" Enemy) (\"CaptureSurroundedGroup\" Mover))))))} (end (forEach Player if:(and (< 2 (count Moves)) (no Pieces Player)) (result Player Loss))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nA size 4 board is currently selected -> A size 6 board is currently selected\n(define \"Remove\" (move Select (from (sites Occupied by:Enemy)) (then (forEach Site (sites Group at:(last From) Orthogonal) (remove (site)))))) (define \"Place\" (move Add (to (sites Around (sites Occupied by:Mover) Empty Orthogonal)))) (game \"Gygoreg\" (players 2) (equipment { (board (square Diamond 4)) (piece \"Disc\" Each)}) (rules (start { (place \"Disc1\" (forEach (sites Phase 0) if:(is Odd (site)))) (place \"Disc2\" (forEach (sites Phase 0) if:(is Even (site))))}) (play (or (\"Place\") (\"Remove\"))) (end { (\"SingleGroupWin\" P1 Orthogonal) (\"SingleGroupWin\" P2 Orthogonal)})))\n\n###\n\n", "completion": "(define \"Remove\" (move Select (from (sites Occupied by:Enemy)) (then (forEach Site (sites Group at:(last From) Orthogonal) (remove (site)))))) (define \"Place\" (move Add (to (sites Around (sites Occupied by:Mover) Empty Orthogonal)))) (game \"Gygoreg\" (players 2) (equipment { (board (square Diamond 6)) (piece \"Disc\" Each)}) (rules (start { (place \"Disc1\" (forEach (sites Phase 0) if:(is Odd (site)))) (place \"Disc2\" (forEach (sites Phase 0) if:(is Even (site))))}) (play (or (\"Place\") (\"Remove\"))) (end { (\"SingleGroupWin\" P1 Orthogonal) (\"SingleGroupWin\" P2 Orthogonal)}))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"MoveOppositeDice\" (forEach Value (values Remembered \"Opposite\") (if (\"IsOffBoard\" (\"NextSiteFrom\" (from) (value))) (move Remove (from)) (move (from (from)) (to (\"NextSiteFrom\" (from) (value)) if:(\"NoEnemyOrOnlyOne\" (to)) (apply (and (if (\"IsEnemyAt\" (to)) (fromTo (from (to)) (to (handSite Next)))) (forget Value \"Opposite\" (value)))))) (then (if (!= 0 (size Array (values Remembered \"Opposite\"))) (moveAgain) (and { (set Var \"PlayOpposite\" 0) (set Pending) (moveAgain)})))))) (define \"DoubleDieValue\" (face 28)) (define \"NextSiteFrom\" (\"NextSiteOnTrack\" #2 from:#1)) (game \"Lange Puff\" (players 2) (equipment { (\"BackgammonBoard\" \"BackgammonTracksSameDirectionWithHands\") (dice d:6 num:2) (piece \"Disc\" Each (forEach Die replayDouble:(= 1 (value Player Mover)) if:(\"DieNotUsed\") (if (\"IsOffBoard\" (\"NextSiteFrom\" (from) (pips))) (move Remove (from)) (move (from (from)) (to (\"NextSiteFrom\" (from) (pips)) if:(\"NoEnemyOrOnlyOne\" (to)) (\"HittingCapture\" (handSite Next))))) (then (if (not (all DiceUsed)) (moveAgain) (if (= 1 (value Player Mover)) (if (and (all DiceEqual) (= 0 (size Array (values Remembered)))) (and (moveAgain) (set Var \"PlayOpposite\" 1))) (set Value Mover 1)))))) (hand Each)}) (rules (start { (place Stack \"Disc1\" (handSite P1) count:15) (place Stack \"Disc2\" (handSite P2) count:15)}) (play (do (if (or (is Pending) (\"NewTurn\")) (roll)) next:(if (= 1 (var \"PlayOpposite\")) (or { (forEach Piece (\"MoveOppositeDice\") top:True) (forEach Piece container:(mover) (\"MoveOppositeDice\") top:True) (move Pass (then (and { (forget Value \"Opposite\" All) (set Var \"PlayOpposite\" 0) (set Pending) (moveAgain)})))}) (do (if (and { (= 0 (count MovesThisTurn)) (all DiceEqual) (= 1 (value Player Mover))}) (and (remember Value \"Opposite\" (- 7 (\"DoubleDieValue\"))) (remember Value \"Opposite\" (- 7 (\"DoubleDieValue\"))))) next:(or (forEach Piece top:True) (forEach Piece container:(mover) top:True)))))) (end (\"EscapeWin\"))))\n\n###\n\n", "completion": "2x12 board, with spaces as points, divided in two. Fifteen pieces per player. Two six-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. The lowest value of the dice must be played; if it cannot, the player does not move. When a player throws doubles, they play the values on each die, as well as the values on the opposite side of the dice (I.e., double 6 if double 1 is thrown, 5 if 2, 3 if 4). However, the values on the bottom can only be played if all of the top values are played. The first double throw is only played once, but every subsequent double throw is played twice, and the top values must be played twice before using the bottom values. Bottom values do not have to be played, or only some of the bottom values may be played if the player wishes. In addition, an extra throw is granted for the second and subsequent throws of doubles. Players enter their pieces onto the same section of the board, and proceed around the board to the point opposite the starting point, and then off the board. A player may not land on a point with two or more of the opponent's pieces. A player's piece may land on a point with a single opponent's piece. The opponent's piece is removed from the board and must enter again. The first player to remove all of their pieces from the board wins. END" }, { "prompt": "Construct a Ludii game based on the following description\nFour 3x8 rectangles, arranged in a cross. No marked squares. Four players, each with four pieces, which are black, yellow, green, and red. Yellow seated at the bottom, red to their right, black to the right of red, green to the right of black. Green and red play on a team against black and yellow. Three four-sided rectangular dice, each marked 1, 2, 5, and 6. Pieces begin on the board, with one each in the sixth and seventh space of the central row of the player's arm, (counting from the top of the row), and in the seventh and eighth spaces of the left row of the arm belonging to the player to the right. The latter two pieces must move as a pair, I.e., they must always be moved together, and can only do so when doubles are thrown. The other two pieces belonging to a player may move singly. Throws may be split up as a player sees fit, but the value of one die must be used it its entirety by a piece. Pieces move around the board in an anti-clockwise direction until they reach their central row, at which point they move up the central row to the central spot. They must enter the central space by an exact throw. When a player moves all of their pieces to the center, they continue to throw the dice, and use these throws to move their partner's pieces. When all of the team's pieces reach the center, that team wins. \n\n###\n\n", "completion": "(define \"Move\" (if (\"AllPiecesOnCentre\" Mover) (if (is Mover P1) (forEach Piece (\"PieceMove\" \"TrackNormal3\" \"TrackPaired3\") P3) (if (is Mover P3) (forEach Piece (\"PieceMove\" \"TrackNormal1\" \"TrackPaired1\") P1) (if (is Mover P4) (forEach Piece (\"PieceMove\" \"TrackNormal2\" \"TrackPaired2\") P2) (forEach Piece (\"PieceMove\" \"TrackNormal4\" \"TrackPaired4\") P4)))) (forEach Piece))) (define \"PieceMove\" (forEach Die if:(\"DieNotUsed\") (move (from (from) level:(level) if:(!= 0 (what at:(from) level:(level)))) (to (if (= 0 (state at:(from) level:(level))) (\"TrackMove\" from:(from) #1 (pips)) (\"TrackMove\" from:(from) #2 (pips))) if:(if (= 0 (state at:(from) level:(level))) (if (not (\"MovedPair\")) True (or \"Triple\" (= (pips) (\"NotDoubleValue\")))) (and { (not (\"MovedPair\")) (\"HasDouble\") (= (pips) (\"DoubleValue\")) (< (count MovesThisTurn) 2) (if (= (count MovesThisTurn) 0) True (or (\"Triple\") (!= (\"PreviousPipsUsed\") (\"DoubleValue\"))))})) (apply (and (if (= 1 (state at:(from))) (forEach Site (sites Occupied by:Mover top:False) (forEach Level (site) (if (and { (= 1 (state at:(site) level:(level))) (!= (from) (site)) (= (mover) (who at:(site) level:(level)))}) (fromTo (from (site) level:(level)) (to (\"TrackMove\" from:(site) #2 (pips)))))))) (\"StorePreviousPipsUsed\" (pips))))) (then (if (and (not (\"MovedPair\")) (if (= 1 (state at:(last To) level:(last LevelTo))) (< (count MovesThisTurn) 1) (< (count MovesThisTurn) 2))) (and (moveAgain) (if (= 1 (state at:(last To) level:(last LevelTo))) (\"StoreMovePair\" 1))) (and (\"StoreMovePair\" 0) (\"StorePreviousPipsUsed\" 0))))))) (define \"MovedPair\" (= 1 (var \"MovePair\"))) (define \"StoreMovePair\" (set Var \"MovePair\" #1)) (define \"PreviousPipsUsed\" (var \"Pips\")) (define \"StorePreviousPipsUsed\" (set Var \"Pips\" #1)) (define \"TrackMove\" (\"NextSiteOnTrack\" #3 #1 #2)) (define \"AllPiecesOnCentre\" (and (= 1 (count Sites in:(sites Occupied by:#1 top:False))) (is In (centrePoint) (sites Occupied by:#1 top:False)))) (define \"NotDoubleValue\" (if (= (\"Die1\") (\"Die2\")) (\"Die3\") (if (= (\"Die2\") (\"Die3\")) (\"Die1\") (\"Die2\")))) (define \"DoubleValue\" (if (= (\"Die1\") (\"Die2\")) (\"Die1\") (if (= (\"Die2\") (\"Die3\")) (\"Die2\") (\"Die3\")))) (define \"HasDouble\" (or { (= (\"Die1\") (\"Die2\")) (= (\"Die1\") (\"Die3\")) (= (\"Die2\") (\"Die3\"))})) (define \"Die3\" (face 99)) (define \"Die2\" (face 98)) (define \"Die1\" (face 97)) (define \"Triple\" (all DiceEqual)) (game \"Chonpa\" (players 4) (equipment { (\"PachisiBoard\" { (track \"TrackNormal1\" \"64,S,E,N,11,E,N,W,53,N,W,S,42,W,S,E,8,54,E1,N8\" P1 directed:True) (track \"TrackPaired1\" \"57,S,E,N,11,E,N,W,53,N,W,S,42,W,S,E,8,54,E1,N8\" P1 directed:True) (track \"TrackNormal2\" \"22,W,S,E,8,S,E,N,11,E,N,W,53,N,W,S,42,W,S1,E8\" P2 directed:True) (track \"TrackPaired2\" \"36,W,S,E,8,S,E,N,11,E,N,W,53,N,W,S,42,W,S1,E8\" P2 directed:True) (track \"TrackNormal3\" \"85,N,W,S,42,W,S,E,8,S,E,N,11,E,N,W,53,N,W1,S8\" P3 directed:True) (track \"TrackPaired3\" \"92,N,W,S,42,W,S,E,8,S,E,N,11,E,N,W,53,N,W1,S8\" P3 directed:True) (track \"TrackNormal4\" \"31,E,N,W,53,N,W,S,42,W,S,E,8,S,E,N,11,E,N1,W8\" P4 directed:True) (track \"TrackPaired4\" \"17,E,N,W,53,N,W,S,42,W,S,E,8,S,E,N,11,E,N1,W8\" P4 directed:True)}) (dice d:4 faces:{1 2 5 6} num:3) (piece \"Pawn\" Each (\"PieceMove\" \"TrackNormal\" \"TrackPaired\"))}) (rules (start { (set Team 1 {P1 P3}) (set Team 2 {P2 P4}) (place Stack \"Pawn1\" (sites {61 64})) (place Stack \"Pawn2\" (sites {21 22})) (place Stack \"Pawn3\" (sites {85 88})) (place Stack \"Pawn4\" (sites {31 32})) (place Stack \"Pawn1\" (sites {17 18}) state:1) (place Stack \"Pawn2\" (sites {54 57}) state:1) (place Stack \"Pawn3\" (sites {35 36}) state:1) (place Stack \"Pawn4\" (sites {92 95}) state:1)}) (play (\"RollEachNewTurnMove\" (if (can Move (\"Move\")) (\"Move\") (move Pass (then (and (\"StoreMovePair\" 0) (\"StorePreviousPipsUsed\" 0))))))) (end (if (\"AllPiecesOnCentre\" TeamMover) (result TeamMover Win))))) 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\n2x3-7 board. Four counters in each hole. Players sow counters from their side of the board in an anti-clockwise direction. When the final counter of a sowing lands in a hole containing one or two counters, making it now contain two or three, these are captured. Any adjacent holes with two or three counters are also captured. Single counters cannot be sown. When a player only has single counters in holes in their row, they pass. The player who captures the most counters wins. Each row has 3 holes.\n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (count Cell at:(handSite #1))) (game \"I\" (players 2) (equipment { (mancalaBoard 2 3 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 4 to:(sites Track))) (play (move Select (from (sites Mover) if:(> (count at:(from)) 1)) (then (sow apply:(if (or (= 2 (count at:(to))) (= 3 (count at:(to)))) (and { (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))) (if (!= (to) (ahead (to) E)) (if (or (= 2 (count at:(ahead (to) E))) (= 3 (count at:(ahead (to) E)))) (fromTo (from (ahead (to) E)) (to (handSite Mover)) count:(count at:(ahead (to) E))))) (if (!= (to) (ahead (to) W)) (if (or (= 2 (count at:(ahead (to) W))) (= 3 (count at:(ahead (to) W)))) (fromTo (from (ahead (to) W)) (to (handSite Mover)) count:(count at:(ahead (to) W)))))})))))) (end (\"MancalaByScoreWhen\" (and (no Moves P1) (no Moves P2)))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nStarting with Black, the two players take turns placing stones onto unoccupied points on the board, subject to restrictions, one stone per turn.\n Passing is not allowed in Redstone. Players will always have a placement available and must make one.\n \n GROUPS AND LIBERTIES: \n A group is an orthogonally interconnected collection of one or more like-colored stones. \n Only black groups and white groups will be discussed here, not red groups. \n A liberty is an unoccupied point adjacent to a (black or white) group\n \n CAPTURES:\n A capturing placement results in one or more groups, of either or both colors, having no liberties. \n Such a placement can only be made with a red stone. \n Conversely, a red stone can only be placed if it bounds (completely deprives of liberties) one or more groups of either or both colors. Red stones are permanent. They cannot themselves be captured.\n Self capture is allowed.\n \n When multiple groups without liberties result from a placement, all such groups are removed immediately following said placement, regardless of the groups' colors. Unlike Go, if you unbound your own temporarily bounded group by removing a neighboring enemy group, you must still remove your own temporarily bounded group.\n \n PIE RULE:\n Since Redstone is a game of annihilation, not of point score, Go\u2019s komi can\u2019t be used.\n Instead, Redstone uses the pie rule for balance. \n \n OBJECT OF THE GAME:\n You must annihilate your opponent, removing all of his stones from the board. \n If your placement eliminates all black and white stones from the board, you win. \n If your placement eliminates all of your own stones while enemy stones remain on the board, you lose. A size 13 board is currently selected\n\n###\n\n", "completion": "(define \"PlaceNonRed\" (do (move Add (to (sites Empty))) ifAfterwards:(not (or (\"SomeSite\" (sites Around (last To) Enemy Orthogonal) (= 0 (count Liberties at:(site) Orthogonal if:(is Next (who at:(to)))))) (\"SomeSite\" (sites Around (last To) Own Orthogonal includeSelf:True) (= 0 (count Liberties at:(site) Orthogonal if:(is Mover (who at:(to)))))))))) (define \"PlaceRed\" (do (move Add (piece \"Disc0\") (to (sites Empty))) ifAfterwards:(or (\"SomeSite\" (sites Around (last To) Enemy Orthogonal) (= 0 (count Liberties at:(site) Orthogonal if:(is Next (who at:(to)))))) (\"SomeSite\" (sites Around (last To) Own Orthogonal) (= 0 (count Liberties at:(site) Orthogonal if:(is Mover (who at:(to))))))) (then (and (forEach Site (sites Around (last To) Enemy Orthogonal) (if (= 0 (count Liberties at:(site) Orthogonal if:(is Next (who at:(to))))) (remove (sites Group at:(site) Orthogonal if:(is Next (who at:(to))))))) (forEach Site (sites Around (last To) Own Orthogonal) (if (= 0 (count Liberties at:(site) Orthogonal if:(is Mover (who at:(to))))) (remove (sites Group at:(site) Orthogonal if:(is Mover (who at:(to))))))))))) (define \"SomeSite\" (not (all Sites #1 if:(not #2)))) (game \"Redstone\" (players 2) (equipment { (board (square 13) use:Vertex) (piece \"Disc\" Each) (piece \"Disc\" Neutral)}) (rules (meta (swap)) (play (or (\"PlaceRed\") (\"PlaceNonRed\"))) (end { (if (and (> (count Moves) 2) (no Pieces Next)) (result Next Loss)) (if (and {(> (count Moves) 2) (no Pieces Mover) (not (no Pieces Next))}) (result Mover Loss))}))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"Aqrad\" (players 2) (equipment { (board (rectangle 7 6)) (hand Each) (piece \"Marker\" Each (\"StepToEmpty\" Orthogonal (then (\"ReplayIfLine3\" Orthogonal exact:True))))}) (rules (start (place \"Marker\" \"Hand\" count:18)) phases:{ (phase \"Placement\" (play (if \"SameTurn\" \"RemoveAnyEnemyPiece\" (move (from (handSite Mover)) (to (sites Empty)) (then (\"ReplayIfLine3\" Orthogonal exact:True))))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (phase \"Movement\" (play (if \"SameTurn\" \"RemoveAnyEnemyPiece\" (forEach Piece))))} (end (\"CaptureAll\" Next))))\n\n###\n\n", "completion": "7x6 board. Eighteen pieces per player. Players alternate turns placing a piece on the board. When all of the pieces have been placed, players alternate turns moving a piece to an adjacent empty square in an orthogonal direction. When a player places three of their pieces in an orthogonal line, they capture one of the opponent's pieces. The player who captures all of the opponent's pieces wins. END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nA 6x6 board is currently selected -> A 10x10 board is currently selected\nA running count of your number of groups is show as a heuristic. -> A running count of (the inverse of) the number of enemy groups is show as a heuristic.\n(define \"FlipGroupAndCalculateDifference\" (do (add (to (sites Group at:(last From) Orthogonal) (apply (remove (to))))) next:(and (set Score P1 (- (count Groups Orthogonal if:(= (id P1) (who at:(to)))) (count Groups Orthogonal if:(= (id P2) (who at:(to)))))) (set Score P2 (- (count Groups Orthogonal if:(= (id P2) (who at:(to)))) (count Groups Orthogonal if:(= (id P1) (who at:(to))))))))) (define \"FlipGroupAndCountEnemy\" (do (add (to (sites Group at:(last From) Orthogonal) (apply (remove (to))))) next:(and (set Score P1 (* -1 (count Groups Orthogonal if:(= (id P2) (who at:(to)))))) (set Score P2 (* -1 (count Groups Orthogonal if:(= (id P1) (who at:(to))))))))) (define \"FlipGroupAndCountFriendly\" (do (add (to (sites Group at:(last From) Orthogonal) (apply (remove (to))))) next:(and (set Score P1 (count Groups Orthogonal if:(= (id P1) (who at:(to))))) (set Score P2 (count Groups Orthogonal if:(= (id P2) (who at:(to)))))))) (define \"FlipGroup\" (add (to (sites Group at:(last From) Orthogonal) (apply (remove (to)))))) (game \"Paintbucket\" (players 2) (equipment { (board (square 6)) (tile \"Square\" Each)}) (rules (start { (place \"Square1\" (sites Phase 0)) (place \"Square2\" (sites Phase 1)) (set Score P1 (count Sites in:(sites Occupied by:P1))) (set Score P2 (count Sites in:(sites Occupied by:P2)))}) (play (move Select (from (sites Occupied by:Next)) (then (\"FlipGroupAndCountFriendly\")))) (end (\"CaptureAll\" Next Loss))))\n\n###\n\n", "completion": "(define \"FlipGroupAndCalculateDifference\" (do (add (to (sites Group at:(last From) Orthogonal) (apply (remove (to))))) next:(and (set Score P1 (- (count Groups Orthogonal if:(= (id P1) (who at:(to)))) (count Groups Orthogonal if:(= (id P2) (who at:(to)))))) (set Score P2 (- (count Groups Orthogonal if:(= (id P2) (who at:(to)))) (count Groups Orthogonal if:(= (id P1) (who at:(to))))))))) (define \"FlipGroupAndCountEnemy\" (do (add (to (sites Group at:(last From) Orthogonal) (apply (remove (to))))) next:(and (set Score P1 (* -1 (count Groups Orthogonal if:(= (id P2) (who at:(to)))))) (set Score P2 (* -1 (count Groups Orthogonal if:(= (id P1) (who at:(to))))))))) (define \"FlipGroupAndCountFriendly\" (do (add (to (sites Group at:(last From) Orthogonal) (apply (remove (to))))) next:(and (set Score P1 (count Groups Orthogonal if:(= (id P1) (who at:(to))))) (set Score P2 (count Groups Orthogonal if:(= (id P2) (who at:(to)))))))) (define \"FlipGroup\" (add (to (sites Group at:(last From) Orthogonal) (apply (remove (to)))))) (game \"Paintbucket\" (players 2) (equipment { (board (square 10)) (tile \"Square\" Each)}) (rules (start { (place \"Square1\" (sites Phase 0)) (place \"Square2\" (sites Phase 1)) (set Score P1 (* -1 (count Sites in:(sites Occupied by:P2)))) (set Score P2 (* -1 (count Sites in:(sites Occupied by:P1))))}) (play (move Select (from (sites Occupied by:Next)) (then (\"FlipGroupAndCountEnemy\")))) (end (\"CaptureAll\" Next Loss)))) END" }, { "prompt": "Construct a Ludii game based on the following description\n4x10 board. Forty counters in total. Play begins with one counter in each hole. One player then rearranges these counters however they like, as long as they remain on their side of the board and they remain on the board. They can arrange it so that they capture counters from the opponent's side according to the capture rules. The other player then does the same. Play begins with a player picking up counters from one of the holes with more than one on their side. Counters are sown in an anti-clockwise direction. When the last counter lands in an occupied hole, these counters are picked up and sowing continues until the last counter falls in an empty hole. When the last counter falls into an empty hole, either the turn ends or the player captures. Captures are only made from the inner row; if the corresponding hole in the opponent's inner row holds counters, these are captured; if there are also counters in the corresponding hole in the opponent's outer row, these are also captured. Play continues until one player has nothing left or one player has only single counters in their holes. If the player has no counters left, they have lost. If only single counters remain in a player's holes, they may now move single counters, but only into empty holes. Captures are made in the same way as before. \n\n###\n\n", "completion": "(define \"OnlyHoleWithSingleCounters\" (all Sites (sites Mover \"Home\") if:(>= 1 (count at:(site))))) (define \"Columns\" 10) (game \"Makonn\" (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))) (piece \"Seed\" Shared)}) (rules (start (set Count 1 to:(union (sites P1 \"Home\") (sites P2 \"Home\")))) phases:{ (phase \"Rearrangement\" (play (or (move (from (sites Mover \"Home\") if:(is Occupied (from))) (to (sites Mover \"Home\") if:(!= (from) (to))) (then (and (if (and { (!= 1 (value Player Mover)) (is In (last To) (sites Mover \"Inner\")) (= 1 (count at:(last To)))}) (if (is Occupied (\"OppositePit\" (last To))) (and { (set Value Mover 1) (remove (\"OppositePit\" (last To))) (if (is Occupied (\"OppositeOuterPit\" (last To))) (remove (\"OppositeOuterPit\" (last To))))}))) (moveAgain)))) (move Pass))) (nextPhase Mover (was Pass) \"Sowing\")) (phase \"Sowing\" (play (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (sites Mover \"Home\")) if:(if (\"SameTurn\") True (if (\"OnlyHoleWithSingleCounters\") (is Occupied (from)) (< 1 (count at:(from)))))) (then (sow \"Track\" owner:(mover) apply:(if (< 1 (count at:(to))) (and (set Var \"Replay\" (to)) (moveAgain)) (if (is Occupied (\"OppositePit\" (to))) (and (remove (\"OppositePit\" (to))) (if (is Occupied (\"OppositeOuterPit\" (to))) (remove (\"OppositeOuterPit\" (to))))))))))))} (end (if (all Sites (sites Next \"Home\") if:(= 0 (count at:(site)))) (result Next Loss))))) 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": "Construct a Ludii game based on the following description\n5x5 board. Twelve pieces per player. Players alternate turns placing two pieces on the board. The first piece of each player must be placed on a spot adjacent to the central spot. The central spot cannot be filled. When both players have placed their pieces, they move their pieces orthogonally to an empty adjacent space. When an opponent's piece is surrounded on two opposite sides by pieces belonging to the player, the opponent's piece is captured. The player who made the capture may move the same piece they moved to make a capture another time if another capture is possible by doing so.\n \n The player who captures all of their opponent's pieces, or which blocks the opponent from being able to move, wins.\n \n In a case where the second player has created a blockade of their pieces containing one or more of only their own pieces which can move infinitely without possibility of being taken, the second player player may declare H'ajeb in order to regain the possibility of winning. The second player declares H'ajeb on their turn, and then the first player gains the ability to move any distance orthogonally or diagonally. The first player may also make multiple captures not just with the same piece, but with more than one. The second player may rescind the H'ajeb declaration at any time and the captures must stop. If the second player allows the first player to continue until the first player cannot capture, the second player captures any two of the first player's pieces, and the first player captures one of the second player's pieces that is able to move infinitely.\n \n\n###\n\n", "completion": "(define \"CanCaptureAgain\" (can Move (step (from (last To)) Orthogonal (to if:(\"IsConfigurationToCustodialAgain\"))))) (define \"IsConfigurationToCustodialAgain\" (and (is Empty (to)) (or { (and (\"IsEnemyAt\" (ahead (to) W)) (\"IsFriendAt\" (ahead (to) steps:2 W))) (and (\"IsEnemyAt\" (ahead (to) E)) (\"IsFriendAt\" (ahead (to) steps:2 E))) (and (\"IsEnemyAt\" (ahead (to) N)) (\"IsFriendAt\" (ahead (to) steps:2 N))) (and (\"IsEnemyAt\" (ahead (to) S)) (\"IsFriendAt\" (ahead (to) steps:2 S)))}))) (game \"Sabou'iyya\" (players 2) (equipment { (board (square 5)) (piece \"Marker\" Each (\"StepToEmpty\" Orthogonal (then (\"CustodialCapture\" Orthogonal (max 1) (then (if (\"CanCaptureAgain\") (moveAgain))))))) (hand Each)}) (rules (start (place \"Marker\" \"Hand\" count:12)) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (if (= 0 (count Pieces Mover in:(sites Board))) (forEach (sites Around (centrePoint) Orthogonal) if:(is Empty (site))) (difference (sites Board) (centrePoint))) if:(is Empty (to))) (then (if (\"NewTurn\") (moveAgain))))) (nextPhase Mover (is Empty (handSite Mover)) \"Capture\")) (phase \"Capture\" (play (if (\"SameTurn\") (or (move Step (from (last To)) Orthogonal (to if:(\"IsConfigurationToCustodialAgain\")) (then (\"CustodialCapture\" Orthogonal (max 1) (then (if (\"CanCaptureAgain\") (moveAgain)))))) (move Pass)) (forEach Piece))))} (end (\"BlockWin\")))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"Round Merels\" (players 2) (equipment { (board (concentric {1 8}) use:Vertex) (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 (if (is Line 3 through:(centrePoint) what:(mover)) (result Mover Win)))))\n\n###\n\n", "completion": "Eight spots arranged in a circle around a central spot. Opposite spots are connected by a diameter through the central spot. The rules are describing with the Blumlein ruleset. END" }, { "prompt": "Modify the Ludii game according to the following option changes:\n0 or 6 mouths correspond to 11. -> 0 or 6 mouths correspond to 12.\n(define \"RemovePiece\" (apply (if (\"IsEnemyAt\" (to)) (remove (to))))) (define \"CanMove\" (= (value Player Mover) 1)) (define \"AllowToBegin\" (is In (count Pips) (sites {0 1 5 6}))) (game \"Awangdu\" (players 2) (equipment { (board (rectangle 5 12) { (track \"Track1\" \"0,E,N1,W,N1,E,N1,W,N1,E\" P1 directed:True) (track \"Track2\" \"59,W,S1,E,S1,W,S1,E,S1,W\" P2 directed:True)} use:Vertex) (\"StickDice\" 6) (piece \"Disc\" Each (if (not (\"IsFriendAt\" (\"NextSiteOnTrack\" (mapEntry (var))))) (move (from) (to (\"NextSiteOnTrack\" (mapEntry (var))) (\"RemovePiece\"))))) (map {(pair 0 11) (pair 1 1) (pair 2 2) (pair 3 3) (pair 4 4) (pair 5 1) (pair 6 11)})}) (rules (start { (place \"Disc1\" (sites Bottom)) (place \"Disc2\" (sites Top))}) (play (\"RollMove\" (if (or (\"CanMove\") (\"AllowToBegin\")) (do (set Var (count Pips)) next:(forEach Piece (then (if (not (\"CanMove\")) (set Value Mover 1)))))))) (end (\"HavingLessPiecesLoss\" Next 2))))\n\n###\n\n", "completion": "(define \"RemovePiece\" (apply (if (\"IsEnemyAt\" (to)) (remove (to))))) (define \"CanMove\" (= (value Player Mover) 1)) (define \"AllowToBegin\" (is In (count Pips) (sites {0 1 5 6}))) (game \"Awangdu\" (players 2) (equipment { (board (rectangle 5 12) { (track \"Track1\" \"0,E,N1,W,N1,E,N1,W,N1,E\" P1 directed:True) (track \"Track2\" \"59,W,S1,E,S1,W,S1,E,S1,W\" P2 directed:True)} use:Vertex) (\"StickDice\" 6) (piece \"Disc\" Each (if (not (\"IsFriendAt\" (\"NextSiteOnTrack\" (mapEntry (var))))) (move (from) (to (\"NextSiteOnTrack\" (mapEntry (var))) (\"RemovePiece\"))))) (map {(pair 0 12) (pair 1 1) (pair 2 2) (pair 3 3) (pair 4 4) (pair 5 1) (pair 6 12)})}) (rules (start { (place \"Disc1\" (sites Bottom)) (place \"Disc2\" (sites Top))}) (play (\"RollMove\" (if (or (\"CanMove\") (\"AllowToBegin\")) (do (set Var (count Pips)) next:(forEach Piece (then (if (not (\"CanMove\")) (set Value Mover 1)))))))) (end (\"HavingLessPiecesLoss\" Next 2)))) END" }, { "prompt": "Construct a Ludii game based on the following description\n3x3 intersecting lines, with triangles extending on opposite ends of the large square and the central line extending to the apices. One player plays as the notched stick, called the hare, and the other as three sharp sticks, known as the hounds. Players alternate turns placing a piece on the board. When a player has placed all of their pieces on the board, they move one of their pieces to an empty adjacent spot along the lines. When the hounds block the hare from being able to move, the hounds win. The game has an ending condition only for P1.\n\n###\n\n", "completion": "(game \"Janes Soppi\" (players 2) (equipment { (board (merge { (rectangle 3 3) (shift 1.5 0.5 (rotate -90 (wedge 2))) (shift -1.5 0.5 (rotate 90 (wedge 2)))}) use:Vertex) (hand Each) (piece \"Hound\" P1 \"StepToEmpty\") (piece \"Hare\" P2 \"StepToEmpty\")}) (rules (start { (place \"Hound1\" (handSite P1) count:3) (place \"Hare2\" (handSite P2))}) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (\"PhaseMovePiece\" \"Movement\")} (end { (if (no Moves P2) (result P1 Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nA player may remove one or more adjacent pieces from a row or column. The loser is the person who takes the last piece off the board. \n\n###\n\n", "completion": "(game \"TacTix\" (players 2) (equipment { (board (square 4)) (piece \"Ball\" Shared)}) (rules (start (place \"Ball\" (sites Board))) (play (if (\"SameTurn\") (or (if (= 1 (count MovesThisTurn)) (move Select (from (last To)) (to (intersection (sites Around (last To) Orthogonal) (sites Occupied by:Shared))) (then (and (remove (last To)) (if (and (is Occupied (ahead (last To) (\"LastDirection\" Cell))) (!= (last To) (ahead (last To) (\"LastDirection\" Cell)))) (moveAgain))))) (move Select (from (last To)) (to (ahead (last To) (\"LastDirection\" Cell))) (then (and (remove (last To)) (if (and (is Occupied (ahead (last To) (\"LastDirection\" Cell))) (!= (last To) (ahead (last To) (\"LastDirection\" Cell)))) (moveAgain)))))) (move Pass)) (move Remove (sites Board) (then (if (not (all Sites (sites Around (last To) Orthogonal) if:(is Empty (site)))) (moveAgain)))))) (end (\"NoMoves\" Win)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nDROP - Each stone is dropped on an empty cell, next to and below a stone of the same color\n \n MOVE - First player drops one stone at the first turn, then each player drops up to two stones (he may pass).\n \n GOAL - Wins the player with more stones on the bottom row. \n\n###\n\n", "completion": "(define \"PlaceStone\" (move Add (to (union (sites Around (sites Occupied by:Mover) SSW) (sites Around (sites Occupied by:Mover) SSE)) if:(is Empty (to))) #1)) (game \"Cascades\" (players 2) (equipment { (board (remove (hex Triangle 15) cells:{92..119} vertices:{223..285})) (piece \"Ball\" Each) (hand Each)}) (rules (start { (place \"Ball1\" (forEach (sites Top) if:(is Even (site)))) (place \"Ball2\" (forEach (sites Top) if:(is Odd (site))))}) phases:{ (phase \"FirstMove\" (play (\"PlaceStone\")) (nextPhase \"Main\")) (phase \"Main\" (play (or (\"PlaceStone\" (then (if (\"NewTurn\") (moveAgain)))) (if (\"SameTurn\") (move Pass)))))} (end (if (and (no Moves P1) (no Moves P2)) (byScore { (score P1 (count Sites in:(forEach (sites Bottom) if:(= (who at:(site)) P1)))) (score P2 (count Sites in:(forEach (sites Bottom) if:(= (who at:(site)) P2))))}))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nTwo rows of six holes. Each player has 7 holes.\n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (count Cell at:(handSite #1))) (game \"Mangala (Turkey)\" (players 2) (equipment { (mancalaBoard 2 7 store:None (track \"Track\" \"0,E,N,W\" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 5 to:(sites Track))) (play (move Select (from (sites Mover) if:(> (count at:(from)) 0)) (then (sow if:(or (= (count at:(to)) 1) (= (count at:(to)) 3)) apply:(fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))) backtracking:True)))) (end (\"MancalaByScoreWhen\" (= (count in:(sites Track)) 0))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThree concentric squares, with lines connecting the midpoints and diagonals of the squares. Twelve pieces per player. Players alternate turns placing one of their pieces on the board. When all of the pieces are placed, the pieces may be moved to an empty adjacent spot on the board. One player wins by placing three of their pieces in a row. The other player wins by blocking their opponent from being able to move. Player 1 wins by blocking.\n\n###\n\n", "completion": "(game \"Niranchy\" (players 2) (equipment { (board (concentric Square rings:3 joinCorners:True) use:Vertex) (hand Each) (piece \"Marker\" Each (\"StepToEmpty\"))}) (rules (start (place \"Marker\" \"Hand\" count:12)) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (\"PhaseMovePiece\" \"Movement\")} (end { (if (no Moves P2) (result P1 Win)) (if (is Line 3 P2) (result P2 Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nClaim Jumpers is a 2-player strategy game\n It may be played: \n -- on a hex grid\n -- on a square grid\n -- on a square plus diagonal grid\n \n The goal is to maximize your pieces when the board is full. \n A new piece is placed at the beginning of each turn. Followed, if possible, by a chain of forced jumps made by a different piece, that capture by 'flipping' the jumped opponent to your own color.\n \n The board starts empty. Turns alternate starting with White.\n Game ends when the board is full. No passing.\n \n Maximum captures are not required, but the piece choen to capture must capture at least one, and maynot stop capturing as long as it is able to capture the next adjacent opponent's piece. Board & size: Equiversi Hexhex with edges alternating 3 and 5\n\n###\n\n", "completion": "(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 \"Placement\" (do (forget Value All) next:(move Add (piece (id \"Disc\" Mover)) (to (sites Empty)) (then (if (can Move (\"OpponentHop\" (from if:(!= (from) (last To))))) (moveAgain)))))) (define \"ForcedHop\" (if (= 0 (size Array (values Remembered))) (\"OpponentHop\" (from if:(!= (from) (last To)))) (\"OpponentHop\" (from if:(= (from) (last To)))))) (define \"OpponentHop\" (forEach Piece (move Hop #1 Orthogonal (between if:(\"IsAJumpableSite\") (apply (set Pending (between)))) (to if:(is Empty (to))) (then (and { (remember Value (value Pending)) (remove (value Pending)) (add (piece (id \"Disc\" Mover)) (to (value Pending)))} (then (and { (set Pending) (if (\"CanHop\" (from (last To))) (moveAgain))}))))))) (define \"CanHop\" (can Move (forEach Piece (move Hop #1 Orthogonal (between if:(\"IsAJumpableSite\")) (to if:(is Empty (to))))))) (define \"IsAJumpableSite\" (is In (between) (difference (sites Occupied by:Next) (sites (values Remembered))))) (define \"SameTurn\" (is Prev Mover)) (game \"Claim Jumpers\" (players 2) (equipment { (board (tri {3 5 3 5 3}) use:Vertex) (piece \"Disc\" Each)}) (rules (start (set Score Each 0)) (play (if (\"SameTurn\") (\"ForcedHop\") (\"Placement\") (then (and (set Score Mover (count Pieces Mover)) (set Score Next (count Pieces Next)))))) (end { (if (and \"EndCondition\" (= (score Mover) (score Next))) (result Mover Win)) (if (and \"EndCondition\" (!= (score Mover) (score Next))) (byScore))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayers take turns moving one of their pieces to an adjacent empty point, forwards or sideways. A piece can hop over an adjacent enemy piece to an empty point immeidately beyond it, forwards or sideways, and must do so if possible. Only one hope per turn is allowed. If a piece reaches the far point of the board, it is promoted to a king which can also move and hop backwards. Win by eliminating all enemy pieces. The game is drawn if both players are reduced to a single king. \n\n###\n\n", "completion": "(define \"MoveChoice\" (or (forEach Piece \"Counter\" #1 (then (\"PromoteIfReach\" (sites Mover) \"DoubleCounter\"))) (forEach Piece \"DoubleCounter\" #2))) (define \"StepToEmptyForwards\" (\"StepToEmpty\" (directions {Forwards Rightward Leftward} bySite:True))) (define \"HopCaptureForwards\" (\"HopCapture\" ~ (directions {Forwards Rightward Leftward} bySite:True))) (game \"Game of Solomon\" (\"TwoPlayersNorthSouth\") (equipment { (board (renumber (splitCrossings (add (regular Star 6) edges:{{0 5} {1 4} {2 3}}))) use:Vertex) (piece \"Counter\" Each) (piece \"DoubleCounter\" Each) (regions \"Palace1\" P1 (sites {\"E7\"})) (regions \"Palace2\" P2 (sites {\"E1\"}))}) (rules (start { (place \"Counter1\" (sites {\"E1\" \"A2\" \"D2\" \"E2\" \"F2\" \"I2\"})) (place \"Counter2\" (sites {\"E7\" \"A6\" \"D6\" \"E6\" \"F6\" \"I6\"}))}) (play (priority { (\"MoveChoice\" \"HopCaptureForwards\" \"HopCapture\") (\"MoveChoice\" \"StepToEmptyForwards\" \"StepToEmpty\")})) (end { (\"BlockWin\") (if (and { (= 1 (count Pieces P1)) (= 1 (count Pieces P2)) (= 1 (count Pieces P1 \"DoubleCounter\")) (= 1 (count Pieces P2 \"DoubleCounter\"))}) (result Mover Draw))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x12 board, with the spaces rendered as points, divided into half. Fifteen pieces per player, which begin on the rightmost point, with respect to the player, on the opposite side of the board from which they sit. Two six-sided dice. Pieces move according to the throws of the dice, the value of a die being used to move a piece the entire value of the die. A throw of double sixes makes the player play six twice, then five twice, then four twice, and so on down to one. A throw of double fives forces the player to play five twice and then six twice. A throw of double four, three, or two forces the player to play two of that number, down to one. A play of double ones forces the player to play one twice, then two twice, up to six. More than two pieces of the same player may not occupy a point on the starting side of the board. The player cannot move past the penultimate point on the opposite side of the board until five pieces have been moved from the starting point. A single opponent's piece may be removed from the board when a player's piece lands on it, and the opponent's piece must reenter the board. Pieces cannot move to a point occupied by two opponent's piece. A piece cannot reenter the board on a point occupied by another piece, whether belonging to the player or the opponent. When all of a player's pieces have reached the final quadrant of the board, the player may begin to remove them from the table. The player who bears off their pieces scores two points. \n\n###\n\n", "completion": "(define \"PlayMove\" (if (>= 0 (value Player Mover)) (\"RollEachNewTurnMove\" (if (all DiceEqual) (or (\"SpecialEnterPieces\" (\"DieValue\")) (forEach Piece (\"SpecialMove\" (\"DieValue\")) top:True) (then (and { (moveAgain) (set Var \"FirstPlay\" 1) (set Value Mover (\"DieValue\")) (set Var \"DoubleToPlay\" (\"DieValue\"))}))) (or (\"EnterPieces\") (forEach Piece top:True)))) (or (\"SpecialEnterPieces\" (var \"DoubleToPlay\")) (forEach Piece (\"SpecialMove\" (var \"DoubleToPlay\")) top:True) (then (and { (if (or (= (value Player Mover) 1) (= (value Player Mover) 5)) (if (!= (var \"FirstPlay\") 1) (and (set Var \"DoubleToPlay\" (var \"DoubleToPlay\")) (moveAgain)) (if (!= 6 (var \"DoubleToPlay\")) (and (set Var \"DoubleToPlay\" (+ (var \"DoubleToPlay\") 1)) (moveAgain)) (and (set Var \"DoubleToPlay\" 0) (set Value Mover 0)))) (if (!= (var \"FirstPlay\") 1) (and (set Var \"DoubleToPlay\" (var \"DoubleToPlay\")) (moveAgain)) (if (!= 1 (var \"DoubleToPlay\")) (and (set Var \"DoubleToPlay\" (- (var \"DoubleToPlay\") 1)) (moveAgain)) (and (set Var \"DoubleToPlay\" 0) (set Value Mover 0))))) (if (!= (var \"FirstPlay\") 1) (set Var \"FirstPlay\" 1) (set Var \"FirstPlay\" 0))}))) (then (if (no Pieces Mover) (set Score Mover 2))))) (define \"SpecialEnterPieces\" (if (is Occupied (handSite Mover)) (move (from (handSite Mover)) (to (\"NextSiteFrom\" (mapEntry \"Entry\" Mover) (- #1 1)) if:(is Empty (to)))))) (define \"SpecialMove\" (\"CommonMove\" #1)) (define \"Move\" (forEach Die replayDouble:True if:(\"DieNotUsed\") (\"CommonMove\" (pips)) (then (\"ReplayNotAllDiceUsed\")))) (define \"CommonMove\" (if (\"IsEndTrack\" (\"NextSiteFrom\" (from) #1)) (if (\"AllPiecesInFinalQuadrant\") (move Remove (from))) (move (from (from)) (to (\"NextSiteFrom\" (from) #1) if:(and { (\"NoEnemyOrOnlyOne\" (to)) (if (not (is In (to) (sites Mover \"StartingSide\"))) True (> 2 (size Stack at:(to)))) (if (not (is In (to) (sites Mover \"AfterPenultimate\"))) True (>= 10 (count Pieces in:(sites {(handSite Mover) (mapEntry \"Entry\" Mover)}))))}) (\"HittingCapture\" (handSite Next)))))) (define \"EnterPieces\" (if (is Occupied (handSite Mover)) (forEach Die replayDouble:True if:(\"DieNotUsed\") (move (from (handSite Mover)) (to (\"NextSiteFrom\" (mapEntry \"Entry\" Mover) (- (pips) 1)) if:(is Empty (to)))) (then (\"ReplayNotAllDiceUsed\"))))) (define \"AllPiecesInFinalQuadrant\" (\"AllOwnedPiecesIn\" (sites Mover \"FinalQuadrant\"))) (define \"DieValue\" (face 28)) (define \"NextSiteFrom\" (\"NextSiteOnTrack\" #2 from:#1)) (game \"Piprjall\" (players 2) (equipment { (\"BackgammonBoard\" { (track \"Track1\" {25..20 18..13 0..5 7..12 End} P1 directed:True) (track \"Track2\" {0..5 7..12 25..20 18..13 End} P2 directed:True)}) (dice d:6 num:2) (piece \"Disc\" Each (\"Move\")) (hand Each) (regions \"FinalQuadrant\" P1 (sites {7..12})) (regions \"FinalQuadrant\" P2 (sites {13..18})) (regions \"StartingSide\" P1 (sites {25..20 18..13})) (regions \"StartingSide\" P2 (sites {0..5 7..12})) (regions \"AfterPenultimate\" P1 (sites {12})) (regions \"AfterPenultimate\" P2 (sites {13})) (map \"Entry\" {(pair P1 25) (pair P2 0)})}) (rules (start { (place Stack \"Disc1\" 25 count:15) (place Stack \"Disc2\" 0 count:15)}) (play (if (can Move (\"PlayMove\")) (\"PlayMove\") (move Pass (then (and { (set Value Mover 0) (set Var \"FirstPlay\" 0) (set Var \"DoubleToPlay\" 0)}))))) (end (\"EscapeWin\")))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nOrder 13, Square Ortho-Grid -> Order 19, Square Ortho-Grid\n(define \"GridDirection\" Orthogonal) (define \"AddOrPass\" (or { (move Add (piece (id \"Disc\" Mover)) (to (sites Empty) if:(> 3 (count Pieces Mover in:(sites Around (to) \"GridDirection\")))) (then (set Var \"Added\" 1))) (move Pass)})) (define \"Score4\" (do (forEach Site (sites Occupied by:#1) (if (> 3 (count Pieces #1 in:(sites Around (site) \"GridDirection\"))) (set State at:(site) 0) (set State at:(site) 1))) next:(do (and { (remember Value 0) (remember Value 0) (forEach Group \"GridDirection\" (if (no Pieces in:(intersection (sites) (sites State 1))) (remember Value (count Sites in:(sites)))))}) next:(set Var \"TopValue\" (max (values Remembered)) (then (forget Value (max (values Remembered)) (then (set Score #1 (* (var \"TopValue\") (max (values Remembered))) (then (forget Value All)))))))))) (define \"GridDirection\" Orthogonal) (game \"Wrigglers Squared\" (players 2) (equipment { (board (square 13) use:Vertex) (piece \"Disc\" Each)}) (rules (play (if (= 1 (var \"Added\")) (or { \"AddOrPass\" (forEach Piece (if (< 2 (count Pieces Mover in:(sites Around (from) \"GridDirection\"))) (move Remove (from) (then (set Var \"Added\" 0)))) Mover)}) \"AddOrPass\" (then (\"Score4\" Mover)))) (end (if (all Passed) { (if (>= (score Mover) (score Next)) (result Mover Win))} (result Next Win)))))\n\n###\n\n", "completion": "(define \"GridDirection\" Orthogonal) (define \"AddOrPass\" (or { (move Add (piece (id \"Disc\" Mover)) (to (sites Empty) if:(> 3 (count Pieces Mover in:(sites Around (to) \"GridDirection\")))) (then (set Var \"Added\" 1))) (move Pass)})) (define \"Score4\" (do (forEach Site (sites Occupied by:#1) (if (> 3 (count Pieces #1 in:(sites Around (site) \"GridDirection\"))) (set State at:(site) 0) (set State at:(site) 1))) next:(do (and { (remember Value 0) (remember Value 0) (forEach Group \"GridDirection\" (if (no Pieces in:(intersection (sites) (sites State 1))) (remember Value (count Sites in:(sites)))))}) next:(set Var \"TopValue\" (max (values Remembered)) (then (forget Value (max (values Remembered)) (then (set Score #1 (* (var \"TopValue\") (max (values Remembered))) (then (forget Value All)))))))))) (define \"GridDirection\" Orthogonal) (game \"Wrigglers Squared\" (players 2) (equipment { (board (square 19) use:Vertex) (piece \"Disc\" Each)}) (rules (play (if (= 1 (var \"Added\")) (or { \"AddOrPass\" (forEach Piece (if (< 2 (count Pieces Mover in:(sites Around (from) \"GridDirection\"))) (move Remove (from) (then (set Var \"Added\" 0)))) Mover)}) \"AddOrPass\" (then (\"Score4\" Mover)))) (end (if (all Passed) { (if (>= (score Mover) (score Next)) (result Mover Win))} (result Next Win))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nEach player has 14 holes. -> Each player has 16 holes.\n(define \"PiecesOwnedBy\" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (define \"MoveAgainAfterCapture\" (is Pending)) (define \"PlayFromNextHole\" (sites {(value Pending)})) (define \"NextHole\" (\"NextSiteOnTrack\" 1 from:(to) \"Track\")) (define \"Columns\" 14) (game \"Hus (Damara)\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"0,E,N1,W\" loop:True P1) (track \"Track2\" \"28,E,N1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"Track1\")) (regions \"Home\" P2 (sites Track \"Track2\")) (regions \"Inner\" P1 (difference (sites Track \"Track1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"Track2\") (sites Top))) (regions \"Outer\" P1 (sites Bottom)) (regions \"Outer\" P2 (sites Top)) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 2 to:(union { (expand (intersection (sites Row 1) (sites Right)) steps:3 W) (expand (intersection (sites Row 2) (sites Left)) steps:3 E) (sites P1 \"Outer\") (sites P2 \"Outer\")}))) (play (move Select (from (if (\"SameTurn\") (if \"MoveAgainAfterCapture\" \"PlayFromNextHole\" \"LastHoleSowed\") (sites Mover \"Home\")) if:(> (count at:(from)) 0)) (then (sow \"Track\" owner:(mover) apply:(if (> (count at:(to)) 1) (if (and { (is In (to) (sites Mover \"Inner\")) (> (count at:(\"OppositePit\" (to))) 0) (> (count at:(\"OppositeOuterPit\" (to))) 0)}) (and { (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))) (fromTo (from (\"OppositePit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePit\" (to)))) (fromTo (from (\"OppositeOuterPit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositeOuterPit\" (to)))) (if (> (count at:\"NextHole\") 1) (and (set Pending \"NextHole\") (moveAgain)))}) (moveAgain))))))) (end (\"MancalaByScoreWhen\" (no Moves Mover)))))\n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (define \"MoveAgainAfterCapture\" (is Pending)) (define \"PlayFromNextHole\" (sites {(value Pending)})) (define \"NextHole\" (\"NextSiteOnTrack\" 1 from:(to) \"Track\")) (define \"Columns\" 16) (game \"Hus (Damara)\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"0,E,N1,W\" loop:True P1) (track \"Track2\" \"32,E,N1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"Track1\")) (regions \"Home\" P2 (sites Track \"Track2\")) (regions \"Inner\" P1 (difference (sites Track \"Track1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"Track2\") (sites Top))) (regions \"Outer\" P1 (sites Bottom)) (regions \"Outer\" P2 (sites Top)) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 2 to:(union { (expand (intersection (sites Row 1) (sites Right)) steps:3 W) (expand (intersection (sites Row 2) (sites Left)) steps:3 E) (sites P1 \"Outer\") (sites P2 \"Outer\")}))) (play (move Select (from (if (\"SameTurn\") (if \"MoveAgainAfterCapture\" \"PlayFromNextHole\" \"LastHoleSowed\") (sites Mover \"Home\")) if:(> (count at:(from)) 0)) (then (sow \"Track\" owner:(mover) apply:(if (> (count at:(to)) 1) (if (and { (is In (to) (sites Mover \"Inner\")) (> (count at:(\"OppositePit\" (to))) 0) (> (count at:(\"OppositeOuterPit\" (to))) 0)}) (and { (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))) (fromTo (from (\"OppositePit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePit\" (to)))) (fromTo (from (\"OppositeOuterPit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositeOuterPit\" (to)))) (if (> (count at:\"NextHole\") 1) (and (set Pending \"NextHole\") (moveAgain)))}) (moveAgain))))))) (end (\"MancalaByScoreWhen\" (no Moves Mover))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nA triangular board is currently selected -> A diamond shaped board is currently selected\nA size 3 board is currently selected -> A size 4 board is currently selected\nThe currently selected star cells are the perimeter cells cells -> The currently selected star cells are the corner cells\nThe 12* placement protocol is currently in force -> No balance rule is currently in force\n(define \"StarCells\" (sites Outer)) (game \"Omny\" (players 2) (equipment { (board (hex Triangle 3)) (piece \"Disc\" Each)}) (rules (play (if (= 1 (var)) (or (move Swap Players P1 P2) (move Add (to (sites Empty)) (then (set Var 0)))) (move Add (to (sites Empty)) (then (if (= 1 (% (+ 1 (count Moves)) 2)) (moveAgain)))))) (end (if (>= (count Sites in:(\"StarCells\")) (max (results from:(difference (sites Board) (sites Group at:(last To))) to:2 (* (to) (count Sites in:(intersection (\"StarCells\") (sites Group at:(from) if:(not (is In (to) (sites Group at:(last To))))))))))) (result Mover Win)))))\n\n###\n\n", "completion": "(define \"StarCells\" (sites Corners)) (game \"Omny\" (players 2) (equipment { (board (hex Diamond 4)) (piece \"Disc\" Each)}) (rules (play (if (= 1 (var)) (or (move Swap Players P1 P2) (move Add (to (sites Empty)) (then (set Var 0)))) (move Add (to (sites Empty))))) (end (if (>= (count Sites in:(\"StarCells\")) (max (results from:(difference (sites Board) (sites Group at:(last To))) to:2 (* (to) (count Sites in:(intersection (\"StarCells\") (sites Group at:(from) if:(not (is In (to) (sites Group at:(last To))))))))))) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6 board. Four counters in each hole. Sowing proceeds in an anti-clockwise direction. When the final counter of a sowing lands in an occupied hole, the counters are picked up and sowing continues. When the final counter lands in an occupied hole in the player's own row causing it to contain four counters, these are captured and the turn ends. If the final counter falls into an empty hole, the turn ends. If at any point in the sowing a hole in the player's own row is made to contain four counters, they are taken. When there are only eight counters left on the board, the first player to make four counters in a hole captures all the remaining counters. At the end of the game, players place their captured counters four by four into the remaining holes. Players may thus capture holes from the opponent's row, one for every four counters placed in a hole. They may capture from these holes in the next round. Play continues until one player owns no holes. \n\n###\n\n", "completion": "(define \"EightPiecesOnBoard\" (>= 8 (count Pieces All in:(sites Board)))) (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 \"J'erin\" (players 2) (equipment { (mancalaBoard 2 6 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 4 to:(sites Track)) (set RememberValue \"OwnedP1\" (sites Bottom)) (set RememberValue \"OwnedP2\" (sites Top))}) phases:{ (phase \"Sowing\" (play (or { (move Select (from (if (\"SameTurn\") (\"LastHoleSowed\") (\"OwnedHoles\")) if:(< 0 (count at:(from)))) (then (do (set Var \"NumSowed\" (count at:(last To))) next:(if (and (\"EightPiecesOnBoard\") (not (all Sites (sites Track from:(\"NextSiteOnTrack\" 1 from:(last From) \"Track\") to:(\"NextSiteOnTrack\" (var \"NumSowed\") from:(last From) \"Track\")) if:(!= 3 (count at:(site)))))) (forEach Site (sites Board) (if (is Occupied (site)) (fromTo (from (site)) (to Cell (handSite Mover)) count:(count at:(site))))) (sow apply:(if (if (= 4 (count at:(to))) (not (is In (to) (\"OwnedHoles\"))) (!= 0 (count at:(to)))) (moveAgain))) (then (and (forEach Site (intersection (\"OwnedHoles\") (sites Track from:(last From) to:(trackSite Move from:(last From) \"Track\" steps:(var \"NumSowed\")))) (if (= 4 (count at:(site))) (fromTo (from (site)) (to (handSite Mover)) count:4))) (set Var \"NumSowed\" 0)))))))} (then (if (\"NoPieceOnBoard\") (and (forget Value \"OwnedP1\" All) (forget Value \"OwnedP2\" All)))))) (end (if (\"NoPieceOnBoard\") { (if (> 4 (count Cell at:(handSite P1))) (result P2 Win)) (if (> 4 (count Cell at:(handSite P2))) (result P1 Win))})) (nextPhase (\"NoPieceOnBoard\") \"BetweenRounds\")) (phase \"BetweenRounds\" (play (if (<= 4 (count Cell at:(handSite Mover))) (if (not (all Sites (sites Mover) if:(is Occupied (site)))) (move (from (handSite Mover)) (to (sites Mover) if:(is Empty (to))) count:4 (then (\"RemmemberOwnedHoles\" (last To)))) (move (from (handSite Mover)) (to (sites Board) if:(is Empty (to))) count:4 (then (\"RemmemberOwnedHoles\" (last To))))))) (nextPhase (and (> 4 (count Cell at:(handSite P1))) (> 4 (count Cell at:(handSite P2)))) \"Sowing\"))})) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game start with a special starting position. -> The game start with a special starting position.\n(define \"LastHole\" (last To afterConsequence:True)) (define \"NextHole\" (\"NextSiteOnTrack\" 1 from:#1 \"TrackCCW\")) (define \"InnerPitsWithPossibleCapture\" (forEach (difference (sites Mover \"Inner\") (sites Empty)) if:(is Occupied (\"OppositePit\" (site))))) (define \"InnerPit\" (if (is Mover P1) (- #1 \"Columns\") (+ #1 \"Columns\"))) (define \"EmptyOuterRow\" (all Sites (sites #1 \"Outer\") if:(= 0 (count at:(site))))) (define \"Columns\" 7) (game \"Kisolo\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"TrackCCW1\" \"0,E,N1,W\" loop:True P1) (track \"TrackCCW2\" \"14,E,N1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"TrackCCW1\")) (regions \"Home\" P2 (sites Track \"TrackCCW2\")) (regions \"Inner\" P1 (difference (sites Track \"TrackCCW1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"TrackCCW2\") (sites Top))) (regions \"Outer\" P1 (difference (sites Track \"TrackCCW1\") (sites P1 \"Inner\"))) (regions \"Outer\" P2 (difference (sites Track \"TrackCCW2\") (sites P2 \"Inner\"))) (piece \"Seed\" Shared)}) (rules (start { (set Count 15 to:(sites {\"G1\" \"A4\"})) (set Count 1 to:(sites {\"F2\" \"D2\" \"B2\" \"A1\" \"C1\" \"E1\" \"B3\" \"D3\" \"F3\" \"G4\" \"E4\" \"C4\"}))}) (play (if (and (or (= 0 (count MovesThisTurn)) (is In 1 (sites Pending))) (!= 0 (count Sites in:((\"InnerPitsWithPossibleCapture\"))))) (move Select (from (\"InnerPitsWithPossibleCapture\")) (then (and { (fromTo (from (\"OppositePit\" (last To))) (to (\"InnerPit\" (last To)))) (if (is Occupied (\"OppositeOuterPit\" (last To))) (fromTo (from (\"OppositeOuterPit\" (last To))) (to (\"InnerPit\" (last To))))) (moveAgain)} (then (if (!= 0 (count Sites in:((\"InnerPitsWithPossibleCapture\")))) (set Pending 1)))))) (move Select (from (if (and (is In 2 (sites Pending)) (\"SameTurn\")) (sites {(\"NextHole\" \"LastHole\")}) (sites Mover \"Home\")) if:(> (count at:(from)) 0)) (then (sow \"TrackCCW\" owner:(mover) apply:(if (is Occupied (\"NextHole\" (to))) (and { (if (and (is In (\"NextHole\" (to)) (sites Mover \"Inner\")) (is Occupied (\"OppositePit\" (\"NextHole\" (to))))) (and (fromTo (from (\"OppositePit\" (\"NextHole\" (to)))) (to (\"InnerPit\" (\"NextHole\" (to))))) (if (is Occupied (\"OppositeOuterPit\" (\"NextHole\" (to)))) (fromTo (from (\"OppositeOuterPit\" (\"NextHole\" (to)))) (to (\"InnerPit\" (\"NextHole\" (to)))))))) (moveAgain) (set Pending 2)}))))))) (end (forEach Player if:(\"EmptyOuterRow\" Player) (result Player Loss)))))\n\n###\n\n", "completion": "(define \"LastHole\" (last To afterConsequence:True)) (define \"NextHole\" (\"NextSiteOnTrack\" 1 from:#1 \"TrackCCW\")) (define \"InnerPitsWithPossibleCapture\" (forEach (difference (sites Mover \"Inner\") (sites Empty)) if:(is Occupied (\"OppositePit\" (site))))) (define \"InnerPit\" (if (is Mover P1) (- #1 \"Columns\") (+ #1 \"Columns\"))) (define \"EmptyOuterRow\" (all Sites (sites #1 \"Outer\") if:(= 0 (count at:(site))))) (define \"Columns\" 7) (game \"Kisolo\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"TrackCCW1\" \"0,E,N1,W\" loop:True P1) (track \"TrackCCW2\" \"14,E,N1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"TrackCCW1\")) (regions \"Home\" P2 (sites Track \"TrackCCW2\")) (regions \"Inner\" P1 (difference (sites Track \"TrackCCW1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"TrackCCW2\") (sites Top))) (regions \"Outer\" P1 (difference (sites Track \"TrackCCW1\") (sites P1 \"Inner\"))) (regions \"Outer\" P2 (difference (sites Track \"TrackCCW2\") (sites P2 \"Inner\"))) (piece \"Seed\" Shared)}) (rules (start { (set Count 9 to:(sites {\"A1\" \"G4\" \"A4\" \"G1\"})) (set Count 1 to:(sites {\"F2\" \"D2\" \"B2\" \"B3\" \"D3\" \"F3\"}))}) (play (if (and (or (= 0 (count MovesThisTurn)) (is In 1 (sites Pending))) (!= 0 (count Sites in:((\"InnerPitsWithPossibleCapture\"))))) (move Select (from (\"InnerPitsWithPossibleCapture\")) (then (and { (fromTo (from (\"OppositePit\" (last To))) (to (\"InnerPit\" (last To)))) (if (is Occupied (\"OppositeOuterPit\" (last To))) (fromTo (from (\"OppositeOuterPit\" (last To))) (to (\"InnerPit\" (last To))))) (moveAgain)} (then (if (!= 0 (count Sites in:((\"InnerPitsWithPossibleCapture\")))) (set Pending 1)))))) (move Select (from (if (and (is In 2 (sites Pending)) (\"SameTurn\")) (sites {(\"NextHole\" \"LastHole\")}) (sites Mover \"Home\")) if:(> (count at:(from)) 0)) (then (sow \"TrackCCW\" owner:(mover) apply:(if (is Occupied (\"NextHole\" (to))) (and { (if (and (is In (\"NextHole\" (to)) (sites Mover \"Inner\")) (is Occupied (\"OppositePit\" (\"NextHole\" (to))))) (and (fromTo (from (\"OppositePit\" (\"NextHole\" (to)))) (to (\"InnerPit\" (\"NextHole\" (to))))) (if (is Occupied (\"OppositeOuterPit\" (\"NextHole\" (to)))) (fromTo (from (\"OppositeOuterPit\" (\"NextHole\" (to)))) (to (\"InnerPit\" (\"NextHole\" (to)))))))) (moveAgain) (set Pending 2)}))))))) (end (forEach Player if:(\"EmptyOuterRow\" Player) (result Player Loss))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nMOVE - A stone can move up to N spaces in any combination of directions (it may even move over intervening stones), where N varies depending on the number of stones he has remaining:\n - Six pieces: one space per turn\n - Five pieces: two spaces per turn\n - Four pieces: three spaces per turn\n - Three pieces: four spaces per turn\n - Two pieces: five spaces per turn\n - One piece: six spaces per turn.\n \n CAPTURE - A stone captures an opposing piece by moving onto it. If a stone makes a capture before it has used all of the spaces available to it that move, it may continue to make additional captures until it has moved its limit.\n \n GOAL - Wins the player who captures all of his opponent's stones, or, if he reduces his opponent to a single stone without losing any of his own. \n\n###\n\n", "completion": "(define \"PieceMovement\" (move Slide #1 (between (max (\"RemainingMove\")) if:(not (\"IsEnemyAt\" (between)))) (to if:(\"IsEnemyAt\" (to)) (apply if:(not (\"IsFriendAt\" (to))) (if (\"IsEnemyAt\" (to)) (remove (to) (then (set Value Next (+ (value Player Next) 1))))))) (then (if (<= (- (\"RemainingMove\") (count Steps (last From) (last To))) 0) (set Value Mover (- 7 (count Pieces Mover))) (and (set Value Mover (- (\"RemainingMove\") (count Steps (last From) (last To)))) (moveAgain)))))) (define \"RemainingMove\" (if (= Undefined (value Player Mover)) 1 (value Player Mover))) (game \"Annuvin\" (players 2) (equipment { (board (rotate 30 (hex 4))) (piece \"Ball\" Each (\"PieceMovement\")) (hand Each)}) (rules (start { (place \"Ball1\" (difference (union {(sites Side NW) (sites Side NE) (expand (sites Side N))}) (union (sites Left) (sites Right)))) (place \"Ball2\" (difference (union {(sites Side SW) (sites Side SE) (expand (sites Side S))}) (union (sites Left) (sites Right))))}) (play (if (\"SameTurn\") (\"PieceMovement\" (from (last To))) (forEach Piece))) (end (if (or (and (= 1 (count Pieces Next)) (= 6 (count Pieces Mover))) (no Pieces Next)) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6 board. Three counters in each hole. The players begin the game simultaneously sowing first from their rightmost hole, racing to be the first one to drop the last counter of a sowing into an empty hole. This player then begins the next phase where they alternate play. Sowing occurs in an anti-clockwise direction. When the final counter falls into an occupied hole, the contents of this hole are picked up and sowing continues. When the final counter lands into an empty hole in the row belonging to the player, the counters in the opposite hole belonging to the opponent are captured, and the counter that triggered the capture is moved to the following hole. This could trigger the further capture of more of the opponent's counters if the hole in which the counter is placed was empty and the opponent's opposite hole contains counters. If the hole is occupied, sowing continues. If the hole is empty and the opposite hole is unoccupied or it is one of the opponent's holes, sowing ends. When one player can no longer play because the holes on their side are empty, the opponent captures the remaining counters on the board. A new round begins. The losing player places three counters in each hole, beginning on the rightmost hole. If the player has remaining counters but cannot fill their holes with three, they must distribute the remainder to fill as many of the remaining holes as possible with at least one counter. The winning player from the previous round then matches this starting configuration, keeping any surplus for use in future rounds. Play continues until one player has one or zero counters, the opponent being the winner. \n\n###\n\n", "completion": "(define \"LeftMostEmpty\" (trackSite FirstSite from:(mapEntry \"LeftMost\" Mover) if:(is Empty (to)))) (define \"NoPiecesInP1Side\" (all Sites (sites P1) if:(= 0 (count at:(site))))) (define \"OneRowIsEmpty\" (or (all Sites (sites P1) if:(= 0 (count at:(site)))) (all Sites (sites P2) if:(= 0 (count at:(site)))))) (define \"NextHoleFrom\" (\"NextSiteOnTrack\" #2 from:#1)) (define \"Columns\" 6) (game \"Gabata (Ansaba)\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" store:None (track \"Track\" \"0,E,N,W\" loop:True)) (piece \"Seed\" Shared) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (hand Each) (map \"LeftMost\" {(pair P1 0) (pair P2 11)}) (map \"CorrespondingHoles\" {(pair 0 11) (pair 1 10) (pair 2 9) (pair 3 8) (pair 4 7) (pair 5 6) (pair 6 5) (pair 7 4) (pair 8 3) (pair 9 2) (pair 10 1) (pair 11 0)})}) (rules (start (set Count 3 to:(sites Track))) phases:{ (phase \"Sowing\" (play (or { (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover)) if:(> (count at:(from)) 0)) (then (sow apply:(if (> (count at:(to)) 1) (moveAgain) (if (is In (to) (sites Mover)) (if (!= 0 (count at:(\"OppositePit\" (to)))) (and (fromTo (from (\"OppositePit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePit\" (to)))) (moveAgain))))))))} (then (if (\"OneRowIsEmpty\") (if (\"NoPiecesInP1Side\") (and (forEach Site (sites Board) (if (< 0 (count at:(site))) (fromTo (from (site)) (to (handSite P2)) count:(count at:(site))))) (if (>= (count Cell at:(handSite P1)) (+ (count Cell at:(handSite P2)) (count in:(sites Board)))) (set NextPlayer (player 2)) (set NextPlayer (player 1)))) (and (forEach Site (sites Board) (if (< 0 (count at:(site))) (fromTo (from (site)) (to (handSite P1)) count:(count at:(site))))) (if (>= (count Cell at:(handSite P2)) (+ (count Cell at:(handSite P1)) (count in:(sites Board)))) (set NextPlayer (player 1)) (set NextPlayer (player 2))))))))) (end (if (\"NoPieceOnBoard\") { (if (> 2 (count Cell at:(handSite P1))) (result P2 Win)) (if (> 2 (count Cell at:(handSite P2))) (result P1 Win))})) (nextPhase (\"NoPieceOnBoard\") \"BetweenRounds\")) (phase \"BetweenRounds\" (play (if (<= 3 (count Cell at:(handSite Mover))) (move (from (handSite Mover)) (to (\"LeftMostEmpty\")) count:3) (move (from (handSite Mover)) (to (\"LeftMostEmpty\")) count:1) (then (if (!= 0 (count Cell at:(handSite Mover))) (moveAgain) (forEach Site (sites Mover) (if (is Occupied (site)) (fromTo (from (handSite Next)) (to (mapEntry \"CorrespondingHoles\" (site))) count:(count at:(site))))))))) (nextPhase (or (is Empty (handSite P1)) (is Empty (handSite P2))) \"Sowing\"))})) END" }, { "prompt": "Construct a Ludii game based on the following description\n3x5 lines, intersecting one another and forming a square. Diagonals are drawn in the four quadrants of the board. Two triangles, their apices intersecting the main board at opposite midpoints. The base of the triangle is bisected by a line drawn from the apex, and this line is bisected and intersects with the other two sides of the triangle. Fourteen pieces per player, which begin on the points in the triangle and the first two rows of the square closest to each player. The central line remains empty. Players alternate turns moving to an empty adjacent point along the lines. A player may capture an opponent's piece by hopping over it to an empty space 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 \"Pam Pait\" (players 2) (equipment { (board (add (remove (\"AlquerqueGraphWithBottomAndTopTriangles\") vertices:{1 11 21 23 13 3}) edges:{ {0 1} {1 2} {8 9} {9 10} {16 17} {17 18}}) use:Vertex) (piece \"Marker\" Each (or \"HopCapture\" \"StepToEmpty\"))}) (rules (start { (place \"Marker1\" (union (sites {\"A4\" \"E4\"}) (expand (sites Bottom) steps:3))) (place \"Marker2\" (union (sites {\"A6\" \"E6\"}) (expand (sites Top) steps:3)))}) (play (forEach Piece)) (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nYour goal in Gobblet Junior is to place three of your pieces in a horizontal, vertical or diagonal row. Your pieces can stack on top of each other, and they start the game nested, off the board. On a turn, you either play one exposed piece from your three off-the-board piles or move one piece on the board to any other spot on the board where it fits. A larger piece can cover any smaller piece.\n \n Your memory is tested as you try to remember which color one of your larger pieces is covering before you move it. As soon as a player has three like-colored pieces in a row, he wins. \n\n###\n\n", "completion": "(game \"Gobblet Gobblers\" (players 2) (equipment { (board (square 3)) (piece \"Disc1\" Each) (piece \"Disc2\" Each) (piece \"Disc3\" Each) (hand Each size:3)}) (rules (start { (place Stack \"Disc11\" (handSite P1) count:3) (place Stack \"Disc12\" (handSite P2) count:3) (place Stack \"Disc21\" (handSite P1 1) count:3) (place Stack \"Disc22\" (handSite P2 1) count:3) (place Stack \"Disc31\" (handSite P1 2) count:3) (place Stack \"Disc32\" (handSite P2 2) count:3)}) (play (or (\"MoveToEmptyOrOccupiedByLargerPiece\" (sites Hand Mover) if:(is Occupied (from))) (\"MoveToEmptyOrOccupiedByLargerPiece\" (sites Occupied by:Mover top:True)))) (end (forEach Player if:(is Line 3 Player top:True) (result Player Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nFour rows of holes, of any number. Each player has as many pieces as are in one row. The pieces start in the outer row of the board for each player. Six sticks used as dice, with a green side and a white side. The throws are as follows: one white up = 0; two white up = 2; three white up = 1; four white up = 4; five white up = 0; zero white or six white up = 6. Each piece's first move must be with a throw of 1 or 6. This first throw moves the piece one space only. Play moves from left to right in the player's home row, from right to left in the second row, left to right in the third row, and right to left in the opponent's home row. When a player's piece lands on a space occupied by an opponent's piece, the opponent's piece is removed from the board. The player who captures all of the opponent's pieces wins. Each row has 20 holes.\n\n###\n\n", "completion": "(define \"AllPieceInOpponentHome\" (and (= (count Sites in:(difference (sites Occupied by:P1) (sites P2))) 0) (= (count Sites in:(difference (sites Occupied by:P2) (sites P1))) 0))) (define \"CaptureEnemyPiece\" (apply if:(\"IsEnemyAt\" (to)) (remove (to)))) (define \"InactivePiece\" (= (state at:(from)) 1)) (define \"ActivatedPiece\" (= (state at:(from)) 0)) (define \"ActivatePiece\" (if (= (state at:(last To)) 1) (set State at:(last To) 0))) (define \"ThrowValue\" (mapEntry (count Pips))) (game \"Sig (Mzab)\" (players 2) (equipment { (board (rectangle 4 20) { (track \"Track1\" \"0,E,N1,W,N1,E,N1,W\" P1 directed:True) (track \"Track2\" \"79,W,S1,E,S1,W,S1,E\" P2 directed:True)} use:Vertex) (piece \"Stick\" Each (if (or (\"ActivatedPiece\") (and (or (= 1 (\"ThrowValue\")) (= 6 (\"ThrowValue\"))) (\"InactivePiece\"))) (if (\"IsNotOffBoard\" (\"NextSiteOnTrack\" (if (\"InactivePiece\") 1 (\"ThrowValue\")))) (if (or (is In (\"NextSiteOnTrack\" (if (\"InactivePiece\") 1 (\"ThrowValue\"))) (sites Empty)) (\"IsEnemyAt\" (\"NextSiteOnTrack\" (if (\"InactivePiece\") 1 (\"ThrowValue\"))))) (move (from) (to (\"NextSiteOnTrack\" (if (\"InactivePiece\") 1 (\"ThrowValue\"))) \"CaptureEnemyPiece\"))) (then (\"ActivatePiece\"))))) (regions \"AllSites\" (sites Board)) (\"StickDice\" 6) (map {(pair 0 6) (pair 1 0) (pair 2 2) (pair 3 1) (pair 4 1) (pair 5 0) (pair 6 6)}) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start { (place \"Stick1\" (sites Bottom) state:1) (place \"Stick2\" (sites Top) state:1)}) (play (\"RollMove\" (forEach Piece))) (end { (\"CaptureAll\" Next) (if (\"AllPieceInOpponentHome\") (result Mover Draw))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nEach player has an allocated colour. The game is played in turns. On his first move, the second player may elect to swap colours (swap option). This is to prevent overly strong opening moves.\n \n Each turn the current player places one of their pegs on an empty hole, which may conquer one or more cells. A cell is conquered by the first player to occupy at least half of its surrounding holes. A blue rectangle is placed on cells conquered by Blue, and a red rectangle is placed on cells conquered by Red.\n The central cell, which has five holes, is conquered by the player who has occupied any three of these holes. \n The first player that completes a contiguous chain of connected cells of his colour between the 2 sides of his colour wins the game. \n\n###\n\n", "completion": "(define \"CaptureTheCell\" (claim (piece (id \"Rectangle\" Mover)) (to Cell (site)))) (define \"MajorityOfEmptyCell\" (if (is In (site) (sites Centre)) (>= (+ (\"NumOwnedHolesCells\") (if (= (mover) (who Vertex at:(centrePoint Vertex))) 1 0)) 3) (>= (\"NumOwnedHolesCells\") (if (is Even (\"NumHolesCells\")) (/ (\"NumHolesCells\") 2) (+ (/ (\"NumHolesCells\") 2) 1))))) (define \"NumOwnedHolesCells\" (count Sites in:(intersection (\"AllHolesOfCell\") (sites Occupied by:Mover on:Vertex)))) (define \"NumHolesCells\" (count Sites in:(\"AllHolesOfCell\"))) (define \"AllHolesOfCell\" (intersection (sites Incident Vertex of:Cell at:(site)) (sites \"Holes\"))) (define \"CellOfLastVertex\" (sites Incident Cell of:Vertex at:(last To))) (game \"ConHex\" (players 2) (equipment { (board (add (keep (splitCrossings (merge (rotate 45 (dual (square 12 diagonals:Concentric))) (shift 3 3 (scale 6 (square 1))))) (poly { {3 3} {3 9} {9 9} {9 3}})) vertices:{{6 6}})) (piece \"Marker\" Each) (piece \"Rectangle\" Each) (regions \"Holes\" (union (difference (sites Board Vertex) (sites Outer Vertex)) (sites Corners Vertex))) (regions P1 {(sites Side N) (sites Side S)}) (regions P2 {(sites Side W) (sites Side E)})}) (rules (meta (swap)) (play (move Add (to Vertex (sites Empty Vertex) if:(is In (to) (sites \"Holes\"))) (then (forEach Site \"CellOfLastVertex\" (if \"MajorityOfEmptyCell\" \"CaptureTheCell\") (then (forEach Site (forEach (\"CellOfLastVertex\") if:(is Mover (who Cell at:(site)))) (if (is Connected at:(site) Mover) (trigger \"Connected\" Mover)))))))) (end { (if (is Triggered \"Connected\" Mover) (result Mover Win)) (if (<= 52 (count Moves)) (result Mover Draw))}))) 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": "Describe the mechanics of the following Ludii game\n(game \"Caturvimsatikosthakatmiki Krida\" (players 2) (equipment { (board (rectangle 3 8)) (piece \"Marker\" Each (or { (move Hop Orthogonal (between if:(and (\"IsEnemyAt\" (between)) (not (is In (between) (union (sites Bottom) (sites Top))))) (apply (remove (between)))) (to if:(is Empty (to)))) (\"StepOrthogonalToEmpty\") (if (= 1 (state at:(from))) (move Slide Orthogonal (between (exact 2) if:(is Empty (between))) (then (set State at:(last To) 0))))}))}) (rules (start { (place \"Marker1\" (sites Bottom) state:1) (place \"Marker2\" (sites Top) state:1)}) (play (forEach Piece)) (end (\"HavingLessPiecesLoss\" Next 3))))\n\n###\n\n", "completion": "3x8 board. The second space from the left and from the right in the center row are marked with an X. Eight pieces per player, which begin in the row closest to the player. Players alternate turns moving a piece to an empty adjacent space in an orthogonal direction. On the first move of a piece, that piece may move two spaces in one direction. A player may capture an opponent's piece in the central row by hopping over it to an empty space on the opposite side of it. The player who reduces their opponent to fewer than four pieces wins. END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game is played on the Graph2. -> The game is played on the Graph3.\n(game \"Nein Ari\" (players 1) (equipment { (board (graph vertices:{{0 0} {5 0} {10 0} {0 5} {5 5} {10 5} {0 10} {5 10} {10 10}} edges:{ {0 1} {0 2} {0 3} {0 4} {0 5} {0 6} {0 7} {1 2} {1 3} {1 4} {1 5} {1 6} {1 8} {2 3} {2 4} {2 5} {2 7} {2 8} {3 4} {3 6} {3 7} {3 8} {4 5} {4 6} {4 7} {4 8} {5 6} {5 8} {5 7} {6 7} {6 8} {7 8}}) use:Edge)}) (rules (start (set P1 Edge (sites Board Edge))) (play (move Remove (sites Occupied by:Mover on:Edge))) (end (if (is RegularGraph Mover) (result Mover Win)))))\n\n###\n\n", "completion": "(game \"Nein Ari\" (players 1) (equipment { (board (graph vertices:{{0 0} {7 1} {0 4} {3 1} {6 5} {0 8} {10 5} {6 8} {10 11} {11 2} {10 10} {8 13} {13 14} {15 9}} edges:{ {0 1} {0 2} {0 3} {0 4} {0 5} {0 6} {0 7} {0 8} {0 9} {0 10} {0 11} {0 12} {0 13} {1 2} {1 3} {1 4} {1 5} {1 6} {1 7} {1 8} {1 9} {1 10} {1 11} {1 12} {1 13} {2 3} {2 4} {2 5} {2 6} {2 7} {2 8} {2 9} {2 10} {2 11} {2 12} {2 13} {3 4} {3 5} {3 6} {3 7} {3 8} {3 9} {3 10} {3 11} {3 12} {3 13} {4 5} {4 6} {4 7} {4 8} {4 9} {4 10} {4 11} {4 12} {4 13} {5 6} {5 7} {5 8} {5 9} {5 10} {5 11} {5 12} {5 13} {6 7} {6 8} {6 9} {6 10} {6 11} {6 12} {6 13} {7 8} {7 9} {7 10} {7 11} {7 12} {7 13} {8 9} {8 10} {8 11} {8 12} {8 13} {9 10} {9 11} {9 12} {9 13} {10 11} {10 12} {10 13} {11 12} {11 13} {12 13}}) use:Edge)}) (rules (start (set P1 Edge (sites Board Edge))) (play (move Remove (sites Occupied by:Mover on:Edge))) (end (if (is RegularGraph Mover) (result Mover Win))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nTriangle-8 Board (36) -> Triangle-15 Board (120)\n(define \"EdgesOfSide\" (intersection (sites Outer Edge) (forEach of:(difference #1 (sites Corners Vertex)) (sites Incident Edge of:Vertex at:(site))))) (define \"BoardColour\" (colour 215 203 170)) (define \"P2Colour\" (colour White)) (define \"P1Colour\" (colour DarkGreen)) (define \"AddPieceOf\" (move Add (piece #1) (to (sites Empty)) #2)) (define \"Side3\" (union (sites Side NW) (sites Side SW))) (define \"Side2\" (union (sites Side SE) (sites Side S))) (define \"Side1\" (union (sites Side NE) (sites Side N))) (game \"Bipartisan Y\" (players 2) (equipment { (board (tri 8) use:Vertex) (piece \"Disc\" Each) (piece \"Counter\" Neutral maxState:2)}) (rules (play (if (\"SameTurn\") (\"AddPieceOf\" (next) ~) (\"AddPieceOf\" (mover) (then (moveAgain))))) (end { (if (and (= 1 (who at:(last To))) (is Connected 3 {\"Side1\" \"Side2\" \"Side3\"})) (result P1 Win)) (if (and (= 2 (who at:(last To))) (is Connected 3 {\"Side1\" \"Side2\" \"Side3\"})) (result P2 Win))})))\n\n###\n\n", "completion": "(define \"EdgesOfSide\" (intersection (sites Outer Edge) (forEach of:(difference #1 (sites Corners Vertex)) (sites Incident Edge of:Vertex at:(site))))) (define \"BoardColour\" (colour 215 203 170)) (define \"P2Colour\" (colour White)) (define \"P1Colour\" (colour DarkGreen)) (define \"AddPieceOf\" (move Add (piece #1) (to (sites Empty)) #2)) (define \"Side3\" (union (sites Side NW) (sites Side SW))) (define \"Side2\" (union (sites Side SE) (sites Side S))) (define \"Side1\" (union (sites Side NE) (sites Side N))) (game \"Bipartisan Y\" (players 2) (equipment { (board (tri 15) use:Vertex) (piece \"Disc\" Each) (piece \"Counter\" Neutral maxState:2)}) (rules (play (if (\"SameTurn\") (\"AddPieceOf\" (next) ~) (\"AddPieceOf\" (mover) (then (moveAgain))))) (end { (if (and (= 1 (who at:(last To))) (is Connected 3 {\"Side1\" \"Side2\" \"Side3\"})) (result P1 Win)) (if (and (= 2 (who at:(last To))) (is Connected 3 {\"Side1\" \"Side2\" \"Side3\"})) (result P2 Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\n7x7 board. The central square, as well as the central square on each edge of the board, is marked with an X. Two to four players. Four pieces per player. Four cowries used as dice, the values are equal to the number of mouths which land face up; when all mouths are down the value = 8 and a \\ The game involves 2 players.\n\n###\n\n", "completion": "(define \"EntryPoint\" (mapEntry #1)) (define \"Goal\" 24) (define \"CaptureEnemyPiece\" (apply if:(and (not (is In (to) (sites \"ProtectedSites\"))) (\"IsEnemyAt\" (to))) (and (fromTo (from (to)) (to (handSite (who at:(to))))) (moveAgain)))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" (\"ThrowValue\"))) (define \"Grace\" (is In (count Pips) (array {0 4}))) (define \"ThrowValue\" (mapEntry \"Throw\" (count Pips))) (game \"Ashta-kashte\" (players 2) (equipment { (board (square 7) { (track \"Track1\" \"27,N,W,S,E,N2,SW1,W4,N4,E4,S3,W3,N2,E2,S1,W1\" P1 directed:True) (track \"Track2\" \"21,S,E,N,W,S2,NE1,E4,S4,W4,N3,E3,S2,W2,N1,E1\" P2 directed:True)}) (piece \"Paddle\" Each (if (and (is In (from) (sites Board)) (\"IsNotOffBoard\" \"SiteToMoveOnTrack\")) (move (from (from) level:(level)) (to \"SiteToMoveOnTrack\" \"CaptureEnemyPiece\")) (then (if (= \"Goal\" (last To)) (remove (last To)))))) (hand Each) (\"StickDice\" 4) (map {(pair 1 \"G4\") (pair 2 \"A4\") (pair 3 \"D1\") (pair 4 \"D7\")}) (map \"Throw\" {(pair 0 8)}) (regions \"ProtectedSites\" (sites {0 3 6 21 27 3 45 42 48 24}))}) (rules (start { (place Stack \"Paddle1\" (handSite P1) count:4) (place Stack \"Paddle2\" (handSite P2) count:4)}) (play (\"RollMove\" (or { (forEach Piece) (move Pass) (if (and (\"Grace\") (!= 0 (who at:(handSite Mover)))) (move (from (handSite Mover)) (to (mapEntry Mover))))}) (then (if (\"Grace\") (moveAgain))))) (end (\"EscapeWin\")))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"NoPiece\" (all Sites (sites #1) if:(= 0 (count at:(site))))) (game \"Mbelele\" (players 2) (equipment { (board (merge { (rectangle 2 12) (shift -1 0.5 (square 1)) (shift -3 0 (square 2)) (shift -4 0.5 (square 1)) (shift 12 0.5 (square 1)) (shift 13 0 (square 2)) (shift 15 0.5 (square 1))}) { (track \"TrackCCW1\" \"25,26,24,0,E,31,32,35\" loop:True P1) (track \"TrackCCW2\" \"34,33,30,23,W,28,27,29\" loop:True P2) (track \"TrackCW1\" \"35,32,31,11,W,24,26,25\" loop:True P1) (track \"TrackCW2\" \"29,27,28,12,E,30,33,34\" loop:True P2)} use:Vertex) (piece \"Seed\" Shared) (map \"Opposite\" { (pair 29 35) (pair 35 29) (pair 24 30) (pair 30 24) (pair 25 27) (pair 26 28) (pair 0 12) (pair 1 13) (pair 2 14) (pair 3 15) (pair 4 16) (pair 5 17) (pair 6 18) (pair 7 19) (pair 8 20) (pair 9 21) (pair 10 22) (pair 11 23) (pair 31 33) (pair 32 34) (pair 27 25) (pair 28 26) (pair 12 0) (pair 13 1) (pair 14 2) (pair 15 3) (pair 16 4) (pair 17 5) (pair 18 6) (pair 19 7) (pair 20 8) (pair 21 9) (pair 22 10) (pair 23 11) (pair 33 31) (pair 34 32)}) (regions P1 (union (sites Bottom) (sites {24 35}))) (regions P2 (union (sites Top) (sites {29 30})))}) (rules (start (set Count 3 to:(sites Board))) (play (or (if (!= 2 (var \"NumCapture\")) (or (if (!= (var \"Direction\") 2) (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (sites Mover)) if:(and (if (\"SameTurn\") True (= 1 (count at:(from)))) (is Occupied (from)))) (then (sow \"TrackCCW\" owner:(mover) apply:(if (= 1 (count at:(to))) (and { (if (is Occupied (mapEntry \"Opposite\" (to))) (remove (mapEntry \"Opposite\" (to)) count:1)) (set Var \"Direction\" 0) (set Var \"NumCapture\" 0)}) (and { (moveAgain) (set Var \"Replay\" (to)) (set Var \"Direction\" 1) (set Var \"NumCapture\" 1)})))))) (if (!= (var \"Direction\") 1) (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (sites Mover)) if:(and (if (\"SameTurn\") True (= 1 (count at:(from)))) (is Occupied (from)))) (then (sow \"TrackCW\" owner:(mover) apply:(if (= 1 (count at:(to))) (and { (if (is Occupied (mapEntry \"Opposite\" (to))) (remove (mapEntry \"Opposite\" (to)) count:1)) (set Var \"Direction\" 0) (set Var \"NumCapture\" 0)}) (and { (moveAgain) (set Var \"Replay\" (to)) (set Var \"Direction\" 2) (set Var \"NumCapture\" 1)})))))))) (if (!= 1 (var \"NumCapture\")) (or (if (!= (var \"Direction\") 2) (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (sites Mover)) if:(and (if (\"SameTurn\") True (< 1 (count at:(from)))) (is Occupied (from)))) (then (sow \"TrackCCW\" owner:(mover) apply:(if (= 1 (count at:(to))) (and { (if (is Occupied (mapEntry \"Opposite\" (to))) (remove (mapEntry \"Opposite\" (to)) count:(count at:(to)))) (set Var \"Direction\" 0) (set Var \"NumCapture\" 0)}) (and { (moveAgain) (set Var \"Replay\" (to)) (set Var \"Direction\" 1) (set Var \"NumCapture\" 2)})))))) (if (!= (var \"Direction\") 1) (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (sites Mover)) if:(and (if (\"SameTurn\") True (< 1 (count at:(from)))) (is Occupied (from)))) (then (sow \"TrackCW\" owner:(mover) apply:(if (= 1 (count at:(to))) (and { (if (is Occupied (mapEntry \"Opposite\" (to))) (remove (mapEntry \"Opposite\" (to)) count:(count at:(to)))) (set Var \"Direction\" 0) (set Var \"NumCapture\" 1)}) (and { (moveAgain) (set Var \"Replay\" (to)) (set Var \"Direction\" 2) (set Var \"NumCapture\" 2)})))))))))) (end (forEach NonMover if:(\"NoPiece\" Player) (result Player Loss)))))\n\n###\n\n", "completion": "Two rows of twelve holes in the central part of the board, one hole on either end of this, two rows of two outside of these single holes on both sides of the board, and one final hole on either end of the board. Three counters in each hole. Sowing occurs only in the player's row; players use the inner single hole to their left; the outer single hole to the right. Sowing can occur in either direction. Captures are made when a counter falls into an empty hole. The counters in the opponent's opposite hole are captured. When the final counter of a sowing ends in a player's empty inner single holes, the counters in the opponent's inner single hole are captured. If it lands in a player's empty outer single hole, the counters in the opponent's outer single hole are captured. Single counters can be sown, but these cannot capture more than one of the opponent's counters. If the final counter falls into an occupied hole, the contents of this hole are picked up and sowing continues in the same direction. A player can sow such that they can make a capture from the hole in which the sowing began, but this cannot be done by sowing two or fewer counters. The player who has no counters remaining in their row loses. It is customary to play a series of round to determine the winner. END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6 board. Each player has 36 counters which they arrange however they like in their holes. Play begins from any hole in a player's row. Sowing occurs in an anti-clockwise direction. When the last counter falls makes an odd number of counters in the final hole of the sowing, these are picked up and sowing continues. If the last hole is made to be even, these are captured, as well as the contents of the opposite hole. If the previous hole is also even, those counters and those in the opposite hole are also taken, continuing until there is an odd or empty hole. If the final counter falls into an empty hole, play ends. The round ends when one player is unable to move. A new round begins. The player with the smaller number of counters distributes them as they like in their holes. The opponent then copies this arrangement, keeping the surplus of counters. Play continues as before. Rounds are played until one player has no remaining counters. \n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (define \"Columns\" 6) (game \"Baqura\" (players 2) (equipment { (mancalaBoard 2 6 store:None (track \"Track\" \"0,E,N,W\" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece \"Seed\" Shared) (hand Each)}) (rules (start { (set Count 36 at:(handSite P1)) (set Count 36 at:(handSite P2))}) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (sites Mover)))) (nextPhase Mover (\"HandEmpty\" Mover) \"Sowing\")) (phase \"Sowing\" (play (if (not (all Sites (sites Mover) if:(= 0 (count at:(site))))) (move Select (from (if \"SameTurn\" \"LastHoleSowed\" (sites Mover)) if:(> (count at:(from)) 0)) (then (sow if:(> (count at:(to)) 1) apply:(if (and (> (count at:(to)) 1) (is Odd (count at:(to)))) (moveAgain) (and (if (> (count at:(\"OppositePitTwoRows\" (to))) 0) (fromTo (from (\"OppositePitTwoRows\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePitTwoRows\" (to))))) (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))))) backtracking:(and {(is In (to) (sites Mover)) (> (count at:(to)) 1) (is Even (count at:(to)))})))) (move Pass (then (and (forEach Site (sites Next) (if (is Occupied (site)) (fromTo (from (site)) (to (handSite Next)) count:(count at:(site))))) (if (< (\"PiecesOwnedBy\" P1) (\"PiecesOwnedBy\" P2)) (set NextPlayer (player 1)) (set NextPlayer (player 2)))))))) (nextPhase (was Pass) \"PlacementLosingPlayer\")) (phase \"PlacementLosingPlayer\" (play (move (from (handSite Mover)) (to (sites Mover)) (then (if (\"HandEmpty\" Mover) (forEach Site (sites Mover) (if (is Occupied (site)) (fromTo (from Cell (handSite Next)) (to (\"OppositePitTwoRows\" (site))) count:(count at:(site))))) (moveAgain))))) (nextPhase (\"HandEmpty\" Mover) \"Sowing\"))} (end (forEach Player if:(= 0 (\"PiecesOwnedBy\" Player)) (result Player Loss))))) 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 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": "Construct a Ludii game based on the following description\n2x7 board. Four counters in each hole. Sowing occurs in an anti-clockwise direction and begins from one of the holes in the player's row. When the final counter lands in an occupied hole, these are picked up and sowing continues. If the occupied hole has three counters (four including the final counter from the sowing), these are captured. Then, the player picks up the counters in the next hole after the one from which the capture was made and continues sowing from there. When the final counter lands into an empty hole the turn ends. The game ends when one player no longer has any counters on their side of the board. The opponent then captures the remaining counters on the board. A new game begins, with each player filling holes with the counters they captured, four to each hole. The player now controls as many holes as they can fill with counters. Play begins with the player who played second in the previous game. Subsequent games are played until one player captures all of the holes, becoming the winner. \n\n###\n\n", "completion": "(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 \"OneRowIsEmpty\" (or (all Sites (sites P1) if:(= 0 (count at:(site)))) (all Sites (sites P2) if:(= 0 (count at:(site)))))) (define \"NextHoleFrom\" (\"NextSiteOnTrack\" #2 from:#1)) (define \"PiecesOwnedBy\" (+ (count Cell at:(handSite #1)) (count in:(sites #1 \"Home\")))) (game \"Motiq\" (players 2) (equipment { (mancalaBoard 2 7 store:None (track \"Track\" \"0,E,N,W\" loop:True)) (regions \"Home\" P1 (sites Bottom)) (regions \"Home\" P2 (sites Top)) (piece \"Seed\" Shared) (hand Each)}) (rules (start { (set Count 4 to:(sites Track)) (set RememberValue \"OwnedP1\" (sites Bottom)) (set RememberValue \"OwnedP2\" (sites Top))}) phases:{ (phase \"Sowing\" (play (or { (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (\"OwnedHoles\")) if:(is Occupied (from))) (then (sow apply:(if (= 4 (count at:(to))) (and (fromTo (from (to)) (to (handSite Mover)) count:4) (if (is Occupied (\"NextHoleFrom\" (to) 1)) (and (moveAgain) (set Var \"Replay\" (\"NextHoleFrom\" (to) 1))))) (if (< 1 (count at:(to))) (and (moveAgain) (set Var \"Replay\" (to))))))))} (then (if (\"OneRowIsEmpty\") (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)))) (forget Value \"OwnedP1\" All) (forget Value \"OwnedP2\" All)}))))) (end (if (\"NoPieceOnBoard\") { (if (> 4 (count Cell at:(handSite P1))) (result P2 Win)) (if (> 4 (count Cell at:(handSite P2))) (result P1 Win))})) (nextPhase (\"NoPieceOnBoard\") \"BetweenRounds\")) (phase \"BetweenRounds\" (play (if (<= 4 (count Cell at:(handSite Mover))) (move (from (handSite Mover)) (to (if (all Sites (sites Mover) if:(is Occupied (site))) (sites Board) (sites Mover)) if:(is Empty (to))) count:4 (then (\"RemmemberOwnedHoles\" (last To)))))) (nextPhase (all Passed) \"Sowing\"))})) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game is played on a 9x9 board. -> The game is played on a 15x15 board.\nThree players. -> Four players.\n(define \"AlternateRegions\" (regions \"Centre\" (sites Centre)) (regions \"CentreRing\" (difference (expand (sites Centre)) (sites Centre))) (regions \"CornerSites\" (sites {\"B2\" \"J2\" \"R2\" \"B10\" \"R10\" \"B18\" \"J18\" \"R18\"})) (regions \"DotSites\" (sites {\"F6\" \"J6\" \"N6\" \"N10\" \"F10\" \"F14\" \"J14\" \"N14\"})) (regions \"OuterGoals\" (difference (expand (sites \"CornerSites\")) (sites \"CornerSites\")))) (define \"RegularRegions\" (regions \"Centre\" (sites Centre)) (regions \"CentreRing\" (difference (expand (sites Centre)) (sites Centre))) (regions \"OuterGoals\" (expand (sites Corners)))) (define \"Nbors\" (count Sites in:(intersection (sites Around #1) (sites Occupied by:All)))) (game \"Abak\" (players 3) (equipment { (board (square 9)) (piece \"Disc\" Each) \"RegularRegions\"}) (rules phases: { (phase \"Placement\" (play (move Add (to (intersection (sites \"CentreRing\") (sites Empty))))) (nextPhase (= (count Pieces All) 3) \"Movement\")) (phase \"Movement\" (play (move Add (to (difference (sites Playable) (sites Centre))) (then (forEach Site (sites Occupied by:All) (if (<= 4 (\"Nbors\" (to))) (remove (to))) (then (forEach Site (sites Occupied by:All) (if (= 0 (\"Nbors\" (to))) (remove (to))))))))))} (end (if (is Connected {(sites \"CentreRing\") (sites \"OuterGoals\")}) (result Mover Win)))))\n\n###\n\n", "completion": "(define \"AlternateRegions\" (regions \"Centre\" (sites Centre)) (regions \"CentreRing\" (difference (expand (sites Centre)) (sites Centre))) (regions \"CornerSites\" (sites {\"B2\" \"J2\" \"R2\" \"B10\" \"R10\" \"B18\" \"J18\" \"R18\"})) (regions \"DotSites\" (sites {\"F6\" \"J6\" \"N6\" \"N10\" \"F10\" \"F14\" \"J14\" \"N14\"})) (regions \"OuterGoals\" (difference (expand (sites \"CornerSites\")) (sites \"CornerSites\")))) (define \"RegularRegions\" (regions \"Centre\" (sites Centre)) (regions \"CentreRing\" (difference (expand (sites Centre)) (sites Centre))) (regions \"OuterGoals\" (expand (sites Corners)))) (define \"Nbors\" (count Sites in:(intersection (sites Around #1) (sites Occupied by:All)))) (game \"Abak\" (players 4) (equipment { (board (square 15)) (piece \"Disc\" Each) \"RegularRegions\"}) (rules phases: { (phase \"Placement\" (play (move Add (to (intersection (sites \"CentreRing\") (sites Empty))))) (nextPhase (= (count Pieces All) 4) \"Movement\")) (phase \"Movement\" (play (move Add (to (difference (sites Playable) (sites Centre))) (then (forEach Site (sites Occupied by:All) (if (<= 4 (\"Nbors\" (to))) (remove (to))) (then (forEach Site (sites Occupied by:All) (if (= 0 (\"Nbors\" (to))) (remove (to))))))))))} (end (if (is Connected {(sites \"CentreRing\") (sites \"OuterGoals\")}) (result Mover Win))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nEach player has 13 holes. -> Each player has 14 holes.\n(define \"PiecesOwnedBy\" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (define \"MoveAgainAfterCapture\" (is Pending)) (define \"PlayFromNextHole\" (sites {(value Pending)})) (define \"NextHole\" (if (is Mover P1) (\"NextSiteOnTrack\" 1 from:(to) \"Track1\") (\"NextSiteOnTrack\" 1 from:(to) \"Track2\"))) (define \"Columns\" 13) (game \"Owela (Benguela)\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"0,E,N1,W\" loop:True P1) (track \"Track2\" \"26,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)) (regions \"InnerInit\" P1 (sites {21..25})) (regions \"InnerInit\" P2 (sites {26..30})) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 2 to:(union {(sites P1 \"Outer\") (sites P1 \"InnerInit\") (sites P2 \"Outer\") (sites P2 \"InnerInit\")}))) (play (move Select (from (if (\"SameTurn\") (if \"MoveAgainAfterCapture\" \"PlayFromNextHole\" \"LastHoleSowed\") (sites Mover \"Home\")) if:(> (count at:(from)) 1)) (then (sow \"Track\" owner:(mover) apply:(if (> (count at:(to)) 1) (if (and (is In (to) (sites Mover \"Inner\")) (> (count at:(\"OppositePit\" (to))) 0)) (and { (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))) (fromTo (from (\"OppositePit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePit\" (to)))) (if (> (count at:(\"OppositeOuterPit\" (to))) 0) (fromTo (from (\"OppositeOuterPit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositeOuterPit\" (to))))) (if (> (count at:\"NextHole\") 1) (and (set Pending \"NextHole\") (moveAgain)))}) (moveAgain))))))) (end (\"MancalaByScoreWhen\" (no Moves Mover)))))\n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (define \"MoveAgainAfterCapture\" (is Pending)) (define \"PlayFromNextHole\" (sites {(value Pending)})) (define \"NextHole\" (if (is Mover P1) (\"NextSiteOnTrack\" 1 from:(to) \"Track1\") (\"NextSiteOnTrack\" 1 from:(to) \"Track2\"))) (define \"Columns\" 14) (game \"Owela (Benguela)\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"0,E,N1,W\" loop:True P1) (track \"Track2\" \"28,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)) (regions \"InnerInit\" P1 (sites {24..27})) (regions \"InnerInit\" P2 (sites {28..31})) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 2 to:(union {(sites P1 \"Outer\") (sites P1 \"InnerInit\") (sites P2 \"Outer\") (sites P2 \"InnerInit\")}))) (play (move Select (from (if (\"SameTurn\") (if \"MoveAgainAfterCapture\" \"PlayFromNextHole\" \"LastHoleSowed\") (sites Mover \"Home\")) if:(> (count at:(from)) 1)) (then (sow \"Track\" owner:(mover) apply:(if (> (count at:(to)) 1) (if (and (is In (to) (sites Mover \"Inner\")) (> (count at:(\"OppositePit\" (to))) 0)) (and { (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))) (fromTo (from (\"OppositePit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePit\" (to)))) (if (> (count at:(\"OppositeOuterPit\" (to))) 0) (fromTo (from (\"OppositeOuterPit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositeOuterPit\" (to))))) (if (> (count at:\"NextHole\") 1) (and (set Pending \"NextHole\") (moveAgain)))}) (moveAgain))))))) (end (\"MancalaByScoreWhen\" (no Moves Mover))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n8x8 board. Each player begins with sixteen pieces with special moves: Khoon (x1): moves orthogonally in any direction; Met (x1): placed to the right of the Khoon, moves one square orthogonally or diagonally forward, or one square diagonally backward, may move two squares orthogonally forward on the first move; Khon (x2): moves one square forward orthogonally or diagonally, may move backward diagonally but not to capture; Maa (x2): moves as a Chess knight; Rooa (x2): moves orthogonally any distance; Bea (x8): move forward one space, but capture diagonally. When they reach the opposite edge of the board, they are promoted to Met. They begin on the third row of the board with respect to each player. When the Khoon is threatened, it is in check and the player's next move must be to remove the check. If the player cannot, it is checkmate and the player loses. If there are no legal moves, the game is a draw. If one player has only a king left, the opponent must checkmate it within a set number of turns, based on the highest ranking piece left on the board, minus the total number of pieces on the board. The values are: two Rooa: eight; one Rooa, sixteen, two Khon, 22; one Khon, 44; two Maa, 33; one Maa, 66; Met and two Bea, 88; one each of Met, Rooa, Maa, Khon, sixteen. With only a Met, the game is a draw. \n\n###\n\n", "completion": "(game \"Mak Ruk\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (\"ChessPawn\" \"Pawn\" ~ (then (\"PromoteIfReach\" (sites Mover \"Promotion\") \"Ferz_noCross\"))) (\"ChessRook\" \"Rook\") (piece \"King_noCross\" Each (\"StepToNotFriend\" Orthogonal)) (piece \"Bishop_noCross\" Each (or (\"StepToNotFriend\" (directions {FL FR Forward})) (\"StepToEmpty\" (directions {BL BR})))) (\"ChessKnight\" \"Knight\") (piece \"Ferz_noCross\" Each (or (if (= (state at:(from)) 1) (move (from) (to (ahead (ahead (from) N) N) if:(is Empty (to)))) (then (set State at:(last To) 0))) (\"StepToNotFriend\" (directions {BL BR FL FR Forward})))) (regions \"Promotion\" P1 (sites Top)) (regions \"Promotion\" P2 (sites Bottom))}) (rules (start { (place \"Pawn1\" (sites Row 2)) (place \"Pawn2\" (sites Row 5)) (place \"Rook1\" {\"A1\" \"H1\"}) (place \"Knight1\" {\"B1\" \"G1\"}) (place \"Bishop_noCross1\" {\"C1\" \"F1\"}) (place \"Ferz_noCross1\" coord:\"E1\" state:1) (place \"King_noCross1\" coord:\"D1\") (place \"Rook2\" {\"A8\" \"H8\"}) (place \"Knight2\" {\"B8\" \"G8\"}) (place \"Bishop_noCross2\" {\"C8\" \"F8\"}) (place \"Ferz_noCross2\" coord:\"D8\" state:1) (place \"King_noCross2\" coord:\"E8\")}) (play (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King_noCross\" Mover)))) (end { (\"Checkmate\" \"King_noCross\") (\"DrawIfNoMoves\" Next) (if (and {(= (count Pieces Next) 1) (= (count Pieces Mover) 2) (\"IsNotOffBoard\" (where \"Ferz_noCross\" Mover))}) (result Mover Draw))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nA vertical line, with seven lines perpendicularly crossing it at equal intervals. Six pieces, three of one color and three of another. The three of one color are placed on the top three intersections, the three of the other color on the bottom three intersections. In the first move, one piece is moved to the center line, from one of the two lines adjacent to it. Pieces may move to an empty adjacent point, or may jump over a piece of the other color to an empty point. The goal is to place the pieces on the spaces where the pieces of the opposite color started the game. \n\n###\n\n", "completion": "(define \"HopPiece\" (move Hop (from) (between if:(\"IsFriendAt\" (between))) (to if:(is Empty (to))))) (game \"Mawryngkneng Solitaire Game\" (players 1) (equipment { (board (add (rectangle 7 1) vertices:{ {0.0 -1.0} {-1.0 0.0} {1.0 0.0} {-1.0 1.0} {1.0 1.0} {-1.0 2.0} {1.0 2.0} {-1.0 3.0} {1.0 3.0} {-1.0 4.0} {1.0 4.0} {-1.0 5.0} {1.0 5.0} {-1.0 6.0} {1.0 6.0} {0.0 7.0}}) use:Vertex) (piece \"Marker1\" P1 (or (\"StepToEmpty\") (\"HopPiece\"))) (piece \"Marker2\" P1 (or (\"StepToEmpty\") (\"HopPiece\")))}) (rules (start { (place \"Marker1\" (expand (sites {0}) steps:2)) (place \"Marker2\" (expand (sites {6}) steps:2))}) phases:{ (phase \"Opening\" (play (forEach Piece (\"StepToEmpty\"))) (nextPhase \"Solving\")) (phase \"Solving\" (play (forEach Piece)))} (end (if (is Target {2 2 2 0 1 1 1} {0 1 2 3 4 5 6}) (result P1 Win))))) 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 \"Cram\" (players 2) (equipment { (board (rectangle 1 2)) (tile \"Tile\" P1 {F} numSides:4) (tile \"Tile\" P2 {F} numSides:4)}) (rules (play (or (move Add (piece (mover) state:0) (to (sites Empty))) (move Add (piece (mover) state:1) (to (sites Empty))))) (end (\"NoMoves\" Loss))))\n\n###\n\n", "completion": "(game \"Cram\" (players 2) (equipment { (board (rectangle 2 3)) (tile \"Tile\" P1 {F} numSides:4) (tile \"Tile\" P2 {F} numSides:4)}) (rules (play (or (move Add (piece (mover) state:0) (to (sites Empty))) (move Add (piece (mover) state:1) (to (sites Empty))))) (end (\"NoMoves\" Loss)))) END" }, { "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": "Describe the mechanics of the following Ludii game\n(define \"EmptyOrNeutralPiece\" (= (who at:(to)) 0)) (define \"LevelBetweenGroundAndDestinationPlusOne\" (<= (- (size Stack at:(to)) (topLevel at:(from))) 1)) (game \"Santorini\" (players 2) (equipment { (board (square 5)) (hand Each) (map {(pair 0 \"SquareLarge0\") (pair 1 \"SquareSmall0\") (pair 2 \"Octagon0\") (pair 3 \"Marker0\")}) (piece \"Pawn3d\" Each (move Step (to if:(and (\"LevelBetweenGroundAndDestinationPlusOne\") (\"EmptyOrNeutralPiece\"))) (then (moveAgain)))) (piece \"SquareLarge\" Neutral) (piece \"SquareSmall\" Neutral) (piece \"Octagon\" Neutral) (piece \"Marker\" Neutral)}) (rules (start { (place Stack \"Pawn3d1\" (handSite P1) count:2) (place Stack \"Pawn3d2\" (handSite P2) count:2)}) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (sites Empty)) (then (if (\"HandOccupied\" Mover) (moveAgain))))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (phase \"Movement\" (play (if (\"SameTurn\") (move Select (from (sites Around (last To) if:(and (< (size Stack at:(to)) 4) (\"EmptyOrNeutralPiece\")))) (then (add (piece (mapEntry (size Stack at:(last To)))) (to (last To)) stack:True))) (forEach Piece))))} (end { (if (and (= 3 (topLevel at:(last To))) (\"IsPieceAt\" \"Pawn3d\" Mover (last To) level:(topLevel at:(last To)))) (result Mover Win)) (if (no Moves P1) (result P2 Win)) (if (no Moves P2) (result P1 Win))})))\n\n###\n\n", "completion": "The game is played on a 5x5 grid where each turn players build a town by placing building pieces up to four levels high. To win the game, players must move one of their two workers to the third level of the town.\n \n Beginning turns :\n The first player places his two workers on the board, then the second does the same.\n \n Normal turns :\n Each turn, the current player moves one of his two workers in an adjacent position (in horizontal, vertical or diagonal, i.e. king chess move) then he places a building tile adjacent to the moved worker (in a horizontal, vertical or diagonal adjacent position). The level of a position (i.e. a grid square) is the number of tiles.\n Workers can move onto a position with zero, one, two, or three tiles (but not with four tiles) only if the level of the destination position is less than or equal to the level of departure destination plus one. There can be no more than 4 tiles per position.\n The primary winning condition is to get one of his workers onto the third level (i.e. on a position with three tiles), though players may also win if their opponent is unable to make a move. END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"Morabaraba\" (players 2) (equipment { (board (remove (add (concentric Square rings:3 joinCorners:True) vertices:{{0 0}} edges:{{11 24} {16 24} {7 24} {12 24}}) edges:{{3 6} {8 5} {17 20} {15 18}}) use:Vertex) (hand Each) (piece \"Marker\" Each (if (> (count Pieces Mover) 3) (\"StepToEmpty\") (move (from) (to (sites Empty))) (then (\"ReplayIfLine3\"))))}) (rules (start (place \"Marker\" \"Hand\" count:12)) phases:{ (phase \"Placement\" (play (if \"SameTurn\" (\"RemoveAnyEnemyPieceNotInLine3\") (move (from (handSite Mover)) (to (sites Empty)) (then (\"ReplayIfLine3\"))))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (phase \"Movement\" (play (if \"SameTurn\" (\"RemoveAnyEnemyPieceNotInLine3\") (forEach Piece))))} (end (\"HavingLessPiecesLoss\" Next 2))))\n\n###\n\n", "completion": "Three concentric squares, with lines connecting the midpoints of the squares with the center of the square and four lines connecting the corners of the outer two squares. Twelve pieces per player. In the first phase, players take turns placing pieces on an empty spot on the board. If they place three pieces so they are in a line, forming a \\ END" }, { "prompt": "Construct a Ludii game based on the following description\nThe board is rectangular, with six points on either side, with each side divided in half by two short parallel lines, which are the \\ Each team has 10 scoring sticks.\n\n###\n\n", "completion": "(define \"Move\" (if (\"IsEndTrack\" (\"SiteToMoveOnTrack\" from:(from) (\"ThrowValue\"))) (move Remove (from) (then (if (is Occupied (handSite (\"HandTeam\"))) (fromTo (from (handSite (\"HandTeam\"))) (to (mapEntry \"Start\" (\"HandTeam\"))))))) (move (from (from)) (to (\"SiteToMoveOnTrack\" from:(from) (\"ThrowValue\")) if:True (\"HittingCapture\" (mapEntry \"Start\" (who at:(to))))) (then (if (= (last To) (mapEntry \"Opposite\" Mover)) (fromTo (from (last To)) (to (mapEntry \"Start\" Mover)))))))) (define \"HandTeam\" (if (or (is Mover P1) (is Mover P2)) 1 3)) (define \"ReplayThrow\" (or { (= (\"ThrowValue\") 6) (= (\"ThrowValue\") 10) (and (= 1 (\"SaheValue\")) (= (\"ThrowValue\") 1)) (and (= 1 (\"SaheValue\")) (= (\"ThrowValue\") 3))})) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" #2 #1)) (define \"ThrowValue\" (mapEntry \"Throw\" (count Pips))) (define \"SaheValue\" (face 57)) (game \"Nebakuthana\" (players 4) (equipment { (board (graph vertices:{ {0 0} {2 0} {3 0.33} {4 0.33} {5 0.33} {6 0} {7 0} {8 0.33} {9 0.33} {10 0.33} {11 0} {13 0} {0 2} {6 2} {7 2} {13 2} {0.33 3} {12.66 3} {0.33 4} {12.66 4} {0.33 5} {12.66 5} {0 6} {2 6} {11 6} {13 6} {0 7} {2 7} {11 7} {13 7} {0.33 8} {12.66 8} {0.33 9} {12.66 9} {0.33 10} {12.66 10} {0 11} {6 11} {7 11} {13 11} {0 13} {2 13} {3 12.66} {4 12.66} {5 12.66} {6 13} {7 13} {8 12.66} {9 12.66} {10 12.66} {11 13} {13 13}} edges:{ {0 1} {1 5} {5 13} {6 14} {5 6} {6 10} {10 11} {12 1} {0 12} {10 15} {15 11} {12 22} {22 26} {22 23} {26 27} {26 36} {36 40} {15 25} {25 29} {24 25} {28 29} {29 39} {39 51} {40 41} {36 41} {39 50} {50 51} {41 45} {45 46} {45 37} {46 38} {46 50}}) { (track \"Track1\" \"6,7,8,9,10,15,17,19,21,25,29,31,33,35,39,50,49,48,47,46,45,44,43,42,41,36,34,32,30,26,22,20,18,16,12,1,2,3,4,End\" P1 directed:True) (track \"Track2\" \"6,7,8,9,10,15,17,19,21,25,29,31,33,35,39,50,49,48,47,46,45,44,43,42,41,36,34,32,30,26,22,20,18,16,12,1,2,3,4,End\" P2 directed:True) (track \"Track3\" \"5,4,3,2,1,12,16,18,20,22,26,30,32,34,36,41,42,43,44,45,46,47,48,49,50,39,35,33,31,29,25,21,19,17,15,10,9,8,7,End\" P3 directed:True) (track \"Track4\" \"5,4,3,2,1,12,16,18,20,22,26,30,32,34,36,41,42,43,44,45,46,47,48,49,50,39,35,33,31,29,25,21,19,17,15,10,9,8,7,End\" P4 directed:True)} use:Vertex) (piece \"Stick\" P1 (\"Move\")) (piece \"Stick\" P3 (\"Move\")) (\"StickDice\" 4) (hand P1) (hand P3) (map \"Throw\" {(pair 0 10) (pair 1 1) (pair 2 2) (pair 3 3) (pair 4 6)}) (map \"Start\" {(pair P1 6) (pair P2 6) (pair P3 5) (pair P4 5)}) (map \"Opposite\" {(pair P1 46) (pair P2 46) (pair P3 45) (pair P4 45)})}) (rules (start { (set Team 1 {P1 P2}) (set Team 2 {P3 P4}) (place \"Stick1\" 6) (place \"Stick3\" 5) (place \"Stick1\" (handSite P1) count:10) (place \"Stick3\" (handSite P3) count:10)}) (play (\"RollMove\" (if (or (is Mover P1) (is Mover P2)) (forEach Piece P1) (forEach Piece P3)) (then (if (\"ReplayThrow\") (moveAgain))))) (end (\"EscapeTeamWin\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\n1) When castling king moves 3 squares towards either rook. 2) Both bishops of each player cannot run along squares of a same color. One of them must change in such a manner that it transits through squares of the other color. Being in its original square without having been moved before, it will take an orthogonal step towards any of the 3 surrounding squares that are of the other color, provided that these are empty. This special move is called conversion and it must be done as an ordinary move during the game. \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 \"BigCastling\" (\"DecideToCastle\" \"King\" W 3 \"KingNotCheckedAndToEmpty\" (then (\"CastleRook\" \"RookLeft\" E 2 True)))) (define \"SmallCastling\" (\"DecideToCastle\" \"King\" E 3 \"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 \"Symmetric Chess\" (\"TwoPlayersNorthSouth\") (equipment { (board (rectangle 8 9)) (\"ChessPawn\" \"Pawn\" (or \"InitialPawnMove\" \"EnPassant\") (then (and (\"ReplayInMovingOn\" (sites Mover \"Promotion\")) (set Counter)))) (\"ChessRook\" \"Rook\" (then (set Counter)) (\"RememberPieceHasMoved\")) (\"ChessKing\" \"King\" (then (set Counter)) (\"RememberPieceHasMoved\")) (piece \"Bishop\" Each (or { (\"SlideCapture\" (from if:(!= (state at:(from)) 2)) Diagonal (then (set Counter)) (then (and (forEach Site (sites Occupied by:Mover component:\"Bishop\") (set State at:(site) 2)) (set State at:(last To) 0)))) (move Step Orthogonal (to if:(and (not (\"IsFriendAt\" (to))) (!= (state at:(from)) 0)) (apply (if (\"IsEnemyAt\" (to)) (remove (to) (then (set Counter)))))) (then (forEach Site (sites Occupied by:Mover component:\"Bishop\") (set State at:(site) 0))))})) (\"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 \"I1\") (pair 2 \"I8\")}) (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\" \"I1\"} state:1) (place \"Knight1\" {\"B1\" \"H1\"}) (place \"Bishop1\" {\"C1\" \"G1\"} state:1) (place \"Queen1\" {\"D1\" \"F1\"}) (place \"King1\" coord:\"E1\" state:1) (place \"Rook2\" {\"A8\" \"I8\"} state:1) (place \"Knight2\" {\"B8\" \"H8\"}) (place \"Bishop2\" {\"C8\" \"G8\"} state:1) (place \"Queen2\" {\"D8\" \"F8\"}) (place \"King2\" coord:\"E8\" state:1)}) (play (if \"SameTurn\" (move Promote (last To) (piece {\"Queen\" \"Knight\" \"Bishop\" \"Rook\"}) Mover) (do (or (forEach Piece) (if (and (\"HasNeverMoved\" \"King\") (not (\"IsInCheck\" \"King\" Mover))) (or (if (and (\"HasNeverMoved\" \"RookLeft\") (can Move (\"CastleRook\" \"RookLeft\" E 2 (is Empty (to))))) \"BigCastling\") (if (and (\"HasNeverMoved\" \"RookRight\") (can Move (\"CastleRook\" \"RookRight\" W 2 (is Empty (to))))) \"SmallCastling\")))) ifAfterwards:(not (\"IsInCheck\" \"King\" Mover))))) (end { (\"Checkmate\" \"King\") (if (or (no Moves Mover) (= (counter) 99)) (result Mover Draw))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\n- BOARDS: The stones in each board are responsible for the moving possibilities of the stones in the next board (clockwise direction).\n E.g., board NW position determines the moves for board NE.\n \n - MOVE: Every stone allows the stones in the next board to move according to its position (using the red point as a reference point).\n E.g., A stone on b3, allows that player to move any stone in the next board one step to the left. A stone on e5 allows any stone in the next board to move two steps diagonally to the top right.\n A stone on a red point is useless for the moves in the next board .\n \n - TURN: On his turn a player must do one of two actions:\n Drop: The player drops a friendly stone on an empty cell. If there are no more offboard stones, he cannot choose this action.\n Move: The player moves a stone according to the moving rules. To move a stone there must be a friendly stone in the previous board.\n The move is only allowed if the moving stone stays in the same board.\n Stones jump. So if a stone moves from a5 to c5 (only possible if there is a friendly stone on e3 at the previous board) the status of b5 is irrelevant.\n The destination cell must be empty or occupied with an opponent stone, which is captured and removed from play.\n \n - GOAL: A player with no legal moves loses. \n\n###\n\n", "completion": "(define \"HopMove\" (move Hop #1 (between if:True) (to if:(and (not (\"IsFriendAt\" (to))) (\"IsFriendAt\" (ahead (coord #2) steps:2 #1))) (apply (if (\"IsEnemyAt\" (to)) (remove (to))))))) (define \"StepMove\" (move Step #1 (to if:(and (not (\"IsFriendAt\" (to))) (\"IsFriendAt\" (ahead (coord #2) #1))) (apply (if (\"IsEnemyAt\" (to)) (remove (to))))))) (game \"4 Squared\" (players 2) (equipment { (board (merge { (square 5) (shift 5 0 (square 5)) (shift 0 5 (square 5)) (shift 5 5 (square 5))}) use:Vertex) (piece \"Ball\" Each (if (is In (from) (sites \"SW\")) (or { (\"StepMove\" S \"H3\") (\"StepMove\" SE \"H3\") (\"StepMove\" SW \"H3\") (\"StepMove\" E \"H3\") (\"StepMove\" W \"H3\") (\"StepMove\" NE \"H3\") (\"StepMove\" NW \"H3\") (\"StepMove\" N \"H3\") (\"HopMove\" S \"H3\") (\"HopMove\" SE \"H3\") (\"HopMove\" SW \"H3\") (\"HopMove\" E \"H3\") (\"HopMove\" W \"H3\") (\"HopMove\" NE \"H3\") (\"HopMove\" NW \"H3\") (\"HopMove\" N \"H3\")}) (if (is In (from) (sites \"NW\")) (or { (\"StepMove\" S \"C3\") (\"StepMove\" SE \"C3\") (\"StepMove\" SW \"C3\") (\"StepMove\" E \"C3\") (\"StepMove\" W \"C3\") (\"StepMove\" NE \"C3\") (\"StepMove\" NW \"C3\") (\"StepMove\" N \"C3\") (\"HopMove\" S \"C3\") (\"HopMove\" SE \"C3\") (\"HopMove\" SW \"C3\") (\"HopMove\" E \"C3\") (\"HopMove\" W \"C3\") (\"HopMove\" NE \"C3\") (\"HopMove\" NW \"C3\") (\"HopMove\" N \"C3\")}) (if (is In (from) (sites \"NE\")) (or { (\"StepMove\" S \"C8\") (\"StepMove\" SE \"C8\") (\"StepMove\" SW \"C8\") (\"StepMove\" E \"C8\") (\"StepMove\" W \"C8\") (\"StepMove\" NE \"C8\") (\"StepMove\" NW \"C8\") (\"StepMove\" N \"C8\") (\"HopMove\" S \"C8\") (\"HopMove\" SE \"C8\") (\"HopMove\" SW \"C8\") (\"HopMove\" E \"C8\") (\"HopMove\" W \"C8\") (\"HopMove\" NE \"C8\") (\"HopMove\" NW \"C8\") (\"HopMove\" N \"C8\")}) (if (is In (from) (sites \"SE\")) (or { (\"StepMove\" S \"H8\") (\"StepMove\" SE \"H8\") (\"StepMove\" SW \"H8\") (\"StepMove\" E \"H8\") (\"StepMove\" W \"H8\") (\"StepMove\" NE \"H8\") (\"StepMove\" NW \"H8\") (\"StepMove\" N \"H8\") (\"HopMove\" S \"H8\") (\"HopMove\" SE \"H8\") (\"HopMove\" SW \"H8\") (\"HopMove\" E \"H8\") (\"HopMove\" W \"H8\") (\"HopMove\" NE \"H8\") (\"HopMove\" NW \"H8\") (\"HopMove\" N \"H8\")})))))) (hand Each) (regions \"SW\" (expand origin:(coord \"C3\") steps:2 All)) (regions \"SE\" (expand origin:(coord \"H3\") steps:2 All)) (regions \"NW\" (expand origin:(coord \"C8\") steps:2 All)) (regions \"NE\" (expand origin:(coord \"H8\") steps:2 All))}) (rules (start (place \"Ball\" \"Hand\" count:15)) (play (or (forEach Piece) (if (is Occupied (handSite Mover)) (move (from (handSite Mover)) (to (sites Empty)))))) (end (\"BlockWin\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\n5x5 board, played on intersections of the lines, with diagonals for each quadrant of the board. One player plays as four tigers, the other as twenty goats. The tigers begin, two on the top two corners of the board, and two in the centers of the two bottom quadrants. Four of the goats are placed on any available points. The tigers move first, to an empty adjacent spot along the lines on the board. The player playing as the goats places one of the remaining goats on any available point. The goats cannot move until all of the goats are placed. Once they are all placed, the goats move as the tigers do. The tigers alone may capture a goat by hopping over it to an empty spot immediately opposite a goat. The tigers win by capturing all the goats; the goats win by blocking the tigers from being able to move. \n\n###\n\n", "completion": "(game \"Orissa Tiger Game (Four Tigers)\" (players 2) (equipment { (\"AlquerqueBoard\" 5 5) (piece \"Goat\" P1 (\"StepToEmpty\")) (piece \"Tiger\" P2 (or (\"StepToEmpty\") (\"HopCapture\"))) (hand P1)}) (rules (start { (place \"Goat1\" (handSite P1) count:20) (place \"Tiger2\" (sites {\"A5\" \"E5\" \"B2\" \"D2\"}))}) phases:{ (phase \"Placement\" P1 (play (move (from (handSite P1)) (to (sites Empty)) (then (if (< 16 (count Cell at:(handSite P1))) (moveAgain))))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (\"PhaseMovePiece\" \"Movement\")} (end (\"NoMovesP2NoPiecesP1\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\n7x7 board. 24 pieces per player. Players alternate turns placing two pieces on the board. The first piece of each player must be placed on a spot adjacent to the central spot. The central spot cannot be filled. When both players have placed their pieces, they move their pieces orthogonally to an empty adjacent space. When an opponent's piece is surrounded on two opposite sides by pieces belonging to the player, the opponent's piece is captured. The player who made the capture may move the same piece they moved to make a capture another time if another capture is possible by doing so. \n \n The player who captures all of their opponent's pieces, or which blocks the opponent from being able to move, wins. \n \n In a case where the second player has created a blockade of their pieces containing one or more of only their own pieces which can move infinitely without possibility of being taken, the second player player may declare H'ajeb in order to regain the possibility of winning. The second player declares H'ajeb on their turn, and then the first player gains the ability to move any distance orthogonally or diagonally. The first player may also make multiple captures not just with the same piece, but with more than one. The second player may rescind the H'ajeb declaration at any time and the captures must stop. If the second player allows the first player to continue until the first player cannot capture, the second player captures any two of the first player's pieces, and the first player captures one of the second player's pieces that is able to move infinitely. \n\n###\n\n", "completion": "(define \"CanCaptureAgain\" (can Move (step (from (last To)) Orthogonal (to if:(\"IsConfigurationToCustodialAgain\"))))) (define \"IsConfigurationToCustodialAgain\" (and (is Empty (to)) (or { (and (\"IsEnemyAt\" (ahead (to) W)) (\"IsFriendAt\" (ahead (to) steps:2 W))) (and (\"IsEnemyAt\" (ahead (to) E)) (\"IsFriendAt\" (ahead (to) steps:2 E))) (and (\"IsEnemyAt\" (ahead (to) N)) (\"IsFriendAt\" (ahead (to) steps:2 N))) (and (\"IsEnemyAt\" (ahead (to) S)) (\"IsFriendAt\" (ahead (to) steps:2 S)))}))) (game \"Khamousiyya\" (players 2) (equipment { (board (square 7)) (piece \"Marker\" Each (\"StepToEmpty\" Orthogonal (then (\"CustodialCapture\" Orthogonal (max 1) (then (if (\"CanCaptureAgain\") (moveAgain))))))) (hand Each)}) (rules (start (place \"Marker\" \"Hand\" count:24)) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (if (no Pieces Mover in:(sites Board)) (forEach (sites Around (centrePoint) Orthogonal) if:(is Empty (site))) (difference (sites Board) (centrePoint))) if:(is Empty (to))) (then (if (\"NewTurn\") (moveAgain))))) (nextPhase Mover (is Empty (handSite Mover)) \"Capture\")) (phase \"Capture\" (play (if (\"SameTurn\") (or (move Step (from (last To)) Orthogonal (to if:(\"IsConfigurationToCustodialAgain\")) (then (\"CustodialCapture\" Orthogonal (max 1) (then (if (\"CanCaptureAgain\") (moveAgain)))))) (move Pass)) (forEach Piece))))} (end (\"BlockWin\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\n3x6 board. Three counters per hole. Each player owns the row closest to them and the right half of the central row. Sowing occurs in the following direction: from left to right in the player's full row, right to left in the player's half of the central row, proceeding to the opponent's full row and sowing right to left, then left to right in the opponent's part of the central row, then proceeding back to the player's full row and proceeding as before. Sowing always begins from a player's own holes. When the last counter falls into an empty hole, the turn ends. If the last counter falls into an occupied hole, the contents of that hole are picked up and sowing continues. A hole is captured by dropping the last counter of a sowing into an opponent's hole which contains three counters, making it have four counters, and becomes a wegue. Captures cannot be made until after the original three counters placed in the holes at the beginning of the game have been moved. Once a wegue is created, the player cannot sow from it. When the final counter of a sowing lands in a wegue owned by the opponent, the player captures two counters from it. Play continues until all of the counters are captured or all of the counters are accumulated in wegue. A new round begins. Players then collect the counters in their captured holes. They count their takings by filling their holes with three counters each as in the beginning, and the player would own every hole they could fill with three counters. If the player has two counters remaining, they also gain another hole and the opponent surrenders their extra counter. At the end of play, if a player captures the opponent's single remaining hole as a wegue, the player captured three counters from it, leaving one for the opponent to continue to play. Play continues until one player cannot fill any holes. \n\n###\n\n", "completion": "(define \"SitesMarkedBy\" (forEach (sites Board) if:(= #1 (state at:(site))))) (define \"LeftMostEmpty\" (trackSite FirstSite from:(mapEntry \"LeftMost\" Mover) if:(is Empty (to)))) (define \"OnlyPiecesInMarked\" (all Sites (forEach (sites Board) if:(= 0 (state at:(site)))) if:(= 0 (count at:(site))))) (define \"RemmemberOwnedHoles\" (if (is Mover P1) (remember Value \"OwnedP1\" #1) (remember Value \"OwnedP2\" #1))) (define \"OpponentOwnedHoles\" (if (is Mover P1) (sites (values Remembered \"OwnedP2\")) (sites (values Remembered \"OwnedP1\")))) (define \"OwnedHoles\" (if (is Mover P1) (sites (values Remembered \"OwnedP1\")) (sites (values Remembered \"OwnedP2\")))) (define \"Columns\" 6) (game \"Gabata (Adowa)\" (players 2) (equipment { (mancalaBoard 3 \"Columns\" store:None (track \"Track\" \"0,E,N1,W2,17,W,S1,E2\" loop:True)) (piece \"Seed\" Shared) (hand Each) (regions P1 (union (sites Bottom) (intersection (sites Row 1) (expand (sites Right) steps:2)))) (regions P2 (union (sites Top) (intersection (sites Row 1) (expand (sites Left) steps:2)))) (map \"LeftMost\" {(pair P1 0) (pair P2 17)})}) (rules (start { (set Count 3 to:(sites Track)) (set RememberValue \"OwnedP1\" (union (sites Bottom) (intersection (sites Row 1) (expand (sites Right) steps:2)))) (set RememberValue \"OwnedP2\" (union (sites Top) (intersection (sites Row 1) (expand (sites Left) steps:2))))}) phases:{ (phase \"Sowing\" (play (or { (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (\"OwnedHoles\")) if:(and (< 0 (count at:(from))) (= 0 (state at:(from))))) (then (sow apply:(if (and { (= 0 (state at:(to))) (= 4 (count at:(to))) (is In (to) (\"OpponentOwnedHoles\"))}) (set State at:(to) (mover)) (if (< 1 (count at:(to))) (if (= 0 (state at:(to))) (and { (moveAgain) (set Var \"Replay\" (to))}) (if (!= (mover) (state at:(to))) (and { (fromTo (from (to)) (to (handSite Mover)) count:(min 2 (count at:(to)))) (set State at:(to) (state at:(to)))}))))))))} (then (if (\"OnlyPiecesInMarked\") (and { (forEach Site (\"SitesMarkedBy\" 1) (fromTo (from (site)) (to (handSite P1)) count:(count at:(site)))) (forEach Site (\"SitesMarkedBy\" 2) (fromTo (from (site)) (to (handSite P2)) count:(count at:(site)))) (forget Value \"OwnedP1\" All) (forget Value \"OwnedP2\" All)}))))) (end (if (\"NoPieceOnBoard\") { (if (>= 1 (count Cell at:(handSite P1))) (result P2 Win)) (if (>= 1 (count Cell at:(handSite P2))) (result P1 Win))})) (nextPhase (\"NoPieceOnBoard\") \"BetweenRounds\")) (phase \"BetweenRounds\" (play (if (<= 3 (count Cell at:(handSite Mover))) (move (from (handSite Mover)) (to (\"LeftMostEmpty\")) count:3 (then (and { (\"RemmemberOwnedHoles\" (last To)) (if (<= 3 (count Cell at:(handSite Mover))) (moveAgain) (if (= 2 (count Cell at:(handSite Mover))) (and { (fromTo (from (handSite Mover)) (to (\"LeftMostEmpty\")) count:2) (fromTo (from (handSite Next)) (to (\"LeftMostEmpty\")) count:1) (\"RemmemberOwnedHoles\" (\"LeftMostEmpty\"))})))}))))) (nextPhase (and (is Empty (handSite P1)) (is Empty (handSite P2))) \"Sowing\"))})) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayers take turns placing one of their stones on an empty square. It is not legal to place orthogonally adjacent to only enemy stones and it is not legal to place orthogonally adjacent to more than 1 friendly stone. All other placements onto empty squares are legal. Put differently: You may place adjacent to no stone or to exactly 1 friendly and any number of enemy stones.\n The first player unable to place a stone has won the game. A 6x6 board is currently selected\n\n###\n\n", "completion": "(game \"Pathway\" (players 2) (equipment { (board (square 6)) (piece \"Disc\" Each)}) (rules (play (move Add (to (sites Empty) if:(or (all Sites (sites Around (to) Orthogonal) if:(is Empty (site))) (= 1 (count Sites in:(sites Around (to) Own Orthogonal))))))) (end (\"NoMoves\" Win)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nWhite starts and, in turn, pieces are placed on any one of 5 spaces, including on other pieces. The object is to get 3 same color pieces in a row - horizontally, vertically or diagonally. \n\n###\n\n", "completion": "(game \"Agilidade\" (players 2) (equipment { (board (skew .5 (scale 1 .5 (merge { (wedge 2 2) (shift 0 1 (rotate 180 (wedge 2 2)))}))) use:Vertex) (piece \"discFlat\" Each) (hand Each)}) (rules (start { (place Stack \"discFlat1\" (handSite P1) count:7) (place Stack \"discFlat2\" (handSite P2) count:7)}) (play (move (from (handSite Mover)) (to (sites Board)))) (end (if (is Line 3 byLevel:True) (result Mover Win))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"Selbia\" (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 diagonals in the square. Three pieces per player. Players alternate turns placing a piece on the board. The player who places three pieces in a row along one of the lines of the board wins. END" }, { "prompt": "Construct a Ludii game based on the following description\nThis game is played on a hexagonal board made up of hexagonal cells, usually 7 cells per side, although bigger sizes may also be used. Initially the board is empty except for the six corner cells, upon which black stones are placed. Then the players take it in turns to place 1-3 black stones each turn until one decides to pass; that player then becomes Black, and the other becomes White. After that, players take it in turns to place one stone of their colour on the board on any empty hex. If Black forms a continuous loop composed of their pieces, they win; if the board fills up with no loop of Black pieces being formed, White wins.\n \n During the initial chicken ballot phase, you may add stones by clicking on available spaces, or skip the rest of your placements (by choosing the Next Player action). Alternatively, you may Pass at the start of your turn to take Black. After that, you and your opponent will alternate playing one stone of your colour per turn, until the board is full or Black forms a loop. Played on a Hexagonal Board, pre-filled corners. The game is played on a board with 7 hexes per side.\n\n###\n\n", "completion": "(define \"IsPlayingPhase\" (= 1 (var))) (define \"LimpCorners\" (start { (place \"Disc2\" { 0 (- (/ (+ (* {3 #1 #1}) #1) 2) 1) (- (* 3 (* #1 #1)) #1)}) (place \"Disc2\" { #1 (/ (- (* {3 #1 #1}) (* 3 #1)) 2) (- (* 3 (* #1 #1)) 1)})})) (define \"Skip\" (move Set NextPlayer (player (next)))) (define \"HexCorners\" (start { (place \"Disc2\" { 0 (- (/ (- (* {3 #1 #1}) #1) 2) 1) (+ 1 (- (* {3 #1 #1}) (* 4 #1)))}) (place \"Disc2\" {(- #1 1) (+ 1 (/ (- (* {3 #1 #1}) (* 5 #1)) 2)) (- (* {3 #1 #1}) (* 3 #1))})})) (define \"BlackVC\" (is Loop)) (define \"WhiteVC\" (is Full)) (define \"NonAdjacent\" (not (is Within (id \"Disc\" P2) in:(sites Around (to))))) (define \"Size\" 7) (game \"Coil\" (players 2) (equipment { (board (hex Hexagon 7)) (piece \"Disc\" Each)}) (rules (\"HexCorners\" \"Size\") phases: { (phase \"Opening\" (play (or (or (move Add (piece (id \"Disc\" P2)) (to (sites Empty) if:\"NonAdjacent\") (then (if (< (count MovesThisTurn) 2) (moveAgain)))) \"Skip\") (if (= (count MovesThisTurn) 0) (move Pass (then (if (is Mover P1) (swap Players P1 P2 (then (note \"Player 1 is now Black. Player 2 is now White.\" to:All))) (note \"Player 1 remains White. Player 2 remains Black.\" to:All) (then (do (set NextPlayer (player 1)) next:(set Var 1))))))))) (nextPhase (\"IsPlayingPhase\") \"Playing\")) (phase \"Playing\" (play (move Add (to (sites Empty)))))} (end (forEach Player if:(and {(\"IsPlayingPhase\") (= (id Player) (mover)) (\"BlackVC\")}) (result Player Win))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game has 8 players. -> The game has 10 players.\n(define \"CaptureMove\" (forEach Level (to) FromTop (if (\"IsEnemyAt\" (to) level:(level)) (remove (to) level:(level))))) (define \"NoPieceOnBoard\" (< (count Pieces Mover in:(sites Board)) 1)) (define \"ThrowValue\" (count Pips)) (game \"Aj T'iwil\" (players 8) (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 0..18} P4 directed:True) (track \"Track5\" {23 18..0} P5 directed:True) (track \"Track6\" {24 18..0} P6 directed:True) (track \"Track7\" {25 18..0} P7 directed:True) (track \"Track8\" {26 18..0} P8 directed:True)} use:Edge) (regions \"AllSites\" (sites Board Vertex)) (piece \"Stick\" Each (forEach Value (values Remembered \"Throws\") (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 (and (\"CaptureMove\") (forget Value \"Throws\" (value))))))))) (\"StickDice\" 4) (hand Each)}) (rules (start { (set Team 1 {P1 P2 P3 P4}) (set Team 2 {P5 P6 P7 P8}) (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) (place Stack \"Stick7\" (handSite P7) count:5) (place Stack \"Stick8\" (handSite P8) 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 (if (< 0 (size Array (values Remembered \"Throws\"))) (moveAgain))))) (nextPhase (= 0 (size Array (values Remembered \"Throws\"))) \"ThrowPhase\"))} (end (\"CaptureAllTeam\"))))\n\n###\n\n", "completion": "(define \"CaptureMove\" (forEach Level (to) FromTop (if (\"IsEnemyAt\" (to) level:(level)) (remove (to) level:(level))))) (define \"NoPieceOnBoard\" (< (count Pieces Mover in:(sites Board)) 1)) (define \"ThrowValue\" (count Pips)) (game \"Aj T'iwil\" (players 10) (equipment { (board (rectangle 1 25) { (track \"Track1\" {24 0..23} P1 directed:True) (track \"Track2\" {25 0..23} P2 directed:True) (track \"Track3\" {26 0..23} P3 directed:True) (track \"Track4\" {27 0..23} P4 directed:True) (track \"Track5\" {28 0..23} P5 directed:True) (track \"Track6\" {29 23..0} P6 directed:True) (track \"Track7\" {30 23..0} P7 directed:True) (track \"Track8\" {31 23..0} P8 directed:True) (track \"Track9\" {32 23..0} P9 directed:True) (track \"Track10\" {33 23..0} P10 directed:True)} use:Edge) (regions \"AllSites\" (sites Board Vertex)) (piece \"Stick\" Each (forEach Value (values Remembered \"Throws\") (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 (and (\"CaptureMove\") (forget Value \"Throws\" (value))))))))) (\"StickDice\" 4) (hand Each)}) (rules (start { (set Team 1 {P1 P2 P3 P4 P5}) (set Team 2 {P6 P7 P8 P9 P10}) (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) (place Stack \"Stick7\" (handSite P7) count:5) (place Stack \"Stick8\" (handSite P8) count:5) (place Stack \"Stick9\" (handSite P9) count:5) (place Stack \"Stick10\" (handSite P10) 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 (if (< 0 (size Array (values Remembered \"Throws\"))) (moveAgain))))) (nextPhase (= 0 (size Array (values Remembered \"Throws\"))) \"ThrowPhase\"))} (end (\"CaptureAllTeam\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6 board. Six counters in each hole. Sowing occurs from any of the holes in the player's row, and continues in a clockwise direction. If the final counter lands in a hole in the player's row containing three counters, four with the addition of the final counter, these are captured. Play continues until one player cannot move or the board position repeats. When one player cannot move, the other player captures the remaining counters. The player with the most counters wins. The game ends if no moves or a repeating state is detected.\n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (game \"Unnee Tugalluulax\" (players 2) (equipment { (mancalaBoard 2 6 store:None (track \"Track\" \"5,W,N,E\" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 6 to:(sites Track))) (play (move Select (from (sites Mover) if:(< 0 (count at:(from)))) (then (sow if:(= (count at:(to)) 4) apply:(fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))))))) (end (\"MancalaByScoreWhen\" (or (no Moves Mover) (is Cycle)))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nCapturing is optional. -> Capturing is forced.\n(game \"Felli\" (players 2) (equipment { (board (graph vertices:{ {0 0} {2 0} {4 0} {1 1} {2 1} {3 1} {2 2} {1 3} {2 3} {3 3} {0 4} {2 4} {4 4}} edges:{ {0 1} {0 3} {1 2} {1 4} {2 5} {3 4} {3 6} {4 5} {4 6} {5 6} {6 7} {6 8} {6 9} {7 8} {7 10} {8 9} {8 11} {9 12} {10 11} {11 12}}) use:Vertex) (piece \"Counter\" Each) (piece \"DoubleCounter\" Each) (regions P1 (intersection (sites Corners) (sites Bottom))) (regions P2 (intersection (sites Corners) (sites Top)))}) (rules (start { (place \"Counter1\" (expand (sites Bottom))) (place \"Counter2\" (expand (sites Top)))}) (play (or { (forEach Piece \"Counter\" (\"HopCapture\")) (forEach Piece \"Counter\" (\"StepToEmpty\"))})) (end (\"NoMoves\" Loss))))\n\n###\n\n", "completion": "(game \"Felli\" (players 2) (equipment { (board (graph vertices:{ {0 0} {2 0} {4 0} {1 1} {2 1} {3 1} {2 2} {1 3} {2 3} {3 3} {0 4} {2 4} {4 4}} edges:{ {0 1} {0 3} {1 2} {1 4} {2 5} {3 4} {3 6} {4 5} {4 6} {5 6} {6 7} {6 8} {6 9} {7 8} {7 10} {8 9} {8 11} {9 12} {10 11} {11 12}}) use:Vertex) (piece \"Counter\" Each) (piece \"DoubleCounter\" Each) (regions P1 (intersection (sites Corners) (sites Bottom))) (regions P2 (intersection (sites Corners) (sites Top)))}) (rules (start { (place \"Counter1\" (expand (sites Bottom))) (place \"Counter2\" (expand (sites Top)))}) (play (if \"SameTurn\" (\"HopSequenceCaptureAgain\") (priority { (forEach Piece \"Counter\" (\"HopSequenceCapture\")) (forEach Piece \"Counter\" (\"StepToEmpty\"))}))) (end (\"NoMoves\" Loss)))) END" }, { "prompt": "Construct a Ludii game based on the following description\n8x8 board. Eight pieces per player, which begin on alternating squares in the first two rows on opposing sides of the board. Players alternate turns moving one of their pieces to an adjacent space. Pieces move diagonally forward only. A piece may capture one of the opponent's adjacent pieces by hopping over it to an empty adjacent space immediately on the opposite side of the opponent's piece. Multiple captures are not allowed. When a piece arrives at the opposite edge of the board from where it began, it is promoted and may move diagonally forward or backward. The player who captures all of the opponent's pieces wins. \n\n###\n\n", "completion": "(define \"IsUnpromoted\" (\"IsPieceAt\" \"Counter\" Mover (last To))) (game \"Doov\" (\"TwoPlayersNorthSouth\") (\"DraughtsEquipment\" (square 8)) (rules (\"BlackCellsSetup\" 2) (play (or (or (forEach Piece \"Counter\" (\"HopCapture\" (from) (directions {FR FL}) (then (\"PromoteIfReach\" (sites Next) \"DoubleCounter\")))) (forEach Piece \"DoubleCounter\" (\"HopDiagonalCapture\"))) (or (forEach Piece \"Counter\" (\"StepToEmpty\" (directions {FR FL})) (then (\"PromoteIfReach\" (sites Next) \"DoubleCounter\"))) (forEach Piece \"DoubleCounter\" \"StepDiagonalToEmpty\")))) (end (\"BlockWin\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\nForty stones arranged in a circle, with a larger gap after every tenth stone, the spaces between the stones are the playing spaces. Four or six players, played on two teams, with two sticks per team, starting in one of the gaps. Three sticks, round on one side and flat on the other, used as dice. The throws are as follows: three round sides = 10; two round sides = 2; one round side = 3; three flat sides = 5. A throw of 10 grants the player another throw. Pieces move according to the throws in opposite directions around the board. The team to get their pieces to the starting gap wins. The game has 6 players.\n\n###\n\n", "completion": "(define \"Move\" (move (from (sites Occupied by:#1)) (to (\"NextSiteOnTrack\" (\"ThrowValue\") #2) if:(not (\"IsEnemyAt\" (to)))))) (define \"ThrowValue\" (mapEntry \"Throw\" (count Pips))) (game \"Setichch\" (players 6) (equipment { (\"FortyStonesWithFourGapsBoard\" { (track \"TrackCW\" {39 35 33 31 29 27 25 23 21 19 38 17 15 13 11 9 7 5 3 1 37 0 2 4 6 8 10 12 14 16 36 18 20 22 24 26 28 30 32 34} loop:True) (track \"TrackCCW\" {39 34 32 30 28 26 24 22 20 18 36 16 14 12 10 8 6 4 2 0 37 1 3 5 7 9 11 13 15 17 38 19 21 23 25 27 29 31 33 35} loop:True)}) (regions \"AllSites\" (sites Board)) (piece \"Stick\" P1) (piece \"Stick\" P2) (\"StickDice\" 3) (hand Each) (map \"Throw\" {(pair 0 5) (pair 1 3) (pair 2 2) (pair 3 10)})}) (rules (start { (place Stack \"Stick1\" Edge 36 count:2) (place Stack \"Stick2\" Edge 38 count:2) (set Team 1 {P1 P3 P5}) (set Team 2 {P2 P4 P6})}) (play (\"RollMove\" (if (is In (mover) (players Team1)) (\"Move\" Team1 \"TrackCW\") (\"Move\" Team2 \"TrackCCW\")) (then (if (= 10 (\"ThrowValue\")) (moveAgain))))) (end { (if (and { (is In (mover) (players Team1)) (= 1 (count Sites in:(sites Occupied by:Team1))) (= 36 (where \"Stick\" Team1))}) (result Team1 Win)) (if (and { (is In (mover) (players Team2)) (= 1 (count Sites in:(sites Occupied by:Team2))) (= 38 (where \"Stick\" Team2))}) (result Team2 Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6 board. Three counters in each hole. Sowing occurs from one of the holes in the player's row. If the final counter lands in an occupied hole, these counters are picked up and sowing continues. If the final counter lands in an empty hole in the player's own row, any counters in the opposite row hole are captured. A player wins when the opponent's row is empty. \n\n###\n\n", "completion": "(define \"Columns\" 6) (game \"Altiev\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" store:None (track \"Track\" \"0,E,N,W\" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 3 to:(sites Track))) (play (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover)) if:(> (count at:(from)) 0)) (then (sow apply:(if (> (count at:(to)) 1) (moveAgain) (if (is In (to) (sites Mover)) (fromTo (from (\"OppositePitTwoRows\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePitTwoRows\" (to)))))))))) (end { (if (all Sites (sites P1) if:(= 0 (count at:(site)))) (result P2 Win)) (if (all Sites (sites P2) if:(= 0 (count at:(site)))) (result P1 Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nEvery turn, the current player can choose to pass, or select a previously-unselected edge. If the selected edge is disjoint from any other friendly edge, then the player gets 1 point. If the graph is full (i.e., all edges have been selected) or both players are passed their turn, the game is over and the winner is selected by their score.\n \n\n###\n\n", "completion": "(game \"MaxMatch\" (players 2) (equipment { (board (graph vertices:{ {0 1} {3 1} {6 1} {8 1} {10 1} {0 2} {2 2} {4 2} {6 2} {8 2} {0 3} {3 3} {5 3} {7 3} {8 3} {10 3} {2 5} {4 5} {0 5} {3 5} {7 5} {5 5} {10 5}} edges:{{0 6} {5 6} {6 10} {1 6} {6 11} {6 7} {7 8} {8 2} {8 12} {8 13} {12 13} {8 9} {9 3} {9 14} {9 4} {9 15} {4 15} {11 16} {11 17} {16 18} {16 19} {12 21} {12 20} {13 20} {14 22} {15 22}}) use:Vertex)}) (rules (play (or (move Add (to Edge (sites Empty Edge)) (then (if (is Path Edge Mover length:(exact 1)) (addScore Mover 1)))) (move Pass))) (end (if (all Passed) (byScore))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n8x8 board, twelve pieces per player. Pieces placed on the dark squares of the first three rows of each side, with the empty corner to the right of each player. Pieces move one space forward diagonally. They may capture pieces of the opponent by hopping over them. Captures may happen in any direction. Multiple captures are allowed in the same turn, but they may not hop over the same piece or a player's own piece. Captures are compulsory, but if more than one option exists the player may choose which capture to make. When a piece reaches the opposite edge of the board, it becomes a king, even if this is in the middle of a turn. Kings may move any number of spaces forward or backwards, and may capture by flying leap. Kings must take all possible pieces in a sequence. The player to capture all of the other player's pieces wins. \n\n###\n\n", "completion": "(define \"JumpToPromotionZone\" (is In (last To) (sites Next))) (define \"IsUnpromoted\" (\"IsPieceAt\" \"Counter\" Mover (last To))) (game \"Jekab\" (\"TwoPlayersNorthSouth\") (\"DraughtsEquipment\" (square 8)) (rules (\"BlackCellsSetup\" 3) (play (if \"SameTurn\" (if \"IsUnpromoted\" (\"HopInternationalDraughtsStyle\" (from (last To)) (then (if \"JumpToPromotionZone\" (and (\"ReplayIfCanMove\" (\"HopDiagonalSequenceCaptureAgain\" before:(count Rows) after:(count Rows) at:EndOfTurn)) (promote (last To) (piece \"DoubleCounter\") Mover)) (\"ReplayIfCanMove\" (\"HopInternationalDraughtsStyle\" (from (last To))))))) (max Moves (\"HopDiagonalSequenceCaptureAgain\" before:(count Rows) after:(count Rows) at:EndOfTurn))) (priority { (or (forEach Piece \"Counter\" (\"HopInternationalDraughtsStyle\" (from) (then (if \"JumpToPromotionZone\" (and (\"ReplayIfCanMove\" (\"HopDiagonalSequenceCaptureAgain\" before:(count Rows) after:(count Rows) at:EndOfTurn)) (promote (last To) (piece \"DoubleCounter\") Mover)) (\"ReplayIfCanMove\" (\"HopInternationalDraughtsStyle\" (from (last To)))))))) (max Moves (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": "Describe the mechanics of the following Ludii game\n(game \"Saxun\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (\"ChessPawn\" \"Pawn\") (\"ChessRook\" \"Rook\") (\"ChessKing\" \"King_noCross\") (\"ChessBishop\" \"Bishop_noCross\") (\"ChessKnight\" \"Knight\") (\"ChessQueen\" \"Queen\")}) (rules (start { (place \"Pawn1\" {\"F4\" \"G4\" \"H4\" \"B3\" \"C3\" \"D3\" \"E3\" \"A2\"}) (place \"Pawn2\" {\"H7\" \"H6\" \"G6\" \"F6\" \"E6\" \"A5\" \"B5\" \"C5\"}) (place \"Rook1\" {\"C2\" \"D1\"}) (place \"Knight1\" {\"B1\" \"H2\"}) (place \"Bishop_noCross1\" {\"E1\" \"F1\"}) (place \"Queen1\" coord:\"D2\") (place \"King_noCross1\" coord:\"C1\") (place \"Rook2\" {\"C7\" \"B8\"}) (place \"Knight2\" {\"A7\" \"H8\"}) (place \"Bishop_noCross2\" {\"F7\" \"G7\"}) (place \"Queen2\" coord:\"B7\") (place \"King_noCross2\" coord:\"C8\")}) (play (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King_noCross\" Mover)))) (end (\"Checkmate\" \"King_noCross\"))))\n\n###\n\n", "completion": "8x8 checkered board. The pieces move as follows: \u00c1lix' (\\ END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"ThreeStones\" (or { (= 3 (count Sites in: (forEach (sites Row (row of:(last To))) if:(\"IsFriendAt\" (site))))) (= 3 (count Sites in: (forEach (sites Column (column of:(last To))) if:(\"IsFriendAt\" (site))))) (= 3 (count Sites in: (forEach (union (sites Direction from:(last To) NE included:True) (sites Direction from:(last To) SW)) if:(\"IsFriendAt\" (site))))) (= 3 (count Sites in: (forEach (union (sites Direction from:(last To) NW included:True) (sites Direction from:(last To) SE)) if:(\"IsFriendAt\" (site)))))})) (game \"Trianon\" (players 2) (equipment { (board (square 5) use:Vertex) (piece \"Ball\" Each)}) (rules (play (move Add (to (sites Empty)))) (end (if (\"ThreeStones\") (result Mover Loss)))))\n\n###\n\n", "completion": "TURN - On each turn, each player drops a stone on an empty cell\n \n GOAL - A player loses if he has 3 friendly stones on an orthogonal or diagonal line (they don't need to be adjacent to each other). END" }, { "prompt": "Construct a Ludii game based on the following description\nThis game is played on a square grid board of any size, though 13x13 or 19x19 are recommended. Then the players take it in turns to place 1-3 black stones each turn until one decides to pass; that player then becomes Black, and the other becomes White. After that, players take it in turns to place one stone of their colour on the board on any empty point. If Black connects any two sides of the board with a single orthogonally-connected group, they win; White wins if they connect all four sides with a group connected either orthogonally or diagonally.\n \n During the initial chicken ballot phase, you may add stones by clicking on available spaces, or skip the rest of your placements (by choosing the Next Player action). Alternatively, you may Pass at the start of your turn to take Black. After that, you and your opponent will alternate playing one stone of your colour per turn, until one player forms a connection (draws are impossible in Pippinzip). Played on a size 13 board.\n\n###\n\n", "completion": "(define \"Skip\" (move Set NextPlayer (player (next)))) (define \"IsPlayingPhase\" (= 1 (var))) (define \"BlackVC\" (or (is Connected Orthogonal {(sites Side N) (sites Side S)}) (is Connected Orthogonal {(sites Side E) (sites Side W)}))) (define \"WhiteVC\" (is Connected All {(sites Side N) (sites Side S) (sites Side E) (sites Side W)})) (game \"Pippinzip\" (players 2) (equipment { (board (square 13) use:Vertex) (piece \"Disc\" Each)}) (rules phases:{ (phase \"Opening\" (play (or (or (move Add (piece (id \"Disc\" P2)) (to (sites Empty)) (then (if (< (count MovesThisTurn) 2) (moveAgain)))) \"Skip\") (if (= (count MovesThisTurn) 0) (move Pass (then (if (is Mover P1) (swap Players P1 P2 (then (note \"Player 1 is now Black. Player 2 is now White.\" to:All))) (note \"Player 1 remains White. Player 2 remains Black.\" to:All) (then (do (set NextPlayer (player 1)) next:(set Var 1))))))))) (nextPhase (\"IsPlayingPhase\") \"Playing\")) (phase \"Playing\" (play (move Add (to (sites Empty)))))} (end { (if (and (not (\"IsPlayingPhase\")) (\"BlackVC\")) (result Mover Win)) (if (and {(= (id P2) (mover)) (\"BlackVC\")}) (result P2 Win)) (if (and {(= (id P1) (mover)) (\"WhiteVC\")}) (result P1 Win))}))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game has 2 players. -> The game has 3 players.\n(define \"Move\" (move (from (from) level:(level)) (to (\"SiteToMoveOnTrack\" (\"ThrowValue\")) if:True (\"HittingCapture\" (mapEntry \"Start\" (who at:(to))))) (then (forEach Site (sites Track Mover \"Track\" from:(\"NextSite\" (last From) \"Track\") to:(last To)) (if (\"IsEnemyAt\" (site)) (forEach Level (site) (move (from (site) level:(level)) (to (mapEntry \"Start\" (who at:(site) level:(level))))))))))) (define \"MadeACompleteCircuit\" (is In (mapEntry \"Start\" Mover) (sites Track Mover \"Track\" from:(\"NextSite\" (last From) \"Track\") to:(last To)))) (define \"NextSite\" (\"NextSiteOnTrack\" 1 from:#1 #2)) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" #1)) (define \"ThrowValue\" (mapEntry \"Throw\" (count Pips))) (game \"Set Dilth'\" (players 2) (equipment { (\"FortyStonesWithFourGapsBoard\" { (track \"Track1\" {39 34 32 30 28 26 24 22 20 18 36 16 14 12 10 8 6 4 2 0 37 1 3 5 7 9 11 13 15 17 38 19 21 23 25 27 29 31 33 35} loop:True P1) (track \"Track2\" {39 35 33 31 29 27 25 23 21 19 38 17 15 13 11 9 7 5 3 1 37 0 2 4 6 8 10 12 14 16 36 18 20 22 24 26 28 30 32 34} loop:True P2)}) (regions \"AllSites\" (sites Board)) (map \"Throw\" {(pair 0 10) (pair 1 2) (pair 2 3) (pair 3 5)}) (map \"Start\" {(pair 1 37) (pair 2 38) (pair 3 39) (pair 4 36)}) (piece \"Stick\" Each (\"Move\")) (\"StickDice\" 3)}) (rules (start { (set Team 1 {P1}) (set Team 2 {P2}) (place Stack \"Stick1\" 37) (place Stack \"Stick2\" 38)}) (play (\"RollMove\" (forEach Piece) (then (do (if (\"MadeACompleteCircuit\") (addScore Mover 1) (then (if (= (score Mover) 3) (remove (last To))))) next:(if (and (!= 3 (score Mover)) (= 10 (\"ThrowValue\"))) (moveAgain)))))) (end (if (>= (score Mover) 4) (result Mover Win)))))\n\n###\n\n", "completion": "(define \"Move\" (move (from (from) level:(level)) (to (\"SiteToMoveOnTrack\" (\"ThrowValue\")) if:True (\"HittingCapture\" (mapEntry \"Start\" (who at:(to))))) (then (forEach Site (sites Track Mover \"Track\" from:(\"NextSite\" (last From) \"Track\") to:(last To)) (if (\"IsEnemyAt\" (site)) (forEach Level (site) (move (from (site) level:(level)) (to (mapEntry \"Start\" (who at:(site) level:(level))))))))))) (define \"MadeACompleteCircuit\" (is In (mapEntry \"Start\" Mover) (sites Track Mover \"Track\" from:(\"NextSite\" (last From) \"Track\") to:(last To)))) (define \"NextSite\" (\"NextSiteOnTrack\" 1 from:#1 #2)) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" #1)) (define \"ThrowValue\" (mapEntry \"Throw\" (count Pips))) (game \"Set Dilth'\" (players 3) (equipment { (\"FortyStonesWithFourGapsBoard\" { (track \"Track1\" {39 34 32 30 28 26 24 22 20 18 36 16 14 12 10 8 6 4 2 0 37 1 3 5 7 9 11 13 15 17 38 19 21 23 25 27 29 31 33 35} loop:True P1) (track \"Track2\" {39 35 33 31 29 27 25 23 21 19 38 17 15 13 11 9 7 5 3 1 37 0 2 4 6 8 10 12 14 16 36 18 20 22 24 26 28 30 32 34} loop:True P2) (track \"Track3\" {39 34 32 30 28 26 24 22 20 18 36 16 14 12 10 8 6 4 2 0 37 1 3 5 7 9 11 13 15 17 38 19 21 23 25 27 29 31 33 35} loop:True P3)}) (regions \"AllSites\" (sites Board)) (map \"Throw\" {(pair 0 10) (pair 1 2) (pair 2 3) (pair 3 5)}) (map \"Start\" {(pair 1 37) (pair 2 38) (pair 3 39) (pair 4 36)}) (piece \"Stick\" Each (\"Move\")) (\"StickDice\" 3)}) (rules (start { (set Team 1 {P1 P3}) (set Team 2 {P2}) (place Stack \"Stick1\" 37) (place Stack \"Stick2\" 38) (place Stack \"Stick3\" 39)}) (play (\"RollMove\" (forEach Piece) (then (do (if (\"MadeACompleteCircuit\") (addScore Mover 1) (then (if (= (score Mover) 3) (remove (last To))))) next:(if (and (!= 3 (score Mover)) (= 10 (\"ThrowValue\"))) (moveAgain)))))) (end (if (>= (score Mover) 4) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n4x10-20 holes, with even numbers. Two counters in each hole, except the rightmost hole in the inner row of each player, which has zero, and the hole to its left, which has one. 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 lands in an empty hole in the inner row, the counters in the opposite hole in the opponent's inner row are captured. If counters are captured from the inner row, and there are also counters in the outer row, the counters in the outer row are also captured. If counters in the inner and outer row are captured, the player may also capture counters from two other holes on the opponent's side of the board. Single counters cannot be sown until there are no holes with multiple counters on the player's side of the board, and then single counters may only be sown into empty holes. Play continues until one player captures all of their opponent's counters, thus winning the game. Each row has 10 holes.\n\n###\n\n", "completion": "(define \"NextHoleFrom\" (\"NextSiteOnTrack\" 1 from:#1)) (define \"HaveHolesWithMoreThanOneCounter\" (not (all Sites (forEach (sites Mover \"Home\") if:(< 1 (count at:(site)))) if:(= 0 (count at:(site)))))) (define \"NoPiece\" (all Sites (sites Player \"Home\") if:(= 0 (count at:(site))))) (define \"Columns\" 10) (game \"Msuwa\" (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))) (piece \"Seed\" Shared)}) (rules (start { (set Count 2 to:(difference (sites Board) (sites {18..21}))) (set Count 1 to:(sites {18 21}))}) (play (if (and (\"SameTurn\") (< 0 (var))) (move Remove (forEach (sites Next \"Home\") if:(< 0 (count at:(site)))) (then (and (if (> (var) 1) (moveAgain)) (set Var (- (var) 1))))) (if (\"HaveHolesWithMoreThanOneCounter\") (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(< 1 (count at:(from)))) (then (sow \"Track\" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover \"Inner\")) (if (< 0 (count at:(\"OppositePit\" (to)))) (and (remove (\"OppositePit\" (to))) (if (< 0 (count at:(\"OppositeOuterPit\" (to)))) (and { (remove (\"OppositeOuterPit\" (to))) (set Var 2) (moveAgain)}))))))))) (move Select (from (sites Mover \"Home\") if:(and (= 1 (count at:(from))) (= 0 (count at:(\"NextHoleFrom\" (from)))))) (then (sow \"Track\" owner:(mover) apply: (if (is In (to) (sites Mover \"Inner\")) (if (< 0 (count at:(\"OppositePit\" (to)))) (and (remove (\"OppositePit\" (to))) (if (< 0 (count at:(\"OppositeOuterPit\" (to)))) (and { (remove (\"OppositeOuterPit\" (to))) (set Var 2) (moveAgain)}))))))))))) (end (forEach NonMover if:(\"NoPiece\") (result Player Loss))))) 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": "Construct a Ludii game based on the following description\nPlayed on a board similar to Perali Kotuma, with the addition of triangular extensions on the four corners. Play begins with nine pieces for each player. Pieces move along the lines to the next open space. Opponent's pieces can be captured by hopping over them. Within the triangular extensions, pieces may move two places at a time, in a straight line. The player to capture all of the opponent's pieces wins. \n\n###\n\n", "completion": "(define \"WithinTrianglePieceCanMoveDistanceTwo\" (move Slide (between (exact 2) if:(and (is Empty (between)) (not (is In (between) (\"SitesNotInTriangle\"))))))) (define \"SitesNotInTriangle\" (difference (expand (sites Centre) steps:2) (sites {\"F6\" \"I6\" \"L6\" \"F9\" \"L9\" \"F12\" \"I12\" \"L12\"}))) (game \"Terhuchu\" (players 2) (equipment { (\"AlquerqueBoardWithEightTriangles\") (piece \"Marker\" Each (or { (\"HopCapture\") (\"StepToEmpty\") (if (not (is In (from) \"SitesNotInTriangle\")) (\"WithinTrianglePieceCanMoveDistanceTwo\"))}))}) (rules (start { (place \"Marker1\" (sites {\"H3\" \"F6\" \"G6\" \"H6\" \"I6\" \"J6\" \"L6\" \"H8\" \"I8\" \"J8\"})) (place \"Marker2\" (sites {\"H10\" \"I10\" \"J10\" \"F12\" \"H12\" \"I12\" \"J12\" \"L12\" \"J15\"}))}) (play (forEach Piece)) (end (\"NoMoves\" Loss)))) 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\nPlayers take turns placing pieces on the board. There are three winning conditions: 1. Connect any three edges (without corner points), or 2. Make a bridge connection between any two corners, or 3. loop around any site. The game is played on a 8x8 board The game does not use the swap rule.\n\n###\n\n", "completion": "(game \"Havannah\" (players 2) (equipment { (board (hex 8)) (piece \"Marker\" Each)}) (rules (play (move Add (to (sites Empty)))) (end (if (or { (is Loop) (is Connected 3 SidesNoCorners) (is Connected 2 Corners)}) (result Mover Win))))) 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 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": "Construct a Ludii game based on the following description\nFour players, playing on teams of two. 1 x Shah (king): moves one space orthogonally or diagonally. 2 x Rukh (rook): Any number of spaces orthogonally. 2 x Pil (elephant): any distance diagonally; 2 x Asb (horse): Moves as a chess knight. 8 x Sarbaz (soldier): Moves one space forward orthogonally; one space forward diagonally to capture. The pieces of one team are arranged with Shahs on the two central squares of the outer rows, then the Pils, ASbs, and Rukhs, with the Sarbaz in the row in front of them. When a piece moves onto a space occupied by an opponent's piece, the opponent's piece is captured. When a Shah can be captured on the next turn, it is in check, and cannot remain in check at the end of that player's turn. When this is not possible, it is checkmate, and that player is out of the game. A team wins by checkmating both opposing Kings, or by capturing all of the opponents' pieces aside from the Kings. If all four Kings are the only remaining pieces, the game is a draw. \n\n###\n\n", "completion": "(define \"InitialPawnMove\" (if (is In (from) (sites Start (piece (what at:(from))))) (\"DoubleStepForwardToEmpty\"))) (define \"RemovePiecesIfCheckmate\" (if (and (is Active #1) (not (is Mover #1))) (if (or (and (\"IsInCheck\" \"King_noCross\" #1) (\"CanNotMove\" #1 #2)) (\"IsOffBoard\" (where (id \"King_noCross\" #1)))) (forEach Site (sites Occupied by:#1) (remove (site)))))) (define \"CanNotMove\" (not (can Move (do (and (forEach Piece #1) (set NextPlayer (player #2))) ifAfterwards:(not (\"IsInCheck\" \"King_noCross\" #1)))))) (define \"KingNotCheckedAndToEmpty\" (and (is Empty (to)) (not (\"IsInCheck\" \"King_noCross\" Mover at:(to))))) (game \"Chatrang\" (players {(player N) (player S) (player N) (player S)}) (equipment { (board (square 8)) (\"ChessPawn\" \"Pawn\" \"InitialPawnMove\") (\"ChessRook\" \"Rook\") (\"ChessKing\" \"King_noCross\") (\"ChessBishop\" \"Elephant\") (\"ChessKnight\" \"Knight\")}) (rules (start { (place \"Pawn1\" (intersection (expand (sites Left) steps:3) (sites Row 1))) (place \"Pawn2\" (intersection (expand (sites Right) steps:3) (sites Row 6))) (place \"Pawn3\" (intersection (expand (sites Right) steps:3) (sites Row 1))) (place \"Pawn4\" (intersection (expand (sites Left) steps:3) (sites Row 6))) (place \"Rook1\" {\"A1\"}) (place \"Knight1\" {\"B1\"}) (place \"Elephant1\" {\"C1\"}) (place \"King_noCross1\" coord:\"D1\") (place \"Rook3\" {\"H1\"}) (place \"Knight3\" {\"G1\"}) (place \"Elephant3\" {\"F1\"}) (place \"King_noCross3\" coord:\"E1\") (place \"Rook2\" {\"H8\"}) (place \"Knight2\" {\"G8\"}) (place \"Elephant2\" {\"F8\"}) (place \"King_noCross2\" coord:\"E8\") (place \"Rook4\" {\"A8\"}) (place \"Knight4\" {\"B8\"}) (place \"Elephant4\" {\"C8\"}) (place \"King_noCross4\" coord:\"D8\") (set Team 1 {P1 P3}) (set Team 2 {P2 P4})}) (play (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King_noCross\" Mover)) (then (and { (\"RemovePiecesIfCheckmate\" P1 1) (\"RemovePiecesIfCheckmate\" P2 2) (\"RemovePiecesIfCheckmate\" P3 3) (\"RemovePiecesIfCheckmate\" P4 4)})))) (end { (forEach NonMover if:(\"IsOffBoard\" (where \"King_noCross\" Player)) (result Player Loss)) (if (and { (no Pieces Enemy \"Pawn\") (no Pieces Enemy \"Knight\") (no Pieces Enemy \"Elephant\") (no Pieces Enemy \"Rook\")}) (result TeamMover Win))}))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game is played on a size 5 board -> The game is played on a size 9 board\n(define \"RemoveGroups\" (forEach Site (sites Around (sites Group at:(last To)) Enemy) (remove (sites Group at:(site))))) (define \"Captures\" (and (all Sites (sites Around (sites Group at:(last To)) Enemy) if:(> (size Group at:(last To)) (size Group at:(site)))) (< 0 (count Sites in:(sites Around (sites Group at:(last To)) Enemy))))) (define \"FriendlyAdjacent\" (< 0 (count Sites in:(sites Around (to) Own)))) (define \"NoFriendlyAdjacent\" (= 0 (count Sites in:(sites Around (to) Own)))) (game \"Oust\" (players 2) (equipment { (board (hex 5)) (piece \"Disc\" Each)}) (rules (play (or (move Add (to (sites Empty) if:\"NoFriendlyAdjacent\")) (do (move Add (to (sites Empty) if:\"FriendlyAdjacent\")) ifAfterwards:\"Captures\" (then (and (\"RemoveGroups\") (moveAgain)))))) (end (if (and (< 2 (count Moves)) (= 0 (count Sites in:(sites Occupied by:Enemy)))) (result Mover Win)))))\n\n###\n\n", "completion": "(define \"RemoveGroups\" (forEach Site (sites Around (sites Group at:(last To)) Enemy) (remove (sites Group at:(site))))) (define \"Captures\" (and (all Sites (sites Around (sites Group at:(last To)) Enemy) if:(> (size Group at:(last To)) (size Group at:(site)))) (< 0 (count Sites in:(sites Around (sites Group at:(last To)) Enemy))))) (define \"FriendlyAdjacent\" (< 0 (count Sites in:(sites Around (to) Own)))) (define \"NoFriendlyAdjacent\" (= 0 (count Sites in:(sites Around (to) Own)))) (game \"Oust\" (players 2) (equipment { (board (hex 9)) (piece \"Disc\" Each)}) (rules (play (or (move Add (to (sites Empty) if:\"NoFriendlyAdjacent\")) (do (move Add (to (sites Empty) if:\"FriendlyAdjacent\")) ifAfterwards:\"Captures\" (then (and (\"RemoveGroups\") (moveAgain)))))) (end (if (and (< 2 (count Moves)) (= 0 (count Sites in:(sites Occupied by:Enemy)))) (result Mover Win))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game has 2 players. -> The game has 3 players.\n(define \"MoveOn\" (if (\"IsNotOffBoard\" #1) (move (from (from) level:(level)) (to #1 if:(is Empty #1))) #2)) (define \"ReachEastDoor\" (= (last To) \"EastDoor\")) (define \"MadeACompleteCircuit\" (if (= 1 (state at:(where \"Stick\" Mover))) (is In \"EastDoor\" (sites Track \"TrackCW\" from:(\"NextSite\" (last From) \"TrackCW\") to:(last To))) (is In \"EastDoor\" (sites Track \"TrackCCW\" from:(\"NextSite\" (last From) \"TrackCCW\") to:(last To))))) (define \"NextSite\" (\"NextSiteOnTrack\" 1 from:#1 #2)) (define \"ThrowValue\" (if (= (count Pips) 3) 5 (if (= (count Pips) 0) 10 (if (= (count Pips) 1) 2 (if (= (face 44) 1) 15 3))))) (define \"SiteToMoveOnTrackCCW\" (\"NextSiteOnTrack\" (\"ThrowValue\") \"TrackCCW\")) (define \"SiteToMoveOnTrackCW\" (\"NextSiteOnTrack\" (\"ThrowValue\") \"TrackCW\")) (define \"SiteToMoveOnSelectedTrack\" (if (= (state at:(from)) 1) (\"NextSiteOnTrack\" (\"ThrowValue\") \"TrackCW\") (\"NextSiteOnTrack\" (\"ThrowValue\") \"TrackCCW\"))) (define \"EastDoor\" 38) (game \"Owasokotz\" (players 2) (equipment { (\"FortyStonesWithFourGapsBoard\" { (track \"TrackCW\" {39 35 33 31 29 27 25 23 21 19 38 17 15 13 11 9 7 5 3 1 37 0 2 4 6 8 10 12 14 16 36 18 20 22 24 26 28 30 32 34} loop:True) (track \"TrackCCW\" {39 34 32 30 28 26 24 22 20 18 36 16 14 12 10 8 6 4 2 0 37 1 3 5 7 9 11 13 15 17 38 19 21 23 25 27 29 31 33 35} loop:True)}) (regions \"AllSites\" (sites Board)) (piece \"Stick\" Each (if (= (state at:(from)) 0) (or (\"MoveOn\" (\"NextSiteOnTrack\" (\"ThrowValue\") \"TrackCCW\") (then (set State at:(last To) 2))) (\"MoveOn\" (\"NextSiteOnTrack\" (\"ThrowValue\") \"TrackCW\") (then (set State at:(last To) 1)))) (\"MoveOn\" (\"SiteToMoveOnSelectedTrack\" (\"ThrowValue\"))))) (\"StickDice\" 3) (hand Each)}) (rules (start (place Stack items:{\"Stick2\" \"Stick1\"} Edge \"EastDoor\")) (play (\"RollMove\" (forEach Piece))) (end (if (and (not (was Pass)) (\"MadeACompleteCircuit\")) (result Mover Win)))))\n\n###\n\n", "completion": "(define \"MoveOn\" (if (\"IsNotOffBoard\" #1) (move (from (from) level:(level)) (to #1 if:(is Empty #1))) #2)) (define \"ReachEastDoor\" (= (last To) \"EastDoor\")) (define \"MadeACompleteCircuit\" (if (= 1 (state at:(where \"Stick\" Mover))) (is In \"EastDoor\" (sites Track \"TrackCW\" from:(\"NextSite\" (last From) \"TrackCW\") to:(last To))) (is In \"EastDoor\" (sites Track \"TrackCCW\" from:(\"NextSite\" (last From) \"TrackCCW\") to:(last To))))) (define \"NextSite\" (\"NextSiteOnTrack\" 1 from:#1 #2)) (define \"ThrowValue\" (if (= (count Pips) 3) 5 (if (= (count Pips) 0) 10 (if (= (count Pips) 1) 2 (if (= (face 44) 1) 15 3))))) (define \"SiteToMoveOnTrackCCW\" (\"NextSiteOnTrack\" (\"ThrowValue\") \"TrackCCW\")) (define \"SiteToMoveOnTrackCW\" (\"NextSiteOnTrack\" (\"ThrowValue\") \"TrackCW\")) (define \"SiteToMoveOnSelectedTrack\" (if (= (state at:(from)) 1) (\"NextSiteOnTrack\" (\"ThrowValue\") \"TrackCW\") (\"NextSiteOnTrack\" (\"ThrowValue\") \"TrackCCW\"))) (define \"EastDoor\" 38) (game \"Owasokotz\" (players 3) (equipment { (\"FortyStonesWithFourGapsBoard\" { (track \"TrackCW\" {39 35 33 31 29 27 25 23 21 19 38 17 15 13 11 9 7 5 3 1 37 0 2 4 6 8 10 12 14 16 36 18 20 22 24 26 28 30 32 34} loop:True) (track \"TrackCCW\" {39 34 32 30 28 26 24 22 20 18 36 16 14 12 10 8 6 4 2 0 37 1 3 5 7 9 11 13 15 17 38 19 21 23 25 27 29 31 33 35} loop:True)}) (regions \"AllSites\" (sites Board)) (piece \"Stick\" Each (if (= (state at:(from)) 0) (or (\"MoveOn\" (\"NextSiteOnTrack\" (\"ThrowValue\") \"TrackCCW\") (then (set State at:(last To) 2))) (\"MoveOn\" (\"NextSiteOnTrack\" (\"ThrowValue\") \"TrackCW\") (then (set State at:(last To) 1)))) (\"MoveOn\" (\"SiteToMoveOnSelectedTrack\" (\"ThrowValue\"))))) (\"StickDice\" 3) (hand Each)}) (rules (start (place Stack items:{\"Stick3\" \"Stick2\" \"Stick1\"} Edge \"EastDoor\")) (play (\"RollMove\" (forEach Piece))) (end (if (and (not (was Pass)) (\"MadeACompleteCircuit\")) (result Mover Win))))) 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 Shah (king): moves one space orthogonally or diagonally. May move like an Asb if it is not in check and has never been in check. Place to a player's square right of center. 1 x Fers (counselor): Any distance orthogonally or diagonally; 2 x Rukh (rook): Any number of spaces orthogonally. 2 x Pil (elephant): Any distance diagonally. 2 x Asb (horse): Moves as a chess knight. 8 x Sarbaz (soldier): Moves one space forward orthogonally; one space forward diagonally to capture. Promoted to Fers when reaching the eighth rank. No en passant. No castling. An opponent's piece is captured by moving a player's own piece onto a space occupied by the opponent's piece. When a Shah can be captured on the next turn by an opponent's piece, it is in check. The Shah must not be in check at the end of the player's turn. If this is not possible, it is checkmate and the opponent wins. Stalemate results in a win for that player causing it. The game ends in a draw only when a player's final piece, being a Sarbaz, is lost, that player's Shah captures the opponent's only remaining piece, a Sarbaz. \n\n###\n\n", "completion": "(game \"Shatranj (Algeria)\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (\"ChessPawn\" \"Pawn\" ~ (then (\"PromoteIfReach\" (sites Mover \"Promotion\") \"Ferz_noCross\"))) (\"ChessRook\" \"Rook\") (piece \"King_noCross\" Each (or (\"StepToNotFriend\") (if (!= (value Player Mover) (mover)) (\"LeapToEmpty\" \"KnightWalk\" (then (set Value Mover (mover))))))) (\"ChessBishop\" \"Elephant\") (\"ChessKnight\" \"Knight\") (\"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 \"Rook1\" {\"A1\" \"H1\"}) (place \"Knight1\" {\"B1\" \"G1\"}) (place \"Elephant1\" {\"C1\" \"F1\"}) (place \"Ferz_noCross1\" coord:\"D1\") (place \"King_noCross1\" coord:\"E1\") (place \"Rook2\" {\"A8\" \"H8\"}) (place \"Knight2\" {\"B8\" \"G8\"}) (place \"Elephant2\" {\"C8\" \"F8\"}) (place \"Ferz_noCross2\" coord:\"E8\") (place \"King_noCross2\" coord:\"D8\")}) (play (do (forEach Piece) ifAfterwards:(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 (= (count Pieces Next) 1) (result Mover Win)) (\"BlockWin\")}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe game is played on a board with twelve points on either side. The points form a continuous track in a horseshoe shape; each player progresses in opposite directions (one from their bottom right to the top right, the other from their bottom left to their top left. Each player has 15 pieces. The starting position is as such, number the points from the origin of each player's track: Point six: five pieces Point 8: three pieces Point 13: five pieces Point 24: two pieces Play begins by each player rolling one die; the player with the highest roll plays first and plays the numbers on this first roll. Players move according to the number on each die by moving one piece the value on one die then another piece the value on the other die, or by moving one piece the value of one die and then the value of the other. If doubles are rolled, the player must play the number on each die twice. Players cannot end their move on a point with multiple opposing pieces. If a player ends the turn on a point with one opposing piece, that piece is placed in the middle of the board (not on a point) and must reenter the board according the the next die roll, counting the origin point as a move of 1. They cannot reenter on a point with two or more pieces. No other pieces can move until all of the pieces belonging to that player are removed from the center. When all of a player's pieces are on their final 6 points, they may start removing pieces from the board. They can do so by rolling a 6 to move from the 6th point, and so on down to 1. Players must use all available moves presented by the dice. The first player to remove all of their pieces wins. \n\n###\n\n", "completion": "(define \"HaveAPieceAndCanEscape\" (and (\"IsFriendAt\" (site)) (< (\"NextSiteOnTrack\" (pips) from:(site)) 0))) (define \"SetScoreOf\" (set Score #1 (if (is Mover #1) (if (= (\"NumPiece\" #2) 15) 2 1) 0))) (define \"NotEmptyAndNotOffTheBoard\" (and (is Occupied (site)) (\"IsNotOffBoard\" (\"NextSiteFrom\" (site))))) (define \"CanEscape\" (\"IsEndTrack\" (\"NextSiteFrom\" (site)))) (define \"NumPiece\" (size Stack in:(sites Occupied by:#1))) (define \"AllPieceEscaped\" (no Pieces Mover)) (define \"MoveAPieceIf\" (forEach Die replayDouble:True if:#1 (\"MoveAPiece\" #2))) (define \"MoveAPiece\" (move (from #1) (to (\"NextSiteFrom\" #1) if:(\"NoEnemyOrOnlyOne\" (to)) (\"IfEnemyBlotIt\")))) (define \"DieNotUsedAndNoEscapeAndNotOffTheTrack\" (and { (\"DieNotUsed\") (\"IsNotOffBoard\" (\"NextSiteFrom\" (from))) (not (\"IsEndTrack\" (\"NextSiteFrom\" (from))))})) (define \"RemoveAPiece\" (move Remove (site))) (define \"AllPieceInHome\" (\"AllOwnedPiecesIn\" (sites Mover))) (define \"Bar\" (mapEntry (mover))) (define \"NextSiteFrom\" (\"NextSiteOnTrack\" (pips) from:#1)) (define \"BarEmpty\" (is Empty \"Bar\")) (define \"IfEnemyBlotIt\" (\"HittingCapture\" (mapEntry (next)))) (game \"Backgammon\" (players 2) (equipment { (\"BackgammonBoard\" (\"BackgammonTracksWithBar\" End)) (dice num:2) (regions P1 { 20..25}) (regions P2 { 7..12}) (map {(pair 1 6) (pair 2 19)}) (piece \"Disc\" Each (\"MoveAPieceIf\" \"DieNotUsedAndNoEscapeAndNotOffTheTrack\" (from)))}) (rules (start { (place Stack \"Disc1\" 0 count:5) (place Stack \"Disc1\" 12 count:2) (place Stack \"Disc1\" 17 count:3) (place Stack \"Disc1\" 20 count:5) (place Stack \"Disc2\" 4 count:3) (place Stack \"Disc2\" 7 count:5) (place Stack \"Disc2\" 13 count:5) (place Stack \"Disc2\" 25 count:2)}) (play (\"RollEachNewTurnMove\" (if \"AllPieceInHome\" (forEach Die replayDouble:True if:(\"DieNotUsed\") (forEach Site (sites Occupied by:Mover) (if (\"NotEmptyAndNotOffTheBoard\") (if (\"CanEscape\") (\"RemoveAPiece\") (\"MoveAPiece\" (site)))) noMoveYet:(firstMoveOnTrack \"Track\" Mover (if \"HaveAPieceAndCanEscape\" \"RemoveAPiece\")) (then (\"ReplayNotAllDiceUsed\")))) (max Distance \"Track\" Mover (if \"BarEmpty\" (forEach Piece top:True) (\"MoveAPieceIf\" (\"DieNotUsed\") (\"Bar\")) (then (if (not (all DiceUsed)) (if (can Move (if \"BarEmpty\" (forEach Piece top:True) (\"MoveAPieceIf\" (\"DieNotUsed\") (\"Bar\")))) (moveAgain))))))))) (end (if (\"AllPieceEscaped\") (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayed on a grid of 4x4 squares, each square with both diagonals. Pieces are played on the intersections of the lines, moving to an empty point along one of the lines. Play begins with 20 pieces per player. Players take turns moving the pieces, and capture the opponent's pieces by hopping over them. When the back line on a player's side of the board is vacated, it is no longer in play. The player who captures the other player's pieces wins. \n\n###\n\n", "completion": "(game \"Tuknanavuhpi\" (players 2) (equipment { (board (square 5 diagonals:Solid) use:Vertex) (piece \"Counter\" Each (or (\"HopCapture\") (\"StepToEmpty\")))}) (rules (start { (place \"Counter1\" (union (difference (expand (sites Bottom) steps:2) (sites {\"E5\" \"G5\" \"I5\"})) (sites {\"B2\" \"B4\" \"D2\" \"D4\" \"F2\" \"F4\" \"H2\" \"H4\"}))) (place \"Counter2\" (union (difference (expand (sites Top) steps:2) (sites {\"E5\" \"A5\" \"C5\"})) (sites {\"B6\" \"B8\" \"D6\" \"D8\" \"F6\" \"F8\" \"H6\" \"H8\"})))}) (play (forEach Piece)) (end (\"NoMoves\" Loss)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nMOVE - Each player inserts a stone onto the board from an edge. Black inserts from top and pushes from top to bottom, White inserts from left and pushes from left to right.\n - Black starts with a stone on the top-left corner.\n - Passing is not allowed \n - If a stone, when pushed meets another stone, this too is pushed on the same direction, and so on...\n \n EDGE - A stone pushed off the edge during a push is returned to the player (there are no captures). If it is an opponent stone, this row/column cannot be used on the next turn (friendly stones do not have such restriction). \n \n GOAL - Wins the player which makes a path between the edges (top-bottom for Black, right-left for White). Stones may be connected orthogonal or diagonal. \n\n###\n\n", "completion": "(define \"ConnectedEdges\" (!= 0 (count Sites in:(forEach (sites Occupied by:#1) if:(is Connected at:(site) All #1))))) (game \"Tara\" (players 2) (equipment { (board (square 5) use:Vertex) (piece \"Ball\" Each) (regions P1 {(sites Top) (sites Bottom)}) (regions P2 {(sites Left) (sites Right)})}) (rules phases:{ (phase \"Opening\" (play (move Add (to (intersection (sites Top) (sites Left))))) (nextPhase \"Main\")) (phase \"Main\" (play (if (is Mover P1) (move Select (from (sites Top) if:(not (is In (column of:(from)) (sites Pending)))) (then (and { (if (is Enemy (who at:(coord row:0 column:(column of:(last From))))) (set Pending (row of:(coord row:0 column:(column of:(last From)))))) (push (from (last To)) S) (add (piece (id \"Ball\" Mover)) (to (last To)))}))) (move Select (from (sites Left) if:(not (is In (row of:(from)) (sites Pending)))) (then (and { (if (is Enemy (who at:(coord row:(row of:(last From)) column:(- (count Columns) 1)))) (set Pending (column of:(coord row:(row of:(last From)) column:(- (count Columns) 1))))) (push (from (last To)) E) (add (piece (id \"Ball\" Mover)) (to (last To)))}))))))} (end { (if (\"ConnectedEdges\" P1) (result P1 Win)) (if (\"ConnectedEdges\" P2) (result P2 Win))}))) 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": "Describe the mechanics of the following Ludii game\n(game \"Six-Penny Madell\" (players 2) (equipment { (board (concentric Triangle rings:3 joinMidpoints:False joinCorners:True) use:Vertex) (hand Each) (piece \"Marker\" Each (\"StepToEmpty\" ~ (then (\"ReplayIfLine3\" Orthogonal exact:True))))}) (rules (start (place \"Marker\" \"Hand\" count:6)) phases:{ (phase \"Placement\" (play (if \"SameTurn\" (\"RemoveAnyEnemyPiece\") (move (from (handSite Mover)) (to (sites Empty)) (then (\"ReplayIfLine3\" Orthogonal exact:True))))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (phase \"Movement\" (play (if \"SameTurn\" (\"RemoveAnyEnemyPiece\") (forEach Piece))))} (end (\"CaptureAll\" Next))))\n\n###\n\n", "completion": "Three concentric triangles, with lines connecting their corners. Six pieces per player. Pieces can move or be placed where the lines intersect, or in the center of the sides of the triangles. Players alternate turns placing their pieces on an empty space on the board.When all the pieces have been placed, players alternate turns moving their pieces to an empty adjacent space along the lines. During either phase, when a player places three pieces in a row along one of the sides of one of the lines, they remove one of the pieces belonging to the other player. The player who removes all of the opponent's pieces wins. END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"IsUnpromoted\" (\"IsPieceAt\" \"Counter\" Mover (last To))) (define \"CounterMove\" (or { (\"StepToEmpty\" (directions {FR FL}) (then (\"PromoteIfReach\" (sites Next) \"DoubleCounter\"))) (\"DiagonalHopCaptureCounter\" (from) (\"CounterMoveAgainIfCanCaptureAgain\")) (\"OrthogonalHopCaptureCounter\" (from) (\"CounterMoveAgainIfCanCaptureAgain\"))})) (define \"CounterMoveAgainIfCanCaptureAgain\" (then (and (\"PromoteIfReach\" (sites Next) \"DoubleCounter\") (\"ReplayIfCanMove\" (or (\"DiagonalHopCaptureCounter\" (from (last To))) (\"OrthogonalHopCaptureCounter\" (from (last To)))))))) (define \"DoubleCounterMove\" (or { (do (move Slide) ifAfterwards:(is In (last To) (sites Phase 0))) (\"DiagonalHopCaptureDoubleCounter\" (from) (\"DoubleCounterMoveAgainIfCanCaptureAgain\")) (\"OrthogonalHopCaptureDoubleCounter\" (from) (\"DoubleCounterMoveAgainIfCanCaptureAgain\"))})) (define \"DoubleCounterMoveAgainIfCanCaptureAgain\" (then (\"ReplayIfCanMove\" (or (\"DiagonalHopCaptureDoubleCounter\" (from (last To))) (\"OrthogonalHopCaptureDoubleCounter\" (from (last To))))))) (define \"DiagonalHopCaptureCounter\" (move Hop #1 Diagonal (between before:1 if:(and (= 2 (count Steps (from) (between))) (\"IsEnemyAt\" (between))) (apply (remove (between)))) (to if:(is Empty (to))) #2)) (define \"OrthogonalHopCaptureCounter\" (do (move Hop #1 Orthogonal (between before:3 after:1 if:(and (= 4 (count Steps (from) (between))) (\"IsEnemyAt\" (between))) (apply (remove (between)))) (to if:(is Empty (to)))) ifAfterwards:(is In (last To) (sites Phase 0)) #2)) (define \"DiagonalHopCaptureDoubleCounter\" (move Hop #1 Diagonal (between before:1 if:(and (= 2 (count Steps (from) (between))) (\"IsEnemyAt\" (between))) (apply (remove (between)))) (to if:(is Empty (to))) #2)) (define \"OrthogonalHopCaptureDoubleCounter\" (do (move Hop #1 Orthogonal (between before:3 after:1 if:(and (= 4 (count Steps (from) (between))) (\"IsEnemyAt\" (between))) (apply (remove (between)))) (to if:(is Empty (to)))) ifAfterwards:(is In (last To) (sites Phase 0)) #2)) (game \"Maleys\" (\"TwoPlayersNorthSouth\") (\"DraughtsEquipment\" (square 10)) (rules (\"BlackCellsSetup\" 4) (play (if (\"SameTurn\") (or (if (\"IsUnpromoted\") (or (\"DiagonalHopCaptureCounter\" (from (last To)) (\"CounterMoveAgainIfCanCaptureAgain\")) (\"OrthogonalHopCaptureCounter\" (from (last To)) (\"CounterMoveAgainIfCanCaptureAgain\"))) (or (\"DiagonalHopCaptureDoubleCounter\" (from (last To)) (\"DoubleCounterMoveAgainIfCanCaptureAgain\")) (\"OrthogonalHopCaptureDoubleCounter\" (from (last To)) (\"DoubleCounterMoveAgainIfCanCaptureAgain\")))) (move Pass)) (or (forEach Piece \"Counter\" \"CounterMove\") (forEach Piece \"DoubleCounter\" \"DoubleCounterMove\")))) (end (\"CaptureAll\" Next))))\n\n###\n\n", "completion": "10x10 board. Twenty pieces per player, which begin in the four rows closest to the players. Pieces move diagonally forward one space. Pieces capture orthogonally or diagonally, in any direction, when there is one empty space between the piece and the opponent's piece, and an empty space immediately on the opposite side of the opponent's piece. Pieces are promoted to Queen when they reach the edge of the board opposite from where they start. Queens may capture orthogonally or diagonally in any direction over any distance, as long as there are no other pieces intervening and there is an empty spot immediately after the piece to be captured, which is where the Queen lands to make the capture. Multiple captures are allowed for Queens and regular pieces. Queens move orthogonally or diagonally any distance. The player who captures all of the opponent's pieces wins. END" }, { "prompt": "Construct a Ludii game based on the following description\nManzhouqi is played on a Xiangqi board. The black player's pieces are set up as in Xiangqi, but the white player has the following pieces: Five soldiers: Move one space forward orthogonally. Two courtiers: Move one space diagonally and cannot leave the palace. One general: Moves on space orthogonally and cannot leave the palace. Two elephants: Move two spaces diagonally and cannot cross the river. One chariot: can move any distance orthogonally, taking either by jumping or by landing on the same space, and can also move like a knight in chess. The player that checkmates the other player's general wins. \n\n###\n\n", "completion": "(define \"ChariotMove\" (\"SlideCapture\" Orthogonal)) (define \"CanonMove\" (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))))))) (define \"HorseMove\" (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))))))))))) (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 \"Manzhouqi\" (\"TwoPlayersNorthSouth\") (equipment { (board (rectangle 10 9) use:Vertex) (piece \"Jiang\" Each (\"StepMoveOnThePalace\" Orthogonal)) (piece \"Shi\" Each (\"StepMoveOnThePalace\" Diagonal)) (piece \"Xiang\" Each (\"SlideCapture\" Diagonal (between (exact 2) if:(and { (is In (between) (sites Mover \"Home\")) (is Empty (between))})))) (piece \"Ma\" Each \"HorseMove\") (piece \"Ju\" Each (if (is Mover P2) \"ChariotMove\" (or { \"ChariotMove\" \"HorseMove\" \"CanonMove\"}))) (piece \"Pao\" Each \"CanonMove\") (piece \"Zu\" Each (\"StepToNotFriend\" (if (is In (from) (sites Mover \"Home\")) Forward (directions {Forward Rightward Leftward})))) (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))}) (rules (start { (place \"Jiang1\" coord:\"E1\") (place \"Shi1\" {\"D1\" \"F1\"}) (place \"Xiang1\" {\"C1\" \"G1\"}) (place \"Ju1\" coord:\"A1\") (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 (forEach Piece) ifAfterwards:(and (\"JiangSameColumnWithNoPieceBetween\") (not (\"IsInCheck\" \"Jiang\" Mover))))) (end { (\"Checkmate\" \"Jiang\") (\"BlockWin\")}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThree vertical lines, and two horizontal lines intersecting them along their top end points and their midpoints. The ends of the lines which are not connected to one another are the calves' pens. Three pieces per player, one playing as calves (black), and the other as guardians (white), arranged on the intersections of opposite vertical lines. Players alternate turns moving one of their pieces to an adjacent spot. The guardians attempt to trap the calves into the three pens, the calves attempt to block the guardians from being able to move. \n\n###\n\n", "completion": "(define \"AllCowsInBottom\" (all Sites (difference (sites Occupied by:P2) (sites Bottom)) if:(= 0 (count at:(site))))) (game \"Gurvan Xudag\" (players 2) (equipment { (board (remove (square 3) edges:{{0 1}{1 2}}) use:Vertex) (piece \"Human\" P1 \"StepToEmpty\") (piece \"Cow\" P2 \"StepToEmpty\")}) (rules (start { (place \"Human1\" (sites Left)) (place \"Cow2\" (sites Right))}) (play (forEach Piece)) (end { (if (no Moves P1) (result P2 Win)) (if (and (\"AllCowsInBottom\") (no Moves P2)) (result P1 Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe rules are the same of Sudoku except the diagonals of the square board also have to contain only different numbers. \n\n###\n\n", "completion": "(game \"Sudoku X\" (players 1) (equipment { (board (square 9) (values Cell (range 1 9))) (regions {Columns Rows SubGrids}) (regions (sites Direction from:(intersection (sites Left) (sites Bottom)) NE included:True)) (regions (sites Direction from:(intersection (sites Right) (sites Bottom)) NW included:True))}) (rules (start (set { {0 9} {11 8} {12 6} {15 9} {19 4} {28 7} {29 3} {35 1} {38 1} {43 3} {45 2} {46 5} {50 7} {51 4} {52 8} {56 5} {66 9} {73 3} {75 8} {76 4}})) (play (satisfy (all Different))) (end (if (is Solved) (result P1 Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayed on cross-shaped board, made of five squares, each divided into four squares and with the diagonals of the larger squares drawn. One player plays with thirteen pieces situated on every point of one arm of the cross and along the line immediately perpendicular to that arm. The other plays as the Punipeki, which is placed on any empty spot on the first turn. Pieces move along the lines to an adjacent empty spot. The Punipeki may jump over an adjacent piece to capture it. The Punipeki wins if it can capture all the opponent's pieces, the other player wins by blocking the Punipeki from moving. \n\n###\n\n", "completion": "(game \"Manu\" (players 2) (equipment { (\"CrossBoard\" 3 7 use:Vertex diagonals:Alternating) (hand P1) (piece \"Stick\" P1 (or (\"HopCapture\") \"StepToEmpty\")) (piece \"Marker\" P2 \"StepToEmpty\")}) (rules (start { (place \"Marker2\" (union (expand (sites Bottom)) (sites Row 2))) (place \"Stick1\" (handSite P1))}) phases:{ (phase \"Placement\" P1 (play (move (from (handSite P1)) (to (sites Empty)))) (nextPhase (\"HandEmpty\" P1) \"Movement\")) (\"PhaseMovePiece\" \"Movement\")} (end (\"NoMovesLossAndNoPiecesPlayerLoss\" P2)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nEach player begins with their eleven pieces arrayed on the intersections of the lines in one of the triangles. Pieces move to an adjacent point along one of the lines connecting it to its present location. Captures are made by hopping over an opponent's piece. The player who captures all of the opponent's pieces wins. \n\n###\n\n", "completion": "(game \"Egara Guti\" (players 2) (equipment { (board (graph vertices:{ {0 0} {2 0} {4 0} {6 0} {8 0} {2 2} {4 2} {6 2} {3 3} {4 3} {5 3} {4 4} {3 5} {4 5} {5 5} {2 6} {4 6} {6 6} {0 8} {2 8} {4 8} {6 8} {8 8}} edges:{ {0 1} {0 5} {1 2} {1 5} {2 3} {2 6} {3 4} {3 7} {4 7} {5 6} {5 8} {5 15} {6 7} {6 9} {7 10} {7 17} {8 9} {8 11} {9 10} {9 11} {10 11} {11 12} {11 13} {11 14} {12 13} {12 15} {13 14} {13 16} {14 17} {15 16} {15 18} {15 19} {16 17} {16 20} {17 21} {17 22} {18 19} {19 20} {20 21} {21 22}}) use:Vertex) (piece \"Counter\" Each (or (\"HopCapture\") (\"StepToEmpty\")))}) (rules (start { (place \"Counter1\" (union (expand (sites Bottom)) (sites Row 2))) (place \"Counter2\" (union (expand (sites Top)) (sites Row 4)))}) (play (forEach Piece)) (end (\"NoMoves\" Loss)))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"UpdateSurplusesToDisplayFor\" (forEach Group Adjacent if:(is In (to) (sites Occupied by:#1)) (forEach Value (array (sites)) (set Value at:(value) (\"SurplusGoodsChainAt\" (value)))))) (define \"SurplusGoodsChainAt\" (- (size Array (array (\"SuppliersAroundChainAt\" #1))) (size Array (array (\"WarehousesinChainAt\" #1))))) (define \"ScoreFor\" (set Score #1 (size Array (array (\"AllWarehousesOf\" #1))))) (define \"Score\" (and (\"ScoreFor\" P1) (\"ScoreFor\" P2))) (define \"AllWarehousesOf\" (forEach (sites Occupied by:#1) if:(\"IsWarehouseAt\" (site)))) (define \"DoubleTurnProtocol\" (set Var \"MoveInTurn\" (% (+ 3 (var \"MoveInTurn\")) 2) (then (if (= 1 (var \"MoveInTurn\")) (moveAgain))))) (define \"DeficitWarehousesOf\" (forEach (sites Occupied by:#1) if:(and (\"IsWarehouseAt\" (site)) (\"IsDeficitInChainAt\" (site))))) (define \"Place\" (do (move Add (to (sites Empty))) ifAfterwards:(not (\"IsDeficitInChainAt\" (last To))))) (define \"WarehousesinChainAt\" (forEach (\"ChainAt\" #1) if:(\"IsWarehouseAt\" (site)))) (define \"SuppliersAroundChainAt\" (sites Around (\"ChainAt\" #1) Adjacent if:(\"IsSupplierAt\" (to)))) (define \"ChainAt\" (sites Group at:#1 Adjacent)) (define \"IsDeficitInChainAt\" (< (size Array (array (\"SuppliersAroundChainAt\" #1))) (size Array (array (\"WarehousesinChainAt\" #1))))) (define \"IsWarehouseAt\" (< 2 (count Pieces of:(who at:#1) in:(sites Around #1 Adjacent)))) (define \"IsSupplierAt\" (and (not (is Empty #1)) (> 3 (count Pieces of:(who at:#1) in:(sites Around #1 Adjacent if:(not (is Empty (to)))))))) (game \"SupplyChains\" (players 2) (equipment { (board (hex 3 5) use:Cell) (piece \"Disc\" Each)}) (rules (play (priority { (move Remove (\"DeficitWarehousesOf\" Mover)) (or { (\"Place\")})} (then (and { (\"UpdateSurplusesToDisplayFor\" Mover) (\"UpdateSurplusesToDisplayFor\" Next) (\"Score\") (if (can Move (move Remove (\"DeficitWarehousesOf\" Mover))) (moveAgain) \"DoubleTurnProtocol\")})))) (end (if (or (all Passed) (no Moves Mover)) (byScore)))))\n\n###\n\n", "completion": "Goal: Most 'Warehouses' when the board is full.\n Definitions:\n -- 'friendly': a player's piece. -- 'foreign': their opponent's piece.\n -- A 'Supplier' is a piece with less than 3 friendly neighbors.\n -- A 'Warehouse' is a piece with 3 or more friendly neighbors.\n -- A 'Supply Chain' is any of a player's pieces, and all of the friendly pieces that can connect to it through series of adjacent connections with each other.\n \n -- A supply chain 'deficit' is a condition that occurs when the number of Warehouses in a Supply Chain exceeds the number of foreign Suppliers next to that Chain.\n \n -- A supply chain 'Surplus' is the number by which the number of foreign Suppliers next to a Friendly Supply Chain exceeds the Warehouses in that Chain, displayed for informational purposes.\n \n Play:\n After the first player takes a single turn, the players continue to play, each taking 2 turns in a row until no more placements can be made.\n \n On a normal turn, the mover adds a piece to the board, taking care not to cause a supply chain deficit in the chain being extended.\n \n However, if a player starts a turn with a supply chain deficit, the player must remove Warehouses from the deficit chains until no deficit remains. In this case, no placement is made for the turn.\n \n In either case, all piece conversions are updated, and supply chain surpluses are shown for each chain. Hex 3,5 Grid of adjacent cells Self Removals, Forced placement Double moves END" }, { "prompt": "Construct a Ludii game based on the following description\nThree concentric squares, with lines connecting the midpoints. Nine pieces per player. Players alternate turns placing a piece on the board on an empty spot. When all the pieces have been placed, the players alternate turns moving a piece to an empty adjacent spot along the lines of the board. During either phase, if a player places three of their pieces in a row along the lines on the board, the player removes one of the opponent's pieces. The player who removes all the opponent's pieces wins. \n\n###\n\n", "completion": "(game \"Nao Guti\" (players 2) (equipment { (\"NineMensMorrisBoard\") (hand Each) (piece \"Marker\" Each (\"StepToEmpty\" ~ (then (\"ReplayIfLine3\" Orthogonal exact:True))))}) (rules (start (place \"Marker\" \"Hand\" count:9)) phases:{ (phase \"Placement\" (play (if \"SameTurn\" \"RemoveAnyEnemyPiece\" (move (from (handSite Mover)) (to (sites Empty)) (then (\"ReplayIfLine3\" Orthogonal exact:True))))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (phase \"Movement\" (play (if \"SameTurn\" \"RemoveAnyEnemyPiece\" (forEach Piece))))} (end (\"CaptureAll\" Next)))) END" }, { "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 Ludii game based on the following description\n5x5 grid of points, four point in each row, each alternating position with an end point on the left or right edge. Points are connecting with diagonal lines. Twelve pieces per player, positioned on the first three rows closest to the player. Players alternate turns moving a piece forward to an empty adjacent spot along the lines. A player may capture an opponent's piece by hopping over it to an empty spot on the opposite side of it along the lines. Multiple captures are allowed, if possible. When a player's piece reaches the opposite edge of the board from which it started, it becomes a king. Kings may move any distance diagonally forward or backward, and may capture any number of opponent's pieces it leaps over. The king cannot take in multiple directions in one turn. The first player to capture all of the opponent's pieces wins.\n \n\n###\n\n", "completion": "(define \"IsUnpromoted\" (\"IsPieceAt\" \"Counter\" Mover (last To))) (define \"HopDoubleCounter\" (\"HopCaptureDistance\" #1 #2 ~ (then (\"ReplayIfCanMove\" (\"HopCaptureDistance\" (from (last To)) SameDirection))))) (define \"HopCounter\" (\"HopCapture\" (from #1) (directions {FR FL}) #2)) (game \"Dama (Philippines)\" (players 2) (\"DraughtsEquipment\" (rotate 45 (merge { (rectangle 5 4) (shift -1 1 (rectangle 3 6)) (shift -2 2 (rectangle 1 8)) (shift 1 -1 (rectangle 7 2))})) use:Vertex) (rules (\"BottomTopSetup\" 3 \"Counter1\" \"Counter2\") (play (if \"SameTurn\" (or (if \"IsUnpromoted\" (\"HopCounter\" (last To) (then (\"ReplayIfCanMove\" (\"HopCounter\" (last To)) (\"PromoteIfReach\" (sites Next) \"DoubleCounter\")))) (\"HopDoubleCounter\" (from (last To)) SameDirection)) (move Pass)) (or { (forEach Piece \"Counter\" (\"HopCounter\" (from) (then (\"ReplayIfCanMove\" (\"HopCounter\" (last To)) (\"PromoteIfReach\" (sites Next) \"DoubleCounter\"))))) (forEach Piece \"DoubleCounter\" (\"HopDoubleCounter\" (from) Orthogonal)) (forEach Piece \"Counter\" (\"StepToEmpty\" (directions {FR FL})) (then (\"PromoteIfReach\" (sites Next) \"DoubleCounter\"))) (forEach Piece \"DoubleCounter\" (move Slide))}))) (end (\"BlockWin\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6 board. Four counters in each hole. Sowing proceeds in an anti-clockwise direction. When the final counter of a sowing lands in an occupied hole, the contents are picked up and sowing continues. When the final counter falls in an empty hole, the turn ends. If the empty hole is in the player's row, any counters in the opponent's opposite hole are captured. If a player cannot play, they pass their turn until they are able. The player who captures all of the counters wins. Players then count their pieces by placing four in each hole, and the player who has more than their original number takes ownership of one of the opponent's holes for every four counters more than the original number that have been taken. If no player took four more than the original, the player with three extra gets the hole, if each player has two extra they draw lots to see who gets an extra hole. Play then begins again as before. Play continues until one player owns all of the holes. \n\n###\n\n", "completion": "(define \"NumCapturedPieces\" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (define \"LeftMostEmpty\" (trackSite FirstSite from:(mapEntry \"LeftMost\" Mover) if:(is Empty (to)))) (define \"OneRowIsEmpty\" (or (all Sites (sites P1) if:(= 0 (count at:(site)))) (all Sites (sites P2) if:(= 0 (count at:(site)))))) (define \"RemmemberOwnedHoles\" (if (is Mover P1) (remember Value \"OwnedP1\" #1) (remember Value \"OwnedP2\" #1))) (define \"OwnedHoles\" (if (is Mover P1) (sites (values Remembered \"OwnedP1\")) (sites (values Remembered \"OwnedP2\")))) (define \"Columns\" 6) (game \"Hufesay\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" store:None (track \"Track\" \"0,E,N,W\" loop:True)) (regions \"Home\" P1 (sites Bottom)) (regions \"Home\" P2 (sites Top)) (piece \"Seed\" Shared) (hand Each) (map \"LeftMost\" {(pair P1 0) (pair P2 11)})}) (rules (start { (set Count 4 to:(sites Track)) (set RememberValue \"OwnedP1\" (sites Bottom)) (set RememberValue \"OwnedP2\" (sites Top))}) phases:{ (phase \"Sowing\" (play (or { (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (\"OwnedHoles\")) if:(is Occupied (from))) (then (sow apply:(if (> (count at:(to)) 1) (moveAgain) (if (and (is In (to) (sites Mover)) (> (count at:(\"OppositePit\" (to))) 0)) (fromTo (from (\"OppositePit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePit\" (to)))))))))} (then (if (\"OneRowIsEmpty\") (and { (forEach Site (sites (values Remembered \"OwnedP1\")) (if (is Occupied (site)) (fromTo (from (site)) (to (handSite P1)) count:(count at:(site))))) (forEach Site (sites (values Remembered \"OwnedP2\")) (if (is Occupied (site)) (fromTo (from (site)) (to (handSite P2)) count:(count at:(site))))) (forget Value \"OwnedP1\" All) (forget Value \"OwnedP2\" All) (if (>= (\"NumCapturedPieces\" P1) (\"NumCapturedPieces\" P2)) (set NextPlayer (player 1)) (set NextPlayer (player 2)))}))))) (end (if (\"NoPieceOnBoard\") { (if (> 4 (count Cell at:(handSite P1))) (result P2 Win)) (if (> 4 (count Cell at:(handSite P2))) (result P1 Win))})) (nextPhase (\"NoPieceOnBoard\") \"BetweenRounds\")) (phase \"BetweenRounds\" (play (if (<= 4 (count Cell at:(handSite Mover))) (move (from (handSite Mover)) (to (\"LeftMostEmpty\")) count:4 (then (and { (\"RemmemberOwnedHoles\" (last To)) (if (<= 4 (count Cell at:(handSite Mover))) (moveAgain) (if (= 3 (count Cell at:(handSite Mover))) (and { (fromTo (from (handSite Mover)) (to (\"LeftMostEmpty\")) count:3) (fromTo (from (handSite Next)) (to (\"LeftMostEmpty\")) count:1) (\"RemmemberOwnedHoles\" (\"LeftMostEmpty\"))}) (fromTo (from (handSite Mover)) (to (handSite Next)) count:(count Cell at:(handSite Mover)))))}))))) (nextPhase (and (is Empty (handSite P1)) (is Empty (handSite P2))) \"Sowing\"))})) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayed on a 4x4 grid. Each player has seven pieces, placed on the intersections of the lines, five on the back row and one on each outer intersection of the second line. Pieces are moved diagonally across the squares. The object is to place one's pieces in the opponent's starting position. The first player to do so wins. \n\n###\n\n", "completion": "(game \"O-Pat-Kono\" (players 2) (equipment { (board (rectangle 5 5) use:Vertex) (piece \"Marker\" Each \"StepDiagonalToEmpty\") (regions \"Home\" P1 (union (sites Bottom) (sites {\"A2\" \"E2\"}))) (regions \"Home\" P2 (union (sites Top) (sites {\"A4\" \"E4\"})))}) (rules (start { (place \"Marker1\" (sites P1)) (place \"Marker2\" (sites P2))}) (play (forEach Piece)) (end (\"FillWin\" (sites Next))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n4x7 board. Play begins with three counters in each hole of the outer rows. Players pick up all of the counters in one hole and sow them anti-clockwise. Holes with single counters can be chosen for sowing. When the final counter is sown, the counters in the following hole are picked up and sowing continues with those counters. If this hole is empty, play ends. Captures are made from the player's inner row at the beginning of a turn or a subsequent sowing within a turn. Counters are captured when a player's inner row has occupied holes. Counters in the opponent's holes opposite a player's occupied holes are captured: either from both of the opponent's rows or only the inner row if the corresponding hole in the outer row is empty. If the inner row is empty but the outer row is occupied, there is no capture, and when both rows are occupied they both must be captured. Captures are also made on a subsequent sowing within a turn, in the same manner as above but from the hole the next sowing begins, i.e., the one following the hole in which the last seed of the previous sowing is made. Captured counters are placed in the player's outer row opposite the hole from which the capture was made. Game is won when the opponent's outer row is emptied. At the initial state 3 seeds are in each outer hole.\n\n###\n\n", "completion": "(define \"LastHole\" (last To afterConsequence:True)) (define \"NextHole\" (\"NextSiteOnTrack\" 1 from:#1 \"TrackCCW\")) (define \"InnerPitsWithPossibleCapture\" (forEach (difference (sites Mover \"Inner\") (sites Empty)) if:(is Occupied (\"OppositePit\" (site))))) (define \"InnerPit\" (if (is Mover P1) (- #1 \"Columns\") (+ #1 \"Columns\"))) (define \"EmptyOuterRow\" (all Sites (sites #1 \"Outer\") if:(= 0 (count at:(site))))) (define \"Columns\" 7) (game \"Kisolo\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"TrackCCW1\" \"0,E,N1,W\" loop:True P1) (track \"TrackCCW2\" \"14,E,N1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"TrackCCW1\")) (regions \"Home\" P2 (sites Track \"TrackCCW2\")) (regions \"Inner\" P1 (difference (sites Track \"TrackCCW1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"TrackCCW2\") (sites Top))) (regions \"Outer\" P1 (difference (sites Track \"TrackCCW1\") (sites P1 \"Inner\"))) (regions \"Outer\" P2 (difference (sites Track \"TrackCCW2\") (sites P2 \"Inner\"))) (piece \"Seed\" Shared)}) (rules (start { (set Count 3 to:(union (sites P1 \"Outer\") (sites P2 \"Outer\")))}) (play (if (and (or (= 0 (count MovesThisTurn)) (is In 1 (sites Pending))) (!= 0 (count Sites in:((\"InnerPitsWithPossibleCapture\"))))) (move Select (from (\"InnerPitsWithPossibleCapture\")) (then (and { (fromTo (from (\"OppositePit\" (last To))) (to (\"InnerPit\" (last To)))) (if (is Occupied (\"OppositeOuterPit\" (last To))) (fromTo (from (\"OppositeOuterPit\" (last To))) (to (\"InnerPit\" (last To))))) (moveAgain)} (then (if (!= 0 (count Sites in:((\"InnerPitsWithPossibleCapture\")))) (set Pending 1)))))) (move Select (from (if (and (is In 2 (sites Pending)) (\"SameTurn\")) (sites {(\"NextHole\" \"LastHole\")}) (sites Mover \"Home\")) if:(> (count at:(from)) 0)) (then (sow \"TrackCCW\" owner:(mover) apply:(if (is Occupied (\"NextHole\" (to))) (and { (if (and (is In (\"NextHole\" (to)) (sites Mover \"Inner\")) (is Occupied (\"OppositePit\" (\"NextHole\" (to))))) (and (fromTo (from (\"OppositePit\" (\"NextHole\" (to)))) (to (\"InnerPit\" (\"NextHole\" (to))))) (if (is Occupied (\"OppositeOuterPit\" (\"NextHole\" (to)))) (fromTo (from (\"OppositeOuterPit\" (\"NextHole\" (to)))) (to (\"InnerPit\" (\"NextHole\" (to)))))))) (moveAgain) (set Pending 2)}))))))) (end (forEach Player if:(\"EmptyOuterRow\" Player) (result Player Loss))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nSetup: Pieces of each color are distributed symmetrically on every 3rd cell of the board.\n (For a game on an order 4 board, the outer cells are not used.)\n Four game options are provided:\n \n 1. Keep-a-riding - Goal: Last to move. \n Play: No passing. Pieces step to join larger group. When they can't step to join larger group, they can slide to capture.\n \n 2. Conflagration, - Goal: Win when you you have no fire left or can't make a move. \n Play: No passing. A piece can either take a single step to join a larger group, or slide to capture an opponent's piece.\n \n 3. Conflagration, - Firestorm Variant (longer)\n Rule restriction: A piece can only slide to capture when it cannot step to join a larger group.\n \n 4. Conflagration, - Backfire Variant (shorter), \n Rule restriction: A piece can only step to join a larger group when it cannot slide to capture. Conflagration Standard version Order 4 board\n\n###\n\n", "completion": "(define \"ColourBackground\" (colour 245 245 245)) (define \"Last2MoveEnd\" (\"BlockWin\")) (define \"AMSEnd\" (if (no Moves Next) (result Mover Loss))) (define \"StandardEnd\" (if (or { (no Moves Next) (\"IsSingleGroupOf\" Mover) (\"IsSingleGroupOf\" Next)}) { (if (\"IsSingleGroupOf\" Mover) (result Mover Win)) (if (\"IsSingleGroupOf\" Next) (result Next Win)) (\"Last2MoveEnd\")})) (define \"IsSingleGroupOf\" (= 1 (count Groups Cell Orthogonal if:(is #1 (who at:(to)))))) (define \"Shakattrition\" (do (set Var \"OriginGroupSize\" (size Group at:(from)) (then (set Var \"From\" (from)))) next:(move (from (from)) (to (intersection (sites Inner) (sites Around (from) if:(is Empty (to)))) if:(<= (var \"OriginGroupSize\") (\"DestinationGroupSize\")))))) (define \"PriorityCaptureOverMoveByPiece\" (forEach Piece (priority (move (from) (to (sites LineOfSight Piece at:(from)) if:(is Next (who at:(to))) (apply (remove (to))))) (\"Shakattrition\")))) (define \"PriorityMoveOverCaptureByPiece\" (forEach Piece (priority (\"Shakattrition\") (move (from) (to (sites LineOfSight Piece at:(from)) if:(is Next (who at:(to))) (apply (remove (to)))))))) (define \"MoveOrLOSCapture\" (forEach Piece (or (move (from) (to (sites LineOfSight Piece at:(from)) if:(is Next (who at:(to))) (apply (remove (to))))) (\"Shakattrition\")))) (define \"FirstFriend\" (sites To (move Hop #1 (between (min 0) if:(or { (= (from) (between)) (is Next (who at:(between))) (is Empty (between))})) (to (sites Inner) if:(is Mover (who at:(to))))))) (define \"ValueAtFrom\" (set Var \"MaxSizeFrom\" (max 1 (max (results from:(from) to:(\"FirstFriend\" Orthogonal) (size Group at:(to) Orthogonal if:(= (mover) (who at:(to))))))))) (define \"ValueAtTo\" (max 1 (max (results from:(last To) to:(\"FirstFriend\" Orthogonal) (size Group at:(to) Orthogonal if:(= (mover) (who at:(to)))))))) (define \"MoveToSiteWithFriendVisible\" (< 1 (count Pieces Mover in:(sites LineOfSight Piece at:(to) Orthogonal)))) (define \"MoveTowardFriendInSameLine\" (< 0 (count Pieces Mover in:(\"FurtherAlongLine\" #1)))) (define \"FurtherAlongLine\" (sites Distance (step #1 (to if:True)) from:(to) (min 1))) (define \"AlongLine\" (sites Distance (step #1 (to if:True)) from:(from) (min 1))) (define \"IsPlayableSiteType\" (is In (to) (\"PlayableSite\"))) (define \"PlayableSite\" (difference (sites Inner) (sites Occupied by:Mover))) (define \"DestinationGroupSize\" (count Sites in:(sites Distance Orthogonal (step (to if:(and (!= (var \"From\") (to)) (is Mover (who at:(to)))))) from:(to) (min 0)))) (game \"Conflagration and Keep-a-riding\" (players 2) (equipment { (board (hex Hexagon 5) use:Cell) (piece \"Disc\" Each)}) (rules (start {(place \"Disc1\" {7 12 15 21 24 28 31 38 41 44 47 52}) (place \"Disc2\" {8 13 16 19 22 29 32 36 39 45 48 53})}) (play \"MoveOrLOSCapture\") (end \"AMSEnd\"))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe first capture must be of one counter. The first capture must be of three counters, the second of one counter.\n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (+ (count at:(mapEntry #1)) (count in:(sites #1)))) (define \"Sow\" (move Select (from (sites Mover) if:(> (count at:(from)) 0)) (then (sow #1 if:(or { (and {(<= (count at:(to)) 9) (is Odd (count at:(to))) (>= \"NumCaptureDone\" 2)}) (and (\"IsOffBoard\" \"NumCaptureDone\") (= (count at:(to)) 3)) (and (= \"NumCaptureDone\" 1) (= (count at:(to)) 1))}) apply:(fromTo (from (to)) (to (mapEntry (mover))) count:(count at:(to)) (then (and (if (= \"NumCaptureDone\" 1) (set Value Mover 2)) (if (\"IsOffBoard\" \"NumCaptureDone\") (set Value Mover 1))))) origin:True)))) (define \"NumCaptureDone\" (value Player Mover)) (game \"Ako Okwe\" (players 2) (equipment { (mancalaBoard 2 5 { (track \"TrackCCW\" \"1,E,N,W\" loop:True) (track \"TrackCW\" \"6,E,S,W\" loop:True)}) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 FirstSite) (pair P2 LastSite)}) (piece \"Seed\" Shared)}) (rules (start (set Count 10 to:(sites Track))) (play (or (\"Sow\" \"TrackCW\") (\"Sow\" \"TrackCCW\"))) (end (\"MancalaByScoreWhen\" (no Moves Mover))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n3x6 board. Play begins with three counters per hole. Each player owns the row closest to them and the right half of the central row. Sowing occurs in the following direction: from left to right in the player's full row, right to left in the player's half of the central row, proceeding to the opponent's full row and sowing right to left, then left to right in the opponent's part of the central row, then proceeding back to the player's full row and proceeding as before. Sowing always begins from a player's own holes. A player can not sow from their left hand hole in their main row unless it has more than three counters, unless there is no other option. When the last counter falls into an empty hole, the turn ends. If the last counter falls into an occupied hole, the contents of that hole are picked up and sowing continues. A hole is captured by dropping the last counter of a sowing into an opponent's hole which contains three counters, making it have four counters, and becomes a wegue. Captures cannot be made until after the original three counters placed in the holes at the beginning of the game have been moved. Once a wegue is created, the player cannot sow from it. When the final counter of a sowing lands in a wegue owned by the opponent, the player captures two counters from it. Play continues until all of the counters are captured or all of the counters are accumulated in wegue. A new round begins. Players then collect the counters in their captured holes. They count their takings by filling their holes with three counters each as in the beginning, and the player would own every hole they could fill with three counters. If the player has two counters remaining, they also gain another hole and the opponent surrenders their extra counter. At the end of play, if a player captures the opponent's single remaining hole as a wegue, the player captured three counters from it, leaving one for the opponent to continue to play. Play continues until one player cannot fill any holes. \n\n###\n\n", "completion": "(define \"SitesMarkedBy\" (forEach (sites Board) if:(= #1 (state at:(site))))) (define \"LeftMostEmpty\" (trackSite FirstSite from:(mapEntry \"LeftMost\" Mover) if:(is Empty (to)))) (define \"OnlyPiecesInMarked\" (all Sites (forEach (sites Board) if:(= 0 (state at:(site)))) if:(= 0 (count at:(site))))) (define \"RemmemberOwnedHoles\" (if (is Mover P1) (remember Value \"OwnedP1\" #1) (remember Value \"OwnedP2\" #1))) (define \"OpponentOwnedHoles\" (if (is Mover P1) (sites (values Remembered \"OwnedP2\")) (sites (values Remembered \"OwnedP1\")))) (define \"OwnedHoles\" (if (is Mover P1) (sites (values Remembered \"OwnedP1\")) (sites (values Remembered \"OwnedP2\")))) (define \"Columns\" 6) (game \"Gabata (Aksum)\" (players 2) (equipment { (mancalaBoard 3 \"Columns\" store:None (track \"Track\" \"0,E,N1,W2,17,W,S1,E2\" loop:True)) (piece \"Seed\" Shared) (hand Each) (regions P1 (union (sites Bottom) (intersection (sites Row 1) (expand (sites Right) steps:2)))) (regions P2 (union (sites Top) (intersection (sites Row 1) (expand (sites Left) steps:2)))) (map \"LeftMost\" {(pair P1 0) (pair P2 17)})}) (rules (start { (set Count 3 to:(sites Track)) (set RememberValue \"OwnedP1\" (union (sites Bottom) (intersection (sites Row 1) (expand (sites Right) steps:2)))) (set RememberValue \"OwnedP2\" (union (sites Top) (intersection (sites Row 1) (expand (sites Left) steps:2))))}) phases:{ (phase \"Sowing\" (play (or { (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (\"OwnedHoles\")) if:(and { (if (!= (from) (mapEntry \"LeftMost\" Mover)) True (if (\"SameTurn\") True (or (< 3 (count at:(from))) (no Pieces All in:(forEach (difference (\"OwnedHoles\") (mapEntry \"LeftMost\" Mover)) if:(= 0 (state at:(site)))))))) (< 0 (count at:(from))) (= 0 (state at:(from)))})) (then (sow apply:(if (and { (= 0 (state at:(to))) (= 4 (count at:(to))) (is In (to) (\"OpponentOwnedHoles\"))}) (set State at:(to) (mover)) (if (< 1 (count at:(to))) (if (= 0 (state at:(to))) (and { (moveAgain) (set Var \"Replay\" (to))}) (if (!= (mover) (state at:(to))) (and { (fromTo (from (to)) (to (handSite Mover)) count:(min 2 (count at:(to)))) (set State at:(to) (state at:(to)))}))))))))} (then (if (\"OnlyPiecesInMarked\") (and { (forEach Site (\"SitesMarkedBy\" 1) (fromTo (from (site)) (to (handSite P1)) count:(count at:(site)))) (forEach Site (\"SitesMarkedBy\" 2) (fromTo (from (site)) (to (handSite P2)) count:(count at:(site)))) (forget Value \"OwnedP1\" All) (forget Value \"OwnedP2\" All)}))))) (end (if (\"NoPieceOnBoard\") { (if (>= 1 (count Cell at:(handSite P1))) (result P2 Win)) (if (>= 1 (count Cell at:(handSite P2))) (result P1 Win))})) (nextPhase (\"NoPieceOnBoard\") \"BetweenRounds\")) (phase \"BetweenRounds\" (play (if (<= 3 (count Cell at:(handSite Mover))) (move (from (handSite Mover)) (to (\"LeftMostEmpty\")) count:3 (then (and { (\"RemmemberOwnedHoles\" (last To)) (if (<= 3 (count Cell at:(handSite Mover))) (moveAgain) (if (= 2 (count Cell at:(handSite Mover))) (and { (fromTo (from (handSite Mover)) (to (\"LeftMostEmpty\")) count:2) (fromTo (from (handSite Next)) (to (\"LeftMostEmpty\")) count:1) (\"RemmemberOwnedHoles\" (\"LeftMostEmpty\"))})))}))))) (nextPhase (and (is Empty (handSite P1)) (is Empty (handSite P2))) \"Sowing\"))})) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe version of the game played with 3 players. -> The version of the game played with 4 players.\n(game \"Ilpion\" (players 3) (equipment { (board (graph vertices:{ {1 0.5} {3 0} {5 0} {6 0} {7 0} {8 0} {10 0} {11 0} {12 3} {0 2} {3 2} {5 2} {8 2} {8.5 2} {2 3} {7 3} {1 4} {12 4} {2 5} {5 5} {10 5} {10 8} {2 7} {6 7} {8 7} {0 10} {2 9} {5 9} {10 9} {1 10} {5 14} {10 10} {1 12} {4 12} {7 14} {9 12}} edges:{ {0 10} {1 10} {2 11} {3 11} {4 12} {5 12} {6 13} {7 13} {8 13} {10 19} {16 9} {9 10} {11 19} {15 12} {12 20} {13 20} {13 17} {14 18} {18 19} {19 23} {20 23} {20 24} {21 24} {23 26} {22 26} {26 33} {26 32} {32 29} {29 25} {23 27} {27 34} {30 34} {27 35} {31 35} {27 28}}) use:Vertex) (piece \"Disc\" Each) (piece \"Marker\" Shared)}) (rules (start { (set Shared Edge (sites Board Edge))}) (play (forEach Site (sites Board) (if (> (count Sites in:(sites Incident Edge of:Vertex at:(to) Shared)) 0) (move Add (to (intersection (sites Empty) (sites {(to)}))) (then (and (if (is TreeCentre Shared) (addScore Mover 1)) (forEach Site (sites Incident Edge of:Vertex at:(last To)) (remove Edge (to))))))))) (end (if (no Moves Mover) (byScore)))))\n\n###\n\n", "completion": "(game \"Ilpion\" (players 4) (equipment { (board (graph vertices:{ {1 0.5} {3 0} {5 0} {6 0} {7 0} {8 0} {10 0} {11 0} {12 3} {0 2} {3 2} {5 2} {8 2} {8.5 2} {2 3} {7 3} {1 4} {12 4} {2 5} {5 5} {10 5} {10 8} {2 7} {6 7} {8 7} {0 10} {2 9} {5 9} {10 9} {1 10} {5 14} {10 10} {1 12} {4 12} {7 14} {9 12}} edges:{ {0 10} {1 10} {2 11} {3 11} {4 12} {5 12} {6 13} {7 13} {8 13} {10 19} {16 9} {9 10} {11 19} {15 12} {12 20} {13 20} {13 17} {14 18} {18 19} {19 23} {20 23} {20 24} {21 24} {23 26} {22 26} {26 33} {26 32} {32 29} {29 25} {23 27} {27 34} {30 34} {27 35} {31 35} {27 28}}) use:Vertex) (piece \"Disc\" Each) (piece \"Marker\" Shared)}) (rules (start { (set Shared Edge (sites Board Edge))}) (play (forEach Site (sites Board) (if (> (count Sites in:(sites Incident Edge of:Vertex at:(to) Shared)) 0) (move Add (to (intersection (sites Empty) (sites {(to)}))) (then (and (if (is TreeCentre Shared) (addScore Mover 1)) (forEach Site (sites Incident Edge of:Vertex at:(last To)) (remove Edge (to))))))))) (end (if (no Moves Mover) (byScore))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x7 board. Four counters per hole. The first player takes all of the counters from one of their holes. If they take from the central hole, they can be placed in any other hole on the board. If they are from any other hole, they can be placed in any hole except the opposite hole on the opponent's side. Once both players have made this initial move, the main phase of the game begins. Players alternate turns taking counters from one of the holes on their side of the board and sowing them. Groups of four counters are always sown. Play can occur in a clockwise or anti-clockwise direction. Players sow four counters at a time; that is, placing four counters in each hole. When the final four counters land in an empty hole in the player's row, any counters in the opponent's opposite hole are captured, and the player may sow again from another hole. Play continues until all of the counters have been captured, and the player with the most counters wins. \n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (+ (count in:(sites Mover)) (count Cell at:(handSite #1)))) (define \"NoPieceOnBoard\" (= 4 (count Pieces All in:(sites Board)))) (define \"Columns\" 7) (game \"Luuth\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" store:None { (track \"TrackCCW\" \"0,E,N,W\" loop:True) (track \"TrackCW\" \"6,W,N,E\" loop:True)}) (piece \"Seed\" Shared) (hand Each) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start (set Count 4 to:(sites Track))) phases:{ (phase \"Opening\" (play (move (from (sites Mover)) (to (if (is In (from) (sites Centre)) (difference (sites Board) (from)) (difference (sites Board) (sites {(from) (\"OppositePit\" (from))})))) count:(count at:(from)))) (nextPhase Mover \"Sowing\")) (phase \"Sowing\" (play (or (move Select (from (sites Mover) if:(is Occupied (from))) (then (sow numPerHole:4 \"TrackCCW\" apply:(if (and (is In (to) (sites Mover)) (= 4 (count at:(to)))) (and (moveAgain) (if (is Occupied (\"OppositePit\" (to))) (fromTo (from (\"OppositePit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePit\" (to)))))))))) (move Select (from (sites Mover) if:(is Occupied (from))) (then (sow numPerHole:4 \"TrackCW\" apply:(if (and (is In (to) (sites Mover)) (= 4 (count at:(to)))) (and (moveAgain) (if (is Occupied (\"OppositePit\" (to))) (fromTo (from (\"OppositePit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePit\" (to)))))))))))))} (end (\"MancalaByScoreWhen\" (\"NoPieceOnBoard\"))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n8x8 board. The pieces move as follows, with the number per player: 1 x Shah (king): moves one space orthogonally or diagonally. 1 x Fers (counselor): Any distance orthogonally or diagonally.]. 2 x Rukh (rook): Any number of spaces orthogonally. 2 x Pil (elephant): Any distance diagonally. 2 x Asb (horse): Moves as a chess knight. 8 x Sarbaz (soldier): Moves one space forward orthogonally; one space forward diagonally to capture. No en passant. The first move must be the Fers's Sarbaz, which moves two spaces forward. Castling can happen in three moves, moving the Shah forward or backward once orthogonally and once with the Asb's move, and moving the Rukh to the Shah's former space. Castling can also be done on the Fers's side, but moving the Rukh to the Fers's space. When a piece moves to a space occupied by an opponent's piece, the opponent's piece is captured. If the Shah can be captured on the opponent's next turn, it is in check. A player's Shah must not be in check at the end of their turn. If this is impossible, it is checkmate and the opponent wins.\n \n\n###\n\n", "completion": "(define \"PieceHasMoved\" (set State at:#1 0)) (game \"Persian Chess with a Queen\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (piece \"King_noCross\" Each (or { (\"StepToNotFriend\" ~ (then (if (and (= 1 (state at:(last To))) (= (last To) (mapEntry \"AheadKing\" Mover))) (set State at:(last To) 2) (if (!= (state at:(last To)) 0) (\"PieceHasMoved\" (last To)))))) (if (and { (= 1 (state at:(from))) (= 1 (state at:(mapEntry \"RookRight\" Mover))) (is Empty (mapEntry \"KnightKingRightForward\" Mover))}) (move (from) (to (mapEntry \"KnightKingRightForward\" Mover)) (then (if (!= (state at:(last To)) 0) (\"PieceHasMoved\" (last To)))))) (if (and { (= 1 (state at:(from))) (= 1 (state at:(mapEntry \"RookLeft\" Mover))) (is Empty (mapEntry \"KnightKingLeftForward\" Mover))}) (move (from) (to (mapEntry \"KnightKingLeftForward\" Mover)) (then (if (!= (state at:(last To)) 0) (\"PieceHasMoved\" (last To)))))) (if (and { (= 2 (state at:(from))) (= 2 (state at:(regionSite (sites Start (piece (id \"King\" Mover))) index:0)))}) (move (from) (to (mapEntry \"KnightKingLeftBackward\" Mover)) (then (\"PieceHasMoved\" (last To))))) (if (and { (= 2 (state at:(from))) (= 3 (state at:(regionSite (sites Start (piece (id \"King\" Mover))) index:0)))}) (move (from) (to (mapEntry \"KnightKingRightBackward\" Mover)) (then (\"PieceHasMoved\" (last To)))))})) (piece \"Rook\" Each (move Slide Orthogonal (to if:(\"IsEnemyAt\" (to)) (apply (remove (to)))) (then (if (= (state at:(last To)) 1) (if (and (is In (last To) (sites Start (piece (id \"King\" Mover)))) (= 2 (state at:(where \"King\" Mover)))) (if (= (last From) (mapEntry \"RookLeft\" Mover)) (set State at:(last To) 2) (set State at:(last To) 3)) (\"PieceHasMoved\" (last To)))))) maxState:3) (\"ChessBishop\" \"Bishop_noCross\") (\"ChessKnight\" \"Knight\") (\"ChessQueen\" \"Ferz_noCross\") (\"ChessPawn\" \"Pawn\") (map \"RookLeft\" {(pair 1 \"A1\") (pair 2 \"A8\")}) (map \"RookRight\" {(pair 1 \"H1\") (pair 2 \"H8\")}) (map \"AheadKing\" {(pair 1 \"E2\") (pair 2 \"E7\")}) (map \"KnightKingRightForward\" {(pair 1 \"G2\") (pair 2 \"G7\")}) (map \"KnightKingLeftForward\" {(pair 1 \"C2\") (pair 2 \"C7\")}) (map \"KnightKingRightBackward\" {(pair 1 \"G1\") (pair 2 \"G8\")}) (map \"KnightKingLeftBackward\" {(pair 1 \"C1\") (pair 2 \"C8\")})}) (rules (start { (place \"Pawn1\" (sites Row 1)) (place \"Pawn2\" (sites Row 6)) (place \"Rook1\" {\"A1\" \"H1\"} state:1) (place \"Knight1\" {\"B1\" \"G1\"}) (place \"Bishop_noCross1\" {\"C1\" \"F1\"}) (place \"Ferz_noCross1\" coord:\"D1\") (place \"King_noCross1\" coord:\"E1\" state:1) (place \"Rook2\" {\"A8\" \"H8\"} state:1) (place \"Knight2\" {\"B8\" \"G8\"}) (place \"Bishop_noCross2\" {\"C8\" \"F8\"}) (place \"Ferz_noCross2\" coord:\"D8\") (place \"King_noCross2\" coord:\"E8\" state:1)}) (play (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King_noCross\" Mover)))) (end (\"Checkmate\" \"King_noCross\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\nFour 3x4 rectangles, arranged in a cross shape, with a large central square which has diagonals, and spaces in the four corners between each arm of the cross. Four players, played on two teams, with team members sitting on opposite sides of the board. Four pieces per player, with the colors red, black, yellow, and green. Six cowrie shells used as dice: five are white and one is yellow. The number of the mouths which are face-up determine the value of the throw, except for a throw of 3 when one of the cowries with the mouth down is the yellow one, in which case the throw is known as So-hatara, and counts as 4, but allows special moves because it is actually considered four individual throws of 1. When the player throws 1, 5, or So-hatara, the player receives an extra throw. A 1, 5, or So-hatara must be thrown to enter a piece on the board. The entirety of a throw must be used to move one piece, but separate throws in a turn can each be used individually to move a different piece. This does not apply when So-hatara is one of the throws; in this case, the total of the throw can be subdivided however the player sees fit. Pieces enter the board from the center, moving down the central track of their arm, then in an anti-clockwise direction around the board, and then back up the central row of their arm of the board to the central square. If a player lands on a space occupied by a piece of the opposing team, the opponent's piece is sent back to start. Pieces resting on the corner spaces between the arms of the cross cannot be sent to start in any circumstance. The first team who places all of their pieces in the central square wins.\n \n\n###\n\n", "completion": "(define \"PlayingSohatara\" (is Pending)) (define \"Move\" (if (\"IsEndTrack\" (\"NextSiteOnTrack\" #1)) \"RemoveAPiece\" (if (\"IsNotOffBoard\" (\"NextSiteOnTrack\" #1)) (if (or (is Empty (\"NextSiteOnTrack\" #1)) (and (\"IsEnemyAt\" (\"NextSiteOnTrack\" #1)) (not (is In (\"NextSiteOnTrack\" #1) (sites \"SafeSites\"))))) (move (from) (to (\"NextSiteOnTrack\" #1) \"CaptureEnemyPiece\")))))) (define \"CaptureEnemyPiece\" (\"HittingCapture\" (handSite (who at:(to))))) (define \"RemoveAPiece\" (move Remove (from))) (define \"SpecialThrows\" (or (\"Sohatara\") (is In (\"ThrowValue\") (sites {1 5})))) (define \"ThrowValue\" (count Pips)) (define \"Sohatara\" (and (= (\"ThrowValue\") 3) (= 0 (\"ValueYellowDice\")))) (define \"ValueYellowDice\" (face 65)) (game \"Asi Keliya\" (players 4) (equipment { (board (merge { (add (add (merge { (rectangle 3 4) (shift 7 0 (rectangle 3 4)) (shift 3.5 3.5 (rotate 90 (rectangle 3 4))) (shift 3.5 -3.5 (rotate 90 (rectangle 3 4)))}) vertices:{{5.5 1.5}}) edges:{{4 76} {35 76} {19 76} {20 76}}) (shift 3 3 (square 1)) (shift 7 3 (square 1)) (shift 3 -1 (square 1)) (shift 7 -1 (square 1))}) { (track \"Track1\" \"6,52,S,E,N3,E,N1,E,N,W3,N1,W1,N,W,S3,W1,S1,W,S,E3,S1,E1,S,E1,N3,End\" P1 directed:True) (track \"Track2\" \"7,11,W,S1,E3,S1,E1,S,E,N3,E1,N1,E,N,W3,N,W1,N,W2,S3,W1,S1,W,S1,E3,End\" P2 directed:True) (track \"Track3\" \"17,39,N,W1,S3,W1,S1,W,S,E3,S1,E1,S,E,N3,E,N1,E,N,W3,N,W1,N,W1,S3,End\" P3 directed:True) (track \"Track4\" \"21,26,E,N1,W3,N1,W1,N,W,S3,W1,S1,W,S,E3,S1,E1,S,E,N3,E1,N1,E,N1,W3,End\" P4 directed:True)}) (piece \"Marker\" Each (\"Move\" (\"ThrowValue\"))) (hand Each) (\"StickDice\" 6) (map {(pair P1 6) (pair P2 7) (pair P3 17) (pair P4 21)}) (regions \"SafeSites\" (sites {3 19 16 34}))}) (rules (start { (set Team 1 {P1 P3}) (set Team 2 {P2 P4}) (place \"Marker\" \"Hand\" count:4)}) (play (do (if (not (\"PlayingSohatara\")) (roll)) next:(or (if (\"SpecialThrows\") (move (from (handSite Mover)) (to (mapEntry (mover)) if:(is Empty (mapEntry (mover)))))) (if (or (\"PlayingSohatara\") (\"Sohatara\")) (forEach Die if:(\"DieNotUsed\") (forEach Piece (\"Move\" (pips))) (then (if (not (all DiceUsed)) (and (set Pending) (moveAgain))))) (forEach Piece))) (then (if (\"SpecialThrows\") (moveAgain))))) (end (\"EscapeTeamWin\")))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game is played on a 9x9 board -> The game is played on a 15x15 board\n(game \"Gonnect\" (players 2) (equipment { (board (square 9) use:Vertex) (piece \"Marker\" Each) (regions P1 {(sites Side N) (sites Side S)}) (regions P2 {(sites Side W) (sites Side E)})}) (rules (meta { (swap) (no Repeat)}) (play (do (move Add (to (sites Empty)) (then (\"EncloseCapture\" Orthogonal))) ifAfterwards:(\"HasFreedom\" Orthogonal))) (end { (if (is Connected Mover) (result Mover Win)) (\"BlockWin\")})))\n\n###\n\n", "completion": "(game \"Gonnect\" (players 2) (equipment { (board (square 15) use:Vertex) (piece \"Marker\" Each) (regions P1 {(sites Side N) (sites Side S)}) (regions P2 {(sites Side W) (sites Side E)})}) (rules (meta { (swap) (no Repeat)}) (play (do (move Add (to (sites Empty)) (then (\"EncloseCapture\" Orthogonal))) ifAfterwards:(\"HasFreedom\" Orthogonal))) (end { (if (is Connected Mover) (result Mover Win)) (\"BlockWin\")}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe board begins initially with one stone on each playable site. First, according to the player's wish, one stone must be removed. Then, each piece jumps over another piece to an empty site to remove the piece that was jumped over. If the player has no move, they lose. If only one stone is left on the board, the player wins. A win is considered to be good luck and anything you pray for will come true. \n\n###\n\n", "completion": "(game \"Jiu Zi Xian Qi\" (players 1) (equipment { (\"StarBoard\" 5) (piece \"Marker\" P1 (\"HopFriendCapture\"))}) (rules (start (place \"Marker\" (sites Board))) phases:{ (phase \"Remove\" (play (move Remove (sites Board))) (nextPhase \"Playing\")) (phase \"Playing\" (play (forEach Piece)) (end { (if (= 1 (count Pieces P1)) (result Mover Win)) (\"NoMoves\" Loss)}))})) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe first player begins the game by placing a stone anywhere on the board. Then, starting with the second player, players take turns placing a stone orthogonally adjacent to exactly one enemy stone and no friendly stones. \n\n###\n\n", "completion": "(game \"Gopher\" (players 2) (equipment { (board (hex 6)) (piece \"Disc\" Each)}) (rules (play (if (= 0 (count Moves)) (move Add (to (sites Empty))) (move Add (to (sites Empty) if:(and (= 0 (count Sites in:(sites Around (to) Own))) (= 1 (count Sites in:(sites Around (to) Enemy)))))))) (end (\"NoMoves\" Loss)))) END" }, { "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": "Modify the Ludii game according to the following option changes:\nA size 4 board is currently selected -> A size 6 board is currently selected\n(game \"Bamboo\" (players 2) (equipment { (board (hex 4)) (piece \"Disc\" Each) (piece \"Disc\" Neutral)}) (rules (play (do (move Add (to (sites Empty))) ifAfterwards:(<= (max (results from:(sites Occupied by:Mover) to:1 (* 1 (size Group at:(from))))) (count Groups if:(= (who at:(to)) (mover)))))) (end (\"NoMoves\" Loss))))\n\n###\n\n", "completion": "(game \"Bamboo\" (players 2) (equipment { (board (hex 6)) (piece \"Disc\" Each) (piece \"Disc\" Neutral)}) (rules (play (do (move Add (to (sites Empty))) ifAfterwards:(<= (max (results from:(sites Occupied by:Mover) to:1 (* 1 (size Group at:(from))))) (count Groups if:(= (who at:(to)) (mover)))))) (end (\"NoMoves\" Loss)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayed on a board with 36 holes arranged in a square, with a gap in the center of each side. There are arcs of five holes branching from opposite corners. Can be played with two to four players, who can also play on teams. One or two pieces per player.\n Four stick dice are used, with one marked side. Each die is marked differently for a different value: 4, 6, 14, 15. The throws are as follows: All marked sides up = 5; three marked sides up = 3; two marked sides up = 2, one marked side up = the value of the marked side; zero marked sides up = 10. \n Players\u2019 pieces enter on the branching arcs. The second piece cannot enter before the first one leaves the arc.\n Each player can choose which direction they wish to move around the board, but they must continue in this direction for the rest of the game. If a player lands on the same spot as the opponent, the opponent\u2019s piece is removed from the board and must re-enter.\n Player must make an exact throw to get a piece off the board after reentering the arc from the spot where the player entered the board. The player to get both of their pieces off the board first wins. 2 players. Each player has 2 pieces.\n\n###\n\n", "completion": "(define \"PieceCanEnterOnlyIfNoPieceOnArc\" (and (= (from) (handSite Mover)) (all Sites (sites Mover \"Arc\") if:(!= (who at:(site)) Mover)))) (define \"PieceAlreadyEntered\" (!= (from) (handSite Mover))) (define \"RememberSelectedTrack\" (then (if (and (= (state at:(last To)) 0) (is In (last To) (sites \"AllSitesDifferentThanArc\"))) (set State at:(last To) #1)))) (define \"MoveOn\" (if (\"IsEndTrack\" #1) \"RemoveAPiece\" (if (\"IsNotOffBoard\" #1) (if (not (\"IsFriendAt\" #1)) (move (from) (to #1 \"CaptureEnemyPiece\")))) #2)) (define \"RemoveAPiece\" (move Remove (from))) (define \"CaptureEnemyPiece\" (apply if:(\"IsEnemyAt\" (to)) (and (set State at:(to) 0) (fromTo (from (to)) (to (handSite Next)))))) (define \"ThrowValue\" (mapEntry \"Throw\" (count Pips))) (define \"SiteToMoveOnTrackCCW\" (\"NextSiteOnTrack\" (\"ThrowValue\")\"TrackCCW\")) (define \"SiteToMoveOnTrackCW\" (\"NextSiteOnTrack\" (\"ThrowValue\") \"TrackCW\")) (define \"SiteToMoveOnSelectedTrack\" (if (= (state at:(from)) 2) (\"NextSiteOnTrack\" (\"ThrowValue\") \"TrackCCW\") (\"NextSiteOnTrack\" (\"ThrowValue\")\"TrackCW\"))) (game \"Ghingskoot\" (players 2) (equipment { (\"KintsBoard\" { (track \"TrackCW1\" \"46,5,SSE,N,E,S,W,NNW,End\" P1 directed:True) (track \"TrackCCW1\" \"46,5,SSE,E,N,W,S,NNW,End\" P1 directed:True) (track \"TrackCW2\" \"47,41,NNW,S,W,N,E,SSE,End\" P2 directed:True) (track \"TrackCCW2\" \"47,41,NNW,W,S,E,N,SSE,End\" P2 directed:True)}) (regions \"AllSites\" (sites Board)) (regions \"Arc\" P1 (sites {1..5})) (regions \"Arc\" P2 (sites {41..45})) (regions \"AllSitesDifferentThanArc\" (difference (sites Board) (union {(sites P1 \"Arc\") (sites P2 \"Arc\") (sites {0 32})}))) (dice d:2 facesByDie:{{0 4} {0 6} {0 14} {0 15}} num:4) (piece \"Marker\" Each (if (= (state at:(from)) 0) (if (or (\"PieceAlreadyEntered\") (\"PieceCanEnterOnlyIfNoPieceOnArc\")) (or (\"MoveOn\" \"SiteToMoveOnTrackCW\" (\"RememberSelectedTrack\" 1)) (\"MoveOn\" \"SiteToMoveOnTrackCCW\" (\"RememberSelectedTrack\" 2)))) (\"MoveOn\" \"SiteToMoveOnSelectedTrack\"))) (hand Each) (map \"Throw\" { (pair 0 10) (pair 39 5) (pair 24 3) (pair 25 3) (pair 35 3) (pair 33 3) (pair 10 2) (pair 18 2) (pair 19 2) (pair 20 2) (pair 21 2) (pair 29 2)})}) (rules (start (place \"Marker\" \"Hand\" count:2)) (play (\"RollMove\" (or (forEach Piece) (forEach Piece container:(mover))))) (end (\"EscapeWin\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\nA player moves one disk at a time to an empty rod or on a rod where it rests on a larker disk. The goal is to place all of the disks on one rod in decreasing size with the largest on the bottom and the smallest on top. \n\n###\n\n", "completion": "(game \"Tower of Hanoi\" (players 1) (equipment { (board (rectangle 1 3)) (piece \"Counter3\" P1) (piece \"Counter6\" P1) (piece \"Counter9\" P1)}) (rules (start { (place Stack items:{\"Counter9\" \"Counter6\" \"Counter3\"} 0)}) (play (\"MoveToEmptyOrOccupiedByLargerPiece\" (sites Occupied by:Mover))) (end { (if (is Target {3 2 1} 2) (result P1 Win)) (if (= (count Moves) 7) (result P1 Loss))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\n6x3 or 6 board. Two counters in each hole. Sowing occurs from one of the holes in the player's outermost row which contains counters, in either direction. Sowing moves in a boustrophedon path along the holes, moving from the last hole in the innermost row to the beginning of the outer row. When the final counter lands in an occupied hole, the contents of this hole are picked up and sowing continues. If this hole is in the player's inner row, the contents of the opponent's hole opposite it are captured, and these counters are also used along with the hole in which the last counter fell for the sowing to continue. If the opponent's inner row hole is empty, counters may be captured from their central row, and if both the inner and central rows are empty, captures may be made from the outer hole. Sowing ends when the final counter lands in an empty hole. When a player has only one counter on their side of the board, it may capture by moving from the central row directly to the inner row hole above it to make a capture (i.e., without following the normal track), and on the move prior to the capture, from the outer to the central row. Play continues until one player has captured all of the counters. 6 Holes per row.\n\n###\n\n", "completion": "(define \"OuterMostRowWithPieces\" (if (!= 0 (count in:(sites Mover \"Outer\"))) (sites Mover \"Outer\") (if (!= 0 (count in:(sites Mover \"Middle\"))) (sites Mover \"Middle\") (sites Mover \"Inner\")))) (define \"OneSingePieceInTheOuter\" (and (= (count in:(sites Mover \"Home\")) 1) (= (count in:(sites Mover \"Outer\")) 1))) (define \"OneSingePieceInTheMiddle\" (and (= (count in:(sites Mover \"Home\")) 1) (= (count in:(sites Mover \"Middle\")) 1))) (define \"NoPiece\" (all Sites (sites Player \"Home\") if:(= 0 (count at:(site))))) (define \"OppositeOuterPit\" (if (is Mover P1) (+ #1 (* \"Columns\" 3)) (- #1 (* \"Columns\" 3)))) (define \"OppositeMiddlePit\" (if (is Mover P1) (+ #1 (* \"Columns\" 2)) (- #1 (* \"Columns\" 2)))) (define \"Columns\" 6) (game \"Katro\" (players 2) (equipment { (mancalaBoard 6 \"Columns\" store:None { (track \"TrackCCW1\" \"0,E,N1,W,N1,E\" loop:True P1) (track \"TrackCW1\" \"5,W,N1,E,N1,W\" loop:True P1) (track \"TrackCW2\" \"18,E,N1,W,N1,E\" loop:True P2) (track \"TrackCCW2\" \"23,W,N1,E,N1,W\" loop:True P2)}) (piece \"Seed\" Shared) (regions \"Home\" P1 (sites Track \"TrackCCW1\")) (regions \"Home\" P2 (sites Track \"TrackCCW2\")) (regions \"Inner\" P1 (sites Row 2)) (regions \"Inner\" P2 (sites Row 3)) (regions \"Middle\" P1 (sites Row 1)) (regions \"Middle\" P2 (sites Row 4)) (regions \"Outer\" P1 (sites Bottom)) (regions \"Outer\" P2 (sites Top))}) (rules (start (set Count 2 to:(sites Board))) (play (or { (if (or (= (value Player Mover) 1) (<= (value Player Mover) 0)) (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (\"OuterMostRowWithPieces\")) if:(> (count at:(from)) 0)) (then (sow \"TrackCCW\" owner:(mover) apply:(if (> (count at:(to)) 1) (and { (if (<= (value Player Mover) 0) (set Value Mover 1)) (moveAgain) (if (is In (to) (sites Mover \"Inner\")) (if (!= 0 (count at:(\"OppositePit\" (to)))) (fromTo (from (\"OppositePit\" (to))) (to (to)) count:(count at:(\"OppositePit\" (to)))) (if (!= 0 (count at:(\"OppositeMiddlePit\" (to)))) (fromTo (from (\"OppositeMiddlePit\" (to))) (to (to)) count:(count at:(\"OppositeMiddlePit\" (to)))) (if (!= 0 (count at:(\"OppositeOuterPit\" (to)))) (fromTo (from (\"OppositeOuterPit\" (to))) (to (to)) count:(count at:(\"OppositeOuterPit\" (to))))))))}) (set Value Mover 0)))))) (if (or (= (value Player Mover) 2) (<= (value Player Mover) 0)) (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (\"OuterMostRowWithPieces\")) if:(> (count at:(from)) 0)) (then (sow \"TrackCW\" owner:(mover) apply:(if (> (count at:(to)) 1) (and { (if (<= (value Player Mover) 0) (set Value Mover 2)) (moveAgain) (if (is In (to) (sites Mover \"Inner\")) (if (!= 0 (count at:(\"OppositePit\" (to)))) (fromTo (from (\"OppositePit\" (to))) (to (to)) count:(count at:(\"OppositePit\" (to)))) (if (!= 0 (count at:(\"OppositeMiddlePit\" (to)))) (fromTo (from (\"OppositeMiddlePit\" (to))) (to (to)) count:(count at:(\"OppositeMiddlePit\" (to)))) (if (!= 0 (count at:(\"OppositeOuterPit\" (to)))) (fromTo (from (\"OppositeOuterPit\" (to))) (to (to)) count:(count at:(\"OppositeOuterPit\" (to))))))))}) (set Value Mover 0)))))) (if (\"OneSingePieceInTheOuter\") (move (from (sites Mover \"Outer\") if:(> (count at:(from)) 0)) (to (if (is Mover P1) (ahead (from) N) (ahead (from) S))))) (if (\"OneSingePieceInTheMiddle\") (move (from (sites Mover \"Middle\") if:(and (> (count at:(from)) 0) (< 1 (count in:(sites Column (column of:(from))))))) (to (if (is Mover P1) (ahead (from) N) (ahead (from) S))) (then (and (if (!= 0 (count at:(\"OppositePit\" (last To)))) (fromTo (from (\"OppositePit\" (last To))) (to (last To)) count:(count at:(\"OppositePit\" (last To)))) (if (!= 0 (count at:(\"OppositeMiddlePit\" (last To)))) (fromTo (from (\"OppositeMiddlePit\" (last To))) (to (last To)) count:(count at:(\"OppositeMiddlePit\" (last To)))) (if (!= 0 (count at:(\"OppositeOuterPit\" (last To)))) (fromTo (from (\"OppositeOuterPit\" (last To))) (to (last To)) count:(count at:(\"OppositeOuterPit\" (last To))))))) (moveAgain)))))})) (end (forEach NonMover if:(\"NoPiece\") (result Player Loss))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nDefinitions:\n 1 A group is a stone along with all stones one can reach from it through a series of steps onto adjacent stones of the same color.\n 1.1 The size of a group is the number of stones in it.\n \n 2 A brood is a group along with all other groups of identical color, size and shape. Shapes are considered identical across symmetries (just like in Bug).\n 2.1 The size of a brood is the number of groups in it.\n 2.2 The order of a brood is the size of the groups in it.\n 2.3 The mass of a brood is the number of stones in it (its size times its order).\n \n Play:\n On the very first turn of the game, Black places one stone of their colour on any hex.\n After, that \u2013 starting with White \u2013 take turns doing one of the following:\n - Pass.\n - Place two stones of your colour on empty hexes.\n \n When the players pass consecutively, the winner is the player with the higher score.\n \n Scoring:\n For each of your broods, you score its mass multiplied by the lesser of its size and its order.\n \n For example, if a brood consists of 2 groups of size 3, it is worth 12 points. Its order is 3, its size is 2 and its mass is 6. Since 2 is smaller than 3, the brood is worth 6*2 = 12. A board of size 5 is currently selected. Nothing is currently printed on the pieces. The 12* placement protocol is currently in effect. This is the protocol described in the rules above.\n\n###\n\n", "completion": "(define \"PlaceHex\" (do (forEach Site (sites Occupied by:Mover) (set State at:(site) 0)) next:(move Add (piece (id \"Hex\" Mover)) (to (sites Empty)) (then (\"RecordShapeVectorsAsValues\"))) (then (\"ScorePlayer\" (mover))))) (define \"ScorePlayer\" (forEach Group if:(= #1 (who at:(to))) (remember Value (regionSite (sites) index:0) unique:True) (then (and { (\"CountShapesOf\" #1) (set Score Mover 0 (then (forEach Piece (addScore Mover (state at:(from))))))})))) (define \"CountShapesOf\" (forEach Value (values Remembered) (and { (set Var \"KeySite\" (value) (then (forEach Group if:(= #1 (who at:(to))) (\"IfShapessMatchDo\" (remember Value \"ShapeCount\" (var \"KeySite\")) (var \"KeySite\")))))} (then (\"RecordMultiplier\"))) (then (forget Value All)))) (define \"RecordMultiplier\" (forEach Site (sites Group at:(var \"KeySite\")) (set State at:(site) (min (\"BroodSize\") (\"GroupSize\"))))) (define \"BroodSize\" (count Value (var \"KeySite\") in:(values Remembered \"ShapeCount\"))) (define \"GroupSize\" (size Group at:(var \"KeySite\"))) (define \"RecordShapeVectorsAsValues\" (set Var \"LastRow\" (row of:(max (array (sites Group at:(last To))))) (then (set Var \"LastCol\" (max (results from:(sites Group at:(last To)) to:(from) (column of:(from)))) (then (forEach Site (sites Group at:(last To)) (set Value at:(site) (+ (* 32 (- (var \"LastRow\") (row of:(site)))) (- (var \"LastCol\") (column of:(site))))))))))) (define \"IfShapessMatchDo\" (if (\"IsSameSizeAsShapeAtValue\" #2) (priority { (\"IfThisRotationDo\" (\"DRow\") (\"DCol\") #1 #2) (\"IfThisRotationDo\" (\"DRow\") (- \"DRow\" \"DCol\") #1 #2) (\"IfThisRotationDo\" (- \"DRow\" \"DCol\") (\"DRow\") #1 #2) (\"IfThisRotationDo\" (\"DCol\") (\"DRow\") #1 #2) (\"IfThisRotationDo\" (- \"DCol\") (- \"DRow\" \"DCol\") #1 #2) (\"IfThisRotationDo\" (- \"DCol\" \"DRow\") (\"DCol\") #1 #2) (\"IfThisRotationDo\" (- \"DRow\") (- \"DCol\") #1 #2) (\"IfThisRotationDo\" (- \"DRow\") (- \"DCol\" \"DRow\") #1 #2) (\"IfThisRotationDo\" (- \"DCol\" \"DRow\") (- \"DRow\") #1 #2) (\"IfThisRotationDo\" (- \"DCol\") (- \"DRow\") #1 #2) (\"IfThisRotationDo\" (\"DCol\") (- \"DCol\" \"DRow\") #1 #2) (\"IfThisRotationDo\" (- \"DRow\" \"DCol\") (- \"DCol\") #1 #2)}))) (define \"IsSameSizeAsShapeAtValue\" (= (size Array (array (sites))) (size Array (array (sites Group at:#1))))) (define \"DCol\" (% (value Piece at:(from)) 32)) (define \"DRow\" (/ (value Piece at:(from)) 32)) (define \"IfThisRotationDo\" (if (= 0 (size Array (difference (results from:(sites Group at:#4) to:(from) (+ (+ (* 32 #1) (#2)) (+ (max (results from:(sites Group at:#4) to:(from) (- (* 32 #1)))) (max (results from:(sites Group at:#4) to:(from) (- (#2))))))) (results from:(sites) to:(from) (value Piece at:(from)))))) #3)) (game \"Brood\" (players 2) (equipment { (board (hex Hexagon 5) use:Cell) (piece \"Hex\" Each maxState:7 maxValue:1023) (piece \"Disc\" Neutral) (hand Shared)}) (rules (play (if (or (= 0 (count Moves)) (!= 0 (count MovesThisTurn))) (\"PlaceHex\") (or (move Pass) (and { (\"PlaceHex\")} (then (moveAgain)))) (then (forget Value All)))) (end (if (all Passed) (byScore))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"NumRemove\" (+ 1 (count MovesThisTurn))) (define \"Max\" (if (= 1 (count Turns)) (- 40 1) (* 2 (value Player (prev MoverLastTurn))))) (game \"Fibonacci Nim\" (players 2) (equipment { (board (square 1)) (piece \"Marker\" Neutral)}) (rules (start (set Count 40 at:0)) (play (if \"SameTurn\" (or (if (<= \"NumRemove\" \"Max\") (move Select (from (last To)) (then (if (= (count at:(last To)) 1) (remove (last To)) (and (set Count at:(last To) (- (count at:(last To)) 1)) (moveAgain)))))) (move Pass (then (set Value Mover (- (\"NumRemove\") 1))))) (move Select (from (sites Occupied by:Neutral)) (then (if (= (count at:(last To)) 1) (remove (last To)) (and (set Count at:(last To) (- (count at:(last To)) 1)) (moveAgain))))))) (end (if (no Moves Next) (result Mover Win)))))\n\n###\n\n", "completion": "Fibonacci Nim is played by two players, who alternate removing coins or other counters from a pile. On the first move, a player is not allowed to take all of the coins, and on each subsequent move, the number of coins removed can be any number that is at most twice the previous move. According to the normal play convention, the player who takes the last coin wins. Or according to the Mis\u00e8re game, the player who takes the last coin loses. The last mover wins. The game involves a pile of 40 pieces. END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayers take turns placing a piece of each color in an empty site. Play ends at the start of the first players turn, if all the players would not be able to complete their turn. Example: for 2 players less than 4 empty sites.\n \n Scores are awarded based on the sizes of the groups of each color on the board, which are multiplied. The player with the highest score wins. The game is played on a 5x5 board The version of the game played with 2 players.\n\n###\n\n", "completion": "(game \"Omega\" (players 2) (equipment { (board (hex 5)) (piece \"Marker\" Each)}) (rules (play (move Add (piece (+ 1 (% (count Moves) (count Players)))) (to (sites Empty)) (then (if (!= (count MovesThisTurn) (- (count Players) 1)) (moveAgain))))) (end (if (and { (not (is Mover P1)) (is Next P1) (> (pow (count Players) 2) (count Sites in:(sites Empty)))}) (byScore {(score P1 (* (sizes Group P1))) (score P2 (* (sizes Group P2)))}))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nA player wins by connecting opposite sides of the square board with a chain of their pieces. The game is played on a 13x13 board The first player to connect their two sides wins.\n\n###\n\n", "completion": "(game \"Gale\" (players 2) (equipment { (board (square 13)) (piece \"Square\" Each) (regions P1 {(sites Top) (sites Bottom)}) (regions P2 {(sites Left) (sites Right)})}) (rules (start { (place \"Square1\" (forEach (sites Board) if:(and (is Even (column of:(site))) (is Odd (row of:(site)))))) (place \"Square2\" (forEach (sites Board) if:(and (is Even (row of:(site))) (is Odd (column of:(site))))))}) (play (move Add (to (sites Empty)))) (end (if (is Connected Mover) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n5x5 intersecting lines. Triangles on each side, with the apex intersecting with the midpoint of the side of the square. A line is drawn from the apex to the base of each triangle, and a line bisecting it and the two opposite sides. A diamond is drawn within the square, the corners of which intersect with the apices of the triangles and the midpoint of each side is the center point of each quadrant of the square. 24 pieces per player, which begin on the points of the board closest to the player and in the triangle to their right and the right half of the central row. The central point is vacant. Players alternate turns moving a piece to an empty adjacent spot on the board. A piece may capture an opponent's piece by hopping over it to an empty adjacent spot immediately on the opposite side of the opponent's pieces along the lines on the board. The player who captures all of the opponent's pieces wins. \n\n###\n\n", "completion": "(game \"Padaivettu\" (players 2) (equipment { (board (remove (\"AlquerqueGraphWithFourTriangles\") edges:{{20 16} {16 12} {12 8} {8 4} {0 6} {6 12} {12 18} {18 24}}) use:Vertex) (piece \"Marker\" Each (or (\"StepToEmpty\") (\"HopCapture\")))}) (rules (start { (place \"Marker1\" (difference (union (expand (sites Right)) (expand (sites Bottom) steps:4)) (expand (sites Centre) steps:2 W))) (place \"Marker2\" (difference (union (expand (sites Left)) (expand (sites Top) steps:4)) (expand (sites Centre) steps:2 E)))}) (play (forEach Piece)) (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nGoal:Score the product of the sizes of your two largest chains. Highest score wins. \n In case of a tie, the last to play wins.\n \n Chains are a series of adjacent like-colored stones with no branching.\n \n Play:\n Boards starts empty. The darker color starts.\n \n On a turn the moving player does one of these actions:\n - Place one of their stones onto an empty site adjacent to no more than 2 of their stones, or\n - Remove one of their stones that is adjacent to more than two of their stones.\n \n Otherwise he passes.\n \n The game ends when both players pass. Order 9, Square Ortho-Grid\n\n###\n\n", "completion": "(define \"GridDirection\" Orthogonal) (define \"AddOrPass\" (or { (move Add (piece (id \"Disc\" Mover)) (to (sites Empty) if:(> 3 (count Pieces Mover in:(sites Around (to) \"GridDirection\")))) (then (set Var \"Added\" 1))) (move Pass)})) (define \"Score4\" (do (forEach Site (sites Occupied by:#1) (if (> 3 (count Pieces #1 in:(sites Around (site) \"GridDirection\"))) (set State at:(site) 0) (set State at:(site) 1))) next:(do (and { (remember Value 0) (remember Value 0) (forEach Group \"GridDirection\" (if (no Pieces in:(intersection (sites) (sites State 1))) (remember Value (count Sites in:(sites)))))}) next:(set Var \"TopValue\" (max (values Remembered)) (then (forget Value (max (values Remembered)) (then (set Score #1 (* (var \"TopValue\") (max (values Remembered))) (then (forget Value All)))))))))) (define \"GridDirection\" Orthogonal) (game \"Wrigglers Squared\" (players 2) (equipment { (board (square 9) use:Vertex) (piece \"Disc\" Each)}) (rules (play (if (= 1 (var \"Added\")) (or { \"AddOrPass\" (forEach Piece (if (< 2 (count Pieces Mover in:(sites Around (from) \"GridDirection\"))) (move Remove (from) (then (set Var \"Added\" 0)))) Mover)}) \"AddOrPass\" (then (\"Score4\" Mover)))) (end (if (all Passed) { (if (>= (score Mover) (score Next)) (result Mover Win))} (result Next Win))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game is played on the Graph2. -> The game is played on the Graph3.\n(game \"Nedilmarth\" (players 2) (equipment { (board (graph vertices:{ {4 0} {12 0} {5 3} {8 4} {11 3} {4 6} {6 7} {8 6} {10 7} {12 6} {0 10} {3 9} {7 9} {9 9} {13 9} {16 10} {5 11} {11 11} {8 13} {8 16}} edges:{{0 1} {0 2} {0 10} {1 4} {1 15} {2 3} {2 5} {3 4} {3 7} {4 9} {5 6} {5 11} {10 11} {11 16} {6 12} {6 7} {7 8} {8 9} {9 14} {14 15} {8 13} {13 12} {12 16} {13 17} {14 17} {16 18} {18 17} {18 19} {10 19} {15 19}}) use:Edge) (piece \"Marker\" Neutral)}) (rules (start { (set Neutral Edge (sites Board Edge))}) (play (move Remove (sites Occupied by:Neutral on:Edge))) (end (if (is Tree Neutral) (result Mover Win)))))\n\n###\n\n", "completion": "(game \"Nedilmarth\" (players 2) (equipment { (board (dual (rotate 45 (square 7))) use:Edge) (piece \"Marker\" Neutral)}) (rules (start { (set Neutral Edge (sites Board Edge))}) (play (move Remove (sites Occupied by:Neutral on:Edge))) (end (if (is Tree Neutral) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe board is a square, with the diagonals drawn. A circle is drawn around the midpoint of the top side of the square. Two pieces per player, the pieces for one player on the top corners and the other on the remaining corners. Players alternate turns moving along the lines on the board, the player on the top corners moving first, but can never move along the line with the circle. The player who blocks their opponent from being able to move wins. \n\n###\n\n", "completion": "(game \"Oumoul Kono\" (players 2) (equipment { (board (square 2 diagonals:Solid) use:Vertex) (piece \"Disc\" Each (move Step (to if:(and { (or { (and (!= (from) (coord \"A3\")) (!= (from) (coord \"C3\"))) (and (= (from) (coord \"C3\")) (!= (to) (coord \"A3\"))) (and (= (from) (coord \"A3\")) (!= (to) (coord \"C3\")))}) (is Empty (to))}))))}) (rules (start { (place \"Disc1\" (sites Bottom)) (place \"Disc2\" (sites Top))}) (play (forEach Piece)) (end (\"NoMoves\" Loss)))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nOrder 2 board -> Order 4 board\nSquare 2N grid w/even nodes, no center -> Square 2N grid w/even nodes, no center\nHighly tactical. Control a site with a surplus of 1 on lines of sight. -> Tactical. Control a site with a surplus of 2 on lines of sight.\n(define \"ColourBackground\" (colour 135 170 130)) (define \"SquareDiagonal\" (board (square 4) use:Vertex)) (define \"SquareGrid\" (board (square 4) use:Vertex)) (define \"Hex2Limp\" (board (dual (hex (/ 4 2) (+ 2 (/ 4 2)))) use:Vertex)) (define \"BoardUsed\" \"SquareDiagonal\") (define \"LoSDirection\" All) (define \"MoveTwiceThenScore\" (if (is Prev Next) (moveAgain) (and (\"ScoreFor\" Mover) (\"ScoreFor\" Next)))) (define \"ScoreFor\" (set Score #1 (+ (results from:(forEach (difference (difference (sites Board) (sites Occupied by:#1)) (sites Occupied by:Neutral)) if:(\"IsControlledBy\" #1 (site))) to:(from) (if (is Empty (to)) 1 2))))) (define \"IsControlledBy\" (<= (+ 1 (count Pieces in:(sites Around (#2) \"LoSDirection\" if:(!= 0 (who at:(to)))))) (* 2 (count Pieces #1 in:(sites Around (#2) \"LoSDirection\"))))) (game \"Dogtown Clans\" (players 2) (equipment { \"BoardUsed\" (piece \"Counter\" P1) (piece \"Counter\" P2) (piece \"X\" Neutral) (piece \"Counter\" Neutral)}) (rules (meta (passEnd NoEnd)) (play (if (and (= -1 (var \"DoubleTurnPhase\")) (= 1 (mover))) (or (move Pass) (move Add (piece \"X0\") (to (sites Empty)) (then (if (> 2 (count Pieces in:(sites Occupied by:Neutral))) (moveAgain))))) (or { (move Add (to (sites Empty) if:(not (\"IsControlledBy\" Next (to)))) (then (if (= -1 (var \"DoubleTurnPhase\")) (set Var \"DoubleTurnPhase\" 1) (\"MoveTwiceThenScore\")))) (move Remove (forEach (sites Occupied by:Next) if:(\"IsControlledBy\" Mover (site))) (then (\"MoveTwiceThenScore\")))}) (then (if (no Moves Next) (and (\"ScoreFor\" Mover) (\"ScoreFor\" Next)))))) (end (if (no Moves Mover) (result Mover Loss)))))\n\n###\n\n", "completion": "(define \"ColourBackground\" (colour 135 170 130)) (define \"SquareDiagonal\" (board (square 8) use:Vertex)) (define \"SquareGrid\" (board (square 8) use:Vertex)) (define \"Hex2Limp\" (board (dual (hex (/ 8 2) (+ 2 (/ 8 2)))) use:Vertex)) (define \"BoardUsed\" \"SquareGrid\") (define \"LoSDirection\" Orthogonal) (define \"MoveTwiceThenScore\" (if (is Prev Next) (moveAgain) (and (\"ScoreFor\" Mover) (\"ScoreFor\" Next)))) (define \"ScoreFor\" (set Score #1 (+ (results from:(forEach (difference (difference (sites Board) (sites Occupied by:#1)) (sites Occupied by:Neutral)) if:(\"IsControlledBy\" #1 (site))) to:(from) (if (is Empty (to)) 1 2))))) (define \"IsControlledBy\" (<= (+ 2 (count Pieces in:(sites Around (#2) \"LoSDirection\" if:(!= 0 (who at:(to)))))) (* 2 (count Pieces #1 in:(sites Around (#2) \"LoSDirection\"))))) (game \"Dogtown Clans\" (players 2) (equipment { \"BoardUsed\" (piece \"Counter\" P1) (piece \"Counter\" P2) (piece \"X\" Neutral) (piece \"Counter\" Neutral)}) (rules (meta (passEnd NoEnd)) (play (if (and (= -1 (var \"DoubleTurnPhase\")) (= 1 (mover))) (or (move Pass) (move Add (piece \"X0\") (to (sites Empty)) (then (if (> 2 (count Pieces in:(sites Occupied by:Neutral))) (moveAgain))))) (or { (move Add (to (sites Empty) if:(not (\"IsControlledBy\" Next (to)))) (then (if (= -1 (var \"DoubleTurnPhase\")) (set Var \"DoubleTurnPhase\" 1) (\"MoveTwiceThenScore\")))) (move Remove (forEach (sites Occupied by:Next) if:(\"IsControlledBy\" Mover (site))) (then (\"MoveTwiceThenScore\")))}) (then (if (no Moves Next) (and (\"ScoreFor\" Mover) (\"ScoreFor\" Next)))))) (end (if (no Moves Mover) (result Mover Loss))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n5x5 board, played on intersections, with diagonals for each quadrant of the board. One player plays with two tiger pieces, placed on the midpoints of two opposite sides. The other player plays with nineteen goats, divided into three stacks of five and one stack of four, placed in the center of each quadrant. The goats move first. Goats may move one at a time to any adjacent vacant spot. More than one goat can be placed on the goats' starting spots, but not elsewhere. The tiger moves in the same manner, but also may capture a piece by hopping over it. Multiple captures can be made on the same turn with subsequent hops, but only the top goat in a stack is captured when a tiger leaps over it. The goal of the goats is to surround the tigers so they cannot move. The goal of the tigers is to capture all the goats.\n \n\n###\n\n", "completion": "(game \"Sher Bakar\" (players 2) (equipment { (\"AlquerqueBoard\" 5 5) (piece \"Goat\" P1 (move Step (to if:(or (and (is In (to) (sites \"StartingSitesGoats\")) (\"IsFriendAt\" (to))) (is Empty (to)))))) (piece \"Tiger\" P2 (or (\"StepToEmpty\") (\"HopSequenceCapture\"))) (regions \"StartingSitesGoats\" (sites {\"B2\" \"D2\" \"D4\" \"B4\"}))}) (rules (start { (place \"Tiger2\" (sites {\"C1\" \"C5\"})) (place Stack \"Goat1\" (sites {\"B2\" \"D2\" \"D4\"}) count:5) (place Stack \"Goat1\" (sites {\"B4\"}) count:4)}) (play (if (\"SameTurn\") (or (move Pass) (\"HopSequenceCaptureAgain\")) (forEach Piece top:True))) (end (\"NoMovesP2NoPiecesP1\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\nAll rules are the same as regular Xiangqi. \n\n###\n\n", "completion": "(define \"StepMoveOnThePalace\" (move Step #1 (to if:(and (is In (to) (sites Mover \"Palace\")) (not (\"IsFriendAt\" (to)))) (apply (remove (to)))))) (define \"JiangSameColumnWithNoPieceBetween\" (if (= (column of:(where \"Jiang\" P1)) (column of:(where \"Jiang\" P2))) (not (\"NoSites\" (forEach (sites Direction from:(where \"Jiang\" P1) N stop:(= (to) (where \"Jiang\" P2))) if:(is Occupied (site))))) True)) (game \"Xiang Hex\" (\"TwoPlayersNorthSouth\") (equipment { (board (renumber Cell (rotate 90 (remove (hex Rectangle 9 11) cells:{0 1 11 21 63 74 85 84 94 93 83 73 31 20 9 10})))) (piece \"Jiang\" Each (\"StepMoveOnThePalace\" Orthogonal)) (piece \"Shi\" Each (\"StepMoveOnThePalace\" Diagonal)) (piece \"Xiang\" Each (move Slide Diagonal (between (exact 2) if:(and { (is In (between) (sites Mover \"Home\")) (is Empty (between))})) (to if:(\"IsEnemyAt\" (to)) (apply (remove (to)))))) (piece \"Ma\" Each (forEach Direction Orthogonal (to if:(is Empty (to)) (apply (forEach Direction (from (to)) (directions {FR FL} of:All) (if (not (\"IsFriendAt\" (to))) (move (from) (to (apply if:(\"IsEnemyAt\" (to)) (remove (to))))))))))) (piece \"Ju\" Each (\"SlideCapture\" Orthogonal)) (piece \"Pao\" Each (or (move Slide Orthogonal) (move Hop Orthogonal (between before:(count Rows) after:(count Rows) if:(is Occupied (between))) (to if:(is Empty (to)) (apply if:(\"IsEnemyAt\" (to)) (remove (to))))))) (piece \"Zu\" Each (\"StepToNotFriend\" (if (is In (from) (sites Mover \"Home\")) Forward (union (directions {Forward FL FR}) (directions {W E}))))) (regions \"PalaceP1\" P1 { 0 1 2 4 7 8 12}) (regions \"PalaceP2\" P2 { 66 70 71 74 76 77 78}) (regions \"Home\" P1 (forEach (sites Board) if:(< (site) 37))) (regions \"Home\" P2 (forEach (sites Board) if:(> (site) 41)))}) (rules (start { (place \"Jiang1\" coord:\"A1\") (place \"Shi1\" {\"A2\" \"B1\"}) (place \"Xiang1\" {\"A3\" \"C1\"}) (place \"Ma1\" {\"A4\" \"D1\"}) (place \"Ju1\" {\"A5\" \"E1\"}) (place \"Pao1\" {\"B5\" \"E2\"}) (place \"Zu1\" {\"B6\" \"C5\" \"D4\" \"E3\" \"F2\"}) (place \"Jiang2\" coord:\"K11\") (place \"Shi2\" {\"J11\" \"K10\"}) (place \"Xiang2\" {\"I11\" \"K9\"}) (place \"Ma2\" {\"H11\" \"K8\"}) (place \"Ju2\" {\"G11\" \"K7\"}) (place \"Pao2\" {\"G10\" \"J7\"}) (place \"Zu2\" {\"F10\" \"G9\" \"H8\" \"I7\" \"J6\"})}) (play (do (forEach Piece) ifAfterwards:(and (\"JiangSameColumnWithNoPieceBetween\") (not (\"IsInCheck\" \"Jiang\" Mover))))) (end { (\"Checkmate\" \"Jiang\") (\"BlockWin\")}))) END" }, { "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": "Construct a Ludii game based on the following description\nCross-shaped board made of five squares. The four squares of the arms have diagonals and lines connecting the midpoints of opposite sides. The central square has diagonals and a line connecting the central point with the midpoint of the lower side. One player plays with nineteen pieces, which begin on the uppermost nineteen points. The other player plays with two pieces, which begin on the central space and the one immediately below it. The player with two pieces goes first. Pieces move along the lines of the board to an empty adjacent spot. The player with two pieces may capture an adjacent opponent's piece by hopping over it to an empty spot immediately on the opposite side of it. The player with two pieces wins by capturing all of the opponent's pieces; the player with nineteen pieces wins by blocking the opponent from being able to move. \n\n###\n\n", "completion": "(game \"Nuktagaq\" (players 2) (equipment { (board (remove (\"CrossGraph\" 3 7 diagonals:Alternating) edges:{{17 10} {9 10} {10 11}}) use:Vertex) (hand P1) (piece \"Marker\" P1 (or (\"HopCapture\") \"StepToEmpty\")) (piece \"Marker\" P2 \"StepToEmpty\")}) (rules (start { (place \"Marker2\" (difference (expand (sites Top) steps:4) (union (sites Row 2) (sites Centre)))) (place \"Marker1\" (sites Direction from:(sites Centre) S included:True distance:1))}) (play (forEach Piece)) (end (\"NoMovesLossAndNoPiecesPlayerLoss\" P2)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nTic-Tac-Mo uses the same rules as Tic-Tac-Toe, but the third player plays with a \\ \n\n###\n\n", "completion": "(game \"Tic-Tac-Mo\" (players 3) (equipment { (board (rectangle 3 5)) (piece \"Disc\" P1) (piece \"Cross\" P2) (piece \"Y\" P3)}) (rules (play (move Add (to (sites Empty)))) (end (\"Line3Win\")))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"MoveTo\" (move Hop #1 (between (exact (- #2 1)) if:(not (\"IsEnemyAt\" (between)))) (to if:(not (\"IsFriendAt\" (to))) (apply (if (\"IsEnemyAt\" (to)) (remove (to))))))) (define \"DistInNWSE\" (count Sites in:(difference (sites Direction from:(from) (directions {NW SE}) included:True) (sites Empty)))) (define \"DistInNESW\" (count Sites in:(difference (sites Direction from:(from) (directions {NE SW}) included:True) (sites Empty)))) (define \"DistInRow\" (count Sites in:(difference (sites Row (row of:(from))) (sites Empty)))) (define \"DistInColumn\" (count Sites in:(difference (sites Column (column of:(from))) (sites Empty)))) (game \"Lines of Action\" (players 2) (equipment { (board (square 8)) (piece \"Disc\" Each (or { (\"MoveTo\" (directions {N S}) \"DistInColumn\") (\"MoveTo\" (directions {W E}) \"DistInRow\") (\"MoveTo\" (directions {NE SW}) \"DistInNESW\") (\"MoveTo\" (directions {NW SE}) \"DistInNWSE\")}))}) (rules (start { (place \"Disc1\" (difference (union (sites Top) (sites Bottom)) (sites Corners))) (place \"Disc2\" (difference (union (sites Right) (sites Left)) (sites Corners)))}) (play (forEach Piece)) (end { (if (and (= 1 (count Groups if:(= (who at:(to)) P1))) (= 1 (count Groups if:(= (who at:(to)) P2)))) (result Mover Draw)) (if (= 1 (count Groups if:(= (who at:(to)) P1))) (result P1 Win)) (if (= 1 (count Groups if:(= (who at:(to)) P2))) (result P2 Win))})))\n\n###\n\n", "completion": "A player wins by connecting all of one's pieces into a contiguous body so that they are connected orthogonally or diagonally. Players alternate moves. Pieces move orthogonally or diagonally. A piece moves exactly as many spaces as there are pieces (belonging to both the player and their opponent) on the line in which it is moving. A piece may jump over the player's own pieces, but not over one belonging to the opponent. A piece can capture piece belonging to the opponent by landing on it. If the two players make a group in the same turn, the game ends in a draw. END" }, { "prompt": "Construct a Ludii game based on the following description\nTo be reconstructed. The rules implemented here are suggested by Jenny Kile as follows: Besides being an 8x8 squared board, the board consists of certain marked spaces which denote safety, entry, or exit for players. The four corners, the four central squares, and two center squares on each side are crosscut, like shown. Two, three, or four people can play the game. If two players are playing, each would sit on one side of the board and enter their two pieces onto the center crosscut squares along the outer side The object of the game is to be the first player to enter and exit both his pieces. A player exits his piece once reaching the center squares. The version of the game played with 2 players.\n\n###\n\n", "completion": "(define \"MoveToNextSiteOnTrack\" (\"NextSiteOnTrack\" 1)) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" (mapEntry \"DieValue\" (count Pips)))) (game \"Ashtapada\" (players 2) (equipment { (board (square 8) { (track \"Track1\" \"3,E,N,W,S,E1,N6,E5,S5,W4,N4,E3,S3,W1\" 1 directed:True) (track \"Track2\" \"60,W,S,E,N,W1,S6,W5,N5,E4,S4,W3,N3,E1\" 2 directed:True) (track \"Track3\" \"31,N,W,S,E,N1,W6,N5,E5,S4,W4,N3,E3,S1\" 3 directed:True) (track \"Track4\" \"32,S,E,N,W,S1,E6,S5,W5,N4,E4,S3,W3,N1\" 4 directed:True)}) (\"StickDice\" 4) (hand Each) (map \"DieValue\" {(pair 4 8)}) (map \"Entry\" {(pair P1 \"D1\") (pair P2 \"E8\")}) (map \"Exit\" {(pair P1 \"E3\") (pair P2 \"D6\")}) (regions \"Protect\" (sites {\"A1\" \"A4\" \"A5\" \"A8\" \"D1\" \"D4\" \"D5\" \"D8\" \"E1\" \"E4\" \"E5\" \"E8\" \"H1\" \"H4\" \"H5\" \"H8\"})) (piece \"Disc\" Each (if (\"IsNotOffBoard\" \"SiteToMoveOnTrack\") (if (if (is In \"SiteToMoveOnTrack\" (sites \"Protect\")) (not (\"IsEnemyAt\" \"SiteToMoveOnTrack\")) True) (move (from) (to \"SiteToMoveOnTrack\" (apply if:(\"IsEnemyAt\" (to)) (fromTo (from (to)) (to (handSite (who at:(to)))))))))))}) (rules (start { (place \"Disc1\" (handSite P1) count:2) (place \"Disc2\" (handSite P2) count:2)}) (play (\"RollEachNewTurnMove\" (if \"SameTurn\" (or (forEach Piece (if (= (from) (mapEntry \"Exit\" Mover)) (move Remove (from)) (if (\"IsNotOffBoard\" \"MoveToNextSiteOnTrack\") (if (if (is In \"MoveToNextSiteOnTrack\" (sites \"Protect\")) (not (\"IsEnemyAt\" \"MoveToNextSiteOnTrack\")) True) (move (from) (to \"MoveToNextSiteOnTrack\" (\"HittingCapture\" (handSite (who at:(to)))))))))) (if (\"HandOccupied\" Mover) (move (from (handSite Mover)) (to (mapEntry \"Entry\" Mover) if:(not (\"IsEnemyAt\" (to))))))) (if (can Move (forEach Piece)) (forEach Piece (then (if (= (count Pips) 3) (moveAgain)))) (move Pass (then (if (= (count Pips) 3) (moveAgain)))))))) (end (\"EscapeWin\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayed on a 12x12 board with 30 pieces per player, arranged on the dark squares. Pieces move diagonally one or can jump an opponent's adjacent player to capture it. Pieces can move forward or backwards. When a piece reaches the opposite edge of the board from its starting position, it becomes a king and can may move and jump over any number of spaces diagonally. Captures are compulsory and the maximum number of jumps must be made. Winning is achieved by capturing all the opponent's pieces or by blocking them from moving. The rules are the standard ones.\n\n###\n\n", "completion": "(define \"ShouldCapturedButMoved\" (and (is In (last From) (\"SitesWithPossibleCaptureInPreviousTurn\")) (is In (last From) (sites Empty)))) (define \"HuffOnePieceOf\" (move Select (from #1 if:(is Occupied (from))) (then (and { (remove (last To)) (moveAgain) (set Value Prev 0)})))) (define \"SitesWithPossibleCaptureInPreviousTurn\" (sites Pending)) (define \"RememberSiteWithPossibleCapture\" (set Pending (sites From (\"MovesWithCapture\")))) (define \"DidNotCaptured\" (= (value Player Prev) 1)) (define \"HasNotCaptured\" (set Value Mover 1)) (define \"HasCaptured\" (set Value Mover 0)) (define \"PlayRulesHuff\" (if (and (\"SameTurn\") (is Occupied (last To))) (if \"IsUnpromoted\" (\"HopInternationalDraughtsStyle\" (from (last To)) (then (\"ReplayIfCanMove\" (\"HopInternationalDraughtsStyle\" (from (last To))) (\"PromoteIfReach\" (sites Next) \"DoubleCounter\")))) (\"HopDiagonalSequenceCaptureAgain\" before:(count Rows) after:(count Rows) at:EndOfTurn) (then (\"HasCaptured\"))) (or { (or (forEach Piece \"Counter\" (\"HopInternationalDraughtsStyle\" (from) (then (and (\"ReplayIfCanMove\" (\"HopInternationalDraughtsStyle\" (from (last To))) (\"PromoteIfReach\" (sites Next) \"DoubleCounter\")) (\"HasCaptured\"))))) (forEach Piece \"DoubleCounter\" (\"HopDiagonalSequenceCapture\" before:(count Rows) after:(count Rows) at:EndOfTurn)) (then (\"HasCaptured\"))) (forEach Piece \"Counter\" (\"StepToEmpty\" (directions {FR FL})) (then (and (\"PromoteIfReach\" (sites Next) \"DoubleCounter\") (\"HasNotCaptured\")))) (forEach Piece \"DoubleCounter\" (move Slide Diagonal (then (\"HasNotCaptured\"))))}))) (define \"MovesWithCapture\" (if \"SameTurn\" (if \"IsUnpromoted\" (max Moves (\"HopInternationalDraughtsStyle\" (from (last To)) (then (\"ReplayIfCanMove\" (\"HopInternationalDraughtsStyle\" (from (last To))) (\"PromoteIfReach\" (sites Next) \"DoubleCounter\"))))) (max Moves (\"HopDiagonalSequenceCaptureAgain\" before:(count Rows) after:(count Rows) at:EndOfTurn))) (max Moves (or (forEach Piece \"Counter\" (\"HopInternationalDraughtsStyle\" (from) (then (\"ReplayIfCanMove\" (\"HopInternationalDraughtsStyle\" (from (last To))) (\"PromoteIfReach\" (sites Next) \"DoubleCounter\"))))) (forEach Piece \"DoubleCounter\" (\"HopDiagonalSequenceCapture\" before:(count Rows) after:(count Rows) at:EndOfTurn)))))) (define \"PlayRules\" (if \"SameTurn\" (if \"IsUnpromoted\" (max Moves (\"HopInternationalDraughtsStyle\" (from (last To)) (then (\"ReplayIfCanMove\" (\"HopInternationalDraughtsStyle\" (from (last To))) (\"PromoteIfReach\" (sites Next) \"DoubleCounter\"))))) (max Moves (\"HopDiagonalSequenceCaptureAgain\" before:(count Rows) after:(count Rows) at:EndOfTurn))) (priority { (max Moves (or (forEach Piece \"Counter\" (\"HopInternationalDraughtsStyle\" (from) (then (\"ReplayIfCanMove\" (\"HopInternationalDraughtsStyle\" (from (last To))) (\"PromoteIfReach\" (sites Next) \"DoubleCounter\"))))) (forEach Piece \"DoubleCounter\" (\"HopDiagonalSequenceCapture\" before:(count Rows) after:(count Rows) at:EndOfTurn)))) (or (forEach Piece \"Counter\" (\"StepToEmpty\" (directions {FR FL})) (then (\"PromoteIfReach\" (sites Next) \"DoubleCounter\"))) (forEach Piece \"DoubleCounter\" (move Slide Diagonal)))}))) (define \"IsUnpromoted\" (\"IsPieceAt\" \"Counter\" Mover (last To))) (game \"Canadian Draughts\" (players 2) (\"DraughtsEquipment\" (square 12)) (rules (\"BlackCellsSetup\" 5) (play (\"PlayRules\")) (end (\"BlockWin\")))) END" }, { "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": "Describe the mechanics of the following Ludii game\n(define \"MoveGhoula\" (if (\"IsSingletonStack\" (where \"Ghoula\" Neutral)) (move (from (where \"Ghoula\" Neutral) level:(where Level \"Ghoula\" Neutral at:(where \"Ghoula\" Neutral))) (to (\"GhoulaOnTrack\" \"GhoulaTrack\" 1))) (move (from (where \"Ghoula\" Neutral) level:(where Level \"Ghoula\" Neutral at:(where \"Ghoula\" Neutral))) (to (\"GhoulaOnTrack\" \"ReverseGhoulaTrack\" 1)) (then (if (= (last From) (\"KillingSite\")) (forEach Level (last From) FromTop (remove (last From) level:(level))) (forEach Level (last From) FromTop (fromTo (from (last From) level:(level)) (to (last To))))))) (then (if (\"GhoulaPhaseDone\") (set Var 0) (and (if (> (var) 1) (moveAgain)) (set Var (- (var) 1))))))) (define \"GhoulaPhaseDone\" (and (\"IsSingletonStack\" (where \"Ghoula\" Neutral)) (= (\"EndTrack\") (where \"Ghoula\" Neutral)))) (define \"ActivePiece\" (set State at:#1 level:#2 1)) (define \"ActivatedPiece\" (<= 1 (state at:#1 level:#2))) (define \"Sig\" (= (\"ThrowValue\") 1)) (define \"IsSpecialThrow\" (is In (\"ThrowValue\") (sites {1 6 4}))) (define \"GhoulaOnTrack\" (\"NextSiteOnTrack\" #2 from:(where \"Ghoula\" Neutral) #1)) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" #2 #1)) (define \"BeginningExtensionTrack\" 4) (define \"EndTrack\" 6) (define \"Kaaba\" 0) (define \"KillingSite\" 17) (define \"ThrowValue\" (mapEntry \"Throw\" (count Pips))) (define \"ExternalSite\" 20) (game \"Sig wa Duqqan (Houmt al-Arbah)\" (players 4) (equipment { (board (merge { (shift -4 0 (rectangle 1 4)) (square 4) (shift -4 3 (square 1))}) { (track \"Track\" \"16,E,S1,W,S1,E,S1,W2\" directed:True) (track \"ExtensionTrack\" \"4,W\" directed:True) (track \"GhoulaTrack\" \"20,16,E,S1,W,S1,E,S1,W2\" directed:True) (track \"ReverseGhoulaTrack\" \"6,E,N1,W,N1,E,N1,W\" directed:True)}) (piece \"Ghoula\" Neutral) (piece \"Stick\" Each (if (= (from) (\"EndTrack\")) (if (= (state at:(from) level:(level)) 8) (move (from (from) level:(level)) (to (\"BeginningExtensionTrack\"))) (if (\"Sig\") (move Select (from (from) level:(level)) (then (set State at:(last To) level:(last LevelTo) (+ 1 (state at:(last To) level:(last LevelTo)))))))) (if (is In (from) (sites Track \"Track\")) (move (from (from) level:(level) if:(if (\"ActivatedPiece\" (from) (level)) True (\"Sig\"))) (to (\"SiteToMoveOnTrack\" \"Track\" (\"ThrowValue\")) if:True) (then (if (not (\"ActivatedPiece\" (last To) (topLevel at:(last To)))) (\"ActivePiece\" (last To) (topLevel at:(last To)))))) (if (is In (from) (sites Track \"ExtensionTrack\")) (or { (if (and (!= (from) (\"Kaaba\")) (\"Sig\")) (move (from (from) level:(level)) (to (\"SiteToMoveOnTrack\" \"ExtensionTrack\" 1)))) (if (= (from) (\"Kaaba\")) (move Pass (then (and (if (= 0 (\"ThrowValue\")) (set Var 2) (set Var (\"ThrowValue\"))) (moveAgain)))) (if (= 3 (\"ThrowValue\")) (move Pass (then (and (set Var 3) (moveAgain))))))})))) maxState:8) (\"StickDice\" 4) (map \"Throw\" {(pair 0 4) (pair 1 3) (pair 2 0) (pair 3 1) (pair 4 6)})}) (rules (start { (place Stack \"Ghoula0\" (\"ExternalSite\")) (place Stack items:{\"Stick4\" \"Stick3\" \"Stick2\" \"Stick1\"} 16)}) (play (do (if (<= (var) 0) (roll)) next:(if (> (var) 0) (\"MoveGhoula\") (if (!= 0 (\"ThrowValue\")) (forEach Piece))) (then (if (\"IsSpecialThrow\") (moveAgain))))) (end { (forEach Player if:(no Pieces Player) (result Player Loss)) (forEach Player if:(\"GhoulaPhaseDone\") (result Player Win))})))\n\n###\n\n", "completion": "4x4 board, with an extension of four squares extending from the left of the bottom row. Two or more players, each with one piece. A piece of charcoal plays the part of the Ghoula. Four sticks, with one green side and one white side, used as dice. The throws are as follows: One white side up = 1, this throw is known as \\ The game has 4 players. END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayers take turns placing two pieces of their colour on empty cells. White places only one stone on their first turn. A player wins by connecting all three board sides with a connected group of their pieces. Played on a size 13 board. The first player to connect all three sides wins.\n\n###\n\n", "completion": "(game \"Master Y\" (players 2) (equipment { (board (hex Triangle 13)) (piece \"Disc\")}) (rules phases:{ (phase \"Opening\" P1 (play (move Add (to (sites Empty)))) (nextPhase \"Playing\")) (phase \"Playing\" (play (move Add (to (sites Empty)) (then (if (= 0 (count MovesThisTurn)) (moveAgain))))))} (end (if (is Connected 3 Sides) (result Mover Win))))) END" }, { "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": "Modify the Ludii game according to the following option changes:\nThe game is played on a 6x6 board. -> The game is played on a 8x8 board.\n(game \"Nei-Pat-Kono\" (players 2) (equipment { (board (square 6) use:Vertex) (piece \"Marker\" Each (or (\"StepOrthogonalToEmpty\") (move Hop Orthogonal (between if:(\"IsFriendAt\" (between))) (to if:(\"IsEnemyAt\" (to))))))}) (rules (start { (place \"Marker1\" (expand (sites Bottom) steps:(- (/ (count Rows) 2) 1))) (place \"Marker2\" (expand (sites Top) steps:(- (/ (count Rows) 2) 1)))}) (play (forEach Piece)) (end (if (or (no Moves Next) (<= (count Pieces Next) 1)) (result Mover Win)))))\n\n###\n\n", "completion": "(game \"Nei-Pat-Kono\" (players 2) (equipment { (board (square 8) use:Vertex) (piece \"Marker\" Each (or (\"StepOrthogonalToEmpty\") (move Hop Orthogonal (between if:(\"IsFriendAt\" (between))) (to if:(\"IsEnemyAt\" (to))))))}) (rules (start { (place \"Marker1\" (expand (sites Bottom) steps:(- (/ (count Rows) 2) 1))) (place \"Marker2\" (expand (sites Top) steps:(- (/ (count Rows) 2) 1)))}) (play (forEach Piece)) (end (if (or (no Moves Next) (<= (count Pieces Next) 1)) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayed on a board with two rows of five spaces forming an \\ \n\n###\n\n", "completion": "(define \"ReplaceStick\" (move (from (handSite Mover)) (to (sites Empty)) (then (moveAgain)))) (define \"LessThanFourSticksOnBoard\" (< (count Sites in:(sites Occupied by:Mover container:\"Board\")) 4)) (define \"HaveRemainingSticks\" (\"HandOccupied\" Mover)) (game \"Queah Game\" (players 2) (equipment { (board (rotate 45 (merge (shift 1 -1 (rectangle 5 1)) (merge (shift -1 1 (rectangle 1 5)) (square 3))))) (piece \"Stick\" Each (or (\"StepOrthogonalToEmpty\") (\"HopOrthogonalCapture\"))) (hand Each)}) (rules (start { (place \"Stick1\" {\"A1\" \"B2\" \"A3\" \"B4\"}) (place \"Stick2\" {\"E5\" \"D4\" \"E3\" \"D2\"}) (place \"Stick\" \"Hand\" count:6)}) (play (if (and (\"HaveRemainingSticks\") (\"LessThanFourSticksOnBoard\")) (\"ReplaceStick\") (forEach Piece))) (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x8 and two stores. Five counters per hole. On each player's first move, they sow three counters into the first hole and two into the second hole. After this, sowing proceeds as usual, with one counter in each hole. Sowing may occur in either direction. When the final counter lands in an occupied hole, the contents of this hole are picked up and sowing continues in the opposite direction. When the final counter falls in an empty hole in the player's own row, the contents of the opposite hole are captured. If the final counter falls into the first of a series of empty holes, the contents of all of the holes opposite the empty holes are captured. It is necessary to enter the opponent's row first and return before making a capture.If the final counter lands in an empty hole in the opponent's row, the turn ends. The winner is the player who has captured the most counters. \n\n###\n\n", "completion": "(define \"Capture\" (if (and (= 1 (var \"GoInOpponentRow\")) (is In (to) (sites Mover))) (if (!= 0 (count at:(\"OppositePit\" (to)))) (fromTo (from (\"OppositePit\" (to))) (to (mapEntry Mover)) count:(count at:(\"OppositePit\" (to))) (then (if (and (is Empty (\"NextHole\" (last From) #1 1)) (is In (\"NextHole\" (last From) #1 1) (sites Mover))) (and (if (!= 0 (count at:(\"NextHole\" (last From) #1 1))) (fromTo (from (\"NextHole\" (last From) #1 1)) (to (mapEntry Mover)) count:(count at:(\"NextHole\" (last From) #1 1)))) (if (and (is Empty (\"NextHole\" (last From) #1 2)) (is In (\"NextHole\" (last From) #1 2) (sites Mover))) (and (if (!= 0 (count at:(\"NextHole\" (last From) #1 2))) (fromTo (from (\"NextHole\" (last From) #1 2)) (to (mapEntry Mover)) count:(count at:(\"NextHole\" (last From) #1 2)))) (if (and (is Empty (\"NextHole\" (last From) #1 3)) (is In (\"NextHole\" (last From) #1 3) (sites Mover))) (and (if (!= 0 (count at:(\"NextHole\" (last From) #1 3))) (fromTo (from (\"NextHole\" (last From) #1 3)) (to (mapEntry Mover)) count:(count at:(\"NextHole\" (last From) #1 3)))) (if (and (is Empty (\"NextHole\" (last From) #1 4)) (is In (\"NextHole\" (last From) #1 4) (sites Mover))) (and (if (!= 0 (count at:(\"NextHole\" (last From) #1 4))) (fromTo (from (\"NextHole\" (last From) #1 4)) (to (mapEntry Mover)) count:(count at:(\"NextHole\" (last From) #1 4)))) (if (and (is Empty (\"NextHole\" (last From) #1 5)) (is In (\"NextHole\" (last From) #1 5) (sites Mover))) (and (if (!= 0 (count at:(\"NextHole\" (last From) #1 5))) (fromTo (from (\"NextHole\" (last From) #1 5)) (to (mapEntry Mover)) count:(count at:(\"NextHole\" (last From) #1 5)))) (if (and (is Empty (\"NextHole\" (last From) #1 6)) (is In (\"NextHole\" (last From) #1 6) (sites Mover))) (and (if (!= 0 (count at:(\"NextHole\" (last From) #1 6))) (fromTo (from (\"NextHole\" (last From) #1 6)) (to (mapEntry Mover)) count:(count at:(\"NextHole\" (last From) #1 6)))) (if (and (is Empty (\"NextHole\" (last From) #1 7)) (is In (\"NextHole\" (last From) #1 7) (sites Mover))) (if (!= 0 (count at:(\"NextHole\" (last From) #1 7))) (fromTo (from (\"NextHole\" (last From) #1 7)) (to (mapEntry Mover)) count:(count at:(\"NextHole\" (last From) #1 7)))))))))))))))))))))) (define \"NextHole\" (\"NextSiteOnTrack\" #3 from:#1 #2)) (define \"PiecesOwnedBy\" (count at:(mapEntry #1))) (define \"Columns\" 8) (game \"Uthi\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" { (track \"TrackCW\" \"8,W,N,E\" loop:True) (track \"TrackCCW\" \"1,E,N,W\" loop:True)}) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 FirstSite) (pair P2 LastSite)}) (piece \"Seed\" Shared)}) (rules (start (set Count 5 to:(sites Track))) phases:{ (phase \"Opening\" (play (or (move Select (from (sites Mover)) (then (and (fromTo (from (last To)) (to (\"NextHole\" (last To) \"TrackCW\" 1)) count:3) (fromTo (from (last To)) (to (\"NextHole\" (last To) \"TrackCW\" 2)) count:2)))) (move Select (from (sites Mover)) (then (and (fromTo (from (last To)) (to (\"NextHole\" (last To) \"TrackCCW\" 1)) count:3) (fromTo (from (last To)) (to (\"NextHole\" (last To) \"TrackCCW\" 2)) count:2)))))) (nextPhase Mover \"Sowing\")) (phase \"Sowing\" (play (or (if (!= (value Player Mover) 1) (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover)) if:(> (count at:(from)) 0)) (then (sow \"TrackCW\" apply:(if (> (count at:(to)) 1) (and { (moveAgain) (set Value Mover 1) (if (is In (to) (sites Next)) (set Var \"GoInOpponentRow\" 1))}) (and { (set Value Mover 0) (set Var \"GoInOpponentRow\" 0) (\"Capture\" \"TrackCW\")})))))) (if (!= (value Player Mover) 2) (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover)) if:(> (count at:(from)) 0)) (then (sow \"TrackCCW\" apply:(if (> (count at:(to)) 1) (and { (moveAgain) (set Value Mover 2) (if (is In (to) (sites Next)) (set Var \"GoInOpponentRow\" 1))}) (and { (set Value Mover 0) (set Var \"GoInOpponentRow\" 0) (\"Capture\" \"TrackCCW\")})))))))))} (end (\"MancalaByScoreWhen\" (no Moves Mover))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nPlayed on a size 19 board. -> Played on a size 3 board.\n(game \"Inkblots\" (players 2) (equipment { (board (tri Hexagon 19)) (tile \"Triangle\" Each) (tile \"Triangle\" Neutral)}) (rules (meta (swap)) (start (place Random {\"Triangle1\" \"Triangle2\" \"Triangle0\"})) (play (move Add (to (sites Empty)) (then (add (piece (id \"Triangle\" Next)) (to (intersection (expand (sites Occupied by:Next) Orthogonal) (sites Empty))))))) (end (if (no Moves Next) (byScore { (score P1 (count Pieces P1)) (score P2 (count Pieces P2))})))))\n\n###\n\n", "completion": "(game \"Inkblots\" (players 2) (equipment { (board (tri Hexagon 3)) (tile \"Triangle\" Each) (tile \"Triangle\" Neutral)}) (rules (meta (swap)) (start (place Random {\"Triangle1\" \"Triangle2\" \"Triangle0\"})) (play (move Add (to (sites Empty)) (then (add (piece (id \"Triangle\" Next)) (to (intersection (expand (sites Occupied by:Next) Orthogonal) (sites Empty))))))) (end (if (no Moves Next) (byScore { (score P1 (count Pieces P1)) (score P2 (count Pieces P2))}))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n5x5 board; the central row and column being slightly wider than the others. Two to four players. Four pieces per player. Pieces begin on one of the central squares around the perimeter of the squares; if there are two players, they begin from opposite sides. Four cowrie shells are used as dice, with the count of the throw determined by the number of mouths which land face-up, with none facing up equaling 8. A throw of 4 gives the player another throw. Only the first throw matters for winning extra throws. Pieces move anti-clockwise from their origin point around the perimeter of the square, until they come to the final square before returning to the origin point. They then turn left and proceed around the inner perimeter of squares in a clockwise direction, until the space directly between the origin point and the central square, from which the pieces proceed to the center. When a piece overtakes a piece owned by the opponent, and the opponent's piece is not on one of the central squares of the perimeter, the opponent's pieces are sent back to the origin point, and the player is awarded an extra throw for each piece sent back. The first player to place their four pieces in the center wins.\n The game is played with 4 players.\n\n###\n\n", "completion": "(define \"AllPiecesInCenter\" (\"AllOwnedPiecesIn\" (sites {(centrePoint)}))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" #2 #1)) (define \"Throw4\" (= (\"ThrowValue\") 4)) (define \"ThrowValue\" (mapEntry \"Throw\" (count Pips))) (game \"Tamman\" (players 4) (equipment { (board (merge { (add (merge { (square 2) (shift 4 0 (square 2)) (shift 0 4 (square 2)) (shift 4 4 (square 2))}) edges:{{2 9} {5 12} {8 15} {6 18} {8 20} {15 27} {17 29} {20 27} {23 30} {26 33} {7 19} {16 28}})}) { (track \"Track1\" \"2,E,N,W,S,E1,N3,E2,S2,W1,N1\" P1 directed:True) (track \"Track2\" \"6,S,E,N,W,S1,E3,S2,W2,N1,E1\" P2 directed:True) (track \"Track3\" \"20,W,S,E,N,W1,S3,W2,N2,E1,S1\" P3 directed:True) (track \"Track4\" \"14,N,W,S,E,N1,W3,N2,E2,S1,W1\" P4 directed:True)}) (\"StickDice\" 4) (piece \"Marker\" Each (move (from (from) level:(level)) (to (\"SiteToMoveOnTrack\" from:(from) (\"ThrowValue\")) if:True (apply (if (< 1 (\"ThrowValue\")) (forEach Site (sites Track Mover \"Track\" from:(\"SiteToMoveOnTrack\" from:(from) 1) to:(\"SiteToMoveOnTrack\" from:(from) (- (\"ThrowValue\") 1))) (if (not (is In (sites \"SafeSites\"))) (forEach Level (site) FromTop (if (\"IsEnemyAt\" (site) level:(level)) (fromTo (from (site) level:(level)) (to (mapEntry \"Entry\" (who at:(site) level:(level)))))))))))))) (regions \"SafeSites\" (sites {2 6 14 20})) (map \"Throw\" {(pair 0 8) (pair 1 1) (pair 2 2) (pair 3 3) (pair 4 4)}) (map \"Entry\" {(pair P1 2) (pair P2 6) (pair P3 20) (pair P4 14)})}) (rules (start { (place Stack \"Marker1\" 2 count:4) (place Stack \"Marker2\" 6 count:4) (place Stack \"Marker3\" 20 count:4) (place Stack \"Marker4\" 14 count:4)}) (play (\"RollMove\" (forEach Piece) (then (if (and (\"Throw4\") (\"NewTurn\")) (moveAgain))))) (end (if (\"AllPiecesInCenter\") (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nEach player simultaneously bets on what the sum of all fingers shown will be. Each bet is added to a common pot. Then each player simultaneously reveals their hand, extending any number of fingers. Any player who successfully guesses the total number of fingers revealed by all players combined scores a point.\n The game is over when a player reaches a score of 3. The winning players share the pot. The game is played with 2 players.\n\n###\n\n", "completion": "(define \"ShowHand\" (move (from (sites Occupied by:#1)) (to (- (id #1) 1)) copy:True #1 (then (if (= \"SumFingers\" (amount #1)) (addScore #1 1)) applyAfterAllMoves:True))) (define \"MaxFingers\" (* 5 (count Players))) (define \"SumFingers\" (+ (state at:0) (state at:1))) (define \"InitHand\" (place #1 (handSite #2) state:0) (place #1 (handSite #2 1) state:1) (place #1 (handSite #2 2) state:2) (place #1 (handSite #2 3) state:3) (place #1 (handSite #2 4) state:4) (place #1 (handSite #2 5) state:5)) (game \"Morra\" (players 2) (mode Simultaneous) (equipment { (board (union (square 1) (shift 0 2 (square 1)))) (hand Each size:6) (hand Shared) (piece \"Hand0\" Each)}) (rules (start { (\"InitHand\" \"Hand01\" P1) (\"InitHand\" \"Hand02\" P2)}) phases:{ (phase \"Bet\" (play (or { (move Bet P1 (range 0 (\"MaxFingers\")) (then (set Pot (+ (pot) (amount P1))))) (move Bet P2 (range 0 (\"MaxFingers\")) (then (set Pot (+ (pot) (amount P2)))))})) (nextPhase \"Hand\")) (phase \"Hand\" (play (or { (\"ShowHand\" P1) (\"ShowHand\" P2)})) (nextPhase \"Observe\")) (phase \"Observe\" (play (move Pass (then (and { (remove 0) (remove 1)})))) (nextPhase \"Bet\"))} (end (if (or { (= (score P1) 3) (= (score P2) 3)}) (byScore))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayers alternate turns placing pieces on one of the spaces. The first player to place four in a row without first making three in a row wins. The version of game with 2 players. The game is played on a 5x5 board.\n\n###\n\n", "completion": "(game \"Yavalath\" (players 2) (equipment { (board (rotate 90 (hex 5))) (piece \"Marker\" Each)}) (rules (meta (swap)) (play (move Add (to (sites Empty)))) (end { (if (is Line 4) (result Mover Win)) (if (is Line 3) (result Mover Loss))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nAn isosceles triangle, with the height of the triangle and two lines, which bisect the sides of the triangle, but intersect the height at the same point, roughly central, such that they are at an angle but do not bisect it. One player plays as the tiger, which begins at the apex of the triangle, the other as four goats, which begin on the central point. The goats play first, removing one of the pieces from the stack to an adjacent empty spot. The tiger moves along the lines to an empty adjacent spot. The goats also move in this way. Goats may only be stacked on the central point. The tiger may capture a goat by jumping over it, and a jump from one side of the triangle to the opposite side, over the central point, is allowed. The goats win by blocking the tiger from being able to move, the tiger wins by capturing one goat. \n\n###\n\n", "completion": "(game \"Sher Bakr\" (players 2) (equipment { (board (rotate 180 (add (remove (scale 1 2 (wedge 3)) vertices:{2}) vertices:{{2 1.333}} edges:{{4 6} {6 0} {1 6} {6 2}})) use:Vertex) (hand Each) (piece \"Goat\" P1 (move Step (to if:(or (is Empty (to)) (and (= (to) (centrePoint)) (\"IsFriendAt\" (to))))))) (piece \"Tiger\" P2 (or { (\"StepToEmpty\") (\"HopCapture\") (if (and {(= (from) 2) (\"IsEnemyAt\" (centrePoint)) (is Empty 1)}) (move (from 2) (to 1) (then (remove (centrePoint))))) (if (and {(= (from) 1) (\"IsEnemyAt\" (centrePoint)) (is Empty 2)}) (move (from 1) (to 2) (then (remove (centrePoint)))))}))}) (rules (start { (place Stack \"Goat1\" (centrePoint) count:4) (place Stack \"Tiger2\" 0)}) (play (forEach Piece top:True)) (end { (if (no Moves P2) (result P1 Win)) (if (= 3 (count Pieces P1)) (result P2 Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayed on an 8x8 board. 8 Bhata (or Padati; move like Chess pawns but without being able to move two on the first turn); 2 Ashva (horses; move like Chess knights); 2 Gaja (elephants; two spaces in any orthogonal direction, jumping over the first square); 2 Ratha (chariots; moves like a rook in chess); 1 Mantri (counselor; moves one square diagonally in any direction); 1 Raja (king; moves one square in any direction). These are set up along one edge of the board: Ratha-Ashva-Gaja-Mantri-Raja-Gaja-Ashva-Ratha, with the eight Bhata lined up in the row in front of these, as in chess. Players take turns moving. When one piece lands on the space occupied by another piece, it is captured. Play continues until one player's king cannot move without being captured. The elephants can jump only orthogonally.\n\n###\n\n", "completion": "(game \"Chaturanga\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (\"ChessPawn\" \"Pawn\" ~ (then (\"ReplayInMovingOn\" (sites Mover \"Promotion\")))) (\"ChessRook\" \"Rook\") (\"ChessKing\" \"King_noCross\") (piece \"Elephant\" Each (move Hop Orthogonal (between if:True) (to if:(not (\"IsFriendAt\" (to))) (apply (remove (to)))))) (\"ChessKnight\" \"Knight\") (piece \"Ferz_noCross\" Each (\"StepToNotFriend\" Diagonal)) (regions \"Promotion\" P1 (sites Top)) (regions \"Promotion\" P2 (sites Bottom))}) (rules (start { (place \"Pawn1\" (sites Row 1)) (place \"Pawn2\" (sites Row 6)) (place \"Rook1\" {\"A1\" \"H1\"}) (place \"Knight1\" {\"B1\" \"G1\"}) (place \"Elephant1\" {\"C1\" \"F1\"}) (place \"Ferz_noCross1\" coord:\"D1\") (place \"King_noCross1\" coord:\"E1\") (place \"Rook2\" {\"A8\" \"H8\"}) (place \"Knight2\" {\"B8\" \"G8\"}) (place \"Elephant2\" {\"C8\" \"F8\"}) (place \"Ferz_noCross2\" coord:\"E8\") (place \"King_noCross2\" coord:\"D8\")}) (play (if \"SameTurn\" (move Promote (last To) (piece \"Ferz_noCross\") Mover) (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King_noCross\" Mover))))) (end { (\"Checkmate\" \"King_noCross\") (\"MisereBlockWin\") (\"HavingLessPiecesLoss\" Next 1)}))) END" }, { "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": "Describe the mechanics of the following Ludii game\n(define \"ReleaseCapturePiece\" (forEach Site (forEach (sites Occupied by:Mover component:#1) if:(!= 0 (state at:(site)))) (move (from (site)) (to (sites #2) if:(is Empty (to))) (then (set State at:(last To) 0))))) (define \"CapturePiece\" (custodial (from (last To)) Orthogonal (between (max 1) if:(\"IsEnemyAt\" (between)) (apply (set State at:(between) 1))) (to if:(\"IsFriendAt\" (to))))) (define \"AllPawnsInInnerRing\" (all Sites (difference (sites Around (sites Centre)) (sites Centre)) if:(\"IsPieceAt\" \"Pawn\" Mover (site)))) (define \"CloserToCentre\" (>= (count Steps Orthogonal (from) (centrePoint)) (count Steps Orthogonal (to) (centrePoint)))) (game \"Agon\" (players 2) (equipment { (board (hex 6)) (piece \"Pawn\" Each (move Step (to if:(and { (is Empty (to)) (\"CloserToCentre\") (!= (to) (centrePoint))})) (then (\"CapturePiece\")))) (piece \"Queen\" Each (move Step (to if:(and (is Empty (to)) (\"CloserToCentre\"))) (then (\"CapturePiece\"))))}) (rules (start { (place \"Pawn1\" (sites {89 60 20 3 6 51})) (place \"Pawn2\" (sites {87 84 39 1 30 70})) (place \"Queen1\" 85) (place \"Queen2\" 5)}) (play (priority { (\"ReleaseCapturePiece\" \"Queen\" Board) (\"ReleaseCapturePiece\" \"Pawn\" Outer) (do (forEach Piece) ifAfterwards:(not (can Move (\"InterveneCapture\" Orthogonal))))})) (end (if (\"AllPawnsInInnerRing\") { (if (\"IsPieceAt\" \"Queen\" Mover (centrePoint)) (result Mover Win)) (if (not (\"IsPieceAt\" \"Queen\" Mover (centrePoint))) (result Mover Loss))}))))\n\n###\n\n", "completion": "1. Agon is played on a hexagonal board made of 91 hexagonal playing spaces. Each concentric layer for hexagons is so coloured that it is easy to see a playing space's distance from the centre of the board.\n \n 2. The players each start with a queen and six guards. They are placed in a set configuration at the edge of the board, as shown again in the diagram.\n \n 3. In his turn a player moves a piece one space in any direction, except for any direction that leads away from the centre.\n \n 5. A piece may not land on or jump over another.\n \n 6. A piece may not move adjacent to two enemy pieces such that it is directly between them.\n \n 7. Only a queen may move to the central space.\n \n 8. If a piece becomes sandwiched between two enemies, it is captured.\n \n 9. If the queen is captured, then its owner must, on his next turn, remove the queen from her predicament and place her on any other space on the board.\n \n 10. Otherwise if one of his guards is captured, the player must remove the guard from his predicament, but the guard must be placed on a space at the edge of the board.\n \n 11. Only one captured piece may be so removed each turn; so a player may arrest his opponent's strategy for a number of turns if he makes multiple captures at once or in quick succession.\n \n 12. A player has won the game when his queen rests on the central space, and her six guards are on the six spaces adjacent to her.\n \n 13. A player has lost the game if his six guards are adjacent to the central space but his queen is not between them, as this configuration prevents either player from ever winning the game. END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game is played on a 9x9 board -> The game is played on a 13x13 board\n(define \"CaptureSurroundedPiece\" (enclose (from (last To)) Orthogonal (between if:(\"IsEnemyAt\" (between)) (apply (and (addScore Mover 1) (remove (between))))))) (game \"One-Eyed Go\" (players 2) (equipment { (board (square 9) use:Vertex) (piece \"Marker\" Each)}) (rules (play (or (do (move Add (to (sites Empty))) ifAfterwards:(\"HasFreedom\" Orthogonal) (then \"CaptureSurroundedPiece\")) (move Pass))) (end (if (all Passed) (byScore { (score P1 (+ (score P1) (size Territory P1))) (score P2 (+ (score P2) (size Territory P2)))})))))\n\n###\n\n", "completion": "(define \"CaptureSurroundedPiece\" (enclose (from (last To)) Orthogonal (between if:(\"IsEnemyAt\" (between)) (apply (and (addScore Mover 1) (remove (between))))))) (game \"One-Eyed Go\" (players 2) (equipment { (board (square 13) use:Vertex) (piece \"Marker\" Each)}) (rules (play (or (do (move Add (to (sites Empty))) ifAfterwards:(\"HasFreedom\" Orthogonal) (then \"CaptureSurroundedPiece\")) (move Pass))) (end (if (all Passed) (byScore { (score P1 (+ (score P1) (size Territory P1))) (score P2 (+ (score P2) (size Territory P2)))}))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"RemoveEnemyPiece\" (if (can Move (\"RemoveAnyEnemyPieceNotInLine3\" Orthogonal)) (\"RemoveAnyEnemyPieceNotInLine3\" Orthogonal) (\"RemoveAnyEnemyPiece\"))) (game \"Nine Men's Morris\" (players 2) (equipment { (\"NineMensMorrisBoard\") (hand Each) (piece \"Marker\" Each (\"StepToEmpty\" ~ (then (\"ReplayIfLine3\" Orthogonal exact:True))))}) (rules (start (place \"Marker\" \"Hand\" count:9)) phases:{ (phase \"Placement\" (play (if \"SameTurn\" \"RemoveEnemyPiece\" (move (from (handSite Mover)) (to (sites Empty)) (then (\"ReplayIfLine3\" Orthogonal exact:True))))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (phase \"Movement\" (play (if \"SameTurn\" \"RemoveEnemyPiece\" (if (> (count Pieces Mover) 3) (forEach Piece) (move (from (sites Occupied by:Mover)) (to (sites Empty)))))))} (end (\"HavingLessPiecesLoss\" Next 2))))\n\n###\n\n", "completion": "Played on a board of three concentric squares, with a line bisecting the perimeters of each square on each side, but not extending inside the perimeter of the central square. Play occurs on the intersections of the lines and the corners of the squares. Each player has nine pieces. Play begins with each player placing pieces on empty points. If they make three in a row along the lines, they can remove one of the opponent's pieces. They cannot remove an opponent's piece that is in a three-in-a-row formation unless there are no other options. Once all pieces are placed, players take turns moving pieces one spot to an adjacent point along the lines. If a player makes three in a row, an opponent's piece is removed as in the first phase of the game. Once a player is reduced to three pieces, that player may move to any open space on the board. The game is won when the opponent is reduced to two pieces. END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"Main Tapak Empat\" (players 2) (equipment { (\"AlquerqueBoard\" 5 5) (piece \"Goat\" P1 \"StepToEmpty\") (piece \"Tiger\" P2 (or \"HopCapture\" \"StepToEmpty\")) (hand P1)}) (rules (start { (place Stack \"Tiger2\" (centrePoint)) (place Stack \"Goat1\" (handSite P1) count:24)}) phases:{ (phase \"Placement\" P1 (play (move (from (handSite P1)) (to (sites Empty)))) (nextPhase (\"HandEmpty\" P1))) (\"PhaseMovePiece\" \"Movement\")} (end (\"NoMovesP2NoPiecesP1\"))))\n\n###\n\n", "completion": "5x5 intersecting lines, with diagonals in each 3x3 quadrant. One player plays with two tigers, which begin on the central spot. The other player plays as 24 goats. The goats play first, and may place a piece on any empty spot. The tigers move to an empty spot any distance along the lines on the board, or may hop over an adjacent goat to capture it, provided there is an empty spot immediately on the other side of the goat. Once all of the goats are placed, they may move along the lines to an empty adjacent spot. If the tigers cannot move, the goats win. The tigers win by capturing all the goats. END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game is played on the Graph1. -> The game is played on the Graph3.\n(game \"Windir\" (players 2) (equipment { (board (complete (subdivide (regular Star 4))) use:Edge) (piece \"Marker\" Neutral)}) (rules (play (move Add (piece \"Marker0\") (to Edge (sites Empty Edge)))) (end (if (is RegularGraph Neutral) (result Mover Loss)))))\n\n###\n\n", "completion": "(game \"Windir\" (players 2) (equipment { (board (complete (subdivide (regular Star 14))) use:Edge) (piece \"Marker\" Neutral)}) (rules (play (move Add (piece \"Marker0\") (to Edge (sites Empty Edge)))) (end (if (is RegularGraph Neutral) (result Mover Loss))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"MoveOnlyIfAdjacentToEnemy\" (move Step (to if:(and (\"IsEmpty\") (is Related Adjacent (from) (sites Occupied by:Next)))))) (define \"MoveOnlyIfAdjacentToEnemyOrCentre\" (move Step (to if:(and (\"IsEmpty\") (or (not \"Centre\") (is Related Adjacent (from) (sites Occupied by:Next))))))) (define \"Centre\" (= (to) (centrePoint))) (define \"IsEmpty\" (is Empty (to))) (game \"Mu Torere\" (players 2) (equipment { (board (concentric {1 8}) use:Vertex) (piece \"Marker\" Each (\"MoveOnlyIfAdjacentToEnemyOrCentre\"))}) (rules (start { (place \"Marker1\" {1..3 8}) (place \"Marker2\" {4..7})}) (play (forEach Piece)) (end (\"NoMoves\" Loss))))\n\n###\n\n", "completion": "Play begins with the pieces on the kewai, each player on half of the circle. Players move by moving one piece to an empty adjacent space. Players can only move to the putahi when the piece being moved is next to an opponent's piece. The player that blocks the other from moving is the winner. The game is played on a wheel board. The game is played with all the rules END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"BigHole\" 20) (define \"CaptureEnemyPiece\" (apply if:(\"IsEnemyAt\" (to)) (remove (to)))) (define \"EndSiteOfTrack\" (if (= 0 (state at:(last To))) (trackSite EndSite Mover \"TrackCW\") (trackSite EndSite Mover \"TrackCCW\"))) (define \"ChangeOfTrack\" (if (= 0 (state at:(last To))) (set State at:(last To) 1) (set State at:(last To) 0))) (define \"SiteToMoveOnTrack\" (if (= 0 (state at:(from))) (\"NextSiteOnTrack\" (\"ThrowValue\") \"TrackCW\") (\"NextSiteOnTrack\" (\"ThrowValue\") \"TrackCCW\"))) (define \"ThrowValue\" (mapEntry \"ThrowDiceValue\" (count Pips))) (game \"Mapuche Game\" (players 2) (equipment { (board (remove (concentric {26}) vertices:{0..4}) { (track \"TrackCW1\" {0 2 4 6 8 10 12 14 16 18 20 19 17 15 13 11 9 7 5 3 1} P1 directed:True) (track \"TrackCCW1\" {1 3 5 7 9 11 13 15 17 19 20 18 16 14 12 10 8 6 4 2 0} P1 directed:True) (track \"TrackCW2\" {0 2 4 6 8 10 12 14 16 18 20 19 17 15 13 11 9 7 5 3 1} P2 directed:True) (track \"TrackCCW2\" {1 3 5 7 9 11 13 15 17 19 20 18 16 14 12 10 8 6 4 2 0} P2 directed:True)} use:Vertex) (regions \"AllSitesExceptTop\" (difference (sites Board) \"BigHole\")) (piece \"Marker\" Each (if (\"IsNotOffBoard\" \"SiteToMoveOnTrack\") (if (or (is In \"SiteToMoveOnTrack\" (sites Empty)) (\"IsEnemyAt\" \"SiteToMoveOnTrack\")) (move (from) (to \"SiteToMoveOnTrack\" \"CaptureEnemyPiece\"))))) (\"StickDice\" 4) (map \"ThrowDiceValue\" {(pair 0 4) (pair 1 0) (pair 2 2) (pair 3 0) (pair 4 3)}) (hand Each)}) (rules (start { (place \"Marker1\" (sites {0 2 4 6 8 10 12 14 16 18})) (place \"Marker2\" (sites {1 3 5 7 9 11 13 15 17 19}) state:1)}) (play (\"RollMove\" (if (can Move (if (!= (\"ThrowValue\") 0) (forEach Piece))) (forEach Piece (then (if (!= (\"ThrowValue\") 0) (moveAgain)))) (move Pass (then (if (!= (\"ThrowValue\") 0) (moveAgain))))) (then (and (if (and (is Occupied \"BigHole\") (!= \"BigHole\" (last To))) (remove \"BigHole\")) (if (= (last To) (\"EndSiteOfTrack\")) (\"ChangeOfTrack\")))))) (end { (\"CaptureAll\" P1) (\"CaptureAll\" P2)})))\n\n###\n\n", "completion": "21 holes, arranged in an arc, the central hole larger than the others. Ten pieces per player, each player's pieces beginning on one side of the board, one in each hole. Four beans used as dice, with a black side and a white side. The throws are as follows: Four white sides up = 4; four black sides up = 3; two white/two black up = 2; three white or three black = player loses their turn. Players continue to throw until they lose their turn. If a piece lands in the central hole, and it cannot move from it on its next opportunity, it is removed from the game. Pieces moving into the opponent's side of the board capture any of the opponent's pieces which occupy a space on which they land. When a piece reaches the end of the track, they proceed back in the other direction. The player who captures all ten of the opponent's pieces wins. END" }, { "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": "Construct a Ludii game based on the following description\nBeirut chess follows all the rules and conventions of standard chess, with one difference: Before the game begins, each player secretly attaches a red dot to the bottom of one of their pieces (but not the king). This piece is called a bomb carrier. On any turn, instead of moving, a player may say \\ \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)) (define \"NextCanNotMove\" (not (can Move (do (forEach Piece Next) ifAfterwards:(not (\"IsInCheck\" \"King\" Next)))))) (game \"Beirut Chess\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (\"ChessPawn\" \"Pawn\" (or \"InitialPawnMove\" \"EnPassant\") (then (and (\"ReplayInMovingOn\" (sites Mover \"Promotion\")) (set Counter)))) (\"ChessRook\" \"Rook\" (then (set Counter)) (\"RememberPieceHasMoved\")) (\"ChessKing\" \"King\" (then (set Counter)) (\"RememberPieceHasMoved\")) (\"ChessBishop\" \"Bishop\" (then (set Counter))) (\"ChessKnight\" \"Knight\" (then (set Counter))) (\"ChessQueen\" \"Queen\" (then (set Counter))) (map \"King\" {(pair 1 \"E1\") (pair 2 \"E8\")}) (map \"RookLeft\" {(pair 1 \"A1\") (pair 2 \"A8\")}) (map \"RookRight\" {(pair 1 \"H1\") (pair 2 \"H8\")}) (regions \"Promotion\" P1 (sites Top)) (regions \"Promotion\" P2 (sites Bottom))}) (rules (start { (place \"Pawn1\" (sites Row 1)) (place \"Pawn2\" (sites Row 6)) (place \"Rook1\" {\"A1\" \"H1\"} state:1) (place \"Knight1\" {\"B1\" \"G1\"}) (place \"Bishop1\" {\"C1\" \"F1\"}) (place \"Queen1\" coord:\"D1\") (place \"King1\" coord:\"E1\" state:1) (place \"Rook2\" {\"A8\" \"H8\"} state:1) (place \"Knight2\" {\"B8\" \"G8\"}) (place \"Bishop2\" {\"C8\" \"F8\"}) (place \"Queen2\" coord:\"D8\") (place \"King2\" coord:\"E8\" state:1)}) phases:{ (phase \"Bomb\" (play (forEach Site (sites Occupied by:Mover) (if (!= (what at:(site)) (id \"King\" Mover)) (move Select (from (site)) (then (and (set Value at:(last To) 1) (set Hidden Value at:(last To) to:Next))))))) (nextPhase Mover \"Play\")) (phase \"Play\" (play (if \"SameTurn\" (move Promote (last To) (piece {\"Queen\" \"Knight\" \"Bishop\" \"Rook\"}) Mover) (or (do (or (forEach Piece) (\"Castling\")) ifAfterwards:(not (\"IsInCheck\" \"King\" Mover))) (move Select (from (sites Occupied by:Mover) if:(= 1 (value Piece at:(from)))) (then (forEach Site (sites Around (last To) includeSelf:True) (if (is Occupied (site)) (remove (site))))))))))} (end { (if (or (and (\"IsInCheck\" \"King\" Next) (\"NextCanNotMove\")) (\"IsOffBoard\" (where \"King\" Next))) (result Mover Win)) (if (\"IsOffBoard\" (where \"King\" Mover)) (result Mover Loss)) (if (or (no Moves Mover) (= (counter) 99)) (result Mover Draw))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\n8x8 checkered board. twelve pieces per player, placed on the first three rows closest to the players. Players alternate turns moving a piece forward diagonally to an empty space. Pieces may capture an opponent's piece by hopping over it to an empty adjacent space. Captures are compulsory, multiple captures are possible, the maximum capture possible is required, and failure to do so is penalized by the huff, where the piece that should have made the capture is itself captured. When a piece reaches the opposite edge of the board from where it started, it becomes a king. Kings may move any distance diagonally forward or backward, and may capture any number of opponent's pieces it leaps over. The player who captures all of the opponent's pieces wins. \n\n###\n\n", "completion": "(define \"LastCapturingPiece\" (value Player Mover)) (define \"StoreCapturingPiece\" (set Value Mover (last To))) (define \"IsUnpromoted\" (\"IsPieceAt\" \"Counter\" Mover (last To))) (define \"RememberSiteWithPossibleCapture\" (set Pending (sites From (max Moves (or (forEach Piece \"Counter\" (\"HopCapture\" (from) (directions {FR FL}) (then (if (is In (last To) (sites Next)) (and (promote (last To) (piece \"DoubleCounter\") Mover) (\"ReplayIfCanMove\" (\"HopCaptureDistance\" (from (last To)) Diagonal))) (\"ReplayIfCanMove\" (\"HopCapture\" (from (last To)) (directions {FR FL}))))))) (forEach Piece \"DoubleCounter\" (\"HopCaptureDistance\" (from) Diagonal ~ (then (\"ReplayIfCanMove\" (\"HopCaptureDistance\" (from (last To)) Diagonal)))))))))) (define \"SitesWithPossibleCaptureInPreviousTurn\" (sites Pending)) (game \"Damas\" (\"TwoPlayersNorthSouth\") (\"DraughtsEquipment\" (square 8)) (rules (\"BlackCellsSetup\" 3) (play (if (\"SameTurn\") (if \"IsUnpromoted\" (max Moves (\"HopCapture\" (from (last To)) (directions {FR FL}) (then (if (is In (last To) (sites Next)) (and (promote (last To) (piece \"DoubleCounter\") Mover) (\"ReplayIfCanMove\" (\"HopCaptureDistance\" (from (last To)) Diagonal))) (\"ReplayIfCanMove\" (\"HopCapture\" (from (last To)) (directions {FR FL}))))))) (max Moves (\"HopCaptureDistance\" (from (last To)) Diagonal ~ (then (\"ReplayIfCanMove\" (\"HopCaptureDistance\" (from (last To)) Diagonal)))))) (do (\"RememberSiteWithPossibleCapture\") next:(or { (forEach Piece \"Counter\" (max Moves (\"HopCapture\" (from) (directions {FR FL}) (then (and \"StoreCapturingPiece\" (if (is In (last To) (sites Next)) (and (promote (last To) (piece \"DoubleCounter\") Mover) (\"ReplayIfCanMove\" (\"HopCaptureDistance\" (from (last To)) Diagonal))) (\"ReplayIfCanMove\" (\"HopCapture\" (from (last To)) (directions {FR FL}))))))))) (forEach Piece \"DoubleCounter\" (max Moves (\"HopCaptureDistance\" (from) Diagonal ~ (then (and \"StoreCapturingPiece\" (\"ReplayIfCanMove\" (\"HopCaptureDistance\" (from (last To)) Diagonal))))))) (forEach Piece \"Counter\" (\"StepToEmpty\" (directions {FR FL}) (then (\"PromoteIfReach\" (sites Next) \"DoubleCounter\")))) (forEach Piece \"DoubleCounter\" (move Slide Diagonal))}) (then (and (if (and (!= (\"LastCapturingPiece\") (last To)) (not (is In (last To) (\"SitesWithPossibleCaptureInPreviousTurn\")))) (remove (\"SitesWithPossibleCaptureInPreviousTurn\"))) (if (and (!= (\"LastCapturingPiece\") (last To)) (is In (last From) (\"SitesWithPossibleCaptureInPreviousTurn\"))) (remove (last To)))))))) (end (\"ForEachPlayerNoMovesLoss\")))) END" }, { "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\n8x8 board, with markings in the four central squares, the four corner squares, and the two middle squares of each edge. The pieces have the following movement values: Raja (x1): moves one space in any direction; Mantri (x1): moves diagonally one space; Karabha (x2): jumps exactly two squares diagonally; Raji (x2): moves orthogonally one space and then diagonally another space, jumping over any intervening pieces; Kunjara (x2): moves orthogonally any distance; Patti (x8): move forward orthogonally one space, diagonally forward one space to capture. When a Patti reaches a marked space on the opposite edge of the board, it is promoted to Mantri if it is on a marked square. If it is on an unmarked square, the Patti must move back to the space from which it moved to the last row and is then promoted to Mantri. If the Raja can be taken on the opponent's next turn, it is in check. The Raja must not be in check at the end of the player's turn. If this is not possible, it is checkmate and the opponent wins.If a Raja is in stalemate, and no other pieces can move the player may remove one of the opponent's pieces causing the stalemate. If the opponent is reduced to only their Raja, it is also a victory, though considered a lesser one. Checking the opponent's Raja 64 consecutive times is a win.\n \n\n###\n\n", "completion": "(define \"Move\" (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King_noCross\" Mover)) (then (if (\"IsInCheck\" \"King_noCross\" Next) (set Value Mover (+ 1 (value Player Mover))) (set Value Mover 0))))) (define \"ElephantMove\" (move Hop Diagonal (between if:True) (to if:(not (\"IsFriendAt\" (to))) (apply (if (\"IsEnemyAt\" (to)) (remove (to))))))) (define \"NextCanNotMove\" (not (can Move (do (forEach Piece Next) ifAfterwards:(not (\"IsInCheck\" \"King_noCross\" Next (forEach Piece))))))) (game \"Krida Buddhibalasrita\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (\"ChessKing\" \"King_noCross\") (piece \"Ferz_noCross\" Each (\"StepToNotFriend\" Diagonal)) (\"ChessKnight\" \"Knight\") (piece \"Elephant\" Each (\"ElephantMove\")) (\"ChessRook\" \"Rook\") (\"ChessPawn\" \"Pawn\" ~ (then (if (is In (last To) (sites Mover \"Promotion\")) (and (promote (last To) (piece \"Ferz_noCross\") Mover) (if (not (is In (last To) (sites \"PromotionMarked\"))) (fromTo (from (last To)) (to (last From)))))))) (regions \"Promotion\" P1 (sites Top)) (regions \"Promotion\" P2 (sites Bottom)) (regions \"PromotionMarked\" (sites {\"A1\" \"D1\" \"E1\" \"H1\" \"A8\" \"D8\" \"E8\" \"H8\"}))}) (rules (start { (place \"Pawn1\" (sites Row 1)) (place \"Pawn2\" (sites Row 6)) (place \"Rook1\" {\"A1\" \"H1\"}) (place \"Knight1\" {\"B1\" \"G1\"}) (place \"Elephant1\" {\"C1\" \"F1\"}) (place \"Ferz_noCross1\" coord:\"D1\") (place \"King_noCross1\" coord:\"E1\") (place \"Rook2\" {\"A8\" \"H8\"}) (place \"Knight2\" {\"B8\" \"G8\"}) (place \"Elephant2\" {\"C8\" \"F8\"}) (place \"Ferz_noCross2\" coord:\"D8\") (place \"King_noCross2\" coord:\"E8\")}) (play (if (can Move (\"Move\")) (\"Move\") (move Remove (difference (sites Occupied by:Next) (sites Occupied by:Next component:\"King_noCross\"))))) (end { (if (or (and (\"IsInCheck\" \"King_noCross\" Next) (\"NextCanNotMove\")) (= 1 (count Pieces Next))) (result Mover Win)) (if (= (value Player P1) 64) (result P1 Win)) (if (= (value Player P2) 64) (result P2 Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlay: Players take turns placing one stone of their color on any empty hex.\n \n Goal: When the board is full, the game is over and the player with the higher score is the winner.\n \n Scoring: Each stone is worth 1 point for its owner if it is part of a group connecting opposite sides of the board, and -1 point otherwise.\n \n The scoring trick that gave the game its name \u2013 namely that each stone is worth either +1 point or -1 point \u2013 was (unbeknownst to the inventor of Signum) discovered by Brian Wittmann (the inventor of Loops) 9 years earlier. The score is currently updated only when the board is full. (This makes the AI stronger.) A size 6 board is currently selected\n\n###\n\n", "completion": "(define \"ScoreOf\" (+ (results from:(sites Occupied by:#1) to:0 (if (\"ConnectsAt\" (from)) 1 -1)))) (define \"UpdateScoreMover\" (and (set Score Mover 0) (forEach Group Orthogonal if:(is Mover (who at:(to))) (if (\"Connects\" (sites)) (addScore Mover (count Sites in:(sites))) (addScore Mover (- (count Sites in:(sites)))))))) (define \"LengthOfDiagonal\" (* 2 (- 6 1))) (define \"ConnectsSLOWER\" (or { (is Connected {(sites Side N) #1 (sites Side S)}) (is Connected {(sites Side NW) #1 (sites Side SE)}) (is Connected {(sites Side NE) #1 (sites Side SW)})})) (define \"Connects\" (= (max (results from:(intersection #1 (sites Perimeter)) to:(intersection #1 (sites Perimeter)) (count Steps (from) (to)))) (\"LengthOfDiagonal\"))) (define \"ConnectsAt\" (or { (is Connected at:#1 {(sites Side N) (sites Side S)}) (is Connected at:#1 {(sites Side NW) (sites Side SE)}) (is Connected at:#1 {(sites Side NE) (sites Side SW)})})) (game \"Signum\" (players 2) (equipment { (board (hex 6)) (piece \"Disc\" Each)}) (rules (meta (swap)) (play (move Add (to (sites Empty)))) (end (if (is Full) (byScore { (score P1 (\"ScoreOf\" P1)) (score P2 (\"ScoreOf\" P2))}))))) END" }, { "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 \"CountAndMarkOddGroupsMover\" (and (set Score Mover 0) (forEach Group Orthogonal if:(is Mover (who at:(to))) (if (is Odd (count Sites in:(sites))) (and (addScore Mover -1) (forEach Site (sites) (set State at:(site) 1))) (forEach Site (sites) (set State at:(site) 0)))))) (game \"Mono\" (players 2) (equipment { (board (hex 3)) (piece \"Disc\" Each)}) (rules (meta (swap)) (play (move Add (to (sites Empty)) (then (\"CountAndMarkOddGroupsMover\")))) (end (if (is Full) { (if (= (count Groups if:(= (id P1) (who at:(to)))) (count Groups if:(= (id P2) (who at:(to))))) (byScore)) (if True (byScore { (score P1 (- (count Groups if:(= (id P1) (who at:(to)))))) (score P2 (- (count Groups if:(= (id P2) (who at:(to))))))}))}))))\n\n###\n\n", "completion": "(define \"CountAndMarkOddGroupsMover\" (and (set Score Mover 0) (forEach Group Orthogonal if:(is Mover (who at:(to))) (if (is Odd (count Sites in:(sites))) (and (addScore Mover -1) (forEach Site (sites) (set State at:(site) 1))) (forEach Site (sites) (set State at:(site) 0)))))) (game \"Mono\" (players 2) (equipment { (board (hex 4)) (piece \"Disc\" Each)}) (rules (meta (swap)) (play (move Add (to (sites Empty)) (then (\"CountAndMarkOddGroupsMover\")))) (end (if (is Full) { (if (= (count Groups if:(= (id P1) (who at:(to)))) (count Groups if:(= (id P2) (who at:(to))))) (byScore)) (if True (byScore { (score P1 (- (count Groups if:(= (id P1) (who at:(to)))))) (score P2 (- (count Groups if:(= (id P2) (who at:(to))))))}))})))) END" }, { "prompt": "Construct a Ludii game based on the following description\nOriath has two versions: general and parameter-k. In both versions, the graph is initially uncoloured. Player alternate taking turns, in which the current player colours an uncoloured edge. In the general version, the last player to make a move such that the coloured graph becomes a regular graph wins. For the parameter-k version, the game is won by the last player to make a move such that the coloured graph is a k-regular graph. \n The game is played on the Graph1. General version\n\n###\n\n", "completion": "(game \"Oriath\" (players 1) (equipment { (board (complete (regular Star 7)) use:Edge)}) (rules (play (move Add (to Edge (sites Empty Edge)))) (end { (if (is RegularGraph Mover) (result Mover Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe player aims to make a Hamiltonian cycle, which is a path in which each vertex is visited once, no edge is visited twice, and the ending point is the same as the starting point. \n\n###\n\n", "completion": "(define \"HamiltonianCycle\" (is Path Edge Mover length:(exact (count Sites \"Board\")) closed:True)) (define \"IncressPath\" (is Path Edge Mover length:(exact (count Moves)))) (game \"Icosian\" (players 1) (equipment { (board (graph vertices:{ {4 0} {12 0} {5 3} {8 4} {11 3} {4 6} {6 7} {8 6} {10 7} {12 6} {0 10} {3 9} {7 9} {9 9} {13 9} {16 10} {5 11} {11 11} {8 13} {8 16}} edges:{ {0 1} {0 2} {0 10} {1 4} {1 15} {2 3} {2 5} {3 4} {3 7} {4 9} {5 6} {5 11} {10 11} {11 16} {6 12} {6 7} {7 8} {8 9} {9 14} {14 15} {8 13} {13 12} {12 16} {13 17} {14 17} {16 18} {18 17} {18 19} {10 19} {15 19}}) use:Vertex)}) (rules phases:{ (phase \"Init\" P1 (play (move Add (to Edge (sites Empty Edge)))) (nextPhase \"PathMaking\")) (phase \"PathMaking\" P1 (play (or (do (move Add (to Edge (sites Empty Edge))) ifAfterwards:\"IncressPath\") (do (move Add (to Edge (sites Empty Edge))) ifAfterwards:\"HamiltonianCycle\"))))} (end (if (>= (count Moves) (count Sites \"Board\")) (result Mover Win))))) END" }, { "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": "Describe the mechanics of the following Ludii game\n(define \"Cardinal\" (move (from if:(= (* (from) (if (< 0 (count MovesThisTurn)) 1 0)) (* (last To) (if (< 0 (count MovesThisTurn)) 1 0)))) (to (sites Direction from:(from) #1 stop:(is Occupied (to)) stopIncluded:True) if:(= (next) (who at:(to))) (apply (remove (to)))) #2)) (define \"SouthWest\" (move (from if:(= (* (from) (if (< 0 (count MovesThisTurn)) 1 0)) (* (last To) (if (< 0 (count MovesThisTurn)) 1 0)))) (to (\"Reachable\" S W) #1 (apply (remove (to)))) #2)) (define \"NorthWest\" (move (from if:(= (* (from) (if (< 0 (count MovesThisTurn)) 1 0)) (* (last To) (if (< 0 (count MovesThisTurn)) 1 0)))) (to (\"Reachable\" N W) #1 (apply (remove (to)))) #2)) (define \"SouthEast\" (move (from if:(= (* (from) (if (< 0 (count MovesThisTurn)) 1 0)) (* (last To) (if (< 0 (count MovesThisTurn)) 1 0)))) (to (\"Reachable\" S E) #1 (apply (remove (to)))) #2)) (define \"NorthEast\" (move (from if:(= (* (from) (if (< 0 (count MovesThisTurn)) 1 0)) (* (last To) (if (< 0 (count MovesThisTurn)) 1 0)))) (to (\"Reachable\" N E) #1 (apply (remove (to)))) #2)) (define \"Reachable\" (intersection (sites Occupied by:Enemy) (union (expand (union (sites {(from)}) (sites Distance (step (directions {#1 #2}) (to if:(is Empty (to)))) from:(from) (range 1 Infinity))) #1) (expand (union (sites {(from)}) (sites Distance (step (directions {#1 #2}) (to if:(is Empty (to)))) from:(from) (range 1 Infinity))) #2)))) (define \"SouthOf\" (< (row of:#1) (row of:#2))) (define \"NorthOf\" (> (row of:#1) (row of:#2))) (define \"WestOf\" (< (column of:#1) (column of:#2))) (define \"EastOf\" (> (column of:#1) (column of:#2))) (define \"ReachableCardinalFrom\" (intersection (sites Occupied by:Enemy) (sites Direction from:#1 #2 stop:(is Occupied (to)) stopIncluded:True))) (define \"ReachableFrom\" (intersection (sites Occupied by:Enemy) (union (expand (union (sites {#1}) (sites Distance (step (directions {#2 #3}) (to if:(is Empty (to)))) from:#1 (range 1 Infinity))) #2) (expand (union (sites {#1}) (sites Distance (step (directions {#2 #3}) (to if:(is Empty (to)))) from:#1 (range 1 Infinity))) #3)))) (define \"NextEnemies\" (if (= 1 (var)) (\"ReachableCardinalFrom\" (last To) N) (if (= 2 (var)) (\"ReachableCardinalFrom\" (last To) E) (if (= 3 (var)) (\"ReachableCardinalFrom\" (last To) S) (if (= 4 (var)) (\"ReachableCardinalFrom\" (last To) W) (if (= 5 (var)) (\"ReachableFrom\" (last To) N E) (if (= 6 (var)) (\"ReachableFrom\" (last To) S E) (if (= 7 (var)) (\"ReachableFrom\" (last To) N W) (\"ReachableFrom\" (last To) S W))))))))) (define \"Continue\" (if (= 1 (var)) (\"Cardinal\" N ~) (if (= 2 (var)) (\"Cardinal\" E ~) (if (= 3 (var)) (\"Cardinal\" S ~) (if (= 4 (var)) (\"Cardinal\" W ~) (if (= 5 (var)) (\"NorthEast\" ~ ~) (if (= 6 (var)) (\"SouthEast\" ~ ~) (if (= 7 (var)) (\"NorthWest\" ~ ~) (\"SouthWest\" ~ ~))))))))) (game \"Sweep Burrow\" (players 2) (equipment { (board (square 8)) (piece \"Disc\" Each (if (= 0 (count MovesThisTurn)) (or { (\"Cardinal\" N (then (set Var 1))) (\"Cardinal\" E (then (set Var 2))) (\"Cardinal\" S (then (set Var 3))) (\"Cardinal\" W (then (set Var 4))) (\"NorthEast\" if:(and (\"NorthOf\" (to) (from)) (\"EastOf\" (to) (from))) (then (set Var 5))) (\"SouthEast\" if:(and (\"SouthOf\" (to) (from)) (\"EastOf\" (to) (from))) (then (set Var 6))) (\"NorthWest\" if:(and (\"NorthOf\" (to) (from)) (\"WestOf\" (to) (from))) (then (set Var 7))) (\"SouthWest\" if:(and (\"SouthOf\" (to) (from)) (\"WestOf\" (to) (from))) (then (set Var 8)))}) (\"Continue\") (then (if (< 0 (count Sites in:(\"NextEnemies\"))) (moveAgain)))))}) (rules (start { (place \"Disc1\" (forEach (sites Board) if:(or (and (is Even (row of:(site))) (> 2 (% (site) 4))) (and (is Odd (row of:(site))) (< 1 (% (site) 4)))))) (place \"Disc2\" (forEach (sites Board) if:(or (and (is Odd (row of:(site))) (> 2 (% (site) 4))) (and (is Even (row of:(site))) (< 1 (% (site) 4))))))}) (play (forEach Piece)) (end (\"CaptureAll\" Next))))\n\n###\n\n", "completion": "By far the easiest of the variants so far, Sweep Burrow's template is simply the two orthogonal directions involved in making the initial capture. The only further convention here is that if the capture was made with just movement in one direction, you cannot employ a second direction.\n \n The player may not end his turn until the capturing piece have no further captures available. END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe version of the game played with 3 players. -> The version of the game played with 4 players.\n(game \"Onek Rong\" (players 3) (equipment { (board (subdivide (hex 2)) use:Vertex) (piece \"Marker\" Each)}) (rules (start { (set Cost 1 Vertex at:0) (set Cost 2 Vertex at:1) (set Cost 3 Vertex at:2) (set Cost 1 Vertex at:3) (set Cost 2 Vertex at:4) (set Cost 3 Vertex at:5) (set Cost 1 Vertex at:6) (set Cost 2 Vertex at:7) (set Cost 3 Vertex at:8) (set Cost 3 Vertex at:9) (set Cost 1 Vertex at:10) (set Cost 2 Vertex at:11) (set Cost 3 Vertex at:12) (set Cost 1 Vertex at:13) (set Cost 2 Vertex at:14) (set Cost 3 Vertex at:15) (set Cost 1 Vertex at:16) (set Cost 2 Vertex at:17) (set Cost 3 Vertex at:18) (set Cost 3 Vertex at:19) (set Cost 1 Vertex at:20) (set Cost 2 Vertex at:21) (set Cost 3 Vertex at:22) (set Cost 1 Vertex at:23)}) (play (or (move Claim (to (sites Empty)) (then (if (= 1 (size Group at:(last To))) (addScore Mover (cost Vertex at:(last To)))))) (move Pass))) (end (if (or (= (count Sites in:(sites Empty)) 0) (all Passed)) (byScore)))))\n\n###\n\n", "completion": "(game \"Onek Rong\" (players 4) (equipment { (board (subdivide (hex 2)) use:Vertex) (piece \"Marker\" Each)}) (rules (start { (set Cost 1 Vertex at:0) (set Cost 2 Vertex at:1) (set Cost 3 Vertex at:2) (set Cost 1 Vertex at:3) (set Cost 2 Vertex at:4) (set Cost 3 Vertex at:5) (set Cost 1 Vertex at:6) (set Cost 2 Vertex at:7) (set Cost 3 Vertex at:8) (set Cost 3 Vertex at:9) (set Cost 1 Vertex at:10) (set Cost 2 Vertex at:11) (set Cost 3 Vertex at:12) (set Cost 1 Vertex at:13) (set Cost 2 Vertex at:14) (set Cost 3 Vertex at:15) (set Cost 1 Vertex at:16) (set Cost 2 Vertex at:17) (set Cost 3 Vertex at:18) (set Cost 3 Vertex at:19) (set Cost 1 Vertex at:20) (set Cost 2 Vertex at:21) (set Cost 3 Vertex at:22) (set Cost 1 Vertex at:23)}) (play (or (move Claim (to (sites Empty)) (then (if (= 1 (size Group at:(last To))) (addScore Mover (cost Vertex at:(last To)))))) (move Pass))) (end (if (or (= (count Sites in:(sites Empty)) 0) (all Passed)) (byScore))))) END" }, { "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. A player picks up all of the counters in one of the holes in their row and sows them one-by-one in a counterclockwise direction in consecutive holes from the hole the pieces originated. The starting hole is always left empty, even if a player sows in a complete circuit of the board, the original house is skipped and sowing continues in the next hole after it. When the final counter falls into an occupied hole, these are picked up and sowing continues. When the final counter of a sowing lands on in an empty hole in the player's own row, the contents of the hole in the opponent's row opposite it are captured. If the opponent's holes are all empty, the other player must make a move placing counters in the opponent's row. If not possible, the player captures all the counters in their row. The player who has captured the most counters wins. If the game continues in a repeating loop, the players can agree to end the game and capture the counters remaining in their row. \n\n###\n\n", "completion": "(define \"CaptureAsInOware\" (and (is In #1 (sites Next)) (or (= (count at:#1) 2) (= (count at:#1) 3)))) (define \"PiecesOwnedBy\" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (define \"Columns\" 6) (game \"Yovodji\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" store:None (track \"Track\" \"0,E,N,W\" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 4 to:(sites Track))) (play (if (is Proposed \"End\") (or (move Vote \"End\") (move Vote \"No\")) (or (if (is Cycle) (move Propose \"End\")) (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover)) if:(< 0 (count at:(from)))) (then (sow apply:(if (\"CaptureAsInOware\" (to)) (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))) (if (< 1 (count at:(to))) (moveAgain) (if (and (is In (to) (sites Mover)) (< 1 (count at:(\"OppositePit\" (to))))) (fromTo (from (\"OppositePit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePit\" (to))))))) includeSelf:False backtracking:(\"CaptureAsInOware\" (from)))))))) (end (\"MancalaByScoreWhen\" (or (no Moves Mover) (is Decided \"End\")))))) END" }, { "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 Ludii game based on the following description\n2x12 board, with spaces as points, divided in two. Fifteen pieces per player, which start stacked, two on the players' first three points and three in the next three points. Two six-sided dice. Players unstack the pieces by moving pieces off of the stack, but remaining on the same point, according to the throws of the dice. The value of the throw indicates the number of the point which can be unstacked. For example, a throw of 1 and 4 allows the player to unstack the pieces on points 1 and 4. When all of a player's pieces are unstacked, they must be restacked, in the same way. When they have been successfully restacked, the player then bears off the pieces from this quadrant of the board. When bearing off, players move according to the number on each die by moving one piece the value on one die then another piece the value on the other die, or by moving one piece the value of one die and then the value of the other. The first player to bear off all their pieces wins.\n \n\n###\n\n", "completion": "(define \"Stack\" (forEach Level (last To) (set State at:(last To) level:(level) 0))) (define \"UnstackHalf\" (forEach Level (last To) (set State at:(last To) level:(level) 1))) (define \"UnstackFull\" (forEach Level (last To) (set State at:(last To) level:(level) 2))) (define \"PieceStacked\" (or (\"PieceFullStacked\" #1) (\"PieceHalfStacked\" #1))) (define \"PieceHalfStacked\" (= (state at:#1) 1)) (define \"PieceFullStacked\" (= (state at:#1) 0)) (define \"PieceUnstacked\" (= (state at:#1) 2)) (define \"RemoveAPiece\" (move Remove (from))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" (pips))) (define \"SiteToSelect\" (\"NextSiteOnTrack\" (- (pips) 1) from:(mapEntry \"StartTrack\" (mover)))) (game \"Yahoudieh\" (players 2) (equipment { (\"BackgammonBoard\" { (track \"Track1\" {7..12} P1 directed:True) (track \"Track2\" {18..13} P2 directed:True)}) (dice d:6 num:2) (piece \"Disc\" Each (forEach Die if:(\"DieNotUsed\") (if (\"IsOffBoard\" \"SiteToMoveOnTrack\") \"RemoveAPiece\" (move (from) (to \"SiteToMoveOnTrack\"))))) (map \"StartTrack\" {(pair P1 7) (pair P2 18)})}) (rules (start { (place Stack \"Disc1\" (sites {7..9}) count:2) (place Stack \"Disc1\" (sites {10..12}) count:3) (place Stack \"Disc2\" (sites {13..15}) count:3) (place Stack \"Disc2\" (sites {16..18}) count:2)}) phases:{ (phase \"UnStacking\" (play (\"RollEachNewTurnMove\" (forEach Die if:(\"DieNotUsed\") (or (if (\"PieceFullStacked\" \"SiteToSelect\") (move Select (from (\"SiteToSelect\")) (then (and (if (= 3 (size Stack at:(last To))) (\"UnstackHalf\") (\"UnstackFull\")) (\"ReplayNotAllDiceUsed\"))))) (if (\"PieceHalfStacked\" \"SiteToSelect\") (move Select (from (\"SiteToSelect\")) (then (and (\"UnstackFull\") (\"ReplayNotAllDiceUsed\"))))))))) (nextPhase Mover (all Sites (sites Occupied by:Mover) if:(not (\"PieceStacked\" (site)))) \"Stacking\")) (phase \"Stacking\" (play (\"RollEachNewTurnMove\" (forEach Die if:(\"DieNotUsed\") (or (if (\"PieceUnstacked\" \"SiteToSelect\") (move Select (from (\"SiteToSelect\")) (then (and { (if (= 3 (size Stack at:(last To))) (\"UnstackHalf\") (\"Stack\")) (\"ReplayNotAllDiceUsed\")})))) (if (\"PieceHalfStacked\" \"SiteToSelect\") (move Select (from (\"SiteToSelect\")) (then (and (\"Stack\") (\"ReplayNotAllDiceUsed\"))))))))) (nextPhase Mover (all Sites (sites Occupied by:Mover) if:(not (\"PieceUnstacked\" (site)))) \"BearingOff\")) (phase \"BearingOff\" (play (do (if (or (all DiceEqual) (\"NewTurn\")) (roll)) next:(forEach Piece top:True) (then (\"ReplayNotAllDiceUsed\")))) (end (\"EscapeWin\")))})) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x7 board. Seven counters in each hole. Sowing occurs in an anti-clockwise direction. When the final counter falls into an occupied hole, the contents of that hole are picked up and sowing continues. If the final counter falls into a hole containing one or three counters, the player captures those counters, plus any counters in the hole in the opposite row, as well as the contents of any holes in an unbroken sequence following the one in which the final counter which also contain two or four counters.When the final counter falls into an empty hole, the turn ends. Play continues until all of the pieces are captured. The player who captured the most counters wins. \n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (+ (count in:(sites Mover)) (count Cell at:(handSite #1)))) (define \"NoPieceOnBoard\" (>= 1 (count Pieces All in:(sites Board)))) (define \"Columns\" 7) (game \"La'b Akila\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" store:None (track \"TrackCCW\" \"0,E,N,W\" loop:True)) (piece \"Seed\" Shared) (hand Each) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start (set Count 7 to:(sites Track))) (play (move Select (from (sites Mover) if:(is Occupied (from))) (then (sow if:True apply:(if (or (= 2 (count at:(to))) (= 4 (count at:(to)))) (and (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))) (if (!= 0 (count at:(\"OppositePitTwoRows\" (to)))) (fromTo (from (\"OppositePitTwoRows\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePitTwoRows\" (to))))))) backtracking:(or (= 2 (count at:(to))) (= 4 (count at:(to)))))))) (end (\"MancalaByScoreWhen\" (\"NoPieceOnBoard\"))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nTwo rows of ten holes Four counters in each hole First play must be from the rightmost hole. The player has to open the game with one of the four rightmost holes.\n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (+ (count Cell at:(handSite #1)) (count in:(sites #1 \"Home\")))) (define \"Sow\" (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover #1)) if:(> (count at:(from)) 0)) (then (sow apply:(if (and { (is In (to) (sites Mover \"Home\")) (= (count at:(to)) 1) (> (count at:(\"OppositePit\" (to))) 0)}) (and (fromTo (from (\"OppositePit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePit\" (to)))) (fromTo (from (to)) (to (handSite Mover)) count:1)) (if (> (count at:(to)) 1) (moveAgain))))))) (define \"Columns\" 10) (game \"Dabuda\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" store:None (track \"Track\" \"0,E,N,W\" loop:True)) (regions \"Home\" P1 (sites Bottom)) (regions \"Home\" P2 (sites Top)) (regions \"RightMost\" P1 (sites {6..9})) (regions \"RightMost\" P2 (sites {10..13})) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 4 to:(sites Track))) phases:{ (phase \"Rightmost\" (play (\"Sow\" \"RightMost\")) (nextPhase (= (count Turns) 2) \"HomePhase\")) (phase \"HomePhase\" (play (\"Sow\" \"Home\")))} (end (\"MancalaByScoreWhen\" (no Moves Mover))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThree concentric squares with lines connecting the midpoints of the squares. Nine pieces per player. Players alternate turns placing one of their pieces on an empty space. If a player places three of their pieces along one of the straight lines, they take another turn. Once all of the pieces are on the board, players take turns moving a piece to an empty space on the board. When a player creates a line of three in this phase, the player removes one of the opponent's pieces, and receives another turn. The player who reduces the opponent to two pieces wins. \n\n###\n\n", "completion": "(define \"IfLine3MoveAgainPlacement\" (then (if (and (is Line 3) (\"HandOccupied\" Mover)) (moveAgain)))) (game \"Nerenchi Keliya\" (players 2) (equipment { (\"NineMensMorrisBoard\") (hand Each) (piece \"Marker\" Each (\"StepToEmpty\" ~ (then (\"ReplayIfLine3\"))))}) (rules (start (place \"Marker\" \"Hand\" count:9)) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (sites Empty)) \"IfLine3MoveAgainPlacement\")) (nextPhase (and (\"HandEmpty\" P1) (\"HandEmpty\" P2)) \"Movement\")) (phase \"Movement\" (play (forEach Piece)) (nextPhase Mover (is Line 3) \"Capture\")) (phase \"Capture\" (play (\"RemoveAnyEnemyPiece\" (then (moveAgain)))) (nextPhase Mover \"Movement\"))} (end (forEach Player if:(<= (count Pieces Player) 2) (result Player Loss))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6 board. Four counters in each hole. Play begins with a stylised move. One player takes the four counters in their leftmost hole and places them into the next hole, moving in an anti-clockwise direction. They then take the four counters in the next hole, and place them in the following holes. This continues until the entire board has an alternation pattern of a hole with eight counters followed by one with zero counters. The player then sows beginning from the final hole with eight counters they created. When the final counter of a sowing lands in a hole with counters, the player picks up these counters and sowing continues. When the final counter falls into an empty hole, the turn ends. At any time during the sowing a hole is made to contain four counters, they are captured by the player who is sowing, except when it is the final hole of a sowing, in which case they are picked up and sowing continues. If a player cannot play, they must pass their turn and may resume play when they are next able. When all of the counters have been captured, the player who captured the most counters wins. \n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (count Cell at:(handSite #1))) (define \"NextHole\" (\"NextSiteOnTrack\" #2 from:#1 \"Track\")) (game \"Gabata (Oromo)\" (players 2) (equipment { (mancalaBoard 2 6 store:None (track \"Track\" \"0,E,N,W\" loop:True)) (piece \"Seed\" Shared) (hand Each) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start (set Count 4 to:(sites Track))) phases:{ (phase \"Opening1\" (play (move Select (from (if (\"SameTurn\") (var \"Replay\") 0)) (then (sow numPerHole:4 apply:(and (moveAgain) (if (is Occupied (\"NextHole\" (to) 1)) (set Var \"Replay\" (\"NextHole\" (to) 1)) (set Var \"Replay\" Undefined))))))) (nextPhase (= Undefined (var \"Replay\")) \"Opening2\")) (phase \"Opening2\" (play (move Select (from (if (and (\"SameTurn\") (!= Undefined (var \"Replay\"))) (var \"Replay\") 6)) (then (do (set Var \"NumSowed\" (count at:(last To))) next:(sow apply:(if (< 1 (count at:(to))) (and (moveAgain) (set Var \"Replay\" (to))))) (then (and (forEach Site (sites Track from:(last From) to:(trackSite Move from:(last From) \"Track\" steps:(- (var \"NumSowed\") 1))) (if (= 4 (count at:(site))) (fromTo (from (site)) (to (handSite Mover)) count:4))) (set Var \"NumSowed\" 0))))))) (nextPhase (not (is Next Prev)) \"Sowing\")) (phase \"Sowing\" (play (move Select (from (if (and (\"SameTurn\") (!= Undefined (var \"Replay\"))) (sites {(var \"Replay\")}) (sites Mover)) if:(is Occupied (from))) (then (do (set Var \"NumSowed\" (count at:(last To))) next:(sow apply:(if (< 1 (count at:(to))) (and (moveAgain) (set Var \"Replay\" (to))))) (then (and (forEach Site (sites Track from:(last From) to:(trackSite Move from:(last From) \"Track\" steps:(- (var \"NumSowed\") 1))) (if (= 4 (count at:(site))) (fromTo (from (site)) (to (handSite Mover)) count:4))) (set Var \"NumSowed\" 0))))))))} (end (\"MancalaByScoreWhen\" (\"NoPieceOnBoard\"))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"Snailtrail\" (players 2) (equipment { (board (rectangle 7 7)) (piece \"Pawn\" Each (move Step (to if:(is Empty (to))) (then (moveAgain)))) (piece \"Square\" Neutral)}) (rules (start { (place \"Pawn1\" {\"A1\"}) (place \"Pawn2\" {\"G7\"})}) (play (if (is Even (count Moves)) (forEach Piece) (move Add (piece \"Square0\") (to (last From))))) (end (\"BlockWin\"))))\n\n###\n\n", "completion": "Each player has a pawn, that can move to any neighboring cell. After moving, the player places a block to the cell he came from. First player who cannot move loses. The game is played on a 7x7 board. END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"Centre\" (sites {0..3})) (define \"TakeBall\" (if (\"IsPieceAt\" \"Ball\" Shared 32) (and (remove 32) (add (piece (id \"Ball\" #1)) (to 32))) (if (\"IsPieceAt\" \"Ball\" Shared 33) (and (remove 33) (add (piece (id \"Ball\" #1)) (to 33))) (and (remove 34) (add (piece (id \"Ball\" #1)) (to 34)))))) (define \"NextSitePrev\" (if (is Prev P1) (\"NextSite\" from:(where \"Marker\" Prev) \"Track1\") (if (is Prev P2) (\"NextSite\" from:(where \"Marker\" Prev) \"Track2\") (if (is Prev P3) (\"NextSite\" from:(where \"Marker\" Prev) \"Track3\") (\"NextSite\" from:(where \"Marker\" Prev) \"Track4\"))))) (define \"NextSite\" (\"NextSiteOnTrack\" 1 #1 #2)) (game \"Aime\" (players 4) (equipment { (board (merge { (concentric {4 4 4 4 4 4 4 4}) (shift -7 7 (square 1)) (shift -6 7 (square 1)) (shift -7 6 (square 1))}) { (track \"Track1\" {28 24 20 16 12 8 4 0} P1 directed:True) (track \"Track2\" {29 25 21 17 13 9 5 1} P2 directed:True) (track \"Track3\" {30 26 22 18 14 10 6 2} P3 directed:True) (track \"Track4\" {31 27 23 19 15 11 7 3} P4 directed:True)} use:Vertex) (piece \"Marker\" Each) (piece \"Stick\" Shared) (piece \"Ball\" Each) (piece \"Ball\" Shared) (hand Each size:2)}) (rules (start { (place \"Marker1\" 28) (place \"Marker2\" 29) (place \"Marker3\" 30) (place \"Marker4\" 31) (place \"Ball\" (sites {32..34}))}) phases:{ (phase \"Hiding\" (play (move Add (piece (id \"Stick\" Shared)) (to Cell (sites Hand Mover)) (then (set Hidden Cell at:(last To) to:Next)))) (nextPhase \"Guessing\")) (phase \"Guessing\" (play (move Select (from Cell (sites Hand Prev)) (then (and (if (is Empty (last To)) (and (fromTo (from (where \"Marker\" Prev)) (to (\"NextSitePrev\"))) (if (not (is In (\"NextSitePrev\") (\"Centre\"))) (set NextPlayer (player (prev))) (\"TakeBall\" Prev))) (and { (moveAgain) (fromTo (from (where \"Marker\" Mover)) (to (\"NextSite\" from:(where \"Marker\" Mover)))) (if (is In (\"NextSite\" from:(where \"Marker\" Mover)) (\"Centre\")) (\"TakeBall\" Mover))})) (remove Cell (sites Hand Prev)))))) (nextPhase \"Hiding\"))} (end (if (!= (- (count Players) (count Active)) (count Sites in:(difference (\"Centre\") (sites Empty)))) { (if (and (is Active P1) (is In (where \"Marker\" P1) (\"Centre\"))) (result P1 Win)) (if (and (is Active P2) (is In (where \"Marker\" P2) (\"Centre\"))) (result P2 Win)) (if (and (is Active P3) (is In (where \"Marker\" P3) (\"Centre\"))) (result P3 Win)) (if (and (is Active P4) (is In (where \"Marker\" P4) (\"Centre\"))) (result P4 Win))}))))\n\n###\n\n", "completion": "Seven concentric circles. Three points outside the circles. The center contains a circle, the market. There are three balls, placed near the board. Each player plays with one piece, which begins in the outermost point. The first player holds something in their hand, and asks the second player to guess which hand it is in. If the guessing player guesses correctly, they move their piece to the next point, or to the next ring of the spiral toward the market. If the guessing player guesses incorrectly, the player holding the object moves one space forward. The guessing player now takes the object, and asks the next player to guess which hand the object is in, and so on. When a player reaches the market, they take one of the three balls next to the board. The player who fails to collect a ball loses. END" }, { "prompt": "Construct a Ludii game based on the following description\nOBJECT OF THE GAME The last player to make a move wins.\n \n FRIENDLY AND ENEMY CONNECTIONS A connection, i.e. an orthogonal\n adjacency between two checkers, is friendly if the two checkers are the same color and enemy if the two checkers are oppositely colored. \n \n CHECKER VALUE A checker\u2019s value is its number of friendly connections minus\n its number of enemy connections.\n \n MOVES A checker\u2019s value must increase when it\u2018s moved. Move a checker to an\n unoccupied, orthogonally adjacent square.\n \n There is no capturing in Jostle, only jostling. The game is played on a 10x10 square board.\n\n###\n\n", "completion": "(define \"Score\" (+ (results from:(sites {(from)}) to:(sites Around #1 Orthogonal) (if (= (from) (to)) 0 (if (\"IsFriendAt\" (to)) 1 (if (\"IsEnemyAt\" (to)) -1 0)))))) (game \"Jostle\" (players 2) (equipment { (board (square 10)) (piece \"Marker\" Each (move Step Orthogonal (to if:(and (is Empty (to)) (< (\"Score\" (from)) (\"Score\" (to)))))))}) (rules (start { (place \"Marker1\" (sites {23 25 27 32 34 36 43 47 52 63 72 74 76 65 67 56})) (place \"Marker2\" (sites {22 24 26 33 35 37 42 46 53 57 62 64 66 73 75 77}))}) (play (forEach Piece)) (end (\"BlockWin\")))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"HasMadeACapture\" (is Triggered \"CaptureMade\" Next)) (define \"CaptureSurroundedPiece\" (enclose (from (last To)) Orthogonal (between if:(\"IsEnemyAt\" (between)) (apply (and (trigger \"CaptureMade\" Next) (remove (between))))))) (game \"Atari Go\" (players 2) (equipment { (board (square 19) use:Vertex) (piece \"Marker\" Each)}) (rules (play (do (move Add (to (sites Empty)) (then (\"CaptureSurroundedPiece\"))) ifAfterwards:(\"HasFreedom\" Orthogonal))) (end (if \"HasMadeACapture\" (result Mover Win)))))\n\n###\n\n", "completion": "The rules are identical to Go, except the winning condition is to be the first to capture a stone. The game is played on a 19x19 board. END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game starts with 2 counters. -> The game starts with 4 counters.\n(define \"KalahCount\" (count at:(mapEntry #1))) (define \"PiecesOwnedByP2\" (+ {(count at:(mapEntry P2)) (count in:(sites P2)) (count in:(sites P1))})) (define \"PiecesOwnedByP1\" (+ {(count at:(mapEntry P1)) (count in:(sites P1)) (count in:(sites P2))})) (game \"Aw-li On-nam Ot-tjin\" (players 2) (equipment { (mancalaBoard 2 9 (track \"Track\" \"1,E,N,W\" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 FirstSite) (pair P2 LastSite)}) (piece \"Seed\" Shared)}) (rules (start (set Count 2 to:(sites Track))) (play (move Select (from (sites Mover) if:(> (count at:(from)) 1)) (then (sow if:(= (count at:(to)) 2) apply:(fromTo (from (to)) (to (mapEntry (mover))) count:(count at:(to))))))) (end (if (no Moves Mover) { (\"DrawIfNoMoves\" Next) (if (is Mover P1) (byScore { (score P1 (\"KalahCount\" P1)) (score P2 \"PiecesOwnedByP1\")})) (if (is Mover P2) (byScore { (score P1 \"PiecesOwnedByP2\") (score P2 (\"KalahCount\" P2))}))}))))\n\n###\n\n", "completion": "(define \"KalahCount\" (count at:(mapEntry #1))) (define \"PiecesOwnedByP2\" (+ {(count at:(mapEntry P2)) (count in:(sites P2)) (count in:(sites P1))})) (define \"PiecesOwnedByP1\" (+ {(count at:(mapEntry P1)) (count in:(sites P1)) (count in:(sites P2))})) (game \"Aw-li On-nam Ot-tjin\" (players 2) (equipment { (mancalaBoard 2 9 (track \"Track\" \"1,E,N,W\" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 FirstSite) (pair P2 LastSite)}) (piece \"Seed\" Shared)}) (rules (start (set Count 4 to:(sites Track))) (play (move Select (from (sites Mover) if:(> (count at:(from)) 1)) (then (sow if:(= (count at:(to)) 4) apply:(fromTo (from (to)) (to (mapEntry (mover))) count:(count at:(to))))))) (end (if (no Moves Mover) { (\"DrawIfNoMoves\" Next) (if (is Mover P1) (byScore { (score P1 (\"KalahCount\" P1)) (score P2 \"PiecesOwnedByP1\")})) (if (is Mover P2) (byScore { (score P1 \"PiecesOwnedByP2\") (score P2 (\"KalahCount\" P2))}))})))) END" }, { "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": "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 Ludii game based on the following description\nEach player's six pieces are set up on their respective triangle. \n A piece is moved one space in any direction per turn onto an empty point along the lines of the board.\n A piece captures an enemy piece by hopping over it as in draughts.\n Only one piece may be used to move or capture per turn. Players alternate their turns throughout the game. Capturing is optional but pieces can promote.\n\n###\n\n", "completion": "(game \"Felli\" (players 2) (equipment { (board (graph vertices:{ {0 0} {2 0} {4 0} {1 1} {2 1} {3 1} {2 2} {1 3} {2 3} {3 3} {0 4} {2 4} {4 4}} edges:{ {0 1} {0 3} {1 2} {1 4} {2 5} {3 4} {3 6} {4 5} {4 6} {5 6} {6 7} {6 8} {6 9} {7 8} {7 10} {8 9} {8 11} {9 12} {10 11} {11 12}}) use:Vertex) (piece \"Counter\" Each) (piece \"DoubleCounter\" Each) (regions P1 (intersection (sites Corners) (sites Bottom))) (regions P2 (intersection (sites Corners) (sites Top)))}) (rules (start { (place \"Counter1\" (expand (sites Bottom))) (place \"Counter2\" (expand (sites Top)))}) (play (or { (forEach Piece \"Counter\" (\"HopCapture\") (then (\"PromoteIfReach\" (sites Next) \"DoubleCounter\"))) (forEach Piece \"Counter\" (\"StepToEmpty\") (then (\"PromoteIfReach\" (sites Next) \"DoubleCounter\"))) (forEach Piece \"DoubleCounter\" (move Slide)) (forEach Piece \"DoubleCounter\" (\"HopCapture\"))})) (end (\"NoMoves\" Loss)))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"NextHoleFrom\" (trackSite Move from:#1 steps:#2)) (game \"Lelac\" (players 2) (equipment { (board (concentric {0 10}) (track \"Track\" {0..9} loop:True) use:Vertex) (piece \"Square\" Shared) (dice d:6 num:1) (regions P1 (expand (sites Bottom) steps:2)) (regions P2 (expand (sites Top) steps:2))}) (rules (start (set Count 1 to:(sites Board))) (play (\"RollMove\" (move (from (if (\"SameTurn\") (sites {(last From)}) (forEach (sites Mover) if:(is Occupied (site))))) (to (\"NextHoleFrom\" (from) (count Pips))) (then (if (is Occupied (last From)) (moveAgain)))))) (end (forEach Player if:(all Sites (sites Player) if:(and (is Next Player) (is Empty (site)))) (result Player Loss)))))\n\n###\n\n", "completion": "The game is played on a board with ten round pits arranged in a circle. Each player owns the semicircle closest to him. The game requires ten seeds and one standard six-faced die. At the start of the game, each pit contains one seed.\n \n During their turn, a player rolls a die. He then chooses one of his nonempty pits to sow. They take one seed from the sown pit, and move it counterclockwise according to the die value rolled. Then, they must roll to move each remaining seed from the sown pit. The turn only ends once the sown pit is empty. So, for example, if a player chooses to sow a pit with 4 seeds after his initial roll, 3 additional rolls will be needed.\n \n A player wins when all ten seeds are on their part of the board at the end of their turn. END" }, { "prompt": "Construct a Ludii game based on the following description\nThree rows of four holes; the central two holes in the middle row are stores. Each player owns the hole in the central row to their left. Ten counters in each hole. Players sow from one of their holes, sowing first into the hole from which the counters were lifted, in an anti-clockwise direction. When the final counter lands in a hole containing two counters, these counters are captured. The player captures like this seven times. The eighth captures happens when the final counter falls into a hole containing one counter; the next capture from a hole containing three; the next from a hole containing five; then repeating the pattern of one, three, five for the rest of the game. The player who captures the most counters wins. The number of counters to have in the hole to capture in the initial captures before the sequence is 2. The number of initial captures before the sequence is 7.\n\n###\n\n", "completion": "(define \"UpdateNumCaptureTwo\" (set Value Mover (+ 1 (value Player Mover)))) (define \"NumCountersToCapture\" (if (is In 2 (\"NumToCapture\")) (+ 1 2) (if (is In 1 (\"NumToCapture\")) 2 (if (is In 3 (\"NumToCapture\")) 4 6)))) (define \"UpdateNumToCapture\" (if (is Mover P1) (and (forget Value \"NumToCaptureP1\" All) (if (is In 2 (\"NumToCapture\")) (remember Value \"NumToCaptureP1\" 1) (if (is In 1 (\"NumToCapture\")) (remember Value \"NumToCaptureP1\" 3) (if (is In 5 (\"NumToCapture\")) (remember Value \"NumToCaptureP1\" 1) (remember Value \"NumToCaptureP1\" 5))))) (and (forget Value \"NumToCaptureP2\" All) (if (is In 2 (\"NumToCapture\")) (remember Value \"NumToCaptureP2\" 1) (if (is In 1 (\"NumToCapture\")) (remember Value \"NumToCaptureP2\" 3) (if (is In 5 (\"NumToCapture\")) (remember Value \"NumToCaptureP2\" 1) (remember Value \"NumToCaptureP2\" 5))))))) (define \"NumToCapture\" (if (is Mover P1) (sites (values Remembered \"NumToCaptureP1\")) (sites (values Remembered \"NumToCaptureP2\")))) (define \"PiecesOwnedBy\" (count at:(mapEntry #1))) (define \"Columns\" 4) (game \"The Concentration Game\" (players 2) (equipment { (mancalaBoard 3 \"Columns\" store:None (track \"Track\" \"0,E,N,W,S2\" loop:True)) (piece \"Seed\" Shared) (regions P1 (union (sites {4}) (sites Bottom))) (regions P2 (union (sites {7}) (sites Top))) (map {(pair P1 5) (pair P2 6)})}) (rules (start { (set Count 10 to:(sites Outer)) (set RememberValue \"NumToCaptureP1\" 2) (set RememberValue \"NumToCaptureP2\" 2) (set RememberValue \"NumCaptureTwoP1\" 0) (set RememberValue \"NumCaptureTwoP2\" 0)}) (play (move Select (from (sites Mover) if:(< 1 (count at:(from)))) (then (sow if:(= (count at:(to)) (\"NumCountersToCapture\")) apply:(and (fromTo (from (to)) (to (mapEntry (mover))) count:(count at:(to))) (if (< (value Player Mover) 5) (\"UpdateNumCaptureTwo\") (\"UpdateNumToCapture\"))) origin:True)))) (end (\"MancalaByScoreWhen\" (no Moves Next))))) END" }, { "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\n8x8 checkered board. One player plays as four sheep (white pieces), which begin on the four dark squares on one side of the board. The other player plays as one wolf (black piece), which can be placed on any dark space on the board. Players alternate turns moving a piece to an empty adjacent dark square on the board. The sheep move forward only but the wolf may also move backward. The goal of the sheep is to block the wolf from being able to move, the goal of the wolf is to move beyond the line of sheep. \n\n###\n\n", "completion": "(define \"WolfBeyondSheepRow\" (= 0 (count Sites in:(forEach (sites Occupied by:P2) if:(<= (row of:(site)) (row of:(where \"Wolf\" P1))))))) (game \"Wolf und Schaaf\" (players 2) (equipment { (board (square 8)) (piece \"Sheep\" P2 N (\"StepToEmpty\" (directions {FR FL}))) (piece \"Wolf\" P1 \"StepDiagonalToEmpty\") (hand P1)}) (rules (start { (place \"Wolf1\" (handSite P1)) (place \"Sheep2\" {\"A1\" \"C1\" \"E1\" \"G1\"})}) phases:{ (phase \"Placement\" P1 (play (move (from (handSite P1)) (to (intersection (sites Phase 0) (sites Empty))))) (nextPhase \"Movement\")) (\"PhaseMovePiece\" \"Movement\")} (end { (if (and (no Moves P1) (is Mover P1)) (result P2 Win)) (if (\"WolfBeyondSheepRow\") (result P1 Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe game is played on a board with twelve points on either side. The points form a continuous track in a horseshoe shape; each player progresses in opposite directions (one from their bottom right to the top right, the other from their bottom left to their top left. Each player has 15 pieces. Each player's fifteen pieces begin on the first point of their track. Players move according to the number on each die by moving one piece the value on one die then another piece the value on the other die, or by moving one piece the value of one die and then the value of the other. If doubles are rolled, the player must play the number on each die twice. A piece cannot land on a space occupied by one of the opponent's pieces. A player must first move a single one of their pieces around the board and onto one of the final six points of their track before moving any of the other pieces. When all of the player's pieces are on the final six points, they may be borne off the board. The player who bears off all of their pieces wins. The winning player's score equals the number of the opponent's pieces which are left on the board. Play continues until one player's score reaches 31. \n\n###\n\n", "completion": "(games (subgame \"MughrabiehSubgame\" result:(score Mover))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"AllPiecesOnCentre\" (and (= 1 (count Sites in:(sites Occupied by:#1 top:False))) (is In (centrePoint) (sites Occupied by:#1 top:False)))) (define \"IsSpecialThrow\" (is In (\"ThrowValue\") (sites {10 25 30}))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" #2 #1)) (define \"ThrowValue\" (mapEntry \"Throw\" (count Pips))) (game \"Pasit\" (players 4) (equipment { (\"PachisiBoard\" { (track \"Track1\" \"8,S,E,N,11,E,N,W,53,N,W,S,42,W,S,E,8,S,E1,N8\" P1 directed:True) (track \"Track2\" \"42,W,S,E,8,S,E,N,11,E,N,W,53,N,W,S,42,W,S1,E8\" P2 directed:True) (track \"Track3\" \"53,N,W,S,42,W,S,E,8,S,E,N,11,E,N,W,53,N,W1,S8\" P3 directed:True) (track \"Track4\" \"11,E,N,W,53,N,W,S,42,W,S,E,8,S,E,N,11,E,N1,W8\" P4 directed:True)}) (hand Each) (\"StickDice\" 6) (piece \"Pawn\" Each (if (\"IsOffBoard\" (\"SiteToMoveOnTrack\" from:(from) (\"ThrowValue\"))) (move (from (from) level:(level)) (to (centrePoint))) (move (from (from) level:(level)) (to (\"SiteToMoveOnTrack\" from:(from) (\"ThrowValue\")) if:True (apply (if (and (not (is In (to) (sites \"SafeSites\"))) (\"IsEnemyAt\" (to))) (forEach Level (to) FromTop (fromTo (from (to) level:(level)) (to (handSite (who at:(to) level:(level)))))))))))) (map \"Throw\" {(pair 0 6) (pair 1 10) (pair 2 2) (pair 3 3) (pair 4 5) (pair 5 25) (pair 6 12)}) (map \"Entry\" {(pair P1 8) (pair P2 42) (pair P3 53) (pair P4 11)}) (regions \"SafeSites\" (sites {63 65 15 47 84 86 38 3}))}) (rules (start { (place Stack \"Pawn1\" (handSite P1) count:4) (place Stack \"Pawn2\" (handSite P2) count:4) (place Stack \"Pawn3\" (handSite P3) count:4) (place Stack \"Pawn4\" (handSite P4) count:4)}) phases:{ (phase \"Opening\" (play (\"RollMove\" (if (\"IsSpecialThrow\") (move (from (handSite Mover)) (to (mapEntry \"Entry\" Mover))) (move Pass) (then (and (if (!= 1 (value Player Mover)) (moveAgain)) (set Value Mover (+ 1 (value Player Mover)))))))) (nextPhase Mover (= 2 (value Player Mover)) \"Moving\")) (phase \"Moving\" (play (\"RollMove\" (or (if (and (is Occupied (handSite Mover)) (\"IsSpecialThrow\")) (move (from (handSite Mover)) (to (mapEntry \"Entry\" Mover)))) (forEach Piece)))))} (end (if (\"AllPiecesOnCentre\" Mover) (result Mover Win)))))\n\n###\n\n", "completion": "Four 3x8 rectangles, arranged in a cross-shaped board. the fourth square, counting from the outer corners, in the outer rows of each arm are marked. Four pieces per player. Six cowrie shells are used as dice. The value of the throws is as follows: one mouth up = 10; two mouths up = 2, three mouths up = 3; four mouths up = 5; five mouths up = 25; six mouths up = 12; all mouths down = 6. On the first turn, players get three throws, and enter a piece for every throw of 10 or 25. On the top left square in their arm. Players move their pieces around the board in an anti-clockwise direction. When a piece lands on a space occupied by an opponent's piece, the opponent's piece is removed from the board and must enter again. Pieces resting on marked squares are safe from being removed from the board. When a piece completes a circuit of the board. It moves toward the central row in the player's arm, and progresses up the central row into the large square in the center of the board. The player who moves all of their pieces into the center first wine. END" }, { "prompt": "Construct a Ludii game based on the following description\nSnipSnip is a 2-player strategy game\n It may be played: \n -- on a hex grid\n -- on a square grid\n -- on a square plus diagonal grid\n Goal: Largest Group (in Misere, the largest Group loses.)\n \n Definitions:\n A Group is a set of all the pieces that can be reached from any one of them by a series of steps, where a step means movement from one piece to another of the same color, next to it.\n \n Note: For the Diagonal-Linked Group options a step also include diagonals (double-steps that are not in the same grid direction).\n \n A site is a board intersection.\n \n 'Between' Variant:\n -- A Capture site is any site adjacent to two stones of opposite color in the same line (i.e. directly between them.)\n \n 'Diagonal' Variant:\n -- A Capture site is any site adjacent to each of two stones of opposite color, where those stones are not on the same grid-line.\n \n Play:\n Players take turn, starting on an empty board with White to play.\n \n On a turn\n 1) The mover places to an empty site that is not a Capture site.\n 2) Then, if possible, the mover removes one of the opponent's checkers from a Capture site that lies adjacent to the placement just made.\n \n In the case of Misere, the mover must take an additional turn after each capture.\n \n Otherwise, the next player becomes the mover.\n \n The game ends when no placement is possible.\nIn the case of a tie, the player who would have been next to place loses. Misere: Score one negative point for each stone in your largest group of adjacent stones Capture one of the opponent's stones on the 2 sites orthogonally between your stone and a diagonally adjacent opponent's stone. Board & size: Equiversi Hexhex with edges alternating 2 and 4\n\n###\n\n", "completion": "(define \"HighlightConnections\" (show Symbol \"Disc.svg\" Vertex (\"DiagonallyConnectedDomainsOf\" 2) fillColour:(colour 0 0 255 50) edgeColour:(colour 0 0 0 0) scale:1) (show Symbol \"Disc.svg\" Vertex (\"DiagonallyConnectedDomainsOf\" 1) fillColour:(colour 255 255 0 100) edgeColour:(colour 0 0 0 0) scale:1)) (define \"Tri78Bug\" (tri {7 8 7 10 6})) (define \"Tri57Bug\" (tri {5 7 5 8 5})) (define \"Tri56Bug\" (tri {5 6 5 7 5})) (define \"Tri46Bug\" (tri {4 6 4 7 4})) (define \"Misere\" -1) (define \"Sites2RemoveBetween\" (forEach of:(sites Distance (step (to if:(is Next (who at:(to))))) from:(last To) (exact 2)) (sites Between Orthogonal from:(last To) to:(site) cond:(is In (between) (sites Occupied by:#1))))) (define \"SitesAllowedBetween\" (difference (sites Empty) (sites (results from:(sites Occupied by:P1) to:(forEach of:(sites Distance Orthogonal from:(from) (exact 2)) (sites Between Orthogonal from:(from) to:(site) cond:(and (is In (site) (sites Occupied by:P2)) (is Empty (between))))) (to))))) (define \"Sites2RemoveDiagonal\" (sites (results from:(last To) to:(forEach of:(intersection \"SitesAtOmniDiagonal\" (sites Occupied by:#1)) (intersection { (sites Around (from) Orthogonal) (sites Around (site) Orthogonal) (sites Occupied by:#1)})) (to)))) (define \"SitesAllowedDiagonal\" (difference (sites Empty) (sites (results from:(sites Occupied by:P1) to:(forEach of:(intersection \"SitesAtOmniDiagonal\" (sites Occupied by:P2)) (intersection { (sites Around (from) Orthogonal) (sites Around (site) Orthogonal) (sites Empty)})) (to))))) (define \"SetPairScores\" (forEach Player (set Score (player (player)) (* #1 (/ (+ (results from:(sites Occupied by:(player (player))) to:(sites Around (from) Orthogonal if:(is In (to) (sites Occupied by:(player (player))))) 1)) 2))))) (define \"SetGroupScores\" (forEach Player (set Score (player (player)) (* #1 (max 0 (max (sizes Group Orthogonal of:(player)))))))) (define \"SetStoneScores\" (set Score P1 (* #1 (count Pieces P1)) (then (set Score P2 (* #1 (count Pieces P2)))))) (define \"SetDiagonalGroupScores\" (forEach Player (set Score (player (player)) (* #1 (max 0 (+ 1 (max (results from:(sites Occupied by:(player (player))) to:(from) (size Array (array (intersection (sites Distance Orthogonal (step Orthogonal (to if:(is In (to) (\"DiagonallyConnectedDomainsOf\" (player))))) from:(from) (min 0)) (sites Occupied by:(player (player)))))))))))))) (define \"DiagonallyConnectedDomainsOf\" (union (sites Occupied by:(player #1)) (sites (results from:(sites Occupied by:(player #1)) to:(intersection (sites Occupied by:(player #1)) \"SitesAtOmniDiagonal\") (regionSite (intersection (sites Around (from) Orthogonal) (sites Around (to) Orthogonal)) index:0))))) (define \"SitesAtOmniDiagonal\" (difference (difference (sites Around (sites Around (from) Orthogonal) Orthogonal) (sites (from) {{F} {F F}})) (from))) (game \"SnipSnip\" (players 2) (equipment { (board (tri {2 4 2 4 2}) use:Vertex) (piece \"Ball\" Each)}) (rules (start { (set Score Each 0)}) (play (if (= 1 (value Player Mover)) (move Remove (\"Sites2RemoveDiagonal\" Next) (then (and { (set Value Mover 0) (moveAgain)}))) (move Add (to (\"SitesAllowedDiagonal\")) (then (if (< 0 (count Pieces in:(\"Sites2RemoveDiagonal\" Next))) (set Value Mover 1 (then (moveAgain)))))) (then (\"SetGroupScores\" \"Misere\")))) (end { (if (and (no Moves Next) (= (score P1) (score P2))) (result Next Loss)) (if (and (no Moves Next) (!= (score P1) (score P2))) (byScore))}))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game is played with 4 players. -> The game is played with 4 players.\n(define \"NextHole\" (\"NextSiteOnTrack\" 1 from:(to) #1)) (define \"PiecesHandOwnedBy\" (+ (count in:(sites #1)) (count Cell at:(handSite #1)))) (define \"PiecesOwnedBy\" (+ (count in:(sites #1)) (count at:(mapEntry #1)))) (game \"Kpo\" (players 3) (equipment { (mancalaBoard 2 6 { (track \"TrackCCW\" \"1,E,N,W\" loop:True) (track \"TrackCW\" \"6,W,N,E\" loop:True)}) (piece \"Seed\" Shared) (regions P1 (sites {\"B1\" \"C1\" \"B2\" \"C2\"})) (regions P2 (sites {\"D1\" \"E1\" \"D2\" \"E2\"})) (regions P3 (sites {\"F1\" \"G1\" \"F2\" \"G2\"})) (hand Each)}) (rules (start (set Count 3 to:(sites Track))) (play (or (move Select (from (sites Mover) if:(> (count at:(from)) 0)) (then (sow \"TrackCCW\" apply:(if (and (or (= (count at:(to)) 2) (= (count at:(to)) 3)) (!= (count at:(\"NextHole\" \"TrackCCW\")) 0)) (fromTo (from (\"NextHole\" \"TrackCCW\")) (to (handSite Mover)) count:(count at:(\"NextHole\" \"TrackCCW\"))))))) (move Select (from (sites Mover) if:(> (count at:(from)) 0)) (then (sow \"TrackCW\" apply:(if (and (or (= (count at:(to)) 2) (= (count at:(to)) 3)) (!= (count at:(\"NextHole\" \"TrackCW\")) 0)) (fromTo (from (\"NextHole\" \"TrackCW\")) (to (handSite Mover)) count:(count at:(\"NextHole\" \"TrackCW\"))))))))) (end (if (or { (and (no Moves P1) (no Moves P2)) (and (no Moves P1) (no Moves P3)) (and (no Moves P2) (no Moves P3))}) (byScore { (score P1 (\"PiecesHandOwnedBy\" P1)) (score P2 (\"PiecesHandOwnedBy\" P2)) (score P3 (\"PiecesHandOwnedBy\" P3))})))))\n\n###\n\n", "completion": "(define \"NextHole\" (\"NextSiteOnTrack\" 1 from:(to) #1)) (define \"PiecesHandOwnedBy\" (+ (count in:(sites #1)) (count Cell at:(handSite #1)))) (define \"PiecesOwnedBy\" (+ (count in:(sites #1)) (count at:(mapEntry #1)))) (game \"Kpo\" (players 4) (equipment { (mancalaBoard 2 6 { (track \"TrackCCW\" \"1,E,N,W\" loop:True) (track \"TrackCW\" \"6,W,N,E\" loop:True)}) (piece \"Seed\" Shared) (regions P1 (sites {\"B1\" \"C1\" \"D1\"})) (regions P2 (sites {\"E1\" \"F1\" \"G1\"})) (regions P3 (sites {\"G2\" \"F2\" \"E2\"})) (regions P4 (sites {\"B2\" \"C2\" \"D2\"})) (hand Each)}) (rules (start (set Count 3 to:(sites Track))) (play (or (move Select (from (sites Mover) if:(> (count at:(from)) 0)) (then (sow \"TrackCCW\" apply:(if (and (or (= (count at:(to)) 2) (= (count at:(to)) 3)) (!= (count at:(\"NextHole\" \"TrackCCW\")) 0)) (fromTo (from (\"NextHole\" \"TrackCCW\")) (to (handSite Mover)) count:(count at:(\"NextHole\" \"TrackCCW\"))))))) (move Select (from (sites Mover) if:(> (count at:(from)) 0)) (then (sow \"TrackCW\" apply:(if (and (or (= (count at:(to)) 2) (= (count at:(to)) 3)) (!= (count at:(\"NextHole\" \"TrackCW\")) 0)) (fromTo (from (\"NextHole\" \"TrackCW\")) (to (handSite Mover)) count:(count at:(\"NextHole\" \"TrackCW\"))))))))) (end (if (or { (and {(no Moves P1) (no Moves P2) (no Moves P3)}) (and {(no Moves P1) (no Moves P3) (no Moves P4)}) (and {(no Moves P2) (no Moves P3) (no Moves P4)})}) (byScore { (score P1 (\"PiecesHandOwnedBy\" P1)) (score P2 (\"PiecesHandOwnedBy\" P2)) (score P3 (\"PiecesHandOwnedBy\" P3)) (score P4 (\"PiecesHandOwnedBy\" P4))}))))) END" }, { "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": "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": "Construct a Ludii game based on the following description\nThree buttons and three lights. The first button toggles the first light. The second button interchanges first and second lights. The third button interchanges the second and third lights. All lights initially off. The goal is to get them all on. The game terminates when all three lights are on or after 6 steps, whichever comes first. \n\n###\n\n", "completion": "(define \"SwapTwoLastLights\" (swap Pieces 4 5)) (define \"SwapTwoFirstLights\" (swap Pieces 3 4)) (define \"ToggleLight\" (set State at:3 (abs (- (state at:3) 1)))) (define \"SecondButton\" (= (last To) 1)) (define \"FirstButton\" (= (last To) 0)) (define \"LightOn\" (= 1 (state at:(site)))) (game \"Buttons And Lights\" (players 1) (equipment { (board (rectangle 2 3)) (piece \"Light\" Shared)}) (rules (start (place \"Light\" (sites Top))) (play (move Select (from (sites Bottom)) (then (if (\"FirstButton\") (\"ToggleLight\") (if (\"SecondButton\") (\"SwapTwoFirstLights\") (\"SwapTwoLastLights\")))))) (end { (if (all Sites (sites Top) if:(\"LightOn\")) (result Mover Win)) (if (= 4 (counter)) (result Mover Loss))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\n8x8. Each player begins with a complement of pieces, each with their own powers of movement as follows: King (x1): may move one space in any direction; Queen (x1): moves one space diagonally, may leap two spaces diagonally on its first move over any intervening pieces; Bishop (x2): moves diagonally two spaces, jumping over any intervening pieces; Knight (x2): moves orthogonally one space and then diagonally another space, jumping over any intervening pieces; Rook (x2): moves orthogonally any distance; Pawns (x8): move forward one space or diagonally forward one space to capture. Only the Rooks' and Queens' pawns may move forward two spaces for their first move. When a Pawn reaches the row on the opposite side of the board from which it began, it must move two spaces backward to the sixth row, then to the fourth, and then to the second, and then is promoted to Queen. It cannot jump over any pieces or taken a piece during these moves. A Pawn is immune from capture on the eight rank, but not on the others while making these promotion moves. Each player must move the Rooks' Pawns and Queens' Pawn in this way, as well as the jump of the Queen, in their first four moves. There is no castling. A piece is captured when an opponent's piece moves onto its space. The King is in check when it can be taken on the opponent's next turn; it must not remain in check at the end of the player's turn. When the king cannot move out of check, it is checkmated and the opponent wins. \n\n###\n\n", "completion": "(define \"SpecialStartingPawns\" (sites {\"A2\" \"D2\" \"H2\" \"A7\" \"H7\" \"E7\"})) (define \"CaptureForwardDiagonal\" (move Step (directions {FR FL}) (to if:(and (\"IsEnemyAt\" (to)) (if (not (is In (to) (sites Next \"Promotion\"))) True (!= (what at:(to)) (id \"Pawn\" Next)))) (apply (remove (to)))))) (define \"CaptureEnemyToPiece\" (apply (if (\"IsEnemyAt\" (to)) (remove (to))))) (game \"Welschschach\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (piece \"King_noCross\" (move Step (to if:(and (not (\"IsFriendAt\" (to))) (if (not (is In (to) (sites Next \"Promotion\"))) True (not (\"IsPieceAt\" \"Pawn\" Next (to))))) (\"CaptureEnemyToPiece\")))) (piece \"Queen\" (move Step Diagonal (to if:(and (not (\"IsFriendAt\" (to))) (if (not (is In (to) (sites Next \"Promotion\"))) True (!= (what at:(to)) (id \"Pawn\" Next)))) (\"CaptureEnemyToPiece\")))) (piece \"Bishop_noCross\" (move Hop Diagonal (between if:True) (to if:(and (not (\"IsFriendAt\" (to))) (if (not (is In (to) (sites Next \"Promotion\"))) True (!= (what at:(to)) (id \"Pawn\" Next)))) (\"CaptureEnemyToPiece\")))) (piece \"Knight\" (move Leap \"KnightWalk\" (to if:(and (not (\"IsFriendAt\" (to))) (if (not (is In (to) (sites Next \"Promotion\"))) True (!= (what at:(to)) (id \"Pawn\" Next)))) \"CaptureEnemyToPiece\"))) (piece \"Rook\" (move Slide Orthogonal (to if:(and (not (\"IsFriendAt\" (to))) (if (not (is In (to) (sites Next \"Promotion\"))) True (!= (what at:(to)) (id \"Pawn\" Next)))) \"CaptureEnemyToPiece\"))) (piece \"Pawn\" (if (= 0 (state at:(from))) (or \"StepForwardToEmpty\" \"CaptureForwardDiagonal\" (then (if (is In (last To) (sites Mover \"Promotion\")) (set State at:(last To) 1)))) (move Slide Backward (between (exact 2) if:(is Empty (between))) (to if:(is Empty (to))) (then (if (is In (last To) (sites Start (piece (what at:(last To))))) (promote (last To) (piece \"Queen\") Mover)))))) (regions \"Promotion\" P1 (sites Top)) (regions \"Promotion\" P2 (sites Bottom))}) (rules (start { (place \"Pawn1\" (sites Row 1)) (place \"Pawn2\" (sites Row 6)) (place \"Rook1\" {\"A1\" \"H1\"}) (place \"Knight1\" {\"B1\" \"G1\"}) (place \"Bishop_noCross1\" {\"C1\" \"F1\"}) (place \"Queen1\" coord:\"D1\") (place \"King_noCross1\" coord:\"E1\") (place \"Rook2\" {\"A8\" \"H8\"}) (place \"Knight2\" {\"B8\" \"G8\"}) (place \"Bishop_noCross2\" {\"C8\" \"F8\"}) (place \"Queen2\" coord:\"E8\") (place \"King_noCross2\" coord:\"D8\")}) phases:{ (phase \"Opening\" (play (or { (forEach Piece \"Queen\" (if (is In (from) (sites Start (piece (what at:(from))))) (move Hop Diagonal (between (exact 1) if:True) (to if:(and (not (\"IsFriendAt\" (to))) (if (not (is In (to) (sites Next \"Promotion\"))) True (!= (what at:(to)) (id \"Pawn\" Next)))) (\"CaptureEnemyToPiece\")))) Mover) (forEach Piece \"Pawn\" (if (is In (from) (intersection (\"SpecialStartingPawns\") (sites Start (piece (what at:(from)))))) (\"DoubleStepForwardToEmpty\")) Mover)})) (nextPhase (= 8 (count Moves)) \"Playing\")) (phase \"Playing\" (play (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King_noCross\" Mover)))))} (end (\"Checkmate\" \"King_noCross\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\nWhite player takes a red piece and places a white piece on top of it, placing the stack before them. Black player takes a white piece and places a black piece on top of it, placing the stack before them. Red player takes a black piece and places a red piece on top of it, placing the stack before them. Starting with White, players take turns placing a piece of their colour on an empty space of the board until the victory condition is reached. The aim of the game is to create a 5-in-a-row containing both and only both colours of your stack. \n\n###\n\n", "completion": "(game \"Yavalade\" (players 3) (equipment { (board (rotate 90 (hex 5))) (piece \"Marker\" Each)}) (rules (play (move Add (to (sites Empty)))) (end { (if (is Line 5 whats:{1 3}) (result P1 Win)) (if (is Line 5 whats:{1 2}) (result P2 Win)) (if (is Line 5 whats:{2 3}) (result P3 Win))}))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game is played on a 2x2 board -> The game is played on a 3x3 board\n(game \"Three-Player Hex\" (players 3) (equipment { (board (hex 2)) (piece \"Marker\" Each) (regions P1 {(sites Side N) (sites Side S)}) (regions P2 {(sites Side NW) (sites Side SE)}) (regions P3 {(sites Side SW) (sites Side NE)})}) (rules (play (move Add (to (sites Empty)))) (end { (forEach NonMover if:(is Blocked Player) (result Player Loss)) (if (is Connected Mover) (result Mover Win))})))\n\n###\n\n", "completion": "(game \"Three-Player Hex\" (players 3) (equipment { (board (hex 3)) (piece \"Marker\" Each) (regions P1 {(sites Side N) (sites Side S)}) (regions P2 {(sites Side NW) (sites Side SE)}) (regions P3 {(sites Side SW) (sites Side NE)})}) (rules (play (move Add (to (sites Empty)))) (end { (forEach NonMover if:(is Blocked Player) (result Player Loss)) (if (is Connected Mover) (result Mover Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThree intersecting lines, with diagonals drawn in the square. Two players. Three pieces per player, one playing as red and the other as white. The red player plays first and places their piece in the central spot. Players alternate turns placing one of their pieces on an empty space on the board. When all of the pieces are placed, players alternate turns moving one of their pieces to an empty adjacent spot on the board along the lines. The first player to place three of their pieces in a row wins. \n\n###\n\n", "completion": "(game \"Katsela\" (players 2) (equipment { (\"AlquerqueBoard\" 3 3) (hand Each) (piece \"Marker\" Each (\"StepToEmpty\"))}) (rules (start (place \"Marker\" \"Hand\" count:3)) phases:{ (phase \"Opening\" (play (move (from (handSite Mover)) (to (centrePoint)))) (nextPhase \"Placing\")) (phase \"Placing\" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover (\"HandEmpty\" Mover) \"Moving\")) (phase \"Moving\" (play (forEach Piece)))} (end (\"Line3Win\")))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"Fanorona Telo\" (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\"))))\n\n###\n\n", "completion": "3x3 intersecting lines with diagonals. Play occurs on the intersections of the lines. Each player has three pieces. Play begins with each player placing pieces on empty points. If they make three in a row along the lines, they win. Once all pieces are placed, players take turns moving pieces one spot to an adjacent point along the lines trying to make three in a row.\n END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nA size 5 board is currently selected -> A size 6 board is currently selected\n(define \"PlaceNonRed\" (do (move Add (to (sites Empty))) ifAfterwards:(not (or (\"SomeSite\" (sites Around (last To) Enemy Orthogonal) (= 0 (count Liberties at:(site) Orthogonal if:(is Next (who at:(to)))))) (\"SomeSite\" (sites Around (last To) Own Orthogonal includeSelf:True) (= 0 (count Liberties at:(site) Orthogonal if:(is Mover (who at:(to)))))))))) (define \"PlaceRed\" (do (move Add (piece \"Disc0\") (to (sites Empty))) ifAfterwards:(or (\"SomeSite\" (sites Around (last To) Enemy Orthogonal) (= 0 (count Liberties at:(site) Orthogonal if:(is Next (who at:(to)))))) (\"SomeSite\" (sites Around (last To) Own Orthogonal) (= 0 (count Liberties at:(site) Orthogonal if:(is Mover (who at:(to))))))) (then (and (forEach Site (sites Around (last To) Enemy Orthogonal) (if (= 0 (count Liberties at:(site) Orthogonal if:(is Next (who at:(to))))) (remove (sites Group at:(site) Orthogonal if:(is Next (who at:(to))))))) (forEach Site (sites Around (last To) Own Orthogonal) (if (= 0 (count Liberties at:(site) Orthogonal if:(is Mover (who at:(to))))) (remove (sites Group at:(site) Orthogonal if:(is Mover (who at:(to))))))))))) (define \"SomeSite\" (not (all Sites #1 if:(not #2)))) (game \"Redstone\" (players 2) (equipment { (board (square 5) use:Vertex) (piece \"Disc\" Each) (piece \"Disc\" Neutral)}) (rules (meta (swap)) (play (or (\"PlaceRed\") (\"PlaceNonRed\"))) (end { (if (and (> (count Moves) 2) (no Pieces Next)) (result Next Loss)) (if (and {(> (count Moves) 2) (no Pieces Mover) (not (no Pieces Next))}) (result Mover Loss))})))\n\n###\n\n", "completion": "(define \"PlaceNonRed\" (do (move Add (to (sites Empty))) ifAfterwards:(not (or (\"SomeSite\" (sites Around (last To) Enemy Orthogonal) (= 0 (count Liberties at:(site) Orthogonal if:(is Next (who at:(to)))))) (\"SomeSite\" (sites Around (last To) Own Orthogonal includeSelf:True) (= 0 (count Liberties at:(site) Orthogonal if:(is Mover (who at:(to)))))))))) (define \"PlaceRed\" (do (move Add (piece \"Disc0\") (to (sites Empty))) ifAfterwards:(or (\"SomeSite\" (sites Around (last To) Enemy Orthogonal) (= 0 (count Liberties at:(site) Orthogonal if:(is Next (who at:(to)))))) (\"SomeSite\" (sites Around (last To) Own Orthogonal) (= 0 (count Liberties at:(site) Orthogonal if:(is Mover (who at:(to))))))) (then (and (forEach Site (sites Around (last To) Enemy Orthogonal) (if (= 0 (count Liberties at:(site) Orthogonal if:(is Next (who at:(to))))) (remove (sites Group at:(site) Orthogonal if:(is Next (who at:(to))))))) (forEach Site (sites Around (last To) Own Orthogonal) (if (= 0 (count Liberties at:(site) Orthogonal if:(is Mover (who at:(to))))) (remove (sites Group at:(site) Orthogonal if:(is Mover (who at:(to))))))))))) (define \"SomeSite\" (not (all Sites #1 if:(not #2)))) (game \"Redstone\" (players 2) (equipment { (board (square 6) use:Vertex) (piece \"Disc\" Each) (piece \"Disc\" Neutral)}) (rules (meta (swap)) (play (or (\"PlaceRed\") (\"PlaceNonRed\"))) (end { (if (and (> (count Moves) 2) (no Pieces Next)) (result Next Loss)) (if (and {(> (count Moves) 2) (no Pieces Mover) (not (no Pieces Next))}) (result Mover Loss))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayed on a board with twelve points on either side. The points form a continuous track in a horseshoe shape; each player progresses in opposite directions (one from their bottom right to the top right, the other from their bottom left to their top left. Each player has 15 pieces. Each player's pieces begin in three stacks of five on the first point of their track. 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. If a player places all of their pieces on all of the points on the final six points of their side of the board, with three on each of the final three points, they win two points. Otherwise, they move into the opposite side of the board. When an opponent's piece lands on a point occupied by one of the player's pieces on the opponent's side of the board, the piece is removed from the board and must enter again. A player's pieces cannot be hit on their own side of the board. Once a player has brought all of their pieces into the final six points of the board, they may begin to bear off. They can do so by rolling a 6 to move from the 6th point, and so on down to 1. Players must use all available moves presented by the dice. The first player to remove all of their pieces wins.\n \n\n###\n\n", "completion": "(define \"SpecialWin\" (if (is Mover P1) (and { (= 15 (count Pieces Mover in:(sites {0..5}))) (\"IsFriendAt\" 3) (\"IsFriendAt\" 4) (\"IsFriendAt\" 5) (= 3 (size Stack at:0)) (= 3 (size Stack at:1)) (= 3 (size Stack at:2))}) (and { (= 15 (count Pieces Mover in:(sites {13..18}))) (\"IsFriendAt\" 16) (\"IsFriendAt\" 17) (\"IsFriendAt\" 18) (= 3 (size Stack at:13)) (= 3 (size Stack at:14)) (= 3 (size Stack at:15))}))) (define \"AllPiecesInFinalQuadrant\" (\"AllOwnedPiecesIn\" (sites Mover \"FinalQuadrant\"))) (define \"NotEnemyOrOnlyOne\" (or (and { (\"IsEnemyAt\" (to)) (not (is In (to) (sites Mover \"OppositeSide\"))) (\"IsEmptyOrSingletonStack\" (to))}) (not (\"IsEnemyAt\" (to))))) (define \"NextSiteFrom\" (\"NextSiteOnTrack\" #2 from:#1)) (game \"Schuster\" (players 2) (equipment { (\"BackgammonBoard\" (\"BackgammonTracksWithBar\" End)) (dice d:6 num:2) (piece \"Disc\" Each (forEach Die if:(\"DieNotUsed\") (if (\"IsEndTrack\" (\"NextSiteFrom\" (from) (pips))) (if (\"AllPiecesInFinalQuadrant\") (move Remove (from))) (move (from (from)) (to (\"NextSiteFrom\" (from) (pips)) if:(\"NotEnemyOrOnlyOne\") (\"HittingCapture\" (mapEntry \"Bar\" Next))))) (then (and (\"ReplayNotAllDiceUsed\") (if (\"SpecialWin\") (addScore Mover 2)))))) (regions \"FinalQuadrant\" P1 (sites {20..25})) (regions \"FinalQuadrant\" P2 (sites {7..12})) (regions \"OppositeSide\" P1 (sites {25..20 18..13})) (regions \"OppositeSide\" P2 (sites {0..5 7..12})) (map \"Bar\" {(pair P1 6) (pair P2 19)})}) (rules (start { (place Stack \"Disc1\" 12 count:15) (place Stack \"Disc2\" 25 count:15)}) (play (\"RollEachNewTurnMove\" (forEach Piece top:True))) (end { (if (\"SpecialWin\") (result Mover Win)) (\"EscapeWin\")}))) END" }, { "prompt": "Construct a Ludii game based on the following description\n3x6 board. Four counters per hole. Each player controls one row of holes and the half of the central row to their right. Sowing occurs from left ro right in the player's full row, right to left in their holes in the central row, then right to left in the opponent's full row, then left to right in the opponent's holes in the central row, at that point continuing into the player's full row again. When the final counter is sown into an occupied hole, the counters are picked up and sowing continues. When the final counter falls into an empty hole, the turn ends. At any point while the player sows, if a hole is made to contain four counters, these are captured, regardless of who the hole belongs to. When the final counter causes a capture, the turn ends. Play continues until a player has no counters in their holes. The opponent then captures the remaining counters. Players then redistribute their counters, four in each hole, starting from the leftmost hole in their row in the direction of play. The player with fewer counters distributes all of their counters on the board, even if they cannot place four in the final hole of the counting. The player with more counters then places four counters in the same number of holes as the other player, taking any remaining as their winnings. Play continues in this fashion until one player captures all of the counters. \n\n###\n\n", "completion": "(define \"LeftMostEmpty\" (trackSite FirstSite from:(mapEntry \"LeftMost\" Mover) if:(is Empty (to)))) (define \"NumCapturedPieces\" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (define \"OneHomeEmpty\" (or (all Sites (sites P1) if:(is Empty (site))) (all Sites (sites P2) if:(is Empty (site))))) (define \"Columns\" 6) (game \"Rab'e\" (players 2) (equipment { (mancalaBoard 3 \"Columns\" store:None (track \"Track\" \"0,E,N1,W2,17,W,S1,E2\" loop:True)) (piece \"Seed\" Shared) (regions P1 (union (sites Bottom) (difference (expand (sites Right) steps:2) (sites Top)))) (regions P2 (union (sites Top) (difference (expand (sites Left) steps:2) (sites Bottom)))) (hand Each) (map \"LeftMost\" {(pair P1 0) (pair P2 17)}) (map \"CorrespondingHoles\" { (pair 0 17) (pair 1 16) (pair 2 15) (pair 3 14) (pair 4 13) (pair 5 12) (pair 11 6) (pair 10 7) (pair 9 8) (pair 8 9) (pair 7 10) (pair 6 11) (pair 12 5) (pair 13 4) (pair 14 3) (pair 15 2) (pair 16 1) (pair 17 0)})}) (rules (start (set Count 4 to:(sites Track))) phases:{ (phase \"Sowing\" (play (or { (move Select (from (if (\"SameTurn\") (\"LastHoleSowed\") (sites Mover)) if:(< 0 (count at:(from)))) (then (do (set Var \"NumSowed\" (count at:(last To))) next:(sow apply:(if (and (!= 4 (count at:(to))) (< 1 (count at:(to)))) (moveAgain))) (then (and (forEach Site (sites Track from:(last From) to:(trackSite Move from:(last From) \"Track\" steps:(var \"NumSowed\"))) (if (= 4 (count at:(site))) (fromTo (from (site)) (to (handSite Mover)) count:4))) (set Var \"NumSowed\" 0))))))} (then (if (\"OneHomeEmpty\") (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)))) (if (<= (\"NumCapturedPieces\" P1) (\"NumCapturedPieces\" P2)) (set NextPlayer (player 1)) (set NextPlayer (player 2)))}))))) (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 (\"LeftMostEmpty\")) count:4 (then (if (<= 4 (count Cell at:(handSite Mover))) (moveAgain) (and (if (!= 0 (count Cell at:(handSite Mover))) (and (fromTo (from (handSite Mover)) (to (\"LeftMostEmpty\")) count:(count Cell at:(handSite Mover))) (fromTo (from (handSite Next)) (to (mapEntry \"CorrespondingHoles\" (\"LeftMostEmpty\"))) count:(count Cell at:(handSite Next))))) (forEach Site (sites Mover) (if (is Occupied (site)) (fromTo (from (handSite Next)) (to (mapEntry \"CorrespondingHoles\" (site))) count:(count at:(site))))))))))) (nextPhase (= 0 (count Cell at:(handSite Mover))) \"Sowing\"))})) END" }, { "prompt": "Construct a Ludii game based on the following description\nTo start the game, each of the squares on the checkerboard is occupied by a stone. White stones are placed on the white squares and black stones on the black squares. To move, the player must pick up one of his or her own stones and 'clobber' an opponent's stone on an adjacent square, either horizontally or vertically. Once the opponent's stone is clobbered, it must then be removed from the board and replaced by the stone that was moved. The player who, on their turn, is unable to move, loses the game. The board has 10 rows. The board has 10 columns. Pieces must step onto an enemy piece.\n\n###\n\n", "completion": "(game \"Clobber\" (players 2) (equipment { (board (rectangle 10 10)) (piece \"Marker\" Each (\"StepToEnemy\" Orthogonal))}) (rules (start { (place \"Marker1\" (sites Phase 1)) (place \"Marker2\" (sites Phase 0))}) (play (forEach Piece)) (end (\"NoMoves\" Loss)))) END" }, { "prompt": "Construct a Ludii game based on the following description\n86 spaces in a spiral track. Any number of players, each having one piece, which starts on the first space in the outer ring of the spiral. A lump of charcoal, the Ghoula, also is placed on this space. Four sticks, with one green side and one white side, used as dice. The throws are as follows: One white side up = 1, this throw is known as \\ The game has 4 players.\n\n###\n\n", "completion": "(define \"MoveGhoula\" (if (\"IsSingletonStack\" (\"WhereGhoula\")) (move (from (\"WhereGhoula\") level:(where Level \"Ghoula\" Neutral at:(\"WhereGhoula\"))) (to (\"GhoulaOnTrack\" \"GhoulaTrack\" 1))) (move (from (\"WhereGhoula\") level:(where Level \"Ghoula\" Neutral at:(\"WhereGhoula\"))) (to (\"GhoulaOnTrack\" \"ReverseGhoulaTrack\" 1)) (then (if (= (last From) (\"KillingSite\")) (forEach Level (last From) FromTop (remove (last From) level:(level))) (forEach Level (last From) FromTop (fromTo (from (last From) level:(level)) (to (last To))))))) (then (if (\"GhoulaPhaseDone\") (set Var 0) (and (if (> (var) 1) (moveAgain)) (set Var (- (var) 1))))))) (define \"WhereGhoula\" (if (\"IsNotOffBoard\" (where \"Ghoula\" Neutral)) (where \"Ghoula\" Neutral) (handSite P1))) (define \"GhoulaPhaseDone\" (and (\"IsSingletonStack\" (\"WhereGhoula\")) (= (\"EndTrack\") (\"WhereGhoula\")))) (define \"IsSpecialThrow\" (is In (\"ThrowValue\") (sites {1 6 4}))) (define \"GhoulaOnTrack\" (\"NextSiteOnTrack\" #2 from:(\"WhereGhoula\") #1)) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" #2 #1)) (define \"Sig\" (= (\"ThrowValue\") 1)) (define \"ThrowValue\" (mapEntry \"Throw\" (count Pips))) (define \"BeginningExtensionTrack\" 4) (define \"EndTrack\" 5) (define \"Central\" 0) (define \"KillingSite\" 84) (define \"ExternalSite\" 86) (game \"Sig wa Duqqan (Houmt Taourit)\" (players 4) (equipment { (board (spiral turns:5 sites:86) { (track \"Track\" {85..5} directed:True) (track \"ExtensionTrack\" {4..0} directed:True) (track \"GhoulaTrack\" {86..5} directed:True) (track \"ReverseGhoulaTrack\" {5..85} directed:True)} use:Vertex) (\"StickDice\" 4) (map \"Throw\" {(pair 0 4) (pair 1 3) (pair 2 0) (pair 3 1) (pair 4 6)}) (piece \"Stick\" Each (if (= (from) (\"EndTrack\")) (if (= (state at:(from) level:(level)) 7) (move (from (from) level:(level)) (to (\"BeginningExtensionTrack\"))) (if (\"Sig\") (move Select (from (from) level:(level)) (then (set State at:(last To) level:(last LevelTo) (+ 1 (state at:(last To) level:(last LevelTo)))))))) (if (is In (from) (sites Track \"Track\")) (move (from (from) level:(level)) (to (\"SiteToMoveOnTrack\" \"Track\" (\"ThrowValue\")) if:True)) (if (is In (from) (sites Track \"ExtensionTrack\")) (or { (if (and (!= (from) (\"Central\")) (\"Sig\")) (move (from (from) level:(level)) (to (\"SiteToMoveOnTrack\" \"ExtensionTrack\" 1)))) (if (= (from) (\"Central\")) (move Pass (then (and (if (= 0 (\"ThrowValue\")) (set Var 6) (set Var (\"ThrowValue\"))) (moveAgain)))) (if (= 3 (\"ThrowValue\")) (move Pass (then (and (set Var 3) (moveAgain))))))})))) maxState:7) (piece \"Ghoula\" Neutral) (hand P1 size:1)}) (rules (start { (place Stack \"Ghoula0\" (\"ExternalSite\")) (place Stack items:{\"Stick4\" \"Stick3\" \"Stick2\" \"Stick1\"} 85)}) (play (do (if (<= (var) 0) (roll)) next:(if (> (var) 0) (\"MoveGhoula\") (if (!= 0 (\"ThrowValue\")) (forEach Piece))) (then (if (\"IsSpecialThrow\") (moveAgain))))) (end { (forEach Player if:(no Pieces Player) (result Player Loss)) (forEach Player if:(\"GhoulaPhaseDone\") (result Player Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\n= 1 (count at:(site))))) (define \"NextHole\" (\"NextSiteOnTrack\" #2 from:#1 \"Track\")) (define \"NoPiece\" (all Sites (sites Player \"Home\") if:(= 0 (count at:(site))))) (define \"Columns\" 10) (game \"Nsolo\" (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))) (piece \"Seed\" Shared)}) (rules (start (set Count 2 to:(union { (sites Bottom) (sites Top) (difference (sites P1 \"Inner\") (sites Right)) (difference (sites P2 \"Inner\") (sites Left))}))) (play (if (and (\"SameTurn\") (= (var \"Replay\") Undefined)) (move Remove (sites Next \"Home\")) (if (\"AllSitesNoMoreThanOne\") (move Select (from (sites Mover \"Home\") if:(and (is Occupied (from)) (is Empty (\"NextHole\" (from) 1)))) (then (sow \"Track\" owner:(mover)))) (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (sites Mover \"Home\")) if:(> (count at:(from)) 1)) (then (sow \"Track\" owner:(mover) apply:(if (< 1 (count at:(to))) (if (and (is In (to) (sites Mover \"Inner\")) (is Occupied (\"OppositePit\" (to)))) (and (remove (\"OppositePit\" (to))) (if (is Occupied (\"OppositeOuterPit\" (to))) (and { (moveAgain) (set Var \"Replay\" Undefined) (remove (\"OppositeOuterPit\" (to)))}))) (and (moveAgain) (set Var \"Replay\" (to))))))))))) (end (forEach NonMover if:(\"NoPiece\") (result Player Loss))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"Greatest Loss\" (players 2) (equipment { (board (square 4)) (piece \"Disc\" Each)}) (rules (start { (place \"Disc1\" {\"A1\"} state:1) (place \"Disc1\" {\"B1\"} state:2) (place \"Disc1\" {\"C1\"} state:3) (place \"Disc1\" {\"D1\"} state:4) (place \"Disc1\" {\"A2\"} state:5) (place \"Disc1\" {\"B2\"} state:6) (place \"Disc1\" {\"C2\"} state:7) (place \"Disc1\" {\"D2\"} state:8) (place \"Disc2\" {\"A4\"} state:1) (place \"Disc2\" {\"B4\"} state:2) (place \"Disc2\" {\"C4\"} state:3) (place \"Disc2\" {\"D4\"} state:4) (place \"Disc2\" {\"A3\"} state:5) (place \"Disc2\" {\"B3\"} state:6) (place \"Disc2\" {\"C3\"} state:7) (place \"Disc2\" {\"D3\"} state:8)}) (play (move Select (from (sites Occupied by:Mover)) (then (remove (last To))))) (end (if (= 0 (count Sites in:(forEach (sites Occupied by:Mover) if:(= 8 (state at:(site)))))) (result Mover Loss)))))\n\n###\n\n", "completion": "Players take turns removing a piece of their colour (the mover must remove a piece each turn). The player who removes their highest numbered piece loses the game. 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\n3x12-28 board. Players begin with soldiers, equal in number to the number of spaces in one row for each player, which begin in the spaces in the row closes to the player. Each player has one king piece, which begins in the rightmost space in the central row with respect to the player. Four six-sided dice with values from 1-6. A throw of 1 is called Chong. Pieces move in a boustrophedon path along the board, from left to right in their home row, right to left in the center row, and then left to right in their opponent's row. \n \n A player must first throw a Chong to play. On this turn, when a player throws one Chong, the King exchanges places with the soldier behind it. If more than one Chong is thrown, the King exchanges places with the soldier that many spaces behind it. Any remaining values in the throw are moved by the soldier which took the king's space. Once this move has taken place, pieces move according to the throws of the dice, which can be subdivided between the pieces as the player sees fit. The King only moves with a Chong, and it exchanges the place of a piece that number of occupied squares away, i.e., only spaces occupied by the player's pieces are counted when moving the King. When the player has only one soldier and the King, the King may move normally (like a soldier does), but on throws of Chong. When only the King is left, the first Chong in a throw is ignored and only the second, third, or fourth Chongs are moved. \n \n When a player's piece lands on a space occupied by an opponent's piece, the opponent's piece is captured. An opponent's King cannot be taken by a soldier until it has first moved backwards, and then it can only be taken by a Chong.\n \n The game continues after the players' Kings have been taken.\n \n When a player reaches the end of the opponent's home line, the player wins. The game is played on a 3x12 board.\n\n###\n\n", "completion": "(define \"CaptureEnemyPiece\" (apply if:(\"IsEnemyAt\" (to)) (remove (to)))) (define \"NumDiceAtOne\" (+ { (if (= 1 (face (+ 0 (count Sites in:(sites Board))))) 1 0) (if (= 1 (face (+ 1 (count Sites in:(sites Board))))) 1 0) (if (= 1 (face (+ 2 (count Sites in:(sites Board))))) 1 0) (if (= 1 (face (+ 3 (count Sites in:(sites Board))))) 1 0)})) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" #2 #1)) (define \"SumPips\" (count Pips)) (game \"Chong (Sakhalin)\" (players 2) (equipment { (board (rectangle 3 12) { (track \"Track1\" \"0,E,N1,W,N1,E\" P1 directed:True) (track \"Track2\" \"35,W,S1,E,S1,W\" P2 directed:True)}) (dice d:6 num:4) (piece \"Marker\" Each (move (from) (to (\"SiteToMoveOnTrack\" from:(from) (pips)) if:(or { (is Empty (to)) (and (\"IsEnemyAt\" (to)) (if (not (\"IsPieceAt\" \"King\" Next (to))) True (= 1 (abs (- (to) (from))))))}) (\"CaptureEnemyPiece\")))) (piece \"King\" Each (if (= 1 (pips)) (if (<= 2 (count Pieces Mover)) (if (and (!= 1 (value Player Mover)) (= 1 (count Pieces Mover))) (move (from (from)) (to (from)) (then (set Value Mover 1))) (move (from) (to (\"SiteToMoveOnTrack\" from:(from) (pips)) if:(or { (is Empty (to)) (and (\"IsEnemyAt\" (to)) (if (not (\"IsPieceAt\" \"King\" Next (to))) True (= 1 (abs (- (to) (from))))))}) (\"CaptureEnemyPiece\")))) (firstMoveOnTrack \"Track\" Mover (if (and (> (site) (from)) (is Mover (who at:(site)))) (move Swap Pieces (from) (site)))))))}) (rules (start { (place \"Marker1\" (sites Bottom)) (place \"King1\" 23) (place \"Marker2\" (sites Top)) (place \"King2\" 12)}) phases:{ (phase \"Opening\" (play (\"RollMove\" (if (!= 0 (\"NumDiceAtOne\")) (if (is Mover P1) (if (is Mover (who at:(- (where \"King\" Mover) (+ (- (count Sites in:(sites Bottom)) 1) (\"NumDiceAtOne\"))))) (move Swap Pieces (where \"King\" Mover) (- (where \"King\" Mover) (+ (- (count Sites in:(sites Bottom)) 1) (\"NumDiceAtOne\"))))) (if (is Mover (who at:(+ (where \"King\" Mover) (+ (- (count Sites in:(sites Bottom)) 1) (\"NumDiceAtOne\"))))) (move Swap Pieces (where \"King\" Mover) (+ (where \"King\" Mover) (+ (- (count Sites in:(sites Bottom)) 1) (\"NumDiceAtOne\"))))) (then (fromTo (from (last From)) (to (\"SiteToMoveOnTrack\" from:(last From) (- (\"SumPips\") (\"NumDiceAtOne\"))) (\"CaptureEnemyPiece\")))))))) (nextPhase Mover (not (was Pass)) \"Playing\")) (phase \"Playing\" (play (\"RollEachNewTurnMove\" (forEach Die if:(\"DieNotUsed\") (forEach Piece) (then (\"ReplayNotAllDiceUsed\"))))))} (end { (if (= (who at:0) P2) (result P2 Win)) (if (= (who at:(- (count Sites in:(sites Board)) 1)) P1) (result P1 Win))}))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"Snort\" (players 2) (equipment { (board (square 8)) (piece \"Cat\" P1) (piece \"Dog\" P2)}) (rules (play (move Add (to (difference (sites Empty) (sites Around (sites Occupied by:Next) Orthogonal))))) (end (if (no Moves Next) (result P1 Win)))))\n\n###\n\n", "completion": "Two players, black and white, take turns dropping pieces onto empty squares (that are not orthogonally adjacent to another enemy's piece) until no more moves are available. The last player to make a move wins the game. 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 Ludii game based on the following description\nIn Seesaw Draughts, when a man reaches the rank farthest away in its stepping direction, its capture range is increased, and it changes the direction it steps in. It can thereby promote again if it reaches the opposite rank.\n \n The mechanism is implemented like this: All men are stacks. Single pieces are stacks of size 1. Every time a man promotes a piece is added to it, so its stack size increases by 1. The following two-fold meaning of stack size is the key idea:\n 1) Odd stacks step forwards and even stacks step backwards.\n 2) A stack of size n can capture a piece up to n steps away in a straight line provided that there are no pieces between the capturing piece and its target, and that the square immediately behind the target in the capture direction is empty. The capturing piece must land there.\n \n Thus, the men gradually acquire the capturing power of a king in Thai Checkers as they seesaw up and down the board.\n \n There is no obligation to choose the capture sequence that maximizes the number of pieces captured. We deem this calculation a bit too demanding when a stack's range is a function of its size.\n \nOther than this, the rules are as in Brazilian Draughts/Checkers, which is like International Draughts, but on 8x8. \n\n###\n\n", "completion": "(define \"Promote\" (if (\"Promotes\" #1) (add (to #1) stack:True))) (define \"Promotes\" (or (and (is Odd (size Stack at:#1)) (is In #1 (sites (player (+ 1 (% (mover) 2)))))) (and (is Even (size Stack at:#1)) (is In #1 (sites (player (mover))))))) (define \"ConditionalDirection\" (if (is Odd (size Stack at:(from))) (directions {FL FR}) (directions {BL BR}))) (define \"HoppedPiece\" (+ (array (intersection (sites Occupied by:Enemy) (sites Between from:(from) to:(to)))))) (define \"CanCaptureFrom\" (can Move (move (from #1) (to (sites Direction from:(from) (difference Diagonal (directions Cell from:(last To) to:(last From))) distance:(+ 1 (size Stack at:(from)))) if:(and { (is Empty (to)) (= 1 (count Sites in:(intersection (sites Occupied by:Enemy) (sites Between from:(from) to:(to))))) (= 0 (count Sites in:(intersection (sites Occupied by:Mover) (sites Between from:(from) to:(to))))) (= 1 (count Steps (to) (\"HoppedPiece\"))) (not (is In (\"HoppedPiece\") (values Remembered)))}))))) (define \"Capture\" (move (from if:(= (* (from) (if (< 0 (count MovesThisTurn)) 1 0)) (* (last To) (if (< 0 (count MovesThisTurn)) 1 0)))) (to (sites Direction from:(from) Diagonal distance:(+ 1 (size Stack at:(from)))) if:(and { (is Empty (to)) (= 1 (count Sites in:(intersection (sites Occupied by:Enemy) (sites Between from:(from) to:(to))))) (= 0 (count Sites in:(intersection (sites Occupied by:Mover) (sites Between from:(from) to:(to))))) (= 1 (count Steps (to) (\"HoppedPiece\"))) (not (is In (\"HoppedPiece\") (values Remembered)))}) (apply (remember Value (\"HoppedPiece\")))) count:(size Stack at:(from)) stack:True (then (if (\"CanCaptureFrom\" (last To)) (moveAgain) (do (forEach Site (sites (values Remembered)) (remove (site) count:(size Stack at:(site)))) next:(and (\"Promote\" (last To)) (forget Value All))))))) (define \"Step\" (move Step (from) (\"ConditionalDirection\") (to if:(is Empty (to))) stack:True (then (\"Promote\" (last To))))) (game \"Seesaw Draughts\" (players 2) (equipment { (board (square 8)) (piece \"Disc\" P1 N) (piece \"Disc\" P2 S) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start { (place \"Disc1\" (difference (expand (sites Bottom) steps:2) (sites Phase 1))) (place \"Disc2\" (difference (expand (sites Top) steps:2) (sites Phase 1)))}) (play (priority (forEach Piece \"Disc\" (\"Capture\") top:True) (forEach Piece \"Disc\" (\"Step\") top:True))) (end (\"NoMoves\" Loss)))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe First player moves only when all the pieces are placed. The game has an ending condition for each player. -> The First player can move after placing his piece.\n(game \"Hyvn aetter Hare\" (players 2) (equipment { (board (splitCrossings (merge (shift .5 .5 (scale 0.707 (concentric {1 8}))) (square 2))) use:Vertex) (piece \"Hare\" P1 \"StepToEmpty\") (piece \"Dog\" P2 \"StepToEmpty\") (hand Each)}) (rules (start { (place \"Hare1\" (handSite P1) count:1) (place \"Dog2\" (handSite P2) count:3)}) phases:{ (phase \"Placement\" (play (if (\"HandOccupied\" Mover) (move (from (handSite Mover)) (to (sites Empty))))) (nextPhase (\"HandEmpty\" P2) \"Movement\")) (\"PhaseMovePiece\" \"Movement\" (end { (\"NoMoves\" Loss) (if (or (>= (count Moves) (- (value MoveLimit) 10)) (>= (count Turns) (- (value TurnLimit) 5))) (result P1 Win))}))}))\n\n###\n\n", "completion": "(game \"Hyvn aetter Hare\" (players 2) (equipment { (board (splitCrossings (merge (shift .5 .5 (scale 0.707 (concentric {1 8}))) (square 2))) use:Vertex) (piece \"Hare\" P1 \"StepToEmpty\") (piece \"Dog\" P2 \"StepToEmpty\") (hand Each)}) (rules (start { (place \"Hare1\" (handSite P1) count:1) (place \"Dog2\" (handSite P2) count:3)}) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (\"PhaseMovePiece\" \"Movement\")} (end (\"NoMoves\" Loss)))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game is played on a 7x7 board. -> The game is played on a 9x9 board.\nLook and feel: Black&White -> Look and feel: Garden\n(define \"FromEdgeToEdge\" (and ( ( (is In (site) (sites #1))) ( (= 0 (count Pieces All in:(sites LineOfSight at:(site) #2))))))) (define \"DroppableFromDirection\" (and ( (= 0 (count Pieces All in:(sites LineOfSight at:(site) #1))) (= 1 (count Pieces in:(sites Around (site) #2)))))) (game \"Centrifugal Force\" (players 2) (equipment { (board (square 7)) (piece \"Cross\" P1) (piece \"Disc\" P2) (piece \"Square\" Neutral)}) (rules (start { (place \"Square0\" coord:\"A1\") (place \"Square0\" coord:\"G1\") (place \"Square0\" coord:\"G7\") (place \"Square0\" coord:\"A7\")}) (play (move Add (to (forEach (sites Empty) if: (or ( (or { (\"FromEdgeToEdge\" Top S) (\"FromEdgeToEdge\" Bottom N) (\"FromEdgeToEdge\" Left E) (\"FromEdgeToEdge\" Right W)}) (or { (\"DroppableFromDirection\" N S) (\"DroppableFromDirection\" S N) (\"DroppableFromDirection\" W E) (\"DroppableFromDirection\" E W)}))))))) (end { (if (is Line 5) (result Mover Win)) (if (no Moves Next) (result All Draw))})))\n\n###\n\n", "completion": "(define \"FromEdgeToEdge\" (and ( ( (is In (site) (sites #1))) ( (= 0 (count Pieces All in:(sites LineOfSight at:(site) #2))))))) (define \"DroppableFromDirection\" (and ( (= 0 (count Pieces All in:(sites LineOfSight at:(site) #1))) (= 1 (count Pieces in:(sites Around (site) #2)))))) (game \"Centrifugal Force\" (players 2) (equipment { (board (square 9)) (piece \"Cross\" P1) (piece \"Disc\" P2) (piece \"Square\" Neutral)}) (rules (start { (place \"Square0\" coord:\"A1\") (place \"Square0\" coord:\"I1\") (place \"Square0\" coord:\"I9\") (place \"Square0\" coord:\"A9\")}) (play (move Add (to (forEach (sites Empty) if: (or ( (or { (\"FromEdgeToEdge\" Top S) (\"FromEdgeToEdge\" Bottom N) (\"FromEdgeToEdge\" Left E) (\"FromEdgeToEdge\" Right W)}) (or { (\"DroppableFromDirection\" N S) (\"DroppableFromDirection\" S N) (\"DroppableFromDirection\" W E) (\"DroppableFromDirection\" E W)}))))))) (end { (if (is Line 5) (result Mover Win)) (if (no Moves Next) (result All Draw))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nUltimate Chess is a variant of Chess played on a 9x9 Sudoku checkerboard as shown, with same rules as Chess except:\n - Pawns can move 2 or 3 steps forward in their first move. The pawn can be captured by En Passant if they do a such move.\n - Kings can make a large casting in either side.\n - The next player must move from the sub-grid corresponding to the cell just moved to (if they have a legal move from there). \n\n###\n\n", "completion": "(define \"RightSection\" (and { (<= (column of:(from)) (\"MaxColumn\")) (>= (column of:(from)) (\"MinColumn\")) (<= (row of:(from)) (\"MaxRow\")) (>= (row of:(from)) (\"MinRow\"))})) (define \"MaxColumn\" (+ (\"MinColumn\") 2)) (define \"MinColumn\" (* \"ColumnSquareSection\" 3)) (define \"ColumnSquareSection\" (% (column of:(last To)) 3)) (define \"MaxRow\" (+ (\"MinRow\") 2)) (define \"MinRow\" (* \"RowSquareSection\" 3)) (define \"RowSquareSection\" (% (row of:(last To)) 3)) (define \"QueenMove\" (\"SlideCapture\" ~ ~ (then (set Counter)))) (define \"KnightMove\" (\"LeapCapture\" \"KnightWalk\" (then (set Counter)))) (define \"BishopMove\" (\"SlideCapture\" ~ Diagonal (then (set Counter)))) (define \"KingMove\" (move Step (to if:(not (\"IsFriendAt\" (to))) (apply (if (\"IsEnemyAt\" (to)) (remove (to) (then (set Counter)))))) \"RememberPieceHasMoved\")) (define \"RookMove\" (\"SlideCapture\" ~ Orthogonal (then (set Counter)) \"RememberPieceHasMoved\")) (define \"PawnMove\" (or { (if (is In (from) (sites Start (piece (what at:(from))))) \"InitialPawnMove\") \"StepForwardToEmpty\" (\"StepToEnemy\" (directions {FR FL})) \"EnPassant\"} (then (and (\"ReplayInMovingOn\" (sites Mover \"Promotion\")) (set Counter))))) (define \"EnPassant\" (move Step (directions {FR FL}) (to if:\"InLocationEnPassant\") (then (remove (\"LastPawnMoved\"))))) (define \"LastPawnMoved\" (var)) (define \"InLocationEnPassant\" (is In (to) (sites Pending))) (define \"InitialPawnMove\" (forEach Value min:2 max:3 (move Slide Forward (between (exact (value)) if:(is Empty (between)) (apply (set Pending (between)))) (to if:(is Empty (to))) \"SetEnPassantLocation\"))) (define \"SetEnPassantLocation\" (then (set Var (last To)))) (define \"LeftCastling\" (\"DoCastle\" \"King\" W 2 \"KingNotCheckedAndToEmpty\" (then (and (\"PieceHasMoved\") (\"DoCastle\" \"RookLeft\" E 3 True))))) (define \"RightCastling\" (\"DoCastle\" \"King\" E 2 \"KingNotCheckedAndToEmpty\" (then (and (\"PieceHasMoved\") (\"DoCastle\" \"RookRight\" W 3 True))))) (define \"DoCastle\" (move Slide (from (mapEntry #1 (mover))) #2 (between (exact #3) if:#4) #5)) (define \"KingNotCheckedAndToEmpty\" (and (is Empty (to)) (not (\"IsInCheck\" \"King\" Mover at:(to))))) (define \"RememberPieceHasMoved\" (then (if (= (state at:(last To)) 1) \"PieceHasMoved\"))) (define \"PieceHasMoved\" (set State at:(last To) 0)) (define \"HasNeverMoved\" (= (state at:(mapEntry #1 (mover))) 1)) (define \"KingInTheInitialPlace\" (= (what at:(mapEntry \"King\" (mover))) (id \"King\" Mover))) (game \"Ultimate Chess\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 9)) (piece \"Pawn\" Each (\"PawnMove\")) (\"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 \"E9\")}) (map \"RookLeft\" {(pair 1 \"A1\") (pair 2 \"A9\")}) (map \"RookRight\" {(pair 1 \"I1\") (pair 2 \"I9\")}) (regions \"Promotion\" P1 (sites Top)) (regions \"Promotion\" P2 (sites Bottom))}) (rules (start { (place \"Pawn1\" (sites Row 1)) (place \"Pawn2\" (sites Row 7)) (place \"Rook1\" {\"A1\" \"I1\"} state:1) (place \"Knight1\" {\"B1\" \"H1\"}) (place \"Bishop1\" {\"C1\" \"G1\"}) (place \"Queen1\" {\"D1\" \"F1\"}) (place \"King1\" coord:\"E1\" state:1) (place \"Rook2\" {\"A9\" \"I9\"} state:1) (place \"Knight2\" {\"B9\" \"H9\"}) (place \"Bishop2\" {\"C9\" \"G9\"}) (place \"Queen2\" {\"D9\" \"F9\"}) (place \"King2\" coord:\"E9\" state:1)}) (play (if \"SameTurn\" (move Promote (last To) (piece {\"Queen\" \"Knight\" \"Bishop\" \"Rook\"}) Mover) (priority { (if (!= 0 (count Moves)) (do (or { (forEach Piece \"Queen\" (if (\"RightSection\") (\"QueenMove\"))) (forEach Piece \"Knight\" (if (\"RightSection\") (\"KnightMove\"))) (forEach Piece \"Bishop\" (if (\"RightSection\") (\"BishopMove\"))) (forEach Piece \"King\" (if (\"RightSection\") (\"KingMove\"))) (forEach Piece \"Rook\" (if (\"RightSection\") (\"RookMove\"))) (forEach Piece \"Pawn\" (if (\"RightSection\") (\"PawnMove\"))) (if (and (= \"RowSquareSection\" 0) (= \"ColumnSquareSection\" 1)) (if (and { \"KingInTheInitialPlace\" (\"HasNeverMoved\" \"King\") (not (\"IsInCheck\" \"King\" Mover))}) (or (if (and (\"HasNeverMoved\" \"RookLeft\") (can Move (\"DoCastle\" \"RookLeft\" E 3 (is Empty (to))))) \"LeftCastling\") (if (and (\"HasNeverMoved\" \"RookRight\") (can Move (\"DoCastle\" \"RookRight\" W 2 (is Empty (to))))) \"RightCastling\"))))}) ifAfterwards:(not (\"IsInCheck\" \"King\" Mover (forEach Piece))))) (do (or (forEach Piece) (if (and { \"KingInTheInitialPlace\" (\"HasNeverMoved\" \"King\") (not (\"IsInCheck\" \"King\" Mover))}) (or (if (and (\"HasNeverMoved\" \"RookLeft\") (can Move (\"DoCastle\" \"RookLeft\" E 3 (is Empty (to))))) \"LeftCastling\") (if (and (\"HasNeverMoved\" \"RookRight\") (can Move (\"DoCastle\" \"RookRight\" W 3 (is Empty (to))))) \"RightCastling\")))) ifAfterwards:(not (\"IsInCheck\" \"King\" Mover)))}))) (end { (\"Checkmate\" \"King\") (if (or (no Moves Mover) (= (counter) 100)) (result Mover Draw))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe board is a single track: nine squares along the bottom row. From the central space, a track of 25 spaces, which makes turns every five spaces. It begins vertically, then to the right, then vertical, then diagonallyup and to the left, then diagonallydown and to the left. The squares just before the track turns are marked with an \\ \n\n###\n\n", "completion": "(define \"RemoveAPiece\" (move Remove (from))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" (count Pips))) (game \"Pancha Keliya\" (players 2) (equipment { (board (rotate 90 (merge { (shift 2.79 10.44 (rotate 135 (rectangle 5 1))) (shift 6.32 11.15 (rotate 45 (rectangle 5 1))) (shift 9 11 (graph vertices:{ { 0 0} { -0.75 0.55} { -0.04 1.24}{ 1 0}} edges:{ {0 1} {1 2} {2 3} {3 0}})) (shift 9 5 (rectangle 6 1)) (shift 5 5 (rectangle 1 5)) (rectangle 1 9) (shift 4 0 (rectangle 6 1))})) { (track \"Track1\" \"23,N4,W,N,W,11,7,SW,SE,End\" P1 directed:True) (track \"Track2\" \"31,S4,W,N,W,11,7,SW,SE,End\" P2 directed:True)}) (piece \"Marker\" Each (if (\"IsEndTrack\" \"SiteToMoveOnTrack\") \"RemoveAPiece\" (if (\"IsNotOffBoard\" \"SiteToMoveOnTrack\") (if (or (is Empty \"SiteToMoveOnTrack\") (and (not (\"IsFriendAt\" \"SiteToMoveOnTrack\")) (not (is In \"SiteToMoveOnTrack\" (sites \"Protect\"))))) (move (from) (to \"SiteToMoveOnTrack\" (\"HittingCapture\" (mapEntry \"Entry\" Next)))))))) (\"StickDice\" 6) (hand Each) (regions \"Protect\" (sites {27 19 12 10 1})) (regions \"SpecialDiceValues\" (sites {1 5 6})) (map \"Entry\" {(pair P1 23) (pair P2 31)})}) (rules (start (place \"Marker\" \"Hand\" count:3)) (play (\"RollMove\" (if (and (is In (count Pips) (sites \"SpecialDiceValues\")) (\"HandOccupied\" Mover)) (or (move (from (handSite Mover)) (to (mapEntry \"Entry\" Mover) if:(not (\"IsEnemyAt\" (to))))) (forEach Piece) (then (moveAgain))) (forEach Piece)))) (end (\"EscapeWin\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\n3x3 intersecting lines, with diagonals drawn in the large square. Three pieces per player. Players alternate turns placing a stone on an empty point on the board. When all of the pieces have been placed, players alternate turns moving one of their pieces to any empty point. The first player to place three of their pieces in a line wins.\n \n\n###\n\n", "completion": "(game \"Tsoro Yemutatu\" (players 2) (equipment { (\"AlquerqueBoard\" 3 3) (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\")))) 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": "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 Ludii game based on the following description\nThe rules are the same as for \n Chess with these differences: White wins by capturing all black pieces. Black wins by checkmating the white king. If no black piece can make a valid move, the game is a draw (stalemate). Black pawns can be promoted to a black queen, rook, bishop or knight if they reach the last row. Black pawns cannot move two spaces forward from any position except the second rank. \n\n###\n\n", "completion": "(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 \"BigCastling\" (\"DoCastle\" \"King\" W 2 \"KingNotCheckedAndToEmpty\" (then (and (\"PieceHasMoved\") (\"DoCastle\" \"RookLeft\" E 3 True))))) (define \"SmallCastling\" (\"DoCastle\" \"King\" E 2 \"KingNotCheckedAndToEmpty\" (then (and (\"PieceHasMoved\") (\"DoCastle\" \"RookRight\" W 2 True))))) (define \"DoCastle\" (move Slide (from (mapEntry #1 (mover))) #2 (between (exact #3) if:#4) #5)) (define \"KingNotCheckedAndToEmpty\" (and (is Empty (to)) (not (\"IsInCheck\" \"King\" Mover at:(to))))) (define \"RememberPieceHasMoved\" (then (if (= (state at:(last To)) 1) \"PieceHasMoved\"))) (define \"PieceHasMoved\" (set State at:(last To) 0)) (define \"HasNeverMoved\" (= (state at:(mapEntry #1 (mover))) 1)) (define \"KingInTheInitialPlace\" (= (what at:(mapEntry \"King\" (mover))) (id \"King\" Mover))) (define \"NextCanNotMove\" (not (can Move (do (forEach Piece Next) ifAfterwards:(not (\"IsInCheck\" \"King\" Next)))))) (game \"Horde Chess\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (\"ChessPawn\" \"Pawn\" (or (if (and (= (who at:(from)) P1) (is In (from) (sites Start (piece (what at:(from)))))) (\"DoubleStepForwardToEmpty\" \"SetEnPassantLocation\")) \"EnPassant\") (then (and (\"ReplayInMovingOn\" (sites Mover \"Promotion\")) (set Counter)))) (\"ChessRook\" \"Rook\" (then (set Counter)) (\"RememberPieceHasMoved\")) (\"ChessKing\" \"King\" (then (set Counter)) (\"RememberPieceHasMoved\")) (\"ChessBishop\" \"Bishop\" (then (set Counter))) (\"ChessKnight\" \"Knight\" (then (set Counter))) (\"ChessQueen\" \"Queen\" (then (set Counter))) (map \"King\" {(pair 1 \"E1\") (pair 2 \"E8\")}) (map \"RookLeft\" {(pair 1 \"A1\") (pair 2 \"A8\")}) (map \"RookRight\" {(pair 1 \"H1\") (pair 2 \"H8\")}) (regions \"Promotion\" P1 (sites Top)) (regions \"Promotion\" P2 (sites Bottom))}) (rules (start { (place \"Pawn1\" (sites Row 1)) (place \"Pawn2\" (union {(sites Row 5) (sites Row 6) (sites Row 4) (difference (sites Row 7) (sites {\"D8\" \"E8\"})) (difference (sites Row 3) (sites {\"A4\" \"B4\" \"C4\" \"F4\" \"G4\" \"H4\"}))})) (place \"Rook1\" {\"A1\" \"H1\"} state:1) (place \"Knight1\" {\"B1\" \"G1\"}) (place \"Bishop1\" {\"C1\" \"F1\"}) (place \"Queen1\" coord:\"D1\") (place \"King1\" coord:\"E1\" state:1)}) (play (if \"SameTurn\" (move Promote (last To) (piece {\"Queen\" \"Knight\" \"Bishop\" \"Rook\"}) Mover) (if (is Mover P1) (do (or (forEach Piece) (if (and { \"KingInTheInitialPlace\" (\"HasNeverMoved\" \"King\") (not (\"IsInCheck\" \"King\" Mover))}) (or (if (and (\"HasNeverMoved\" \"RookLeft\") (can Move (\"DoCastle\" \"RookLeft\" E 3 (is Empty (to))))) \"BigCastling\") (if (and (\"HasNeverMoved\" \"RookRight\") (can Move (\"DoCastle\" \"RookRight\" W 2 (is Empty (to))))) \"SmallCastling\")))) ifAfterwards:(not (\"IsInCheck\" \"King\" Mover))) (forEach Piece)))) (end { (if (and (is Mover P1) (no Pieces P2)) (result P1 Win)) (if (and { (is Mover P2) (\"IsInCheck\" \"King\" Next) (not (can Move (do (forEach Piece Next) ifAfterwards:(not (\"IsInCheck\" \"King\" Next)))))}) (result P2 Win)) (if (or (no Moves Mover) (= (counter) 100)) (result Mover Draw))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nCircular board. Empty central circle, with four concentric rows of spaces, sixteen spaces per circle. Pieces are as follows: Rukh (x2), placed on two adjacent squares in the outer circle, move any number of spaces orthogonally; Asb (x2), placed in the two spaces adjacent to the Rukh in the next circle, move as Chess knights; Pil (x2): Placed in the two spaces adjacent to the Asb in the next circle in, move two spaces diagonally, jumping over the first space; Fres (x1): placed on the inner circle adjacent to the left Pil, moves one space diagonally; Shah (x1), placed to the right of the Fers, moves one space in any direction, Baidaq (x8), placed in each space flanking the other pieces, those on the left move clockwise, those on the right anti-clockwise, one space forward or one space diagonally forward to capture. No en passant, no promotion. When two Baidaq meet and neither can move, the opponent captures them. The opponent who can checkmate the opponent's Shah wins. Rules Murray.\n\n###\n\n", "completion": "(game \"Shatranj ar-Rumiya\" (players 2) (equipment { (board (remove (concentric {0 0 0 16 16 16 16}) cells:{1})) (piece \"Pawn\" Each (or { (\"StepToEmpty\" (if (= (state at:(from)) 0) CW CCW)) (move (from) (to (sites Around (sites To (move Step (if (= (state at:(from)) 0) CW CCW) (to if:True))) Orthogonal) if:(and (is Related Diagonal (from) (to)) (\"IsEnemyAt\" (to)))))} (then (if (= (state at:(last To)) 0) (if (\"IsPieceAt\" \"Pawn\" Next (ahead (last To) CW)) (and (remove (last To)) (remove (ahead (last To) CW)))) (if (\"IsPieceAt\" \"Pawn\" Next (ahead (last To) CCW)) (and (remove (last To)) (remove (ahead (last To) CCW)))))))) (piece \"Rook\" Each (\"SlideCapture\" Rotational)) (piece \"Knight\" Each (forEach Direction Orthogonal (to if:True (apply (forEach Direction (from (to)) Diagonal (if (and (not (\"IsFriendAt\" (to))) (= 3 (count Steps Orthogonal (from) (to)))) (move (from) (to (apply if:(\"IsEnemyAt\" (to)) (remove (to))))))))))) (piece \"Elephant\" Each (move (from) (to (sites Around (sites Around (from) Diagonal) Diagonal) if:(and (not (\"IsFriendAt\" (to))) (< 2 (count Steps Orthogonal (from) (to)))) (apply if:(\"IsEnemyAt\" (to)) (remove (to)))))) (piece \"Queen\" Each (\"StepToNotFriend\" Diagonal)) (\"ChessKing\" \"King_noCross\")}) (rules (start { (place \"Rook1\" (sites {52 53})) (place \"Rook2\" (sites {61 60})) (place \"Knight1\" (sites {36 37})) (place \"Knight2\" (sites {44 45})) (place \"Elephant1\" (sites {20 21})) (place \"Elephant2\" (sites {28 29})) (place \"Queen1\" 4) (place \"Queen2\" 12) (place \"King_noCross1\" 5) (place \"King_noCross2\" 13) (place \"Pawn1\" (sites {3 19 35 51}) state:0) (place \"Pawn1\" (sites {54 38 22 6}) state:1) (place \"Pawn2\" (sites {11 27 43 59}) state:0) (place \"Pawn2\" (sites {14 30 46 62}) state:1)}) (play (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King_noCross\" Mover)))) (end { (\"Checkmate\" \"King_noCross\")}))) END" }, { "prompt": "Construct a Ludii game based on the following description\n10x10 board. 22 pieces per player. Pieces begin on the board in the following arrangement, and with the following movements: Outer row, from left corner: Rukh: moves orthogonally any distance; Ghora: moves orthogonally one space and then diagonally another space, jumping over the first space; Fil: moves diagonally any distance; Wazir: moves diagonally or orthogonally any distance; Shahzada: can move like the Wazir and like the Ghora; Padshah: moves one space in any direction; Kotwal: moves like the Shahzada; Fil, Ghora, Rukh. In the next row, the central two squares are occupied by the Urdabegini: move one space in the direction of the opponent's Padshah; the other spaces are occupied by Paidal: moves one square forward orthogonally or one diagonally to capture. The central two squares of the third row contain two more Ghora. Players alternate turns moving a piece to a space on the board. If one of the opponent's pieces is on the space to which a player moves their piece, the opponent's piece is captured. If the Padshah can be captured on the opponent's next turn, it is in check. The Padshah cannot remain in check at the end of the player's turn. If this is not possible, it is checkmate and the opponent wins. \n\n###\n\n", "completion": "(game \"Qatranj\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 10)) (\"ChessRook\" \"Rook\") (\"ChessKnight\" \"Knight\") (\"ChessBishop\" \"Bishop_noCross\") (\"ChessQueen\" \"Queen\") (piece \"Commoner\" Each (or (\"SlideCapture\") (\"LeapCapture\" \"KnightWalk\"))) (\"ChessKing\" \"King_noCross\") (piece \"Mann\" Each (or (\"SlideCapture\") (\"LeapCapture\" \"KnightWalk\"))) (piece \"Wazir\" Each (do (\"StepToNotFriend\") ifAfterwards:(> (count Steps (last From) (where \"King_noCross\" Next)) (count Steps (last To) (where \"King_noCross\" Next))))) (piece \"Pawn\" Each (or \"StepForwardToEmpty\" (\"StepToEnemy\" (directions {FR FL}))))}) (rules (start { (place \"Rook1\" (sites {\"A1\" \"J1\"})) (place \"Rook2\" (sites {\"A10\" \"J10\"})) (place \"Knight1\" (sites {\"B1\" \"I1\" \"E3\" \"F3\"})) (place \"Knight2\" (sites {\"B10\" \"I10\" \"E8\" \"F8\"})) (place \"Bishop_noCross1\" (sites {\"C1\" \"H1\"})) (place \"Bishop_noCross2\" (sites {\"C10\" \"H10\"})) (place \"Queen1\" coord:\"D1\") (place \"Queen2\" coord:\"G10\") (place \"Commoner1\" coord:\"E1\") (place \"Commoner2\" coord:\"F10\") (place \"King_noCross1\" coord:\"F1\") (place \"King_noCross2\" coord:\"E10\") (place \"Mann1\" coord:\"G1\") (place \"Mann2\" coord:\"D10\") (place \"Wazir1\" (sites {\"E2\" \"F2\"})) (place \"Wazir2\" (sites {\"E9\" \"F9\"})) (place \"Pawn1\" (difference (sites Row 1) (sites {\"E2\" \"F2\"}))) (place \"Pawn2\" (difference (sites Row 8) (sites {\"E9\" \"F9\"})))}) (play (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King_noCross\" Mover)))) (end (\"Checkmate\" \"King_noCross\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\n5x6 board. Each player has twelve pieces. Players alternate placing their pieces until they are all placed on the board. The goal is to make a line of three, which allows the player to capture one of the opponent's pieces. Once the pieces are all on the board, they may be moved one space orthogonally. In the case that a move creates two lines of three, only one capture is made. The player who makes the last possible capture wins.\n \n\n###\n\n", "completion": "(game \"Tauru\" (players 2) (equipment { (board (rectangle 5 6)) (hand Each) (piece \"Marker\" Each (\"StepToEmpty\" Orthogonal (then (\"ReplayIfLine3\"))))}) (rules (start (place \"Marker\" \"Hand\" count:12)) phases:{ (phase \"Placement\" (play (if \"SameTurn\" (\"RemoveAnyEnemyPiece\") (move (from (handSite Mover)) (to (sites Empty)) (then (\"ReplayIfLine3\"))))) (nextPhase (\"HandEmpty\" P2) \"Movement\")) (phase \"Movement\" (play (if \"SameTurn\" (\"RemoveAnyEnemyPiece\") (forEach Piece))))} (end (\"HavingLessPiecesLoss\" Next 2)))) END" }, { "prompt": "Construct a Ludii game based on the following description\n9x9 board. Played with the full complement of Shogi pieces, placed in the first and second rows. All pieces move only one space orthogonally forward or laterally. Pieces capture by hopping over an opponent's piece. The player to capture all of the opponent's pieces wins. \n\n###\n\n", "completion": "(define \"PieceMove\" (or (\"StepToEmpty\" (directions {Forward Rightward Leftward})) (\"HopCapture\" (directions {Forward Rightward Leftward})))) (game \"Tobi Shogi\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 9)) (piece \"Osho\" Each \"PieceMove\") (piece \"Kinsho\" Each \"PieceMove\") (piece \"Ginsho\" Each \"PieceMove\") (piece \"Keima\" Each \"PieceMove\") (piece \"Kyosha\" Each \"PieceMove\") (piece \"Fuhyo\" Each \"PieceMove\")}) (rules (start { (place \"Osho1\" coord:\"E1\") (place \"Kinsho1\" {\"D1\" \"F1\"}) (place \"Ginsho1\" {\"C1\" \"G1\"}) (place \"Keima1\" {\"B1\" \"H1\"}) (place \"Kyosha1\" {\"A1\" \"I1\"}) (place \"Fuhyo1\" (sites Row 1)) (place \"Osho2\" coord:\"E9\") (place \"Kinsho2\" {\"D9\" \"F9\"}) (place \"Ginsho2\" {\"C9\" \"G9\"}) (place \"Keima2\" {\"B9\" \"H9\"}) (place \"Kyosha2\" {\"A9\" \"I9\"}) (place \"Fuhyo2\" (sites Row 7))}) (play (forEach Piece)) (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"NoRabbit\" (if (and (not (\"IsPieceAt\" \"Rabbit\" #1 (handSite #2))) (\"NoSites\" (sites Occupied by:#1 component:\"Rabbit\"))) (result #2 #3))) (define \"RabbitReachedGoal\" (if (!= 0 (count Sites in:(forEach (sites Occupied by:#1 component:\"Rabbit\") if:(is In (site) (sites #1 \"Goal\"))))) (result #1 #2))) (define \"FinishMyTurn\" (move Pass (then (remember State)))) (define \"PullAPiece\" (move (from (sites Around (last From) Orthogonal if:(and (\"IsEnemyAt\" (to)) (if (and (is In (last To) (sites \"Traps\")) (is Pending)) (< (value Piece at:(to)) (value Pending)) (< (value Piece at:(to)) (value Piece at:(last To))))))) (to (last From)))) (define \"PushThePiece\" (move (from (handSite Mover)) (to (sites Around (last To) Orthogonal if:(and (!= (last From) (to)) (is Empty (to))))) (then (and \"AllPieceInATrapAreRemoved\" (if \"NotMyLastMove\" (moveAgain) (remember State)))))) (define \"HasToPushAPiece\" (is Occupied (handSite Mover))) (define \"AllPieceInATrapAreRemoved\" (forEach Site (sites \"Traps\") (if (or (and (= (who at:(to)) P1) (\"NotProtectedBy\" (site) P1)) (and (= (who at:(to)) P2) (\"NotProtectedBy\" (site) P2))) (do (set Pending (value Piece at:(to))) next:(remove (to)))))) (define \"PieceMove\" (move Step #1 (to if:(and (or \"NotFrozen\" (and (\"Frozen\") (\"ProtectedBy\" Mover))) (or (is Empty (to)) \"WillPushAPiece\")) (apply (fromTo (from (to)) (to (handSite Mover))))))) (define \"WillPushAPiece\" (and { \"NotMyLastMove\" (not (\"NoSites\" (sites Around (to) Orthogonal if:(is Empty (to))))) (\"IsEnemyAt\" (to)) (< (value Piece at:(to)) (value Piece at:(from)))})) (define \"NotMyLastMove\" (< (count MovesThisTurn) 3)) (define \"ProtectedBy\" (not (\"NotProtectedBy\" (from) #1))) (define \"NotProtectedBy\" (\"NoSites\" (sites Around #1 Orthogonal if:(= (who at:(to)) #2)))) (define \"Frozen\" (not \"NotFrozen\")) (define \"NotFrozen\" (\"NoSites\" (sites Around (from) Orthogonal if:(and (\"IsEnemyAt\" (to)) (> (value Piece at:(to)) (value Piece at:(from))))))) (game \"Arimaa\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (hand Each size:6) (piece \"Rabbit\" Each (\"PieceMove\" (directions {Forward Rightward Leftward}))) (piece \"Cat\" Each (\"PieceMove\" Orthogonal)) (piece \"Dog\" Each (\"PieceMove\" Orthogonal)) (piece \"Horse\" Each (\"PieceMove\" Orthogonal)) (piece \"Camel\" Each (\"PieceMove\" Orthogonal)) (piece \"Elephant\" Each (\"PieceMove\" Orthogonal)) (regions \"Traps\" (sites {\"C3\" \"C6\" \"F3\" \"F6\"})) (regions \"Home\" P1 (expand (sites Bottom))) (regions \"Home\" P2 (expand (sites Top))) (regions \"Goal\" P1 (sites Top)) (regions \"Goal\" P2 (sites Bottom))}) (rules (start { (place \"Rabbit\" \"Hand\" count:8 value:1) (place \"Cat\" \"Hand\" count:2 value:2) (place \"Dog\" \"Hand\" count:2 value:3) (place \"Horse\" \"Hand\" count:2 value:4) (place \"Camel\" \"Hand\" count:1 value:5) (place \"Elephant\" \"Hand\" count:1 value:6)}) phases:{ (phase \"PlacementP1\" (play (move (from (sites Occupied by:Mover container:(mover))) (to (forEach (sites Mover \"Home\") if:(is Empty (site)))) (then (if (\"HandOccupied\" P1) (moveAgain))))) (nextPhase (\"HandEmpty\" P1) \"PlacementP2\")) (phase \"PlacementP2\" (play (move (from (sites Occupied by:Mover container:(mover))) (to (forEach (sites Mover \"Home\") if:(is Empty (site)))) (then (if (\"HandEmpty\" P2) (remember State) (moveAgain))))) (nextPhase (\"HandEmpty\" P2) \"Movement\")) (phase \"Movement\" (play (avoidStoredState (if \"HasToPushAPiece\" \"PushThePiece\" (or (or (if (and \"SameTurn\" (is In (last From) (sites Board))) \"PullAPiece\") (forEach Piece) (then (and \"AllPieceInATrapAreRemoved\" (if \"NotMyLastMove\" (moveAgain) (remember State))))) \"FinishMyTurn\")))) (end (if (not (is Next Mover)) { (\"RabbitReachedGoal\" P1 Win) (\"RabbitReachedGoal\" P2 Win) (\"NoRabbit\" P1 P2 Win) (\"NoRabbit\" P2 P1 Win) (\"NoMoves\" Loss)})))}))\n\n###\n\n", "completion": "Played on an 8x8 board with \\ 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": "Construct a Ludii game based on the following description\n7x7 board, with an extra square above the top left square of the grid. One piece per player. Four sticks, with one green side and one white side, used as dice. The throws are as follows: one white and three green = s\u00eeg, valued at 1; two white and two green = 0; three white and one green = 3; four white = 4; four green=6. Pieces begin off the board, moving onto the bottom right square, and proceed in a boustrophedon direction, moving upward in the rightmost column, then down the next to the left, until reaching the extra space in the top left of the board. A player must first throw s\u00eeg to begin moving. Players move according to the values of the throws. If a player lands on the top right square, they must throw s\u00eeg five times to escape it. If a player lands on the central square, they must throw s\u00eeg ten times to escape it. A player must also throw one s\u00eeg to escape each of the final three spaces. Once a player has escaped the final space, they control the Ghula. The Ghula has different values for the throws: one white = 2; two white = 5; three white = 0; four white = 4; four green =6. The ghula moves in the opposite direction of the pieces, and when it overcomes one of the opponent's pieces it drags them in the direction it moves, with the goal of dragging them to the start. The Ghula may move forward or backward on its turn along the track. The Ghula does not have to throw a s\u00eeg to escape any spaces. Play continues until all of the players escape the final space. The game has 4 players.\n\n###\n\n", "completion": "(define \"MoveGhoula\" (if (\"IsSingletonStack\" (where \"Ghoula\" Neutral)) (or (move (from (where \"Ghoula\" Neutral) level:(where Level \"Ghoula\" Neutral at:(where \"Ghoula\" Neutral))) (to (\"GhoulaOnTrack\" \"GhoulaTrack\" \"ThrowGhoulaValue\"))) (move (from (where \"Ghoula\" Neutral) level:(where Level \"Ghoula\" Neutral at:(where \"Ghoula\" Neutral))) (to (\"GhoulaOnTrack\" \"ReverseGhoulaTrack\" \"ThrowGhoulaValue\")))) (move (from (where \"Ghoula\" Neutral) level:(where Level \"Ghoula\" Neutral at:(where \"Ghoula\" Neutral))) (to (\"GhoulaOnTrack\" \"ReverseGhoulaTrack\" \"ThrowGhoulaValue\")) (then (if (= (last From) (\"KillingSite\")) (forEach Level (last From) FromTop (remove (last From) level:(level))) (forEach Level (last From) FromTop (fromTo (from (last From) level:(level)) (to (last To))))))) (then (set Var 0)))) (define \"GhoulaPhaseDone\" (or (and (\"IsSingletonStack\" (where \"Ghoula\" Neutral)) (= (\"BeforeFinalSite\") (where \"Ghoula\" Neutral))) (and (all Sites (difference (sites Board) (sites {(\"ExternalSite\") (\"FinalSite\")})) if:(or (is Empty (site)) (and (\"IsSingletonStack\" (site)) (= (site) (where \"Ghoula\" Neutral))))) (is Empty (\"ExternalSite\"))))) (define \"ActivePiece\" (set State at:#1 level:#2 1)) (define \"ActivatedPiece\" (<= 1 (state at:#1 level:#2))) (define \"Sig\" (= (\"ThrowValue\") 1)) (define \"ThrowGhoulaValue\" (mapEntry \"ThrowGhoula\" (count Pips))) (define \"GhoulaOnTrack\" (\"NextSiteOnTrack\" #2 from:(where \"Ghoula\" Neutral) #1)) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" #2 #1)) (define \"NextCentralSquare\" 32) (define \"CentralSquare\" 31) (define \"BegginingFinalTrack\" 45) (define \"NextTopRightSquare\" 48) (define \"TopRightSquare\" 49) (define \"BeforeFinalSite\" 12) (define \"FinalSite\" 14) (define \"KillingSite\" 19) (define \"ThrowValue\" (mapEntry \"Throw\" (count Pips))) (define \"ExternalSite\" 50) (game \"Es-Sig\" (players 4) (equipment { (board (merge { (rectangle 8 1) (square 7) (shift 8 0 (square 1))}) { (track \"Track\" \"50,19,W,N1,E,N1,W,N1,E,N1,W,N1,E,N1,W4\" directed:True) (track \"ExtensionTrack\" \"45,W,N\" directed:True) (track \"GhoulaTrack\" \"19,W,N1,E,N1,W,N1,E,N1,W,N1,E,N1,W\" directed:True) (track \"ReverseGhoulaTrack\" \"50,12,E,S1,W,S1,E,S1,W,S1,E,S1,W,S1,E\" directed:True)}) (piece \"Ghoula\" Neutral) (piece \"Stick\" Each (if (= (from) (\"TopRightSquare\")) (if (= (state at:(from) level:(level)) 6) (move (from (from) level:(level)) (to (\"NextTopRightSquare\")) (then (forEach Level (last To) (set State at:(last To) level:(level) 0)))) (if (\"Sig\") (move Select (from (from) level:(level)) (then (set State at:(last To) level:(last LevelTo) (+ 1 (state at:(last To) level:(last LevelTo)))))))) (if (= (from) (\"CentralSquare\")) (if (= (state at:(from) level:(level)) 11) (move (from (from) level:(level)) (to (\"NextCentralSquare\")) (then (forEach Level (last To) (set State at:(last To) level:(level) 0)))) (if (\"Sig\") (move Select (from (from) level:(level)) (then (set State at:(last To) level:(last LevelTo) (+ 1 (state at:(last To) level:(last LevelTo)))))))) (if (and (!= (from) (\"BegginingFinalTrack\")) (is In (from) (sites Track \"Track\"))) (move (from (from) level:(level) if:(if (\"ActivatedPiece\" (from) (level)) True (\"Sig\"))) (to (\"SiteToMoveOnTrack\" \"Track\" (\"ThrowValue\")) if:True) (then (if (not (\"ActivatedPiece\" (last To) (topLevel at:(last To)))) (\"ActivePiece\" (last To) (topLevel at:(last To)))))) (if (is In (from) (sites Track \"ExtensionTrack\")) (or { (if (and (!= (from) (\"FinalSite\")) (\"Sig\")) (move (from (from) level:(level)) (to (\"SiteToMoveOnTrack\" \"ExtensionTrack\" 1)))) (if (= (from) (\"FinalSite\")) (move Pass (then (if (!= 1 (count Pips)) (and (moveAgain) (set Var 1))))))})))) (then (if (and (= (last To) (\"FinalSite\")) (!= (last From) (\"FinalSite\"))) (if (!= Undefined (var \"ScoreToGet\")) (and (set Score Mover (- (var \"ScoreToGet\") 1)) (set Var \"ScoreToGet\" (- (var \"ScoreToGet\") 1))) (and (set Score Mover (count Players)) (set Var \"ScoreToGet\" (count Players))))))) maxState:12) (\"StickDice\" 4) (map \"Throw\" {(pair 0 4) (pair 1 3) (pair 2 0) (pair 3 1) (pair 4 6)}) (map \"ThrowGhoula\" {(pair 0 4) (pair 1 6) (pair 2 4) (pair 3 2) (pair 4 6)})}) (rules (start (place Stack items:{\"Ghoula0\"\"Stick4\" \"Stick3\" \"Stick2\" \"Stick1\"} (\"ExternalSite\"))) (play (\"RollMove\" (if (> (var) 0) (\"MoveGhoula\") (if (or (= (where \"Stick\" Mover) (\"FinalSite\")) (!= 0 (\"ThrowValue\"))) (forEach Piece))))) (end { (forEach Player if:(no Pieces Player) (result Player Loss)) (if (\"GhoulaPhaseDone\") (byScore))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\n4x8 board. Two counters in each hole. Sowing proceeds in an anti-clockwise direction. The first move must begin from the second hole from the right in the player's outer row, and proceed as follows, and is played simultaneously by both players: sow the two counters from that first hole, capture the counters in the opponent's two opposite holes and sow them, starting in the rightmost hole in the outer row, capture from the opposite two holes on the opponent's side and sow them again from the same hole. When the final counter falls in an occupied hole, those counters are picked up and sowing continues. The opening move ends when the final counter falls in an empty hole. The main phase then begins. When the final counter falls into an occupied hole in the player's inner row and both of the opposite holes on the opponent's side of the board are occupied, the counters in the opposite holes are captured and sown beginning in the first hole that was sown into to begin the sowing that caused the capture. When the final counter falls into an occupied hole and a capture is not possible, the contents of the hole are picked up and sowing continues. When the final counter lands in an empty hole, the turn ends. Players cannot sow from a hole containing a single counter. The player who captures all of their opponent's counters wins. \n\n###\n\n", "completion": "(define \"NoPiece\" (all Sites (sites Player \"Home\") if:(= 0 (count at:(site))))) (define \"PiecesOwnedBy\" (+ (count Cell at:(handSite #1)) (count in:(sites #1 \"Home\")))) (define \"Columns\" 8) (game \"Ryakati\" (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))) (map \"RightMostOuter\" {(pair P1 7) (pair P2 24)}) (map \"SecondHoleRightOuter\" {(pair P1 6) (pair P2 25)}) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 2 to:(sites Board))) phases:{ (phase \"Opening1\" (play (move Select (from (mapEntry \"SecondHoleRightOuter\" Mover)) (then (sow \"Track\" owner:(mover) apply:(and (fromTo (from (\"OppositePit\" (to))) (to (mapEntry \"RightMostOuter\" Mover)) count:2) (fromTo (from (\"OppositeOuterPit\" (to))) (to (mapEntry \"RightMostOuter\" Mover)) count:2)))))) (nextPhase Mover \"Opening2\")) (phase \"Opening2\" (play (move Select (from (mapEntry \"RightMostOuter\" Mover)) (then (sow count:4 \"Track\" owner:(mover) apply:(and (fromTo (from (\"OppositePit\" (to))) (to (mapEntry \"RightMostOuter\" Mover)) count:2) (fromTo (from (\"OppositeOuterPit\" (to))) (to (mapEntry \"RightMostOuter\" Mover)) count:2)) origin:True)))) (nextPhase Mover \"Opening3\")) (phase \"Opening3\" (play (move Select (from (if (\"SameTurn\") (var \"Replay\") (mapEntry \"RightMostOuter\" Mover))) (then (sow count:(if (\"SameTurn\") (count at:(last To)) 4) \"Track\" owner:(mover) apply:(if (< 1 (count at:(to))) (and (moveAgain) (set Var \"Replay\" (to)))) origin:(\"NewTurn\"))))) (nextPhase Mover (not (is Next Mover)) \"Sowing\")) (phase \"Sowing\" (play (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (sites Mover \"Home\")) if:(> (count at:(from)) 1)) (then (sow \"Track\" owner:(mover) apply:(if (< 1 (count at:(to))) (if (and { (is In (to) (sites Mover \"Inner\")) (is Occupied (\"OppositePit\" (to))) (is Occupied (\"OppositeOuterPit\" (to)))}) (and { (fromTo (from (\"OppositePit\" (to))) (to (last From)) count:(count at:(\"OppositePit\" (to)))) (fromTo (from (\"OppositeOuterPit\" (to))) (to (last From)) count:(count at:(\"OppositeOuterPit\" (to)))) (sow (last From) count:(+ (count at:(\"OppositeOuterPit\" (to))) (count at:(\"OppositePit\" (to)))) \"Track\" owner:(mover))}) (and (moveAgain) (set Var \"Replay\" (to))))))))))} (end (forEach NonMover if:(\"NoPiece\") (result Player Loss))))) 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.\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": "Construct a Ludii game based on the following description\n3x3 intersecting lines. Three sticks per player, the sticks angled toward the player to indicate ownership. Players alternate turns placing sticks on the board. Once all of the sticks are placed, players alternate turns moving a stick to any empty spot on the board. The first player to place three sticks in an orthogonal row along the lines wins. \n\n###\n\n", "completion": "(game \"Akidada\" (players 2) (equipment { (board (square 3) use:Vertex) (hand Each) (piece \"Stick\" Each (move (from) (to (sites Empty))))}) (rules (start (place \"Stick\" \"Hand\" count:3)) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase (\"HandEmpty\" P2) \"Movement\")) (\"PhaseMovePiece\" \"Movement\")} (end (if (is Line 3 Orthogonal) (result Mover Win))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"IsNotAnIsolatedPlacement\" (< 0 (count Pieces Mover in:(sites Around (last To) Orthogonal)))) (define \"SitesInOversizedGroups\" (forEach of:(intersection (sites Board) (sites Occupied by:Mover)) (if (> (value Piece at:(site)) (value Piece at:(handSite Mover 0))) (sites Around (site) Orthogonal)))) (define \"UpdateGroupSizeValue4PiecesConnected2Placement\" (forEach Site (sites Group at:(last To) Orthogonal) (set Value at:(site) (count Sites in:(sites Group at:(last To) Orthogonal))))) (define \"UpdateTotalMoverGroupCount\" (set Value at:(handSite Mover 0) (size Array (sizes Group Orthogonal Mover)))) (define \"EmptySitesOutsideEnemyTerritoryFor\" (difference (sites Empty) (sites (values Remembered #1)))) (define \"RecordTerritoryOfRevisedGroup\" (forEach Site (\"HexHullSites\" (sites Group at:(last To) Orthogonal)) (if (= (mover) 1) (remember Value \"P1\" (site) unique:True) (remember Value \"P2\" (site) unique:True)))) (define \"CaptureWithin\" (forEach Group Orthogonal if:(is In (to) (intersection (sites Board) (sites Occupied by:Next))) (if (no Pieces Next in:(difference (sites) (sites (values Remembered #2)))) (and (forEach Site (\"HexHullSites\" (sites)) (forget Value #1 (site))) (remove (sites)))))) (define \"Scoring\" (and { (set Score P1 (count Sites in:(intersection (sites Empty) (sites (values Remembered \"P1\"))))) (set Score P2 (count Sites in:(intersection (sites Empty) (sites (values Remembered \"P2\"))))) (set Value at:(handSite P1 0) (size Array (sizes Group Orthogonal P1))) (set Value at:(handSite P2 0) (size Array (sizes Group Orthogonal P2)))})) (define \"CommonTerritory\" (intersection (union (sites (values Remembered \"P2\")) (difference (sites Occupied by:P2) (handSite P2 0))) (union (sites (values Remembered \"P1\")) (difference (sites Occupied by:P1) (handSite P1 0))))) (define \"P2Territory\" (difference (union (sites (values Remembered \"P2\")) (difference (sites Occupied by:P2) (handSite P2 0))) (sites (values Remembered \"P1\")))) (define \"P1Territory\" (difference (union (sites (values Remembered \"P1\")) (difference (sites Occupied by:P1) (handSite P1 0))) (sites (values Remembered \"P2\")))) (define \"SquareHullSites\" (union { (\"Corner\" #1 N E) (\"Corner\" #1 S E) (\"Corner\" #1 S W) (\"Corner\" #1 N W)})) (define \"HexHullSites\" (union { (\"Corner\" #1 NNW E) (\"Corner\" #1 NNE SSE) (\"Corner\" #1 E SSW) (\"Corner\" #1 SSE W) (\"Corner\" #1 SSW NNW) (\"Corner\" #1 W NNE)})) (define \"Corner\" (intersection (sites Direction from:#1 #2) (sites Direction from:#1 #3))) (game \"OffShore\" (players 2) (equipment { (board (hex Hexagon 4) use:Cell) (hand Each size:1) (piece \"Disc\" Each)}) (rules (start { (place \"Disc1\" (handSite P1 0) value:0) (place \"Disc2\" (handSite P2 0) value:0)}) (play (or (move Pass) (move Add (to (difference (union { (if (= 1 (mover)) (\"EmptySitesOutsideEnemyTerritoryFor\" \"P2\") (\"EmptySitesOutsideEnemyTerritoryFor\" \"P1\")) ((sites {}))}) (\"SitesInOversizedGroups\"))) (then (do (\"UpdateGroupSizeValue4PiecesConnected2Placement\") next:(\"UpdateTotalMoverGroupCount\") (then (if (\"IsNotAnIsolatedPlacement\") (\"RecordTerritoryOfRevisedGroup\") (then (priority (if (= (mover) 1) (\"CaptureWithin\" \"P2\" \"P1\") (\"CaptureWithin\" \"P1\" \"P2\") (then (\"Scoring\"))) (\"Scoring\")))))))))) (end (if (all Passed) { (if (> (score Mover) (score Next)) (result Mover Win)) (if (< (score Mover) (score Next)) (result Mover Loss))} (result Mover Win)))))\n\n###\n\n", "completion": "Definitions:\n -- Each of a player's stones belongs to exactly one group. \n -- The group it belongs to contains all the stones that connect to it by virtue of being next to one another (across an edge).\n -- A player's territory is the union of all the cells that are within the convex grid-oriented hulls of the player's groups. \n \n In simpler language:\n Imagine a line of cells that goes through just one stone of a group and leaves the rest of that group to one side. Surround the group with six of these lines and they will exactly contain all the territory of the stones of that group. A player's territory is then the combined territory of every group, counting cells only once where any of the group territories overlap.\n \n -- A player's score is the number of empty cells in their territory.\n \n Play:\n The mover places a stone onto an empty site, with the following two limitations:\n 1) No placing in the opponent's territory.\n 2) No placing next to a friendly group that has more stones than there are friendly groups.\n (Note that the resulting size of a group is irrelevant.)\n \n After the placement, every opponent's group that lies completely within the mover's territory is removed.\n \n Passing is voluntary. \n When both players pass consecutively, the higher score wins. In case of a tie, the last to play wins.\n \n Various boards are optional. \nWeak Territory, allowing placement next to a friendly group in enemy territory is optional. 4 Hexagon No placement within Enemy territory. 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": "Construct a Ludii game based on the following description\nPlayers alternate making a move. White plays with the white stones and makes the first move, Black plays with the black stones. On his turn, a player may choose either a) to place a stone on the board without contact to other stones of his color in order to start a new group, or b) to grow all possible groups by one stone. When you grow your groups in this implementation, you place grey stones adjacent to your groups until each of your groups is adjacent to exactly one grey stone. At no point may a group of yours be adjacent to more than one grey stone. When your turn ends, all grey stones are replaced with stones of your color.\n \n For balancing, there is an extra rule: Black is allowed to grow all his groups and place a single stone as long as neither player has not yet grown any groups.\n \nThe game ends when the board is filled in. The score is the number of stones each player has on the board minus 'P' times the number of groups he has, where 'P' is en even number of 4 or higher (the Ludii implementation also allows 0 and 2 as values of 'P'). With an even penalty and an odd boardsize, draws are not possible. A size 19 board is currently selected A group penalty of 10 points is currently selected\n\n###\n\n", "completion": "(define \"UpdateScore\" (set Score Mover (- (count Sites in:(sites Occupied by:Mover)) (* 10 (count Groups Orthogonal if:(is Mover (who at:(to)))))))) (define \"Grow\" (\"PlaceGrey\" (then (if (can Move (\"PlaceGrey\" ~)) (moveAgain) (do (\"ReplaceAllGrey\") next:(\"UpdateScore\")))))) (define \"ReplaceAllGrey\" (add (to (sites Occupied by:Neutral) (apply (remove (to)))) (then (if (!= 1 (var \"HasGrown\")) (and (set Var \"HasGrown\" 1) (if (= (id P2) (mover)) (and (set Var \"MoveThatMustBePlant\" (count Moves)) (moveAgain)))))))) (define \"PlaceGrey\" (do (move Add (piece \"Marker0\") (to (sites Empty) if:(< 0 (count Sites in:(sites Around (to) Own Orthogonal))))) ifAfterwards:(all Groups Orthogonal of:(is Mover (who at:(to))) if:(> 2 (count Sites in:(intersection (sites Around (sites) NotEmpty Orthogonal) (sites Occupied by:Neutral))))) #1)) (define \"Plant\" (move Add (to (sites Empty) if:(= 0 (count Sites in:(sites Around (to) Own Orthogonal)))) (then (\"UpdateScore\")))) (game \"Symple\" (players 2) (equipment { (board (square 19) use:Vertex) (piece \"Marker\" Each) (piece \"Marker\" Neutral)}) (rules (play (if (= (count Moves) (var \"MoveThatMustBePlant\")) (\"Plant\") (if (= 0 (count MovesThisTurn)) (or (\"Plant\") (\"Grow\")) (\"Grow\")))) (end (if (is Full) (byScore))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nHeXentafl can be played on a 4x4 or 5x5 hex grid.\n \n For the 4x4 version:\n The King sits on the central space, the throne, surrounded by three defenders. Six attackers sit on the outer corners of the grid.\n The attackers must capture the King in order to win. The defenders must escort the King to any of the six corners of the board in order to win.\n \n All pieces except the King move in a\n straight line, as many spaces as they like to an unoccupied space (like a rook in Chess). Only one piece at a time can occupy a space. A piece cannot jump over another piece.\n The King can move into any vacant adjacent space, moving one space at a time (similar to the king in Chess).\n \n Pieces are captured by surrounding them on two sides. Except for the corners, the pieces can be captured by surrounding them with two pieces which are not adjacents. You cannot \\ The game is played on a 4x4 hex board.\n\n###\n\n", "completion": "(define \"Throne\" (centrePoint)) (define \"JarlWasCaptured\" (\"IsOffBoard\" (where \"Jarl\" P1))) (define \"SurroundThrone\" (surround (from (last To)) Orthogonal (between if:(and { (= (between) (\"Throne\")) (\"IsPieceAt\" \"Jarl\" P1 (between)) (\"PiecesSurroundingAreNotAdjacent\")}) (apply (remove (between)))) (to if:(\"IsFriendAt\" (to))) except:3)) (define \"SurroundCorners\" (surround (from (last To)) Orthogonal (between if:(and { (is In (between) (sites \"Fortresses\")) (\"IsEnemyAt\" (between)) (\"PiecesSurroundingAreNotAdjacent\")}) (apply (remove (between)))) (to if:(\"IsFriendAt\" (to))) except:1)) (define \"PiecesSurroundingAreNotAdjacent\" (all Sites (sites Around (between) Own) if:(all Sites (sites Around (site) Own) if:(not (is In (to) (sites Around (between) Own)))))) (define \"Custodial\" (custodial (from (last To)) Orthogonal (between (max 1) if:(and (!= (between) (\"Throne\")) (\"IsEnemyAt\" (between))) (apply (remove (between)))) (to if:(\"IsFriendAt\" (to))))) (game \"HeXentafl\" (players 2) (equipment { (board (rotate 90 (hex 4))) (piece \"Thrall\" P1 (move Slide (between if:(and (!= (between) (\"Throne\")) (is Empty (between)))) (then (and (\"SurroundCorners\") (\"Custodial\"))))) (piece \"Thrall\" P2 (move Slide (between if:(and (!= (between) (\"Throne\")) (is Empty (between)))) (then (and {(\"SurroundThrone\") (\"SurroundCorners\") (\"Custodial\")})))) (piece \"Jarl\" P1 (move Step (to if:(is Empty (to))) (then (and (\"SurroundCorners\") (\"Custodial\"))))) (regions \"Fortresses\" (sites Corners))}) (rules (start { (place \"Jarl1\" (\"Throne\")) (place \"Thrall2\" (sites \"Fortresses\")) (place \"Thrall1\" {\"D3\" \"C4\" \"E5\"})}) (play (forEach Piece)) (end { (\"PieceTypeReachWin\" \"Jarl1\" (sites \"Fortresses\") P1) (if \"JarlWasCaptured\" (result P2 Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\n4x8 board. Two counters in each hole. Opening play: Two players play simultaneously, lifting and sowing counters from their outer rows. Rules for sowing and capturing are the same as in the main phase of the game. Sowing cannot begin from the fourth or fifth hole from the left in the player's outer hole. Players play until both drop the final counter in an empty hole, the first to do so plays first in the main phase. Players then move alternately. Main phase: Play begins from any hole on the player's side of the board with counters in it. Singletons cannot move. Sowing happens in an anti-clockwise direction. If the last counter lands in an empty hole, the turn is over. For capturing: Holes are in 'opposition' when one player has the front row hole occupied and the opponent has both of the holes opposite it occupied. If the last hole in a sowing is in opposition, the player takes the counters in both of the opponent's holes and places them in the empty hole from which the player lifted the counters. The player then sows the captured counters from this hole. Further captures in the sowing can occur in the same way. However, each player has two hole from which clockwise plays can be made: the leftmost hole in the outer row and the second from the left in the inner row. Clockwise moves can only be made from these holes if they immediately lead to a capture. When the captured counters are sown, starting from the same hole, they can also be sown clockwise if they lead to a capture. If they cannot lead to a capture, they are sown anti-clockwise. Another alternative the player has is that, if the player plays clockwise from one of these holes and therefore makes a capture, the captured counters may be placed in the hole and left there, and the player may play instead from the other hole from which clockwise captures are allowed in a clockwise direction, if it leads to a capture. The player may continue playing from this hole as above until the possibilities to move are exhausted, and then may move from any hole in an anti-clockwise direction. Multiple captures can only be made in a clockwise direction from these holes if it is made on the first sowing of the turn. Otherwise, only one clockwise capture can be made and sowing must proceed in an anti-clockwise direction. If the last counter lands on a hole that is occupied but not in opposition, these counters are picked up and sowing continues. Play ends when one player captures all the opponent's counters or one player cannot play. The player who cannot play loses. A player may also win by capturing the counters from both of the opponent's end holes in the inner row in a single turn. \n\n###\n\n", "completion": "(define \"NextHole\" (\"NextSiteOnTrack\" #3 from:#1 #2)) (define \"OuterPhaseOppositePit\" (if (is Mover P1) (+ (to) (* 3 (\"Columns\"))) (- (to) (* (\"Columns\") 3)))) (define \"Columns\" 8) (game \"Mweiso\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" 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\" \"24,E,S1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"TrackCCW1\")) (regions \"Home\" P2 (sites Track \"TrackCCW2\")) (regions \"Inner\" P1 (difference (sites Track \"TrackCCW1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"TrackCCW2\") (sites Top))) (regions \"Outer\" P1 (difference (sites Bottom) (sites {3 4}))) (regions \"Outer\" P2 (difference (sites Top) (sites {27 28}))) (map \"LeftMostOuter\" {(pair P1 0) (pair P2 31)}) (map \"SecondLeftInner\" {(pair P1 9) (pair P2 22)}) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 2 to:(union (sites P1 \"Home\") (sites P2 \"Home\")))) phases:{ (phase \"OuterPhase\" (play (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (sites Mover \"Outer\")) if:(if (\"SameTurn\") (< 0 (count at:(from))) (< 1 (count at:(from))))) (then (sow \"TrackCCW\" owner:(mover) apply: (if (< 1 (count at:(to))) (and (moveAgain) (if (and { (is Occupied (\"OppositePit\" (to))) (is Occupied (\"OppositeOuterPit\" (to))) (is In (to) (sites Mover \"Inner\"))}) (and { (fromTo (from (\"OppositePit\" (to))) (to (last From)) count:(count at:(\"OppositePit\" (to)))) (fromTo (from (\"OppositeOuterPit\" (to))) (to (last From)) count:(count at:(\"OppositeOuterPit\" (to)))) (set Var \"Replay\" (from))}) (set Var \"Replay\" (to))))))))) (nextPhase Mover (= 1 (count at:(last To afterConsequence:True))) \"MainPhase\")) (phase \"MainPhase\" (play (or (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (sites {(mapEntry \"LeftMostOuter\" Mover) (mapEntry \"SecondLeftInner\" Mover)})) if:(and { if:(if (\"SameTurn\") (< 0 (count at:(from))) (< 1 (count at:(from)))) (is In (from) (sites {(mapEntry \"LeftMostOuter\" Mover) (mapEntry \"SecondLeftInner\" Mover)})) (is In (\"NextHole\" (from) \"TrackCW\" (count at:(from))) (sites Mover \"Inner\")) (is Occupied (\"OppositePit\" (\"NextHole\" (from) \"TrackCW\" (count at:(from))))) (is Occupied (\"OppositeOuterPit\" (\"NextHole\" (from) \"TrackCW\" (count at:(from)))))})) (then (sow \"TrackCW\" owner:(mover) apply: (if (< 1 (count at:(to))) (and (moveAgain) (if (and { (is Occupied (\"OppositePit\" (to))) (is Occupied (\"OppositeOuterPit\" (to))) (is In (to) (sites Mover \"Inner\"))}) (and { (fromTo (from (\"OppositePit\" (to))) (to (last From)) count:(count at:(\"OppositePit\" (to)))) (fromTo (from (\"OppositeOuterPit\" (to))) (to (last From)) count:(count at:(\"OppositeOuterPit\" (to)))) (set Var \"Replay\" (from))}) (set Var \"Replay\" (to)))))))) (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (sites Mover)) if:(if (\"SameTurn\") (< 0 (count at:(from))) (< 1 (count at:(from))))) (then (sow \"TrackCCW\" owner:(mover) apply: (if (< 1 (count at:(to))) (and (moveAgain) (if (and { (is Occupied (\"OppositePit\" (to))) (is Occupied (\"OppositeOuterPit\" (to))) (is In (to) (sites Mover \"Inner\"))}) (and { (fromTo (from (\"OppositePit\" (to))) (to (last From)) count:(count at:(\"OppositePit\" (to)))) (fromTo (from (\"OppositeOuterPit\" (to))) (to (last From)) count:(count at:(\"OppositeOuterPit\" (to)))) (set Var \"Replay\" (from))}) (set Var \"Replay\" (to)))))))))) (end (\"BlockWin\")))})) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6 board. Four counters per hole. Each player takes their first turn from their leftmost hole. Sowing occurs in an anti-clockwise direction. If the final counter falls into an occupied hole, these are picked up and sowing continues. If the final counter falls into an empty hole, the turn ends. At any time during the sowing, if a hole is made to contain four counters, the owner of the hole in which the four counters are located captures them, unless it is the final hole of the sowing, in which case the player who is sowing captures them. The captures happen immediately. If a player does not capture when they should have, and a subsequent sowing causes this hole to contain five counters, it becomes a Jen. Players can no longer capture from a Jen in the same manner as before. Captures are made from it when the final counter of a sowing lands in it, in which case the final counter and one counter from the Jen are captured by the player who is sowing. Play continues until a player can no longer move because there are no counters in their row, and the opponent captures the remaining counters. 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 \"LeftMostEmpty\" (trackSite FirstSite \"Track\" from:(mapEntry \"LeftMost\" Mover) if:(is Empty (to)))) (define \"RememberOwnedHolesRandom\" (if (< 50 (value Random (range 1 100))) (remember Value \"OwnedP1\" #1) (remember Value \"OwnedP2\" #1))) (define \"OwnedHoles\" (if (is Mover P1) (sites (values Remembered \"OwnedP1\")) (sites (values Remembered \"OwnedP2\")))) (define \"RemmemberOwnedHoles\" (if (is Mover P1) (remember Value \"OwnedP1\" #1) (remember Value \"OwnedP2\" #1))) (define \"NoPieceOnOwnedHolesP2\" (all Sites (sites (values Remembered \"OwnedP2\")) if:(= 0 (count at:(site))))) (define \"NoPieceOnOwnedHolesP1\" (all Sites (sites (values Remembered \"OwnedP1\")) if:(= 0 (count at:(site))))) (define \"NextHole\" (\"NextSiteOnTrack\" #2 from:#1 \"Track\")) (game \"Gabata (Ghinda)\" (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)) (map \"LeftMost\" {(pair P1 0) (pair P2 11)})}) (rules (start { (set RememberValue \"OwnedP1\" (sites Bottom)) (set RememberValue \"OwnedP2\" (sites Top)) (set Count 4 to:(sites Track \"Track\"))}) phases:{ (phase \"Sowing\" (play (or { (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (if (= 1 (value Player Mover)) (\"OwnedHoles\") (sites {(mapEntry \"LeftMost\" Mover)}))) if:(is Occupied (from))) (then (and (do (set Var \"NumSowed\" (count at:(last To))) next:(sow apply:(if (< 1 (count at:(to))) (if (= 4 (count at:(to))) (fromTo (from (to)) (to (handSite Mover)) count:4) (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 (site) (sites (values Remembered \"OwnedP1\"))) (handSite P1) (handSite P2))) count:4))) (set Var \"NumSowed\" 0)))) (if (!= 1 (value Player Mover)) (set Value Mover 1)))))} (then (if (or (\"NoPieceOnOwnedHolesP1\") (\"NoPieceOnOwnedHolesP2\")) (and { (if (\"NoPieceOnOwnedHolesP2\") (forEach Site (sites Board) (fromTo (from (site)) (to (handSite P1)) count:(count at:(site)))) (forEach Site (sites Board) (fromTo (from (site)) (to (handSite P2)) count:(count at:(site))))) (forget Value \"OwnedP1\" All) (forget Value \"OwnedP2\" 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 (\"LeftMostEmpty\")) count:4 (then (and { (\"RemmemberOwnedHoles\" (last To)) (if (<= 4 (count Cell at:(handSite Mover))) (moveAgain) (if (= 3 (count Cell at:(handSite Mover))) (and { (fromTo (from (handSite Mover)) (to (\"LeftMostEmpty\")) count:3) (fromTo (from (handSite Next)) (to (\"LeftMostEmpty\")) count:1) (\"RemmemberOwnedHoles\" (\"LeftMostEmpty\"))}) (if (= 2 (count Cell at:(handSite Mover))) (and { (fromTo (from (handSite Mover)) (to (\"LeftMostEmpty\")) count:2) (fromTo (from (handSite Next)) (to (\"LeftMostEmpty\")) count:2) (\"RememberOwnedHolesRandom\" (\"LeftMostEmpty\"))}))))}))))) (nextPhase (and (is Empty (handSite P1)) (is Empty (handSite P2))) \"Sowing\"))})) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"Ilpion\" (players 2) (equipment { (board (graph vertices:{ {1 0.5} {3 0} {5 0} {6 0} {7 0} {8 0} {10 0} {11 0} {12 3} {0 2} {3 2} {5 2} {8 2} {8.5 2} {2 3} {7 3} {1 4} {12 4} {2 5} {5 5} {10 5} {10 8} {2 7} {6 7} {8 7} {0 10} {2 9} {5 9} {10 9} {1 10} {5 14} {10 10} {1 12} {4 12} {7 14} {9 12}} edges:{ {0 10} {1 10} {2 11} {3 11} {4 12} {5 12} {6 13} {7 13} {8 13} {10 19} {16 9} {9 10} {11 19} {15 12} {12 20} {13 20} {13 17} {14 18} {18 19} {19 23} {20 23} {20 24} {21 24} {23 26} {22 26} {26 33} {26 32} {32 29} {29 25} {23 27} {27 34} {30 34} {27 35} {31 35} {27 28}}) use:Vertex) (piece \"Disc\" Each) (piece \"Marker\" Shared)}) (rules (start { (set Shared Edge (sites Board Edge))}) (play (forEach Site (sites Board) (if (> (count Sites in:(sites Incident Edge of:Vertex at:(to) Shared)) 0) (move Add (to (intersection (sites Empty) (sites {(to)}))) (then (and (if (is TreeCentre Shared) (addScore Mover 1)) (forEach Site (sites Incident Edge of:Vertex at:(last To)) (remove Edge (to))))))))) (end (if (no Moves Mover) (byScore)))))\n\n###\n\n", "completion": "Players take turns adding his friendly colour in an uncoloured vertex. The aim of each player is to colour the centre vertex of the coloured tree. It is a scoring based game, and it has two versions. At the centroid version, each player gets one point for correctly coloured a tree centre. In the second version is the degree version, where a player gets a score, which is equal to the degree of his last coloured tree centre. For both versions, all the incident edges of last move are uncoloured. So the tree is divided into subtrees. The game ends when there is no coloured tree available. The player with the highest score wins. The scoring is based on centroid. The version of the game played with 2 players. END" }, { "prompt": "Construct a Ludii game based on the following description\nEach turn, a player selects a graph element (vertex or edge) to create a disjoint path with size k. When a player successfully makes a path of a specific size, he gets a point. The player with the highest score wins the game. The players play on edges of the graph.\n\n###\n\n", "completion": "(game \"DisPath\" (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} {1 6} {1 2} {2 7} {2 3} {3 8} {3 4} {4 9} {5 6} {5 10} {6 11} {6 7} {7 12} {7 8} {8 13} {8 9} {9 14} {10 11} {11 12} {12 13} {13 14} {10 15} {11 16} {12 17} {13 18} {14 19} {15 16} {15 20} {16 21} {20 21} {16 17} {17 22} {21 22} {17 18} {18 23} {22 23} {18 19} {19 24} {23 24}}) use:Vertex)}) (rules (play (or (move Add (to Edge (sites Empty Edge)) (then (if (is Path Edge Mover length:(exact 3)) (addScore Mover 1)))) (move Pass))) (end (if (all Passed) (byScore))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x5 board. Five counters in each hole. Sowing occurs in an anti-clockwise direction. When the final counters of a sowing lands in a hole, the contents of the next hole are picked up and sowing continues. When the final counter lands in a hole, and the next hole, from which sowing would normally continue, is empty, the player captures any counters in the next hole after the empty one. and the turn ends. Play continues until no more captures are possible, and the player who captured the most counters wins. \n\n###\n\n", "completion": "(define \"LastHoleSowed\" (sites {(value Pending)})) (define \"NextNextHole\" (\"NextSiteOnTrack\" 2 from:(to))) (define \"NextHole\" (\"NextSiteOnTrack\" 1 from:(to))) (define \"PiecesOwnedBy\" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (game \"Pachgarhwa\" (players 2) (equipment { (mancalaBoard 2 5 store:None (track \"Track\" \"0,E,N,W\" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 5 to:(sites Track))) (play (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover)) if:(> (count at:(from)) 0)) (then (sow if:True apply:(if (is Occupied (\"NextHole\")) (and { (set Pending (to)) (fromTo (from (\"NextHole\")) (to (handSite Mover)) count:(count at:(\"NextHole\"))) (moveAgain)}) (if (is Occupied (\"NextNextHole\")) (fromTo (from (\"NextNextHole\")) (to (handSite Mover)) count:(count at:(\"NextNextHole\"))))))))) (end (\"MancalaByScoreWhen\" (= 1 (count in:(sites Board))))))) 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. Sticks are used to play, (five per player), and are played in the spaces between corn kernels. Dice are also corn kernels, with one side marked with a black dot. Four dice are used, the value of a move determined by the number of black dots that land face up. Each player has two throws on their turn, and moves after the second throw. The throws both must be used, and can be used in any order. Each team's home is the side of the board to their left. Each team moves toward the opposite end of the track, exiting at the opposing team's home. All of the players on one team play in succession, and then the players on the other team play next. Players enter the men on their throws and move along the track. Each player may have only one piece on the board at a time. When a player reaches the opposing team's home field, the piece may be re-entered on that player's team's own home field. Reaching the home field does not require an exact throw, and if one throw brings a player home, they may use the second throw to enter it again. If a piece lands on that of an opponent, it is captured. The captured piece is placed on top of the piece that captured it, and the stack continues toward the opposing team's home space. If the player successfully carries the captured piece to the opposing team's home space, the piece is permanently captured and removed from play. If the opposing side lands on the same space as the stack, they are stacked with the opponent's piece, and the opponent begins carrying the stack to the their opposing team's side. Any pieces captured belonging to the team which brings them off the board are returned to their players. Pieces belonging to the same team may occupy the same space with no consequence for the game. When one team has no more counters left to enter, the winner is the team that captured most of the opposing team's pieces.\n 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 \"ThrowValue\" (count Pips)) (game \"Aj Sakakil\" (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)} 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))) (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)) (apply (forget Value \"Throws\" (value)))) (then (if (\"AtLeastAnEnemyPieceThere\" (last To)) (\"CaptureMove\")))))) (if (\"CapturingPiece\" (state at:(from) level:(level))) (if (\"IsOffBoard\" (\"NextSiteOnTrack\" (value) from:(from))) (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)) (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 (if (< 0 (size Array (values Remembered \"Throws\"))) (moveAgain))))) (nextPhase (= 0 (size Array (values Remembered \"Throws\"))) \"ThrowPhase\"))} (end (\"CaptureAllTeam\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayers 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. The game is played on a 11x11 board. The board is a diamond tiling by hexagon. The game uses the swap rule. The first player to connect their two sides wins. The connection between two stones is using all the diagonal directions.\n\n###\n\n", "completion": "(game \"Diagonal 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 Diagonal Mover) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayed on cross-shaped board, made of five squares, each divided into four squares and with the diagonals of the larger squares drawn. One player plays as thirteen hens, which begin on the points on one of the arms of the cross and along the line immediately perpendicular to that arm. The other player plays as one fox, which can be placed on any empty point of the board. Players alternate turns moving to an empty adjacent spot along the lines of the board. The hens, however, can only move in a forward direction. The fox may hop over an adjacent hen to an empty spot immediately on the opposite side of the hen along the lines of the board. The fox wins by capturing all the hens, the hens win by blocking the fox from being able to move. \n\n###\n\n", "completion": "(game \"Jeu du Renard et de la Poule\" (players 2) (equipment { (\"CrossBoard\" 3 7 use:Vertex diagonals:Alternating) (hand P1) (piece \"Fox\" P1 (or (\"HopSequenceCapture\") \"StepToEmpty\")) (piece \"Hen\" P2 N \"StepForwardsToEmpty\")}) (rules (start { (place \"Fox1\" (handSite P1)) (place \"Hen2\" (union (expand (sites Bottom)) (sites Row 2)))}) phases:{ (phase \"Placement\" P1 (play (move (from (handSite P1)) (to (sites Empty)))) (nextPhase (\"HandEmpty\" P1) \"Movement\")) (\"PhaseMovePiece\" \"Movement\")} (end (\"NoMovesLossAndNoPiecesPlayerLoss\" P2)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nInitially, there is a number of edges in a plane, where some of them cross each other. At each turn, a player selects an edge to remove it and all of its intersecting edges. The number of edges with which a selected edge intersects is added to the player's score. When there are no moves left, the game is over. Finally, the player with the highest score wins. The version of the game played with 2 players.\n\n###\n\n", "completion": "(game \"Line and Cross\" (players 2) (equipment { (board (graph vertices:{{2 0} {1 1} {4 1} {7 1} {10 1} {0 2} {2 2} {3 2} {5 2} {9 2} {0 3} {6 3} {7 3} {9 3} {10 3} {11 3} {2 4} {4 4} {6 4} {7 4} {8 4} {10 4} {12 4} {7 5} {9 5} {11 5} {13 5} {1 6} {2 6} {4 6} {6 6} {8 6} {10 6} {12 6} {14 6}} edges:{ {0 6} {5 7} {1 27} {10 11} {2 17} {16 28} {8 9} {3 12} {17 19} {18 30} {29 30} {23 24} {20 31} {13 15} {4 14} {21 32} {25 26} {22 33} {33 34} {1 2} {6 16} {16 17} {27 29} {11 18} {12 19} {19 23} {19 20} {21 22} {15 25} {13 24}}) use:Edge) (piece \"Marker\" Shared)}) (rules (start { (set Shared Edge (sites Board Edge))}) (play (move Remove (sites Occupied by:Shared) (then (and (remove Edge (last To)) (forEach Site (sites Crossing at:(last To) All) (and (remove Edge (to)) (addScore Mover 1))))))) (end (if (no Moves Next) (byScore))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n5x5 board. Twelve pieces per player. Players alternate turns placing a piece on the board or moving a piece already on the board. Pieces move one space in any orthogonal direction. A player may capture an opponent's piece by hopping over it to an empty space on the other side of it. When a capture is made in this fashion, the player chooses another piece belonging to the opponent to capture in addition. The player who captures all of the opponent's pieces wins. \n\n###\n\n", "completion": "(define \"RemoveEnemyPiece\" (move Remove (sites Occupied by:Next container:\"Board\"))) (game \"Yote\" (players 2) (equipment { (board (square 5)) (piece \"Marker\" Each (or (\"StepOrthogonalToEmpty\") (\"HopCapture\" ~ ~ (then (moveAgain))))) (hand Each)}) (rules (start (place \"Marker\" \"Hand\" count:12)) (play (if \"SameTurn\" \"RemoveEnemyPiece\" (or (if (\"HandOccupied\" Mover) (move (from (handSite Mover)) (to (sites Empty)))) (forEach Piece)))) (end (\"CaptureAll\" Next)))) 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": "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": "Modify the Ludii game according to the following option changes:\nBase 3 hexagonal board of triangles -> Base 5 square board\n(define \"CombinedGroupCounts\" ( + { (* 10000 (count Groups Orthogonal #1)) (* 100 (- (count Groups Orthogonal #1) (count Groups Orthogonal #1 min:3))) (- (- (count Groups Orthogonal #1) (count Groups Orthogonal #1 min:5)) (- (count Groups Orthogonal #1) (count Groups Orthogonal #1 min:3)))})) (game \"Hermit\" (players 2) (equipment { (board (tri Hexagon 3) use:Vertex) (piece \"Marker\" Each) (piece \"Marker\" Neutral)}) (rules (start { (set Score P1 0) (set Score P2 0)}) (play (do (move Add (to (sites Empty))) ifAfterwards: (or { (= 1 (size Group at:(last To) Orthogonal)) (= 3 (size Group at:(last To) Orthogonal)) (= 5 (size Group at:(last To) Orthogonal))}) (then (addScore Mover (- (\"CombinedGroupCounts\" if:(= (who at:(to)) (mover))) (score Mover)))))) (end (if (all Passed) { (if (> (\"CombinedGroupCounts\" if:(= (who at:(to)) P1)) (\"CombinedGroupCounts\" if:(= (who at:(to)) P2))) (result P1 Win)) (if (< (\"CombinedGroupCounts\" if:(= (who at:(to)) P1)) (\"CombinedGroupCounts\" if:(= (who at:(to)) P2))) (result P2 Win))} (result Mover Win)))))\n\n###\n\n", "completion": "(define \"CombinedGroupCounts\" ( + { (* 10000 (count Groups Orthogonal #1)) (* 100 (- (count Groups Orthogonal #1) (count Groups Orthogonal #1 min:3))) (- (- (count Groups Orthogonal #1) (count Groups Orthogonal #1 min:5)) (- (count Groups Orthogonal #1) (count Groups Orthogonal #1 min:3)))})) (game \"Hermit\" (players 2) (equipment { (board (square 5) use:Vertex) (piece \"Marker\" Each) (piece \"Marker\" Neutral)}) (rules (start { (set Score P1 0) (set Score P2 0)}) (play (do (move Add (to (sites Empty))) ifAfterwards: (or { (= 1 (size Group at:(last To) Orthogonal)) (= 3 (size Group at:(last To) Orthogonal)) (= 5 (size Group at:(last To) Orthogonal))}) (then (addScore Mover (- (\"CombinedGroupCounts\" if:(= (who at:(to)) (mover))) (score Mover)))))) (end (if (all Passed) { (if (> (\"CombinedGroupCounts\" if:(= (who at:(to)) P1)) (\"CombinedGroupCounts\" if:(= (who at:(to)) P2))) (result P1 Win)) (if (< (\"CombinedGroupCounts\" if:(= (who at:(to)) P1)) (\"CombinedGroupCounts\" if:(= (who at:(to)) P2))) (result P2 Win))} (result Mover Win))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game has 3 players. -> The game has 4 players.\n(define \"MadeACompleteCircuit\" (if (= 1 (state at:(where \"Stick\" Mover))) (is In (value Piece at:(where \"Stick\" Mover)) (sites Track \"TrackCCW\" from:(\"NextSite\" (last From) \"TrackCCW\") to:(last To))) (is In (value Piece at:(where \"Stick\" Mover)) (sites Track \"TrackCW\" from:(\"NextSite\" (last From) \"TrackCW\") to:(last To))))) (define \"MoveOn\" (if (\"IsNotOffBoard\" #1) (if (or (is Empty #1) (\"IsEnemyAt\" #1)) (move (from (from) level:(level)) (to #1 (\"HittingCapture\" (value Piece at:((to))))))))) (define \"NextSite\" (\"NextSiteOnTrack\" 1 from:#1 #2)) (define \"SiteToMoveOnSelectedTrack\" (if (= (state at:(from)) 1) (\"NextSiteOnTrack\" #1 \"TrackCCW\") (\"NextSiteOnTrack\" #1 \"TrackCW\"))) (define \"ThrowValue\" (mapEntry \"ThrowDiceValue\" (count Pips))) (game \"Tsaydithl\" (players 3) (equipment { (\"FortyStonesWithFourGapsBoard\" { (track \"TrackCW\" {39 35 33 31 29 27 25 23 21 19 38 17 15 13 11 9 7 5 3 1 37 0 2 4 6 8 10 12 14 16 36 18 20 22 24 26 28 30 32 34} loop:True) (track \"TrackCCW\" {39 34 32 30 28 26 24 22 20 18 36 16 14 12 10 8 6 4 2 0 37 1 3 5 7 9 11 13 15 17 38 19 21 23 25 27 29 31 33 35} loop:True)}) (piece \"Stick\" Each (or (if (= 2 (\"ThrowValue\")) (\"MoveOn\" (\"SiteToMoveOnSelectedTrack\" (- (\"ThrowValue\") 1)))) (\"MoveOn\" (\"SiteToMoveOnSelectedTrack\" (\"ThrowValue\"))))) (regions \"Gates\" (sites {36..39})) (map \"ThrowDiceValue\" {(pair 0 5) (pair 1 3) (pair 2 2) (pair 3 10)}) (\"StickDice\" 3) (hand Each)}) (rules (start { (place \"Stick1\" 36 state:1 value:36) (place \"Stick2\" 38 state:2 value:38) (place \"Stick3\" 37 state:1 value:37)}) (play (\"RollMove\" (forEach Piece))) (end (if (\"MadeACompleteCircuit\") (result Mover Win)))))\n\n###\n\n", "completion": "(define \"MadeACompleteCircuit\" (if (= 1 (state at:(where \"Stick\" Mover))) (is In (value Piece at:(where \"Stick\" Mover)) (sites Track \"TrackCCW\" from:(\"NextSite\" (last From) \"TrackCCW\") to:(last To))) (is In (value Piece at:(where \"Stick\" Mover)) (sites Track \"TrackCW\" from:(\"NextSite\" (last From) \"TrackCW\") to:(last To))))) (define \"MoveOn\" (if (\"IsNotOffBoard\" #1) (if (or (is Empty #1) (\"IsEnemyAt\" #1)) (move (from (from) level:(level)) (to #1 (\"HittingCapture\" (value Piece at:((to))))))))) (define \"NextSite\" (\"NextSiteOnTrack\" 1 from:#1 #2)) (define \"SiteToMoveOnSelectedTrack\" (if (= (state at:(from)) 1) (\"NextSiteOnTrack\" #1 \"TrackCCW\") (\"NextSiteOnTrack\" #1 \"TrackCW\"))) (define \"ThrowValue\" (mapEntry \"ThrowDiceValue\" (count Pips))) (game \"Tsaydithl\" (players 4) (equipment { (\"FortyStonesWithFourGapsBoard\" { (track \"TrackCW\" {39 35 33 31 29 27 25 23 21 19 38 17 15 13 11 9 7 5 3 1 37 0 2 4 6 8 10 12 14 16 36 18 20 22 24 26 28 30 32 34} loop:True) (track \"TrackCCW\" {39 34 32 30 28 26 24 22 20 18 36 16 14 12 10 8 6 4 2 0 37 1 3 5 7 9 11 13 15 17 38 19 21 23 25 27 29 31 33 35} loop:True)}) (piece \"Stick\" Each (or (if (= 2 (\"ThrowValue\")) (\"MoveOn\" (\"SiteToMoveOnSelectedTrack\" (- (\"ThrowValue\") 1)))) (\"MoveOn\" (\"SiteToMoveOnSelectedTrack\" (\"ThrowValue\"))))) (regions \"Gates\" (sites {36..39})) (map \"ThrowDiceValue\" {(pair 0 5) (pair 1 3) (pair 2 2) (pair 3 10)}) (\"StickDice\" 3) (hand Each)}) (rules (start { (place \"Stick1\" 36 state:1 value:36) (place \"Stick2\" 38 state:2 value:38) (place \"Stick3\" 37 state:1 value:37) (place \"Stick4\" 39 state:2 value:39)}) (play (\"RollMove\" (forEach Piece))) (end (if (\"MadeACompleteCircuit\") (result Mover Win))))) 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 Ludii game based on the following description\n3x3 board. Each player plays with three Horse-shaped pieces, which begin on the row of squares closest to the player. Pieces move one space forward and one space diagonally, jumping over any intervening pieces. The first player to place their pieces in the squares where the opponent started wins. \n\n###\n\n", "completion": "(game \"Aralzaa\" (players 2) (equipment { (board (square 3)) (piece \"Knight\" Each (\"LeapToEmpty\" \"KnightWalk\")) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start { (place \"Knight1\" (sites P1)) (place \"Knight2\" (sites P2))}) (play (forEach Piece)) (end (\"FillWin\" (sites Next))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nOrder 3-4, Hex Grid -> Order 4, Hex Grid\n(define \"AddOrPass\" (or { (move Add (piece (id \"Disc\" Mover)) (to (sites Empty) if:(> 3 (count Pieces Mover in:(sites Around (to) \"GridDirection\")))) (then (set Var \"Added\" 1))) (move Pass)})) (define \"Score4\" (do (forEach Site (sites Occupied by:#1) (if (> 3 (count Pieces #1 in:(sites Around (site) \"GridDirection\"))) (set State at:(site) 0) (set State at:(site) 1))) next:(do (and { (remember Value 0) (remember Value 0) (forEach Group \"GridDirection\" (if (no Pieces in:(intersection (sites) (sites State 1))) (remember Value (count Sites in:(sites)))))}) next:(set Var \"TopValue\" (max (values Remembered)) (then (forget Value (max (values Remembered)) (then (set Score #1 (* (var \"TopValue\") (max (values Remembered))) (then (forget Value All)))))))))) (define \"GridDirection\" Orthogonal) (game \"Wrigglers\" (players 2) (equipment { (board (tri Limping 3) use:Vertex) (piece \"Disc\" Each)}) (rules (play (if (= 1 (var \"Added\")) (or { \"AddOrPass\" (forEach Piece (if (< 2 (count Pieces Mover in:(sites Around (from) \"GridDirection\"))) (move Remove (from) (then (set Var \"Added\" 0)))) Mover)}) \"AddOrPass\" (then (\"Score4\" Mover)))) (end (if (all Passed) { (if (>= (score Mover) (score Next)) (result Mover Win))} (result Next Win)))))\n\n###\n\n", "completion": "(define \"AddOrPass\" (or { (move Add (piece (id \"Disc\" Mover)) (to (sites Empty) if:(> 3 (count Pieces Mover in:(sites Around (to) \"GridDirection\")))) (then (set Var \"Added\" 1))) (move Pass)})) (define \"Score4\" (do (forEach Site (sites Occupied by:#1) (if (> 3 (count Pieces #1 in:(sites Around (site) \"GridDirection\"))) (set State at:(site) 0) (set State at:(site) 1))) next:(do (and { (remember Value 0) (remember Value 0) (forEach Group \"GridDirection\" (if (no Pieces in:(intersection (sites) (sites State 1))) (remember Value (count Sites in:(sites)))))}) next:(set Var \"TopValue\" (max (values Remembered)) (then (forget Value (max (values Remembered)) (then (set Score #1 (* (var \"TopValue\") (max (values Remembered))) (then (forget Value All)))))))))) (define \"GridDirection\" Orthogonal) (game \"Wrigglers\" (players 2) (equipment { (board (tri Hexagon 4) use:Vertex) (piece \"Disc\" Each)}) (rules (play (if (= 1 (var \"Added\")) (or { \"AddOrPass\" (forEach Piece (if (< 2 (count Pieces Mover in:(sites Around (from) \"GridDirection\"))) (move Remove (from) (then (set Var \"Added\" 0)))) Mover)}) \"AddOrPass\" (then (\"Score4\" Mover)))) (end (if (all Passed) { (if (>= (score Mover) (score Next)) (result Mover Win))} (result Next Win))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game is played with no constraint on the centre site. -> The constraint to move a piece adjacent to an enemy is applied only for the first move.\n(define \"MoveOnlyIfAdjacentToEnemy\" (move Step (to if:(and (\"IsEmpty\") (is Related Adjacent (from) (sites Occupied by:Next)))))) (define \"MoveOnlyIfAdjacentToEnemyOrCentre\" (move Step (to if:(and (\"IsEmpty\") (or (not \"Centre\") (is Related Adjacent (from) (sites Occupied by:Next))))))) (define \"Centre\" (= (to) (centrePoint))) (define \"IsEmpty\" (is Empty (to))) (game \"Mu Torere\" (players 2) (equipment { (board (concentric {1 8}) use:Vertex) (piece \"Marker\" Each \"StepToEmpty\")}) (rules (start { (place \"Marker1\" {1..3 8}) (place \"Marker2\" {4..7})}) (play (forEach Piece)) (end (\"NoMoves\" Loss))))\n\n###\n\n", "completion": "(define \"MoveOnlyIfAdjacentToEnemy\" (move Step (to if:(and (\"IsEmpty\") (is Related Adjacent (from) (sites Occupied by:Next)))))) (define \"MoveOnlyIfAdjacentToEnemyOrCentre\" (move Step (to if:(and (\"IsEmpty\") (or (not \"Centre\") (is Related Adjacent (from) (sites Occupied by:Next))))))) (define \"Centre\" (= (to) (centrePoint))) (define \"IsEmpty\" (is Empty (to))) (game \"Mu Torere\" (players 2) (equipment { (board (concentric {1 8}) use:Vertex) (piece \"Marker\" Each (if (> (count Moves) 1) \"StepToEmpty\" (\"MoveOnlyIfAdjacentToEnemyOrCentre\")))}) (rules (start { (place \"Marker1\" {1..3 8}) (place \"Marker2\" {4..7})}) (play (forEach Piece)) (end (\"NoMoves\" Loss)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe game consists of a 5 by 5 grid of lights. When the game starts, some lights are switched on. Pressing any of the lights will toggle it and the four adjacent lights. The goal of the puzzle is to switch all the lights off, preferably in as few button presses as possible.\n Ludii allows 100 moves maximum before losing. \n\n###\n\n", "completion": "(game \"Lights Out\" (players 1) (equipment { (board (square 5)) (piece \"Light\" Shared)}) (rules (start (place Random {\"Light\"} count:(value Random (range 10 20)))) (play (move Select (from (sites Board)) (then (forEach Site (sites Around (last To) Orthogonal includeSelf:True) (if (is Occupied (site)) (remove (site)) (add (piece \"Light\") (to (site)))))))) (end { (if (all Sites (sites Board) if:(is Empty (site))) (result Mover Win)) (if (= 98 (counter)) (result Mover Loss))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nA triangle, with a line drawn from the apex to the base. A rectangle intersects with the triangle, and has a line connecting the midpoints of the short sides. One player plays as the tiger(s), one to four in number. The other player plays as five to 23 goats (or dogs, or lambs). The tiger begins on the apex of the triangle, and any other tigers on the spots adjacent to the apex. The tiger player moves by moving a piece to an empty adjacent spot along the lines of the board. The goat player begins the game by placing a goat on an empty point on the board, and then the tiger player moves. When all of the goats are placed, they move like the tiger. The tiger may capture a goat by hopping over it to an empty spot on the opposite adjacent side of the goat along the lines of the board. The goats win by blocking the tiger(s) from being able to move; the tiger(s) win by capturing enough goats to prevent them from blocking it/them. 1 Tiger. 5 Goats.\n\n###\n\n", "completion": "(game \"Pulijudamu\" (players 2) (equipment { (board (add (remove (merge (scale 1 2 (wedge 5 3)) (shift 0 2 (scale 8 2 (rectangle 3 2)))) edges:{{17 18} {15 16} {13 14}}) edges:{{13 7} {15 4} {17 1} {3 18} {6 16} {9 14}}) use:Vertex) (hand Each) (piece \"Goat\" P2 (\"StepToEmpty\")) (piece \"Tiger\" P1 (or (\"StepToEmpty\") (\"HopCapture\")))}) (rules (start { (place \"Goat2\" (handSite P2) count:5) (place \"Tiger1\" (handSite P1) count:1)}) phases:{ (phase \"Opening\" P1 (play (move (from (handSite Mover)) (to (if (= 0 (count Sites in:(intersection (sites Top) (sites Occupied by:Mover)))) (sites Top) (intersection (sites Empty) (sites {1 2 3})))) (then (if (\"HandOccupied\" Mover) (moveAgain))))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (phase \"Opening\" P2 (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (\"PhaseMovePiece\" \"Movement\")} (end (\"NoMovesP1NoPiecesP2\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\nTwenty squares arranged in a cross shape, with diagonals in each square. The pieces are played on the intersections of the lines. Two foxes are placed on the outer corners of one of the arms of the cross, and twenty geese are placed on the points in the opposite arm, as well as the first two long lines in the perpendicular arms. Players alternate turns moving a piece to an empty spot along the lines on the board. The geese cannot move backward. The foxes may hop over a goose to an empty adjacent spot immediately on the opposite side of it along the lines on the board. The geese win by blocking the foxes from being able to move. The foxes win by capturing all the geese. \n\n###\n\n", "completion": "(game \"Gasetavl\" (players 2) (equipment { (\"CrossBoard\" 3 7 use:Vertex diagonals:Solid) (piece \"Fox\" P1 (or (\"HopCapture\") (\"StepToEmpty\"))) (piece \"Geese\" P2 N (\"StepToEmpty\" (directions {Rightward Forwards Leftward})))}) (rules (start { (place \"Fox1\" (sites {\"G9\" \"I7\"})) (place \"Geese2\" (sites {\"A3\" \"B2\" \"C1\" \"B4\" \"C3\" \"D2\" \"A7\" \"B6\" \"C5\" \"D4\" \"E3\" \"F2\" \"G1\" \"B8\" \"C7\" \"D6\" \"E5\" \"F4\" \"G3\" \"H2\"}))}) (play (forEach Piece)) (end (\"NoMovesP1NoPiecesP2\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6 board with two store holes on either end. Play begins with four counters in each row. For the opening move, a player may take all of the counters in one hole and add them to the next hole. Play continues with players sowing from any one of the holes in their row in an anti-clockwise direction. If a sowing reaches the hole from which the sowing began, this hole is skipped. If the final counter falls in a hole containing three counters, thus making it contain four counters, these are captured. An unbroken sequence of holes containing four counters moving backwards from the final hole are also captured. Single counters cannot be sown. If a player cannot move, the opponent must sow in a way that allows them to play on the next turn. Play continues until one player has no counters on their side of the board. The player with the most captured counters wins. \n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (+ (count at:(mapEntry #1)) (count in:(sites #1)))) (define \"NoMovesNext\" (if (is Mover P1) (not (and { (< (count at:7) 2) (< (count at:8) 2) (< (count at:9) 2) (< (count at:10) 2) (< (count at:11) 2) (< (count at:12) 2)})) (not (and { (< (count at:1) 2) (< (count at:2) 2) (< (count at:3) 2) (< (count at:4) 2) (< (count at:5) 2) (< (count at:6) 2)})))) (game \"English Wari (St. Lucia)\" (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))) phases:{ (phase \"Init\" (play (move Select (from (sites Mover)) (then (fromTo (from (last To)) (to (\"NextSiteOnTrack\" 1 from:(last To))) count:(count at:(last To)))))) (nextPhase (= (next) 1) \"Sowing\")) (phase \"Sowing\" (play (do (move Select (from (sites Mover) if:(> (count at:(from)) 1)) (then (sow if:(= (count at:(to)) 4) apply:(fromTo (from (to)) (to (mapEntry (mover))) count:(count at:(to))) includeSelf:False backtracking:True))) ifAfterwards:\"NoMovesNext\")))} (end (\"MancalaByScoreWhen\" (no Moves Mover))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nGOAL\n Get your king into the enemy home square, or kill the enemy king.\n \n MOVES\n Players make one move per turn, starting with Red. There are three possible\n types of moves, explained below. Players will always have a move available,\n and must make one. Passing is not allowed.\n \n NON-CAPTURING MOVES\n Kings and courtesans can move to an adjacent, unoccupied square in any of\n the three forward directions.\n \n CAPTURING MOVES\n Kings and courtesans can move to an adjacent, enemy occupied square in any\n of eight directions, capturing the enemy king or courtesan by replacement.\n \n EXCHANGE MOVE\n You can transfer the top checker of your king onto an adjacent, friendly\n courtesan in any of the three forward directions, thus exchanging king and\n courtesan.\n \n In the Ludii implementation, the king is controlled like this: \n To make an exchange move you must drag or click the top piece.\n To make a step/capture move, you must drag or click the bottom piece. A size 6 board is currently selected\n\n###\n\n", "completion": "(game \"King And Courtesan\" (\"TwoPlayersNorthSouth\") (equipment { (board (rotate 45 (square 6))) (piece \"Disc\" Each (or { (\"StepToEmpty\" Forwards stack:True) (move Step (to if:(\"IsEnemyAt\" (to)) (apply (and (if (= 2 (size Stack at:(to))) (set Var \"NextLoss\" 1)) (remove (to) count:(size Stack at:(to)))))) stack:True) (move Step (from if:(= 2 (size Stack at:(from)))) Forwards (to if:(is Mover (who at:(to)))))}))}) (rules (start { (place \"Disc1\" (expand (sites Bottom) steps:(- 6 2) Orthogonal)) (place \"Disc2\" (expand (sites Top) steps:(- 6 2) Orthogonal)) (place Stack \"Disc1\" (sites Bottom)) (place Stack \"Disc2\" (sites Top))}) (play (forEach Piece top:True)) (end { (if (= 1 (var \"NextLoss\")) (result Next Loss)) (if (or (and (= (id P1) (who at:(- (* 6 6) 1))) (= 2 (size Stack at:(- (* 6 6) 1)))) (and (= (id P2) (who at:0)) (= 2 (size Stack at:0)))) (result Mover Win))}))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\n12 Holes per row. -> 15 Holes per row.\n(define \"NextHoleFrom\" (\"NextSiteOnTrack\" 1 from:#1 #2)) (define \"AHoleHasMoreThanOneCounter\" (not (all Sites (forEach (sites Mover) if:(< 1 (count at:(site)))) if:(= 0 (count at:(site)))))) (define \"LastHoleSowed\" (sites {(var)})) (define \"NoPiece\" (all Sites (sites Player \"Home\") if:(= 0 (count at:(site))))) (define \"Columns\" 12) (game \"Misoro Tsoro\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"0,E,N1,W\" loop:True P1) (track \"Track2\" \"24,E,N1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"Track1\")) (regions \"Home\" P2 (sites Track \"Track2\")) (regions \"Inner\" P1 (difference (sites Track \"Track1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"Track2\") (sites Top))) (regions \"Outer\" P1 (sites Bottom)) (regions \"Outer\" P2 (sites Top)) (piece \"Seed\" Shared)}) (rules (start (set Count 2 to:(union (sites Top) (sites Bottom)))) phases:{ (phase \"Misoro\" (play (move Select (from (forEach (sites Mover \"Outer\") if:(= 0 (state at:(site))))) (then (set State at:(last To) (mover))))) (nextPhase (= 4 (count Turns)) \"Playing\")) (phase \"Playing\" (play (or (if (and (!= 0 (state at:(var))) (\"SameTurn\")) (move Pass)) (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(if \"AHoleHasMoreThanOneCounter\" (> (count at:(from)) 1) (and (= (count at:(from)) 1) (= 0 (count at:(\"NextHoleFrom\" (from) Mover)))))) (then (and (sow \"Track\" owner:(mover) apply:(if (= (count at:(to)) 1) (if (is In (to) (sites Mover \"Inner\")) (if (> (count at:(\"OppositePit\" (to))) 0) (and (remove (\"OppositePit\" (to))) (if (> (count at:(\"OppositeOuterPit\" (to))) 0) (remove (\"OppositeOuterPit\" (to))))))) (and (moveAgain) (set Var (to))))) (forEach Site (sites Board) (if (!= 0 (state at:(site))) (set State at:(site) (state at:(site)))))))))))} (end (forEach NonMover if:(\"NoPiece\") (result Player Loss)))))\n\n###\n\n", "completion": "(define \"NextHoleFrom\" (\"NextSiteOnTrack\" 1 from:#1 #2)) (define \"AHoleHasMoreThanOneCounter\" (not (all Sites (forEach (sites Mover) if:(< 1 (count at:(site)))) if:(= 0 (count at:(site)))))) (define \"LastHoleSowed\" (sites {(var)})) (define \"NoPiece\" (all Sites (sites Player \"Home\") if:(= 0 (count at:(site))))) (define \"Columns\" 15) (game \"Misoro Tsoro\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"0,E,N1,W\" loop:True P1) (track \"Track2\" \"30,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 2 to:(union (sites Top) (sites Bottom)))) phases:{ (phase \"Misoro\" (play (move Select (from (forEach (sites Mover \"Outer\") if:(= 0 (state at:(site))))) (then (set State at:(last To) (mover))))) (nextPhase (= 4 (count Turns)) \"Playing\")) (phase \"Playing\" (play (or (if (and (!= 0 (state at:(var))) (\"SameTurn\")) (move Pass)) (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(if \"AHoleHasMoreThanOneCounter\" (> (count at:(from)) 1) (and (= (count at:(from)) 1) (= 0 (count at:(\"NextHoleFrom\" (from) Mover)))))) (then (and (sow \"Track\" owner:(mover) apply:(if (= (count at:(to)) 1) (if (is In (to) (sites Mover \"Inner\")) (if (> (count at:(\"OppositePit\" (to))) 0) (and (remove (\"OppositePit\" (to))) (if (> (count at:(\"OppositeOuterPit\" (to))) 0) (remove (\"OppositeOuterPit\" (to))))))) (and (moveAgain) (set Var (to))))) (forEach Site (sites Board) (if (!= 0 (state at:(site))) (set State at:(site) (state at:(site)))))))))))} (end (forEach NonMover if:(\"NoPiece\") (result Player Loss))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nEach turn the players will put one of their pieces on the boardgame. It's forbidden to put a shape in a line, a column or an area on which this same form has already been posed by the opponent. We can only double a shape if we have played the previous one ourself. The first player who places the fourth different form in a row, column or zone wins the game immediately, no matter who owns the other pieces of that winning move. \n\n###\n\n", "completion": "(define \"AllDifferent\" (all Different #1 if:(is Occupied (site)))) (define \"NotSameSquare\" (if (is In (to) (sites \"BottomLeft\")) (\"NotSameRegion\" \"BottomLeft\") (if (is In (to) (sites \"BottomRight\")) (\"NotSameRegion\" \"BottomRight\") (if (is In (to) (sites \"TopLeft\")) (\"NotSameRegion\" \"TopLeft\") (\"NotSameRegion\" \"TopRight\"))))) (define \"NotSameRegion\" (all Sites (sites #1) if:(!= (what at:(site)) (mapEntry (what at:(from)))))) (define \"NotSameColumn\" (all Sites (sites Column (column of:(to))) if:(!= (what at:(site)) (mapEntry (what at:(from)))))) (define \"NotSameRow\" (all Sites (sites Row (row of:(to))) if:(!= (what at:(site)) (mapEntry (what at:(from)))))) (game \"Quantik\" (players 2) (equipment { (board (square 4) use:Vertex) (piece \"Disc\" Each) (piece \"Square\" Each) (piece \"Triangle\" Each) (piece \"Hex\" Each) (regions \"BottomLeft\" (expand origin:(coord \"A1\") All)) (regions \"BottomRight\" (expand origin:(coord \"D1\") All)) (regions \"TopLeft\" (expand origin:(coord \"A4\") All)) (regions \"TopRight\" (expand origin:(coord \"D4\") All)) (hand Each size:4) (map { (pair (id \"Disc1\") (id \"Disc2\")) (pair (id \"Disc2\") (id \"Disc1\")) (pair (id \"Square1\") (id \"Square2\")) (pair (id \"Square2\") (id \"Square1\")) (pair (id \"Triangle1\") (id \"Triangle2\")) (pair (id \"Triangle2\") (id \"Triangle1\")) (pair (id \"Hex1\") (id \"Hex2\")) (pair (id \"Hex2\") (id \"Hex1\"))})}) (rules (start { (place \"Disc1\" (handSite P1) count:2) (place \"Disc2\" (handSite P2) count:2) (place \"Square1\" (handSite P1 1) count:2) (place \"Square2\" (handSite P2 1) count:2) (place \"Triangle1\" (handSite P1 2) count:2) (place \"Triangle2\" (handSite P2 2) count:2) (place \"Hex1\" (handSite P1 3) count:2) (place \"Hex2\" (handSite P2 3) count:2)}) (play (move (from (sites Occupied by:Mover container:(mover))) (to (sites Empty) if:(and { \"NotSameRow\" \"NotSameColumn\" \"NotSameSquare\"})))) (end (if (or { (\"AllDifferent\" (sites \"BottomLeft\")) (\"AllDifferent\" (sites \"BottomRight\")) (\"AllDifferent\" (sites \"TopLeft\")) (\"AllDifferent\" (sites \"TopRight\")) (\"AllDifferent\" (sites Row 0)) (\"AllDifferent\" (sites Row 1)) (\"AllDifferent\" (sites Row 2)) (\"AllDifferent\" (sites Row 3)) (\"AllDifferent\" (sites Column 0)) (\"AllDifferent\" (sites Column 1)) (\"AllDifferent\" (sites Column 2)) (\"AllDifferent\" (sites Column 3)) (no Moves Next)}) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n4x8 board. Two counters in each hole. Each player may sow in either direction on their first move, but must continue in the same direction for the remainder of the game. When the final counter of a sowing lands in an occupied hole, the counters in that hole are picked up and sowing continues. If the final hole of a sowing is in the inner row, regardless of whether it is occupied or empty, the player then captures the counters in both of the opponent's holes opposite it, and continues sowing with these counters as well as the ones in the final hole of sowing. Captures cannot be made when the final hole of a sowing was empty, and the opponent's opposite holes have only a single counter. When the final counter lands in an empty hole, the turn is over. The player who captures all the counters wins. \n\n###\n\n", "completion": "(define \"Columns\" 8) (game \"Katra Boaoaka\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" 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\" \"24,E,S1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"TrackCCW1\")) (regions \"Home\" P2 (sites Track \"TrackCCW2\")) (regions \"Inner\" P1 (difference (sites Track \"TrackCCW1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"TrackCCW2\") (sites Top))) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 2 to:(union (sites P1 \"Home\") (sites P2 \"Home\")))) (play (or (if (!= (value Player Mover) 2) (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (sites Mover \"Home\")) if:(> (count at:(from)) 0)) (then (and (sow \"TrackCCW\" owner:(mover) apply:(and (if (< 1 (count at:(to))) (and (moveAgain) (set Var \"Replay\" (to)))) (if (is In (to) (sites Mover \"Inner\")) (if (not (and { (= 1 (count at:(to))) (= 1 (count at:(\"OppositePit\" (to)))) (= 1 (count at:(\"OppositeOuterPit\" (to))))})) (if (or (is Occupied (\"OppositePit\" (to))) (is Occupied (\"OppositeOuterPit\" (to)))) (and { (fromTo (from (\"OppositePit\" (to))) (to (to)) count:(count at:(\"OppositePit\" (to)))) (fromTo (from (\"OppositeOuterPit\" (to))) (to (to)) count:(count at:(\"OppositeOuterPit\" (to)))) (if (= 1 (count at:(to))) (and (moveAgain) (set Var \"Replay\" (to))))})))))) (if (!= (value Player Mover) 1) (set Value Mover 1)))))) (if (!= (value Player Mover) 1) (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (sites Mover \"Home\")) if:(> (count at:(from)) 0)) (then (and (sow \"TrackCW\" owner:(mover) apply:(and (if (< 1 (count at:(to))) (and (moveAgain) (set Var \"Replay\" (to)))) (if (is In (to) (sites Mover \"Inner\")) (if (not (and { (= 1 (count at:(to))) (= 1 (count at:(\"OppositePit\" (to)))) (= 1 (count at:(\"OppositeOuterPit\" (to))))})) (if (or (is Occupied (\"OppositePit\" (to))) (is Occupied (\"OppositeOuterPit\" (to)))) (and { (fromTo (from (\"OppositePit\" (to))) (to (to)) count:(count at:(\"OppositePit\" (to)))) (fromTo (from (\"OppositeOuterPit\" (to))) (to (to)) count:(count at:(\"OppositeOuterPit\" (to)))) (if (= 1 (count at:(to))) (and (moveAgain) (set Var \"Replay\" (to))))})))))) (if (!= (value Player Mover) 2) (set Value Mover 2)))))))) (end \"ForEachNonMoverNoMovesLoss\"))) 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 Ludii game based on the following description\nEach player has three pieces.\n Players take turns moving a piece to an empty dot. \n Players cannot return to their starting three dots.\n Pieces that move into the opponent\u2019s starting three dots cannot exit them. \n A player wins by blocking the other player from being able to move. \n\n###\n\n", "completion": "(define \"MoveSomewhereElseButInOurHome\" (and (not (is In (from) (sites Next))) (if (not (is In (from) (sites Mover))) (is In (to) (difference (sites Empty) (sites Mover))) (is Empty (to))))) (define \"MoveInTheEnemyHome\" (and { (is In (from) (sites Next)) (is In (to) (sites Next)) (is Empty (to))})) (game \"Ho-Bag Gonu\" (players 2) (equipment { (board (add (merge { (rectangle 1 3) (shift 1 1 (scale 0.5 (concentric {1 4}))) (shift 0 2 (rectangle 1 3))}) edges:{{5 1} {9 7}}) use:Vertex) (piece \"Disc\" Each (move Step (to if:(or \"MoveInTheEnemyHome\" \"MoveSomewhereElseButInOurHome\")))) (regions \"Home\" P1 (sites {\"A1\" \"C1\" \"E1\"})) (regions \"Home\" P2 (sites {\"A5\" \"C5\" \"E5\"}))}) (rules (start { (place \"Disc1\" (sites P1)) (place \"Disc2\" (sites P2))}) (play (forEach Piece)) (end (\"NoMoves\" Loss)))) END" }, { "prompt": "Construct a Ludii game based on the following description\n3x8 board. Eight pieces per player, which start in the spaces of the outer rows of the board. Four cowrie shells used as dice, the number of mouths face up being the value of the throw. A throw of 1 grants the player another throw. A player must throw 1 for the first move of each of their pieces. Players may only play with one piece out of the home row at a time and cannot move the next of their pieces until the piece being played has been captured. Throws of 1 must be used to move a piece in the home row, if possible. Pieces move from left to right in the player's home row, then from right to left in the central row, left to right in the opponent's home row, and right to left in the central row. When a piece lands on a space occupied by an opponent's piece, the opponent's piece is captured. The player who captures all of the opponent's pieces wins. \n\n###\n\n", "completion": "(define \"Move\" (if (and { (if (\"PieceActivated\" (from)) True (= 1 (\"ThrowValue\"))) #1}) (if (and (not (\"IsFriendAt\" (\"NextSiteOnTrack\" (\"ThrowValue\")))) (\"OnlyOnePieceMovingOutOfHome\")) (move (from) (to (\"NextSiteOnTrack\" (\"ThrowValue\")) \"CaptureEnemyPiece\") (then (if (and (not (\"PieceActivated\" (last To))) (= 1 (\"ThrowValue\"))) (\"ActivatePiece\" (last To)))))))) (define \"OnlyOnePieceMovingOutOfHome\" (if (not (\"SiteInHome\" (from))) True (if (\"SiteInHome\" (\"NextSiteOnTrack\" (\"ThrowValue\"))) True (= (\"CountOwnPiecesOutHome\") 0)))) (define \"CountOwnPiecesOutHome\" (count Pieces Mover in:(difference (sites Board) (sites Mover \"Home\")))) (define \"SiteInHome\" (is In #1 (sites Mover \"Home\"))) (define \"PieceActivated\" (!= 0 (state at:#1))) (define \"ActivatePiece\" (set State at:#1 1)) (define \"CaptureEnemyPiece\" (apply if:(\"IsEnemyAt\" (to)) (remove (to)))) (define \"ThrowValue\" (count Pips)) (game \"Bheri Bakhri\" (players 2) (equipment { (board (rectangle 3 8) { (track \"Track1\" \"0,E,N1,W,N1,E,S1,W\" loop:True P1) (track \"Track2\" \"23,W,S1,E,S1,W,N1,E\" loop:True P2)}) (\"StickDice\" 4) (piece \"Marker\" Each (\"Move\")) (regions \"Home\" P1 (sites Bottom)) (regions \"Home\" P2 (sites Top))}) (rules (start { (place \"Marker1\" (sites Bottom)) (place \"Marker2\" (sites Top))}) (play (\"RollMove\" (if (= 1 (\"ThrowValue\")) (priority { (forEach Piece (\"Move\" (is In (from) (sites Mover \"Home\")))) (forEach Piece)}) (forEach Piece)) (then (if (= 1 (\"ThrowValue\")) (moveAgain))))) (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe game LastEdge can be played in an undirected and unweighted graph. The edge colours are related to the playing rules of each version. For the basic version, LastEdge all the edges are in the same colour (green). At each turn, a player selects a vertex, which contains at least one green edge and after each turn, all the edges of the selected vertex are removed. The game is over when there are no green edges in the graph. The second version is the Red blue version (LastEdgeR-B). There are one red player and one blue player. The players can select only those vertices, that contain at least one friendly edge. After each turn, all the edges (any colour) of the selected vertex are removed. The last version is LastEdgeR-G-B; there is a graph with red, green, and blue edges. The players can select a vertex, which has at least one friendly colour or shared colour edge. Importantly, the green edges are used as shared edges between both players. After each turn, all the edges (any colour) of the selected vertex are removed. For all the versions of LastEdge, if the current player has no move, then the opponent player wins. The game is played on the Graph1. The players play on LastEdge version.\n\n###\n\n", "completion": "(game \"LastEdge\" (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} {1 6} {1 2} {2 7} {2 3} {3 8} {3 4} {4 9} {5 6} {5 10} {6 11} {6 7} {7 12} {7 8} {8 13} {8 9} {9 14} {10 11} {11 12} {12 13} {13 14} {10 15} {11 16} {12 17} {13 18} {14 19} {15 16} {15 20} {16 21} {20 21} {16 17} {17 22} {21 22} {17 18} {18 23} {22 23} {18 19} {19 24} {23 24}}) use:Vertex) (piece \"Disc\" Each) (piece \"Marker\" Shared)}) (rules (start { (set Shared Edge (sites Board Edge))}) (play (forEach Site (sites Board) (if (> (count Sites in:(sites Incident Edge of:Vertex at:(to) Shared)) 0) (move Add (to (intersection (sites Empty) (sites {(to)}))) (then (forEach Site (sites Incident Edge of:Vertex at:(last To)) (remove Edge (to)))))))) (end (\"BlockWin\")))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"PreviousHole\" (\"NextSiteOnTrack\" 1 from:(from) \"TrackCW\")) (define \"NoPiece\" (all Sites (sites Player) if:(= 0 (count at:(site))))) (define \"Columns\" 13) (game \"Tsoro (Baia)\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"TrackCCW1\" \"0,E,N1,W\" loop:True P1) (track \"TrackCCW2\" \"26,E,N1,W\" loop:True P2) (track \"TrackCW1\" \"12,W,N1,E\" loop:True P1) (track \"TrackCW2\" \"39,E,S1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"TrackCCW1\")) (regions \"Home\" P2 (sites Track \"TrackCCW2\")) (regions \"Inner\" P1 (difference (sites Track \"TrackCCW1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"TrackCCW2\") (sites Top))) (regions \"Outer\" P1 (sites Bottom)) (regions \"Outer\" P2 (sites Top)) (regions \"FirstMove\" P1 (difference (expand (intersection (difference (sites Track \"TrackCCW1\") (sites Bottom)) (sites Left)) steps:2 E) (expand (intersection (difference (sites Track \"TrackCCW1\") (sites Bottom)) (sites Left)) E))) (regions \"FirstMove\" P2 (difference (expand (intersection (difference (sites Track \"TrackCCW2\") (sites Top)) (sites Right)) steps:2 W) (expand (intersection (difference (sites Track \"TrackCCW2\") (sites Top)) (sites Right)) W))) (piece \"Seed\" Shared) (hand Each)}) (rules (start { (set Count 2 to:(difference (sites P1 \"Outer\") (sites Left))) (set Count 2 to:(difference (sites P2 \"Outer\") (sites Right))) (set Count 2 to:(difference (sites P1 \"Inner\") (expand (sites Left)))) (set Count 2 to:(difference (sites P2 \"Inner\") (expand (sites Right)))) (set Count 1 to:(difference (sites P1 \"Inner\") (union (sites Left) (difference (sites P1 \"Inner\") (expand (sites Left)))))) (set Count 1 to:(difference (sites P2 \"Inner\") (union (sites Right) (difference (sites P2 \"Inner\") (expand (sites Right))))))}) phases:{ (phase \"FirstTurn\" (play (if (>= 0 (var \"FreeCapture\")) (move Select (from (sites Mover \"FirstMove\")) (then (sow \"TrackCCW\" owner:(mover) apply:(if (is In (to) (sites Mover \"Inner\")) (if (is Occupied (\"OppositePit\" (to))) (and { (fromTo (from (\"OppositePit\" (to))) (to (handSite Mover)) count: (count at:(\"OppositePit\" (to)))) (if (is Occupied (\"OppositeOuterPit\" (to))) (fromTo (from (\"OppositeOuterPit\" (to))) (to (handSite Mover)) count: (count at:(\"OppositeOuterPit\" (to))))) (set Value Mover (+ 1 (value Player Mover))) (set Var \"FreeCapture\" 5) (moveAgain)})))))) (move (from (sites Next \"Home\") if:(and (is Occupied (from)) (not (is In (from) (sites Next \"FirstMove\"))))) (to (handSite Mover)) count:(count at:(from)) (then (and (set Var \"FreeCapture\" (- (var \"FreeCapture\") 1)) (if (< 1 (var \"FreeCapture\")) (moveAgain))))))) (nextPhase Mover (not (is Next Mover)) \"Main\")) (phase \"Main\" (play (if (>= 0 (var \"FreeCapture\")) (or (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (sites Mover \"Home\")) if:(and (< 1 (count at:(from))) (if (\"SameTurn\") True (is Empty (\"PreviousHole\"))))) (then (sow \"TrackCCW\" owner:(mover) apply:(if (< 1 (count at:(to))) (and { (moveAgain) (set Var \"Replay\" (to))}) (if (is In (to) (sites Mover \"Inner\")) (if (is Occupied (\"OppositePit\" (to))) (and { (fromTo (from (\"OppositePit\" (to))) (to (handSite Mover)) count: (count at:(\"OppositePit\" (to)))) (if (is Occupied (\"OppositeOuterPit\" (to))) (fromTo (from (\"OppositeOuterPit\" (to))) (to (handSite Mover)) count: (count at:(\"OppositeOuterPit\" (to))))) (set Value Mover (+ 1 (value Player Mover))) (if (= 0 (value Player Mover)) (set Var \"FreeCapture\" 3) (set Var \"FreeCapture\" 2)) (moveAgain)}))))))) (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (sites Mover \"Home\")) if:(and (= 1 (count at:(from))) (if (\"SameTurn\") True (is Empty (\"PreviousHole\"))))) (then (sow \"TrackCCW\" owner:(mover) apply:(if (< 1 (count at:(to))) (and { (moveAgain) (set Var \"Replay\" (to))})))))) (move (from (sites Next \"Home\") if:(and (is Occupied (from)) (not (is In (from) (sites Next \"FirstMove\"))))) (to (handSite Mover)) count:(count at:(from)) (then (and (set Var \"FreeCapture\" (- (var \"FreeCapture\") 1)) (if (< 1 (var \"FreeCapture\")) (moveAgain))))))))} (end (forEach NonMover if:(\"NoPiece\") (result Player Loss)))))\n\n###\n\n", "completion": "4x13-19 board. Two counters in every hole, except the leftmost in both of a player's rows, which are empty, and the second from the left in the inner row, which has one. Sowing occurs in an anti-clockwise direction. When the final counter lands in an occupied hole, these counters are picked up and sowing continues. Captures are made when the final counters lands in an empty hole in the inner row, capturing the contents of the opponent's opposite inner row hole, as well as the contents of the outer row hole only if there was a capture from the inner row hole. Captures from extra holes are also made, which are graduated based on the number of captures the player has made. On their first turn, players sow from the third hole from the left in the front row. This triggers a capture of the counters in the opposite holes in the opponent's inner and outer rows, plus the contents of any other five holes on the opponent's side of the board. In subsequent turns, sowing must occur from a hole which follows an empty hole according to the circuit of the holes. On their second capture, the player captures three extra holes. All other subsequent captures capture from two extra holes. Sowing a single counter cannot result in a capture. The player who captures all of their opponent's counters wins. Each row has 13 holes. END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6 board. Four counters in each hole. Players sow from any of the holes in their row in an anti-clockwise direction. When the final counter of a sowing falls into an occupied hole (except in the scenario below), these are picked up and sowing continues. If the final counter falls into either an empty hole or one of the opponent's holes with three counters, making that hole now have four counters, the sowing ends. When the final counter falls into a hole in the opponent's row containing four counters after sowing concludes, this hole is marked. If a player sows their final counter into their opponent's marked hole, the final counter and one of the counters in the hole are captured. The player then gets another turn. If the final counter falls into a player's own marked hole, the turn ends. The contents of marked holes cannot be sown. The game ends when only marked holes contain counters. These are then captured by the players who marked them. A new game begins. The player with the most counters places four in each hole beginning from the left hole in their row. Each hole that contains four counters is owned by that player for the new round. If the player has three counters remaining after filling as many holes with four as possible, they borrow one counter from the opponent to make four and own the corresponding hole. If there are two or one remaining, the opponent borrows these to fill and own the last hole. Play continues until one player owns no more holes. \n\n###\n\n", "completion": "(define \"RemmemberOwnedHoles\" (if (is Mover P1) (remember Value \"OwnedP1\" #1) (remember Value \"OwnedP2\" #1))) (define \"LeftMostEmpty\" (trackSite FirstSite from:(mapEntry \"LeftMost\" Mover) if:(is Empty (to)))) (define \"NumCapturedPieces\" (+ (count Cell at:(handSite #1)) (count in:(\"SitesMarkedBy\" #1)))) (define \"SitesMarkedBy\" (forEach (sites Board) if:(= #1 (state at:(site))))) (define \"OnlyPiecesInMarked\" (all Sites (forEach (sites Board) if:(= 0 (state at:(site)))) if:(= 0 (count at:(site))))) (define \"OwnedHoles\" (if (is Mover P1) (sites (values Remembered \"OwnedP1\")) (sites (values Remembered \"OwnedP2\")))) (game \"Um el Banat\" (players 2) (equipment { (mancalaBoard 2 6 store:None (track \"Track\" \"0,E,N,W\" loop:True)) (regions \"Home\" P1 (sites Bottom)) (regions \"Home\" P2 (sites Top)) (piece \"Seed\" Shared) (hand Each) (map \"LeftMost\" {(pair P1 0) (pair P2 11)})}) (rules (start { (set Count 4 to:(sites Track)) (set RememberValue \"OwnedP1\" (sites Bottom)) (set RememberValue \"OwnedP2\" (sites Top))}) phases:{ (phase \"Sowing\" (play (or { (move Select (from (if (and (\"SameTurn\") (= 1 (var \"ContinueSowing\"))) (\"LastHoleSowed\") (\"OwnedHoles\")) if:(and (< 0 (count at:(from))) (= 0 (state at:(from))))) (then (sow apply: (if (= (next) (state at:(to))) (and { (move (from (to)) (to (handSite Mover)) count:(min 2 (count at:(to)))) (moveAgain) (set Var \"ContinueSowing\" 0)}) (if (= (mover) (state at:(to))) (set Var \"ContinueSowing\" 0) (if (and (< 1 (count at:(to))) (!= 4 (count at:(to)))) (and (moveAgain) (set Var \"ContinueSowing\" 1)) (if (and (= 4 (count at:(to))) (not (is In (sites Mover \"Home\")))) (and (set State at:(to) (mover)) (set Var \"ContinueSowing\" 0)))))))))} (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) (if (>= (\"NumCapturedPieces\" 1) (\"NumCapturedPieces\" 2)) (set NextPlayer (player 1)) (set NextPlayer (player 2)))}))))) (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 (\"LeftMostEmpty\")) count:4 (then (and { (\"RemmemberOwnedHoles\" (last To)) (if (<= 4 (count Cell at:(handSite Mover))) (moveAgain) (if (= 3 (count Cell at:(handSite Mover))) (and { (fromTo (from (handSite Mover)) (to (\"LeftMostEmpty\")) count:3) (fromTo (from (handSite Next)) (to (\"LeftMostEmpty\")) count:1) (\"RemmemberOwnedHoles\" (\"LeftMostEmpty\"))}) (fromTo (from (handSite Mover)) (to (handSite Next)) count:(count Cell at:(handSite Mover)))))}))))) (nextPhase (and (is Empty (handSite P1)) (is Empty (handSite P2))) \"Sowing\"))})) END" }, { "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": "Describe the mechanics of the following Ludii game\n(game \"Dash Guti\" (players 2) (equipment { (board (add (merge { (wedge 4) (shift 0 3 (rotate 180 (wedge 4)))}) vertices:{{0 3} {6 3}} edges:{{7 19} {19 18} {0 19} {0 20} {20 16} {20 9}}) use:Vertex) (piece \"Counter\" Each (or (\"HopCapture\") (\"StepToEmpty\")))}) (rules (start { (place \"Counter1\" (union {(sites Row 0) (sites Row 1) (sites Row 2) (intersection (sites Row 3) (sites Left))})) (place \"Counter2\" (union {(sites Row 6) (sites Row 5) (sites Row 4) (intersection (sites Row 3) (sites Right))}))}) (play (forEach Piece)) (end (\"NoMoves\" Loss))))\n\n###\n\n", "completion": "Each player lays out the pieces on the board on the intersections of the lines, each filling all the intersections of the triangle closest to the player, plus the extra intersection to their right. Play moves to the next adjacent intersection connected by a line. Opponent's pieces can be captured by hopping over them. The player who captures all of the opponent's pieces wins. END" }, { "prompt": "Construct a Ludii game based on the following description\nThere are 30 game-pieces for each player and eleven castles. The gameboard is divided into three sections: homes and center section. Object of the game is to capture four castles (among those of the central section and the other side) or 28 pawns of your opponent. In a turn a player moves one of their pieces, horizontally, vertically. A pawn can step to an adjacent empty cell. Additionally a pawn can jump over another pawn as long as the square behind that pawn is free. Multiple jumps are allowed and all enemy pawns are captured this way and removed from the deck. A pawn can capture a maximum of five enemy pieces, and his movement ends after the fifth piece is captured. A castle is conquered when it is surrounded by three pawns. \n\n###\n\n", "completion": "(define \"StorageMiddleCastle\" (handSite Mover 1)) (define \"StorageRightCastle\" (handSite Mover 2)) (define \"StorageLeftCastle\" (handSite Mover)) (define \"CaptureCastleAndStoreItTo\" (surround (from (last To)) Orthogonal (between if:(= (what at:(between)) (id \"Castle0\")) (apply (fromTo (from (between)) (to #1)))) (to if:(\"IsFriendAt\" (to))) except:1)) (define \"JumpAgain\" (move Hop (from (last To)) Orthogonal (between if:(if (< (counter) \"NumMaxCapture\") \"NotEmptyAndNoCastle\" (\"IsFriendAt\" (between))) \"CaptureEnemyPiece\") (to if:\"EmptyAndNotVisited\") (then (if \"CanJumpAgain\" (moveAgain) (set Counter))))) (define \"CanJumpAgain\" (can Move (hop (from (last To)) Orthogonal (between if:(if (< (counter) (- \"NumMaxCapture\" 1)) \"NotEmptyAndNoCastle\" (\"IsFriendAt\" (between))) \"CaptureEnemyPiece\") (to if:\"EmptyAndNotVisited\")))) (define \"EmptyAndNotVisited\" (and (is Empty (to)) (not (is Visited (to))))) (define \"CaptureEnemyPiece\" (apply (if (= (who at:(between)) (next)) (remove (between))))) (define \"NotEmptyAndNoCastle\" (and (!= (what at:(between)) (id \"Castle0\")) (is Occupied (between)))) (define \"NumMaxCapture\" 5) (game \"Castello\" (players 2) (equipment { (board (rectangle 15 21)) (piece \"Pawn\" Each (or (move Hop Orthogonal (between if:\"NotEmptyAndNoCastle\" \"CaptureEnemyPiece\") (to if:(is Empty (to))) (then (if \"CanJumpAgain\" (moveAgain) (set Counter)))) (\"StepToEmpty\" Orthogonal))) (piece \"Castle\" Neutral) (hand Each size:3) (regions \"LeftPart\" (expand (sites Left) steps:6)) (regions \"RightPart\" (expand (sites Right) steps:6)) (regions \"Middle\" (expand (sites Centre)))}) (rules (start { (place \"Pawn1\" (expand (sites Left))) (place \"Pawn2\" (expand (sites Right))) (place \"Castle0\" (sites {\"G2\" \"F6\" \"G10\" \"F14\" \"K3\" \"K8\" \"K13\" \"P2\" \"O6\" \"P10\" \"O14\"}))}) (play (if \"SameTurn\" (or \"JumpAgain\" (move Pass)) (forEach Piece) (then (and (if (is In (last To) (sites \"LeftPart\")) (if (< (count Cell at:(handSite Mover)) 3) (\"CaptureCastleAndStoreItTo\" \"StorageLeftCastle\")) (if (is In (last To) (sites \"RightPart\")) (\"CaptureCastleAndStoreItTo\" \"StorageRightCastle\") (if (is In (last To) (sites \"Middle\")) (if (> (count Cell at:(handSite Mover 2)) 0) (\"CaptureCastleAndStoreItTo\" \"StorageMiddleCastle\")) (\"CaptureCastleAndStoreItTo\" \"StorageMiddleCastle\")))) (set Counter))))) (end { (\"HavingLessPiecesLoss\" Next 3) (if (> (count in:(sites Hand Mover)) 3) (result Mover Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThree concentric hexagons, with lines connecting the corners and midpoints of the sides. Seventeen pieces per player. Players alternate turns placing one of their pieces on an empty spot on the board. When all of the pieces are placed, they alternate turns moving one of their pieces to an empty adjacent spot along the lines of the board. During either phase, when a player places three of their pieces in a row, they may remove one of the opponent's pieces from the board. Pieces which are in a three-in-a-row arrangement cannot be removed from the board. The player who captures all of the opponent's pieces wins. \n\n###\n\n", "completion": "(game \"Zurgaan Tal\" (players 2) (equipment { (board (rotate 30 (concentric Hexagon rings:3 joinCorners:True)) use:Vertex) (hand Each) (piece \"Marker\" Each (\"StepToEmpty\" ~ (then (\"ReplayIfLine3\"))))}) (rules (start (place \"Marker\" \"Hand\" count:17)) phases:{ (phase \"Placement\" (play (if \"SameTurn\" (\"RemoveAnyEnemyPieceNotInLine3\" Orthogonal) (move (from (handSite Mover)) (to (sites Empty)) (then (\"ReplayIfLine3\"))))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (phase \"Movement\" (play (if \"SameTurn\" (\"RemoveAnyEnemyPieceNotInLine3\" Orthogonal) (forEach Piece))))} (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Construct a Ludii game based on the following description\n3x3 intersecting lines with diagonals. Play occurs on the intersections of the lines. Three pieces per player. Play begins with each player placing pieces on empty points. If they make three in a row along the lines, they win. Once all pieces are place, players take turns moving pieces one spot to an adjacent point along the lines trying to make three in a row.\n \n\n###\n\n", "completion": "(game \"Tapatan\" (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\n2x6 board. Eight counters in each hole; two holes in one player's row and one in the opponent's row are left empty. Sowing in an anti-clockwise direction. No captures in first two turns. If the last counter falls into a hole that is occupied, these are picked up and the sowing continues. When the last counter of a sowing falls into an empty hole, the counters in the opposite hole are captured. The player continues play by moving the counter that made the capture into the next hole, and continuing play. If the last counter falls into an empty hole and the opposite hole is also empty, the turn ends. The player who captures the most counters wins. \n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (define \"Columns\" 6) (game \"Mangala (Suez)\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" store:None (track \"Track\" \"0,E,N,W\" loop:True)) (piece \"Seed\" Shared) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (hand Each)}) (rules (start (set Count 8 to:(sites Track))) phases:{ (phase \"Opening\" (play (move Remove (sites Mover) count:(count at:(to)))) (nextPhase (<= 3 (count Turns)) \"Sowing\")) (phase \"Sowing\" (play (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (sites Mover)) if:(is Occupied (from))) (then (sow apply:(if (< 1 (count at:(to))) (and (moveAgain) (set Var \"Replay\" (to))) (if (<= 7 (count Turns)) (if (is Occupied (\"OppositePitTwoRows\" (to))) (and { (fromTo (from (\"OppositePitTwoRows\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePitTwoRows\" (to)))) (moveAgain) (set Var \"Replay\" (to))})))))))) (end (\"MancalaByScoreWhen\" (no Moves Next))))})) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nOrder 5 board -> Order 13 board\n(define \"Invisible\" (colour 0 0 0 0)) (define \"ColourBackground\" (colour LightTan)) (define \"SquareGrid\" (board (square 5) use:Vertex)) (define \"ResolveTheValue\" (forEach Site (intersection (sites Around #1 Orthogonal) (sites Around (\"CrosscutSites\" #1) Orthogonal)) (move (from #1) (to (site) if:(!= (last From) (to)) (apply (remove (site)))) (then (and (add (piece (id \"Ball\" Next)) (to (var \"LT\"))) (set Var \"LT\" (last To) (then (if (\"HasCrosscuts\" (var \"LT\")) (set NextPlayer (player (mover))) (set Var \"LT\" -1))))))))) (define \"Choose2Resolve\" (forEach Site (sites Occupied by:Mover) (do (set Var \"LT\" (site)) next:(\"ResolveTheValue\" (var \"LT\"))))) (define \"Place\" (move Add (to (sites Empty)) (then (if (and (\"NewTurn\") (\"HasCrosscuts\" (last To))) (set Var \"LT\" (last To) (then (moveAgain))) (set Var \"LT\" -1))))) (define \"HasCrosscuts\" (< 0 (count Sites in:(\"CrosscutSites\" #1)))) (define \"CrosscutSites\" (sites (results from:#1 to:(sites Around (from) Diagonal if:(and (is Mover (who at:(to))) (= 2 (count Pieces Next in:(intersection (sites Around (to) Orthogonal) (sites Around (from) Orthogonal)))))) (to)))) (game \"Resolve\" (players 2) (equipment { \"SquareGrid\" (regions P1 {(sites Side N) (sites Side S)}) (regions P2 {(sites Side W) (sites Side E)}) (piece \"Ball\" P1) (piece \"Ball\" P2)}) (rules (play (if (\"NewTurn\") (or (\"Place\") (\"Choose2Resolve\")) (if (<= 0 (var \"LT\")) (\"ResolveTheValue\" (var \"LT\")) (\"Place\")))) (end { (if (is Connected Orthogonal Mover) (result Mover Win))})))\n\n###\n\n", "completion": "(define \"Invisible\" (colour 0 0 0 0)) (define \"ColourBackground\" (colour LightTan)) (define \"SquareGrid\" (board (square 13) use:Vertex)) (define \"ResolveTheValue\" (forEach Site (intersection (sites Around #1 Orthogonal) (sites Around (\"CrosscutSites\" #1) Orthogonal)) (move (from #1) (to (site) if:(!= (last From) (to)) (apply (remove (site)))) (then (and (add (piece (id \"Ball\" Next)) (to (var \"LT\"))) (set Var \"LT\" (last To) (then (if (\"HasCrosscuts\" (var \"LT\")) (set NextPlayer (player (mover))) (set Var \"LT\" -1))))))))) (define \"Choose2Resolve\" (forEach Site (sites Occupied by:Mover) (do (set Var \"LT\" (site)) next:(\"ResolveTheValue\" (var \"LT\"))))) (define \"Place\" (move Add (to (sites Empty)) (then (if (and (\"NewTurn\") (\"HasCrosscuts\" (last To))) (set Var \"LT\" (last To) (then (moveAgain))) (set Var \"LT\" -1))))) (define \"HasCrosscuts\" (< 0 (count Sites in:(\"CrosscutSites\" #1)))) (define \"CrosscutSites\" (sites (results from:#1 to:(sites Around (from) Diagonal if:(and (is Mover (who at:(to))) (= 2 (count Pieces Next in:(intersection (sites Around (to) Orthogonal) (sites Around (from) Orthogonal)))))) (to)))) (game \"Resolve\" (players 2) (equipment { \"SquareGrid\" (regions P1 {(sites Side N) (sites Side S)}) (regions P2 {(sites Side W) (sites Side E)}) (piece \"Ball\" P1) (piece \"Ball\" P2)}) (rules (play (if (\"NewTurn\") (or (\"Place\") (\"Choose2Resolve\")) (if (<= 0 (var \"LT\")) (\"ResolveTheValue\" (var \"LT\")) (\"Place\")))) (end { (if (is Connected Orthogonal Mover) (result Mover Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe game is played on a board with twelve points on either side. The points form a continuous track in a horseshoe shape; each player progresses in opposite directions (one from their bottom right to the top right, the other from their bottom left to their top left). Each player has fifteen pieces, which all begin on the first point of their track. Two dice are used. Players move according to the number on each die by moving one piece the value on one die then another piece the value on the other die, or by moving one piece the value of one die and then the value of the other. The maximum number of pieces per point is two, except for the starting point. Placing pieces on the twelfth point of a player's side is only allowed when it can be achieved by two pieces on the same dice roll. A player's pieces only actually move on the player's half of the board; points are awarded for any hypothetical move that would move a player's pieces along the imagined track onto the opponent's side of the board that would land on a point with a lone opposing piece (a \\ \n\n###\n\n", "completion": "(games { (subgame \"GrandTrictracSubgame\")}) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x12 board, divided in half. Spaces on each side take the form of semi-circular sockets, into which the pieces fit. Fifteen pieces per player. One player places fourteen of their pieces on the first point of the table to their right closest to them, with the other piece on the point opposite it on the other side of the board. The other player places three pieces on each of the four spots following the spot with the other player's fourteen, two on the spot following this, and one on the opposite end of the row of spots where the opponent's single piece is located. 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. Players move along the spaces of the board toward the spot where the first player's single piece is located, and from there they bear off. Pieces cannot be hit as in similar games. If a player cannot play the value on a die (or on both dice), the opponent may play it. The first player to bear off all of their pieces wins. \n\n###\n\n", "completion": "(define \"RemoveAPiece\" (move Remove (from))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" (pips))) (game \"Laquet\" (players 2) (equipment { (\"TableBoard\" (track \"Track1\" {11..6 5..0 12..17 18..23} directed:True)) (dice d:6 num:2) (piece \"Disc\" Each (forEach Die if:(\"DieNotUsed\") (if (\"IsOffBoard\" \"SiteToMoveOnTrack\") \"RemoveAPiece\" (if (not (\"IsEnemyAt\" \"SiteToMoveOnTrack\")) (move (from) (to \"SiteToMoveOnTrack\"))))))}) (rules (start { (place Stack \"Disc1\" 11 count:14) (place Stack \"Disc1\" 23) (place Stack \"Disc2\" (sites {7..10}) count:3) (place Stack \"Disc2\" 6 count:2) (place Stack \"Disc2\" 12)}) (play (do (if (and (not (is Pending)) (\"NewTurn\")) (roll)) next:(if (can Move (forEach Piece)) (forEach Piece top:True (then (\"ReplayNotAllDiceUsed\"))) (move Pass (then (set Pending)))))) (end (\"EscapeWin\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\nA move in Alice chess has two basic stipulations: the move must be legal on the board on which it is played, and the square transferred to on the opposite board must be vacant. (Consequently, capture is possible only on the board upon which a piece currently stands). The en passant rule is removed. \n\n###\n\n", "completion": "(define \"CaptureToPieceAndResetCounter\" (apply if: (or (and (\"IsEnemyAt\" (to)) (= (value Piece at:(from)) (value Piece at:(to)))) (is Empty (to))) (if (and (\"IsEnemyAt\" (to)) (= (value Piece at:(from)) (value Piece at:(to)))) (remove (to) (then (set Counter)))))) (define \"CaptureForwardDiagonal\" (move Step (directions {FR FL}) (to if:(and (\"IsEnemyAt\" (to)) (= (value Piece at:(from)) (value Piece at:(to)))) (apply (remove (to)))))) (define \"DoubleStep\" (move Slide Forward (between (exact 2) if:(or (is Empty (between)) (!= (value Piece at:(from)) (value Piece at:(between))))) (to if:(is Empty (to)) (apply if:(is Empty (to)))))) (define \"Castling\" (if (and (\"HasNeverMoved\" \"King\") (not (\"IsInCheck\" \"King\" Mover))) (or (if (and (\"HasNeverMoved\" \"RookLeft\") (can Move (\"CastleRook\" \"RookLeft\" E 3 (or (is Empty (between)) (!= (value Piece at:(from)) (value Piece at:(between))))))) \"BigCastling\") (if (and (\"HasNeverMoved\" \"RookRight\") (can Move (\"CastleRook\" \"RookRight\" W 2 (or (is Empty (between)) (!= (value Piece at:(from)) (value Piece at:(between))))))) \"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\" (do (set Value at:(mapEntry #1 (mover)) (% (+ (value Piece at:(mapEntry #1 (mover))) 1) 2)) next:(slide (from (mapEntry #1 (mover))) #2 (between (exact #3) if:#4) (to if:True (apply (\"PieceHasMoved\" (from))))))) (define \"DecideToCastle\" (do (set Value at:(mapEntry #1 (mover)) (% (+ (value Piece at:(mapEntry #1 (mover))) 1) 2)) next:(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 (and (if (= (state at:(last To)) 1) (\"PieceHasMoved\" (last To))) (set Value at:(last To) (% (+ (value Piece at:(last To)) 1) 2))))) (define \"PieceHasMoved\" (set State at:#1 0)) (define \"HasNeverMoved\" (= (state at:(mapEntry #1 (mover))) 1)) (game \"Alice Chess\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (piece \"Pawn\" Each (or { (if (is In (from) (sites Start (piece (what at:(from))))) \"DoubleStep\") \"StepForwardToEmpty\" \"CaptureForwardDiagonal\"} (then (and { (if (is In (last To) (sites Mover \"Promotion\")) (moveAgain)) (set Counter) (set Value at:(last To) (% (+ (value Piece at:(last To)) 1) 2))})))) (piece \"Rook\" Each (move Slide Orthogonal (between if:(or (is Empty (between)) (!= (value Piece at:(from)) (value Piece at:(between))))) (to if:(and (\"IsEnemyAt\" (to)) (= (value Piece at:(from)) (value Piece at:(to)))) \"CaptureToPieceAndResetCounter\") \"RememberPieceHasMoved\")) (piece \"King\" Each (move Step (to if:(and (not (\"IsFriendAt\" (to))) (or (is Empty (to)) (= (value Piece at:(from)) (value Piece at:(to))))) \"CaptureToPieceAndResetCounter\") \"RememberPieceHasMoved\")) (piece \"Bishop\" Each (move Slide Diagonal (between if:(or (is Empty (between)) (!= (value Piece at:(from)) (value Piece at:(between))))) (to if:(and (\"IsEnemyAt\" (to)) (= (value Piece at:(from)) (value Piece at:(to)))) \"CaptureToPieceAndResetCounter\") (then (set Value at:(last To) (% (+ (value Piece at:(last To)) 1) 2))))) (piece \"Knight\" Each (move Leap \"KnightWalk\" (to if:(and (not (\"IsFriendAt\" (to))) (or (is Empty (to)) (= (value Piece at:(from)) (value Piece at:(to))))) \"CaptureToPieceAndResetCounter\") (then (set Value at:(last To) (% (+ (value Piece at:(last To)) 1) 2))))) (piece \"Queen\" Each (move Slide (between if:(or (is Empty (between)) (!= (value Piece at:(from)) (value Piece at:(between))))) (to if:(and (\"IsEnemyAt\" (to)) (= (value Piece at:(from)) (value Piece at:(to)))) \"CaptureToPieceAndResetCounter\") (then (set Value at:(last To) (% (+ (value Piece at:(last To)) 1) 2))))) (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\" (do (set Var \"promotedValue\" (value Piece at:(last To))) next:(move Promote (last To) (piece {\"Queen\" \"Knight\" \"Bishop\" \"Rook\"}) Mover (then (set Value at:(last To) (var \"promotedValue\"))))) (do (or (forEach Piece) (\"Castling\")) ifAfterwards:(not (\"IsInCheck\" \"King\" Mover))))) (end { (\"Checkmate\" \"King\") (if (or (no Moves Mover) (= (counter) 99)) (result Mover Draw))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nMOVEMENT - A stone must move as far as it can (no jumps) in a forward direction (orthogonal or diagonal). \n - At the first move, a player may choose any of his stones to move.\n - After that, a player must move a stone that is adjacent to the last moved enemy stone. If that is not possible, the player may choose any unblocked of his stones to move. \n - There is no capturing.\n \n GOAL - Wins the player that moved the last stone. \n\n###\n\n", "completion": "(game \"Forge\" (\"TwoPlayersNorthSouth\") (equipment { (board (rectangle 8 6) use:Vertex) (piece \"Ball\" Each (move Slide (directions Forwards of:All)))}) (rules (start { (place \"Ball1\" (expand (sites Bottom))) (place \"Ball2\" (expand (sites Top)))}) phases:{ (phase \"Opening\" (play (forEach Piece)) (nextPhase \"Main\")) (phase \"Main\" (play (priority { (forEach Piece (move Slide (from (from) if:(is In (from) (sites Around (last To) All))) (directions Forwards of:All))) (forEach Piece)})))} (end (\"BlockWin\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\n5x5 intersecting lines with diagonals drawn in each quadrant. Twelve pieces per player, which begin on the rows closest to the player and the two spots to the right of the central point, leaving the central point open. Players alternate turns moving the pieces along the lines of the board. The first play is from one of the pieces directly above or below the central point. Pieces cannot move backwards. A player may capture an opponent's piece by hopping over it to an empty spot immediately adjacent to the opponent's piece on the opposite side, along the lines of the board. Pieces which reach the opposite edge of the board from where they started are promoted and can move and capture any distance along the two large diagonals of the board. The player who captures all of the opponent's pieces wins. \n\n###\n\n", "completion": "(define \"HopLargeDiagonals\" (move Hop (from (from) if:(is In (from) (\"LargeDiagonals\"))) Adjacent (between before:(count Rows) after:(count Rows) if:(and (\"IsEnemyAt\" (between)) (is In (between) (\"LargeDiagonals\"))) (apply (remove (between)))) (to if:(and (is Empty (to)) (is In (to) (\"LargeDiagonals\")))))) (define \"LargeDiagonals\" (union (sites Direction from:4 NW included:True) (sites Direction from:0 NE included:True))) (game \"Fetach\" (\"TwoPlayersNorthSouth\") (equipment { (\"AlquerqueBoard\" 5 5) (piece \"Counter\" Each (or { (\"StepToEmpty\" (if (!= 0 (count Moves)) (difference Adjacent Backwards) Forwards) (then (\"PromoteIfReach\" (sites Next) \"DoubleCounter\"))) (\"HopCapture\" ~ (difference Adjacent Backwards) (then (\"PromoteIfReach\" (sites Next) \"DoubleCounter\")))})) (piece \"DoubleCounter\" Each (or { (\"StepToEmpty\" Adjacent) (\"HopCapture\" ~ Adjacent) (\"HopLargeDiagonals\")})) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start { (place \"Counter1\" (union {(expand (sites Bottom)) (sites {\"D3\" \"E3\"})})) (place \"Counter2\" (union {(sites {\"A3\" \"B3\"}) (expand (sites Top))}))}) (play (forEach Piece)) (end (\"CaptureAll\" Next)))) 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 King (king): moves one space orthogonally or diagonally. The King may leap one, two, or three squares on its first move if it has not yet been checked and does not hop over an opponent's piece. The King cannot make this leap over an opponent's piece. A capture cannot be made with this special first move. 1 x Queen: One square diagonally. On its first move, the Queen may jump diagonally two squares. The Queen cannot capture when making this move. 2 x Rook: Any number of spaces orthogonally. 2 x Bishop: Two squares diagonally, jumping over the first. Cannot capture another Bishop. 2 x Knight: Moves as a chess knight. 8 x Pawn: Moves one space forward orthogonally; one space forward diagonally to capture. The Rook's, King's and Queen's Pawns may move two spaces on its first move. The King's and Queen's Pawns are restricted in having this ability only if no piece on the board has been captured. Promoted to Queen when reaching the eighth rank, and may make the Queen's leap on its first move after being promoted, but cannot capture with this move. No castling. An opponent's piece is captured by moving a player's own piece onto a space occupied by the opponent's piece. When a King can be captured on the next turn by an opponent's piece, it is in check. The King must not be in check at the end of the player's turn. If this is not possible, it is checkmate and the opponent wins.\n \n\n###\n\n", "completion": "(define \"PieceHasMoved\" (set State at:#1 0)) (define \"RememberPieceHasMoved\" (then (if (= (state at:(last To)) 1) (\"PieceHasMoved\" (last To))))) (game \"Schachzabel\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (piece \"King\" Each (or (\"StepToNotFriend\") (if (= 1 (state at:(from))) (move Hop (between (range 1 3) if:(not (\"IsEnemyAt\" (between)))) (to if:(is Empty (to))))) (\"RememberPieceHasMoved\"))) (\"ChessRook\" \"Rook\") (piece \"Bishop\" Each (move Hop Diagonal (between if:True) (to if:(not (\"IsFriendAt\" (to))) (apply (if (\"IsEnemyAt\" (to)) (remove (to))))))) (\"ChessKnight\" \"Knight\") (piece \"Queen\" Each (or (\"StepToNotFriend\" Diagonal \"RememberPieceHasMoved\") (if (= 1 (state at:(from))) (move Hop Diagonal (between if:True) (to if:(is Empty (to))))) (\"RememberPieceHasMoved\"))) (\"ChessPawn\" \"Pawn\" (if (and { (is In (from) (sites Start (piece (what at:(from))))) (= 1 (state at:(from))) (= 32 (count Sites in:(sites Occupied by:All)))}) (\"DoubleStepForwardToEmpty\")) (then (if (is In (last To) (sites Mover \"Promotion\")) (and (promote (last To) (piece (id \"Queen\" Mover))) (set State at:(last To) 1))))) (regions \"Promotion\" P1 (sites Top)) (regions \"Promotion\" P2 (sites Bottom))}) (rules (start { (place \"Pawn1\" (sites {\"A2\" \"D2\" \"E2\" \"H2\"}) state:1) (place \"Pawn2\" (sites {\"A7\" \"D7\" \"E7\" \"H7\"}) state:1) (place \"Pawn1\" (sites {\"B2\" \"C2\" \"F2\" \"G2\"})) (place \"Pawn2\" (sites {\"B7\" \"C7\" \"F7\" \"G7\"})) (place \"Rook1\" {\"A1\" \"H1\"}) (place \"Knight1\" {\"B1\" \"G1\"}) (place \"Bishop1\" {\"C1\" \"F1\"}) (place \"Queen1\" coord:\"D1\" state:1) (place \"King1\" coord:\"E1\" state:1) (place \"Rook2\" {\"A8\" \"H8\"}) (place \"Knight2\" {\"B8\" \"G8\"}) (place \"Bishop2\" {\"C8\" \"F8\"}) (place \"Queen2\" coord:\"D8\" state:1) (place \"King2\" coord:\"E8\" state:1)}) (play (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King\" Mover)) (then (if (and (= 1 (state at:(where \"King\" Next))) (\"IsInCheck\" \"King\" Next)) (\"PieceHasMoved\" (where \"King\" Next)))))) (end (\"Checkmate\" \"King\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\n5x5 board. Twelve pieces per player. Pieces begin in the rows closest to the player, and the two 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 (5x5)\" (players 2) (equipment { (board (square 5)) (piece \"Marker\" Each (or (\"HopOrthogonalSequenceCapture\") (move Slide Orthogonal)))}) (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 (\"CaptureAll\" Next)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nOn your turn, place a single piece of your color on an empty position that is not next to another friendly piece. This is compulsory whenever it is possible to do so.\n \n When it is not possible to place a piece; then instead, step one of your pieces to an adjacent empty position. \n \n You win either:\n -- when all your pieces become connected, or\n -- when you cut-off your opponent from being able to connect theirs. Board: Muster order 3 board - 45 positions Angled cells\n\n###\n\n", "completion": "(define \"Order6\" (poly { { 1 8} { 2 7} { 14 1} { 15 2} { 21 14} { 20 15} { 8 21} { 7 20}})) (define \"Order5\" (poly { { 1 7} { 2 6} { 12 1} { 13 2} { 18 12} { 17 13} { 7 18} { 6 17}})) (define \"Order4\" (poly { { 1 6} { 2 5} { 10 1} { 11 2} { 15 10} { 14 11} { 6 15} { 5 14}})) (define \"Order3\" (poly { { 1 5} { 2 4} { 8 1} { 9 2} { 12 8} { 11 9} { 5 12} { 4 11}})) (define \"Order2\" (poly { { 1 4} { 2 3} { 6 1} { 7 2} { 9 6} { 8 7} { 4 9} { 3 8}})) (define \"NoPlacementAvailable\" (all Sites (sites Empty) if:(not (no Pieces Mover in:(sites Around (site) All))))) (game \"Make Muster\" (players 2) (equipment { (board (rotate (- 90 62) (square \"Order3\")) use:Cell) (piece \"Disc\" Each (\"StepToEmpty\"))}) (rules (play (priority (move Add (to (sites Empty) if:(no Pieces Mover in:(sites Around (to) Adjacent)))) (forEach Piece))) (end (if (or (and { (\"IsSingleGroup\" Mover All) (< 1 (count Pieces Mover))}) (< 1 (count Groups All if:(!= (mover) (who at:(to)))))) (result Mover Win))))) 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. Sticks are used to play, (five per player), and are played in the spaces between corn kernels. Dice are also corn kernels, with one side marked with a black dot. Four dice are used, the value of a move determined by the number of black dots that land face up. Each player has two throws on their turn, and moves after the second throw. The throws both must be used, and can be used in any order. Each team's home is the side of the board to their left. Each team moves toward the opposite end of the track, and then back to home. All of the players on one team play in succession, and then the players on the other team play next. Players enter the men on their throws and move along the track. Each player may have only one piece on the board at a time. When a player reaches the team's home field, the piece may be re-entered. Reaching the home field does not require an exact throw, and if one throw brings a player home, they may use the second throw to enter it again. If a piece lands on that of an opponent, it is captured and immediately leaved the board with the capture. Neither piece is reentered. Pieces belonging to the same team may occupy the same space with no consequence for the game. When one team has no more counters left to enter, the winner is the team that captured most of the opposing team's pieces.\n The game has 6 players.\n\n###\n\n", "completion": "(define \"CaptureMove\" (forEach Level (to) FromTop (if (\"IsEnemyAt\" (to) level:(level)) (remove (to) level:(level))))) (define \"NoPieceOnBoard\" (< (count Pieces Mover in:(sites Board)) 1)) (define \"ThrowValue\" (count Pips)) (game \"Aj T'iwil\" (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)} use:Edge) (regions \"AllSites\" (sites Board Vertex)) (piece \"Stick\" Each (forEach Value (values Remembered \"Throws\") (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 (and (\"CaptureMove\") (forget Value \"Throws\" (value))))))))) (\"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 (if (< 0 (size Array (values Remembered \"Throws\"))) (moveAgain))))) (nextPhase (= 0 (size Array (values Remembered \"Throws\"))) \"ThrowPhase\"))} (end (\"CaptureAllTeam\")))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe puzzle is played on a 4x4 board -> The puzzle is played on a 5x5 board\n(game \"N Queens\" (players 1) (equipment { (board (square 4) (values Cell (range 0 1))) (regions {AllDirections})}) (rules (play (satisfy { (is Count (sites Board) of:1 4) (all Different except:0)})) (end (if (is Solved) (result P1 Win)))))\n\n###\n\n", "completion": "(game \"N Queens\" (players 1) (equipment { (board (square 5) (values Cell (range 0 1))) (regions {AllDirections})}) (rules (play (satisfy { (is Count (sites Board) of:1 5) (all Different except:0)})) (end (if (is Solved) (result P1 Win))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"JumpToPromotionZone\" (is In (last To) (sites Next))) (define \"IsQueen\" (\"IsPieceAt\" \"DoubleCounter\" Mover (last To))) (define \"IsUnpromoted\" (\"IsPieceAt\" \"Counter\" Mover (last To))) (define \"HopDoubleCounter\" (move Hop #1 Diagonal (between #2 #3 if:(and (not (is In (between) (sites ToClear))) (\"IsEnemyAt\" (between))) (apply (remove (between) #4))) (to if:(is Empty (to))) (then (\"ReplayIfCanMove\" (hop (from (last To)) Diagonal (between #2 #3 if:(and (not (is In (between) (sites ToClear))) (\"IsEnemyAt\" (between))) (apply (remove (between) #4))) (to if:(is Empty (to)))) (\"PromoteIfReach\" (sites Next) \"CounterStar\"))))) (game \"Unnamed Dutch Draughts Game\" (\"TwoPlayersNorthSouth\") (\"DraughtsEquipment\" (square 10) ~ (piece \"CounterStar\" Each)) (rules (start { (place \"Counter1\" (difference (expand (sites Bottom) steps:3) (union (sites Bottom) (sites Phase 1)))) (place \"Counter2\" (difference (expand (sites Top) steps:3) (union (sites Top) (sites Phase 1)))) (place \"DoubleCounter1\" (difference (sites Bottom) (sites Phase 1))) (place \"DoubleCounter2\" (difference (sites Top) (sites Phase 1)))}) (play (if (\"SameTurn\") (if (\"IsUnpromoted\") (max Moves (\"HopInternationalDraughtsStyle\" (from (last To)) (then (\"ReplayIfCanMove\" (\"HopInternationalDraughtsStyle\" (from (last To))) (\"PromoteIfReach\" (sites Next) \"DoubleCounter\"))))) (if (\"IsQueen\") (max Moves (\"HopDoubleCounter\" (from (last To)) before:(count Rows) after:(count Rows) at:EndOfTurn)) (max Moves (\"HopSequenceCaptureAgain\" 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\" (\"HopDoubleCounter\" (from) before:(count Rows) after:(count Rows) at:EndOfTurn)) (forEach Piece \"CounterStar\" (\"HopSequenceCapture\" 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) (then (\"PromoteIfReach\" (sites Next) \"CounterStar\"))) (forEach Piece \"CounterStar\" (move Slide))})}))) (end (\"BlockWin\"))))\n\n###\n\n", "completion": "10x10 board. Twenty pieces per player, which begin on the four rows closest to the player. The row of pieces on the edge of the board closest to each player begins with the pieces already as Queens. Pieces move diagonally one space forward, or can jump an adjacent piece belonging to the opponent to capture it. Captures are mandatory, and the maximum number of captures possible must be taken. When pieces reach the opposite edge of the board from where they started, they are promoted to Queen. Queens move any number of spaces diagonally, and jump over any number of opponents' pieces over any distance. When a Queen reaches that edge of the board a second time (or, for the first time if one of those which began the game as a Queen), they are further promoted, gaining the power to move and take orthogonally over any distance. The player who captures all of the opponent's pieces wins. END" }, { "prompt": "Construct a Ludii game based on the following description\n8x8 board, not checkered. Pieces, their number, and moves are as follows: Ang/Sdaach (\\ \n\n###\n\n", "completion": "(define \"PieceHasMoved\" (set State at:#1 0)) (define \"RememberPieceHasMoved\" (then (if (= (state at:(last To)) 1) (\"PieceHasMoved\" (last To))))) (game \"Ouk Chatrang\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (hand Each size:5) (piece \"King_noCross\" Each (or (\"StepToNotFriend\") (if (= 1 (state at:(from))) (\"LeapToEmpty\" \"KnightWalk\")) \"RememberPieceHasMoved\")) (\"ChessRook\" \"Boat\") (piece \"Ferz_noCross\" Each (or (\"StepToNotFriend\" Diagonal) (\"StepToNotFriend\" Forward))) (\"ChessKnight\" \"Knight\") (\"ChessPawn\" \"Fish\" ~ (then (\"PromoteIfReach\" (sites Mover \"Promotion\") \"Queen\"))) (piece \"Queen\" Each (or (\"StepToNotFriend\" Diagonal) (if (= 1 (state at:(from))) (move Hop Forward (between if:True) (to if:(not (\"IsFriendAt\" (to))) (apply (remove (to)))))) \"RememberPieceHasMoved\")) (regions \"Promotion\" P1 (sites Row 5)) (regions \"Promotion\" P2 (sites Row 2))}) (rules (start { (place \"Fish1\" (sites Row 2)) (place \"Fish2\" (sites Row 5)) (place \"Boat1\" {\"A1\" \"H1\"}) (place \"Knight1\" {\"B1\" \"G1\"}) (place \"Ferz_noCross1\" {\"C1\" \"F1\"}) (place \"Queen1\" coord:\"D1\" state:1) (place \"King_noCross1\" coord:\"E1\" state:1) (place \"Boat2\" {\"A8\" \"H8\"}) (place \"Knight2\" {\"B8\" \"G8\"}) (place \"Ferz_noCross2\" {\"C8\" \"F8\"}) (place \"Queen2\" coord:\"D8\" state:1) (place \"King_noCross2\" coord:\"E8\" state:1)}) (play (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King_noCross\" Mover)))) (end { (\"Checkmate\" \"King_noCross\") (\"DrawIfNoMoves\" 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": "Construct a Ludii game based on the following description\n4x8 board. Two counters in each hole. Opening play: Players simultaneously arrange their counters in the following patter, beginning from the bottom left and proceeding anti-clockwise: 0, 6, 0, 0, 0, 0, 0, 17, 0, 3, 0, 3, 0, 3, 0, 0. Players then move alternately. The first three turns are made by sowing from the holes with three holes, proceeding in order from the one furthest to the left, sowing two in the next hole and one in the following. They then sow from the next hole to the right with three counters on the next turn in the same way. Main phase: Play begins from any hole on the player's side of the board with counters in it. Singletons cannot move. Sowing happens in an anti-clockwise direction. If the last counter lands in an empty hole, the turn is over. For capturing: Holes are in 'opposition' when one player has the front row hole occupied and the opponent has both of the holes opposite it occupied. If the last hole in a sowing is in opposition, the player takes the counters in both of the opponent's holes and places them in the empty hole from which the player lifted the counters. The player then sows the captured counters from this hole. Further captures in the sowing can occur in the same way. However, each player has two hole from which clockwise plays can be made: the leftmost hole in the outer row and the second from the left in the inner row. Clockwise moves can only be made from these holes if they immediately lead to a capture. When the captured counters are sown, starting from the same hole, they can also be sown clockwise if they lead to a capture. If they cannot lead to a capture, they are sown anti-clockwise. Another alternative the player has is that, if the player plays clockwise from one of these holes and therefore makes a capture, the captured counters may be placed in the hole and left there, and the player may play instead from the other hole from which clockwise captures are allowed in a clockwise direction, if it leads to a capture. The player may continue playing from this hole as above until the possibilities to move are exhausted, and then may move from any hole in an anti-clockwise direction. Multiple captures can only be made in a clockwise direction from these holes if it is made on the first sowing of the turn. Otherwise, only one clockwise capture can be made and sowing must proceed in an anti-clockwise direction. If the last counter lands on a hole that is occupied but not in opposition, these counters are picked up and sowing continues. Play ends when one player captures all the opponent's counters or one player cannot play. The player who cannot play loses. A player may also win by capturing the counters from both of the opponent's end holes in the inner row in a single turn. \n\n###\n\n", "completion": "(define \"NextHole\" (\"NextSiteOnTrack\" #3 from:#1 #2)) (define \"OuterPhaseOppositePit\" (if (is Mover P1) (+ (to) (* 3 (\"Columns\"))) (- (to) (* (\"Columns\") 3)))) (define \"Columns\" 8) (game \"Ikibuguzo (Opening 1)\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" 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\" \"24,E,S1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"TrackCCW1\")) (regions \"Home\" P2 (sites Track \"TrackCCW2\")) (regions \"Inner\" P1 (difference (sites Track \"TrackCCW1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"TrackCCW2\") (sites Top))) (map \"FirstMove\" {(pair P1 10) (pair P2 21)}) (map \"SecondMove\" {(pair P1 12) (pair P2 19)}) (map \"ThirdMove\" {(pair P1 14) (pair P2 17)}) (map \"LeftMostOuter\" {(pair P1 0) (pair P2 31)}) (map \"SecondLeftInner\" {(pair P1 9) (pair P2 22)}) (piece \"Seed\" Shared) (hand Each)}) (rules (start { (set Count 6 to:(sites {\"G4\" \"B1\"})) (set Count 17 to:(sites {\"H1\" \"A4\"})) (set Count 3 to:(sites {\"G2\" \"E2\" \"C2\" \"B3\" \"D3\" \"F3\"}))}) phases:{ (phase \"FirstMove\" (play (move (from (mapEntry \"FirstMove\" Mover)) (to (\"NextHole\" (from) \"TrackCCW\" 1)) count:2 (then (fromTo (from (mapEntry \"FirstMove\" Mover)) (to (\"NextHole\" (from) \"TrackCCW\" 2)) count:1)))) (nextPhase Mover \"SecondMove\")) (phase \"SecondMove\" (play (move (from (mapEntry \"SecondMove\" Mover)) (to (\"NextHole\" (from) \"TrackCCW\" 1)) count:2 (then (fromTo (from (mapEntry \"SecondMove\" Mover)) (to (\"NextHole\" (from) \"TrackCCW\" 2)) count:1)))) (nextPhase Mover \"ThirdMove\")) (phase \"ThirdMove\" (play (move (from (mapEntry \"ThirdMove\" Mover)) (to (\"NextHole\" (from) \"TrackCCW\" 1)) count:2 (then (fromTo (from (mapEntry \"ThirdMove\" Mover)) (to (\"NextHole\" (from) \"TrackCCW\" 2)) count:1)))) (nextPhase Mover \"MainPhase\")) (phase \"MainPhase\" (play (or (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (sites {(mapEntry \"LeftMostOuter\" Mover) (mapEntry \"SecondLeftInner\" Mover)})) if:(and { if:(if (\"SameTurn\") (< 0 (count at:(from))) (< 1 (count at:(from)))) (is In (from) (sites {(mapEntry \"LeftMostOuter\" Mover) (mapEntry \"SecondLeftInner\" Mover)})) (is In (\"NextHole\" (from) \"TrackCW\" (count at:(from))) (sites Mover \"Inner\")) (is Occupied (\"OppositePit\" (\"NextHole\" (from) \"TrackCW\" (count at:(from))))) (is Occupied (\"OppositeOuterPit\" (\"NextHole\" (from) \"TrackCW\" (count at:(from)))))})) (then (sow \"TrackCW\" owner:(mover) apply: (if (< 1 (count at:(to))) (and (moveAgain) (if (and { (is Occupied (\"OppositePit\" (to))) (is Occupied (\"OppositeOuterPit\" (to))) (is In (to) (sites Mover \"Inner\"))}) (and { (fromTo (from (\"OppositePit\" (to))) (to (last From)) count:(count at:(\"OppositePit\" (to)))) (fromTo (from (\"OppositeOuterPit\" (to))) (to (last From)) count:(count at:(\"OppositeOuterPit\" (to)))) (set Var \"Replay\" (from))}) (set Var \"Replay\" (to)))))))) (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (sites Mover)) if:(if (\"SameTurn\") (< 0 (count at:(from))) (< 1 (count at:(from))))) (then (sow \"TrackCCW\" owner:(mover) apply: (if (< 1 (count at:(to))) (and (moveAgain) (if (and { (is Occupied (\"OppositePit\" (to))) (is Occupied (\"OppositeOuterPit\" (to))) (is In (to) (sites Mover \"Inner\"))}) (and { (fromTo (from (\"OppositePit\" (to))) (to (last From)) count:(count at:(\"OppositePit\" (to)))) (fromTo (from (\"OppositeOuterPit\" (to))) (to (last From)) count:(count at:(\"OppositeOuterPit\" (to)))) (set Var \"Replay\" (from))}) (set Var \"Replay\" (to)))))))))) (end (\"BlockWin\")))})) END" }, { "prompt": "Construct a Ludii game based on the following description\n5x5 board. Twelve pieces per player. Players alternate turns placing two pieces on the board. When all of the pieces are placed, players alternate turns moving one piece orthogonally any distance. The first player to place five of their pieces in an orthogonal or diagonal line wins.\n \n\n###\n\n", "completion": "(game \"Fart (5x5)\" (players 2) (equipment { (board (square 5)) (piece \"Marker\" Each (move Slide Orthogonal)) (hand Each)}) (rules (start (place \"Marker\" \"Hand\" count:12)) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (difference (sites Board) (centrePoint)) if:(is Empty (to))) (then (if (\"NewTurn\") (moveAgain))))) (nextPhase Mover (is Empty (handSite Mover)) \"Move\")) (phase \"Move\" (play (forEach Piece)))} (end (if (is Line 5) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nOn a player's turn he or she must perform one of the following actions:\n 1) Move a tower (2-stack) by distributing its two stones into the two nearest cells in any one direction. Each destination cell must be empty or contain a single friendly stone. \n 2) Sacrifice a single tower stone to remove an adjacent enemy wall (1-stack). Sacrifice is not forced.\nGoal: A player wins immediately by reaching any cell of his or her opponent's home row, or by stalemating his or her opponent. Stack limit is 2. Standard 7 x 8, one row Immediately after reaching goal.\n\n###\n\n", "completion": "(define \"ThrowStonetoEnemy\" (move Hop (from if:(and (is Mover (who at:(from))) (= (size Stack at:(from)) 3))) (difference All Backwards) (between (range 1 2) if:True) (to if: (\"IsEnemyAt\" (to))) (then (and (remove (last To)) (remove (last To)))))) (define \"ThrowStonetoEmpty\" (move Hop (from if:(and (is Mover (who at:(from))) (= (size Stack at:(from)) 3))) (difference All Backwards) (between (range 1 2) if:True) (to if: (and (not (\"IsEnemyAt\" (to))) (not (is Mover (who at:(to)))))))) (define \"SacrificeCaptureCatapult\" (move Step (from if:(and (is Mover (who at:(from))) (= (size Stack at:(from)) 2))) (to if:(and (\"IsEnemyAt\" (to)) (= (size Stack at:(to)) 3)) (apply (remove (to)))) stack:True (then (and { (fromTo (from (last To)) (to (last From))) (remove (last To)) (moveAgain)})))) (define \"SacrificeCaptureWall\" (move Step (from if:(and (is Mover (who at:(from))) (= (size Stack at:(from)) 2))) (to if:(and (\"IsEnemyAt\" (to)) (\"IsSingletonStack\" (to))) (apply (remove (to)))) stack:True (then (and (fromTo (from (last To)) (to (last From))) (remove (last To)))))) (define \"MoveTower\" (move Hop (from if:(and (is Mover (who at:(from))) (= (size Stack at:(from)) 2))) (between if:(or (is Empty (between)) (and (is Mover (who at:(between))) (< (size Stack at:(between)) 2))) (apply (fromTo (from) (to (between))))) (to if:(or (is Empty (to)) (and (is Mover (who at:(to))) (< (size Stack at:(to)) 2)))) stack:True)) (game \"Murus Gallicus\" (\"TwoPlayersNorthSouth\") (equipment { (board (rectangle 7 8)) (piece \"Counter_isometric\" Each) (regions \"RomanGoal1\" P1 (sites Top)) (regions \"GaulGoal2\" P2 (sites Bottom))}) (rules (start { (place Stack \"Counter_isometric1\" (sites {0..7}) count:2) (place Stack \"Counter_isometric2\" (sites {48..55}) count:2)}) (play (if (\"SameTurn\") (or (move (from (last From)) (to (last To)) stack:True (then (and (remove (last To)) (remove (last To))))) (move Pass)) (forEach Piece \"Counter_isometric\" (or { \"MoveTower\" \"SacrificeCaptureWall\" \"SacrificeCaptureCatapult\" \"ThrowStonetoEmpty\" \"ThrowStonetoEnemy\"}) top:True))) (end { (\"BlockWin\") (if (and { (is In (last To) (sites Mover)) (not (\"IsEnemyAt\" (last To))) (is Mover (who at:(last To)))}) (result Mover Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nGoal:Score the product of the sizes of your two largest chains. Highest score wins. \n In case of a tie, the last to play wins.\n \n Chains are a series of adjacent like-colored stones with no branching.\n \n Play:\n Boards starts empty. The darker color starts.\n \n On a turn the moving player does one of these actions:\n - Place one of their stones onto an empty site adjacent to no more than 2 of their stones, or\n - Remove one of their stones that is adjacent to more than two of their stones.\n \n Otherwise he passes.\n \n The game ends when both players pass. Order 4-5, Hex Grid\n\n###\n\n", "completion": "(define \"AddOrPass\" (or { (move Add (piece (id \"Disc\" Mover)) (to (sites Empty) if:(> 3 (count Pieces Mover in:(sites Around (to) \"GridDirection\")))) (then (set Var \"Added\" 1))) (move Pass)})) (define \"Score4\" (do (forEach Site (sites Occupied by:#1) (if (> 3 (count Pieces #1 in:(sites Around (site) \"GridDirection\"))) (set State at:(site) 0) (set State at:(site) 1))) next:(do (and { (remember Value 0) (remember Value 0) (forEach Group \"GridDirection\" (if (no Pieces in:(intersection (sites) (sites State 1))) (remember Value (count Sites in:(sites)))))}) next:(set Var \"TopValue\" (max (values Remembered)) (then (forget Value (max (values Remembered)) (then (set Score #1 (* (var \"TopValue\") (max (values Remembered))) (then (forget Value All)))))))))) (define \"GridDirection\" Orthogonal) (game \"Wrigglers\" (players 2) (equipment { (board (tri Limping 4) use:Vertex) (piece \"Disc\" Each)}) (rules (play (if (= 1 (var \"Added\")) (or { \"AddOrPass\" (forEach Piece (if (< 2 (count Pieces Mover in:(sites Around (from) \"GridDirection\"))) (move Remove (from) (then (set Var \"Added\" 0)))) Mover)}) \"AddOrPass\" (then (\"Score4\" Mover)))) (end (if (all Passed) { (if (>= (score Mover) (score Next)) (result Mover Win))} (result Next Win))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe players play on CrossGeoR-B version. -> The players play on CrossGeoR-G-B version.\n(game \"CrossGeo\" (players 2) (equipment { (board (graph vertices:{ {2 0} {3 0} {1 1} {1 2} {0 2} {0 4} {1 3} {1 5} {2 4} {2 2} {4 2} {3 3} {3 1} {5 1} {6 2} {6 1} {8 1} {7 3} {9 3} {9 1} {8 4} {8 2} {10 3} {11 2} {11 1} {13 1} {13 3} {14 2} {10 3} {10 5} {8 5} {9 6} {12 3} {11 4} {13 6} {12 4} {14 6} {11 6} {5 7} {11 7} {8 7} {8 6} {7 6} {7 8} {4 4} {5 3} {6 4} {5 5} {7 5} {6 6} {1 7} {3 7} {2 6} {4 6} {3 5} {13 4}} edges:{ {0 1} {0 2} {2 3} {1 3} {4 5} {5 8} {6 7} {9 10} {11 12} {12 13} {14 15} {15 16} {17 18} {18 19} {20 21} {21 22} {23 27} {24 25} {25 26} {28 29} {29 30} {31 32} {33 34} {35 36} {37 55} {42 43} {38 39} {40 41} {44 46} {46 49} {45 47} {47 48} {52 53} {50 51} {51 54}}) use:Edge) (piece \"Disc\" Each) (piece \"Marker\" Shared)}) (rules (start { (set P1 Edge (sites {0..9})) (set P2 Edge (difference (sites Board Edge) (sites {0..9})))}) (play (move Remove (sites Occupied by:Mover) (then (forEach Site (sites Crossing at:(last To) All) (remove Edge (to)))))) (end (if (no Moves Mover) (result Next Win)))))\n\n###\n\n", "completion": "(game \"CrossGeo\" (players 2) (equipment { (board (graph vertices:{ {2 0} {3 0} {1 1} {1 2} {0 2} {0 4} {1 3} {1 5} {2 4} {2 2} {4 2} {3 3} {3 1} {5 1} {6 2} {6 1} {8 1} {7 3} {9 3} {9 1} {8 4} {8 2} {10 3} {11 2} {11 1} {13 1} {13 3} {14 2} {10 3} {10 5} {8 5} {9 6} {12 3} {11 4} {13 6} {12 4} {14 6} {11 6} {5 7} {11 7} {8 7} {8 6} {7 6} {7 8} {4 4} {5 3} {6 4} {5 5} {7 5} {6 6} {1 7} {3 7} {2 6} {4 6} {3 5} {13 4}} edges:{ {0 1} {0 2} {2 3} {1 3} {4 5} {5 8} {6 7} {9 10} {11 12} {12 13} {14 15} {15 16} {17 18} {18 19} {20 21} {21 22} {23 27} {24 25} {25 26} {28 29} {29 30} {31 32} {33 34} {35 36} {37 55} {42 43} {38 39} {40 41} {44 46} {46 49} {45 47} {47 48} {52 53} {50 51} {51 54}}) use:Edge) (piece \"Disc\" Each) (piece \"Marker\" Shared)}) (rules (start { (set P1 Edge (sites {0..5 13..20})) (set P2 Edge (sites {9..12 23..30})) (set Shared Edge (difference (sites Board Edge) (union (sites {0..5 13..20}) (sites {9..12 23..30}))))}) (play (move Remove (difference (sites Occupied by:All) (sites Occupied by:Next)) (then (forEach Site (sites Crossing at:(last To) All) (remove Edge (to)))))) (end (if (no Moves Mover) (result Next Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n10x10 board, with an extra square placed diagonally behind each Rukh. The pieces move as follows, with the number per player: 1 x Shah (king): moves one space orthogonally or diagonally. 1 x Fers (counselor): One square diagonally. 2 x Rukh (rook): Any number of spaces orthogonally. 2x Dabbaba: any number of squares diagonally. 2 x Pil (elephant): Two squares diagonally, jumping over the first. Cannot capture another Pil. 2 x Asb (horse): Moves as a Chess knight. 12 x Sarbaz (soldier): Moves one space forward orthogonally; one space forward diagonally to capture. No en passant. Promoted to Fers when reaching the tenth rank. No castling. Stalemate results in win for player causing it. The player who checkmates the king wins. If a player moves their king into one of the extra squares on the opposite side of the board, the game is a draw.\n \n\n###\n\n", "completion": "(game \"Shatranj al-Husun\" (\"TwoPlayersNorthSouth\") (equipment { (board (merge { (square 10) (shift -1 -1 (square 1)) (shift 10 -1 (square 1)) (shift -1 10 (square 1)) (shift 10 10 (square 1))})) (\"ChessKing\" \"King\") (piece \"Queen\" Each (\"StepToNotFriend\" Diagonal)) (\"ChessRook\" \"Rook\") (\"ChessKnight\" \"Knight\") (piece \"Elephant\" Each (move Hop Diagonal (between if:True) (to if:(or (is Empty (to)) (and (\"IsEnemyAt\" (to)) (not (\"IsPieceAt\" \"Elephant\" Next (to))))) (apply (remove (to)))))) (\"ChessBishop\" \"Bishop\") (\"ChessPawn\" \"Pawn\" (if (is In (from) (sites Start (piece (what at:(from))))) (\"DoubleStepForwardToEmpty\")) (then (\"PromoteIfReach\" (sites Mover \"Promotion\") \"Queen\"))) (regions \"Promotion\" P1 (sites Row 10)) (regions \"Promotion\" P2 (sites Row 1)) (regions \"OppositeExtraSquares\" P1 (sites Top)) (regions \"OppositeExtraSquares\" P2 (sites Bottom))}) (rules (start { (place \"Pawn1\" (sites Row 2)) (place \"Pawn2\" (sites Row 9)) (place \"Rook1\" (sites {\"B2\" \"K2\"})) (place \"Knight1\" (sites {\"C2\" \"J2\"})) (place \"Elephant1\" (sites {\"D2\" \"I2\"})) (place \"Bishop1\" (sites {\"E2\" \"H2\"})) (place \"King1\" coord:\"F2\") (place \"Queen1\" coord:\"G2\") (place \"Rook2\" (sites {\"B11\" \"K11\"})) (place \"Knight2\" (sites {\"C11\" \"J11\"})) (place \"Elephant2\" (sites {\"D11\" \"I11\"})) (place \"Bishop2\" (sites {\"E11\" \"H11\"})) (place \"King2\" coord:\"F11\") (place \"Queen2\" coord:\"G11\")}) (play (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King\" Mover)))) (end { (if (is In (where \"King\" Mover) (sites Mover \"OppositeExtraSquares\")) (result Mover Draw)) (\"Checkmate\" \"King\") (\"BlockWin\")}))) 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": "Modify the Ludii game according to the following option changes:\nEach row has 12 holes. -> Each row has 14 holes.\n(define \"AllSitesNoMoreThanOne\" (all Sites (sites Mover \"Home\") if:(>= 1 (count at:(site))))) (define \"NextHole\" (\"NextSiteOnTrack\" #2 from:#1 \"Track\")) (define \"NoPiece\" (all Sites (sites Player \"Home\") if:(= 0 (count at:(site))))) (define \"Columns\" 12) (game \"Nsolo\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"0,E,N1,W\" loop:True P1) (track \"Track2\" \"24,E,N1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"Track1\")) (regions \"Home\" P2 (sites Track \"Track2\")) (regions \"Inner\" P1 (difference (sites Track \"Track1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"Track2\") (sites Top))) (piece \"Seed\" Shared)}) (rules (start (set Count 2 to:(union { (sites Bottom) (sites Top) (difference (sites P1 \"Inner\") (sites Right)) (difference (sites P2 \"Inner\") (sites Left))}))) (play (if (and (\"SameTurn\") (= (var \"Replay\") Undefined)) (move Remove (sites Next \"Home\")) (if (\"AllSitesNoMoreThanOne\") (move Select (from (sites Mover \"Home\") if:(and (is Occupied (from)) (is Empty (\"NextHole\" (from) 1)))) (then (sow \"Track\" owner:(mover)))) (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (sites Mover \"Home\")) if:(> (count at:(from)) 1)) (then (sow \"Track\" owner:(mover) apply:(if (< 1 (count at:(to))) (if (and (is In (to) (sites Mover \"Inner\")) (is Occupied (\"OppositePit\" (to)))) (and (remove (\"OppositePit\" (to))) (if (is Occupied (\"OppositeOuterPit\" (to))) (and { (moveAgain) (set Var \"Replay\" Undefined) (remove (\"OppositeOuterPit\" (to)))}))) (and (moveAgain) (set Var \"Replay\" (to))))))))))) (end (forEach NonMover if:(\"NoPiece\") (result Player Loss)))))\n\n###\n\n", "completion": "(define \"AllSitesNoMoreThanOne\" (all Sites (sites Mover \"Home\") if:(>= 1 (count at:(site))))) (define \"NextHole\" (\"NextSiteOnTrack\" #2 from:#1 \"Track\")) (define \"NoPiece\" (all Sites (sites Player \"Home\") if:(= 0 (count at:(site))))) (define \"Columns\" 14) (game \"Nsolo\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"0,E,N1,W\" loop:True P1) (track \"Track2\" \"28,E,N1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"Track1\")) (regions \"Home\" P2 (sites Track \"Track2\")) (regions \"Inner\" P1 (difference (sites Track \"Track1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"Track2\") (sites Top))) (piece \"Seed\" Shared)}) (rules (start (set Count 2 to:(union { (sites Bottom) (sites Top) (difference (sites P1 \"Inner\") (sites Right)) (difference (sites P2 \"Inner\") (sites Left))}))) (play (if (and (\"SameTurn\") (= (var \"Replay\") Undefined)) (move Remove (sites Next \"Home\")) (if (\"AllSitesNoMoreThanOne\") (move Select (from (sites Mover \"Home\") if:(and (is Occupied (from)) (is Empty (\"NextHole\" (from) 1)))) (then (sow \"Track\" owner:(mover)))) (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (sites Mover \"Home\")) if:(> (count at:(from)) 1)) (then (sow \"Track\" owner:(mover) apply:(if (< 1 (count at:(to))) (if (and (is In (to) (sites Mover \"Inner\")) (is Occupied (\"OppositePit\" (to)))) (and (remove (\"OppositePit\" (to))) (if (is Occupied (\"OppositeOuterPit\" (to))) (and { (moveAgain) (set Var \"Replay\" Undefined) (remove (\"OppositeOuterPit\" (to)))}))) (and (moveAgain) (set Var \"Replay\" (to))))))))))) (end (forEach NonMover if:(\"NoPiece\") (result Player Loss))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nMovement is the same as regular amazons. You can move or shoot as many spaces as you want in any orthogonal or diagonal direction. With a hex board you have 6 orthogonal lines of movement (green) as well as 6 diagonal lines of movement (blue).\n \n Like in the original, Amazons still cannot move or shoot through other arrows or other amazons. However the diagonals are a little bit more tricky than the original. If the two orthogonal spaces next to the diagonal line are blocked, than the amazon can no longer use (or continue along) this diagonal. This is important because it reduces the movement capabilities of the amazons and allows a wall of connected arrows to become impenetrable.\n \n One final rule, in order to balance the game (white has first move advantage). On whites first turn he/she can only move an amazon but not shoot an arrow afterwards. This prevents potential too strong opening moves.\n \n The first player to block the opponent wins. \n\n###\n\n", "completion": "(define \"QueenMove\" (or (move Slide) (move Slide Diagonal (between if:(is Empty (between))) (to if:(\"ToEmptyAndBlocked\") (apply if:(\"NotBlockedOrNotMaxSlide\")))) #1)) (define \"ToEmptyAndNotBlocked\" (and (is Empty (to)) (!= 2 (\"NumPiecesBetweenDiagonalStep\")))) (define \"NotBlockedOrNotMaxSlide\" (or (= (between) (to)) (!= 2 (\"NumPiecesBetweenDiagonalStep\")))) (define \"ToEmptyAndBlocked\" (and (is Empty (to)) (= 2 (\"NumPiecesBetweenDiagonalStep\")))) (define \"NumPiecesBetweenDiagonalStep\" (count Sites in:(forEach (intersection (sites Incident Cell of:Cell at:(if (!= (between) Off) (between) (from))) (sites Incident Cell of:Cell at:(to))) if:(is Occupied (site))))) (game \"Hex Amazons\" (players 2) (equipment { (board (hex 7)) (piece \"Queen\" Each (\"QueenMove\" (then (moveAgain)))) (piece \"Dot\" Neutral)}) (rules (start { (place \"Queen1\" {\"B2\" \"G2\" \"E5\" \"B7\"}) (place \"Queen2\" {\"L12\" \"G12\" \"L7\" \"I9\"})}) phases:{ (phase \"Opening\" P1 (play (forEach Piece \"QueenMove\")) (nextPhase Mover \"Playing\")) (phase \"Playing\" (play (if (\"SameTurn\") (or (move Shoot (piece \"Dot0\")) (move Shoot (piece \"Dot0\") Diagonal (between if:(is Empty (between))) (to if:(\"ToEmptyAndNotBlocked\")))) (forEach Piece))))} (end (\"BlockWin\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\n8x8 board. Two players. Pieces and movement are as follows: King x1, placed on the fifth space from the left on one edge of the board: Moves one space orthogonally or diagonally. Pawns x8, arranged along the row in front of the king: moves one space forward orthogonally or one space forward diagonally to capture. The opponent's pieces are placed in the same position on the opposite side of the board. If the King can be taken on the next turn it is in check, it must not remain in check on the next turn. If the king cannot move out of check, checkmate is declared and the opponent wins. \n\n###\n\n", "completion": "(game \"Shatr ikh Padan\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (\"ChessPawn\" \"Pawn\") (\"ChessKing\" \"King_noCross\")}) (rules (start { (place \"Pawn1\" (sites Row 1)) (place \"Pawn2\" (sites Row 6)) (place \"King_noCross1\" coord:\"E1\") (place \"King_noCross2\" coord:\"D8\")}) (play (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King_noCross\" Mover)))) (end (\"Checkmate\" \"King_noCross\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe game is played on a board with twelve points on either side. The points form a continuous track in a horseshoe shape; both players progress in an anti-clockwise direction. Fifteen pieces per player, two six-sided dice. Each player begins with two pieces on the rightmost point on the opposite side of the board. Players move according to the number on each die by moving one piece the number on one die and other the number on the other die, or by moving one piece the total number of both die. Further pieces are entered based on the roll of the dice, the point after the one with the two pieces on it at the beginning being counted as the first point. When entering captured pieces, however, the point where the two pieces start is counted as the first point. The two pieces which start on the board cannot be moved until all of the remaining pieces have been entered on the board. No more than one piece may rest on a point on the first half of the board, except for the two which start and also on the leftmost point on the opposite side of the board from where the player sits. When a piece lands on a point occupied by an opponent's piece, the opponent's piece is removed from the board and must be entered again. Players must enter captured pieces before continuing to move the other pieces on the board. When a piece is captured in the opponent's starting quadrant, a point must be left open or with only one piece, thus allowing the opponent to enter their piece. The player to move all of their pieces off the board wins.\n \n\n###\n\n", "completion": "(define \"EmptyOrFriednIfNotSpecialRegion\" (and (not (is In (to) (sites Mover \"OnePieceMax\"))) (or (\"IsFriendAt\" (to)) (is Empty (to))))) (define \"OneEnemyPiece\" (and (\"IsSingletonStack\" (to)) (\"IsEnemyAt\" (to)))) (define \"CaptureEnemyPiece\" (if (\"IsEnemyAt\" (to)) (move (from (to)) (to (\"BarSite\" Next))))) (define \"EmptySiteIfOneSpecialRegion\" (and (is Empty (to)) (is In (to) (sites Mover \"OnePieceMax\")))) (define \"BarSite\" (mapEntry \"Bar\" #1)) (define \"BarEmpty\" (is Empty (\"BarSite\" #1))) (define \"SiteToMoveOnTrack\" (trackSite Move steps:(pips))) (define \"RemoveAPiece\" (move Remove (from))) (define \"SiteToEnterCapturePiece\" (\"NextSiteOnTrack\" (pips) from:(\"BarSite\" Mover))) (define \"SiteToEnter\" (\"NextSiteOnTrack\" (pips) from:(mapEntry \"StartTrack\" Mover))) (game \"Tawula\" (players 2) (equipment { (\"BackgammonBoard\" \"BackgammonTracksSameDirectionOppositeCornersWithBars2\") (dice d:6 num:2) (piece \"Disc\" Each (if (or (!= (from) (mapEntry \"StartTrack\" Mover)) (and (= (from) (mapEntry \"StartTrack\" Mover)) (\"HandEmpty\" Mover))) (forEach Die if:(\"DieNotUsed\") (if (\"IsOffBoard\" \"SiteToMoveOnTrack\") \"RemoveAPiece\" (move (from) (to \"SiteToMoveOnTrack\" if:(or (or (\"EmptySiteIfOneSpecialRegion\") (\"EmptyOrFriednIfNotSpecialRegion\")) (\"OneEnemyPiece\")) (apply (\"CaptureEnemyPiece\")))))))) (hand Each) (map \"Bar\" {(pair P1 6) (pair P2 19)}) (map \"StartTrack\" {(pair P1 25) (pair P2 0)}) (regions \"OnePieceMax\" P1 (sites {14..18 20..24})) (regions \"OnePieceMax\" P2 (sites {1..5 7..11}))}) (rules (start { (place Stack \"Disc1\" 25 count:2) (place Stack \"Disc2\" 0 count:2) (place Stack \"Disc1\" (handSite P1) count:13) (place Stack \"Disc2\" (handSite P2) count:13)}) (play (\"RollEachNewTurnMove\" (or (if (\"BarEmpty\" Mover) (forEach Piece top:True) (forEach Die if:(\"DieNotUsed\") (move (from (\"BarSite\" Mover)) (to (\"SiteToEnterCapturePiece\") if:(or (or (\"EmptySiteIfOneSpecialRegion\") (\"EmptyOrFriednIfNotSpecialRegion\")) (\"OneEnemyPiece\")) (apply (\"CaptureEnemyPiece\")))))) (if (\"HandOccupied\" Mover) (forEach Die if:(\"DieNotUsed\") (move (from (handSite Mover)) (to (\"SiteToEnter\") if:(or (is Empty (to)) (\"OneEnemyPiece\")) (apply (\"CaptureEnemyPiece\")))))) (then (\"ReplayNotAllDiceUsed\"))))) (end (\"EscapeWin\")))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"GoBack\" (if (and (!= (to) (regionSite (sites #1 \"StartQuadrant\") index:0)) (not (\"IsFriendAt\" (regionSite (sites #1 \"StartQuadrant\") index:0)))) (regionSite (sites #1 \"StartQuadrant\") index:0) (if (and (!= (to) (regionSite (sites #1 \"StartQuadrant\") index:1)) (not (\"IsFriendAt\" (regionSite (sites #1 \"StartQuadrant\") index:1)))) (regionSite (sites #1 \"StartQuadrant\") index:1) (if (and (!= (to) (regionSite (sites #1 \"StartQuadrant\") index:2)) (not (\"IsFriendAt\" (regionSite (sites #1 \"StartQuadrant\") index:2)))) (regionSite (sites #1 \"StartQuadrant\") index:2) (if (and (!= (to) (regionSite (sites #1 \"StartQuadrant\") index:3)) (not (\"IsFriendAt\" (regionSite (sites #1 \"StartQuadrant\") index:3)))) (regionSite (sites #1 \"StartQuadrant\") index:3) (if (and (!= (to) (regionSite (sites #1 \"StartQuadrant\") index:4)) (not (\"IsFriendAt\" (regionSite (sites #1 \"StartQuadrant\") index:4)))) (regionSite (sites #1 \"StartQuadrant\") index:4) (if (and (!= (to) (regionSite (sites #1 \"StartQuadrant\") index:5)) (not (\"IsFriendAt\" (regionSite (sites #1 \"StartQuadrant\") index:5)))) (regionSite (sites #1 \"StartQuadrant\") index:5) (regionSite (sites #1 \"StartQuadrant\") index:6)))))))) (define \"NoGoBack\" (\"NoSites\" (difference (sites #1 \"StartQuadrant\") (union (sites {(to)}) (sites Occupied by:Mover))))) (define \"NextSiteFrom\" (\"NextSiteOnTrack\" #2 from:#1)) (game \"Fallas\" (players 2) (equipment { (\"TableBoard\" \"TableTracksOpposite\") (dice d:6 num:3) (piece \"Disc\" Each (forEach Die if:(\"DieNotUsed\") (if (\"IsOffBoard\" (\"NextSiteFrom\" (from) (pips))) (move Remove (from)) (move (from (from)) (to (\"NextSiteFrom\" (from) (pips)) if:(\"NoEnemyOrOnlyOne\" (to)) (apply (if (\"IsEnemyAt\" (to)) (if (\"NoGoBack\" Next) (and (remove (to)) (trigger \"StartQuadrantFull\" Next)) (fromTo (from (to)) (to (\"GoBack\" Next))))))))) (then \"ReplayNotAllDiceUsed\"))) (regions \"StartQuadrant\" P1 (sites {6..11})) (regions \"StartQuadrant\" P2 (sites {18..23}))}) (rules (start { (place Stack \"Disc1\" 7 count:13) (place Stack \"Disc1\" 11 count:2) (place Stack \"Disc2\" 19 count:13) (place Stack \"Disc2\" 23 count:2)}) (play (\"RollEachNewTurnMove\" (forEach Piece))) (end { (\"EscapeWin\") (if (is Triggered \"StartQuadrantFull\" P1) (result P2 Win)) (if (is Triggered \"StartQuadrantFull\" P2) (result P1 Win)) (if (and (\"NewTurn\") (no Moves Mover)) (result Mover Loss))})))\n\n###\n\n", "completion": "2x12 board, divided in half. Spaces on each side take the form of semi-circular sockets, into which the pieces fit. Fifteen pieces per player. Play begins with thirteen pieces on the seventh point of the track, and two pieces on the twelfth point. Three six-sided dice. Players move pieces according to the value of each individual die. Play moves around the board through starting from the quadrant where the pieces begin, through the one where the opponent's pieces begin, and then through the remaining quadrant on the opponent's side of the board, where the pieces are borne off the board. When a piece lands on a spot occupied by a single piece of the opponent, the opponent's piece is sent back to its starting quadrant. If a player's piece is sent back to start, but all of the spaces in their starting quadrant are occupied by the opponent's pieces, the player loses automatically. Also, any roll that allows the player to only move to spaces occupied by the opponent results in an automatic loss for the player. Otherwise, the first player to bear off all their pieces wins. END" }, { "prompt": "Construct a Ludii game based on the following description\nKeryo-Pente is played on a 19x19 Go board. White goes first, and plays their first move on the centre point (unless playing Freestyle). After the opening, players alternate playing one stone of their colour onto any empty point. If their placement results in a pair or a line of three enemy stones being sandwiched between two of their own stones, those enemy stones are captured. The first player to form an orthogonal or diagonal line of five (or more) of their stones, or to capture 15 enemy stones, wins the game. Played on a 19x19 board. Open at the centre point.\n\n###\n\n", "completion": "(define \"Custodial\" (custodial (from (last To)) All (between if:(is Next (who at:(between))) (apply (remove (between)))) (to if:(and (or (= 3 (count Steps Vertex All (last To) (to))) (= 4 (count Steps Vertex All (last To) (to)))) (is Mover (who at:(to))))) (then (addScore Mover 1)))) (game \"Keryo-Pente\" (players 2) (equipment { (board (square 19) use:Vertex) (piece \"Ball\" Each)}) (rules (start (set Score Each 0)) phases:{ (phase \"Opening\" (play (move Add (to (sites \"J10\")))) (nextPhase \"General\")) (phase \"General\" (play (move Add (to (sites Empty)) (then \"Custodial\"))))} (end { (if (is Line 5 All) (result Mover Win)) (if (> (score Mover) 14) (result Mover Win))}))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game is played with 7 holes per row. -> The game is played with 8 holes per row.\n(define \"Column\" 7) (define \"PiecesOwnedBy\" (count Cell at:(handSite #1))) (game \"Um el-Bil\" (players 2) (equipment { (mancalaBoard 2 \"Column\" store:None (track \"Track\" \"0,E,N,W\" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 4 to:(sites Track))) phases:{ (phase \"Opening\" (play (move Select (from (- (\"Column\") 1)) (then (sow if:(= (count at:(to)) 1) apply:(fromTo (from (to)) (to (handSite Mover)) count:1))))) (nextPhase \"Play\")) (phase \"Play\" (play (move Select (from (sites Mover) if:(< 0 (count at:(from)))) (then (sow if:(= (count at:(to)) 1) apply:(fromTo (from (to)) (to (handSite Mover)) count:1))))))} (end (\"MancalaByScoreWhen\" (all Sites (sites Board) if:(is Empty (site)))))))\n\n###\n\n", "completion": "(define \"Column\" 8) (define \"PiecesOwnedBy\" (count Cell at:(handSite #1))) (game \"Um el-Bil\" (players 2) (equipment { (mancalaBoard 2 \"Column\" store:None (track \"Track\" \"0,E,N,W\" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 4 to:(sites Track))) phases:{ (phase \"Opening\" (play (move Select (from (- (\"Column\") 1)) (then (sow if:(= (count at:(to)) 1) apply:(fromTo (from (to)) (to (handSite Mover)) count:1))))) (nextPhase \"Play\")) (phase \"Play\" (play (move Select (from (sites Mover) if:(< 0 (count at:(from)))) (then (sow if:(= (count at:(to)) 1) apply:(fromTo (from (to)) (to (handSite Mover)) count:1))))))} (end (\"MancalaByScoreWhen\" (all Sites (sites Board) if:(is Empty (site))))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n5x6 or 6x6 board. Twelve pieces per player. Players take turns placing pieces on the board. Once all the pieces are on the board, players may move one piece orthogonally one space during their turn. Players cannot create a line of more than three in an orthogonal direction, and cannot make a line of three during the placement phase. If three pieces are in an orthogonal line, they cannot be moved again. If a player makes three rows before the opponent makes one, it is an automatic win.\n The game is played on a 5x6 board.\n\n###\n\n", "completion": "(game \"Shiva\" (players 2) (equipment { (board (rectangle 5 6)) (hand Each) (piece \"Marker\" Each (if (not (is Line 3 Orthogonal through:(from))) (\"StepToEmpty\" Orthogonal (then (if (is Line 3 Orthogonal) (if (\"IsOffBoard\" (value Player Mover)) (set Value Mover 1) (set Value Mover (+ (value Player Mover) 1))))))))}) (rules (start (place \"Marker\" \"Hand\" count:12)) phases:{ (phase \"Placement\" (play (do (move (from (handSite Mover)) (to (sites Empty))) ifAfterwards:(not (is Line 3 Orthogonal)))) (nextPhase (and (\"HandEmpty\" P1) (\"HandEmpty\" P2)) \"Movement\")) (phase \"Movement\" (play (do (forEach Piece) ifAfterwards:(not (is Line 4 Orthogonal)))))} (end (if (= (value Player Mover) 3) (result Mover Win))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nA size 5 board is currently selected -> A size 6 board is currently selected\n(game \"Gyre\" (players 2) (equipment { (board (hex 5)) (piece \"Disc\" Each)}) (rules (meta (swap)) (play (move Add (to (sites Empty)))) (end (if (>= (count Sites in:(union (sites Outer) (sites {(centrePoint)}))) (max (results from:(difference (sites Board) (sites Group at:(last To))) to:2 (* (to) (count Sites in:(intersection (union (sites Outer) (sites {(centrePoint)})) (sites Group at:(from) if:(not (is In (to) (sites Group at:(last To))))))))))) (result Mover Win)))))\n\n###\n\n", "completion": "(game \"Gyre\" (players 2) (equipment { (board (hex 6)) (piece \"Disc\" Each)}) (rules (meta (swap)) (play (move Add (to (sites Empty)))) (end (if (>= (count Sites in:(union (sites Outer) (sites {(centrePoint)}))) (max (results from:(difference (sites Board) (sites Group at:(last To))) to:2 (* (to) (count Sites in:(intersection (union (sites Outer) (sites {(centrePoint)})) (sites Group at:(from) if:(not (is In (to) (sites Group at:(last To))))))))))) (result Mover Win))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nEach row has 4 holes. -> Each row has 5 holes.\n(define \"PiecesOwnedBy\" (count Cell at:(handSite #1))) (game \"I\" (players 2) (equipment { (mancalaBoard 2 4 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 4 to:(sites Track))) (play (move Select (from (sites Mover) if:(> (count at:(from)) 1)) (then (sow apply:(if (or (= 2 (count at:(to))) (= 3 (count at:(to)))) (and { (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))) (if (!= (to) (ahead (to) E)) (if (or (= 2 (count at:(ahead (to) E))) (= 3 (count at:(ahead (to) E)))) (fromTo (from (ahead (to) E)) (to (handSite Mover)) count:(count at:(ahead (to) E))))) (if (!= (to) (ahead (to) W)) (if (or (= 2 (count at:(ahead (to) W))) (= 3 (count at:(ahead (to) W)))) (fromTo (from (ahead (to) W)) (to (handSite Mover)) count:(count at:(ahead (to) W)))))})))))) (end (\"MancalaByScoreWhen\" (and (no Moves P1) (no Moves P2))))))\n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (count Cell at:(handSite #1))) (game \"I\" (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 4 to:(sites Track))) (play (move Select (from (sites Mover) if:(> (count at:(from)) 1)) (then (sow apply:(if (or (= 2 (count at:(to))) (= 3 (count at:(to)))) (and { (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))) (if (!= (to) (ahead (to) E)) (if (or (= 2 (count at:(ahead (to) E))) (= 3 (count at:(ahead (to) E)))) (fromTo (from (ahead (to) E)) (to (handSite Mover)) count:(count at:(ahead (to) E))))) (if (!= (to) (ahead (to) W)) (if (or (= 2 (count at:(ahead (to) W))) (= 3 (count at:(ahead (to) W)))) (fromTo (from (ahead (to) W)) (to (handSite Mover)) count:(count at:(ahead (to) W)))))})))))) (end (\"MancalaByScoreWhen\" (and (no Moves P1) (no Moves P2)))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nAn isosceles triangle, with a line intersecting the two equal sides, another line drawn from the apex to the midpoint of this line. A line extending below the base, and another line perpendicular to this one. One player plays as the tiger, and another player as three goats. The tiger begins at the apex of the triangle, the goats on the three points on the bottom line (the two ends and the place where it intersects with the other line. Players alternate turns moving a piece to an empty adjacent spot. The tiger may capture a goat by hopping over it to an empty adjacent spot along the lines of the board. The tiger wins by capturing all of the goats; the goats win by blocking the tiger from being able to move. \n\n###\n\n", "completion": "(game \"Bam Blang Beh Khla\" (players 2) (equipment { (board (add (remove (merge { (shift 0.4 -1 (scale 0.6 (rectangle 1 3))) (shift 0.2 0 (scale 0.8 2 (wedge 2))) (shift 0 -0.5 (scale 1 2.5 (wedge 2)))}) edges:{{3 8} {3 7} {3 9}}) edges:{{6 9} {4 7} {1 8}}) use:Vertex) (piece \"Tiger\" P1 (or \"HopCapture\" \"StepToEmpty\")) (piece \"Goat\" P2 \"StepToEmpty\")}) (rules (start { (place \"Tiger1\" (sites Top)) (place \"Goat2\" (sites Bottom))}) (play (forEach Piece)) (end (\"NoMovesP1NoPiecesP2\")))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"NextSite\" (\"NextSiteOnTrack\" 1 #1)) (define \"FirstSiteToSow\" (if (is Mover P1) (intersection (sites Right) (sites Row 1)) (intersection (sites Left) (sites Row 2)))) (define \"PiecesOwnedBy\" (count in:(sites #1 \"Home\"))) (define \"Columns\" 6) (game \"Nchuwa\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"TrackCCW1\" \"0,E,N1,W\" loop:True P1) (track \"TrackCCW2\" \"12,E,N1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"TrackCCW1\")) (regions \"Home\" P2 (sites Track \"TrackCCW2\")) (regions \"Inner\" P1 (sites Row 1)) (regions \"Inner\" P2 (sites Row 2)) (regions \"Outer\" P1 (sites Row 0)) (regions \"Outer\" P2 (sites Row 3)) (piece \"Seed\" Shared)}) (rules (start (set Count 2 to:(union (sites P1 \"Home\") (sites P2 \"Home\")))) phases:{ (phase \"Opening1\" (play (move Select (from (\"FirstSiteToSow\")) (then (sow \"TrackCCW\" owner:(mover) apply:(set Value Mover (\"NextSite\" from:(to))))))) (nextPhase Mover \"Opening2\")) (phase \"Opening2\" (play (move Select (from (value Player Mover)) (then (sow \"TrackCCW\" owner:(mover) apply:(if (= (count at:(\"NextSite\" from:(to))) 0) (set Value Mover Off) (set Value Mover (\"NextSite\" from:(to)))))))) (nextPhase Mover (\"IsOffBoard\" (value Player Mover)) \"Opening3\")) (phase \"Opening3\" (play (move (from (forEach (sites Mover \"Inner\") if:(!= 0 (count at:(site))))) (to (forEach (sites Mover \"Outer\") if:(= 0 (count at:(site))))) count:2)) (nextPhase Mover \"Opening4\")) (phase \"Opening4\" (play (move Remove (sites Next \"Home\"))) (nextPhase Mover \"Opening5\")) (phase \"Opening5\" (play (move Remove (sites Next \"Home\"))) (nextPhase Mover \"Playing\")) (phase \"Playing\" (play (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(> (count at:(from)) 0)) (then (sow \"TrackCCW\" owner:(mover) apply:(if (= (count at:(to)) 1) (if (is In (to) (sites Mover \"Inner\")) (if (> (count at:(\"OppositePit\" (to))) 0) (and (remove (\"OppositePit\" (to))) (if (> (count at:(\"OppositeOuterPit\" (to))) 0) (remove (\"OppositeOuterPit\" (to))))))) (moveAgain)))))))} (end (forEach Player if:(= 0 (\"PiecesOwnedBy\" Player)) (result Player Loss)))))\n\n###\n\n", "completion": "4x6, 9, 12, or 15. Two counters in each hole. Players begin by sowing from the rightmost hole in the inner row, placing one counter in each of the first two holes, then picking up the counters from the next hole and continuing to sow until the next hole after the sowing is empty (this should be the hole from which the sowing began). Each player then takes two counters from any of the holes in their inner row and places them in any empty hole in the outer row. The player then captures the counters in the opponent's opposite holes. The player then removes the contents of any one of the opponent's holes. Once both players have done this, the main phase begins. Players move by sowing from any of the holes on their side of the board in an anti-clockwise direction. When the final counter lands in an occupied hole, these are picked up and sowing continues. When they fall into an empty hole, the sowing ends. If this hole is in the inner row, the contents of the opponent's opposite hole in the inner row are also taken. If there are also counters in the opponent's outer row opposite, these are also taken. The player may also capture the contents of any other hole in the inner or outer row. Single counters may be moved. The player who captures all of their opponent's counters wins. Each player has 6 holes by row. 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 King (king): moves one space orthogonally or diagonally. 1 x Queen (counselor): One square diagonally. 2 x Rook (rook): Any number of spaces orthogonally. 2 x Fil (elephant): Two squares diagonally, jumping over the first. Cannot capture another Fil. 2 x Knight: Moves as a chess knight. 8 x Pawn: Moves one space forward orthogonally; one space forward diagonally to capture. No en passant. Promoted to Fers when reaching the eighth rank. No castling. An opponent's piece is captured by moving a player's own piece onto a space occupied by the opponent's piece. When a Shah can be captured on the next turn by an opponent's piece, it is in check. The Shah must not be in check at the end of the player's turn. If this is not possible, it is checkmate and the opponent wins. Stalemate results in a win for that player causing it.\n \n\n###\n\n", "completion": "(game \"Medieval Chess\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (\"ChessPawn\" \"Pawn\" ~ (then (\"ReplayInMovingOn\" (sites Mover \"Promotion\")))) (\"ChessRook\" \"Rook\") (\"ChessKing\" \"King_noCross\") (piece \"Bishop_noCross\" Each (move Hop Diagonal (between if:True) (to if:(or (is Empty (to)) (\"IsEnemyAt\" (to))) (apply (remove (to)))))) (\"ChessKnight\" \"Knight\") (piece \"Ferz_noCross\" Each (\"StepToNotFriend\" Diagonal)) (regions \"Promotion\" P1 (sites Top)) (regions \"Promotion\" P2 (sites Bottom))}) (rules (start { (place \"Pawn1\" (sites Row 1)) (place \"Pawn2\" (sites Row 6)) (place \"Rook1\" {\"A1\" \"H1\"}) (place \"Knight1\" {\"B1\" \"G1\"}) (place \"Bishop_noCross1\" {\"C1\" \"F1\"}) (place \"Ferz_noCross1\" coord:\"D1\") (place \"King_noCross1\" coord:\"E1\") (place \"Rook2\" {\"A8\" \"H8\"}) (place \"Knight2\" {\"B8\" \"G8\"}) (place \"Bishop_noCross2\" {\"C8\" \"F8\"}) (place \"Ferz_noCross2\" coord:\"D8\") (place \"King_noCross2\" coord:\"E8\")}) (play (if \"SameTurn\" (move Promote (last To) (piece \"Ferz_noCross\") Mover) (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King_noCross\" Mover))))) (end { (\"Checkmate\" \"King_noCross\") (if (= (count Pieces Next) 1) (result Mover Win)) (\"BlockWin\")}))) 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": "Construct a Ludii game based on the following description\nPlayed on a Go-like board (6x6 or larger, but a 19x19 go board is ideal) with two colors of stones (usually white and black). Black goes first by placing one stone. Play continues with each player playing two stones per turn. The first player to make a line of six in a row wins. \n\n###\n\n", "completion": "(game \"Connect6\" (players 2) (equipment { (board (square 19) use:Vertex) (piece \"Marker\" Each)}) (rules phases:{ (phase \"Opening\" (play (move Add (to (sites Empty)))) (nextPhase \"Playing\")) (phase \"Playing\" (play (move Add (to (sites Empty)) (then (if (is Even (count Moves)) (moveAgain))))) (nextPhase \"Playing\"))} (end (if (is Line 6 All) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayed on the Fox and Geese board, but the top arm of the cross is surrounded by a double line, indicating it is a fortress, in which one player puts two officers. The opponent has 24 pieces, which occupy the points outside the fortress. Officers may capture one of the opponent's pieces by hopping over it to an empty space immediately on the opposite side of the opponent's piece. If the officer does not capture when it is possible, it is huffed. The soldiers win by occupying all of the points in the fortress or by blocking the officers from being able to move; the officers win by capturing enough soldiers to prevent this. \n\n###\n\n", "completion": "(define \"RememberSiteWithPossibleCapture\" (forEach Site (sites From (forEach Piece \"Marker\" (\"HopCapture\"))) (remember Value \"From\" (site)))) (game \"Asalto\" (players 2) (equipment { (\"CrossBoard\" 3 7 use:Vertex diagonals:Alternating) (piece \"Marker\" P1 (or (\"HopCapture\") \"StepToEmpty\")) (piece \"Marker\" P2 \"StepToEmpty\")}) (rules (start { (place \"Marker1\" (sites {\"C6\" \"E6\"})) (place \"Marker2\" (union (expand (union (sites Right) (sites Left))) (expand (sites Bottom) steps:3)))}) (play (if (is Mover P1) (do (\"RememberSiteWithPossibleCapture\") next:(forEach Piece) (then (and (if (!= 0 (count Sites in:(sites (values Remembered \"From\")))) (if (= 1 (count Steps (last From) (last To))) (and (forEach Site (sites (values Remembered \"From\")) (remove (site))) (if (is In (last From) (sites (values Remembered \"From\"))) (remove (last To)))))) (forget Value All)))) (forEach Piece))) (end { (if (no Pieces P2) (result P1 Win)) (if (or (or (no Pieces P1) (no Moves P1)) (all Sites (expand (sites Top) steps:2) if:(= (who at:(site)) P2))) (result P2 Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\n4x7-15 (odd number only) board. One piece in each hole in the outer row. Four palm branches used as dice, with one side white and the other side yellow. The throws are equal to the number of white sides that fall up; when only yellow sides are up, the score is 6. When a player throws 1, 4, or 6, the player throws again. Players take turns throwing, until one throws 1, and that player begins to play. Each player moves in a boustrophedon path, from left to right in the row closest to them, right to left in the second row, and left to right in the third row. From there, the player may move again into the second row and continue as before, or move into the fourth row, proceeding from right to left, as long as at least one of the opponent's pieces remains there. The piece may enter the third row again upon reaching the end of the fourth row, but only when the player has either no pieces in their first row, or one group of pieces in the same spot (see below). When a piece has moved out of the fourth row, it may not enter it again during the game. When a player's piece lands in the same spot as another piece belonging to the player, the pieces may move as one piece. When a player's piece lands on a space occupied by an opponent's, piece, the opponent's piece is captured. The player who captures all of the opponent's pieces wins. Each row has 7 holes.\n\n###\n\n", "completion": "(define \"Move\" (or { (if (\"IsInTrack\" (site) \"HomeTrack\") (move (from (site)) (to (\"NextSiteOnTrack\" (\"ThrowValue\") from:(site) \"HomeTrack\") \"CaptureEnemyPiece\") count:(count at:(site)))) (if (\"IsInTrack\" (site) \"MiddleTrack\") (move (from (site)) (to (\"NextSiteOnTrack\" (\"ThrowValue\") from:(site) \"MiddleTrack\") \"CaptureEnemyPiece\") count:(count at:(site)))) (if (\"IsInTrack\" (site) \"EnemyTrack\") (if (if (is In (site) (sites Next \"Home\")) True (and (!= 0 (\"CountPiecesInHome\" Next)) (\"PieceDidNotGoToEnemyHome\" (site)))) (move (from (site)) (to (\"NextSiteOnTrack\" (\"ThrowValue\") from:(site) \"EnemyTrack\") \"CaptureEnemyPiece\") count:(count at:(site)) (then (if (and (is In (last To) (sites Next \"Home\")) (\"PieceDidNotGoToEnemyHome\" (last To))) (\"PieceGoesToEnemyHome\" (last To)))))))})) (define \"IsInTrack\" (is In #1 (sites Track Mover #2))) (define \"PieceDidNotGoToEnemyHome\" (= 0 (state at:#1))) (define \"PieceGoesToEnemyHome\" (set State at:#1 1)) (define \"CountPiecesInHome\" (count Pieces #1 in:(sites #1 \"Home\"))) (define \"CaptureEnemyPiece\" (apply if:(\"IsEnemyAt\" (to)) (remove (to) count:(count at:(to))))) (define \"Tab\" (= 1 (\"ThrowValue\"))) (define \"SpecialThrows\" (is In (\"ThrowValue\") (sites {1 4 6}))) (define \"ThrowValue\" (mapEntry (count Pips))) (game \"Tab\" (players 2) (equipment { (board (rectangle 4 7) { (track \"HomeTrack1\" \"0,E,N1,W\" P1 directed:True) (track \"HomeTrack2\" \"27,W,S1,E\" P2 directed:True) (track \"MiddleTrack\" \"13,W,N1,E\" loop:True) (track \"EnemyTrack1\" \"14,E,N1,W,S1,E\" P1 directed:True) (track \"EnemyTrack2\" \"13,W,S1,E,N1,W\" P2 directed:True)} use:Vertex) (piece \"Stick\" Each) (regions \"AllSites\" (sites Board)) (\"StickDice\" 4) (map \"Throw\" {(pair 0 6) (pair 1 1) (pair 2 2) (pair 3 3) (pair 4 4)}) (regions \"Home\" P1 (sites Bottom)) (regions \"Home\" P2 (sites Top))}) (rules (start { (place \"Stick1\" (sites Bottom)) (place \"Stick2\" (sites Top))}) phases:{ (phase \"InitGame\" (play (\"RollMove\" (move Pass) (then (if (\"Tab\") (moveAgain))))) (nextPhase (\"Tab\") \"Play\")) (phase \"Play\" (play (\"RollMove\" (forEach Site (sites Occupied by:Mover) (\"Move\")) (then (if (\"SpecialThrows\") (moveAgain))))))} (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Construct a Ludii game based on the following description\n8x8 board. One player plays with the following pieces: Raja (x1): moves one space in any direction; Mantri (x1): moves any distance orthogonally or diagonally; Ushtra (x2): moves diagonally any distance; Vaha (x2): move orthogonally one space and then diagonally another, jumping over any intervening pieces; Danti (x2): moves orthogonally any distance. Padati (x8): move forward orthogonally one space or one space diagonally forward to capture. When a Padati reaches the opposite edge of the board, it is promoted to a Mantri and is moved immediately to the space it last moved from. The opponent plays as one Raja, which can move as any of the other pieces. This Raja cannot move to a space adjacent to the opponent's Raja. An opponent's piece is captured by moving one of the player's own pieces onto the space occupied by the opponent's piece. If the Raja can be captured on the opponent's next turn, it is in check. The Raja cannot be in check at the end of the player's turn. If this is impossible, the opponent wins. Check and checkmate rules apply to the player with a single Raja. \n\n###\n\n", "completion": "(game \"Cittabhramanrpasya Khelanam\" (players {(player S) (player N)}) (equipment { (board (square 8)) (piece \"Pawn\" P1 (or \"StepForwardToEmpty\" (\"StepToEnemy\" (directions {FR FL})) (then (if (is In (last To) (sites Mover \"Promotion\")) (and (promote (last To) (piece \"Ferz_noCross\") Mover) (fromTo (from (last To)) (to (last From)))))))) (piece \"Rook\" P1 (\"SlideCapture\" ~ Orthogonal)) (piece \"King_noCross\" P1 (\"StepToNotFriend\")) (piece \"Elephant\" P1 (\"SlideCapture\" ~ Diagonal)) (piece \"Knight\" P1 (\"LeapCapture\" \"KnightWalk\")) (piece \"Ferz_noCross\" P1 (\"SlideCapture\")) (piece \"King_noCross\" P2 (or (move Leap \"KnightWalk\" (to if:(and (not (\"IsFriendAt\" (to))) (not (is In (to) (sites Around (where \"King-noCross\" Next))))) (apply (remove (to))))) (move Slide (to if:(\"IsEnemyAt\" (to)) (apply if:(not (is In (to) (sites Around (where \"King-noCross\" Next)))) (remove (to))))))) (regions \"Promotion\" P1 (sites Bottom))}) (rules (start { (place \"Pawn1\" (sites Row 6)) (place \"Rook1\" {\"A8\" \"H8\"}) (place \"Knight1\" {\"B8\" \"G8\"}) (place \"Elephant1\" {\"C8\" \"F8\"}) (place \"Ferz_noCross1\" coord:\"E8\") (place \"King_noCross1\" coord:\"D8\") (place \"King_noCross2\" coord:\"E1\")}) (play (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King_noCross\" Mover)))) (end (\"Checkmate\" \"King_noCross\")))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"MadeACompleteCircuit\" (if (= 1 (value Player Mover)) (is In (value Piece at:(where \"Marker\" Mover)) (sites Track \"TrackCW\" from:(\"NextSite\" (last From) \"TrackCW\") to:(last To))) (is In (value Piece at:(where \"Marker\" Mover)) (sites Track \"TrackCCW\" from:(\"NextSite\" (last From) \"TrackCCW\") to:(last To))))) (define \"MoveOn\" (if (\"IsNotOffBoard\" #1) (if (or (is In #1 (sites Empty)) (\"IsEnemyAt\" #1)) (move (from (from) level:(level)) (to #1 (\"HittingCapture\" (value Piece at:(to)))))) #2)) (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 \"NextSite\" (\"NextSiteOnTrack\" 1 from:#1 #2)) (define \"SiteToMoveOnSelectedTrack\" (if (= (value Player Mover) 2) (\"NextSiteOnTrack\" (\"ThrowValue\") \"TrackCCW\") (\"NextSiteOnTrack\" (\"ThrowValue\") \"TrackCW\"))) (define \"ThrowValue\" (count Pips)) (game \"Kawasukuts\" (players 2) (equipment { (\"FortyStonesWithFourGapsBoard\" { (track \"TrackCW\" {39 35 33 31 29 27 25 23 21 19 38 17 15 13 11 9 7 5 3 1 37 0 2 4 6 8 10 12 14 16 36 18 20 22 24 26 28 30 32 34} loop:True) (track \"TrackCCW\" {39 34 32 30 28 26 24 22 20 18 36 16 14 12 10 8 6 4 2 0 37 1 3 5 7 9 11 13 15 17 38 19 21 23 25 27 29 31 33 35} loop:True)}) (regions \"Gates\" (sites {36..39})) (piece \"Marker\" Each (if (\"IsOffBoard\" (value Player Mover)) (or (\"MoveOn\" (\"SiteToMoveOnTrackCW\") (\"RememberSelectedTrack\" (\"SelectCW\"))) (\"MoveOn\" (\"SiteToMoveOnTrackCCW\") (\"RememberSelectedTrack\" (\"SelectCCW\")))) (\"MoveOn\" \"SiteToMoveOnSelectedTrack\"))) (dice d:2 facesByDie:{{0 2} {0 3} {0 10}} num:3) (hand Each)}) (rules (start (place \"Marker\" \"Hand\")) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (sites \"Gates\")) (then (set Value at:(last To) (last To))))) (nextPhase Mover \"Playing\")) (phase \"Playing\" (play (\"RollMove\" (forEach Piece))) (end (if (and (!= 0 (\"ThrowValue\")) (\"MadeACompleteCircuit\")) (result Mover Win))))}))\n\n###\n\n", "completion": "Forty stones, arranged in a circle, with larger gaps (doors) between the stones after every ten. The gaps between the stones are the playing spaces. Any number of players. One stick per player. Three sticks used as dice, one marked with two notches, one marked with three notches, the other marked with ten notches. The value of the throw is the number of notches which land face up. Players move their sticks around the board, beginning at one of the doors. Players may choose in which direction to proceed around the board. When a player lands on the same space as an opponent, the opponent's piece is sent back to the starting door. The first player to complete the circuit of the board wins. The game has 2 players. 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 Ludii game based on the following description\nThe game is played on a board with twelve points on either side. The points form a continuous track in a horseshoe shape; each player progresses in opposite directions (one from their bottom right to the top right, the other from their bottom left to their top left). Each player has fifteen pieces, which all begin on the first point of their track. Three dice are used. 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 player rolls triples, the throw is played three times. If a player throws a pair among the three dice, they play the dice as normal if the third die has a greater value than the value which appears twice. If the value of the third die is lower, the player plays the doubles twice and the single value once. When 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 enter again from the quadrant of the board from which it began. When a piece reaches the end of the track, it may bear off the board with a throw greater than the number of points remaining in the track. The player who bears off all their pieces first wins. \n\n###\n\n", "completion": "(define \"Move\" (forEach Site (sites Occupied by:Mover) (if (\"CanEscape\" #1) (\"RemoveAPiece\") (move (from (site)) (to #1 if:(\"NoEnemyOrOnlyOne\" (to)) (\"CaptureToBar\")))) #2)) (define \"CaptureToBar\" (\"HittingCapture\" (\"Bar\" (next)))) (define \"CanStillLowerDie\" (or (or (= (count MovesThisTurn) (value Player Mover)) (and (= (count MovesThisTurn) 0) (< (value Player Mover) 0))) (and (!= (count MovesThisTurn) 0) (= (value Player Mover) 0)))) (define \"CanStillPlayDouble\" (not (and (= (value Player Mover) 0) (!= (count MovesThisTurn) 0)))) (define \"LowerValue\" (if (and (= (face 26) (face 27)) (> (face 26) (face 28))) (face 28) (if (and (= (face 26) (face 28)) (> (face 26) (face 27))) (face 27) (face 26)))) (define \"DoubleValue\" (if (and (= (face 26) (face 27)) (> (face 26) (face 28))) (face 26) (if (and (= (face 26) (face 28)) (> (face 26) (face 27))) (face 26) (face 27)))) (define \"TwoDiceEqualLastLower\" (or { (and (= (face 26) (face 27)) (> (face 26) (face 28))) (and (= (face 26) (face 28)) (> (face 26) (face 27))) (and (= (face 27) (face 28)) (> (face 27) (face 26)))})) (define \"UpdateCounterDoublePlay\" (and (if (< (count MovesThisTurn) 4) (moveAgain)) (if (< (value Player Mover) 3) (if (< (value Player Mover) 0) (set Value Mover 1) (set Value Mover (+ 1 (value Player Mover)))) (set Value Mover 0)))) (define \"UpdateCounterTriplePlay\" (if (< (value Player Mover) 8) (and (moveAgain) (if (< (value Player Mover) 0) (set Value Mover 1) (set Value Mover (+ 1 (value Player Mover))))) (set Value Mover 0))) (define \"Bar\" (mapEntry #1)) (define \"CanEscape\" (\"IsOffBoard\" #1)) (define \"AllPieceEscaped\" (no Pieces Mover)) (define \"RemoveAPiece\" (move Remove (site))) (define \"NextSiteFromDistDouble\" (\"NextSiteOnTrack\" (\"DoubleValue\") from:#1)) (define \"NextSiteFromDistLower\" (\"NextSiteOnTrack\" (\"LowerValue\") from:#1)) (define \"NextSiteFromDistTripleDice\" (\"NextSiteOnTrack\" (/ (count Pips) 3) from:#1)) (define \"NextSiteFrom\" (\"NextSiteOnTrack\" (pips) from:#1)) (game \"Garanguet\" (players 2) (equipment { (\"BackgammonBoard\" (\"BackgammonTracksWithBar\")) (dice num:3) (piece \"Disc\" Each) (map {(pair 1 6) (pair 2 19)}) (regions \"Home\" P1 { 7..12}) (regions \"Home\" P2 { 20..25})}) (rules (start { (place Stack \"Disc1\" 12 count:15) (place Stack \"Disc2\" 25 count:15)}) (play (\"RollEachNewTurnMove\" (if (all DiceEqual) (\"Move\" (\"NextSiteFromDistTripleDice\" (site)) (then (\"UpdateCounterTriplePlay\"))) (if (\"TwoDiceEqualLastLower\") (or (if (\"CanStillPlayDouble\") (\"Move\" (\"NextSiteFromDistDouble\" (site)) (then (\"UpdateCounterDoublePlay\")))) (if (\"CanStillLowerDie\") (\"Move\" (\"NextSiteFromDistLower\" (site)) (then (if (< (count MovesThisTurn) 4) (moveAgain) (set Value Mover 0)))))) (forEach Die if:(\"DieNotUsed\") (\"Move\" (\"NextSiteFrom\" (site)) (then (\"ReplayNotAllDiceUsed\")))))))) (end (if (\"AllPieceEscaped\") (result Mover Win))))) 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": "Construct a Ludii game based on the following description\n10x10 board. Pieces move as follows: Raja (x1): moves one space in any direction; Crown Prince (placed to the left of the Raja, x1): moves like any of the other pieces; Kotwal (Police Chief, placed to the right of the Raja, x1): Moves like the Elephant and the Vaha; Mantri (x1): moves any distance orthogonally or diagonally; Elephant (x2): moves diagonally any distance; Vaha (two placed in front of the Queens, x4): move orthogonally one space and then diagonally another, jumping over any intervening pieces; Chariot (x2): moves orthogonally any distance; Queen (placed in front of the Raja and Crown Prince, x2): move one square orthogonally or diagonally; Padati (placed in the second row, except for the central two squares, x8): move forward orthogonally one space or one space diagonally forward to capture. When a Padati reaches the opposite edge of the board, it is promoted to a Mantri and is moved immediately to the space it last moved from. An opponent's piece is captured by moving one of the player's own pieces onto the space occupied by the opponent's piece. If the Raja can be captured on the opponent's next turn, it is in check. The Raja cannot be in check at the end of the player's turn. If this is impossible, the opponent wins. When a player is reduced to only their Raja and Padati, the opponent wins. In the case of a stalemate, the player in stalemate may remove any of the opponent's pieces (except their Raja).\n \n\n###\n\n", "completion": "(game \"Shataranja\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 10)) (\"ChessPawn\" \"Pawn\" ~ (then (if (is In (last To) (sites Mover \"Promotion\")) (and (promote (last To) (piece \"Bishop_noCross\") Mover) (fromTo (from (last To)) (to (last From))))))) (\"ChessRook\" \"Rook\") (\"ChessKing\" \"King_noCross\") (\"ChessRook\" \"Elephant\") (\"ChessKnight\" \"Knight\") (\"ChessKing\" \"Queen\") (piece \"Ferz_noCross\" Each (or (\"SlideCapture\") (\"LeapCapture\" \"KnightWalk\"))) (\"ChessQueen\" \"Bishop_noCross\") (piece \"Commoner\" Each (or (\"SlideCapture\" Diagonal) (\"LeapCapture\" \"KnightWalk\"))) (regions \"Promotion\" P1 (sites Top)) (regions \"Promotion\" P2 (sites Bottom))}) (rules (start { (place \"Pawn1\" (difference (sites Row 1) (sites {\"E2\" \"F2\"}))) (place \"Pawn2\" (difference (sites Row 8) (sites {\"E2\" \"F2\"}))) (place \"Queen1\" {\"E2\" \"F2\"}) (place \"Queen2\" {\"E9\" \"F9\"}) (place \"Rook1\" {\"A1\" \"J1\"}) (place \"Knight1\" {\"B1\" \"I1\" \"E3\" \"F3\"}) (place \"Elephant1\" {\"C1\" \"H1\"}) (place \"Ferz_noCross1\" coord:\"E1\") (place \"Commoner1\" coord:\"G1\") (place \"Bishop_noCross1\" coord:\"D1\") (place \"King_noCross1\" coord:\"F1\") (place \"Rook2\" {\"A10\" \"J10\"}) (place \"Knight2\" {\"B10\" \"I10\" \"E8\" \"F8\"}) (place \"Elephant2\" {\"C10\" \"H10\"}) (place \"Ferz_noCross2\" coord:\"F10\") (place \"Commoner2\" coord:\"D10\") (place \"Bishop_noCross2\" coord:\"G10\") (place \"King_noCross2\" coord:\"E10\")}) (play (if (no Moves Mover) (move Remove (difference (sites Occupied by:Next) (where \"King_noCross\" Next))) (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King_noCross\" Mover))))) (end { (\"Checkmate\" \"King_noCross\") (if (and { (no Pieces Next \"Ferz_noCross\") (no Pieces Next \"Queen\") (no Pieces Next \"Knight\") (no Pieces Next \"Bishop_noCross\") (no Pieces Next \"Elephant\") (no Pieces Next \"Rook\") (no Pieces Next \"Commoner\")}) (result Mover Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe game begins with the pieces set out as in the diagram. 2. The king's side takes the first move, play then alternating between players. 3. In his turn a player moves one of his pieces along a straight line, horizontally or vertically. 4. No piece may land on another, nor is there any jumping. 5. Only the king can land on the central space, though other pieces can pass through it. 6. Only the king may move to the spaces occupied by the fixed men: see rule 11. 7. The king is captured by surrounding him on all four sides by counts. If he is next to the central square or the edge of the board, he may be captured by surrounding him on the other three sides. 8. Dukes and counts are captured by surrounding them with enemies on two opposite sides, horizontally or vertically. Two or three men may be captured simultaneously if each falls between the moving piece and another enemy. 9. The fixed men in the corners may be used to capture pieces by either player. 10. A piece may come to rest voluntarily between two others, without being captured. 11. If the king moves to one of the squares occupied by the fixed men, he has escaped the board and wins the game. 12. If the king is captured by his opponents, then he has lost the game. The rules are describing with the Cyningstan ruleset.\n\n###\n\n", "completion": "(define \"JarlButNotTheExpandedCentre\" (and (\"IsPieceAt\" \"Jarl\" P2 (between)) (not (is In (between) (expand origin:(centrePoint) Orthogonal))))) (define \"JarlAndExpandedCentre\" (and (\"IsPieceAt\" \"Jarl\" P2 (between)) (is In (between) (expand origin:(centrePoint) Orthogonal)))) (define \"AFriendOrTheCentre\" (or (\"IsFriendAt\" (to)) (is In (to) (sites Centre)))) (define \"EmptyButNotFortress\" (and (not (is In (between) (sites \"Fortresses\"))) (is Empty (between)))) (define \"JarlWasCaptured\" (is Triggered \"Surrounded\" P2)) (define \"CaptureJarl\" (apply (trigger \"Surrounded\" P2))) (define \"Custodial\" (custodial (from (last To)) Orthogonal (between (max 1) if:(\"IsPieceAt\" #1 Next (between)) (apply (remove (between)))) (to if:(or { (\"IsFriendAt\" (to)) (is In (to) (sites \"Fortresses\")) (and (is In (to) (sites Centre)) (is Empty (to)))})))) (game \"Alea Evangelii\" (players 2) (equipment { (board (square 19)) (regions \"Fortresses\" (expand (sites Corners))) (piece \"Thrall\" P1 (move Slide Orthogonal (between if:\"EmptyButNotFortress\") (to (apply if:(!= (to) (centrePoint)))) (then (or { (\"Custodial\" \"Thrall2\") (surround (from (last To)) Orthogonal (between if:\"JarlAndExpandedCentre\" \"CaptureJarl\") (to if:\"AFriendOrTheCentre\")) (custodial (from (last To)) Orthogonal (between if:\"JarlButNotTheExpandedCentre\" \"CaptureJarl\") (to if:(\"IsFriendAt\" (to))))})))) (piece \"Thrall\" P2 (move Slide Orthogonal (between if:\"EmptyButNotFortress\") (to (apply if:(!= (to) (centrePoint)))) (then (\"Custodial\" \"Thrall1\")))) (piece \"Jarl\" P2 (move Slide Orthogonal (to (apply if:(!= (to) (centrePoint))))))}) (rules (start { (place \"Thrall1\" {\"C1\" \"F1\" \"N1\" \"Q1\" \"A3\" \"F3\" \"N3\" \"S3\" \"H4\" \"L4\" \"G5\" \"I5\" \"K5\" \"M5\" \"A6\" \"C6\" \"Q6\" \"S6\" \"E7\" \"O7\" \"D8\" \"P8\" \"E9\" \"O9\" \"E11\" \"O11\" \"D12\" \"P12\" \"E13\" \"O13\" \"A14\" \"C14\" \"Q14\" \"S14\" \"G15\" \"I15\" \"K15\" \"M15\" \"H16\" \"L16\" \"A17\" \"F17\" \"N17\" \"S17\" \"C19\" \"F19\" \"N19\" \"Q19\"}) (place \"Thrall2\" {\"J4\" \"F6\" \"N6\" \"J7\" \"I8\" \"K8\" \"H9\" \"J9\" \"L9\" \"D10\" \"G10\" \"I10\" \"K10\" \"M10\" \"P10\" \"H11\" \"J11\" \"L11\" \"I12\" \"K12\" \"J13\" \"F14\" \"N14\" \"J16\"}) (place \"Jarl2\" (centrePoint))}) (play (forEach Piece)) (end { (\"PieceTypeReachWin\" \"Jarl2\" (sites \"Fortresses\") P2) (if \"JarlWasCaptured\" (result P1 Win))}))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nPlayed on a size 3 board. -> Played on a size 4 board.\nMin group size 3. -> Min group size 4.\n(define \"GroupCount\" (+ (count Groups if:(= (who at:(to)) P1) min:3) (count Groups if:(= (who at:(to)) P2) min:3))) (game \"Odd\" (players 2) (equipment { (board (rotate 90 (hex 3))) (piece \"Marker\" Each) (hand Shared size:2)}) (rules (start { (place \"Marker1\" (handSite Shared)) (place \"Marker2\" (handSite Shared 1))}) (play (move (from (sites Hand Shared)) (to (sites Empty)) copy:True)) (end (if (is Full) (if (is Odd (+ (count Groups if:(= (who at:(to)) P1) min:3) (count Groups if:(= (who at:(to)) P2) min:3))) (result P1 Win)) (result P2 Win)))))\n\n###\n\n", "completion": "(define \"GroupCount\" (+ (count Groups if:(= (who at:(to)) P1) min:4) (count Groups if:(= (who at:(to)) P2) min:4))) (game \"Odd\" (players 2) (equipment { (board (rotate 90 (hex 4))) (piece \"Marker\" Each) (hand Shared size:2)}) (rules (start { (place \"Marker1\" (handSite Shared)) (place \"Marker2\" (handSite Shared 1))}) (play (move (from (sites Hand Shared)) (to (sites Empty)) copy:True)) (end (if (is Full) (if (is Odd (+ (count Groups if:(= (who at:(to)) P1) min:4) (count Groups if:(= (who at:(to)) P2) min:4))) (result P1 Win)) (result P2 Win))))) 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.\nThe player has 2 safe teleportations. -> The player has 3 safe teleportations.\n2 robots. -> 3 robots.\n(define \"SafeTeleportation\" (fromTo (from (where (id \"Human\"))) (to (sites Random (difference (sites Empty) (sites Around (sites Occupied by:Shared))))) (then (\"RobotThreat\")))) (define \"Teleportation\" (fromTo (from (where (id \"Human\"))) (to (sites Random)) (then (\"RobotThreat\")))) (define \"KillRobotsIfColliding\" (forEach Site (sites Occupied by:Shared) (if (>= (count at:(site)) 2) (and (remove (site)) (add (piece \"Rubble0\") (to (site))))))) (define \"RobotThreat\" (forEach Site (sites Occupied by:Shared) (\"GoCloser\" NE (\"GoCloser\" NW (\"GoCloser\" SW (\"GoCloser\" SE (\"GoCloser\" E (\"GoCloser\" W (\"GoCloser\" N (\"GoCloser\" S)))))))))) (define \"GoCloser\" (if (\"CloserToHuman\" #1) (\"MoveRobot\" #1) #2)) (define \"MoveRobot\" (if (\"IsPieceAt\" \"Rubble\" Neutral (ahead (site) #1)) (remove (site)) (fromTo (from (site)) (to (ahead (site) #1) (apply (if (\"IsPieceAt\" \"Human\" P1 (to)) (remove (to)))))))) (define \"CloserToHuman\" (> (count Steps Orthogonal (site) (where (id \"Human\"))) (count Steps Orthogonal (ahead (site) #1) (where (id \"Human\"))))) (define \"NumSafeTeleportation\" 2) (define \"NumRobots\" 2) (game \"Chase\" (players 1) (equipment { (board (rectangle 1 2)) (piece \"Human\" P1 (\"StepToEmpty\" ~ (then (\"RobotThreat\")))) (piece \"Robot\" Shared) (piece \"Rubble\" Neutral)}) (rules (start { (place Random {\"Human\"}) (place Random {\"Robot\"} count:(\"NumRobots\")) (set Score P1 (\"NumSafeTeleportation\"))}) (play (or { (forEach Piece) (move Pass (then (\"Teleportation\"))) (if (< 0 (score P1)) (move Select (from (where (id \"Human\"))) (then (and (set Score Mover (- (score P1) 1)) (\"SafeTeleportation\")))))} (then (\"KillRobotsIfColliding\")))) (end { (if (no Pieces Mover) (result Mover Loss)) (if (no Pieces \"Robot\") (result Mover Win))})))\n\n###\n\n", "completion": "(define \"SafeTeleportation\" (fromTo (from (where (id \"Human\"))) (to (sites Random (difference (sites Empty) (sites Around (sites Occupied by:Shared))))) (then (\"RobotThreat\")))) (define \"Teleportation\" (fromTo (from (where (id \"Human\"))) (to (sites Random)) (then (\"RobotThreat\")))) (define \"KillRobotsIfColliding\" (forEach Site (sites Occupied by:Shared) (if (>= (count at:(site)) 2) (and (remove (site)) (add (piece \"Rubble0\") (to (site))))))) (define \"RobotThreat\" (forEach Site (sites Occupied by:Shared) (\"GoCloser\" NE (\"GoCloser\" NW (\"GoCloser\" SW (\"GoCloser\" SE (\"GoCloser\" E (\"GoCloser\" W (\"GoCloser\" N (\"GoCloser\" S)))))))))) (define \"GoCloser\" (if (\"CloserToHuman\" #1) (\"MoveRobot\" #1) #2)) (define \"MoveRobot\" (if (\"IsPieceAt\" \"Rubble\" Neutral (ahead (site) #1)) (remove (site)) (fromTo (from (site)) (to (ahead (site) #1) (apply (if (\"IsPieceAt\" \"Human\" P1 (to)) (remove (to)))))))) (define \"CloserToHuman\" (> (count Steps Orthogonal (site) (where (id \"Human\"))) (count Steps Orthogonal (ahead (site) #1) (where (id \"Human\"))))) (define \"NumSafeTeleportation\" 3) (define \"NumRobots\" 3) (game \"Chase\" (players 1) (equipment { (board (rectangle 2 3)) (piece \"Human\" P1 (\"StepToEmpty\" ~ (then (\"RobotThreat\")))) (piece \"Robot\" Shared) (piece \"Rubble\" Neutral)}) (rules (start { (place Random {\"Human\"}) (place Random {\"Robot\"} count:(\"NumRobots\")) (set Score P1 (\"NumSafeTeleportation\"))}) (play (or { (forEach Piece) (move Pass (then (\"Teleportation\"))) (if (< 0 (score P1)) (move Select (from (where (id \"Human\"))) (then (and (set Score Mover (- (score P1) 1)) (\"SafeTeleportation\")))))} (then (\"KillRobotsIfColliding\")))) (end { (if (no Pieces Mover) (result Mover Loss)) (if (no Pieces \"Robot\") (result Mover Win))}))) 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 Ludii game based on the following description\nPieces move one space orthogonally. Pieces are captured through the custodial capture move, but a piece moving in between two other pieces is not automatically captured. The goal of the player with the king is to reach the edge of the board. The goal of the other player is to capture the king. The game is played with the common rules.\n\n###\n\n", "completion": "(define \"EmptyButNotTheCentre\" (and (not (is In (to) (sites Centre))) (is Empty (to)))) (define \"JarlWasCaptured\" (is Triggered \"Surrounded\" P2)) (define \"JarlIsCaptured\" (apply (trigger \"Surrounded\" P2))) (game \"ArdRi\" (players 2) (equipment { (board (square 7)) (piece \"Thrall\" P1 (move Step Orthogonal (to if:\"EmptyButNotTheCentre\") (then (or { (\"CustodialCapturePieceType\" \"Thrall2\" Orthogonal (max 1)) (surround (from (last To)) Orthogonal (between if:(= (what at:(between)) (id \"Jarl2\")) \"JarlIsCaptured\") (to if:(or (\"IsFriendAt\" (to)) (is In (to) (sites Centre)))))})))) (piece \"Thrall\" P2 (move Step Orthogonal (to if:\"EmptyButNotTheCentre\") (then (\"CustodialCapturePieceType\" \"Thrall1\" Orthogonal (max 1))))) (piece \"Jarl\" P2 (\"StepToEmpty\" Orthogonal (then (\"CustodialCapturePieceType\" \"Thrall1\" Orthogonal (max 1)))))}) (rules (start { (place \"Thrall1\" {\"C1\" \"D1\" \"E1\" \"D2\" \"A3\" \"A4\" \"A5\" \"B4\" \"G3\" \"G4\" \"G5\" \"F4\" \"D6\" \"C7\" \"D7\" \"E7\"}) (place \"Thrall2\" (difference (expand (sites Centre)) (sites Centre))) (place \"Jarl2\" (centrePoint))}) (play (forEach Piece)) (end { (\"PieceTypeReachWin\" \"Jarl2\" (sites Outer) P2) (if \"JarlWasCaptured\" (result P1 Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x12 board, with spaces as points, divided in two. Fifteen pieces per player. Two six-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. The lowest value of the dice must be played; if it cannot, the player does not move. When a player throws doubles, they play the values on each die, as well as the values on the opposite side of the dice (I.e., double 6 if double 1 is thrown, 5 if 2, 3 if 4). However, the values on the bottom can only be played if all of the top values are played. The first double throw is only played once, but every subsequent double throw is played twice, and the top values must be played twice before using the bottom values. Bottom values do not have to be played, or only some of the bottom values may be played if the player wishes. In addition, an extra throw is granted for the second and subsequent throws of doubles. Players enter their pieces onto opposite sections of the board, and proceed around the board toward the section where the opponent enters the board, and then bearing pieces off the board. A player may not land on a point with two or more of the opponent's pieces. A player's piece may land on a point with a single opponent's piece. The opponent's piece is removed from the board and must enter again. The first player to remove all of their pieces from the board wins.\n \n\n###\n\n", "completion": "(define \"MoveOppositeDice\" (forEach Value (values Remembered \"Opposite\") (if (\"IsOffBoard\" (\"NextSiteFrom\" (from) (value))) (move Remove (from)) (move (from (from)) (to (\"NextSiteFrom\" (from) (value)) if:(\"NoEnemyOrOnlyOne\" (to)) (apply (and (if (\"IsEnemyAt\" (to)) (fromTo (from (to)) (to (handSite Next)))) (forget Value \"Opposite\" (value)))))) (then (if (!= 0 (size Array (values Remembered \"Opposite\"))) (moveAgain) (and { (set Var \"PlayOpposite\" 0) (set Pending) (moveAgain)})))))) (define \"DoubleDieValue\" (face 28)) (define \"NextSiteFrom\" (\"NextSiteOnTrack\" #2 from:#1)) (game \"Contrare Puff\" (players 2) (equipment { (\"BackgammonBoard\" \"BackgammonTracksWithHands\") (dice d:6 num:2) (piece \"Disc\" Each (forEach Die replayDouble:(= 1 (value Player Mover)) if:(\"DieNotUsed\") (if (\"IsOffBoard\" (\"NextSiteFrom\" (from) (pips))) (move Remove (from)) (move (from (from)) (to (\"NextSiteFrom\" (from) (pips)) if:(\"NoEnemyOrOnlyOne\" (to)) (\"HittingCapture\" (handSite (who at:(to))))))) (then (if (not (all DiceUsed)) (moveAgain) (if (= 1 (value Player Mover)) (if (and (all DiceEqual) (= 0 (size Array (values Remembered)))) (and (moveAgain) (set Var \"PlayOpposite\" 1))) (set Value Mover 1)))))) (hand Each)}) (rules (start { (place Stack \"Disc1\" (handSite P1) count:15) (place Stack \"Disc2\" (handSite P2) count:15)}) (play (do (if (or (is Pending) (\"NewTurn\")) (roll)) next:(if (= 1 (var \"PlayOpposite\")) (or { (forEach Piece (\"MoveOppositeDice\") top:True) (forEach Piece container:(mover) (\"MoveOppositeDice\") top:True) (move Pass (then (and { (forget Value \"Opposite\" All) (set Var \"PlayOpposite\" 0) (set Pending) (moveAgain)})))}) (do (if (and { (= 0 (count MovesThisTurn)) (all DiceEqual) (= 1 (value Player Mover))}) (and (remember Value \"Opposite\" (- 7 (\"DoubleDieValue\"))) (remember Value \"Opposite\" (- 7 (\"DoubleDieValue\"))))) next:(or (forEach Piece top:True) (forEach Piece container:(mover) top:True)))))) (end (\"EscapeWin\")))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"Icosahedron\" (board (add (remove (tri Limping 4) vertices:{0 1 3 4 5 6 7 8 9 10 11 13 15 17 18 19 20 23 24 25 26 27 31 32 34 35 36 37 39 40 42 43 44 45 46 47}) edges:{ {0 1} {0 2} {0 3} {0 9} {0 10} {1 2} {1 4} {1 6} {6 11} {7 11} {8 11} {1 9} {2 3} {3 5} {3 8} {3 10} {6 9} {8 10} {9 10} {9 11} {10 11}}) use:Vertex)) (define \"HexCell\" (board (hex Hexagon 6) use:Cell)) (define \"HexHex\" (board (tri Hexagon 6) use:Vertex)) (define \"TriSquare\" (board (tiling T33434 (- 6 2)) use:Vertex)) (define \"HexLimp\" (board (tri Limping (- 6 1)) use:Vertex)) (define \"SquareGrid\" (board (square 6) use:Vertex)) (define \"BoardUsed\" \"HexHex\") (define \"Connection\" Orthogonal) (define \"PiePhase\" (phase \"Pie\" (play (if (is Mover P1) (or { (move Add (piece (mover)) (to (sites Empty))) (move Add (piece (next)) (to (sites Empty))) (move Pass)} (then (if (< 0 (counter)) (set NextPlayer (player (next))) (moveAgain)))) (or (move Propose \"Accept Pie Offer and Move\" (then (set NextPlayer (player (mover))))) (move Propose \"Swap Pieces\" (then (do (forEach Site (sites Occupied by:Mover) (remember Value (site))) next:(forEach Site (sites Occupied by:Next) (and (remove (site)) (add (piece (mover)) (to (site))))) (then (forEach Value (values Remembered) (and (remove (value)) (add (piece (next)) (to (value)))) (then (and (forget Value All) (set NextPlayer (player (next))))))))))))) (nextPhase (or (is Proposed \"Swap Pieces\") (is Proposed \"Accept Pie Offer and Move\")) \"Placement\"))) (define \"SpecialOrthoScoring\" (and (set Score Mover (* (max (sizes Group Orthogonal Mover)) (count Pieces Next))) (set Score Next (* (max (sizes Group Orthogonal Next)) (count Pieces Mover))))) (define \"SpecialScoring\" (and (set Score Mover (* (max (sizes Group Orthogonal Mover)) (count Pieces Next))) (set Score Next (* (max (sizes Group Orthogonal Next)) (count Pieces Mover))))) (define \"SimpleOrthoScoring\" (set Score Mover (max (sizes Group Orthogonal Mover)))) (define \"SimpleScoring\" (set Score Mover (max (sizes Group Orthogonal Mover)))) (game \"Faraday\" (players 2) (equipment { \"BoardUsed\" (piece \"Ball\" P1) (piece \"Ball\" P2)}) (rules (meta (no Repeat Positional)) (start (set Score Each 0)) phases:{ \"PiePhase\" (phase \"Placement\" (play (move Add (piece (mover)) (to (sites Empty) if:(or (<= 3 (count Pieces Next in:(sites Around (to) Orthogonal))) (< 0 (- (count Pieces Next in:(sites Around (to) Orthogonal)) (count Pieces Mover in:(sites Around (to) Orthogonal)))))) (then (and { (\"SimpleOrthoScoring\") (set Var \"Last2Move\" (mover)) (if (not (no Moves Mover)) (moveAgain))})))) (end (if (all Passed) { (if (!= (score Mover) (score Next)) (byScore)) (if (and (= (score Mover) (score Next)) (= (var \"Last2Move\") (mover))) (result Mover Loss)) (if (and (= (score Mover) (score Next)) (!= (var \"Last2Move\") (mover))) (result Mover Loss))} (byScore))))}))\n\n###\n\n", "completion": "Goal: End the game with the highest scoring group. A group scores one point for each stone it contains.\n \n Definitions: A group, as in Go, is every stone that can be reached from a selected stone through a series of adjacent stones of the same color.\n \n Play:\n Start with a pie offer of 1 to 3 stones of any color combination. (Player 1 does this by making 3 placements, or passes; after which Player 2 may choose to play, or to have the pieces exchanged with the opposite colors)\n \n Turns alternate.\n \n On a turn, a player places a series of stones, one at a time, (as described below) until no more placements are possible, and then passes. Order of placement matters.\n \n Placements are made to empty cells that:\n -- 1) have more neighbors that are oppositely charged than similarly charged, or\n -- 2) have 3 or more oppositely charged neighbors.\n \n The game ends when neither player can play.\n The largest group for each player is then scored. In case of a tie the last to place a stone loses. \n \n Variants: \n Exception for Surplus Charge\nImmediately after placing to a cell with 4 or more oppositely charged neighbors, the player MUST, if possible, place the next stone on an otherwise unplayable empty cell with an equal number of both types of charge around it. Hex Grid - Standard Order 6 board Largest orthogonal group scores 1 point per piece. END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"FirstEmptyHole\" (trackSite FirstSite Mover \"TrackCW\" from:#1 if:(is Empty (to)))) (define \"NextHoleFrom\" (\"NextSiteOnTrack\" #3 from:#1 #2)) (define \"PlayFromNextLastHole\" (sites {(\"NextHoleFrom\" (last To afterConsequence:True) \"TrackCCW\" 1)})) (define \"Columns\" 8) (game \"Mangola\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" 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)}) (regions \"Home\" P1 (sites Track \"TrackCCW1\")) (regions \"Home\" P2 (sites Track \"TrackCCW2\")) (regions \"Inner\" P1 (difference (sites Track \"TrackCCW1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"TrackCCW2\") (sites Top))) (regions \"LeftMost\" P1 (intersection (sites Left) (sites Track \"TrackCCW1\"))) (regions \"LeftMost\" P2 (intersection (sites Right) (sites Track \"TrackCCW2\"))) (regions \"EndHoles\" P1 (intersection (union (sites Left) (sites Right)) (sites Track \"TrackCCW1\"))) (regions \"EndHoles\" P2 (intersection (union (sites Left) (sites Right)) (sites Track \"TrackCCW2\"))) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 2 to:(union (sites P1 \"Home\") (sites P2 \"Home\")))) phases:{ (phase \"Opening1\" (play (move Select (from (if (\"SameTurn\") \"PlayFromNextLastHole\" (sites Mover \"LeftMost\")) if:(> (count at:(from)) 0)) (then (sow numPerHole:2 \"TrackCCW\" owner:(mover) apply:(if (is Occupied (\"NextHoleFrom\" (to) \"TrackCCW\" 1)) (moveAgain)))))) (nextPhase Mover (not (is Next Mover)) \"Opening2\")) (phase \"Opening2\" (play (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (sites Mover \"EndHoles\")) if:(> (count at:(from)) 1)) (then (sow \"TrackCCW\" owner:(mover) apply:(if (< 1 (count at:(to))) (and { (moveAgain) (set Var \"Replay\" (to)) (if (and { (is In (to) (sites Mover \"Inner\")) (is Occupied (\"OppositeOuterPit\" (to))) (is Occupied (\"OppositePit\" (to)))}) (and { (fromTo (from (\"OppositeOuterPit\" (to))) (to (\"NextHoleFrom\" (\"FirstEmptyHole\" (to)) \"TrackCCW\" 1)) count:(count at:(\"OppositeOuterPit\" (to)))) (fromTo (from (\"OppositePit\" (to))) (to (\"NextHoleFrom\" (\"FirstEmptyHole\" (to)) \"TrackCCW\" 1)) count:(count at:(\"OppositePit\" (to)))) (sow (\"NextHoleFrom\" (\"FirstEmptyHole\" (to)) \"TrackCCW\" 1) count:(+ (count at:(\"OppositePit\" (to))) (count at:(\"OppositeOuterPit\" (to)))) \"TrackCCW\" owner:(mover))}))}) (fromTo (from (to)) (to (\"NextHoleFrom\" (to) \"TrackCCW\" 1)) count:1)))))) (nextPhase Mover (not (is Next Mover)) \"Sowing\")) (phase \"Sowing\" (play (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (sites Mover \"Home\")) if:(> (count at:(from)) 1)) (then (sow \"TrackCCW\" owner:(mover) apply:(if (< 1 (count at:(to))) (and { (moveAgain) (set Var \"Replay\" (to)) (if (and { (is In (to) (sites Mover \"Inner\")) (is Occupied (\"OppositeOuterPit\" (to))) (is Occupied (\"OppositePit\" (to)))}) (and { (fromTo (from (\"OppositeOuterPit\" (to))) (to (\"NextHoleFrom\" (\"FirstEmptyHole\" (to)) \"TrackCCW\" 1)) count:(count at:(\"OppositeOuterPit\" (to)))) (fromTo (from (\"OppositePit\" (to))) (to (\"NextHoleFrom\" (\"FirstEmptyHole\" (to)) \"TrackCCW\" 1)) count:(count at:(\"OppositePit\" (to)))) (sow (\"NextHoleFrom\" (\"FirstEmptyHole\" (to)) \"TrackCCW\" 1) count:(+ (count at:(\"OppositePit\" (to))) (count at:(\"OppositeOuterPit\" (to)))) \"TrackCCW\" owner:(mover))}))}) (fromTo (from (to)) (to (\"NextHoleFrom\" (to) \"TrackCCW\" 1)) count:1)))))))} (end (\"ForEachPlayerNoMovesLoss\"))))\n\n###\n\n", "completion": "4x8 board. Two counters in each hole. Play begins with each player taking the two counters in the leftmost hole of either the inner or outer row and placing them both in the following hole in an anti-clockwise direction, and continuing with the two counters in the next hole, until there is an alternating pattern of holes with four counters followed by empty holes in all of the player's holes. On the next turn, the player sows from one of the holes on the end of one of their rows. Sowing occurs in an anti-clockwise direction. After this turn, sowing can be from any hole on the player's side of the board. Single counters cannot be sown. When the final counter falls into an occupied hole, the player picks up these counters and continues to sow. When the final counter is supposed to fall into an empty hole, it is not placed there but placed in the next hole. When the final counter falls into an occupied hole in the inner row, any counters in the opponent's two holes opposite are captured. These are then sown on the player's side of the board, beginning with the first occupied hole immediately after an empty hole before the hole from which the capture was made. Play continues until one player can no longer play, and the opponent wins. END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"Driesticken\" (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 pieces on an empty spot on the board. When all pieces are placed, players alternate turns moving a piece to any empty spot on the board. The first player to place their pieces in an orthogonal row along the lines wins.\n END" }, { "prompt": "Construct a Ludii game based on the following description\nA series of three parallel lines are drawn, with diagonals connecting the outer lines at intervals, crossing each other at the central line. Sixteen spaces each row. Pieces begin on all of the points on the board, except the central point and the leftmost point of the central row. Pieces are moved along the intersections, and they are placed on the board on opposing sides, leaving the central spot empty. The first player moves to this spot along one of the lines, and the opponent jumps this pieces, thereby capturing it. \n\n###\n\n", "completion": "(game \"Kolowis Awithlaknannai\" (players 2) (equipment { (board (merge { (repeat 1 1 step:{{0.5 0} {1 0}} (poly {{-0.5 0} {0.5 0} {0 0.5}})) (repeat 1 1 step:{{0.5 0} {1 0}} (poly {{-0.5 0} {0.5 0} {0 -0.5}})) (repeat 15 1 step:{{0.5 0} {1 0}} (poly {{0.5 0} {0 0.5} {1 0.5}})) (repeat 15 1 step:{{0.5 0} {1 0}} (poly {{0.5 0} {0 -0.5} {1 -0.5}})) (shift 0.5 0 (rectangle 1 15))}) use:Vertex) (piece \"Counter\" Each (or (\"HopCapture\") (\"StepToEmpty\")))}) (rules (start { (place \"Counter1\" (difference (union (sites Bottom) (sites Direction from:(centrePoint) W)) (coord \"A2\"))) (place \"Counter2\" (union (sites Direction from:(centrePoint) E) (sites Top)))}) (play (forEach Piece)) (end (\"NoMoves\" Loss)))) 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": "Construct a Ludii game based on the following description\nThe game is played on a board with twelve points on either side. The points form a continuous track in a horseshoe shape; each player progresses in opposite directions (one from their bottom right to the top right, the other from their bottom left to their top left. Each player has 15 pieces. The starting position is as such, numbering the points from the origin of each player's track: Point six: five pieces. Point 8: three pieces. Point 13: five pieces. Point 24: two pieces. Play begins by each player rolling one die; the player who rolls the highest plays first, and then rolls again to begin play. Players move according to the number on each die by moving one piece the number on one die and another the number on the other die, or by moving one piece twice (once for each die). If doubles are rolled, the player must play the number on each die twice. Players cannot end their move on a point with multiple opposing pieces. If a player ends the turn on a point with one opposing piece, that piece is placed in the middle of the board (not on a point) and must reenter the board according the the next die roll, counting the origin point as a move of one. They cannot reenter on a point with two or more pieces. No other pieces can move until all of the pieces belonging to that player are removed from the center. When all of a player's pieces are on their final six points, they may start removing pieces from the board. They can do so by rolling a 6 to move from the 6th point, and so on down to 1. Players must use all available moves presented by the dice. The first player to remove all of their pieces wins.\n \n\n###\n\n", "completion": "(define \"HaveAPieceAndCanEscape\" (and (\"IsFriendAt\" (site)) (< (\"NextSiteOnTrack\" (pips) from:(site)) 0))) (define \"SetScoreOf\" (set Score #1 (if (is Mover #1) (if (= (\"NumPiece\" #2) 15) 2 1) 0))) (define \"NotEmptyAndNotOffTheBoard\" (and (is Occupied (site)) (\"IsNotOffBoard\" (\"NextSiteFrom\" (site))))) (define \"CanEscape\" (\"IsEndTrack\" (\"NextSiteFrom\" (site)))) (define \"NumPiece\" (size Stack in:(sites Occupied by:#1))) (define \"AllPieceEscaped\" (no Pieces Mover)) (define \"MoveAPieceIf\" (forEach Die replayDouble:True if:#1 (\"MoveAPiece\" #2))) (define \"MoveAPiece\" (move (from #1) (to (\"NextSiteFrom\" #1) if:(\"NoEnemyOrOnlyOne\" (to)) (\"IfEnemyBlotIt\")))) (define \"DieNotUsedAndNoEscapeAndNotOffTheTrack\" (and { (\"DieNotUsed\") (\"IsNotOffBoard\" (\"NextSiteFrom\" (from))) (\"IsNotEndTrack\" (\"NextSiteFrom\" (from)))})) (define \"RemoveAPiece\" (move Remove (site))) (define \"AllPieceInHome\" (\"AllOwnedPiecesIn\" (sites Mover))) (define \"Bar\" (mapEntry (mover))) (define \"NextSiteFrom\" (\"NextSiteOnTrack\" (pips) from:#1)) (define \"BarEmpty\" (is Empty \"Bar\")) (define \"IfEnemyBlotIt\" (\"HittingCapture\" (mapEntry (next)))) (game \"Frangieh\" (players 2) (equipment { (\"BackgammonBoard\" (\"BackgammonTracksWithBar\" End)) (dice num:2) (regions P1 { 20..25}) (regions P2 { 7..12}) (map {(pair 1 6) (pair 2 19)}) (piece \"Disc\" Each (\"MoveAPieceIf\" \"DieNotUsedAndNoEscapeAndNotOffTheTrack\" (from)))}) (rules (start { (place Stack \"Disc1\" 0 count:5) (place Stack \"Disc1\" 12 count:2) (place Stack \"Disc1\" 17 count:3) (place Stack \"Disc1\" 20 count:5) (place Stack \"Disc2\" 4 count:3) (place Stack \"Disc2\" 7 count:5) (place Stack \"Disc2\" 13 count:5) (place Stack \"Disc2\" 25 count:2)}) (play (\"RollEachNewTurnMove\" (if \"AllPieceInHome\" (forEach Die replayDouble:True if:(\"DieNotUsed\") (forEach Site (sites Occupied by:Mover) (if (\"NotEmptyAndNotOffTheBoard\") (if (\"CanEscape\") (\"RemoveAPiece\") (\"MoveAPiece\" (site)))) noMoveYet:(firstMoveOnTrack \"Track\" Mover (if \"HaveAPieceAndCanEscape\" \"RemoveAPiece\")) (then (\"ReplayNotAllDiceUsed\")))) (if \"BarEmpty\" (forEach Piece top:True) (\"MoveAPieceIf\" (\"DieNotUsed\") (\"Bar\")) (then (if (not (all DiceUsed)) (if (can Move (if \"BarEmpty\" (forEach Piece top:True) (\"MoveAPieceIf\" (\"DieNotUsed\") (\"Bar\")))) (moveAgain)))))))) (end (if (\"AllPieceEscaped\") (result Mover Win))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"IsUnpromoted\" (\"IsPieceAt\" \"Counter\" Mover (last To))) (define \"HopMan\" (move Hop (from #1) (between if:(and (not (is In (between) (sites ToClear))) (\"IsEnemyAt\" (between))) (apply (remove (between) at:EndOfTurn))) (to if:(is Empty (to))) #2)) (game \"HexDame\" (players 2) (equipment { (board (rotate 90 (hex 5))) (piece \"Counter\" P1 N) (piece \"Counter\" P2 S) (piece \"DoubleCounter\" Each) (regions P1 (union (sites Side SW) (sites Side SE))) (regions P2 (union (sites Side NW) (sites Side NE)))}) (rules (start { (place \"Counter1\" (expand (sites Bottom) steps:3)) (place \"Counter2\" (expand (sites Top) steps:3))}) (play (if \"SameTurn\" (if \"IsUnpromoted\" (max Moves (\"HopMan\" (last To) (then (\"ReplayIfCanMove\" (\"HopMan\" (last To)) (\"PromoteIfReach\" (sites Next) \"DoubleCounter\"))))) (max Moves (\"HopSequenceCaptureAgain\" before:10 after:10 at:EndOfTurn))) (priority { (max Moves (or (forEach Piece \"Counter\" (\"HopMan\" (from) (then (\"ReplayIfCanMove\" (\"HopMan\" (last To)) (\"PromoteIfReach\" (sites Next) \"DoubleCounter\"))))) (forEach Piece \"DoubleCounter\" (\"HopSequenceCapture\" before:10 after:10 at:EndOfTurn)))) (or (forEach Piece \"Counter\" (\"StepToEmpty\" (directions {Forward FL FR})) (then (\"PromoteIfReach\" (sites Next) \"DoubleCounter\"))) (forEach Piece \"DoubleCounter\" (move Slide)))}))) (end (\"BlockWin\"))))\n\n###\n\n", "completion": "Pieces move one step forward. Otherwise, the rules are the same as International Draughts: Pieces 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. 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 Ludii game based on the following description\nSquare with diagonals and lines connecting the midpoints of the sides. Three pieces per player. The first player places their piece in the center. Players alternate turns placing a piece on an empty spot on the board. The first player to make three in a row wins. \n\n###\n\n", "completion": "(game \"Ngrin\" (players 2) (equipment { (board (square 3 diagonals:Alternating) use:Vertex) (piece \"Marker\" Each)}) (rules phases:{ (phase \"Opening\" (play (move Add (to (centrePoint)))) (nextPhase \"Playing\")) (phase \"Playing\" (play (move Add (to (sites Empty)))))} (end (\"Line3Win\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6 board with two stores. Four counters in each hole. Sowing occurs in an anti-clockwise direction. When the final counter lands in an occupied hole the counters are picked up and sowing continues, unless the hole contained three counters, causing it to contain four, in which case the counters are captured. An unbroken sequence of holes with four counters in them behind the hole from which the first capture was made are also captured. In addition, any holes which were sown into during the course of the turn which now contain four counters are captured by the owner of the row. Play continues until there are only eight counters left. The first player to make a capture with these eight counters captures them all. The player with the most counters wins. \n\n###\n\n", "completion": "(define \"LastHoleSowed\" (sites {(var \"To\")})) (define \"PiecesOwnedBy\" (+ (count at:(mapEntry #1)) (count in:(sites #1)))) (game \"Duene\" (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))) phases:{ (phase \"Playing\" (play (move Select (from (if (\"SameTurn\") (\"LastHoleSowed\") (sites Mover)) if:(< 0 (count at:(from)))) (then (do (and (set Var \"From\" (last From)) (sow apply:(and (set Var \"To\" (to)) (if (= (count at:(to)) 4) (fromTo (from (to)) (to (mapEntry (mover))) count:(count at:(to))) (if (> (count at:(to)) 1) (moveAgain)))) backtracking:(= (count at:(to)) 4))) next:(and { (pass) (forEach Site (forEach (sites Track from:(var \"From\") to:(var \"To\")) if:(and (is In (site) (sites P1)) (= 4 (count at:(site))))) (fromTo (from (site)) (to (mapEntry P1)) count:(count at:(site)))) (forEach Site (forEach (sites Track from:(var \"From\") to:(var \"To\")) if:(and (is In (site) (sites P2)) (= 4 (count at:(site))))) (fromTo (from (site)) (to (mapEntry P2)) count:(count at:(site))))}))))) (nextPhase (<= (count in:(sites Track)) 8) \"EndGame\")) (phase \"EndGame\" (play (move Select (from (if (\"SameTurn\") (\"LastHoleSowed\") (sites Mover)) if:(< 0 (count at:(from)))) (then (sow apply:(if (= (count at:(to)) 4) (forEach Site (sites Track) (if (< 0 (count at:(site))) (fromTo (from (site)) (to (mapEntry (mover))) count:(count at:(site))))) (if (> (count at:(to)) 1) (moveAgain))))))))} (end (\"MancalaByScoreWhen\" (all Sites (sites Track) if:(= 0 (count at:(site)))))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6 board. 72 counters are distributed unevenly into the holes by one player in both rows, placing at least four in each hole. The opponent moves first, but may flip the board around if they prefer that arrangement. Each move must begin from the rightmost hole in a player's row or the next closest hole to it from which it is possible to move. Counters are sowed in an anti-clockwise direction. If the last counter falls into a hole making it odd, these are picked up and sowing continues. If it lands in a hole making it even, these counters are captured as are the ones in the opposite hole. If the previous hole also has an even number, these and the ones in the opposite hole are captured. If the last counter falls into an empty hole, the turn ends. If a player has no counters in their holes, the opponent must give them one counter, to be placed in the leftmost hole and played from there. Play ends when the board is cleared of counters. Each player counts the number of counters they captured. The player with more counters is given a score equal to the difference in the number of counters. Another round begins as before, with the loser distributing the counters and the winner playing first.. The game is won when a player accumulates sixty points. \n\n###\n\n", "completion": "(define \"RightMostNotEmpty\" (trackSite FirstSite \"TrackCW\" from:(mapEntry \"RightMost\" Mover) if:(and (is In (to) (sites Mover)) (is Occupied (to))))) (define \"EmptyBoardOrOne\" (= 1 (count in:(sites Board)))) (define \"NoCounters\" (all Sites (sites #1) if:(= 0 (count at:(site))))) (define \"FourInEach\" (all Sites (sites Board) if:(<= 4 (count at:(site))))) (define \"Columns\" 6) (game \"Li'b al-Ghashim\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" 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 (place \"Seed\" (handSite P1) count:72)) phases:{ (phase \"Opening1\" (play (or { (if (is Occupied Cell (handSite P1)) (forEach Value min:1 max:(count Cell at:(handSite P1)) (move (from (handSite P1)) (to (sites Board)) count:(value))) (forEach Site (sites Board) (if (is Occupied (site)) (move (from (site)) (to (sites Board) if:(!= (to) (from)))))) (then (moveAgain))) (if (and (is Empty (handSite P1)) (\"FourInEach\")) (move Pass))})) (nextPhase (was Pass) \"Opening2\")) (phase \"Opening2\" (play (or (move Pass (then (and (set Pending) (moveAgain)))) (move Swap Players P1 P2 (then (and (set NextPlayer (player 1)) (set Pending)))))) (nextPhase \"Sowing\")) (phase \"Sowing\" (play (if (and (\"NewTurn\") (\"NoCounters\" Next)) (move (from (sites Mover) if:(is Occupied (from))) (to (\"RightMostNotEmpty\"))) (move Select (from (if (and (not (is Pending)) (\"SameTurn\")) (sites {(var \"Replay\")}) (sites Mover)) if:(is Occupied (from))) (then (sow \"TrackCCW\" if:True apply:(if (is Odd (count at:(to))) (and (moveAgain) (set Var \"Replay\" (to))) (and (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))) (if (is Occupied (\"OppositePitTwoRows\" (to))) (fromTo (from (\"OppositePitTwoRows\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePitTwoRows\" (to))))))) backtracking:(and (is Occupied (to)) (is Even (count at:(to))))))) (then (if (\"EmptyBoardOrOne\") (and { (if (< (count Cell at:(handSite P1)) (count Cell at:(handSite P2))) (addScore P2 (- (count Cell at:(handSite P2)) (count Cell at:(handSite P1)))) (addScore P1 (- (count Cell at:(handSite P1)) (count Cell at:(handSite P2))))) (if (is Occupied Cell (handSite P2)) (fromTo (from (handSite P2)) (to (handSite P1)) count:(count Cell at:(handSite P2)))) (forEach Site (sites Board) (if (is Occupied (site)) (fromTo (from (site)) (to Cell (handSite P1)) count:(count at:(site)))))}))))) (nextPhase (\"EmptyBoardOrOne\") \"Opening1\"))} (end (forEach Player if:(<= 60 (score Player)) (result Player Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayers take turns removing a piece of their colour whose number is higher than the last piece they removed (free choice of first piece). The mover loses if they remove an even numbered piece. \n\n###\n\n", "completion": "(define \"StoreStateRemoved\" (set Value Mover (state at:(last To)))) (define \"LastStateRemove\" (value Player Mover)) (game \"Greater Even Loss\" (players 2) (equipment { (board (square 4)) (piece \"Disc\" Each)}) (rules (start { (place \"Disc1\" {\"A1\"} state:1) (place \"Disc1\" {\"B1\"} state:2) (place \"Disc1\" {\"C1\"} state:3) (place \"Disc1\" {\"D1\"} state:4) (place \"Disc1\" {\"A2\"} state:5) (place \"Disc1\" {\"B2\"} state:6) (place \"Disc1\" {\"C2\"} state:7) (place \"Disc1\" {\"D2\"} state:8) (place \"Disc2\" {\"A3\"} state:5) (place \"Disc2\" {\"B3\"} state:6) (place \"Disc2\" {\"C3\"} state:7) (place \"Disc2\" {\"D3\"} state:8) (place \"Disc2\" {\"A4\"} state:1) (place \"Disc2\" {\"B4\"} state:2) (place \"Disc2\" {\"C4\"} state:3) (place \"Disc2\" {\"D4\"} state:4)}) (play (move Select (from (forEach (sites Occupied by:Mover) if:(> (state at:(site)) (\"LastStateRemove\")))) (then (and (\"StoreStateRemoved\") (remove (last To)))))) (end (if (is Even \"LastStateRemove\") (result Mover Loss))))) 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\n4x4, 8, 10, 16, or 22 board. Two counters in each hole. Sowing occurs in an anti-clockwise direction. When the final counter of a sowing lands in an occupied hole, the contents are picked up and sowing continues. When the final counter lands in an empty hole in the player's inner row, the contents of the opponent's hole in the inner row opposite it are captured, and if there are counters also in the corresponding outer row hole, these are also captured. The player may also capture from another hole from the opponent's side of the board of their choosing. The turn ends. If the final counter lands in an empty hole in the player's outer row, the turn ends. Play continues until one player captures all of the opponent's counters, thus winning. Each player has 4 holes on each row.\n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (count in:(sites #1 \"Home\"))) (define \"Columns\" 4) (game \"Tshuba\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"0,E,N1,W\" loop:True P1) (track \"Track2\" \"8,E,N1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"Track1\")) (regions \"Home\" P2 (sites Track \"Track2\")) (regions \"Inner\" P1 (difference (sites Track \"Track1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"Track2\") (sites Top))) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 2 to:(union (sites P1 \"Home\") (sites P2 \"Home\")))) (play (if (= 1 (var \"ExtraCapture\")) (move Remove (difference (sites Next \"Home\") (sites Empty)) count:(count at:(to)) (then (set Var \"ExtraCapture\" 0))) (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover)) if:(< 0 (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)})))))))) (end (if (all Sites (sites Next \"Home\") if:(= 0 (count at:(site)))) (result Mover Win))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"ReplaceByLargePiece\" (fromTo (from (handSite Mover)) (to (between)))) (define \"LargePieveAvailable\" (\"HandOccupied\" Mover)) (define \"Team2OnlyOnStartSitesTeam1\" (all Sites (\"SitesOccupiedTeam2\") if:(is In (site) (\"StartSitesTeam1\")))) (define \"Team1OnlyOnStartSitesTeam2\" (all Sites (\"SitesOccupiedTeam1\") if:(is In (site) (\"StartSitesTeam2\")))) (define \"StartSitesTeam2\" (union (sites P2) (sites P3))) (define \"StartSitesTeam1\" (union (sites P1) (sites P4))) (define \"SitesOccupiedTeam2\" (union (sites Occupied by:P2) (sites Occupied by:P3))) (define \"SitesOccupiedTeam1\" (union (sites Occupied by:P1) (sites Occupied by:P4))) (define \"ScoreTeam2\" (+ (score P2) (score P3))) (define \"ScoreTeam1\" (+ (score P1) (score P4))) (game \"Awithlaknakwe\" (players {(player N) (player E) (player S) (player W)}) (equipment { (board (merge (merge (merge (merge (square 13 diagonals:Solid) (shift 3 -1 (rectangle 2 7 diagonals:Solid))) (shift 3 12 (rectangle 2 7 diagonals:Solid))) (shift -3.5 5.5 (rotate 90 (rectangle 2 7 diagonals:Solid)))) (shift 9.5 5.5 (rotate 90 (rectangle 2 7 diagonals:Solid)))) use:Vertex) (piece \"Counter\" Each (\"StepToEmpty\" (directions {FR FL}))) (piece \"DoubleCounter\" Each (\"StepToEmpty\" (directions {Rightward Forwards Leftward}))) (regions \"Home\" P1 (sites {\"D9\" \"E8\" \"F7\" \"G6\" \"H5\" \"I4\"})) (regions \"Home\" P2 (sites {\"I22\" \"H21\" \"G20\" \"F19\" \"E18\" \"D17\"})) (regions \"Home\" P3 (sites {\"Q22\" \"R21\" \"S20\" \"T19\" \"U18\" \"V17\"})) (regions \"Home\" P4 (sites {\"V9\" \"U8\" \"T7\" \"S6\" \"R5\" \"Q4\"})) (hand Each)}) (rules (start { (set Team 1 {P1 P4}) (set Team 2 {P2 P3}) (place \"Counter1\" (sites P1)) (place \"Counter2\" (sites P2)) (place \"Counter3\" (sites P3)) (place \"Counter4\" (sites P4)) (place \"DoubleCounter\" \"Hand\")}) (play (forEach Piece (then (custodial (from (last To)) Orthogonal (between (max 1) if:(\"IsEnemyAt\" (between)) (apply (and { (remove (between)) (if (\"LargePieveAvailable\") (\"ReplaceByLargePiece\")) (addScore Mover 1)}))) (to if:(\"IsFriendAt\" (to))))))) (end (if (and (\"Team1OnlyOnStartSitesTeam2\") (\"Team2OnlyOnStartSitesTeam1\")) { (if (> (\"ScoreTeam1\") (\"ScoreTeam2\")) (result Team1 Win)) (if (< (\"ScoreTeam1\") (\"ScoreTeam2\")) (result Team2 Win)) (if (= (\"ScoreTeam1\") (\"ScoreTeam2\")) (result Mover Draw))}))))\n\n###\n\n", "completion": "12x12 board, with a line of six extra squares centered on each side. Diagonals in every square. Pieces are played on the intersections of lines. Played with two or four players; with four players, the top and left players play against the bottom and right players. Six pieces per player, with one larger piece. Each player's six pieces begin on the central intersection of the extra spaces. Pieces move one spot at a time diagonally. When a player surrounds an opponent's piece on two opposite sides, this piece is captured. The piece is then replaced by the larger piece, which may move diagonally or orthogonally. Pieces may not move backward. When all of the players' remaining pieces reach the starting squares of the opponent, the player with the most captured pieces wins. END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"LetADiscOnTheFromLocation\" (add (piece \"Disc0\") (to (last From)))) (game \"Go with the Floe\" (players 2) (equipment { (board (keep (square 8) (poly { {-3 4} {4 -3} {11 4} {4 11}}))) (piece \"Seal\" P1 N (or (move Slide (between (max 2) trail:(id \"Disc0\"))) (move Hop (between if:(\"IsPieceAt\" \"Disc0\" Neutral (between))) (to if:(is Empty (to))) (then \"LetADiscOnTheFromLocation\")))) (piece \"Bear\" P2 (or { (move Slide (between (max 2) trail:(id \"Disc0\"))) (move Hop (between if:(\"IsPieceAt\" \"Disc0\" Neutral (between))) (to if:(is Empty (to))) (then \"LetADiscOnTheFromLocation\")) (move Step (to if:(\"IsPieceAt\" \"Seal1\" P1 (to)) (apply (remove (to)))) (then (and (remove (last To)) (\"LetADiscOnTheFromLocation\"))))})) (piece \"Disc\" Neutral)}) (rules (start { (place \"Bear2\" {\"G2\" \"G7\"}) (place \"Seal1\" {\"B2\" \"B7\"})}) (play (forEach Piece)) (end { (if (\"NoSites\" (sites Occupied by:All)) (result P2 Win)) (if (and (no Moves P1) (not (can Move (forEach Piece \"Bear\" (step (to if:(\"IsPieceAt\" \"Seal1\" P1 (to)))))))) (result P1 Win)) (if (all Passed) (result P1 Win))})))\n\n###\n\n", "completion": "Players take turns moving their pieces. Black starts. Players may: Move one or two empty spaces in any direction, or hop over one ring marker in any direction into an empty space. multiple jumps. White may capture an opponent's piece by moving onto its space from an adjacent one. Both the white and black pieces are removed from play. After moving or capturing, the moving player places a hole-in-the-ice ring marker on the moving tokens starting space and any empty space passed over. The goal for the white player is to capture both black tokens. The goal for the black player is to isolate at least one of their pieces so that it cannot be captured. If both players cannot play, black wins. 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": "Describe the mechanics of the following Ludii game\n(game \"Ko-app-paw-na\" (players 2) (equipment { (board (square 5) use:Vertex) (piece \"Rabbit\" P1 \"StepToEmpty\") (piece \"Counter\" P2 (or \"HopCapture\" \"StepToEmpty\")) (regions P1 (union (expand (sites Top)) (sites {\"A3\" \"E3\"})))}) (rules (start { (place \"Rabbit1\" (union (expand (sites Bottom)) (sites {\"A3\" \"E3\"}))) (place \"Counter2\" (centrePoint))}) (play (forEach Piece)) (end { (if (= (sites P1) (sites Occupied by:P1)) (result P1 Win)) (if (= (count Pieces P1) 11) (result P2 Win))})))\n\n###\n\n", "completion": "One player has a single piece, the other has twelve, playing as jackrabbits. The player playing as the jackrabbits attempts to move all of their pieces to the opposite side of the board until they form the same configuration as the starting position on the opposite side. Pieces move orthogonally to accomplish this. The opponent's goal is to capture one of the jackrabbits by hopping over it. END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe version of game with 3 players. -> The version of game with 4 players.\nThe game is played on a 3x3 board. -> The game is played on a 4x4 board.\n(game \"Yavalath\" (players 3) (equipment { (board (rotate 90 (hex 3))) (piece \"Marker\" Each)}) (rules (play (priority {(move Add (to (union (sites Winning Mover (add (to (sites Empty)))) (sites Winning Next (add (to (sites Empty))))))) (move Add (to (sites Empty)))})) (end { (if (is Line 4) (result Mover Win)) (if (is Line 3) (result Mover Loss))})))\n\n###\n\n", "completion": "(game \"Yavalath\" (players 4) (equipment { (board (rotate 90 (hex 4))) (piece \"Marker\" Each)}) (rules (play (priority {(move Add (to (union (sites Winning Mover (add (to (sites Empty)))) (sites Winning Next (add (to (sites Empty))))))) (move Add (to (sites Empty)))})) (end { (if (is Line 4) (result Mover Win)) (if (is Line 3) (result Mover Loss))}))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game is played on a 9x9 board -> The game is played on a 13x13 board\n(define \"CaptureSurroundedPiece\" (enclose (from (last To)) Orthogonal (between if:(\"IsEnemyAt\" (between)) (apply (and (addScore Mover 1) (remove (between))))))) (game \"Go\" (players 2) (equipment { (board (square 9) use:Vertex) (piece \"Marker\" Each)}) (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 \"CaptureSurroundedPiece\" (enclose (from (last To)) Orthogonal (between if:(\"IsEnemyAt\" (between)) (apply (and (addScore Mover 1) (remove (between))))))) (game \"Go\" (players 2) (equipment { (board (square 13) use:Vertex) (piece \"Marker\" Each)}) (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:\nThe board is a square board of size 4x4. -> The board is a square board of size 6x6.\n(define \"ReverseBoundedPieces\" (custodial (from (site)) (between if:(is Enemy (state at:(between))) (apply (allCombinations (add (piece \"Disc0\" state:(mover)) (to (site))) (flip (between))))) (to if:(is Friend (state at:(to)))))) (game \"Reversi\" (players 2) (equipment { (board (square 4)) (piece \"Disc\" Neutral (flips 1 2))}) (rules (start { (place \"Disc0\" (difference (sites Centre) (sites Phase 1)) state:1) (place \"Disc0\" (difference (sites Centre) (sites Phase 0)) state:2)}) phases:{ (phase \"Playing\" (play (forEach Site (sites Empty) (append \"ReverseBoundedPieces\" (then (and (set Score P1 (count Sites in:(sites State 1))) (set Score P2 (count Sites in:(sites State 2)))))))))} (end (if (all Passed) (byScore)))))\n\n###\n\n", "completion": "(define \"ReverseBoundedPieces\" (custodial (from (site)) (between if:(is Enemy (state at:(between))) (apply (allCombinations (add (piece \"Disc0\" state:(mover)) (to (site))) (flip (between))))) (to if:(is Friend (state at:(to)))))) (game \"Reversi\" (players 2) (equipment { (board (square 6)) (piece \"Disc\" Neutral (flips 1 2))}) (rules (start { (place \"Disc0\" (difference (sites Centre) (sites Phase 1)) state:1) (place \"Disc0\" (difference (sites Centre) (sites Phase 0)) state:2)}) phases:{ (phase \"Playing\" (play (forEach Site (sites Empty) (append \"ReverseBoundedPieces\" (then (and (set Score P1 (count Sites in:(sites State 1))) (set Score P2 (count Sites in:(sites State 2)))))))))} (end (if (all Passed) (byScore))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nA move of a player consists of two parts: he first makes a normal move with one of his pieces (this is not obligatory), but no piece may move to a goal, i.e., to e1 or e9. (Pieces like rooks and queens however may move across it, e.g. from d1 to f1.) However, no captures are made, and check is disregarded. Then, after this move, the player may, if he can, have a piece kick the ball.\n \n A piece can kick the ball if the ball is adjacent to it (i.e., a kings move away.) The ball moves in the same way as the piece that kicks the ball, and the ball must be moved directly away from the piece. Also, the ball cannot be moved to or over occupied squares (except when a knight kicks the ball). For instance, a rook on a3 can kick a ball on a4 to squares a5, a6, a7, a8, a9, as long as the ball isn't moved to an occupied square; but a rook on a3 cannot kick a ball on b4.\n \n A knight can kick the ball to any square, a knight-move away from the square where the ball was before the kick, but not to a square, adjacent to the knight.\n \n When the ball is kicked to a square adjacent to another piece of the same player, the player may make another kick. This is called a `pass'. If after a second kick, a third kick is possible, the player may also make this third kick, and similar for successive kicks. Making an infinite number of passes, in order to draw the game, however is not allowed. Note that when kicking, only the ball moves but all normal pieces remain on the same places.\n \n The object of the game is to kick to ball to the goal at the opponents side of the board. However, it is not allowed to kick the ball into or across the goal from a square on the 1st or 9th row. \n\n###\n\n", "completion": "(define \"CanKickAgainWithoutMoving\" (and (set Pending) (moveAgain))) (define \"KickBallAgainWithoutMoving\" (is Pending)) (define \"KickTheBall\" (if (\"KickerIsA\" \"Knight\" #1) (move (from (where \"Ball\" Shared)) (to (sites To (leap (from (where \"Ball\" Shared)) \"KnightWalk\" (to if:(is Empty (to))))) if:(not (is In (to) (sites Around #1))))) (if (\"KickerIsA\" \"King\" #1) (move (from (where \"Ball\" Shared)) (to (sites To (step (from (where \"Ball\" Shared)) (\"SameDirection\" #1) (to if:(is Empty (to))))) if:(if (\"InBottomOrTop\" #1) (not (is In (to) (sites \"Goals\"))) True))) (if (\"KickerIsA\" \"Queen\" #1) (move (from (where \"Ball\" Shared)) (to (sites To (slide (from (where \"Ball\" Shared)) (\"SameDirection\" #1) (between if:(if (\"InBottomOrTop\" #1) (\"NotInOrThroughGoal\") (is Empty (between)))))))) (if (\"KickerIsA\" \"Rook\" #1 Orthogonal) (move (from (where \"Ball\" Shared)) (to (sites To (slide (from (where \"Ball\" Shared)) (\"SameDirection\" #1) (between if:(if (\"InBottomOrTop\" #1) (\"NotInOrThroughGoal\") (is Empty (between)))))))) (if (\"KickerIsA\" \"Bishop\" #1 Diagonal) (move (from (where \"Ball\" Shared)) (to (sites To (slide (from (where \"Ball\" Shared)) (\"SameDirection\" #1) (between if:(if (\"InBottomOrTop\" #1) (\"NotInOrThroughGoal\") (is Empty (between)))))))))))) #2)) (define \"NotInOrThroughGoal\" (and (is Empty (between)) (not (is In (between) (sites \"Goals\"))))) (define \"InBottomOrTop\" (is In #1 (union (sites Bottom) (sites Top)))) (define \"KickerIsA\" (and (\"IsPieceAt\" #1 Mover #2) (is In (where \"Ball\" Shared) (sites Around #2 #3)))) (define \"SameDirection\" (directions Cell from:#1 to:(where \"Ball\" Shared))) (game \"Football Chess\" (players 2) (equipment { (board (square 9)) (piece \"Rook\" Each (move Slide Orthogonal (to (apply if:(not (is In (to) (sites \"Goals\"))))))) (piece \"King\" Each (move Step (to if:(and (is Empty (to)) (not (is In (to) (sites \"Goals\"))))))) (piece \"Bishop\" Each (move Slide Diagonal (to (apply if:(not (is In (to) (sites \"Goals\"))))))) (piece \"Knight\" Each (move Leap \"KnightWalk\" (to if:(and (is Empty (to)) (not (is In (to) (sites \"Goals\"))))))) (piece \"Queen\" Each (move Slide (to (apply if:(not (is In (to) (sites \"Goals\"))))))) (piece \"Ball\" Shared) (regions \"Goals\" (sites {\"E1\" \"E9\"})) (map \"Goal\" {(pair P1 \"E9\") (pair P2 \"E1\")})}) (rules (meta (no Repeat PositionalInTurn)) (start { (place \"Rook1\" {\"A1\" \"I1\"}) (place \"Knight1\" {\"B1\" \"H1\"}) (place \"Bishop1\" {\"C1\" \"G1\"}) (place \"Queen1\" coord:\"D1\") (place \"King1\" coord:\"F1\") (place \"Rook2\" {\"A9\" \"I9\"}) (place \"Knight2\" {\"B9\" \"H9\"}) (place \"Bishop2\" {\"C9\" \"G9\"}) (place \"Queen2\" coord:\"D9\") (place \"King2\" coord:\"F9\") (place \"Ball\" {\"E5\"})}) (play (if (\"SameTurn\") (or (if (\"KickBallAgainWithoutMoving\") (forEach Site (sites Around (where \"Ball\" Shared)) (\"KickTheBall\" (site)) (then (if (can Move (forEach Site (sites Around (where \"Ball\" Shared)) (\"KickTheBall\" (site)))) (\"CanKickAgainWithoutMoving\")))) (\"KickTheBall\" (last To) (then (if (can Move (forEach Site (sites Around (where \"Ball\" Shared)) (\"KickTheBall\" (site)))) (\"CanKickAgainWithoutMoving\"))))) (move Pass)) (or (forEach Piece (then (if (can Move (\"KickTheBall\" (last To))) (moveAgain)))) (forEach Site (sites Around (where \"Ball\" Shared)) (\"KickTheBall\" (site)) (then (if (can Move (forEach Site (sites Around (where \"Ball\" Shared)) (\"KickTheBall\" (site)))) (\"CanKickAgainWithoutMoving\"))))))) (end { (if (= (where \"Ball\" Shared) (mapEntry P1)) (result P1 Win)) (if (= (where \"Ball\" Shared) (mapEntry P2)) (result P2 Win))}))) 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": "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": "Modify the Ludii game according to the following option changes:\nThe game is played on a 4x4 board. -> The game is played on a 8x8 board.\n(define \"StepMove\" (\"StepToEmpty\" (directions { Forward Leftward Rightward}))) (game \"Dodgem\" (players 2) (equipment { (board (square 4)) (piece \"Car\" P1 E (if (is In (from) (sites Right)) (move Remove (from)) (\"StepMove\"))) (piece \"Car\" P2 N (if (is In (from) (sites Top)) (move Remove (from)) (\"StepMove\")))}) (rules (start { (place \"Car1\" (difference (sites Left) (sites {\"A1\"}))) (place \"Car2\" (difference (sites Bottom) (sites {\"A1\"})))}) (play (forEach Piece)) (end (\"EscapeWin\"))))\n\n###\n\n", "completion": "(define \"StepMove\" (\"StepToEmpty\" (directions { Forward Leftward Rightward}))) (game \"Dodgem\" (players 2) (equipment { (board (square 8)) (piece \"Car\" P1 E (if (is In (from) (sites Right)) (move Remove (from)) (\"StepMove\"))) (piece \"Car\" P2 N (if (is In (from) (sites Top)) (move Remove (from)) (\"StepMove\")))}) (rules (start { (place \"Car1\" (difference (sites Left) (sites {\"A1\"}))) (place \"Car2\" (difference (sites Bottom) (sites {\"A1\"})))}) (play (forEach Piece)) (end (\"EscapeWin\")))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\n1 seed per hole. -> 2 seeds per hole.\n(define \"LeftMost\" (trackSite FirstSite from:(trackSite FirstSite if:(not (is Mover (who at:(to))))) if:(is Mover (who at:(to))))) (define \"NumSeed\" 1) (define \"Columns\" 8) (game \"Quendo\" (players 4) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track\" \"0,E,N,W,S2\" loop:True)}) (piece \"Seed\" Each) (hand Each)}) (rules (start { (place \"Seed1\" (sites {0..4}) counts:{\"NumSeed\"}) (place \"Seed2\" (sites {5..7 15 23}) counts:{\"NumSeed\"}) (place \"Seed3\" (sites {31..27}) counts:{\"NumSeed\"}) (place \"Seed4\" (sites {26..24 16 8}) counts:{\"NumSeed\"})}) (play (if (!= 1 (count Pieces Mover)) (move Select (from (\"LeftMost\")) (then (sow 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)))))))) (move (from (\"LeftMost\")) (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 \"LeftMost\" (trackSite FirstSite from:(trackSite FirstSite if:(not (is Mover (who at:(to))))) if:(is Mover (who at:(to))))) (define \"NumSeed\" 2) (define \"Columns\" 8) (game \"Quendo\" (players 4) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track\" \"0,E,N,W,S2\" loop:True)}) (piece \"Seed\" Each) (hand Each)}) (rules (start { (place \"Seed1\" (sites {0..4}) counts:{\"NumSeed\"}) (place \"Seed2\" (sites {5..7 15 23}) counts:{\"NumSeed\"}) (place \"Seed3\" (sites {31..27}) counts:{\"NumSeed\"}) (place \"Seed4\" (sites {26..24 16 8}) counts:{\"NumSeed\"})}) (play (if (!= 1 (count Pieces Mover)) (move Select (from (\"LeftMost\")) (then (sow 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)))))))) (move (from (\"LeftMost\")) (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": "Modify the Ludii game according to the following option changes:\nPlayed on a 9x9 board. -> Played on a 13x13 board.\n(game \"Gomoku\" (players 2) (equipment { (board (square 9) use:Vertex) (piece \"Marker\" Each)}) (rules (play (move Add (to (sites Empty)))) (end (if (is Line 5 All exact:True) (result Mover Win)))))\n\n###\n\n", "completion": "(game \"Gomoku\" (players 2) (equipment { (board (square 13) use:Vertex) (piece \"Marker\" Each)}) (rules (play (move Add (to (sites Empty)))) (end (if (is Line 5 All exact:True) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe goal is to place eight queens on a standard Chess board so that none of them can take another. The puzzle is played on a 8x8 board\n\n###\n\n", "completion": "(game \"N Queens\" (players 1) (equipment { (board (square 8) (values Cell (range 0 1))) (regions {AllDirections})}) (rules (play (satisfy { (is Count (sites Board) of:1 8) (all Different except:0)})) (end (if (is Solved) (result P1 Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6-12 board, six is the most common. Four counters in each hole. A player moves by picking up the contents of one of their holes and sowing them in an anti-clockwise direction. If the final counter lands in an occupied hole, the contents of this hole are picked up and sowing continues. If the final counter falls into an empty hole, the turn ends. If the final counter falls into a hole containing three counters, making it four after the sowing, then these counters are captured and the turn ends. If at any time during sowing a player drops a counter into a hole to make it contain four, these are captured. If a player cannot move because there are no counters in their holes, they pass. When eight counters are left, the player to first capture a group of four also takes the remaining four counters on the board. Each player has 6 holes.\n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (count Cell at:(handSite #1))) (game \"Hoyito\" (players 2) (equipment { (mancalaBoard 2 6 store:None (track \"Track\" \"0,E,N,W\" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 4 to:(sites Track))) (play (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover)) if:(> (count at:(from)) 0)) (then (sow apply:(if (= (count at:(to)) 4) (if (<= (count in:(sites Board)) 8) (forEach Site (sites Board) (if (> (count at:(site)) 0) (fromTo (from (site)) (to (handSite Mover)) count:(count at:(site))))) (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to)))) (if (< (count at:(to)) 1) (moveAgain))))))) (end (\"MancalaByScoreWhen\" (no Moves Mover))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"Huli-Mane Ata\" (players 2) (equipment { (board (scale 1 2 (wedge 4 3)) use:Vertex) (hand P1) (piece \"Lamb\" P1 (\"StepToEmpty\")) (piece \"Tiger\" P2 (or (\"StepToEmpty\") (\"HopCapture\")))}) (rules (start { (place \"Lamb1\" (handSite P1) count:5) (place \"Tiger2\" (sites Top))}) phases:{ (phase \"Opening\" P1 (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (\"PhaseMovePiece\" \"Movement\")} (end { (if (no Moves P2) (result P1 Win)) (if (< (count Pieces P1) 4) (result P2 Win))})))\n\n###\n\n", "completion": "A triangle, with a line drawn from the apex to the base, and two lines drawn through the height connecting the opposite two sides. One player plays as one tiger, the other as five lambs. The tiger begins on the apex of the triangle. The tiger moves to an empty adjacent spot along the lines of the board. The player who plays as the lambs plays first, placing a lamb on an empty spot on the board, and then the tiger player moves. When all of the lambs are placed, the lambs move in the same manner as the tiger. The tiger may capture a lamb by hopping over it to an empty space on the opposite adjacent side of the lamb along the lines on the board. The lambs win when they block the tiger from being able to move, the tiger wins by capturing enough lambs so that it cannot be blocked. END" }, { "prompt": "Construct a Ludii game based on the following description\nTwo arcs which meet, in the shape of a horn, curving to the left. Nine points along the left side, and eight along the right, with one at the apex. Zig-zag lines connect points on either side of the board, connecting the first on the left to the first on the right, the first on the right to the second on the left, the second on the left to the second on the right, and so on. One player plays as the cow and the calf (black). The cow begins on the first point on the left, the calf on the second point on the right. The other player plays as two children (white), which begin on the second point on the left and the first point on the right. Players alternate turns moving a piece to an empty adjacent spot along the lines on the board. The cow never moves from its position. The calf plays first. The calf wins when it reaches the cow; the children win when they force the calf onto the apex of the board (the pasture). \n\n###\n\n", "completion": "(game \"Uxrijn Ever\" (players 2) (equipment { (board (graph vertices:{ {0 0} {5 0} {0.17 1} {4.65 1} {0.3 2} {4.3 2} {0.38 3} {3.9 3} {0.25 4} {3.5 4} {-0.13 5} {2.97 5} {-0.75 6} {2.2 6} {-1.47 7} {0.95 7} {-2.22 8} {-3 9}} edges:{ {0 1} {0 2} {2 4} {4 6} {6 8} {8 10} {10 12} {12 14} {14 16} {16 17} {1 3} {3 5} {5 7} {7 9} {9 11} {11 13} {13 15} {1 2} {2 3} {3 4} {4 5} {5 6} {6 7} {7 8} {8 9} {9 10} {10 11} {11 12} {12 13} {13 14} {14 15} {15 16} {15 17}}) use:Vertex) (piece \"Cow\" P1) (piece \"Calf\" P1 (move Step (to if:(or (\"IsPieceAt\" \"Cow\" P1 (to)) (is Empty (to))) (apply (remove (to)))))) (piece \"Human\" P2 \"StepToEmpty\")}) (rules (start { (place \"Cow1\" 0) (place \"Calf1\" 3) (place \"Human2\" (sites {1 2}))}) (play (forEach Piece)) (end { (if (is In (where \"Calf\" P1) (sites Top)) (result P2 Win)) (if (= 1 (count Sites in:(sites Occupied by:P1))) (result P1 Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\n17x17 intersecting lines, with alternating black and white points, four equally spaced along the third and fifteenth rank and two along the seventh and eleventh rows, forming a large square. Each player has two kinds of piece, six bull-shaped pieces and 144 round pieces. To begin, players place their bull-shaped pieces on the opposite-color marked points on the board. Then, players alternate turns placing one of their pieces in an adjacent space next to one of their bull pieces. Once all of the bull pieces have been surrounded, the main phase of play begins. Players alternate turns placing one of their pieces on the board. The player who encloses the greatest number of empty spaces wins. \n\n###\n\n", "completion": "(game \"Dorvolz\" (players 2) (equipment { (board (square 17) use:Vertex) (hand Each size:2) (piece \"Bull\" Each) (piece \"Marker\" Each) (regions \"BullSites\" P1 (sites {\"C3\" \"K3\" \"O7\" \"C11\" \"G15\" \"O15\"})) (regions \"BullSites\" P2 (sites {\"G3\" \"O3\" \"C7\" \"O11\" \"C15\" \"K15\"}))}) (rules (start { (place \"Bull1\" (handSite P1) count:6) (place \"Bull2\" (handSite P2) count:6) (place \"Marker1\" (handSite P1 1) count:144) (place \"Marker2\" (handSite P2 1) count:144)}) phases:{ (phase \"BullPlacement\" (play (move (from (handSite Mover)) (to (intersection (sites Empty) (sites Mover))))) (nextPhase Mover (= 6 (count Sites in:(intersection (sites Board) (sites Occupied by:Mover)))) \"MarkerPlacementAroundBull\")) (phase \"MarkerPlacementAroundBull\" (play (move (from (handSite Mover 1)) (to (intersection (sites Empty) (sites Around (sites Mover) All))))) (nextPhase Mover (= 54 (count Sites in:(intersection (sites Board) (sites Occupied by:Mover)))) \"Playing\")) (phase \"Playing\" (play (move (from (handSite Mover 1)) (to (sites Empty)))) (end (if (and (\"HandEmpty\" P1) (\"HandEmpty\" P2)) (byScore { (score P1 (size Territory P1 All)) (score P2 (size Territory P2 All))}))))})) 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": "Describe the mechanics of the following Ludii game\n(define \"OppositePit\" (if (is Mover P1) (+ (to) \"Columns\") (- (to) \"Columns\"))) (define \"StoreLastHoleSowed\" (set Var (to))) (define \"LastHoleSowed\" (sites {(var)})) (define \"SowingEndInMyStore\" (= (to) (mapEntry Mover))) (define \"LastCounterInTheStore\" (set Pending)) (define \"WasInStore\" (is Pending)) (define \"PiecesCaptured\" (count at:(mapEntry #1))) (define \"Columns\" 7) (game \"Sungka\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" (track \"Track\" \"7,W,WNW,ENE,E,ESE\" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 FirstSite) (pair P2 LastSite)}) (piece \"Seed\" Shared)}) (rules (start (set Count \"Columns\" to:(union (sites P1) (sites P2)))) phases:{ (phase \"Sowing\" (play (move Select (from (if (and (\"SameTurn\") (not (\"WasInStore\"))) \"LastHoleSowed\" (sites Mover)) if:(< 0 (count at:(from)))) (then (sow apply:(if (\"SowingEndInMyStore\") (and (moveAgain) (\"LastCounterInTheStore\")) (if (and {(is In (to) (sites Mover)) (= (count at:(to)) 1) (< 0 (count at:\"OppositePit\"))}) (fromTo (from \"OppositePit\") (to (mapEntry (mover))) count:(count at:\"OppositePit\")) (if (> (count at:(to)) 1) (and (moveAgain) (\"StoreLastHoleSowed\"))))) skipIf:(= (to) (mapEntry Next)))))) (end (if (all Passed) { (if (> 7 (count at:(mapEntry P1))) (result P2 Win)) (if (> 7 (count at:(mapEntry P2))) (result P1 Win))})) (nextPhase (all Passed) \"BetweenRounds\")) (phase \"BetweenRounds\" (play (if (<= 7 (count at:(mapEntry Mover))) (move (from (mapEntry Mover)) (to (intersection (sites Empty) (sites Mover))) count:7))) (nextPhase (all Passed) \"Sowing\"))}))\n\n###\n\n", "completion": "2x7 board, with two stores. Each player owns the store to their left. Seven counters per hole. Players take counters from one hole and sow them in a clockwise direction starting in the next hole from which the counters were taken. Players include their own store when sowing but ignore their opponent's store. If last counter falls into an empty hole, move ends. If it is on the player's side, the counters in the opponent's hole opposite are taken and added to the player's store. If the last counter falls into the player's store, the player may sow counters from another hole on their side. If the last counter drops into an occupied hole on either side of the board, the counters are picked up and sowing continues until the last counter drops into an empty hole. When all of the counters are in the players' stores, a new round begins. Players fill their holes with the counters in their store. Any holes which cannot be filled with seven counters are out of play for this round; any extra counters go back in the store. Play continues until one player cannot fill any holes, and the opponent wins. END" }, { "prompt": "Construct a Ludii game based on the following description\nThe first player (Grey) has their home area on the left; the second player (Black) on the right.\n \n In the initial setup phase players move their pieces from their hand to their home area. By default the pieces will be placed vertically. Press 'r' whilst moving it, to place one horizontally.\n \n Finally the players take turns to guess spaces in their opponent's home area. These are revealed to be either water or a ship according to the following code: Carrier - 5 spaces; Battleship - 4 spaces; Destroyer - 3 spaces; Submarine - 3 spaces; Patrol Boat - 2 spaces. \n\n###\n\n", "completion": "(define \"DeclareVictory\" (if (= (id #1) (var)) (result #1 Win))) (define \"CheckForVictory\" (if (and (>= (count Turns) 10) (= 0 (count Sites in:(intersection (sites Hidden to:Mover) (sites Occupied by:Next))))) (set Var (id Mover) (then (forEach Site (sites Board) (set Hidden at:(site) False to:Next)))))) (define \"ClearShotSpace\" (set State at:(last From) (\"Hit\") (then (set Hidden at:(last From) False to:Mover #1)))) (define \"DefinePiece\" (piece #3 Each) (tile #1 Each #2 (move (from if:(is In (from) (sites Hand Mover))) (to (intersection (sites Mover \"Defence\") (sites Empty))) (then (do (forEach Site (sites LargePiece at:(last To)) (remember Value (site)) (then (remove (last To)))) next:(do (forEach Value (values Remembered) (add (piece (id #3 Mover)) (to (value)) (then (set State at:(last To) 0)))) next:(forget Value All))))))) (define \"Waves\" (difference (sites Empty) (sites Hidden to:All))) (define \"Hit\" 1) (game \"Battleships\" (players 2) (equipment { (board (rectangle 10 20)) (\"DefinePiece\" \"CarrierTemplate\" { {F F F F} {L F F F F}} \"Carrier\") (\"DefinePiece\" \"BattleshipTemplate\" { {F F F} {L F F F}} \"Battleship\") (\"DefinePiece\" \"DestroyerTemplate\" { {F F} {L F F}} \"Destroyer\") (\"DefinePiece\" \"SubmarineTemplate\" { {F F} {L F F}} \"Submarine\") (\"DefinePiece\" \"PatrolBoatTemplate\" { {F} {L F}} \"PatrolBoat\") (regions \"Defence\" P1 (expand (sites Left) steps:9)) (regions \"Defence\" P2 (expand (sites Right) steps:9)) (hand Each size:5)}) (rules (start { (set Hidden (sites P1 \"Defence\") to:P2) (set Hidden (sites P2 \"Defence\") to:P1) (set Hidden (sites Hand P1) to:P2) (set Hidden (sites Hand P2) to:P1) (place \"CarrierTemplate1\" (handSite P1 0)) (place \"CarrierTemplate2\" (handSite P2 0)) (place \"BattleshipTemplate1\" (handSite P1 1)) (place \"BattleshipTemplate2\" (handSite P2 1)) (place \"DestroyerTemplate1\" (handSite P1 2)) (place \"DestroyerTemplate2\" (handSite P2 2)) (place \"SubmarineTemplate1\" (handSite P1 3)) (place \"SubmarineTemplate2\" (handSite P2 3)) (place \"PatrolBoatTemplate1\" (handSite P1 4)) (place \"PatrolBoatTemplate2\" (handSite P2 4))}) phases: { (phase \"Setup\" (play (forEach Piece container:(mover))) (nextPhase (>= (count Turns) 10) \"Playing\")) (phase \"Playing\" (play (move Select (from (intersection (sites Next \"Defence\") (sites Hidden to:Mover))) (then (\"ClearShotSpace\" (then (\"CheckForVictory\")))))))} (end { (\"DeclareVictory\" P1) (\"DeclareVictory\" P2)}))) END" }, { "prompt": "Construct a Ludii game based on the following description\n4x8 board. Two counters in each hole. Sowing proceeds in an anti-clockwise direction. The first move must begin from the second hole from the right in the player's outer row, and proceed as follows, and is played simultaneously by both players: sow the two counters from that first hole, capture the counters in the opponent's two opposite holes and sow them, starting in the rightmost hole in the outer row, capture from the opposite two holes on the opponent's side and sow them again from the same hole. When the final counter falls in an occupied hole, those counters are picked up and sowing continues. The opening move ends when the final counter falls in an empty hole. The main phase then begins. When the final counter falls into an occupied hole in the player's inner row and both of the opposite holes on the opponent's side of the board are occupied, the counters in the opposite holes are captured and sown beginning in the first hole that was sown into to begin the sowing that caused the capture. When the final counter falls into an occupied hole and a capture is not possible, the contents of the hole are picked up and sowing continues. When the final counter lands in an empty hole, the turn ends. Players cannot sow from a hole containing a single counter. The player who captures all of their opponent's counters wins.\n \n\n###\n\n", "completion": "(define \"Columns\" 8) (game \"Otep\" (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) (map \"SecondRightOuter\" {(pair P1 14) (pair P2 17)}) (map \"RightOuter\" {(pair P1 15) (pair P2 16)}) (hand Each)}) (rules (start (set Count 2 to:(sites Board))) phases:{ (phase \"Opening1\" (play (move Select (from (mapEntry \"SecondRightOuter\" Mover)) (then (sow \"Track\" owner:(mover) apply:(and (fromTo (from (\"OppositePit\" (last From))) (to (mapEntry \"RightOuter\" Mover)) count:2) (fromTo (from (\"OppositeOuterPit\" (last From))) (to (mapEntry \"RightOuter\" Mover)) count:2)))))) (nextPhase Mover \"Opening2\")) (phase \"Opening2\" (play (move Select (from (mapEntry \"RightOuter\" Mover)) (then (sow \"Track\" owner:(mover) apply:(and (fromTo (from (\"OppositePit\" (last From))) (to (mapEntry \"RightOuter\" Mover)) count:2) (fromTo (from (\"OppositeOuterPit\" (last From))) (to (mapEntry \"RightOuter\" Mover)) count:2)))))) (nextPhase Mover \"Opening3\")) (phase \"Opening3\" (play (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites {(mapEntry \"RightOuter\" Mover)}))) (then (sow \"Track\" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain)))))) (nextPhase Mover (not (is Next Prev)) \"Sowing\")) (phase \"Sowing\" (play (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover)) if:(> (count at:(from)) 1)) (then (sow \"Track\" owner:(mover) apply:(if (and { (is In (to) (sites Mover \"Inner\")) (< 1 (count at:(to))) (is Occupied (\"OppositeOuterPit\" (to))) (is Occupied (\"OppositePit\" (to)))}) (and { (fromTo (from (\"OppositeOuterPit\" (to))) (to (last From)) count:(count at:(\"OppositeOuterPit\" (to)))) (fromTo (from (\"OppositePit\" (to))) (to (last From)) count:(count at:(\"OppositePit\" (to)))) (sow (last From) count:(+ (count at:(\"OppositePit\" (to))) (count at:(\"OppositeOuterPit\" (to)))) \"Track\" owner:(mover))}) (if (< 1 (count at:(to))) (moveAgain))))))))} (end (\"ForEachPlayerNoMovesLoss\")))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nEach row has 9 holes. -> Each row has 10 holes.\n(define \"AllSitesNoMoreThanOne\" (all Sites (sites Mover \"Home\") if:(>= 1 (count at:(site))))) (define \"NextHole\" (\"NextSiteOnTrack\" #2 from:#1 \"Track\")) (define \"NoPiece\" (all Sites (sites Player) if:(= 0 (count at:(site))))) (define \"Columns\" 9) (game \"Njombwa (Two Counters)\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"0,E,N1,W\" loop:True P1) (track \"Track2\" \"18,E,N1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"Track1\")) (regions \"Home\" P2 (sites Track \"Track2\")) (regions \"Inner\" P1 (difference (sites Track \"Track1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"Track2\") (sites Top))) (piece \"Seed\" Shared)}) (rules (start { (set Count 2 to:(difference (sites Board) (sites {9 (+ 1 9) (- (* 9 3) 1) (- (* 9 3) 2)}))) (set Count 1 to:(sites {(+ 9 1) (- (* 9 3) 2)}))}) (play (if (\"AllSitesNoMoreThanOne\") (move Select (from (sites Mover \"Home\") if:(and (is Occupied (from)) (is Empty (\"NextHole\" (from) 1)))) (then (sow \"Track\" owner:(mover)))) (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(> (count at:(from)) 1)) (then (sow \"Track\" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (and (is In (to) (sites Mover \"Inner\")) (is Occupied (\"OppositePit\" (to)))) (and (remove (\"OppositePit\" (to))) (if (is Occupied (\"OppositeOuterPit\" (to))) (remove (\"OppositeOuterPit\" (to)))))))))))) (end (forEach NonMover if:(\"NoPiece\") (result Player Loss)))))\n\n###\n\n", "completion": "(define \"AllSitesNoMoreThanOne\" (all Sites (sites Mover \"Home\") if:(>= 1 (count at:(site))))) (define \"NextHole\" (\"NextSiteOnTrack\" #2 from:#1 \"Track\")) (define \"NoPiece\" (all Sites (sites Player) if:(= 0 (count at:(site))))) (define \"Columns\" 10) (game \"Njombwa (Two Counters)\" (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))) (piece \"Seed\" Shared)}) (rules (start { (set Count 2 to:(difference (sites Board) (sites {10 (+ 1 10) (- (* 10 3) 1) (- (* 10 3) 2)}))) (set Count 1 to:(sites {(+ 10 1) (- (* 10 3) 2)}))}) (play (if (\"AllSitesNoMoreThanOne\") (move Select (from (sites Mover \"Home\") if:(and (is Occupied (from)) (is Empty (\"NextHole\" (from) 1)))) (then (sow \"Track\" owner:(mover)))) (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(> (count at:(from)) 1)) (then (sow \"Track\" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (and (is In (to) (sites Mover \"Inner\")) (is Occupied (\"OppositePit\" (to)))) (and (remove (\"OppositePit\" (to))) (if (is Occupied (\"OppositeOuterPit\" (to))) (remove (\"OppositeOuterPit\" (to)))))))))))) (end (forEach NonMover if:(\"NoPiece\") (result Player Loss))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nFifteen corn kernels are placed in a line; the playing spaces are the empty spaces between the kernels. Four corn kernels used as dice, marked on one side. The value of a throw is equal to the number of marked sides that land up, except when no marked sides are up, when the value is 5. Any number of players, who play on two teams, each starting from one side of the board. Five pieces per player. Players take turns moving pieces according to the throws of the corn, with two throws per turn. When a player reaches the opposite end of the board, they move to the start and continue moving in the same direction. If a piece lands on a space occupied by an opponent's piece, the player then moves in the reverse direction, carrying the opponent's piece with it in an attempt to move past the starting point and off the board. When the player moves past the starting point and then moves off the board, the opponent's piece is captured. The player who made the capture enters their piece again on their next turn. However, if the opponent lands on a piece carrying one of their pieces away, they then start carrying both of those pieces back to their starting point, freeing the captured piece and capturing the other player's piece. Players belonging to the same team may land on the same spot, but both are taken back to start if the opponent lands on them. Players cannot enter more than one of their pieces on the board at one time. The first team to capture all of the opposing team's pieces wins. 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 \"EnterAPiece\" (move (from (handSite Mover)) (to (\"NextSiteOnTrack\" (- \"ThrowValue\" 1) from:(\"EntryPoint\" (mover)) \"Track\")))) (define \"FreePiece\" (= 0 #1)) (define \"CapturedPiece\" (= 2 #1)) (define \"CapturingPiece\" (= 1 #1)) (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 \"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 \"EntryPoint\" (mapEntry \"Entry\" (mover))) (define \"ThrowValue\" (mapEntry \"Throw\" (count Pips))) (game \"Boolik\" (players 6) (equipment { (board (rectangle 1 15) { (track \"Track1\" {0..13} loop:True P1) (track \"Track2\" {13..0} loop:True P2) (track \"CaptureTrack1\" {13..0} P1 directed:True) (track \"CaptureTrack2\" {0..13} P2 directed:True) (track \"Track3\" {0..13} loop:True P3) (track \"Track4\" {13..0} loop:True P4) (track \"CaptureTrack3\" {13..0} P3 directed:True) (track \"CaptureTrack4\" {0..13} P4 directed:True) (track \"Track5\" {0..13} loop:True P5) (track \"Track6\" {13..0} loop:True P6) (track \"CaptureTrack5\" {13..0} P5 directed:True) (track \"CaptureTrack6\" {0..13} P6 directed:True)} use:Edge) (piece \"Stick\" Each (or (if (\"FreePiece\" (state at:(from) level:(level))) (move (from (from) level:(level)) (to (\"NextSiteOnTrack\" (\"ThrowValue\") from:(from) \"Track\")) (then (if (\"AtLeastAnEnemyPieceThere\" (last To)) (\"CaptureMove\"))))) (if (\"CapturingPiece\" (state at:(from) level:(level))) (if (\"IsNotOffBoard\" (\"NextSiteOnTrack\" (\"ThrowValue\") from:(from) \"CaptureTrack\")) (move (from (from) level:(level)) (to (\"NextSiteOnTrack\" (\"ThrowValue\") from:(from) \"CaptureTrack\")) (then (and (\"CapturedPiecesFollowCapturingPiece\") (\"UnsetCapturingPieces\")))) (move Remove (from) level:(level) (then (and { (\"UnsetCapturingPieces\") (\"RemoveCapturedPieces\") (\"RebirthCapturingPiece\")}))))))) (regions \"AllSites\" (sites Board Vertex)) (map \"Throw\" {(pair 0 5) (pair 1 1) (pair 2 2) (pair 3 3) (pair 4 4)}) (map \"Entry\" { (pair 1 0) (pair 2 13) (pair 3 0) (pair 4 13) (pair 5 0) (pair 6 13) (pair 7 0) (pair 8 13) (pair 9 0) (pair 10 13) (pair 11 0) (pair 12 13) (pair 13 0) (pair 14 13) (pair 15 0) (pair 16 13)}) (\"StickDice\" 4) (hand Each)}) (rules (start { (set Team 1 {P1 P3 P5}) (set Team 2 {P2 P4 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)}) (play (\"RollMove\" (or { (if (and (\"NoPieceOnBoard\") (is Occupied (handSite Mover))) (\"EnterAPiece\")) (forEach Piece)}) (then (if (and (not (no Pieces Mover)) (\"NewTurn\")) (moveAgain))))) (end (\"CaptureAllTeam\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\nGROUP - A connected chain of friendly stones.\n \n TURN - Initially, Black drops one stone of either color, then for the remaining turns players drop two stones of either color.\n \n GOAL - After the board is full, wins the player with the higher product between its two largest groups. If both products are equal, wins the player with less stones on board (note: draws are impossible). \n\n###\n\n", "completion": "(define \"ProductBiggestGroups\" (* (max (sizes Group #1)) (max (difference (sizes Group #1) (max (sizes Group #1)))))) (game \"Product\" (players 2) (equipment { (board (hex 5)) (piece \"Marker\" Each)}) (rules (play (move Add (to (sites Empty)))) (end (if (is Full) (byScore { (score P1 (\"ProductBiggestGroups\" P1)) (score P2 (\"ProductBiggestGroups\" P2))}))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"Tre Guti\" (players 2) (equipment { (board (square 3) use:Vertex) (hand Each) (piece \"Marker\" Each (or (\"StepToEmpty\") (\"HopCapture\")))}) (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 (\"CaptureAll\" Next))))\n\n###\n\n", "completion": "3x3 crossed lines, pieces move on the intersections and along the lines. Three pieces per player. In the placement phase, players alternate turns placing one of their pieces on an empty spot. When all of the pieces are placed, Players attempt to capture their opponent's pieces by hopping over them. The player who captures all of the opponent's pieces wins. 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": "Construct a Ludii game based on the following description\n5x5 intersecting lines with diagonals in the four quadrants. Twelve pieces per player, arranged on the intersections of the lines, on the first two ranks in front of each player and the two to the right of the player in the central rank. Pieces move in any direction one space. A piece may capture an opponent's piece by hopping over it to an empty space in a straight line. Captures are obligatory. If a player does not capture when they are supposed to, the opponent may remove that piece immediately and then play as normal. Once pieces reach the opposite side of the board from their starting position at the end of their turn, they are promoted and can move in any direction and over any distance. The player who captures all of their opponent's pieces or blocks them from being able to move wins. \n\n###\n\n", "completion": "(define \"HuffOnePieceOf\" (move Select (from #1 if:(is Occupied (from))) (then (and { (remove (last To)) (moveAgain) (set Value Prev 0)})))) (define \"ShouldCapturedButMoved\" (and (is In (last From) (\"SitesWithPossibleCaptureInPreviousTurn\")) (is In (last From) (sites Empty)))) (define \"SitesWithPossibleCaptureInPreviousTurn\" (sites Pending)) (define \"RememberSiteWithPossibleCapture\" (set Pending (sites From (or (forEach Piece \"Counter\" (\"Hop\")) (forEach Piece \"DoubleCounter\" (\"Hop\")))))) (define \"DidNotCaptured\" (= (value Player Prev) 1)) (define \"HasNotCaptured\" (set Value Mover 1)) (define \"HasCaptured\" (set Value Mover 0)) (define \"Hop\" (\"HopCapture\" ~ ~ (then (and (\"PromoteIfReach\" (sites Next) \"DoubleCounter\") (\"HasCaptured\"))))) (game \"Kharberg\" (players 2) (equipment { (\"AlquerqueBoard\" 5 5) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece \"Counter\" Each (or (\"Hop\") (\"StepToEmpty\" ~ (then (\"HasNotCaptured\"))) (then (\"PromoteIfReach\" (sites Next) \"DoubleCounter\")))) (piece \"DoubleCounter\" Each (or (\"Hop\") (move Slide (then (\"HasNotCaptured\")))))}) (rules (start { (place \"Counter1\" (union {(expand (sites Bottom)) (sites {\"D3\" \"E3\"})})) (place \"Counter2\" (union {(sites {\"A3\" \"B3\"}) (expand (sites Top))}))}) (play (or (if (\"DidNotCaptured\") (or (if (\"ShouldCapturedButMoved\") (\"HuffOnePieceOf\" (last To))) (\"HuffOnePieceOf\" (\"SitesWithPossibleCaptureInPreviousTurn\")))) (do (\"RememberSiteWithPossibleCapture\") next:(forEach Piece)))) (end (\"BlockWin\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\nTURN - On each turn, each player drops a neutral stone on an empty cell provided that it does not share the same row, column or diagonal with all the stones already on board.\n \n GOAL - Wins the last player to move \n\n###\n\n", "completion": "(game \"First Attack\" (players 2) (equipment { (board (square 8)) (piece \"Ball\" Shared)}) (rules (play (move Add (piece \"Ball\") (to (sites Empty) if:(all Sites (sites Direction from:(to) Adjacent) if:(is Empty (site)))))) (end (\"BlockWin\")))) 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 Ludii game based on the following description\nThe board consists of 5x5 intersecting lines with diagonals of each quadrant. Pieces are placed on the intersections and can move along the lines. Each player has 12 pieces. Pieces can move to one adjacent point. Captures can be made by hopping over an opponent's piece. The goal is to capture all of the opponent's pieces.\n \n \n\n###\n\n", "completion": "(game \"Bara Guti\" (players 2) (equipment { (\"AlquerqueBoard\" 5 5) (piece \"Marker\" Each (or (\"HopCapture\") (\"StepToEmpty\")))}) (rules (\"BeforeAfterCentreSetup\" \"Marker1\" \"Marker2\") (play (forEach Piece)) (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x12 board, divided in half. Spaces on each side take the form of semi-circular sockets, into which the pieces fit. Fifteen pieces per player. One player places all of their pieces on the sixth point of one of the quadrants of the board, and the other player places all of their pieces on the fifth point of the same quadrant. Three 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. Players move the pieces along the same track around the board, which ends on the quadrant on the other side of the board from the starting quadrant. When a piece is moved to a space occupied by a piece belonging to the opponent, the opponent's piece is sent back to the starting point. The first player to bear off all of their pieces from the board wins. All the pieces start in the first quadrant. The game involves 3 dice.\n\n###\n\n", "completion": "(define \"UseDie\" (forEach Die if:(\"DieNotUsed\") #1)) (define \"PieceMove\" (if (\"IsOffBoard\" #1) \"RemoveAPiece\" (if (\"NoEnemyOrOnlyOne\" #1) (move (from) (to #1 (\"HittingCapture\" (handSite (who at:(to))))))))) (define \"RemoveAPiece\" (move Remove (from))) (define \"SiteToMoveOnTrackAtSix\" (\"NextSiteOnTrack\" 6)) (define \"SiteToMoveOnTrackAtFive\" (\"NextSiteOnTrack\" 5)) (define \"SiteToMoveOnTrackAtFour\" (\"NextSiteOnTrack\" 4)) (define \"SiteToMoveOnTrackAtThree\" (\"NextSiteOnTrack\" 3)) (define \"SiteToMoveOnTrackAtTwo\" (\"NextSiteOnTrack\" 2)) (define \"SiteToMoveOnTrackAtOne\" (\"NextSiteOnTrack\" 1)) (game \"Cab e Quinal\" (players 2) (equipment { (\"TableBoard\" \"TableTracksSameDirectionWithHands\") (dice d:6 num:3) (hand Each) (piece \"Disc\" Each (\"UseDie\" (\"PieceMove\" (\"NextSiteOnTrack\" (pips)))))}) (rules (start { (place Stack \"Disc1\" 5 count:15) (place Stack \"Disc2\" 4 count:15)}) (play (\"RollEachNewTurnMove\" (or (forEach Piece top:True) (forEach Piece container:(mover) top:True) (then (if (or (= (value Player Mover) Undefined) (not (all DiceUsed))) (moveAgain) (if (and (all DiceUsed) (= (value Player Mover) 1)) (set Value Mover Undefined))))))) (end { (\"EscapeWin\") (if (and (no Moves P1) (no Moves P2)) (result Mover Draw))}))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nOpponent pieces become friends (Defector Y) -> Freinly pieces become Opponent's pieces\nTriangle-8 Board (36) -> Triangle-15 Board (120)\n(define \"EdgesOfSide\" (intersection (sites Outer Edge) (forEach of:(difference #1 (sites Corners Vertex)) (sites Incident Edge of:Vertex at:(site))))) (define \"BoardColour\" (colour 215 203 170)) (define \"P2Colour\" (colour White)) (define \"P1Colour\" (colour DarkGreen)) (define \"IsConnectedAtStartOfFirstMove\" (and (is Next (next)) (\"IsConnectedPlayer\")) (and (= 1) (\"IsConnectedPlayer\"))) (define \"IsWinningConnectionAtSite\" (is Connected 3 at:#1 { \"Side1\" \"Side2\" \"Side3\"})) (define \"StonesOfIn\" (intersection (sites Occupied by:#1) #2)) (define \"FlipFromTo\" (move Add (piece (id \"Disc\" #2)) (to (sites Occupied by:#1) if:(< (\"NeighborCountOf\" #2) ((\"NeighborCountOf\" #1))) (apply (remove (to)))))) (define \"AddToEmpty\" (move Add (to (sites Empty)) (then (set Var \"MoveInTurn\" (% (+ 3 (var \"MoveInTurn\")) 2))))) (define \"NeighborCountOf\" (count Pieces #1 in:(sites Around (to) Orthogonal))) (define \"Side3\" (union (sites Side NW) (sites Side SW))) (define \"Side2\" (union (sites Side SE) (sites Side S))) (define \"Side1\" (union (sites Side NE) (sites Side N))) (define \"AnyOfTheseSitesMeetThisCondition\" (< 0 (size Array (array (forEach #1 #2))))) (game \"00'Y'\" (players 2) (equipment { (board (tri 8) use:Vertex) (piece \"Disc\" Each) (piece \"Counter\" Neutral maxState:2)}) (rules (play (priority { (if (\"SameTurn\") (\"FlipFromTo\" Next Mover)) (\"AddToEmpty\")} (then (if (or (= 1 (var \"MoveInTurn\")) (can Move (\"FlipFromTo\" Next Mover))) (moveAgain) (if (\"AnyOfTheseSitesMeetThisCondition\" (sites Occupied by:Next) if:(\"IsWinningConnectionAtSite\" (site))) (trigger \"Win\" Next)))))) (end { (if (is Triggered \"Win\" Next) (result Next Win)) (if (and (no Moves Mover) (\"AnyOfTheseSitesMeetThisCondition\" (sites Occupied by:Next) if:(\"IsWinningConnectionAtSite\" (site)))) (result Next Win))})))\n\n###\n\n", "completion": "(define \"EdgesOfSide\" (intersection (sites Outer Edge) (forEach of:(difference #1 (sites Corners Vertex)) (sites Incident Edge of:Vertex at:(site))))) (define \"BoardColour\" (colour 215 203 170)) (define \"P2Colour\" (colour White)) (define \"P1Colour\" (colour DarkGreen)) (define \"IsConnectedAtStartOfFirstMove\" (and (is Next (next)) (\"IsConnectedPlayer\")) (and (= 1) (\"IsConnectedPlayer\"))) (define \"IsWinningConnectionAtSite\" (is Connected 3 at:#1 { \"Side1\" \"Side2\" \"Side3\"})) (define \"StonesOfIn\" (intersection (sites Occupied by:#1) #2)) (define \"FlipFromTo\" (move Add (piece (id \"Disc\" #2)) (to (sites Occupied by:#1) if:(< (\"NeighborCountOf\" #2) ((\"NeighborCountOf\" #1))) (apply (remove (to)))))) (define \"AddToEmpty\" (move Add (to (sites Empty)) (then (set Var \"MoveInTurn\" (% (+ 3 (var \"MoveInTurn\")) 2))))) (define \"NeighborCountOf\" (count Pieces #1 in:(sites Around (to) Orthogonal))) (define \"Side3\" (union (sites Side NW) (sites Side SW))) (define \"Side2\" (union (sites Side SE) (sites Side S))) (define \"Side1\" (union (sites Side NE) (sites Side N))) (define \"AnyOfTheseSitesMeetThisCondition\" (< 0 (size Array (array (forEach #1 #2))))) (game \"00'Y'\" (players 2) (equipment { (board (tri 15) use:Vertex) (piece \"Disc\" Each) (piece \"Counter\" Neutral maxState:2)}) (rules (play (priority { (if (\"SameTurn\") (\"FlipFromTo\" Mover Next)) (\"AddToEmpty\")} (then (if (or (= 1 (var \"MoveInTurn\")) (can Move (\"FlipFromTo\" Mover Next))) (moveAgain) (if (\"AnyOfTheseSitesMeetThisCondition\" (sites Occupied by:Next) if:(\"IsWinningConnectionAtSite\" (site))) (trigger \"Win\" Next)))))) (end { (if (is Triggered \"Win\" Next) (result Next Win)) (if (and (no Moves Mover) (\"AnyOfTheseSitesMeetThisCondition\" (sites Occupied by:Next) if:(\"IsWinningConnectionAtSite\" (site)))) (result Next Win))}))) 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 Ludii game based on the following description\n2x12 board, divided in half. Spaces on each side take the form of semi-circular sockets, into which the pieces fit. The points form a continuous track in a horseshoe shape; each player progresses in opposite directions (one from their bottom right to the top right, the other from their bottom left to their top left). Fifteen pieces per player. The starting position is as such, number the points from the origin of each player's track: point six: five pieces; point 8: three pieces; point 13: five pieces; point 24: two pieces. Two 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 a player's piece lands on a spot occupied by a single piece belonging to the opponent, the opponent's piece is sent back to the quadrant in which that player started with two pieces. Players bear off their pieces at the end of their track. The first player to bear off all their pieces wins. \n\n###\n\n", "completion": "(define \"GoBack\" (if (and (!= (to) (regionSite (sites #1 \"StartQuadrant\") index:0)) (not (\"IsFriendAt\" (regionSite (sites #1 \"StartQuadrant\") index:0)))) (regionSite (sites #1 \"StartQuadrant\") index:0) (if (and (!= (to) (regionSite (sites #1 \"StartQuadrant\") index:1)) (not (\"IsFriendAt\" (regionSite (sites #1 \"StartQuadrant\") index:1)))) (regionSite (sites #1 \"StartQuadrant\") index:1) (if (and (!= (to) (regionSite (sites #1 \"StartQuadrant\") index:2)) (not (\"IsFriendAt\" (regionSite (sites #1 \"StartQuadrant\") index:2)))) (regionSite (sites #1 \"StartQuadrant\") index:2) (if (and (!= (to) (regionSite (sites #1 \"StartQuadrant\") index:3)) (not (\"IsFriendAt\" (regionSite (sites #1 \"StartQuadrant\") index:3)))) (regionSite (sites #1 \"StartQuadrant\") index:3) (if (and (!= (to) (regionSite (sites #1 \"StartQuadrant\") index:4)) (not (\"IsFriendAt\" (regionSite (sites #1 \"StartQuadrant\") index:4)))) (regionSite (sites #1 \"StartQuadrant\") index:4) (if (and (!= (to) (regionSite (sites #1 \"StartQuadrant\") index:5)) (not (\"IsFriendAt\" (regionSite (sites #1 \"StartQuadrant\") index:5)))) (regionSite (sites #1 \"StartQuadrant\") index:5) (if (and (!= (to) (regionSite (sites #1 \"StartQuadrant\") index:6)) (not (\"IsFriendAt\" (regionSite (sites #1 \"StartQuadrant\") index:6)))) (regionSite (sites #1 \"StartQuadrant\") index:6) Off)))))))) (define \"NextSiteFrom\" (\"NextSiteOnTrack\" #2 from:#1)) (game \"Todas Tablas\" (players 2) (equipment { (\"TableBoard\" \"TableTracksOpposite2\") (dice d:6 num:2) (piece \"Disc\" Each (forEach Die if:(\"DieNotUsed\") (if (\"IsOffBoard\" (\"NextSiteFrom\" (from) (pips))) (move Remove (from)) (move (from (from)) (to (\"NextSiteFrom\" (from) (pips)) if:(\"NoEnemyOrOnlyOne\" (to)) (\"HittingCapture\" (\"GoBack\" Next))))) (then (\"ReplayNotAllDiceUsed\")))) (regions \"StartQuadrant\" P1 (sites {6..11})) (regions \"StartQuadrant\" P2 (sites {18..23}))}) (rules (start { (place Stack \"Disc1\" 6 count:5) (place Stack \"Disc1\" 4 count:3) (place Stack \"Disc1\" 12 count:5) (place Stack \"Disc1\" 23 count:2) (place Stack \"Disc2\" 18 count:5) (place Stack \"Disc2\" 16 count:3) (place Stack \"Disc2\" 0 count:5) (place Stack \"Disc2\" 11 count:2)}) (play (\"RollEachNewTurnMove\" (forEach Piece))) (end (\"EscapeWin\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThree concentric circles, with four diameters dividing it into eight equal sections. Twelve pieces per player, placed on the points on one half of the circle, leaving the central point open. Players alternate turns moving one of their pieces to an empty adjacent spot along the lines. A piece may capture an opponent's piece by hopping over it to an empty spot immediately on the opposite side of the opponent's piece along the lines. The player who captures all of the opponent's pieces wins. \n\n###\n\n", "completion": "(game \"Bara Guti (Bihar)\" (players 2) (equipment { (board (concentric {1 8 8 8}) use:Vertex) (piece \"Counter\" Each (or (\"HopRotationalCapture\") (\"StepRotationalToEmpty\")))}) (rules (start { (place \"Counter1\" (sites {2..5 10..13 18..21})) (place \"Counter2\" (sites {1 9 17 6..8 14..16 22..24}))}) (play (forEach Piece)) (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe board is a five-pointed star. The player has nine pieces. The player attempts to place all the pieces on the board. The player choses a point, then moves the piece two spaces in a straight line. The piece may move through a spot occupied by another piece, but must land on an empty space. The player wins by successfully placing all nine pieces.\n \n\n###\n\n", "completion": "(game \"Pentalpha\" (players 1) (equipment { (\"StarBoard\" 5) (hand Each) (piece \"Marker\" P1 (\"HopFriendCapture\"))}) (rules (start (place \"Marker\" (handSite P1) count:9)) (play (if (is Even (count Moves)) (move (from (handSite Mover)) (to (sites Empty)) (then (moveAgain))) (forEach Piece (if (= (from) (last To)) (move Hop (between if:(or (\"IsFriendAt\" (between)) (is Empty (between)))) (to if:(is Empty (to)))))))) (end { (if (and (is Even (count Moves)) (\"HandEmpty\" Mover)) (result Mover Win)) (if (no Moves Next) (result Mover Loss))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nChoose between two versions: \n -- Place the most stones, or \n -- Form the largest group. \n \n Ties are broken by relying on a cascading comparison of largest groups; \n - With a standard choice of breaking the tie in favor of the underdog.\n \n The board starts empty.\n Players take turns in sequence. Passing is allowed. \n The game ends when all players have passed in succession. \n \n On a turn, the mover either:\n 1: Places a stone on an empty site, - or -\n 2: Replaces an opponent's stone with their own,\n ---- But replacing a stone is only allowed when there are more stones around that site of the captured stone's color than there are of the mover's own color.\n \n Note: On boards with diagonals, diagonally adjacent stones are part of the count used to allow or disallow capture.\n \n At the end of the game, players count all their stones, or count the stones in their largest group, depending on the goal. Which stones belong to a given group are determined by orthogonal connections.\n \n In the case of a tie between the leading players, each pair of those players compares the size of their largest remaining group after any tied pairs have been removed. \n \n This difference is added to the score of the player with the larger group in that pairing - (or to the score of other player in that pairing, in the case of underdog tie-breaking) \n \n The winner of the game is decided by these amended scores.\n Ties may still remain. Also ties between non-leading players are not resolved. Order 4 board Triangle-Square N-2: Capture-compare all 7 adjacent directions. Scoring - groups connect only in the 5 edge-edge directions. Score a point for each stone placed. While ignoring paired groups of equal size, if your largest group is SMALLER, augment your score by the difference between your largest group and the largest group for every tied opponent. 2 players\n\n###\n\n", "completion": "(define \"ColourBackground\" (colour 136 175 96)) (define \"SquareDiagonal\" (board (square (- (* 2 4) 2)) use:Vertex)) (define \"SquareGrid\" (board (square 4) use:Cell)) (define \"TriSquare\" (board (tiling T33434 (- 4 2)) use:Vertex)) (define \"HexCell\" (board (hex Hexagon 4) use:Cell)) (define \"Hex2Limp\" (board (hex (- 4 1) (+ 4 1)) use:Cell)) (define \"HexLimp\" (board (hex Limping (- 4 1)) use:Cell)) (define \"BoardUsed\" \"TriSquare\") (define \"ConnectionDirection\" All) (define \"ScoreConnection\" Adjacent) (define \"Anemone\" (or { (move Pass) (move Claim (to (sites Empty))) (forEach Site (difference (difference (sites Board) (sites Empty)) (sites Occupied by:Mover)) (if (\"LessQtyAroundSiteThanAnother\" (who at:(site))) (move Remove (site) (then (claim (to (last To)))))))} (then (\"Scoring\" (\"StoneCount\" (player)))))) (define \"LessQtyAroundSiteThanAnother\" (> (max 0 (count Pieces of:#1 in:(sites Around (site) \"ConnectionDirection\"))) (max 0 (count Pieces of:(mover) in:(sites Around (site) \"ConnectionDirection\"))))) (define \"StoneCount\" (count Sites in:(sites Occupied by:Player))) (define \"GroupCount\" (max 0 (max (sizes Group \"ScoreConnection\" of:#1)))) (define \"Tied4FirstPlace\" (= (#1) (max (difference (values Remembered \"Scores\") #1)))) (define \"LargerGroup\" (max 0 (max (difference (sizes Group \"ScoreConnection\" of:#1) (sizes Group \"ScoreConnection\" of:#2))))) (define \"CascadeLoses\" (max 0 (- (\"LargerGroup\" (value) (player)) (\"LargerGroup\" (player) (value))))) (define \"CascadeWins\" (max 0 (- (\"LargerGroup\" (player) (value)) (\"LargerGroup\" (value) (player))))) (define \"Scoring\" (if (all Passed) (do (forEach Player (remember Value \"Scores\" #1)) next:(do (forEach Player (if (\"Tied4FirstPlace\" #1) (and (remember Value \"Tied\" (player)) (set Score Player #1)) (set Score Player #1))) next:(do (forEach Value (values Remembered \"Tied\") (forEach (players All if:(is In (player) (values Remembered \"Tied\"))) (addScore (player (player)) (\"CascadeLoses\")))) next:(forget Value \"Scores\" All (then (forget Value \"Tied\" All)))))) (forEach Player (set Score Player #1)))) (game \"Windflowers\" (players 2) (equipment { \"BoardUsed\" (piece \"Ball\" Each)}) (rules (start (set Score Each 0)) (play \"Anemone\") (end (if (all Passed) (byScore))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nEach row has 9 holes. -> Each row has 11 holes.\n(define \"Move\" (or { (if (\"IsInTrack\" (site) \"HomeTrack\") (move (from (site)) (to (\"NextSiteOnTrack\" (\"ThrowValue\") from:(site) \"HomeTrack\") \"CaptureEnemyPiece\") count:(count at:(site)))) (if (\"IsInTrack\" (site) \"MiddleTrack\") (move (from (site)) (to (\"NextSiteOnTrack\" (\"ThrowValue\") from:(site) \"MiddleTrack\") \"CaptureEnemyPiece\") count:(count at:(site)))) (if (\"IsInTrack\" (site) \"EnemyTrack\") (if (if (is In (site) (sites Next \"Home\")) True (and (!= 0 (\"CountPiecesInHome\" Next)) (\"PieceDidNotGoToEnemyHome\" (site)))) (move (from (site)) (to (\"NextSiteOnTrack\" (\"ThrowValue\") from:(site) \"EnemyTrack\") \"CaptureEnemyPiece\") count:(count at:(site)) (then (if (and (is In (last To) (sites Next \"Home\")) (\"PieceDidNotGoToEnemyHome\" (last To))) (\"PieceGoesToEnemyHome\" (last To)))))))})) (define \"IsInTrack\" (is In #1 (sites Track Mover #2))) (define \"PieceDidNotGoToEnemyHome\" (= 0 (state at:#1))) (define \"PieceGoesToEnemyHome\" (set State at:#1 1)) (define \"CountPiecesInHome\" (count Pieces #1 in:(sites #1 \"Home\"))) (define \"CaptureEnemyPiece\" (apply if:(\"IsEnemyAt\" (to)) (remove (to) count:(count at:(to))))) (define \"Tab\" (= 1 (\"ThrowValue\"))) (define \"SpecialThrows\" (is In (\"ThrowValue\") (sites {1 4 6}))) (define \"ThrowValue\" (mapEntry (count Pips))) (game \"Tab\" (players 2) (equipment { (board (rectangle 4 9) { (track \"HomeTrack1\" \"0,E,N1,W\" P1 directed:True) (track \"HomeTrack2\" \"35,W,S1,E\" P2 directed:True) (track \"MiddleTrack\" \"17,W,N1,E\" loop:True) (track \"EnemyTrack1\" \"18,E,N1,W,S1,E\" P1 directed:True) (track \"EnemyTrack2\" \"17,W,S1,E,N1,W\" P2 directed:True)} use:Vertex) (piece \"Stick\" Each) (regions \"AllSites\" (sites Board)) (\"StickDice\" 4) (map \"Throw\" {(pair 0 6) (pair 1 1) (pair 2 2) (pair 3 3) (pair 4 4)}) (regions \"Home\" P1 (sites Bottom)) (regions \"Home\" P2 (sites Top))}) (rules (start { (place \"Stick1\" (sites Bottom)) (place \"Stick2\" (sites Top))}) phases:{ (phase \"InitGame\" (play (\"RollMove\" (move Pass) (then (if (\"Tab\") (moveAgain))))) (nextPhase (\"Tab\") \"Play\")) (phase \"Play\" (play (\"RollMove\" (forEach Site (sites Occupied by:Mover) (\"Move\")) (then (if (\"SpecialThrows\") (moveAgain))))))} (end (\"CaptureAll\" Next))))\n\n###\n\n", "completion": "(define \"Move\" (or { (if (\"IsInTrack\" (site) \"HomeTrack\") (move (from (site)) (to (\"NextSiteOnTrack\" (\"ThrowValue\") from:(site) \"HomeTrack\") \"CaptureEnemyPiece\") count:(count at:(site)))) (if (\"IsInTrack\" (site) \"MiddleTrack\") (move (from (site)) (to (\"NextSiteOnTrack\" (\"ThrowValue\") from:(site) \"MiddleTrack\") \"CaptureEnemyPiece\") count:(count at:(site)))) (if (\"IsInTrack\" (site) \"EnemyTrack\") (if (if (is In (site) (sites Next \"Home\")) True (and (!= 0 (\"CountPiecesInHome\" Next)) (\"PieceDidNotGoToEnemyHome\" (site)))) (move (from (site)) (to (\"NextSiteOnTrack\" (\"ThrowValue\") from:(site) \"EnemyTrack\") \"CaptureEnemyPiece\") count:(count at:(site)) (then (if (and (is In (last To) (sites Next \"Home\")) (\"PieceDidNotGoToEnemyHome\" (last To))) (\"PieceGoesToEnemyHome\" (last To)))))))})) (define \"IsInTrack\" (is In #1 (sites Track Mover #2))) (define \"PieceDidNotGoToEnemyHome\" (= 0 (state at:#1))) (define \"PieceGoesToEnemyHome\" (set State at:#1 1)) (define \"CountPiecesInHome\" (count Pieces #1 in:(sites #1 \"Home\"))) (define \"CaptureEnemyPiece\" (apply if:(\"IsEnemyAt\" (to)) (remove (to) count:(count at:(to))))) (define \"Tab\" (= 1 (\"ThrowValue\"))) (define \"SpecialThrows\" (is In (\"ThrowValue\") (sites {1 4 6}))) (define \"ThrowValue\" (mapEntry (count Pips))) (game \"Tab\" (players 2) (equipment { (board (rectangle 4 11) { (track \"HomeTrack1\" \"0,E,N1,W\" P1 directed:True) (track \"HomeTrack2\" \"43,W,S1,E\" P2 directed:True) (track \"MiddleTrack\" \"21,W,N1,E\" loop:True) (track \"EnemyTrack1\" \"22,E,N1,W,S1,E\" P1 directed:True) (track \"EnemyTrack2\" \"21,W,S1,E,N1,W\" P2 directed:True)} use:Vertex) (piece \"Stick\" Each) (regions \"AllSites\" (sites Board)) (\"StickDice\" 4) (map \"Throw\" {(pair 0 6) (pair 1 1) (pair 2 2) (pair 3 3) (pair 4 4)}) (regions \"Home\" P1 (sites Bottom)) (regions \"Home\" P2 (sites Top))}) (rules (start { (place \"Stick1\" (sites Bottom)) (place \"Stick2\" (sites Top))}) phases:{ (phase \"InitGame\" (play (\"RollMove\" (move Pass) (then (if (\"Tab\") (moveAgain))))) (nextPhase (\"Tab\") \"Play\")) (phase \"Play\" (play (\"RollMove\" (forEach Site (sites Occupied by:Mover) (\"Move\")) (then (if (\"SpecialThrows\") (moveAgain))))))} (end (\"CaptureAll\" Next)))) 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": "Construct a Ludii game based on the following description\n8x8 board. Four players. Two dice. Four pawns, one ship, one horse, one elephant, and one king per player. The king moves one square in any direction. Pawns move one square forward, and capture one square forward diagonally. Horses move three squares diagonally. Ships move two squares diagonally. The Elephant moves any number of squares orthogonally. Moves are determined by dice roll: 5= pawn or king, 4= elephant, 3= horse, 2= ship. Captures are made by moving onto the space occupied by an opponent's piece. If a ship moves into a space to make a 2x2 square with only ships, it captures the other three ships. Pawns may promote but only to the other piece that begins in that rank or file, including a king, and that piece must have already been captured. Points are awarded based on captures: pawns=1, ships=2, horses=3, elephants=4, kings=5. If a player captures their opponents' three kings while theirs remains, they receive 54 points. The player who accumulates the most points wins. The rules are describing with the Wikipedia ruleset.\n\n###\n\n", "completion": "(define \"PlayAPiece\" (forEach Die (if (= (pips) 5) (or (forEach Piece \"Pawn\") (forEach Piece \"King_noCross\")) (if (= (pips) 4) (forEach Piece \"Elephant\") (if (= (pips) 3) (forEach Piece \"Knight\") (if (= (pips) 2) (forEach Piece \"Boat\"))))))) (define \"PromoteTo\" (if (\"IsOffBoard\" (where #1 Mover)) (move Promote (last To) (piece #1) Mover (then #2)))) (define \"CaptureForwardDiagonal\" (move Step (directions {FR FL}) (to if:(\"IsEnemyAt\" (to)) \"CaptureToPieceAndAddScore\"))) (define \"CaptureToPieceAndAddScore\" (apply (if (is Occupied (to)) (and (addScore Mover (value Piece at:(to))) (remove (to)))))) (game \"Chaturaji\" (players {(player N) (player W) (player S) (player E)}) (equipment { (board (square 8)) (dice d:4 from:2 num:1) (piece \"Pawn\" Each (or \"StepForwardToEmpty\" \"CaptureForwardDiagonal\" (then (if (is In (last To) (sites Mover \"Promotion\")) (and (moveAgain) (set Pending)))))) (piece \"Boat\" Each (move Hop Diagonal (to if:(not (\"IsFriendAt\" (to))) \"CaptureToPieceAndAddScore\"))) (piece \"Knight\" Each (move Leap \"KnightWalk\" (to if:(not (\"IsFriendAt\" (to))) \"CaptureToPieceAndAddScore\"))) (piece \"Elephant\" Each (move Slide Orthogonal (between if:(is Empty (between))) (to if:(\"IsEnemyAt\" (to)) \"CaptureToPieceAndAddScore\"))) (piece \"King_noCross\" Each (move Step (to if:(not (\"IsFriendAt\" (to))) \"CaptureToPieceAndAddScore\"))) (regions \"Promotion\" P1 (sites Top)) (regions \"Promotion\" P2 (sites Left)) (regions \"Promotion\" P3 (sites Bottom)) (regions \"Promotion\" P4 (sites Right))}) (rules (start { (place \"Pawn1\" {\"A2\" \"B2\" \"C2\" \"D2\"} value:1) (place \"Pawn2\" {\"G1\" \"G2\" \"G3\" \"G4\"} value:1) (place \"Pawn3\" {\"H7\" \"G7\" \"E7\" \"F7\"} value:1) (place \"Pawn4\" {\"B5\" \"B6\" \"B7\" \"B8\"} value:1) (place \"Boat1\" coord:\"A1\" value:2) (place \"Boat2\" coord:\"H1\" value:2) (place \"Boat3\" coord:\"H8\" value:2) (place \"Boat4\" coord:\"A8\" value:2) (place \"Knight1\" coord:\"B1\" value:3) (place \"Knight2\" coord:\"H2\" value:3) (place \"Knight3\" coord:\"G8\" value:3) (place \"Knight4\" coord:\"A7\" value:3) (place \"Elephant1\" coord:\"C1\" value:4) (place \"Elephant2\" coord:\"H3\" value:4) (place \"Elephant3\" coord:\"F8\" value:4) (place \"Elephant4\" coord:\"A6\" value:4) (place \"King_noCross1\" coord:\"D1\" value:5) (place \"King_noCross2\" coord:\"H4\" value:5) (place \"King_noCross3\" coord:\"E8\" value:5) (place \"King_noCross4\" coord:\"A5\" value:5)}) (play (\"RollEachNewTurnMove\" (if (and (\"SameTurn\") (is Pending)) (or { (\"PromoteTo\" \"Boat\" (set Value at:(last To) 2)) (\"PromoteTo\" \"Knight\" (set Value at:(last To) 3)) (\"PromoteTo\" \"Elephant\" (set Value at:(last To) 4)) (\"PromoteTo\" \"King_noCross\" (set Value at:(last To) 5))}) \"PlayAPiece\" (then (if (can Move \"PlayAPiece\") (moveAgain)))))) (end (if (= (count Pieces Mover) (- (count Pieces All) 1)) (byScore))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nWagner is a non-capturing game. Initially, each player places a stone at any vertex (not the centre) to maintain the graph colouring rules (i.e., no two friendly pieces are adjacent to each other). Each turn a player moves a friendly stone to an adjacent empty site. The goal is to make all the friendly pieces into a single group. \n \n\n###\n\n", "completion": "(game \"Wagner\" (players 2) (equipment { (board (graph vertices:{ {2 0} {5 0} {0 2} {0 5} {7 2} {7 5} {2 7} {5 7}} edges:{ {0 1} {0 2} {0 7} {1 4} {1 6} {2 3} {2 5} {3 4} {3 6} {4 5} {5 7} {6 7}}) use:Vertex) (piece \"Marker\" Each (\"StepToEmpty\"))}) (rules (start { (set P1 Vertex (sites {0 5 6})) (set P2 Vertex (sites {1 2 7}))}) (play (forEach Piece)) (end (if (= 1 (count Groups if:(= (who at:(to)) (mover)))) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayed on a board with 36 holes arranged in a square, with a gap in the center of each side. There are two semi circles of five holes on the outside of two opposite corners of the board. Two pieces per player. Four stick dice are used, each with one marked side. Each die is marked differently for a different value: 4, 6, 14, 15. The throws are as follows: All marked sides up = 5; three marked sides up = 3; two marked sides up = 2, one marked side up = the value of the marked side; zero marked sides up = 10. Throws of 14 may instead be played as a throw of 1, whenever the player chooses. Players\u2019 pieces enter on the branching arcs. Players move in opposite directions around the board, and then back down the arc in which they started, moving their pieces off the board. If a player lands on the same spot as the opponent, the opponent\u2019s piece is removed from the board and must re-enter. A player's piece is allowed to occupy the same space as that player's other piece. On the last side of the rectangle before completing a circuit of the board, only throws of 1, 2, or 3 are used. Players must make an exact throw to get a piece off the board. The first player to remove their pieces from the board wins.\n \n\n###\n\n", "completion": "(define \"Movement\" (if (if (not (is In (from) (sites Mover \"LastSide\"))) True (or { (= (\"ThrowValue\") 1) (= (\"ThrowValue\") 2) (= (\"ThrowValue\") 3)})) (or (if (= 14 (\"ThrowValue\")) (if (\"IsEndTrack\" (\"SiteToMoveOnTrack\" 1)) \"RemoveAPiece\" (move (from (from) level:(level)) (to (\"SiteToMoveOnTrack\" 1) (\"HittingStackCapture\" (handSite (who at:(to) level:(level)))))))) (if (\"IsEndTrack\" (\"SiteToMoveOnTrack\" (\"ThrowValue\"))) \"RemoveAPiece\" (move (from (from) level:(level)) (to (\"SiteToMoveOnTrack\" (\"ThrowValue\")) (\"HittingStackCapture\" (handSite (who at:(to) level:(level)))))))))) (define \"RemoveAPiece\" (move Remove (from) level:(level))) (define \"ThrowValue\" (mapEntry \"Throw\" (count Pips))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" #1)) (game \"Romavoa\" (players 2) (equipment { (\"KintsBoard\" { (track \"Track1\" \"46,5,SSE,N,E,S,W,NNW2,End\" P1 directed:True) (track \"Track2\" \"47,41,NNW,W,S,E,N,SSE2,End\" P2 directed:True)}) (regions \"AllSites\" (sites Board)) (regions \"LastSide\" P1 (sites {6..9 23..27})) (regions \"LastSide\" P2 (sites {27 33..40})) (dice d:2 facesByDie:{{0 4} {0 6} {0 14} {0 15}} num:4) (piece \"Marker\" Each (\"Movement\")) (hand Each) (map \"Throw\" { (pair 0 10) (pair 39 5) (pair 24 3) (pair 25 3) (pair 35 3) (pair 33 3) (pair 10 2) (pair 18 2) (pair 19 2) (pair 20 2) (pair 21 2) (pair 29 2)})}) (rules (start { (place Stack \"Marker1\" (handSite P1) count:2) (place Stack \"Marker2\" (handSite P2) count:2)}) (play (\"RollMove\" (or (forEach Piece) (forEach Piece container:(mover))))) (end (\"EscapeWin\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\nTri-It-Out is a 2-player strategy game played on a hex grid.\n Definitions:\n -- A 'Triangle' means a pattern of 3 counters that are equidistant from each other, it may be in any orientation including orientations with edges that do not follow grid lines.\n -- A 'Mixed Triangle' is a triangle made of more than one player's counters.\n -- A 'Restricted Location' is an empty intersection that would form a Mixed Triangle if either player placed a piece there; that is it would form a Triangle that includes a mixed-color pair of counters already on the board.\n \n The goal is to have the FEWEST counters on the board when no further play is possible. In the case of a tie, the player who would have been next to make a placement loses.\n \n Turns consist of:\n -- 1) a Placement of a piece onto an empty site that is not a 'Restricted Location'. \n -- 2) If any new Mixed Triangles are created, a Capture is made by removing one opponent's piece from one of them.\n \nA player must continue to take a series of consecutive turns until a Placement is made that cannot be followed by a Capture. Standard Rules Board & size: Hexhex with edges alternating 3 and 4\n\n###\n\n", "completion": "(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\" (no Moves Mover)) (define \"Sites2Capture\" (\"TriangleSites\" (sites Occupied by:Next) (sites Occupied by:Next) { (value Player (mover))})) (define \"OutstandingCaptures\" (< 0 (size Array (array \"Sites2Capture\")))) (define \"TriangleSites\" (union { (\"Due2Step\" {F} #1 #2 #3) (\"Due2Step\" {F R F} #1 #2 #3) (\"Due2Step\" {F F} #1 #2 #3) (\"Due2Step\" {F R F F} #1 #2 #3) (\"Due2Step\" {F F R F} #1 #2 #3) (\"Due2Step\" {F F R F F} #1 #2 #3) (\"Due2Step\" {F F F} #1 #2 #3) (\"Due2Step\" {F R F F F} #1 #2 #3) (\"Due2Step\" {F F F R F} #1 #2 #3) (\"Due2Step\" {F F R F F F} #1 #2 #3) (\"Due2Step\" {F F F R F F} #1 #2 #3) (\"Due2Step\" {F F F F} #1 #2 #3) (\"Due2Step\" {F F F R F F F} #1 #2 #3) (\"Due2Step\" {F R F F F F} #1 #2 #3) (\"Due2Step\" {F F F F R F} #1 #2 #3) (\"Due2Step\" {F F F F R F F} #1 #2 #3) (\"Due2Step\" {F F R F F F F} #1 #2 #3) (\"Due2Step\" {F F F F F} #1 #2 #3) (\"Due2Step\" {F F F R F F F F} #1 #2 #3) (\"Due2Step\" {F F F F R F F F} #1 #2 #3) (\"Due2Step\" {F F F F F R F} #1 #2 #3) (\"Due2Step\" {F R F F F F F} #1 #2 #3)})) (define \"Due2Step\" (intersection (sites Board) (sites (results from:#2 to:(intersection (sites (from) { #1} rotations:True) #3) (if (!= 0 (size Array (intersection (intersection (array (sites (from) { #1} rotations:True)) (array (sites (to) { #1} rotations:True))) (array #4)))) (from) -1))))) (game \"Tri-It-Out\" (players 2) (equipment { (board (tri {3 4 3 4 3}) use:Vertex) (piece \"Counter\" Each)}) (rules (meta (no Repeat PositionalInTurn)) (start { (set Score Each 0)}) (play (if (is Pending) (move Remove (sites Pending) (then (and (set Value Mover Infinity) (moveAgain)))) (move Add (to (difference (sites Empty) (\"TriangleSites\" (sites Empty) (sites Occupied by:P1) (sites Occupied by:P2))) (apply (set Value Mover (to)))) (then (if \"OutstandingCaptures\" (and (set Pending \"Sites2Capture\") (moveAgain))))) (then (set Score P1 (- (count Pieces P1)) (then (set Score P2 (- (count Pieces P2)))))))) (end { (if (and { (no Moves Next) False}) (result Mover Loss)) (if (and (no Moves Next) (= (count Pieces P1) (count Pieces P2))) (result Mover Loss)) (if (and (no Moves Next) (!= (count Pieces P1) (count Pieces P2))) (byScore))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nTo be reconstructed. Rules as inferred by Murray 1951. One player is the bean, and the other player plays with twelve corn kernels. The corn kernels move along the lines. The goal is to corner the bean so that it cannot move. The bean may hop over the corn kernels to capture them or move to an adjacent empty point along the lines. The bean wins by reducing the opponent to nine corn kernels. The coyote can jump to capture.\n\n###\n\n", "completion": "(game \"Pon Chochotl\" (players 2) (equipment { (\"AlquerqueBoard\" 5 5) (piece \"Corn\" P1 \"StepToEmpty\") (piece \"Bean\" P2 (or (\"HopCapture\") (if (\"SameTurn\") (move Pass) (\"StepToEmpty\"))))}) (rules (start { (place \"Corn1\" (union {(expand (sites Bottom)) (sites {\"A3\" \"E3\"})})) (place \"Bean2\" (centrePoint))}) (play (forEach Piece)) (end (\"NoMovesLossAndLessNumPiecesPlayerLoss\" P1 9)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe rules are the same as for Halma. Pieces move one space orthogonally or diagonally. They may jump over a piece of any color. Multiple jumps in one turn are possible. Jumps do not capture. The player who first places all of their pieces in the opponent's starting position wins. The game is played on a board 8x8.\n\n###\n\n", "completion": "(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 \"Grasshopper\" (players 2) (equipment { (board (square 8)) (piece \"Counter\" Each) (regions \"Home\" P1 (expand origin:(coord \"A1\") steps:3 Orthogonal)) (regions \"Home\" P2 (expand origin:(coord \"H8\") steps:3 Orthogonal)) (map {(pair P1 P2) (pair P2 P1)})}) (rules (start { (place \"Counter1\" (sites P1)) (place \"Counter2\" (sites P2))}) phases:{ (phase \"Movement\" (play (forEach Piece (or (\"HopSequence\" (from)) (move Step (to if:(and (is Empty (to)) (or (not (is In (from) (sites Next))) (is In (to) (sites Next))))))))) (nextPhase (is Mover (next)) \"MultiJump\")) (phase \"MultiJump\" (play (or (\"HopSequence\" (last To)) (move Pass))) (nextPhase (not (is Mover (next))) \"Movement\"))} (end (\"FillWin\" (sites (player (mapEntry (mover)))))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nTwo concentric circles, with two perpendicular diameters intersecting both circles, and four other lines, positioned diagonally, connecting the circumferences of the two circles. Six pieces per player. which begin on opposite sides of the circle from the other player, three on each circle. Players alternate turns moving their pieces. Pieces move three spaces along the lines on the board, regardless of whether they are occupied, capturing any piece on the third. Pieces may change direction in a turn, as long as the lines are followed and there is no backtracking. The player who captures all of the opponent's pieces wins. \n\n###\n\n", "completion": "(game \"Toono\" (players 2) (equipment { (board (add (concentric {1 0 8 8}) edges:{{0 2} {0 4} {0 6} {0 8}}) use:Vertex) (piece \"Marker\" Each (move (from) (to (sites Distance from:(from) (exact 3)) if:(not (\"IsFriendAt\" (to))) (apply (if (\"IsEnemyAt\" (to)) (remove (to)))))))}) (rules (start { (place \"Marker1\" (difference (expand (sites Bottom) steps:2) (expand (sites Top) steps:2))) (place \"Marker2\" (difference (expand (sites Top) steps:2) (expand (sites Bottom) steps:2)))}) (play (forEach Piece)) (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Construct a Ludii game based on the following description\n10x10 board. Each player has one piece and move according to the roll of one die. Representations of snakes and ladders are scattered throughout the board, connecting two spaces. If a player lands at the bottom of the ladder at the end of their move, they advance to the space at the top of the ladder. If a player ends their turn on a space with the head of a snake, they move down to the space with the tail of the snake. The first player to move off the last space of the board wins. \n\n###\n\n", "completion": "(game \"Gyan Chaupar\" (players 4) (equipment { (board (square 10) (track \"Track\" \"0,E,N1,W,N1,E,N1,W,N1,E,N1,W,N1,E,N1,W,N1,E,N1,W\" directed:True)) (piece \"Pawn\" Each (move (from (from) level:(level)) (to (mapEntry (\"NextSiteOnTrack\" (count Pips)))))) (dice num:1) (map { (pair \"B1\" \"C4\") (pair \"D1\" \"G2\") (pair \"H1\" \"J4\") (pair \"A3\" \"B5\") (pair \"E4\" \"D5\") (pair \"H3\" \"D9\") (pair \"J8\" \"J10\") (pair \"A8\" \"A10\") (pair \"J6\" \"G7\") (pair \"B7\" \"C2\") (pair \"G5\" \"F3\") (pair \"E2\" \"F1\") (pair \"D7\" \"A6\") (pair \"C10\" \"C8\") (pair \"H10\" \"H8\") (pair \"E10\" \"E8\") (pair \"G9\" \"D3\") (pair \"H6\" \"E6\") (pair \"I5\" \"J2\")})}) (rules (start (place Stack items:{\"Pawn4\" \"Pawn3\" \"Pawn2\" \"Pawn1\"} coord:\"A1\")) (play (\"RollMove\" (forEach Piece))) (end (\"ReachWin\" (sites {(trackSite EndSite)}) Mover)))) 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 Ludii game based on the following description\nRectangular board, with 32 points along each long side. Lines connect the points opposite each other, as well as a diagonal line connecting each point on the left to the next highest point on the right (e.g., the first left point with the second right point, the second left point with the third right point, an so on). One player plays as the calf, which begins in the bottom right corner. The second player plays as two children, which begin in the bottom left corner and the second point on the right. Players alternate turns moving one of their pieces to an empty adjacent spot on the board along the lines. The children move first, and cannot move backward during the game. The calf can move in any direction. The children win by forcing the calf to move to the top left corner of the board, the calf wins by returning to its starting point after first having left it. \n\n###\n\n", "completion": "(game \"Neg Tugal Tuux\" (players 2) (equipment { (board (add (scale 15 1 (rectangle 32 2)) edges:{ {0 3} {2 5} {4 7} {6 9} {8 11} {10 13} {12 15} {14 17} {16 19} {18 21} {20 23} {22 25} {24 27} {26 29} {28 31} {30 33} {32 35} {34 37} {36 39} {38 41} {40 43} {42 45} {44 47} {46 49} {48 51} {50 53} {52 55} {54 57} {56 59} {58 61} {60 63}}) use:Vertex) (piece \"Cow\" P2 \"StepToEmpty\") (piece \"Human\" P1 (move Step (to if:(and (is Empty (to)) (>= 1 (- (from) (to)))))))}) (rules (start { (place \"Cow2\" 1) (place \"Human1\" (sites {0 3}))}) (play (forEach Piece)) (end { (if (and (is Mover P2) (= 1 (where \"Cow2\" P2))) (result P2 Win)) (if (= 62 (where \"Cow2\" P2)) (result P1 Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nEach player has three pieces. Pieces are initially placed three-in a row on side nearest the player. Pieces can move to an adjacent space connected to it by a line. The goal is to create three in a row through the central space. \n\n###\n\n", "completion": "(game \"Shisima\" (players 2) (equipment { (board (concentric {1 8}) use:Vertex) (piece \"Marker\" Each \"StepToEmpty\")}) (rules (start { (place \"Marker1\" {1 8 7}) (place \"Marker2\" {3 4 5})}) (play (forEach Piece)) (end (if (and (= (what at:(centrePoint)) (mover)) (is Line 3)) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x12, 15, 18, 21, or 24 board. Two counters per hole. Typically played by a team of players, who consult each other about the moves to be made. Sowing occurs most commonly in an anti-clockwise direction, but can be played clockwise if the players agree. Play begins with one player picking up the counters in one of the holes in their row and sowing them, then picking up the counters in the hole following the one in which the last counter was sown, and continuing to sow in this way until there is a pattern of holes with three counters alternating with empty holes. The players then decide who gets to play first. Players sow counters from a hole in their row in the agreed-upon direction. When the final counter lands in an occupied hole, these counters are picked up and sowing continues. When the last counter falls into an empty hole, the sowing ends. If the sowing ends in the player's own row, any counters in the opponent's hole opposite are captured. Once both players are reduced to only single counters in their holes, when a player reaches the end of their row with a counter, it is captured instead of continuing to sow it to the opponent's rows. The player who is the last in possession of counters wins. Each player has 12 holes and sow anti-clockwise.\n\n###\n\n", "completion": "(define \"OnlyOneCounterInEachHole\" (all Sites (sites Board) if:(<= (count at:(site)) 1))) (define \"NoCounters\" (all Sites (sites #1) if:(= 0 (count at:(site))))) (define \"NextHole\" (\"NextSiteOnTrack\" 1 from:#1 \"Track\")) (define \"PlayFromLastHole\" (last To afterConsequence:True)) (define \"Columns\" 12) (game \"Andada\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" store:None (track \"Track\" \"0,E,N,W\" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 2 to:(sites Track))) phases:{ (phase \"Opening\" (play (move Select (from (if (\"SameTurn\") (sites {(\"NextHole\" (\"PlayFromLastHole\"))}) (sites Mover)) if:(> (count at:(from)) 0)) (then (sow (then (if (is Occupied (\"NextHole\" (\"PlayFromLastHole\"))) (moveAgain))))))) (nextPhase (is Mover P2) \"Playing\")) (phase \"Playing\" (play (move Select (from (if (\"SameTurn\") (sites {\"PlayFromLastHole\"}) (sites Mover)) if:(> (count at:(from)) 0)) (then (sow apply:(if (= 1 (count at:(to))) (if (\"OnlyOneCounterInEachHole\") (if (is In (\"NextHole\" (to)) (sites Next)) (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to)))) (if (and (is Occupied (\"OppositePit\" (to))) (is In (to) (sites Mover))) (fromTo (from (\"OppositePit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePit\" (to)))))) (moveAgain)))))) (end (forEach Player if:(\"NoCounters\" Player) (result Player Loss))))})) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"NoEdgeBetweenCells\" (\"NoSites\" (intersection (sites Occupied by:Shared on:Edge) (\"EdgeInCommon\" #1 #2)))) (define \"EdgeInCommon\" (intersection (sites Incident Edge of:Cell at:#1) (sites Incident Edge of:Cell at:#2))) (game \"Maze\" (players 1) (equipment { (board (remove (square 20) cells:{ 0 20 40 60 80 100 120 140 1 21 41 61 81 2 22 42 62 3 23 4 5 6 19 39 59 79 99 119 139 159 18 38 58 78 98 17 37 57 77 16 36 15 14 13})) (piece \"Marker\" Shared) (piece \"Cross\" Neutral) (piece \"Human\" P1 (move Step Orthogonal (to if:(and (is Empty (to)) (\"NoEdgeBetweenCells\" (from) (to)))) (then (add (piece (id \"Cross\" Neutral)) (to (last From)))))) (regions \"Exit\" {5})}) (rules (start { (set Shared Edge (union (sites Outer Edge) (sites {692 693 694 696 672 651 630 589 568 673 653 676 656 657 658 678 719 699 701 702 682 724 684 705 706 727 686 728 709 689 648 607 566 668 611 612 613 614 615 677 634 595 574 575 596 637 553 533 532 552 572 551 530 550 509 489 528 508 467 447 427 386 365 366 364 363 385 405 425 466 387 408 409 410 411 429 449 470 431 472 492 430 432 473 514 453 389 368 348 327 390 474 515 556 597 618 598 639 660 661 662 641 620 621 601 581 561 627 626 625 624 623 646 586 585 565 544 543 542 505 504 463 462 461 460 459 458 457 456 443 402 361 341 279 422 421 420 419 418 417 416 401 400 379 398 183 201 238 319 298 318 277 256 276 317 255 275 316 336 356 376 295 294 314 334 354 313 374 292 291 312 311 271 250 230 212 211 210 228 229 193 174 175 157 138 121 89 74 88 75 61 33 11 34 36 64 49 63 77 91 106 123 159 196 214 122 158 80 94 109 108 124 160 127 163 200 144 143 162 199 161 198 216 234 253 252 522 502 521 582 583 563 479 478 519 498 539 579 558 517 476 435 414 434 475 516 413 351 392 372 371 330 309 289 288 287 286 308 267 227 190 246 245 244 172 171 189 207 153 135 118 102 119 101 85 71 70 69 84 99 116 10 19 32 45 44 58 8 17 29 42 26 27 67 82 114 150 132 131 149 186 148 185 222 242 169 224 264 305 325 284 283 282 303 323 590}))) (place \"Human\" 336)}) (play (forEach Piece)) (end { (if (no Moves Mover) (result Mover Loss)) (if (is In (where (id \"Human\")) (sites \"Exit\")) (result Mover Win))})))\n\n###\n\n", "completion": "The human piece can move to any orthogonal empty cells if the edge belonging to these two cells is empty. After moving a cross is added to the previous cell. The goal is to find the path between the starting point and the door. A lost is encountered in case of no legal moves. The board in Cross+A. END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game starts with 3 discs for the second player. -> The game starts with 4 discs for the second player.\n(game \"Kaooa\" (players 2) (equipment { (\"StarBoard\" 5) (hand Each) (piece \"Marker\" P1 (or (\"HopSequenceCapture\") \"StepToEmpty\")) (piece \"Marker\" P2 \"StepToEmpty\")}) (rules (start { (place \"Marker1\" (handSite P1) count:1) (place \"Marker2\" (handSite P2) count:3)}) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (\"PhaseMovePiece\" \"Movement\" (end (\"NoMoves\" Loss)))}))\n\n###\n\n", "completion": "(game \"Kaooa\" (players 2) (equipment { (\"StarBoard\" 5) (hand Each) (piece \"Marker\" P1 (or (\"HopSequenceCapture\") \"StepToEmpty\")) (piece \"Marker\" P2 \"StepToEmpty\")}) (rules (start { (place \"Marker1\" (handSite P1) count:1) (place \"Marker2\" (handSite P2) count:4)}) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (\"PhaseMovePiece\" \"Movement\" (end (\"NoMoves\" Loss)))})) END" }, { "prompt": "Construct a Ludii game based on the following description\nGoal: Simultaneously create two or more rows of exactly four stones of your color.\n \n Play: White starts by placing a white stone at an empty cell. Players then take turns placing two stones of their color at empty cells, one stone after another.\n \n In each placement, players are not allowed to create a single\n 4-in-a-row of their color, unless that placement simultaneously\n creates at least one other 4-in-a-row of their color to win the game.\n \n This means that players may NOT make a single 4-in-a-row of their color on the first placement of their turn even if they can make a second 4-in-a-row on their second placement.\n \n In no event are players allowed to create 5 (or more) -in-a-row of their color.\n \n The first player to make simultaneous 4-in-a-rows of their color wins immediately, whether it was their first or second placement. The game is played on a 13x13 board.\n\n###\n\n", "completion": "(define \"NumSimultaneousFourInARow\" (+ { (if (\"FourInARow\" N) 1 0) (if (\"FourInARow\" NE) 1 0) (if (\"FourInARow\" E) 1 0) (if (\"FourInARow\" SE) 1 0)})) (define \"FourInARow\" (is Line 4 #1 exact:True)) (define \"MoreThan4InARow\" (is Line 5)) (game \"Yavalax\" (players 2) (equipment { (board (square 13)) (piece \"Marker\" Each)}) (rules phases:{ (phase \"Opening\" (play (move Add (to (sites Empty)))) (nextPhase \"General\")) (phase \"General\" (play (do (move Add (to (sites Empty)) (then (if (\"NewTurn\") (moveAgain)))) ifAfterwards:(and (not (\"MoreThan4InARow\")) (!= 1 (\"NumSimultaneousFourInARow\"))))))} (end (if (<= 2 (\"NumSimultaneousFourInARow\")) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nStructure of Play:\n There is no passing.\n Maroon chooses to remove up to two nodes of the board before passing to White. \n Then White places an initial stone onto a remaining node on the board.\n \n After this play alternates, two turns per player, until one player cannot complete both turns. That player loses\n \n On each of the turns, the current player must either:\n - - place a stone on an empty node that the opponent does not control, or\n - - remove an opponent's stone that the current player controls.\n \n A player controls a node and any stone on it when the count of his stones in line-of-sight of the node, exceed those of his opponent by the node-control value chosen for the game, or more. (default is 3)\n \n ('in line-of-site of the node' refers to the first stone in each radial grid direction.) \n \n There are options for the board size and type, and the number of surplus stones needed to control a node. Order 2 board Hex N/N+2 grid w/even nodes, no center Strategic. Control a site with a surplus of 3 on lines of sight.\n\n###\n\n", "completion": "(define \"ColourBackground\" (colour 135 170 130)) (define \"SquareDiagonal\" (board (square 4) use:Vertex)) (define \"SquareGrid\" (board (square 4) use:Vertex)) (define \"Hex2Limp\" (board (dual (hex (/ 4 2) (+ 2 (/ 4 2)))) use:Vertex)) (define \"BoardUsed\" \"Hex2Limp\") (define \"LoSDirection\" Orthogonal) (define \"MoveTwiceThenScore\" (if (is Prev Next) (moveAgain) (and (\"ScoreFor\" Mover) (\"ScoreFor\" Next)))) (define \"IsControlledBy\" (<= (+ 3 (count Pieces in:(difference (sites LineOfSight Piece at:#2 \"LoSDirection\") (sites Occupied by:Neutral)))) (* 2 (count Pieces #1 in:(sites LineOfSight Piece at:#2 \"LoSDirection\"))))) (define \"ScoreFor\" (set Score #1 (+ (results from:(forEach (difference (difference (sites Board) (sites Occupied by:#1)) (sites Occupied by:Neutral)) if:(\"IsControlledBy\" #1 (site))) to:(from) (if (is Empty (to)) 1 2))))) (game \"Double-Move Situ\" (players 2) (equipment { \"BoardUsed\" (piece \"Counter\" P1) (piece \"Counter\" P2) (piece \"X\" Neutral) (piece \"Counter\" Neutral)}) (rules (meta (passEnd NoEnd)) (play (if (and (= -1 (var \"DoubleTurnPhase\")) (= 1 (mover))) (or (move Pass) (move Add (piece \"X0\") (to (sites Empty)) (then (if (> 2 (count Pieces in:(sites Occupied by:Neutral))) (moveAgain))))) (or { (move Add (to (sites Empty) if:(not (\"IsControlledBy\" Next (to)))) (then (if (= -1 (var \"DoubleTurnPhase\")) (set Var \"DoubleTurnPhase\" 1) (\"MoveTwiceThenScore\")))) (move Remove (forEach (sites Occupied by:Next) if:(\"IsControlledBy\" Mover (site))) (then (\"MoveTwiceThenScore\")))}) (then (if (no Moves Next) (and (\"ScoreFor\" Mover) (\"ScoreFor\" Next)))))) (end (if (no Moves Mover) (result Mover Loss))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x12 board, divided in half. Spaces on each side take the form of points. Fifteen pieces per player. Three 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. One player begins with all of their pieces on the space furthest to the left on their side, the other with their pieces on the point directly opposite it. Pieces move in opposite directions around the board, only on the left half of the board where the pieces begin, toward the point where the opponent's pieces begin, and bearing off the board from there. A player cannot have two of their pieces on the same spot in the starting quadrant. When a piece lands on the same space as an opponent's piece, the opponent's piece is sent back to where it began. The first person to bear off all their pieces wins. \n\n###\n\n", "completion": "(define \"CanEscape\" (\"IsOffBoard\" #1)) (define \"AllPieceEscaped\" (no Pieces Mover)) (define \"NotEnemyOrOnlyOne\" (or (and (\"IsEnemyAt\" (to)) (\"IsSingletonStack\" (to))) (and (if (not (is In (to) (sites Mover))) True (is Empty (to))) (not (\"IsEnemyAt\" (to)))))) (define \"Bar\" (mapEntry (mover))) (define \"RemoveAPiece\" (move Remove (site))) (define \"NextSiteFromDist6\" (\"NextSiteOnTrack\" 6 from:#1)) (define \"NextSiteFrom\" (\"NextSiteOnTrack\" (pips) from:#1)) (game \"Ludus Lombardorum\" (players 2) (equipment { (\"BackgammonBoard\" { (track \"Track1\" {6 0..5 18..12} P1 directed:True) (track \"Track2\" {19 12..18 5..0} P2 directed:True)}) (dice num:3) (map {(pair 1 19) (pair 2 6)}) (piece \"Disc\" Each) (regions P1 { 0..5}) (regions P2 { 13..18})}) (rules (start { (place Stack \"Disc1\" 0 count:15) (place Stack \"Disc2\" 13 count:15)}) (play (\"RollEachNewTurnMove\" (forEach Die if:(\"DieNotUsed\") (forEach Site (sites Occupied by:Mover) (if (\"CanEscape\" (\"NextSiteFrom\" (site))) (\"RemoveAPiece\") (move (from (site)) (to (\"NextSiteFrom\" (site)) if:(\"NotEnemyOrOnlyOne\") (\"HittingCapture\" (\"Bar\")))))) (then (\"ReplayNotAllDiceUsed\"))))) (end (if (\"AllPieceEscaped\") (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nFirst, the giant takes place on one of the top sites. Centre site in the opening move for the giant is not allowed. In any subsequent moves, the giant is allowed to enter the centre.\n \n The Giant piece can step to an empty site, the dwarves can step only forward to the top of the board.\n \n The giant wins if it reaches the bottom sites and the dwarves win if they block the giant to move. The rules of the game I.\n\n###\n\n", "completion": "(game \"Ratio\" (players {(player S) (player N)}) (equipment { (board (add (remove (merge { (rectangle 3 3 diagonals:Alternating) (shift 0 2 (wedge 2)) (shift 0 -1 (rotate 180 (wedge 2)))}) vertices:{3 5 1}) edges:{{0 3} {1 5} {2 7} {0 1}}) use:Vertex) (piece \"Foot\" P1 (move Step Adjacent (to if:(and (if (= 1 (count Turns)) (!= (centrePoint) (to)) True) (is Empty (to)))))) (piece \"Gnome\" P2 (move Step (directions {Forwards Rightward Leftward}) (to if:(is Empty (to))))) (hand P1) (regions \"Home\" P2 (intersection (sites Outer) (expand (sites Bottom)))) (regions \"Home\" P1 (sites Top))}) (rules (start { (place \"Gnome2\" (intersection (sites Outer) (expand (sites Bottom)))) (place \"Foot1\" (handSite P1))}) phases:{ (phase \"Opening\" (play (move (from (handSite Mover)) (to (expand (sites Top))) (then (moveAgain)))) (nextPhase \"Main\")) (phase \"Main\" (play (forEach Piece)))} (end { (if (no Moves P1) (result P2 Win)) (if (is In (where \"Foot\" P1) (sites P2)) (result P1 Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\n4x12 board. Twelve pieces per player, which begin one in each space in the row closest to the player. Six stick dice, green on one side and white on the other. The value of the throws equals the number of green faces, with the following exceptions: four green faces up allows a piece to be moved for the first time and a move of 1, plus another throw is granted; six white faces = 4 plus another throw; six green = 6 plus another throw; five white faces = move 5 plus another throw. Pieces move from right to left in the player's home row, then into the second row, moving left to right, then into the third row moving right to left, and then into the opponent's home row moving left to right, then back into the third row moving right to left, to the second row moving left to right, and then back into the player's home row moving right to left. If a player's piece lands on a space occupied by one of the opponent's pieces, the opponent's piece is captured. The player who captures all of the opponent's pieces wins. \n\n###\n\n", "completion": "(define \"AllowToReplay\" (and (is In (\"ThrowValue\") (sites {1 4 6 5})) (!= 5 (count Pips)))) (define \"AllowToActivate\" (= (\"ThrowValue\") 1)) (define \"InactivePiece\" (= (state at:(from)) 1)) (define \"ActivatedPiece\" (= (state at:(from)) 0)) (define \"ActivatePiece\" (set State at:(last To) 0)) (define \"ThrowValue\" (mapEntry (count Pips))) (game \"Issiren\" (players 2) (equipment { (board (rectangle 4 12) { (track \"Track1\" \"11,W,N1,E,N1,W,N1,E,S1,W,S1,E\" loop:True P1) (track \"Track2\" \"36,E,S1,W,S1,E,S1,W,N1,E,N1,W\" loop:True P2)}) (\"StickDice\" 6) (piece \"Marker\" Each (move (from (from) if:(if (\"ActivatedPiece\") True (\"AllowToActivate\"))) (to (\"NextSiteOnTrack\" (\"ThrowValue\")) if:(not (\"IsFriendAt\" (to))) (apply (if (\"IsEnemyAt\" (to)) (remove (to))))) (then (if (= 1 (state at:(last To))) (\"ActivatePiece\"))))) (map {(pair 0 4) (pair 1 5) (pair 2 2) (pair 3 3) (pair 4 1) (pair 5 5) (pair 6 6)})}) (rules (start { (place \"Marker1\" (sites Bottom) state:1) (place \"Marker2\" (sites Top) state:1)}) (play (\"RollMove\" (forEach Piece) (then (if (\"AllowToReplay\") (moveAgain))))) (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nEach player in turn places one of his marbles in an open space on the board, on top of a square (i.e. 4 marbles next to each other). After the placement of each marble, check to see if a square or marbles have been formed. If at least 3 of the 4 marbles that form a square are of the same color, a piece of that color go on top of that square. If as a result other squares are formed, the same rule is applied. The winner is the first player to have at least 27 marbles of his colour on the board.\n \n \n\n###\n\n", "completion": "(define \"PutOnTop\" (while (\"APieceCanGoOnTop\") (forEach Site (sites Board) (and (\"AddOnTopSquareIfLegal\" P1) (\"AddOnTopSquareIfLegal\" P2))))) (define \"APieceCanGoOnTop\" (not (all Sites (sites Board) if:(not (can Move (or (\"AddOnTopSquareIfLegal\" P1) (\"AddOnTopSquareIfLegal\" P2))))))) (define \"AddOnTopSquareIfLegal\" (and { (if (and (\"TopExistAndEmptySite\" UNE) (\"PossibleSquareFromBottomLeft\")) (if (\"EnoughOwnedInSquare\" #1 \"SquareFromBottomLeft\") (\"AddOnTopSquare\" #1 UNE))) (if (and (\"TopExistAndEmptySite\" USE) (\"PossibleSquareFromTopLeft\")) (if (\"EnoughOwnedInSquare\" #1 \"SquareFromTopLeft\") (\"AddOnTopSquare\" #1 USE))) (if (and (\"TopExistAndEmptySite\" USW) (\"PossibleSquareFromTopRight\")) (if (\"EnoughOwnedInSquare\" #1 \"SquareFromTopRight\") (\"AddOnTopSquare\" #1 USW))) (if (and (\"TopExistAndEmptySite\" UNE) (\"PossibleSquareFromBottomRight\")) (if (\"EnoughOwnedInSquare\" #1 \"SquareFromBottomRight\") (\"AddOnTopSquare\" #1 UNE)))})) (define \"TopExistAndEmptySite\" (and (is Occupied (site)) (is Empty (ahead (site) #1)))) (define \"AddOnTopSquare\" (add (piece (id \"Ball\" #1)) (to (ahead (site) #2) if:(is Flat)))) (define \"EnoughOwnedInSquare\" (and (= 0 (count Sites in:(intersection (sites Empty) (#2)))) (<= 3 (count Sites in:(intersection (sites Occupied by:#1) (#2)))))) (define \"SquareFromBottomRight\" (\"SquareFrom\" N W)) (define \"PossibleSquareFromBottomRight\" (\"PossibleSquareFrom\" N W)) (define \"SquareFromTopRight\" (\"SquareFrom\" S W)) (define \"PossibleSquareFromTopRight\" (\"PossibleSquareFrom\" S W)) (define \"SquareFromTopLeft\" (\"SquareFrom\" S E)) (define \"PossibleSquareFromTopLeft\" (\"PossibleSquareFrom\" S E)) (define \"SquareFromBottomLeft\" (\"SquareFrom\" N E)) (define \"PossibleSquareFromBottomLeft\" (\"PossibleSquareFrom\" N E)) (define \"SquareFrom\" (sites {(site) (ahead (site) #1) (ahead (site) #2) (ahead (ahead (site) #1) #2)})) (define \"PossibleSquareFrom\" (and (!= (site) (ahead (site) #1)) (!= (site) (ahead (site) #2)))) (game \"Upper Hand\" (players 2) (equipment { (board (square 5 pyramidal:True) use:Vertex) (piece \"Ball\" Each) (piece \"Ball\" Neutral)}) (rules (start (place \"Ball0\" (centrePoint))) (play (move Add (to (sites Empty) if:(is Flat)) (then (\"PutOnTop\")))) (end (if (<= 27 (count Sites in:(sites Occupied by:Mover))) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe board has two rows of six play pits with a larger scoring pit on either end. Play begins with four seeds in each hole, with one or two seeds moved to make the initial position fair, i.e. two perfect players will draw. Each player controls the row nearest them. Play consists of choosing one of the player's non-empty play pits, removing the pieces from it, and sowing the pieces one per pit consecutively in a counterclockwise pattern including the player's own scoring pit but not the opponent's. If the last piece is placed in a player's empty pit, that piece and any opposite are captured and put in the player's scoring pit. If the last seed falls in the scoring pit, the player gets another turn. When one player has no pieces in any of their play pits, the game ends. The other player captures all of the other pieces, and the player with the most scored pieces wins. FairKalah board 1\n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (+ (count at:(mapEntry #1)) (count in:(sites #1)))) (define \"Columns\" 6) (game \"FairKalah\" (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 at:1) (set Count 4 at:2) (set Count 5 at:3) (set Count 4 at:4) (set Count 3 at:5) (set Count 4 at:6) (set Count 0 at:13) (set Count 4 at:12) (set Count 4 at:11) (set Count 4 at:10) (set Count 4 at:9) (set Count 4 at:8) (set Count 4 at:7) (set Count 0 at:0)}) (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\" (or (= (count in:(sites Bottom)) 0) (= (count in:(sites Top)) 0)))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe rules are identical to Breakthrough except that if a player can move any of their pieces one step directly backwards to an empty cell then they must.\n If there is more than one such backward move available then the player chooses which one to make. The board is tiling by square. The game is played on a 8x8 board.\n\n###\n\n", "completion": "(define \"ReachedTarget\" (is In (last To) (sites Mover))) (game \"Breakback\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (piece \"Pawn\" Each (or { \"StepForwardToEmpty\" (move Step (directions {FR FL}) (to if:(or (is Empty (to)) (\"IsEnemyAt\" (to))) (apply (remove (to)))))})) (regions P1 (sites Top)) (regions P2 (sites Bottom))}) (rules (start { (place \"Pawn1\" (expand (sites Bottom))) (place \"Pawn2\" (expand (sites Top)))}) (play (priority (forEach Piece (\"StepBackwardToEmpty\")) (forEach Piece))) (end (if \"ReachedTarget\" (result Mover Win))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game is playing with two players. -> The game is playing with three players.\n(define \"ReverseBoundedPieces\" (custodial (from (site)) (between if:(is Enemy (state at:(between))) (apply (allCombinations (add (piece \"Ball0\" state:(mover)) (to (site))) (set State at:(between) (mover))))) (to if:(is Friend (state at:(to)))))) (game \"Rolit\" (players 2) (equipment { (board (square 8)) (piece \"Ball\" Neutral)}) (rules (start { (place \"Ball0\" coord:\"D5\" state:1) (place \"Ball0\" coord:\"E5\" state:2) (place \"Ball0\" coord:\"E4\" state:3) (place \"Ball0\" coord:\"D4\" state:4)}) (play (priority (forEach Site (sites Empty) (append \"ReverseBoundedPieces\")) (move Add (piece \"Ball0\" state:(mover)) (to (sites Around (sites Occupied by:Neutral) Empty))) (then (forEach Player (set Score Player (count Sites in:(sites State (player)))))))) (end (if (all Passed) (byScore)))))\n\n###\n\n", "completion": "(define \"ReverseBoundedPieces\" (custodial (from (site)) (between if:(is Enemy (state at:(between))) (apply (allCombinations (add (piece \"Ball0\" state:(mover)) (to (site))) (set State at:(between) (mover))))) (to if:(is Friend (state at:(to)))))) (game \"Rolit\" (players 3) (equipment { (board (square 8)) (piece \"Ball\" Neutral)}) (rules (start { (place \"Ball0\" coord:\"D5\" state:1) (place \"Ball0\" coord:\"E5\" state:2) (place \"Ball0\" coord:\"E4\" state:3) (place \"Ball0\" coord:\"D4\" state:4)}) (play (priority (forEach Site (sites Empty) (append \"ReverseBoundedPieces\")) (move Add (piece \"Ball0\" state:(mover)) (to (sites Around (sites Occupied by:Neutral) Empty))) (then (forEach Player (set Score Player (count Sites in:(sites State (player)))))))) (end (if (all Passed) (byScore))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nTriangle, with a line from the apex bisecting the base, and a line bisecting this one and the opposite sides. Three pieces per player. Players alternate turns placing a piece on one of the empty points on the board. When all of the pieces have been placed, players alternate turns moving any one of their pieces to the empty point on the board. The first player to make a line of three wins. \n\n###\n\n", "completion": "(game \"Tsoro Yemutatu (Triangle)\" (players 2) (equipment { (board (scale 1 2 (wedge 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\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\nSome of the squares created by the dots have numbers. The goal is to connect dots vertically or horizontally so that they form a continuous loop. The numbers indicate the number of sides in that box which are parts of the loop. \n\n###\n\n", "completion": "(game \"Slitherlink\" (players 1) (equipment { (board (rectangle 8 8) (values Edge (range 0 1)) use:Edge) (hints { (hint {0} 3) (hint {2} 3) (hint {4} 0) (hint {5} 2) (hint {14} 3) (hint {15} 1) (hint {17} 2) (hint {21} 3) (hint {22} 0) (hint {26} 3) (hint {27} 0) (hint {31} 3) (hint {33} 3) (hint {34} 1) (hint {43} 0) (hint {44} 2) (hint {46} 1) (hint {48} 3)} Cell)}) (rules (play (satisfy { (forAll Cell (or (= (hint Cell at:(from)) Off) (is Count Edge (sites Incident Edge of:Cell at:(from)) (hint Cell at:(from))))) (forAll Vertex (or (is Count Edge (sites Incident Edge of:Vertex at:(from)) 0) (is Count Edge (sites Incident Edge of:Vertex at:(from)) 2))) (< (count Groups Edge) 2)})) (end (if (is Solved) (result P1 Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n8x8 board. Twelve pieces per player. Pieces begin on the dark spaces. White plays first. Players alternate turns moving their pieces diagonally one space forward to an empty space. A piece may capture an opponent's piece by hopping over it to an empty space on the opposite side of the opponent's piece, in a forward direction only. When pieces are captured, they are placed underneath the piece making the capture, forming a stack, controlled by the player whose piece is on top, the \\ \n\n###\n\n", "completion": "(define \"IsUnpromoted\" (\"IsPieceAt\" \"Counter\" Mover (last To) level:(topLevel at:(last To)))) (define \"HopDistance\" (\"HopStackEnemyCaptureTopDistance\" (from) #1 (then (\"ReplayIfCanMove\" (hop (from (last To)) #1 (between before:(count Rows) after:(count Rows) if:(and (not (is In (between) (last Between))) (\"IsEnemyAt\" (between))) (apply (fromTo (from (between)) (to)))) (to if:(and (is In (from) (sites Occupied by:Mover)) (is Empty (to)))) stack:True))))) (define \"Hop\" (\"HopStackEnemyCaptureTop\" (from) #1 (then (\"ReplayIfCanMove\" (\"HopStackEnemyCaptureTop\" (from (last To)) #1))))) (game \"Bashni\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (piece \"Counter\" Each) (piece \"CounterStar\" Each) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (\"BlackCellsSetup\" 3) (play (if \"SameTurn\" (if \"IsUnpromoted\" (\"HopStackEnemyCaptureTop\" (from (last To)) (directions {FR FL}) (then (\"PromoteIfReach\" (sites Next) \"CounterStar\" (\"ReplayIfCanMove\" (\"HopStackEnemyCaptureTop\" (from (last To)) (directions {FR FL})))))) (move Hop (from (last To)) Diagonal (between before:(count Rows) after:(count Rows) if:(and (not (is In (between) (last Between))) (\"IsEnemyAt\" (between))) (apply (fromTo (from (between)) (to)))) (to if:(and (is In (from) (sites Occupied by:Mover)) (is Empty (to)))) stack:True (then (\"ReplayIfCanMove\" (hop (from (last To)) Diagonal (between before:(count Rows) after:(count Rows) if:(and (not (is In (between) (last Between))) (\"IsEnemyAt\" (between))) (apply (fromTo (from (between)) (to)))) (to if:(and (is In (from) (sites Occupied by:Mover)) (is Empty (to)))) stack:True))))) (priority { (or { (forEach Piece \"Counter\" (\"Hop\" (directions {FR FL})) top:True (then (\"PromoteIfReach\" (sites Next) \"CounterStar\"))) (forEach Piece \"CounterStar\" (\"HopDistance\" Diagonal) top:True)}) (or { (forEach Piece \"Counter\" (\"StepStackToEmpty\" (directions {FR FL})) top:True (then (\"PromoteIfReach\" (sites Next) \"CounterStar\"))) (forEach Piece \"CounterStar\" (move Slide Diagonal stack:True) top:True)})}))) (end (\"BlockWin\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\nGoal: Score the most points: \n -- One point for each stone in one's largest group.\n -- Bonus points are also added to the scores according to the selected option.\n \n The board starts empty. \n \n Players take turns in alternation, placing one of their own stones onto an empty site. \n \n Restriction on placement:\n Every site of the board must remain connected to an empty perimeter site via a continuous path of empty sites.\n \n There is no passing. \n \n The game ends when no more placements can be made. \n \n Players score one point for every stone in their largest group, then, if applicable, score bonus points according to the selected option.\n \n Bonus Options are:\n -- Count of one's own groups. Standard\n -- Count of the opponent's groups\n -- No Bonus\n \n The player with the higher score wins. \n \n If the scores are tied, the game is decided by the tiebreaker option used: \n A: Cascading largest group LOSES -- i.e. negative scores -- This excludes tied pairs; If all groups are paired, last to place. \n B: Last player to have placed a stone. Order 5 board - about 20 moves each Hex N / N-1 Grid, about 20% less moves Scoring Option: Score the size of your largest group, then score an additional point for every group you have on the board. Tiebreaker is largest group (excluding tied pairs) LOSES. If all are paired, last placement wins.\n\n###\n\n", "completion": "(define \"ColourBackground\" (colour 126 130 156)) (define \"TriSquare\" (board (tiling T33434 (- 5 2)) use:Vertex)) (define \"HexCell\" (board (hex Hexagon 5) use:Cell)) (define \"Hex2Limp\" (board (hex (- 5 1) (+ 5 1)) use:Cell)) (define \"HexLimp\" (board (hex Limping (- 5 1)) use:Cell)) (define \"BoardUsed\" \"HexLimp\") (define \"ConnectionDirection\" Orthogonal) (define \"ScoreConnectionDirection\" Orthogonal) (define \"AllHave1Connection2Edge\" (all Sites #1 if:(or (and (is Empty (site)) (is In (site) (sites Outer))) (!= Infinity (count Steps (step \"ConnectionDirection\" (to if:(is Empty (to)))) (site) (difference (sites Outer) (site))))))) (define \"CascadeTiebreaker\" (if (= (var \"MoverScore\") (var \"NextScore\")) (and (set Score Mover (* -1 (\"CascadeScore\" Mover Next))) (set Score Next (* -1 (\"CascadeScore\" Next Mover)))) (\"NoTiebreaker\"))) (define \"NoTiebreaker\" (and (set Score Mover (var \"MoverScore\")) (set Score Next (var \"NextScore\")))) (define \"CascadeScore\" (max 0 (max (difference (sizes Group \"ScoreConnectionDirection\" #1) (sizes Group \"ScoreConnectionDirection\" #2))))) (define \"BonusOpponent\" (set Var \"MoverScore\" (+ (\"GroupCount\" Mover) (count Groups \"ScoreConnectionDirection\" if:(= (who at:(to)) (next)))) (then (set Var \"NextScore\" (+ (\"GroupCount\" Next) (count Groups \"ScoreConnectionDirection\" if:(= (who at:(to)) (mover)))) (then (\"CascadeTiebreaker\")))))) (define \"BonusMover\" (set Var \"MoverScore\" (+ (\"GroupCount\" Mover) (count Groups \"ScoreConnectionDirection\" if:(= (who at:(to)) (mover)))) (then (set Var \"NextScore\" (+ (\"GroupCount\" Next) (count Groups \"ScoreConnectionDirection\" if:(= (who at:(to)) (next)))) (then (\"CascadeTiebreaker\")))))) (define \"GroupScore\" (set Var \"MoverScore\" (\"GroupCount\" Mover) (then (set Var \"NextScore\" (\"GroupCount\" Next) (then (\"CascadeTiebreaker\")))))) (define \"GroupCount\" (max 0 (max (sizes Group \"ScoreConnectionDirection\" #1)))) (game \"Brain Coral\" (players 2) (equipment { \"BoardUsed\" (piece \"Ball\" Each) (piece \"Disc\" Each)}) (rules (start (set Score Each 0)) (play (do (move Add (to (sites Empty))) ifAfterwards:(\"AllHave1Connection2Edge\" (sites Around (last To) \"ConnectionDirection\" includeSelf:True)) (then \"BonusMover\"))) (end (if (no Moves Next) { (if (= (score Mover) (score Next)) (result Mover Win)) (if (!= (score Mover) (score Next)) (byScore))})))) END" }, { "prompt": "Construct a Ludii game based on the following description\n4x7 board, using only the outer two rows. Three counters in each hole. Sowing occurs in an anticlockwise direction. The first player takes the counters out of their leftmost hole and sows them. Instead of each player owning a row of holes, they own the series of holes which currently contain their counters. Players always sow from the rearmost of their holes. When the frontmost two holes of a player's sequence contain one counter each, the player gets another turn. When a player sows into the rear holes of the opponent, the player takes ownership of those holes. When one player is reduced to one counter, they jump to the nearest corner hole in the direction of play, and continue jumping from corner to corner until they capture counters belonging to the opponent, at which point they revert to the normal playing style. The first player to capture all their opponent's pieces wins. \n\n###\n\n", "completion": "(define \"NextHoleFrom\" (\"NextSiteOnTrack\" #3 from:#1 #2)) (define \"LeftMost\" (trackSite FirstSite from:(trackSite FirstSite if:(not (is Mover (who at:(to))))) if:(is Mover (who at:(to))))) (game \"Ngulungu\" (players 2) (equipment { (mancalaBoard 4 7 store:None { (track \"Track\" \"0,E,27,W\" loop:True) (track \"TrackCorner\" \"0,6,27,21\" loop:True) (track \"ReverseTrack\" \"6,W,21,E\" loop:True)}) (piece \"Seed\" Each)}) (rules (start { (place \"Seed1\" (sites Bottom) counts:{3}) (place \"Seed2\" (sites Top) counts:{3})}) (play (if (and (all Sites (sites Occupied by:Mover) if:(is In (sites Corners))) (= 1 (count Pieces Mover))) (move (from (\"LeftMost\")) (to (trackSite FirstSite \"TrackCorner\" from:(from) if:(\"IsEnemyAt\" (to))) (apply (and (remove (to) count:(count at:(to))) (add (piece (id \"Seed\" Mover)) (to (to)) count:(count at:(to))))))) (move Select (from (\"LeftMost\")) (then (sow 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 (and (= 1 (count at:(\"NextHoleFrom\" (to) \"ReverseTrack\" 1))) (= 1 (count at:(to)))) (moveAgain))))))) (end (forEach NonMover if:(no Pieces Player) (result Player Loss))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nIn Chessence, kings do not move and must remain fixed on their starting squares the entire game. (Thus, a king is unable to move out of check.) \n \n A man has capability to move based on its relative position to other friendly men on the board, as follows:\n - If a man is orthogonally adjacent to a friendly man, then both have the ability to move as a rook in chess.\n - If a man is diagonally adjacent to a friendly man, then both have the ability to move as a chess bishop.\n - If a man is a knight's move away from a friendly man, then both have the ability to move as a knight.\n \n A man with more than one position relationship has the ability to move in more than one way. Likewise, if a man has no position relationship defined above, that man cannot move. The king has no bearing on how the other men may move.\n \n A man may not move to, nor through, a non-existent (blackened-out) square; except that a man moving as a knight may jump over a non-existent square. For a turn, a player may move a man on the board, or alternatively, they may put one of their reserve men in play by placing it on any of their six initial starting squares that are currently open.\n \n Checks, checkmate, and captures are as in standard chess. If a player has no legal moves, they lose the game. \n\n###\n\n", "completion": "(define \"CaptureToPiece\" (apply if:(not (is In (to) (sites \"BlackenedSquares\"))) (if (\"IsEnemyAt\" (to)) (remove (to))))) (game \"Chessence\" (players 2) (equipment { (board (rectangle 9 6)) (piece \"Pawn\" Each (or { (if (not (all Sites (sites Around (from) Orthogonal) if:(not (\"IsPieceAt\" \"Pawn\" Mover (site))))) (move Slide Orthogonal (between if:(and (is Empty (between)) (not (is In (between) (sites \"BlackenedSquares\"))))) (to if:(\"IsEnemyAt\" (to)) \"CaptureToPiece\"))) (if (not (all Sites (sites Around (from) Diagonal) if:(not (\"IsPieceAt\" \"Pawn\" Mover (site))))) (move Slide Diagonal (between if:(and (is Empty (between)) (not (is In (between) (sites \"BlackenedSquares\"))))) (to if:(\"IsEnemyAt\" (to)) \"CaptureToPiece\"))) (if (not (all Sites (forEach (sites Around (sites To (hop Orthogonal (between if:True) (to if:True))) Orthogonal) if:(= 2 (count Steps (from) (site)))) if:(!= (what at:(site)) (id \"Pawn\" Mover)))) (move Leap \"KnightWalk\" (to if:(and (not (\"IsFriendAt\" (to))) (not (is In (to) (sites \"BlackenedSquares\")))) \"CaptureToPiece\")))})) (piece \"King\" Each) (hand Each) (regions \"BlackenedSquares\" (sites {\"A2\" \"B3\" \"B5\" \"C6\" \"D4\" \"E5\" \"E7\" \"F8\"})) (regions \"PawnStart\" P1 (sites {\"E1\" \"E2\" \"F2\" \"D2\" \"D3\" \"E3\"})) (regions \"PawnStart\" P2 (sites {\"B9\" \"B8\" \"A8\" \"C8\" \"C7\" \"B7\"}))}) (rules (start { (place \"Pawn\" \"Hand\" count:3) (place \"Pawn1\" (sites P1 \"PawnStart\")) (place \"Pawn2\" (sites P2 \"PawnStart\")) (place \"King1\" coord:\"F1\") (place \"King2\" coord:\"A9\")}) (play (or (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King\" Mover))) (if (is Occupied (handSite Mover)) (move (from (sites Hand)) (to (sites Mover \"PawnStart\") if:(is Empty (to))))))) (end { (\"Checkmate\" \"King\") (if (no Moves Mover) (result Mover Loss))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe game starts with the board empty. Order plays first, then turns alternate. On each turn, a player places either an X or an O on any open square. Order aims to get five like pieces in a row either vertically, horizontally, or diagonally. Chaos aims to fill the board without completion of a line of five like pieces. \n\n###\n\n", "completion": "(game \"Order and Chaos\" (players 2) (equipment { (board (square 6)) (piece \"Disc\" Shared) (piece \"Cross\" Shared) (hand Shared size:2)}) (rules (start { (place \"Disc\" (handSite Shared)) (place \"Cross\" (handSite Shared 1))}) (play (move (from (sites Hand Shared)) (to (sites Empty)) copy:True)) (end { (if (is Line 5) (result P1 Win)) (if (no Moves Next) (result P2 Win))}))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"Djara-Badakh\" (players 2) (equipment { (board (square 3) use:Vertex) (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 Mover (\"HandEmpty\" Mover) \"Movement\")) (\"PhaseMovePiece\" \"Movement\")} (end (\"Line3Win\"))))\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. When all of the pieces are placed, players alternate turns moving a piece to an empty adjacent spot. The first player to place their three pieces along one of the lines wins. END" }, { "prompt": "Construct a Ludii game based on the following description\nConnect 4 is played on a vertically placed grid of 7x6, where colored disks are dropped from the top of the grid. Players alternate dropping discs, which fall to the bottom of the column in which they are dropped. The first player to create a row of four disks in their color wins. \n\n###\n\n", "completion": "(define \"Drop\" (slide (from (last To)) S (between (exact \"Distance\")))) (define \"Distance\" (count Sites in:(intersection (sites Empty) \"LastColumn\"))) (define \"LastColumn\" (sites Column (column of:(last To)))) (define \"EmptyTop\" (intersection (sites Top) (sites Empty))) (define \"ColumnSize\" 6) (game \"Connect Four\" (players 2) (equipment { (board (rectangle 1 7)) (piece \"Disc\" Each)}) (rules (play (move Add (to (forEach (sites Board) if:(< (size Stack at:(site)) \"ColumnSize\"))) stack:True)) (end (if (is Line 4 byLevel:True) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nBoard with 5x5 lines, diagonals drawn in the four quadrants of the board, and a triangle at the top, connecting the apex with the three central points at the top edge, and a line perpendicularly bisecting the height of the triangle. One player plays as the general, placed in the central position. The other player plays with sixteen pieces, arranged on the perimeter points of the square. Pieces move one spot along the lines on the board. The general may capture pieces when it moves into a space that is surrounded on two opposite sides, along the lines on the board, thus capturing the pieces on either side of it. Conversely, the general can be captured by surrounding it on two opposite sides with pieces. Only the general may enter the triangle. The goal of the general is to capture all of the opponent's pieces, the goal of the person playing with sixteen pieces is to capture the general. If the general becomes trapped in the triangle, the opponent wins. \n\n###\n\n", "completion": "(game \"Shi Liu Kan Tsiang Kun\" (players 2) (equipment { (board (merge (scale 2 (square 5 diagonals:Alternating)) (shift 2 8 (rotate 180 (wedge 3)))) use:Vertex) (piece \"General\" P1 (\"StepToEmpty\" ~ (then (\"InterveneCapture\")))) (piece \"Marker\" P2 (move Step (to if:(and (not (is In (to) (expand (sites Top)))) (is Empty (to)))) (then (\"CustodialCapture\"))))}) (rules (start { (place \"General1\" (ahead (centrePoint) S)) (place \"Marker2\" (difference (sites Outer) (expand (sites Top))))}) (play (forEach Piece)) (end { (if (no Pieces P2) (result P1 Win)) (if (no Pieces P1) (result P2 Win)) (if (and { (is In (where \"General\" P1) (expand (sites Top))) (>= (count Pieces P2) 2) (= (who at:(coord \"D5\")) P2)}) (result P2 Win))}))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"CanNotMoveALPiece\" (and (not (is Mover (next))) (no Moves Next))) (game \"L Game\" (players 2) (equipment { (board (square 4)) (piece \"Dot\" Neutral) (tile \"L\" Each \"LWalk\")}) (rules (start { (place \"Dot0\" {\"A4\" \"D1\"}) (place \"L1\" coord:\"C1\" state:0) (place \"L2\" coord:\"B4\" state:2)}) (play (if (\"SameTurn\") (or (move Pass) (move (from (sites Occupied by:Neutral)) (to (sites Empty)))) (move (from (sites Occupied by:Mover)) (to (union (sites Empty) (sites Occupied by:Mover))) (then (moveAgain))))) (end (if \"CanNotMoveALPiece\" (result Mover Win)))))\n\n###\n\n", "completion": "Played on a board of 4x4 squares. Each player controls a 3x2 L-shaped piece, and there are two 1x1 pieces which either player can manipulate. On a turn, a player moves the L piece to a new available position, and then has the option to move one of the 1x1 pieces. When a player cannot move their L piece, they lose. END" }, { "prompt": "Construct a Ludii game based on the following description\nTODO \n\n###\n\n", "completion": "(define \"CaptureForwardDiagonal\" (move Step (directions {FR FL}) (to if:(\"IsEnemyAt\" (to)) (apply (remove (to)))))) (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 \"BigCastling\" (\"DoCastle\" \"King\" W 4 \"KingNotCheckedAndToEmpty\" (then (and (\"PieceHasMoved\") (\"DoCastle\" \"RookLeft\" E 5 True))))) (define \"SmallCastling\" (\"DoCastle\" \"King\" E 4 \"KingNotCheckedAndToEmpty\" (then (and (\"PieceHasMoved\") (\"DoCastle\" \"RookRight\" W 4 True))))) (define \"DoCastle\" (move Slide (from (mapEntry #1 (mover))) #2 (between (exact #3) if:#4) #5)) (define \"KingNotCheckedAndToEmpty\" (and (is Empty (to)) (not (\"IsInCheck\" \"King\" Mover at:(to))))) (define \"CaptureToPieceAndResetCounter\" (apply (if (\"IsEnemyAt\" (to)) (remove (to) (then (set Counter)))))) (define \"RememberPieceHasMoved\" (then (if (= (state at:(last To)) 1) \"PieceHasMoved\"))) (define \"PieceHasMoved\" (set State at:(last To) 0)) (define \"HasNeverMoved\" (= (state at:(mapEntry #1 (mover))) 1)) (define \"KingInTheInitialPlace\" (= (what at:(mapEntry \"King\" (mover))) (id \"King\" Mover))) (define \"NextCanNotMove\" (not (can Move (do (forEach Piece Next) ifAfterwards:(not (\"IsInCheck\" \"King\" Next)))))) (game \"Social Distance Chess\" (\"TwoPlayersNorthSouth\") (equipment { (board (rectangle 8 15)) (piece \"Pawn\" Each (or { (if (is In (from) (sites Start (piece (what at:(from))))) (\"DoubleStepForwardToEmpty\" \"SetEnPassantLocation\")) \"StepForwardToEmpty\" \"CaptureForwardDiagonal\" \"EnPassant\"} (then (and (if (is In (last To) (sites Mover \"Promotion\")) (moveAgain)) (set Counter))))) (piece \"Rook\" Each (move Slide Orthogonal (to if:(\"IsEnemyAt\" (to)) \"CaptureToPieceAndResetCounter\") \"RememberPieceHasMoved\")) (piece \"King\" Each (move Step (to if:(not (\"IsFriendAt\" (to))) \"CaptureToPieceAndResetCounter\") \"RememberPieceHasMoved\")) (piece \"Bishop\" Each (move Slide Diagonal (to if:(\"IsEnemyAt\" (to)) \"CaptureToPieceAndResetCounter\"))) (piece \"Knight\" Each (move Leap \"KnightWalk\" (to if:(not (\"IsFriendAt\" (to))) \"CaptureToPieceAndResetCounter\"))) (piece \"Queen\" Each (move Slide (to if:(\"IsEnemyAt\" (to)) \"CaptureToPieceAndResetCounter\"))) (map \"King\" {(pair 1 \"I1\") (pair 2 \"I8\")}) (map \"RookLeft\" {(pair 1 \"A1\") (pair 2 \"A8\")}) (map \"RookRight\" {(pair 1 \"O1\") (pair 2 \"O8\")}) (regions \"Promotion\" P1 (sites Top)) (regions \"Promotion\" P2 (sites Bottom))}) (rules (start { (place \"Pawn1\" {\"A3\" \"C3\" \"E3\" \"G3\" \"I3\" \"K3\" \"M3\" \"O3\"}) (place \"Pawn2\" {\"A6\" \"C6\" \"E6\" \"G6\" \"I6\" \"K6\" \"M6\" \"O6\"}) (place \"Rook1\" {\"A1\" \"O1\"} state:1) (place \"Knight1\" {\"C1\" \"M1\"}) (place \"Bishop1\" {\"E1\" \"K1\"}) (place \"Queen1\" {\"G1\"}) (place \"King1\" {\"I1\"} state:1) (place \"Rook2\" {\"A8\" \"O8\"} state:1) (place \"Knight2\" {\"C8\" \"M8\"}) (place \"Bishop2\" {\"E8\" \"K8\"}) (place \"Queen2\" {\"G8\"}) (place \"King2\" {\"I8\"} state:1)}) (play (if \"SameTurn\" (move Promote (last To) (piece {\"Queen\" \"Knight\" \"Bishop\" \"Rook\"}) Mover) (do (or (forEach Piece) (if (and { \"KingInTheInitialPlace\" (\"HasNeverMoved\" \"King\") (not (\"IsInCheck\" \"King\" Mover))}) (or (if (and (\"HasNeverMoved\" \"RookLeft\") (can Move (\"DoCastle\" \"RookLeft\" E 3 (is Empty (to))))) \"BigCastling\") (if (and (\"HasNeverMoved\" \"RookRight\") (can Move (\"DoCastle\" \"RookRight\" W 2 (is Empty (to))))) \"SmallCastling\")))) ifAfterwards:(not (\"IsInCheck\" \"King\" Mover))))) (end { (if (and (\"IsInCheck\" \"King\" Next) (\"NextCanNotMove\")) (result Mover Win)) (if (or (no Moves Mover) (= (counter) 100)) (result Mover Draw))}))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"Yavalanchor\" (players 2) (equipment { (board (rotate 90 (hex 5))) (piece \"Marker\" Each) (piece \"Marker\" Shared) (hand Shared)}) (rules (meta (swap)) (start (place \"Marker\" (handSite Shared))) (play (or (move Add (to (sites Around (sites Occupied by:Shared component:\"Marker\") if:(is Empty (to))))) (move (from (handSite Shared)) (to (sites Empty)) copy:True))) (end (forEach Player if:(and (or (= (what at:(last To)) (id \"Marker\" Player)) (= (what at:(last To)) (id \"Marker\"))) (is Line 5 whats:{(id \"Marker\" Player) (id \"Marker\")})) (result Player Win)))))\n\n###\n\n", "completion": "Two players play, with white and black pieces, with neutral red pieces as well. Players take turns placing either a red counters on an empty space or a counter of their color on a space adjacent to a red one. Play continues until one player creates five in a row with only their color and red. The player that does so first wins. END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"PiecesOwnedBy\" (+ (count Cell at:(handSite #1)) (count in:(sites #1 \"Home\")))) (define \"Columns\" 8) (game \"Bao Ki Arabu (Zanzibar 2)\" (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 2 to:(sites Board))) (play (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(> (count at:(from)) 0)) (then (sow \"Track\" owner:(mover) apply:(if (= (count at:(to)) 1) (if (is In (to) (sites Mover \"Inner\")) (if (> (count at:(\"OppositePit\" (to))) 0) (and (fromTo (from (\"OppositePit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePit\" (to)))) (if (> (count at:(\"OppositeOuterPit\" (to))) 0) (fromTo (from (\"OppositeOuterPit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositeOuterPit\" (to)))))))) (moveAgain)))))) (end (\"MancalaByScoreWhen\" (no Moves Mover)))))\n\n###\n\n", "completion": "4x8 board. Play begins with two counters in each hole. Sowing occurs in an anti-clockwise direction. When the last counter falls into an occupied hole, the counters in it are picked up and sowing continues. Sowing ends when the last counter falls into an empty hole. When this hole is in the inner row, the counters in the opponent's inner row opposite it are captured; if there are also counters in the opponent's outer row opposite, these are also captured, but not if the inner row is empty. Play continues until one player has lost all of their counters. END" }, { "prompt": "Construct a Ludii game based on the following description\nThe rules are the same as for Chess, except pawns cannot move two spaces on the first move, there is no castling, and no en-passant capture. \n\n###\n\n", "completion": "(game \"Los Alamos Chess\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 6)) (\"ChessPawn\" \"Pawn\" ~ (then (and (\"ReplayInMovingOn\" (sites Mover \"Promotion\")) (set Counter)))) (\"ChessRook\" \"Rook\" (then (set Counter))) (\"ChessKing\" \"King\" (then (set Counter))) (\"ChessKnight\" \"Knight\" (then (set Counter))) (\"ChessQueen\" \"Queen\" (then (set Counter))) (regions \"Promotion\" P1 (sites Top)) (regions \"Promotion\" P2 (sites Bottom))}) (rules (start { (place \"Pawn1\" (sites Row 1)) (place \"Pawn2\" (sites Row 4)) (place \"Rook1\" {\"A1\" \"F1\"}) (place \"Knight1\" {\"B1\" \"E1\"}) (place \"Queen1\" coord:\"C1\") (place \"King1\" coord:\"D1\") (place \"Rook2\" {\"A6\" \"F6\"}) (place \"Knight2\" {\"B6\" \"E6\"}) (place \"Queen2\" coord:\"C6\") (place \"King2\" coord:\"D6\")}) (play (if \"SameTurn\" (move Promote (last To) (piece {\"Queen\" \"Knight\" \"Rook\"}) Mover) (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King\" Mover))))) (end { (\"Checkmate\" \"King\") (if (or (no Moves Mover) (= (counter) 100)) (result Mover Draw))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6 board. Four counters per hole. Players sow in a clockwise direction from their left three holes or anti-clockwise from their right three holes. When the final counter of a sowing falls into a hole in the opponent's row or in the leftmost or rightmost hole of the player's own row, which contains three counters, making it now contain four, this hole is marked and counters cannot be sown from this hole. Sowing cannot occur from a hole with a single counter into a hole containing three in the opponent's row, but is allowed when the hole containing three is in the player's own row. A player cannot sow a lone counter that was sown into their row by the opponent on the previous turn back into the hole from which it was just moved. If a player is unable to sow from their row, the opponent may continue to play until the player is able to move. Play continues until all of the counters are in marked holes. The player with the most counters in their marked holes wins. \n\n###\n\n", "completion": "(define \"AllCountersInMarkedHoles\" (= 0 (count in:(forEach (sites Board) if:(= 0 (state at:(site))))))) (define \"PiecesOwnedBy\" (count in:(forEach (sites Board) if:(= (id #1) (state at:(site)))))) (define \"NextHoleFrom\" (\"NextSiteOnTrack\" 1 from:#1 #2)) (game \"Andot\" (players 2) (equipment { (mancalaBoard 2 6 store:None { (track \"TrackCCW\" \"0,E,N,W\" loop:True) (track \"TrackCW\" \"5,W,N,E\" loop:True)}) (regions \"Home\" P1 (sites Bottom)) (regions \"Home\" P2 (sites Top)) (regions \"LeftThree\" P1 (expand (intersection (sites Bottom) (sites Left)) steps:2 E)) (regions \"LeftThree\" P2 (expand (intersection (sites Top) (sites Right)) steps:2 W)) (regions \"RightThree\" P1 (expand (intersection (sites Bottom) (sites Right)) steps:2 W)) (regions \"RightThree\" P2 (expand (intersection (sites Top) (sites Left)) steps:2 E)) (regions \"ExtremeHoles\" P1 (intersection (union (sites Left) (sites Right)) (sites Bottom))) (regions \"ExtremeHoles\" P2 (intersection (union (sites Left) (sites Right)) (sites Top))) (piece \"Seed\" Shared)}) (rules (start (set Count 4 to:(sites Board))) (play (or (move Select (from (sites Mover \"LeftThree\") if:(and (or (and (= (count at:(from)) 1) (and (!= (from) (\"NextHoleFrom\" (last From) \"TrackCCW\")) (if (is In (\"NextHoleFrom\" (from) \"TrackCW\") (sites Next \"Home\")) (!= (count at:(\"NextHoleFrom\" (from) \"TrackCW\")) 3) True))) (> (count at:(from)) 1)) (= 0 (state at:(from))))) (then (sow \"TrackCW\" apply:(if (and (= (count at:(to)) 4) (is In (to) (union (sites Mover \"ExtremeHoles\") (sites Next \"Home\")))) (set State at:(to) (mover)))))) (move Select (from (sites Mover \"RightThree\") if:(and (or (and (= (count at:(from)) 1) (and (!= (from) (\"NextHoleFrom\" (last From) \"TrackCW\")) (if (is In (\"NextHoleFrom\" (from) \"TrackCCW\") (sites Next \"Home\")) (!= (count at:(\"NextHoleFrom\" (from) \"TrackCCW\")) 3) True))) (> (count at:(from)) 1)) (= 0 (state at:(from))))) (then (sow \"TrackCCW\" apply:(if (and (= (count at:(to)) 4) (is In (to) (union (sites Mover \"ExtremeHoles\") (sites Next \"Home\")))) (set State at:(to) (mover)))))))) (end (\"MancalaByScoreWhen\" (\"AllCountersInMarkedHoles\"))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n8x8 board. Sixteen pieces per player. The pieces begin on the first and third rank or squares with respect to each player. Pieces move orthogonally any distance. Pieces are captured when surrounded on both sides by an enemy piece. Enemy pieces may also be taken if a piece moves into a space such that the enemy pieces are on either side of it. The goal is to capture all of the enemy's pieces. \n\n###\n\n", "completion": "(game \"Maak Yek\" (players 2) (equipment { (board (square 8)) (piece \"Marker\" Each (move Slide Orthogonal (then (and (\"InterveneCapture\" Orthogonal) (\"CustodialCapture\" Orthogonal)))))}) (rules (start { (place \"Marker1\" (union (sites Row 0) (sites Row 2))) (place \"Marker2\" (union (sites Row 5) (sites Row 7)))}) (play (forEach Piece)) (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nEach turn you must perform exactly one of the following two actions: \n \n 1. Add a friendly piece orthogonally adjacent to one of your pieces. \n 2. Remove an enemy group.\n \n As soon as one player only has 1 group, the game is over and that player is the winner. A size 10 board is currently selected\n\n###\n\n", "completion": "(define \"Remove\" (move Select (from (sites Occupied by:Enemy)) (then (forEach Site (sites Group at:(last From) Orthogonal) (remove (site)))))) (define \"Place\" (move Add (to (sites Around (sites Occupied by:Mover) Empty Orthogonal)))) (game \"Gygoreg\" (players 2) (equipment { (board (square Diamond 10)) (piece \"Disc\" Each)}) (rules (start { (place \"Disc1\" (forEach (sites Phase 0) if:(is Odd (site)))) (place \"Disc2\" (forEach (sites Phase 0) if:(is Even (site))))}) (play (or (\"Place\") (\"Remove\"))) (end { (\"SingleGroupWin\" P1 Orthogonal) (\"SingleGroupWin\" P2 Orthogonal)}))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nEach row has 12 holes. -> Each row has 14 holes.\n(define \"NextHoleFrom\" (\"NextSiteOnTrack\" 1 from:#1)) (define \"HaveHolesWithMoreThanOneCounter\" (not (all Sites (forEach (sites Mover \"Home\") if:(< 1 (count at:(site)))) if:(= 0 (count at:(site)))))) (define \"NoPiece\" (all Sites (sites Player \"Home\") if:(= 0 (count at:(site))))) (define \"Columns\" 12) (game \"Msuwa\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"0,E,N1,W\" loop:True P1) (track \"Track2\" \"24,E,N1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"Track1\")) (regions \"Home\" P2 (sites Track \"Track2\")) (regions \"Inner\" P1 (difference (sites Track \"Track1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"Track2\") (sites Top))) (piece \"Seed\" Shared)}) (rules (start { (set Count 2 to:(difference (sites Board) (sites {22..25}))) (set Count 1 to:(sites {22 25}))}) (play (if (and (\"SameTurn\") (< 0 (var))) (move Remove (forEach (sites Next \"Home\") if:(< 0 (count at:(site)))) (then (and (if (> (var) 1) (moveAgain)) (set Var (- (var) 1))))) (if (\"HaveHolesWithMoreThanOneCounter\") (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(< 1 (count at:(from)))) (then (sow \"Track\" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover \"Inner\")) (if (< 0 (count at:(\"OppositePit\" (to)))) (and (remove (\"OppositePit\" (to))) (if (< 0 (count at:(\"OppositeOuterPit\" (to)))) (and { (remove (\"OppositeOuterPit\" (to))) (set Var 2) (moveAgain)}))))))))) (move Select (from (sites Mover \"Home\") if:(and (= 1 (count at:(from))) (= 0 (count at:(\"NextHoleFrom\" (from)))))) (then (sow \"Track\" owner:(mover) apply: (if (is In (to) (sites Mover \"Inner\")) (if (< 0 (count at:(\"OppositePit\" (to)))) (and (remove (\"OppositePit\" (to))) (if (< 0 (count at:(\"OppositeOuterPit\" (to)))) (and { (remove (\"OppositeOuterPit\" (to))) (set Var 2) (moveAgain)}))))))))))) (end (forEach NonMover if:(\"NoPiece\") (result Player Loss)))))\n\n###\n\n", "completion": "(define \"NextHoleFrom\" (\"NextSiteOnTrack\" 1 from:#1)) (define \"HaveHolesWithMoreThanOneCounter\" (not (all Sites (forEach (sites Mover \"Home\") if:(< 1 (count at:(site)))) if:(= 0 (count at:(site)))))) (define \"NoPiece\" (all Sites (sites Player \"Home\") if:(= 0 (count at:(site))))) (define \"Columns\" 14) (game \"Msuwa\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"0,E,N1,W\" loop:True P1) (track \"Track2\" \"28,E,N1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"Track1\")) (regions \"Home\" P2 (sites Track \"Track2\")) (regions \"Inner\" P1 (difference (sites Track \"Track1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"Track2\") (sites Top))) (piece \"Seed\" Shared)}) (rules (start { (set Count 2 to:(difference (sites Board) (sites {26..29}))) (set Count 1 to:(sites {26 29}))}) (play (if (and (\"SameTurn\") (< 0 (var))) (move Remove (forEach (sites Next \"Home\") if:(< 0 (count at:(site)))) (then (and (if (> (var) 1) (moveAgain)) (set Var (- (var) 1))))) (if (\"HaveHolesWithMoreThanOneCounter\") (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(< 1 (count at:(from)))) (then (sow \"Track\" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover \"Inner\")) (if (< 0 (count at:(\"OppositePit\" (to)))) (and (remove (\"OppositePit\" (to))) (if (< 0 (count at:(\"OppositeOuterPit\" (to)))) (and { (remove (\"OppositeOuterPit\" (to))) (set Var 2) (moveAgain)}))))))))) (move Select (from (sites Mover \"Home\") if:(and (= 1 (count at:(from))) (= 0 (count at:(\"NextHoleFrom\" (from)))))) (then (sow \"Track\" owner:(mover) apply: (if (is In (to) (sites Mover \"Inner\")) (if (< 0 (count at:(\"OppositePit\" (to)))) (and (remove (\"OppositePit\" (to))) (if (< 0 (count at:(\"OppositeOuterPit\" (to)))) (and { (remove (\"OppositeOuterPit\" (to))) (set Var 2) (moveAgain)}))))))))))) (end (forEach NonMover if:(\"NoPiece\") (result Player Loss))))) 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": "Modify the Ludii game according to the following option changes:\nBoard & size: Hexhex with edges alternately 3 and 4 -> Board & size: Hexhex with edges alternately 4 and 5\nMovement: Pieces step or hop once, to the first empty position in that direction. -> Movement: Pieces step to an adjacent empty position.\n(define \"Jumping\" (forEach Piece (\"HopAllPiecesToEmpty\" ~ ~ (range 0 18)))) (define \"Stepping\" (forEach Piece (\"StepToEmpty\"))) (define \"Sliding\" (forEach Piece (move Slide))) (define \"Hopping\" (forEach Piece (or (\"HopAllPiecesToEmpty\") (\"StepToEmpty\")))) (define \"Shooting\" (forEach Piece (move (from) (to (sites LineOfSight Farthest at:(from)) if:(is Empty (to)))))) (game \"Abrobad\" (players 2) (equipment { (board (hex Limping 3)) (piece \"Hex\" Each)}) (rules (play (priority (move Add (to (sites Empty) if:(= 0 (count Sites in:(sites Around (to) Own))))) (or \"Hopping\" (move Propose \"Conclude\" (then (if (is Proposed \"Conclude\") (add (piece (next)) (to (sites Empty)) (then (and (set Score Mover (count Groups if:(= (who at:(to)) (mover)))) (set Score Next (count Groups if:(= (who at:(to)) (next))))))))))))) (end (if (is Proposed \"Conclude\") (if (<= (score Mover) (score Next)) (result Mover Win)) (result Next Win)))))\n\n###\n\n", "completion": "(define \"Jumping\" (forEach Piece (\"HopAllPiecesToEmpty\" ~ ~ (range 0 18)))) (define \"Stepping\" (forEach Piece (\"StepToEmpty\"))) (define \"Sliding\" (forEach Piece (move Slide))) (define \"Hopping\" (forEach Piece (or (\"HopAllPiecesToEmpty\") (\"StepToEmpty\")))) (define \"Shooting\" (forEach Piece (move (from) (to (sites LineOfSight Farthest at:(from)) if:(is Empty (to)))))) (game \"Abrobad\" (players 2) (equipment { (board (hex Limping 4)) (piece \"Hex\" Each)}) (rules (play (priority (move Add (to (sites Empty) if:(= 0 (count Sites in:(sites Around (to) Own))))) (or \"Stepping\" (move Propose \"Conclude\" (then (if (is Proposed \"Conclude\") (add (piece (next)) (to (sites Empty)) (then (and (set Score Mover (count Groups if:(= (who at:(to)) (mover)))) (set Score Next (count Groups if:(= (who at:(to)) (next))))))))))))) (end (if (is Proposed \"Conclude\") (if (<= (score Mover) (score Next)) (result Mover Win)) (result Next Win))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"Dara\" (players 2) (equipment { (board (rectangle 5 6)) (hand Each) (piece \"Marker\" Each (\"StepToEmpty\" Orthogonal (then (\"ReplayIfLine3\" Orthogonal))))}) (rules (start (place \"Marker\" \"Hand\" count:12)) phases:{ (phase \"Placement\" (play (do (move (from (handSite Mover)) (to (sites Empty))) ifAfterwards:(not (is Line 4 Orthogonal)))) (nextPhase (\"HandEmpty\" P2) \"Movement\")) (phase \"Movement\" (play (if \"SameTurn\" (\"RemoveAnyEnemyPieceNotInLine3\" Orthogonal) (do (forEach Piece) ifAfterwards:(not (is Line 4 Orthogonal))))))} (end (\"HavingLessPiecesLoss\" Next 2))))\n\n###\n\n", "completion": "5x6 board. Players have 12 pieces each. They take turns placing pieces on an empty board.Once all pieces are placed, players can move pieces orthogonally to an adjacent space, attempting to make three in a row. When three in a row are made, an opponent's piece is removed from the board that is not in a three in a row pattern. Placing more than three in a row is not allowed. Three in a row during the initial phase of the game does not count. When a player has only two pieces left, they lose. Lines of 4 cannot be made during the drop phase. END" }, { "prompt": "Construct a Ludii game based on the following description\nSame rules as Murray, except players cannot remove an opponent's piece that is in a three in a row formation unless there are no other options. Any Enemy piece can be captured.\n\n###\n\n", "completion": "(define \"RemoveEnemyPieceInMillOnlyIfNoOtherChoice\" (if (can Move (\"RemoveAnyEnemyPieceNotInLine3\" Orthogonal)) (\"RemoveAnyEnemyPieceNotInLine3\" Orthogonal) (\"RemoveAnyEnemyPiece\"))) (game \"Five Men's Morris\" (players 2) (equipment { (board (concentric Square rings:2) use:Vertex) (hand Each) (piece \"Marker\" Each (\"StepToEmpty\" ~ (then (\"ReplayIfLine3\" Orthogonal exact:True))))}) (rules (start (place \"Marker\" \"Hand\" count:5)) 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": "Describe the mechanics of the following Ludii game\n(game \"Lau Kata Kati\" (players 2) (equipment { (board (merge (wedge 4) (shift 0 3 (rotate 180 (wedge 4)))) use:Vertex) (piece \"Counter\" Each (or (\"HopCapture\") (\"StepToEmpty\")))}) (rules (start { (place \"Counter1\" (expand (sites Bottom) steps:2)) (place \"Counter2\" (expand (sites Top) steps:2))}) (play (forEach Piece)) (end (\"CaptureAll\" Next))))\n\n###\n\n", "completion": "Play begins with each player's pieces on the pieces occupying the points of one of the triangles, leaving the shared apex empty. Pieces move to the next adjacent point connected by a line. Captures are made by hopping over an opponent's piece. The player who captures all of the opponent's pieces wins. The player loses when he has no piece. END" }, { "prompt": "Construct a Ludii game based on the following description\nStarchess is played on a star-shaped hexagonal board that can be thought of as a hexagon-shaped board with each side having length 6, but with four spaces removed from each corner. The board has 37 spaces.\n \n Starchess starts off with the non-Pawn pieces being placed behind the Pawns. This happens one piece at a time, in alternating turns, until all non-Pawn pieces have been placed. Then the 'movement phase' of the game begins as usual.\n \n Piece Movement:\n * Knights move as in Glinsky Chess.\n - They move two spaces in any adjacent direction, then one space in another direction.\n * Kings can move one space in any of those same six adjacent directions. There is no castling.\n * Queens can slide in any of the six adjacent directions from their current space---North, South, or 60 degrees off either of those.\n * Rooks can slide forward or backward only in their given column.\n * Bishops can slide in only four of the adjacent directions: they cannot slide North or South.\n * Pawns can advance one space forward without capturing. A Pawn on a Pawn start space can advance two spaces forward, even if it has previously moved (by capturing) to a different Pawn start space than it started the game on. Pawns capture by moving to one of the two adjacent spaces 60 degrees left or right of forward. On reaching the farthest rank in any of the innermost five columns, Pawns are promoted to a Queen, Rook, Bishop, or Knight, as the player chooses.\n \n The game ends on a checkmate or stalemate.\n \n Some terminology: a Pawn off to the side, in one of the two spaces at the extremes of the middle row is called a 'mummy', while a Pawn in one of the spaces adjacent to that is called a 'dead Pawn'. Mummies and dead Pawns cannot be promoted until they return to one of the innermost five columns. \n\n###\n\n", "completion": "(define \"IsEnPassantCapture\" (and (is Pending) (= (to) (value Pending)))) (define \"EnPassant_Ortho\" (\"EnPassant_Base\" (\"Directions\" {WNW ENE} {WSW ESE}))) (define \"EnPassant_Base\" (move Step #1 (to if:\"IsEnPassantCapture\") (then (remove (var))))) (define \"PawnStep_To\" (\"StepToEnemy\" #1)) (define \"PawnStep_Double\" (\"PawnHop\" Forward Backward)) (define \"PawnCapture_Ortho\" (\"PawnStep_To\" (\"Directions\" {WNW ENE} {WSW ESE}))) (define \"PawnHop\" (move Hop #1 (between if:(is In (between) (sites Empty))) (to if:\"IsToEmpty\") (then (and (set Pending (ahead (last To) #2)) (set Var (last To)))))) (define \"KingCaptureStep\" (move Step #1 (to if:\"IsToEmptyOrEnemy\" \"CaptureToPieceAndResetCounter\") #2)) (define \"SlideCaptureMove\" (move Slide #1 (to if:(\"IsEnemyAt\" (to)) \"CaptureToPieceAndResetCounter\") #2)) (define \"PromoteTo\" (move Promote (last To) #1 Mover)) (define \"P12\" (if (is Mover P1) #1 #2)) (define \"IsToEmptyOrEnemy\" (or \"IsToEmpty\" (\"IsEnemyAt\" (to)))) (define \"IsToEmpty\" (is In (to) (sites Empty))) (define \"IsFromInStartCell\" (is In (from) (sites Start (piece (what at:(from)))))) (define \"Directions\" (\"P12\" (directions #1) (directions #2))) (define \"CaptureToPieceAndResetCounter\" (apply (if (\"IsEnemyAt\" (to)) (remove (to) (then (set Counter)))))) (game \"Starchess\" (\"TwoPlayersNorthSouth\") (equipment { (board (rotate 30 (hex Star 2))) (piece \"King\" Each (\"KingCaptureStep\" Orthogonal ~)) (piece \"Queen\" Each (\"SlideCaptureMove\" Orthogonal ~)) (piece \"Rook\" Each (\"SlideCaptureMove\" (directions {N S}) ~)) (piece \"Bishop\" Each (\"SlideCaptureMove\" (directions {WNW ENE WSW ESE}) ~)) (\"ChessKnight\" \"Knight\" (then (set Counter))) (piece \"Pawn\" Each (or { \"StepForwardToEmpty\" (if \"IsFromInStartCell\" \"PawnStep_Double\") \"PawnCapture_Ortho\" \"EnPassant_Ortho\"} (then (and (if (is In (last To) (sites Mover \"PromotionZone\")) (moveAgain)) (set Counter))))) (hand Each size:5) (regions \"Home\" P1 (sites {\"A3\" \"B3\" \"C3\" \"C2\" \"C1\"})) (regions \"Home\" P2 (sites {\"G9\" \"G8\" \"G7\" \"H7\" \"I7\"})) (regions \"PromotionZone\" P1 (sites P2 \"Home\")) (regions \"PromotionZone\" P2 (sites P1 \"Home\")) (regions \"Region-Dark\" (sites Phase 1)) (regions \"Region-Light\" (sites Phase 2)) (regions \"Region-Medium\" (sites Phase 0))}) (rules (start { (place \"King\" \"Hand\" count:1) (place \"Queen\" \"Hand\" count:1) (place \"Rook\" \"Hand\" count:1) (place \"Bishop\" \"Hand\" count:1) (place \"Knight\" \"Hand\" count:1) (place \"Pawn1\" {\"B4\" \"C4\" \"D4\" \"D3\" \"D2\"}) (place \"Pawn2\" {\"F8\" \"F7\" \"F6\" \"G6\" \"H6\"})}) phases:{ (phase \"Placement\" (play (move (from (sites Occupied by:Mover container:(mover))) (to (intersection (sites Mover \"Home\") (sites Empty))))) (nextPhase (\"HandEmpty\" P2) \"Movement\")) (phase \"Movement\" (play (if (\"SameTurn\") (\"PromoteTo\" (piece {\"Queen\" \"Rook\" \"Bishop\" \"Knight\"})) (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King\" Mover))))) (end { (\"Checkmate\" \"King\") (if (or (no Moves Mover) (= (counter) 100)) (result Mover Draw))}))})) END" }, { "prompt": "Construct a Ludii game based on the following description\nTURN - On each turn, each player slides (orthogonally or diagonally) a stone until it hits another stone or a wall.\n \n If it stops because of a stone, the moving stone and all adjacent stones (of either color) are removed.\n \n GOAL - The player with no stones onboard loses.\n \n The game is a draw if (i) the board becomes empty, or (ii) each player has just one stone, or (iii) the moving player has no valid moves. \n\n###\n\n", "completion": "(game \"Fission\" (players 2) (equipment { (board (square 8)) (piece \"Ball\" Each (move (from (from)) (to (sites LineOfSight Farthest at:(from)) if:(not (is In (to) (sites Around (from))))) (then (if (!= (ahead (last To) (\"LastDirection\" Cell)) (last To)) (remove (sites Around (last To) includeSelf:True))))))}) (rules (start { (place \"Ball1\" (intersection (sites Phase 1) (expand (sites Centre) steps:2 Orthogonal))) (place \"Ball2\" (intersection (sites Phase 0) (expand (sites Centre) steps:2 Orthogonal)))}) (play (forEach Piece)) (end { (if (and (not (no Pieces Mover)) (no Pieces Next)) (result Mover Win)) (if (or (no Moves Next) (and (= 1 (count Pieces P1)) (= 1 (count Pieces P2)))) (result Mover Draw))}))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"DuploHex\" (players 2) (equipment { (board (hex Diamond 7)) (piece \"DoubleCounter\" Each) (piece \"Disc\" Each (move Step (to if:(or (= (what at:(to)) (id \"Ring1\")) (= (what at:(to)) (id \"Ring2\")))) (then (promote (last To) (piece \"DoubleCounter\") Mover)))) (piece \"Ring\" Each (move Step (to if:(or (= (what at:(to)) (id \"Disc1\")) (= (what at:(to)) (id \"Disc2\")))) (then (promote (last To) (piece \"DoubleCounter\") Mover)))) (hand Each size:2) (regions P1 {(sites Side NE) (sites Side SW)}) (regions P2 {(sites Side NW) (sites Side SE)})}) (rules (start { (place \"Disc1\" (handSite P1 0) count:25) (place \"Ring1\" (handSite P1 1) count:25) (place \"Disc2\" (handSite P2 0) count:25) (place \"Ring2\" (handSite P2 1) count:25)}) phases:{ (phase \"Placement\" (play (move (from (sites Hand P1)) (to (sites Empty)) (then (moveAgain)))) (nextPhase \"Game\")) (phase \"Game\" (play (if (is Odd (count Moves)) (or (move (from (handSite Mover 0)) (to (sites Empty)) (then (moveAgain))) (forEach Piece \"Disc\")) (or (move (from (handSite Mover 1)) (to (sites Empty))) (forEach Piece \"Ring\")))))} (end (if (is Connected Mover) (result Mover Win)))))\n\n###\n\n", "completion": "White starts by placing one disc or ring on any cell of the board. \n \n Then, each player in turn must perform two actions: \n \n 1. add one of her discs to an empty cell or move one of her discs on the board into any ring located in a neighbor cell, and \n \n 2. add one of her rings to an empty cell or move one of her rings on the board to a neighbor cell occupied by a disc. \n \n The disc-ring pair (a disc inside a ring) cannot be modified for the rest of the game. END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayed on an Alquerque board with triangular appendages at the top and bottom. Sixteen pieces per player. Each player moves one spot along the lines on the board. Captures are made by hopping over an opponent's piece. Multiple hops are allowed per turn if possible. Captures are not compulsory. The player who captures all of the opponent's pieces wins. \n\n###\n\n", "completion": "(game \"Hewakam Keliya\" (players 2) (equipment { (\"AlquerqueBoardWithBottomAndTopTriangles\") (piece \"Marker\" Each (or (\"HopSequenceCapture\") (\"StepToEmpty\")))}) (rules (start { (place \"Marker1\" (union {(sites Row 0) (sites Row 1) (sites Row 2) (sites Row 3)})) (place \"Marker2\" (union {(sites Row 5) (sites Row 6) (sites Row 7) (sites Row 8)}))}) (play (if \"SameTurn\" (or (\"HopSequenceCaptureAgain\") (move Pass)) (forEach Piece))) (end (\"NoMoves\" Loss)))) END" }, { "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\nPlayers take turns placing a stone on an empty cell. A player wins as soon as some or all of their stones form a group with the following property: If all the cells of that group where removed (imagined away) from the board, none of the resulting partitions of the board would contain a majority of the set of cells comprising both the center cell and the perimeter cells (a majority relative to the entire intact board, that is, not of the imagined result of partitioning it). A size 7 board is currently selected\n\n###\n\n", "completion": "(game \"Gyre\" (players 2) (equipment { (board (hex 7)) (piece \"Disc\" Each)}) (rules (meta (swap)) (play (move Add (to (sites Empty)))) (end (if (>= (count Sites in:(union (sites Outer) (sites {(centrePoint)}))) (max (results from:(difference (sites Board) (sites Group at:(last To))) to:2 (* (to) (count Sites in:(intersection (union (sites Outer) (sites {(centrePoint)})) (sites Group at:(from) if:(not (is In (to) (sites Group at:(last To))))))))))) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n8x8 board. Pieces have special moves, as follows: R\u00e1tu (king), moves one square in any direction, but on the first move, if it has not been checked, may move two spaces in any direction or like a J\u00e1ran; Pateh (minister), moves orthogonally or diagonally any number of spaces; M\u00e1ntri (x2); move diagonally any distance; J\u00e1ran (horse) x2, moves orthogonally one space then diagonal one space from there, jumping over any intervening pieces; Pr\u00e1hu (vessel) x2, moves orthogonally any distance; B\u00eddak (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\u00eddak must move backward diagonally three spaces before being promoted to Pateh, unless it is in one of the corner spaces, in which case it is promoted immediately. There is no limit to the number of Patehs on the board. To castle, the Pr\u00e1hu moves next to the R\u00e1tu, and then at any turn in the future the R\u00e1tu may move to the space on the other side of it, provided the R\u00e1tu has not yet been checked and that the space to which it moves remains available. The R\u00e1tu cannot be in check at the end of its turn. When this is unavoidable, it is checkmate and the opponent wins. If the R\u00e1tu is the only piece belonging to the player on the board, that player wins. \n\n###\n\n", "completion": "(define \"RememberKingMovedOrChecked\" (set State at:#1 1)) (define \"KingMovedOrCheckedBefore\" (= 1 (state at:#1))) (define \"RookMovedBefore\" (= 1 (state at:#1))) (define \"RememberRookMoved\" (set State at:#1 1)) (define \"KingSites\" (sites {\"E1\" \"D8\"})) (define \"SitesNextToKing\" (sites {\"D1\" \"F1\" \"C8\" \"E8\"})) (game \"Chatur\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (piece \"King_noCross\" (or (\"StepToNotFriend\" ~ (then (if (not (\"KingMovedOrCheckedBefore\" (last To))) (\"RememberKingMovedOrChecked\" (last To))))) (if (not (\"KingMovedOrCheckedBefore\" (from))) (or { (\"SlideCapture\" ~ (between (exact 2))) (\"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 (\"RememberKingMovedOrChecked\" (last To))))))) (\"ChessRook\" \"Rook\" ~ (then (if (and (not (\"RookMovedBefore\" (last To))) (not (is In (last To) (\"SitesNextToKing\")))) (\"RememberRookMoved\" (last To))))) (\"ChessBishop\" \"Bishop_noCross\") (\"ChessKnight\" \"Knight\") (piece \"Pawn\" (if (is In (from) (sites Mover \"Promotion\")) (\"SlideCapture\" (directions {BR BL}) (between (exact 3)) ~ (then (promote (last To) (piece \"Queen\") Mover))) (or \"StepForwardToEmpty\" (\"StepToEnemy\" (directions {FR FL})) (then (\"PromoteIfReach\" (intersection (sites Corners) (sites Mover \"Promotion\")) \"Queen\"))))) (\"ChessQueen\" \"Queen\") (regions \"Promotion\" P1 (sites Top)) (regions \"Promotion\" P2 (sites Bottom))}) (rules (start { (place \"Pawn1\" (sites Row 1)) (place \"Pawn2\" (sites Row 6)) (place \"Rook1\" {\"A1\" \"H1\"}) (place \"Knight1\" {\"B1\" \"G1\"}) (place \"Bishop_noCross1\" {\"C1\" \"F1\"}) (place \"Queen1\" coord:\"D1\") (place \"King_noCross1\" coord:\"E1\") (place \"Rook2\" {\"A8\" \"H8\"}) (place \"Knight2\" {\"B8\" \"G8\"}) (place \"Bishop_noCross2\" {\"C8\" \"F8\"}) (place \"Queen2\" coord:\"E8\") (place \"King_noCross2\" coord:\"D8\")}) (play (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King_noCross\" Mover)) (then (if (\"IsInCheck\" \"King_noCross\" Next) (if (not (\"KingMovedOrCheckedBefore\" (where \"King_noCross\" Next))) (\"RememberKingMovedOrChecked\" (where \"King_noCross\" Next))))))) (end { (\"Checkmate\" \"King_noCross\") (if (= (count Pieces Next) 1) (result Mover Loss))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nOne player has two leopards, the other has 24 cows. Play begins by each player taking turns to place their pieces, and then can move to one adjacent intersection. Leopards capture cows by hopping over them. Leopards win by capturing all the cows, cows win by blocking the leopards from moving. The leopard can jump to capture.\n\n###\n\n", "completion": "(game \"Diviyan Keliya\" (players 2) (equipment { (\"AlquerqueBoardWithFourTriangles\") (hand Each) (piece \"Leopard\" P1) (piece \"Cow\" P2 \"StepToEmpty\")}) (rules (start { (place \"Leopard1\" \"Hand1\" count:2) (place \"Cow2\" \"Hand2\" count:24)}) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (sites Empty)))) { (nextPhase P1 (\"HandEmpty\" P1) \"MovementP1\") (nextPhase P2 (\"HandEmpty\" P2) \"MovementP2\")}) (phase \"MovementP1\" P1 (play (forEach Piece \"Leopard\" (or \"HopCapture\" \"StepToEmpty\")))) (phase \"MovementP2\" P2 (play (forEach Piece)))} (end (\"NoMoves\" Loss)))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2 players. Each plays Discs. - \n \n --- Goal: Most friendly-stone adjacencies at the end of the game. Ties are broken by comparing piece counts. If it is still a tie, the last player to move loses. \n \n --- Play.\n On your turn you may do one of the following:\n 1. Pass\n \n 2. Place one of your stones on an empty cell of the board is not adjacent to your existing stones.\n \n 3. Move to a location with fewer adjacent enemies than the starting location.\n \n Moves are made in one of the following ways while keeping the above restriction:\n -- A. Step to an adjacent empty location.\n -- B. Hop your opponent's stone and replace it with a mutual enemy piece.\n -- C. Hop a mutual enemy piece and replace it with a stone from your supply.\n \n Note that the number of enemies is based on a count of both the opponent's stones and the mutual-enemy stones combined. Board & size: Hexhex (27) with edges alternating 3 and 4 Brown Background\n\n###\n\n", "completion": "(define \"HopEnemy\" (forEach Piece (move Hop (between if:(is Within (id \"Fan\" Neutral) at:(between)) (apply (and (remove (between)) (add (piece (id \"Disc\" Mover)) (to (between)))))) (to if:(and (is Empty (to)) (\"MoveAllowed\"))) (then (and (\"UpdateScore\" Mover) (\"UpdateScore\" Next)))) Mover)) (define \"HopNeutral\" (forEach Piece (move Hop (between if:(is Next (who at:(between))) (apply (and (remove (between)) (add (piece (id \"Fan\" Neutral)) (to (between)))))) (to if:(and (is Empty (to)) (\"MoveAllowed\"))) (then (and (\"UpdateScore\" Mover) (\"UpdateScore\" Next)))) Mover)) (define \"StepMove\" (forEach Piece (move Step (to (sites Around (from)) if:(and (is Empty (to)) (\"MoveAllowed\"))) (then (\"UpdateScore\" Mover))) Mover)) (define \"Placement\" (move Add (piece (id \"Disc\" Mover)) (to (sites Empty) if:\"NonAdjacent\"))) (define \"UpdateScore\" (set Score #1 (/ (+ (results from:(sites Occupied by:#1) to:(sites Around (from) if:(is #1 (who at:(to)))) 1)) 2))) (define \"Option2\" (not (is Within (id \"Disc\" Mover) in:(sites LineOfSight Piece at:(to))))) (define \"NonAdjacent\" (not (is Within (id \"Disc\" Mover) in:(sites Around (to))))) (define \"MoveAllowed\" (< (\"Unfriendlies\" (to)) (\"Unfriendlies\" (from)))) (define \"Unfriendlies\" (count Sites in:(intersection (sites Around #1) (union (sites Occupied by:Next) (sites Occupied by:Neutral))))) (define \"TieBreaker\" (count Pieces #1)) (game \"Refugia\" (players 2) (equipment { (board (hex {3 4 3 4 3})) (piece \"Disc\" P1) (piece \"Disc\" P2) (piece \"Fan\" Neutral)}) (rules (start (set Score Each 0)) (play (or { (\"StepMove\") (\"HopEnemy\") (\"HopNeutral\") (\"Placement\") (move Pass)})) (end (if (all Passed) { (if (> (score Mover) (score Next)) (result Mover Win)) (if (< (score Mover) (score Next)) (result Next Win)) (if (> (\"TieBreaker\" Mover) (\"TieBreaker\" Next)) (result Mover Win)) (if (< (\"TieBreaker\" Mover) (\"TieBreaker\" Next)) (result Next Win))} (result Next Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe board starts empty. White plays first. Players take turns placing a piece of their colour on an empty cell. Passing is not allowed. After each move, the opponent's pieces with no freedom are captured and removed from the board. A piece has freedom if the group it belongs to touches an empty cell. It is not allowed to place a piece in a space without freedom, unless that move captures the other player's pieces to create freedom. The game ends when one of the players wins a game by making a line of five (or more) stones of their colour. The game is played on the half of a HexHex board of size 7.\n\n###\n\n", "completion": "(game \"Pentalath\" (players 2) (equipment { (board (intersect { (hex 7) (shift -5.20 0 (hex Rectangle 7 14))})) (piece \"Marker\" Each)}) (rules (play (do (move Add (to (sites Empty)) (then (\"EncloseCapture\"))) ifAfterwards:(\"HasFreedom\" Orthogonal))) (end (if (is Line 5) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe game is played on a board with twelve points on either side. The points form a continuous track in a horseshoe shape; each player progresses in opposite directions (one from their bottom right to the top right, the other from their bottom left to their top left. Two six-sided die. Each player has 15 pieces. Each player's fifteen pieces begin on the first point of their track. Players move according to the number on each die by moving one piece the value on one die then another piece the value on the other die, or by moving one piece the value of one die and then the value of the other. If doubles are rolled, the player must play the number on each die twice. Play begins with each player throwing the dice. The player who obtains the higher number goes first, except when doubles are thrown, then the opponent must throw higher doubles. The player who wins the opening throw moves the opponent's pieces according to the value of this throw. Play then continues as usual. A piece cannot land on a space occupied by one of the opponent's pieces. Pieces move around the board to the opposite quadrants from the player's starting position. Players may bear a piece off the board once it reaches one of the final six points on the board. Until all of the player's remaining pieces are on the final six points, the player may only bear off a piece on one of the final six spaces by throwing exactly one more than the number of remaining points. The player who bears off all of their pieces wins. The winning player's score equals the number of the opponent's pieces which are left on the board. In addition, whenever a player is unable to move and the opponent is able to, the opponent gains five points. Play continues until one player's score reaches 31.\n \n\n###\n\n", "completion": "(games (subgame \"JulbaharSubgame\" result:(score Mover))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x8 board. Four counters per hole. Players alternate turns taking the counters from one of the holes in their row and sowing them in an anticlockwise direction. When the final counter falls into a hole containing one or three counters, causing it to contain two or four, these counters are captured. Play continues until all of the counters have been captured. The player who captured the most counters wins. \n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (game \"Ntyenge\" (players 2) (equipment { (mancalaBoard 2 8 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 4 to:(sites Track))) (play (move Select (from (sites Mover) if:(> (count at:(from)) 0)) (then (sow apply:(if (or (= 2 (count at:(to))) (= 4 (count at:(to)))) (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to)))))))) (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": "Construct a Ludii game based on the following description\n5x5 board. Twelve pieces per player, arranged in the two rows in front of each player, and in the right two squares in the central row (the central space is empty). Players alternate turns moving a piece to an adjacent orthogonal space. The player may capture an opponent's piece by hopping over it in an orthogonal direction. Multiple hops are allowed in the same turn, but captures are not compulsory, The player who captures all of their opponent's pieces wins. \n\n###\n\n", "completion": "(game \"Koruboddo\" (players 2) (equipment { (board (square 5)) (piece \"Marker\" Each (or (\"HopOrthogonalSequenceCapture\") (\"StepOrthogonalToEmpty\")))}) (rules (start { (place \"Marker1\" (union {(sites Row 0) (sites Row 1) (sites {\"A3\" \"B3\"})})) (place \"Marker2\" (union {(sites Row 3) (sites Row 4) (sites {\"D3\" \"E3\"})}))}) (play (if \"SameTurn\" (or (\"HopOrthogonalSequenceCaptureAgain\") (move Pass)) (forEach Piece))) (end (\"CaptureAll\" Next)))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"FriendOrCentreOrFortress\" (or (\"IsFriendAt\" (to)) (is In (to) (union (sites Centre) (sites \"Fortresses\"))))) (define \"EmptyButNotCentreOrFortress\" (and (not (is In (between) (union (sites Centre) (sites \"Fortresses\")))) (is Empty (between)))) (define \"JarlWasCaptured\" (is Triggered \"Surrounded\" P2)) (define \"CaptureJarl\" (apply (trigger \"Surrounded\" P2))) (define \"Custodial\" (custodial (from (last To)) Orthogonal (between (max 1) if:(= (what at:(between)) (id #1)) (apply (remove (between)))) (to if:\"FriendOrCentreOrFortress\"))) (game \"Tawlbwrdd\" (players 2) (equipment { (board (square 11)) (regions \"Fortresses\" (sites Corners)) (piece \"Thrall\" P1 (move Slide Orthogonal (between if:\"EmptyButNotCentreOrFortress\") (then (or { (\"Custodial\" \"Thrall2\") (custodial (from (last To)) Orthogonal (between (max 1) if:(\"IsPieceAt\" \"Jarl\" P2 (between)) \"CaptureJarl\") (to if:\"FriendOrCentreOrFortress\"))})))) (piece \"Thrall\" P2 (move Slide Orthogonal (between if:\"EmptyButNotCentreOrFortress\") (then (\"Custodial\" \"Thrall1\")))) (piece \"Jarl\" P2 (move Slide Orthogonal (then (\"Custodial\" \"Thrall1\"))))}) (rules (start { (place \"Thrall1\" {\"D1\" \"E1\" \"F1\" \"G1\" \"H1\" \"F2\" \"A4\" \"A5\" \"A6\" \"A7\" \"A8\" \"B6\" \"K4\" \"K5\" \"K6\" \"K7\" \"K8\" \"J6\" \"F10\" \"D11\" \"E11\" \"F11\" \"G11\" \"H11\" \"F10\"}) (place \"Thrall2\" {\"F3\" \"F4\" \"F5\" \"C6\" \"D6\" \"E6\" \"G6\" \"H6\" \"I6\" \"F7\" \"F8\" \"F9\"}) (place \"Jarl2\" (centrePoint))}) (play (forEach Piece)) (end { (\"PieceTypeReachWin\" \"Jarl2\" (sites Outer) P2) (if \"JarlWasCaptured\" (result P1 Win))})))\n\n###\n\n", "completion": "11x11 board. The king is placed in the centre of the board, with his defenders around him and the attackers at the edge of the board. The attackers move first. Pieces move orthogonally any number of spaces. A pieces is captured by surrounding it on two opposite sides, by an opponent's piece. It is possible to capture two or three pieces at once by so surrounding them. It is not possible to capture a row of pieces. The defending player wins the game by moving the king to any square on the edge of the board. The attacking player wins by capturing the king. The rules are describing with the Cyningstan ruleset. END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game is played on a 14x14 board. -> The game is played on a 15x15 board.\n(define \"NumSimultaneousFourInARow\" (+ { (if (\"FourInARow\" N) 1 0) (if (\"FourInARow\" NE) 1 0) (if (\"FourInARow\" E) 1 0) (if (\"FourInARow\" SE) 1 0)})) (define \"FourInARow\" (is Line 4 #1 exact:True)) (define \"MoreThan4InARow\" (is Line 5)) (game \"Yavalax\" (players 2) (equipment { (board (square 14)) (piece \"Marker\" Each)}) (rules phases:{ (phase \"Opening\" (play (move Add (to (sites Empty)))) (nextPhase \"General\")) (phase \"General\" (play (do (move Add (to (sites Empty)) (then (if (\"NewTurn\") (moveAgain)))) ifAfterwards:(and (not (\"MoreThan4InARow\")) (!= 1 (\"NumSimultaneousFourInARow\"))))))} (end (if (<= 2 (\"NumSimultaneousFourInARow\")) (result Mover Win)))))\n\n###\n\n", "completion": "(define \"NumSimultaneousFourInARow\" (+ { (if (\"FourInARow\" N) 1 0) (if (\"FourInARow\" NE) 1 0) (if (\"FourInARow\" E) 1 0) (if (\"FourInARow\" SE) 1 0)})) (define \"FourInARow\" (is Line 4 #1 exact:True)) (define \"MoreThan4InARow\" (is Line 5)) (game \"Yavalax\" (players 2) (equipment { (board (square 15)) (piece \"Marker\" Each)}) (rules phases:{ (phase \"Opening\" (play (move Add (to (sites Empty)))) (nextPhase \"General\")) (phase \"General\" (play (do (move Add (to (sites Empty)) (then (if (\"NewTurn\") (moveAgain)))) ifAfterwards:(and (not (\"MoreThan4InARow\")) (!= 1 (\"NumSimultaneousFourInARow\"))))))} (end (if (<= 2 (\"NumSimultaneousFourInARow\")) (result Mover Win))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(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 { \"KingInTheInitialPlace\" (\"HasNeverMoved\" \"King\") (not (\"IsInCheck\" \"King\" Mover))}) (or (if (and (\"HasNeverMoved\" \"RookLeft\") (can Move (\"DoCastle\" \"RookLeft\" E 3 (is Empty (to))))) \"BigCastling\") (if (and (\"HasNeverMoved\" \"RookRight\") (can Move (\"DoCastle\" \"RookRight\" W 2 (is Empty (to))))) \"SmallCastling\")))) (define \"BigCastling\" (\"DoCastle\" \"King\" W 2 \"KingNotCheckedAndToEmpty\" (then (and (\"PieceHasMoved\") (\"DoCastle\" \"RookLeft\" E 3 True))))) (define \"SmallCastling\" (\"DoCastle\" \"King\" E 2 \"KingNotCheckedAndToEmpty\" (then (and (\"PieceHasMoved\") (\"DoCastle\" \"RookRight\" W 2 True))))) (define \"DoCastle\" (move Slide (from (mapEntry #1 (mover))) #2 (between (exact #3) if:#4) #5)) (define \"KingNotCheckedAndToEmpty\" (and (is Empty (to)) (not (\"IsInCheck\" \"King\" Mover at:(to))))) (define \"RememberPieceHasMoved\" (then (if (= (state at:(last To)) 1) \"PieceHasMoved\"))) (define \"PieceHasMoved\" (set State at:(last To) 0)) (define \"HasNeverMoved\" (= (state at:(mapEntry #1 (mover))) 1)) (define \"KingInTheInitialPlace\" (= (what at:(mapEntry \"King\" (mover))) (id \"King\" Mover))) (define \"NextCanNotMove\" (not (can Move (do (forEach Piece Next) ifAfterwards:(not (\"IsInCheck\" \"King\" Next)))))) (game \"Safe Passage\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (\"ChessPawn\" \"Pawn\" (or \"InitialPawnMove\" \"EnPassant\") (then (and (\"ReplayInMovingOn\" (sites Mover \"Promotion\")) (set Counter)))) (\"ChessRook\" \"Rook\" (then (set Counter)) (\"RememberPieceHasMoved\")) (\"ChessKing\" \"King\" (then (set Counter)) (\"RememberPieceHasMoved\")) (\"ChessBishop\" \"Bishop\" (then (set Counter))) (\"ChessKnight\" \"Knight\" (then (set Counter))) (\"ChessQueen\" \"Queen\" (then (set Counter))) (map \"King\" {(pair 1 \"E1\") (pair 2 \"E8\")}) (map \"RookLeft\" {(pair 1 \"A1\") (pair 2 \"A8\")}) (map \"RookRight\" {(pair 1 \"H1\") (pair 2 \"H8\")}) (regions \"Promotion\" P1 (sites Top)) (regions \"Promotion\" P2 (sites Bottom))}) (rules (start { (place \"Pawn1\" (sites Row 1)) (place \"Pawn2\" (sites Row 6)) (place \"Rook1\" {\"A1\" \"H1\"} state:1) (place \"Knight1\" {\"B1\" \"G1\"}) (place \"Bishop1\" {\"C1\" \"F1\"}) (place \"Queen1\" coord:\"D1\") (place \"King1\" coord:\"E1\" state:1) (place \"Rook2\" {\"A8\" \"H8\"} state:1) (place \"Knight2\" {\"B8\" \"G8\"}) (place \"Bishop2\" {\"C8\" \"F8\"}) (place \"Queen2\" coord:\"D8\") (place \"King2\" coord:\"E8\" state:1)}) (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 Threatened) (result All Loss)) (if (and (\"IsPieceAt\" \"King\" P2 4) (\"IsPieceAt\" \"King\" P1 60)) (result All Win))})))\n\n###\n\n", "completion": "This Chess puzzle uses the same rules as Chess. To win this puzzle you have to swap the positions of the kings. However, if at any point it is possible to capture a piece, you lose. END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nTriangle-8 Board (36) -> Triangle-15 Board (120)\n(define \"EdgesOfSide\" (intersection (sites Outer Edge) (forEach of:(difference #1 (sites Corners Vertex)) (sites Incident Edge of:Vertex at:(site))))) (define \"BoardColour\" (colour 215 203 170)) (define \"P2Colour\" (colour White)) (define \"P1Colour\" (colour DarkGreen)) (define \"IsConnectedPlayer\" (is Connected 3 {\"Side1\" \"Side2\" \"Side3\"})) (define \"DefectorMove\" (priority (move Add (to (sites Occupied by:Next) if:(< \"MoverLimit\" (count Pieces Next in:(sites Around (to) Orthogonal))) (apply (remove (to)))) (then (moveAgain))) (\"AddToEmpty\" ~))) (define \"AddToEmpty\" (move Add (to (sites Empty)) #1)) (define \"MoverLimit\" (count Pieces Mover in:(sites Around (to) Orthogonal))) (define \"Side3\" (union (sites Side NW) (sites Side SW))) (define \"Side2\" (union (sites Side SE) (sites Side S))) (define \"Side1\" (union (sites Side NE) (sites Side N))) (game \"Defector Y\" (players 2) (equipment { (board (tri 8) use:Vertex) (piece \"Disc\" Each) (piece \"Counter\" Neutral maxState:2)}) (rules (play (if True (\"DefectorMove\") (priority (\"AddToEmpty\" (then (moveAgain))) (\"DefectorMove\")))) (end { (if (\"IsConnectedPlayer\") (result Mover Win))})))\n\n###\n\n", "completion": "(define \"EdgesOfSide\" (intersection (sites Outer Edge) (forEach of:(difference #1 (sites Corners Vertex)) (sites Incident Edge of:Vertex at:(site))))) (define \"BoardColour\" (colour 215 203 170)) (define \"P2Colour\" (colour White)) (define \"P1Colour\" (colour DarkGreen)) (define \"IsConnectedPlayer\" (is Connected 3 {\"Side1\" \"Side2\" \"Side3\"})) (define \"DefectorMove\" (priority (move Add (to (sites Occupied by:Next) if:(< \"MoverLimit\" (count Pieces Next in:(sites Around (to) Orthogonal))) (apply (remove (to)))) (then (moveAgain))) (\"AddToEmpty\" ~))) (define \"AddToEmpty\" (move Add (to (sites Empty)) #1)) (define \"MoverLimit\" (count Pieces Mover in:(sites Around (to) Orthogonal))) (define \"Side3\" (union (sites Side NW) (sites Side SW))) (define \"Side2\" (union (sites Side SE) (sites Side S))) (define \"Side1\" (union (sites Side NE) (sites Side N))) (game \"Defector Y\" (players 2) (equipment { (board (tri 15) use:Vertex) (piece \"Disc\" Each) (piece \"Counter\" Neutral maxState:2)}) (rules (play (if True (\"DefectorMove\") (priority (\"AddToEmpty\" (then (moveAgain))) (\"DefectorMove\")))) (end { (if (\"IsConnectedPlayer\") (result Mover Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nAt the beginning of the game, the board is empty except for the central cell which is occupied by a square which belongs to neither player.\n \n The first player plays with crosses, the second with circles.\n Each player, on his turn, must place his marker on the grid onto an empty cell respecting the following rule:\n the marker is dropped from one of the four sides of the board choosing a row or a column, and, proceeding in a straight line so that it goes inside of the board, it stops in front of the first obstacle (a marker of any of the two players, or the central square).\n Pretty much the same as what happens in Connect4, except here there are four dropping directions.\n If the marker reaches the opposite side without encountering any obstacles, the move is illegal.\n \n To win the game you need to be the first to form an horizontal, vertical, or diagonal line of at least five of your markers.\n If there are no available moves, the game ends in a draw. The game is played on a 15x15 board. Look and feel: Retro\n\n###\n\n", "completion": "(define \"DroppableFromDirection\" (and ( (= 0 (count Pieces All in:(sites LineOfSight at:(site) #1))) (= 1 (count Pieces in:(sites Around (site) #2)))))) (game \"Centripetal Force\" (players 2) (equipment { (board (square 15)) (piece \"Cross\" P1) (piece \"Disc\" P2) (piece \"Square\" Neutral)}) (rules (start (place \"Square0\" coord:\"H8\")) (play (move Add (to (forEach (sites Empty) if: (and ( (< 0 (count Pieces in:(sites Around (site) Orthogonal))) (or { (\"DroppableFromDirection\" N S) (\"DroppableFromDirection\" S N) (\"DroppableFromDirection\" W E) (\"DroppableFromDirection\" E W)}))))))) (end { (if (is Line 5) (result Mover Win)) (if (no Moves Next) (result All Draw))}))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"Chaturanga (Kridakausalya 14x14)\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 14)) (\"ChessPawn\" \"Pawn\" ~ (then (if (is In (last To) (sites Mover \"Promotion\")) (and (promote (last To) (piece \"Ferz_noCross\") Mover) (fromTo (from (last To)) (to (last From))))))) (\"ChessRook\" \"Rook\") (\"ChessBishop\" \"Camel\") (\"ChessKing\" \"King_noCross\") (\"ChessBishop\" \"Bishop_noCross\") (piece \"Queen\" Each (\"StepToNotFriend\" Orthogonal)) (\"ChessQueen\" \"Commoner\") (\"ChessRook\" \"Elephant\") (\"ChessKnight\" \"Knight\") (\"ChessQueen\" \"Ferz_noCross\") (regions \"Promotion\" P1 (sites Top)) (regions \"Promotion\" P2 (sites Bottom))}) (rules (start { (place \"Pawn1\" (sites Row 1)) (place \"Elephant1\" {\"A1\" \"N1\"}) (place \"Knight1\" {\"B1\" \"M1\"}) (place \"Bishop_noCross1\" {\"C1\" \"L1\"}) (place \"Rook1\" {\"D1\" \"K1\"}) (place \"Camel1\" {\"E1\" \"J1\"}) (place \"Commoner1\" coord:\"F1\") (place \"Ferz_noCross1\" coord:\"G1\") (place \"King_noCross1\" coord:\"H1\") (place \"Queen1\" coord:\"I1\") (place \"Pawn2\" (sites Row 12)) (place \"Elephant2\" {\"A14\" \"N14\"}) (place \"Knight2\" {\"B14\" \"M14\"}) (place \"Bishop_noCross2\" {\"C14\" \"L14\"}) (place \"Rook2\" {\"D14\" \"K14\"}) (place \"Camel2\" {\"E14\" \"J14\"}) (place \"Commoner2\" coord:\"I14\") (place \"Ferz_noCross2\" coord:\"H14\") (place \"King_noCross2\" coord:\"G14\") (place \"Queen2\" coord:\"F14\")}) (play (if (no Moves Mover) (move Remove (difference (sites Occupied by:Next) (where \"King_noCross\" Next))) (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King_noCross\" Mover))))) (end { (\"Checkmate\" \"King_noCross\") (if (and { (no Pieces Next \"Ferz_noCross\") (no Pieces Next \"Knight\") (no Pieces Next \"Bishop_noCross\") (no Pieces Next \"Elephant\") (no Pieces Next \"Rook\") (no Pieces Next \"Camel\") (no Pieces Next \"Commoner\") (no Pieces Next \"Queen\")}) (result Mover Win))})))\n\n###\n\n", "completion": "14x14 board. Pieces move as follows: Raja (King, x1): moves one space in any direction; Mantri (Minister, placed to the left of the Raja, x1): moves any distance orthogonally or diagonally; Queen (x1, placed to the right of the Raja); moves orthogonally one space; Prince (placed to the left of the Minister, x1), moves orthogonally or diagonally any distance; Ushtra (Camel, x2): moves diagonally any distance; Chariot (x2), moves orthogonally any distance; Flagcar (x2), moves diagonally any distance; Vaha (Horse, x2): move orthogonally one space and then diagonally another, jumping over any intervening pieces; Danti (Elephant, x2): moves orthogonally any distance. Padati (Pawn, x14): move forward orthogonally one space or one space diagonally forward to capture. When a Padati reaches the opposite edge of the board, it is promoted to a Mantri and is moved immediately to the space it last moved from. An opponent's piece is captured by moving one of the player's own pieces onto the space occupied by the opponent's piece. If the Raja can be captured on the opponent's next turn, it is in check. The Raja cannot be in check at the end of the player's turn. If this is impossible, the opponent wins. When a player is reduced to only their Raja and Padati, the opponent wins. In the case of a stalemate, the player in stalemate may remove any of the opponent's pieces (except their Raja).\n END" }, { "prompt": "Construct a Ludii game based on the following description\n7x7 board, with an X in each corner space, the middle space along each side, and the central space. Black plays with thirteen pieces, white plays with ten. Black places the first piece on the central square, then players alternate turns placing a piece on their own half of the board. When all of the pieces are placed, players alternate turns moving pieces one space orthogonally. A piece is captured when it is surrounded on two opposite sides by opponent's pieces, or if it is in the corner and there are two opponent's pieces blocking it from moving. Capturing cannot happen in the placement phase. Black wins if it can block white from being able to move. White wins if it is impossible for black to block them. \n\n###\n\n", "completion": "(game \"Gala (Buginese)\" (players 2) (equipment { (board (square 7)) (piece \"Marker\" Each (\"StepToEmpty\" Orthogonal (then (and (\"CustodialCapture\" Orthogonal (max 1)) (surround (from (last To)) Orthogonal (between if:(and (\"IsEnemyAt\" (between)) (is In (between) (sites Corners))) (apply (remove (between)))) (to if:(\"IsFriendAt\" (to)))))))) (hand Each) (regions \"HalfBoard\" P1 (expand (sites Bottom) steps:3)) (regions \"HalfBoard\" P2 (expand (sites Top) steps:3))}) (rules (start { (place \"Marker1\" (handSite P1) count:13) (place \"Marker2\" (handSite P2) count:10)}) phases:{ (phase \"CentrePlacing\" P1 (play (move (from (handSite P1)) (to (centrePoint)))) (nextPhase \"Placement\")) (phase \"Placement\" P2 (play (if (\"HandOccupied\" Mover) (move (from (handSite Mover)) (to (intersection (sites Empty) (sites Mover)))) (move Pass))) (nextPhase (and (\"HandEmpty\" P1) (\"HandEmpty\" P2)) \"Movement\")) (\"PhaseMovePiece\" \"Movement\" (end { (if (no Moves P2) (result P1 Win)) (if (< (count Pieces P1) 2) (result P2 Win))}))})) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x7 board. Six counters in each hole, except the central hole in each row, which contains one counter. Sowing occurs in an anti-clockwise direction. When the last counter is sown, the player picks up the counters in the next hole in the direction of the sowing and continues sowing with those counters. When the hole after the hole in which the final counter is sown is empty, the counters in the next hole are captured, as well as the counters in the hole opposite this hole, and the turn ends. Sowing cannot begin from the central hole of either row. When a capture would occur from one of these central holes, the counters are not captured until the end of the round. At the end of the round, if both players are eligible to capture from the hole, they split the counters, leaving one in the hole if it is an odd number, or two if it is an even number. If only one player captured from the holes, they leave one counter in each hole. If neither player made a capture from the hole, the counters remain in the hole. \n \n When the players can no longer play, a new round begins. Each player then fills up as many holes, not counting the central holes, on their side of the board with six counters if possible. Any holes that do not contain counters are out of play. Play continues until one player captures all the counters, and is the winner. \n\n###\n\n", "completion": "(define \"SumCentreSites\" (+ (count at:\"BottomCentre\") (count at:\"TopCentre\"))) (define \"TopCentre\" 10) (define \"BottomCentre\" 3) (define \"NoPiecesOnBoardExceptCentre\" (all Sites (difference (sites Board) (sites Centre)) if:(= 0 (count at:(site))))) (define \"OppositePit\" (if (is In #1 (sites Bottom)) (+ #1 \"Columns\") (- #1 \"Columns\"))) (define \"NextHole\" (\"NextSiteOnTrack\" #2 from:#1 \"Track\")) (define \"PlayableSites\" (sites (values Remembered \"Playable\"))) (define \"Columns\" 7) (game \"Omangunta Peeta\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" store:None (track \"Track\" \"0,E,N,W\" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece \"Seed\" Shared) (hand Each)}) (rules (start { (set Count 6 to:(difference (sites Track) (sites Centre))) (set Count 1 to:(sites Centre)) (set RememberValue \"Playable\" (union (sites Top) (sites Bottom)))}) phases:{ (phase \"Sowing\" (play (or { (move Select (from (if (\"SameTurn\") (sites {(var \"Replay\")}) (difference (sites Mover) (sites Centre))) if:(and (is Occupied (from)) (is In (from) (\"PlayableSites\")))) (then (sow apply:(if (is Occupied (\"NextHole\" (to) 1)) (and (moveAgain) (set Var \"Replay\" (to))) (if (is In (\"NextHole\" (to) 2) (sites Centre)) (set Value Mover 1) (and (if (is Occupied (\"NextHole\" (to) 2)) (fromTo (from (\"NextHole\" (to) 2)) (to (handSite Mover)) count:(count at:(\"NextHole\" (to) 2)))) (if (is Occupied (\"OppositePit\" (\"NextHole\" (to) 2))) (fromTo (from (\"OppositePit\" (\"NextHole\" (to) 2))) (to (handSite Mover)) count:(count at:(\"OppositePit\" (\"NextHole\" (to) 2)))))))) skipIf:(and (not (is In (to) (sites Centre))) (not (is In (to) (\"PlayableSites\")))))))} (then (if (\"NoPiecesOnBoardExceptCentre\") (and { (forget Value \"Playable\" All) (if (!= 0 (\"SumCentreSites\")) (if (and (= 1 (value Player P1)) (= 1 (value Player P2))) (if (is Even (\"SumCentreSites\")) (and { (fromTo (from (\"BottomCentre\")) (to Cell (handSite P1)) count:(- (count at:(\"BottomCentre\")) 1)) (fromTo (from (\"TopCentre\")) (to Cell (handSite P1)) count:(- (count at:(\"TopCentre\")) 1)) (fromTo (from Cell (handSite P1)) (to Cell (handSite P2)) count:(/ (- (\"SumCentreSites\") 2) 2))}) (and { (fromTo (from (\"BottomCentre\")) (to Cell (handSite P1)) count:(- (count at:(\"BottomCentre\")) 1)) (fromTo (from (\"TopCentre\")) (to Cell (handSite P1)) count:(count at:(\"TopCentre\"))) (fromTo (from Cell (handSite P1)) (to Cell (handSite P2)) count:(/ (- (\"SumCentreSites\") 1) 2))})) (if (= 1 (value Player P1)) (and (fromTo (from (\"BottomCentre\")) (to Cell (handSite P1)) count:(- (count at:(\"BottomCentre\")) 1)) (fromTo (from (\"TopCentre\")) (to Cell (handSite P1)) count:(- (count at:(\"TopCentre\")) 1))) (if (= 1 (value Player P2)) (and (fromTo (from (\"BottomCentre\")) (to Cell (handSite P2)) count:(- (count at:(\"BottomCentre\")) 1)) (fromTo (from (\"TopCentre\")) (to Cell (handSite P2)) count:(- (count at:(\"TopCentre\")) 1)))))))}))))) (end (if (\"NoPiecesOnBoardExceptCentre\") { (if (= 0 (count Cell at:(handSite P1))) (result P2 Win)) (if (= 0 (count Cell at:(handSite P2))) (result P1 Win))})) (nextPhase (\"NoPiecesOnBoardExceptCentre\") \"BetweenRounds\")) (phase \"BetweenRounds\" (play (if (not (all Sites (difference (sites Mover) (sites Centre)) if:(is Occupied (site)))) (if (<= 6 (count Cell at:(handSite Mover))) (move (from Cell (handSite Mover)) (to (difference (sites Mover) (sites Centre)) if:(is Empty (to))) count:6 (then (remember Value \"Playable\" (last To))))))) (nextPhase (all Passed) \"Sowing\"))})) END" }, { "prompt": "Construct a Ludii game based on the following description\nGoal: Connect all three edge colors with a single group of connected stones of your own color. (As in 'Y') \n \n First turn is a single move. In the standard game subsequent turns have two placements each. The player seeking to connect with the darker color starts.\n \n The moves consist of two parts: placement, then conditional 'flipping' of stones:\n - Placement is to any empty location.\n - 'Flipping' means changing the color of a stone that has more neighbors of its own color than enemy neighbors. \n \n Flipping is restricted to the selected option. Stones are flipped one at a time until no more can flip.\n \n Options are:\n -- 00'Y': All - Each applicable stone flips, one at a time with cascading effects, until no more can flip.\n -- Defector Y: Enemies flip into Friends - these might be pieces near/at the stone just placed placed, and/or a stone the opponent flipped.\n -- Friends flip into Enemies - these might be pieces near/at the opponent's last placements or flips.\n \n The first player to connect all 3 sides after the all flips have been made is the winner. Turns 122* All, Cascading (00'Y') Win with connections before you start your move. Hex 4-5 Board (48)\n\n###\n\n", "completion": "(define \"EdgesOfSide\" (intersection (sites Outer Edge) (forEach of:(difference #1 (sites Corners Vertex)) (sites Incident Edge of:Vertex at:(site))))) (define \"BoardColour\" (colour 215 203 170)) (define \"P2Colour\" (colour White)) (define \"P1Colour\" (colour DarkGreen)) (define \"IsConnectedAtStartOfFirstMove\" (and (is Next (next)) (\"IsConnectedPlayer\")) (and (= 1) (\"IsConnectedPlayer\"))) (define \"IsWinningConnectionAtSite\" (is Connected 3 at:#1 { \"Side1\" \"Side2\" \"Side3\"})) (define \"StonesOfIn\" (intersection (sites Occupied by:#1) #2)) (define \"FlipFromTo\" (move Add (piece (id \"Disc\" #2)) (to (sites Occupied by:#1) if:(< (\"NeighborCountOf\" #2) ((\"NeighborCountOf\" #1))) (apply (remove (to)))))) (define \"AddToEmpty\" (move Add (to (sites Empty)) (then (set Var \"MoveInTurn\" (% (+ 3 (var \"MoveInTurn\")) 2))))) (define \"NeighborCountOf\" (count Pieces #1 in:(sites Around (to) Orthogonal))) (define \"Side3\" (union (sites Side NW) (sites Side SW))) (define \"Side2\" (union (sites Side SE) (sites Side S))) (define \"Side1\" (union (sites Side NE) (sites Side N))) (define \"AnyOfTheseSitesMeetThisCondition\" (< 0 (size Array (array (forEach #1 #2))))) (game \"00'Y'\" (players 2) (equipment { (board (tri Limping 4) use:Vertex) (piece \"Disc\" Each) (piece \"Counter\" Neutral maxState:2)}) (rules (play (priority { (if (\"SameTurn\") (or (\"FlipFromTo\" Next Mover) (\"FlipFromTo\" Mover Next))) (\"AddToEmpty\")} (then (if (or (= 1 (var \"MoveInTurn\")) (can Move (or (\"FlipFromTo\" Next Mover) (\"FlipFromTo\" Mover Next)))) (moveAgain) (if (\"AnyOfTheseSitesMeetThisCondition\" (sites Occupied by:Next) if:(\"IsWinningConnectionAtSite\" (site))) (trigger \"Win\" Next)))))) (end { (if (is Triggered \"Win\" Next) (result Next Win)) (if (and (no Moves Mover) (\"AnyOfTheseSitesMeetThisCondition\" (sites Occupied by:Next) if:(\"IsWinningConnectionAtSite\" (site)))) (result Next Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe game is played on a 10x10 board. Four of the squares are marked and are considered to contain a watering hole.\n Each player has two elephants, two lions and two mice.\n \n Pieces do not take other pieces. Their movement is as follows: mice move like rooks, lions move like bishops, and elephants move like queens.\n \n Like their chess counterparts, the pieces cannot jump over other pieces.\n \n A mouse is afraid of a lion of the opponent; a lion is afraid of an elephant of the opponent, and an elephant is afraid of a mouse of the opponent.\n \n An animal may not move to a square that is adjacent (horizontally, vertically or diagonally) to an animal it is afraid of. In addition, if an animal is adjacent to an animal that it is afraid of, then it must be moved by its owner, i.e., the owner may not move another animal.\n \n In the special case that more than one animal is adjacent to an animal it is afraid of, the owner may choose which animal to move.\n \n One wins the game by occupying three of the watering holes with own pieces. \n\n###\n\n", "completion": "(define \"ThreePiecesInWater\" (= 3 (count Sites in:(intersection (sites Occupied by:Mover) (sites \"Water\"))))) (define \"IsAround\" (is In (from) (sites Around (sites Occupied by:Next component:#1)))) (define \"LionMove\" (\"SlideMove\" Diagonal \"Elephant\")) (define \"ElephantMove\" (\"SlideMove\" All \"Mouse\")) (define \"MouseMove\" (\"SlideMove\" Orthogonal \"Lion\")) (define \"SlideMove\" (move Slide #1 (to (apply if:(all Sites (sites Around (to)) if:(!= (what at:(site)) (id #2 Next))))))) (game \"Barca\" (players 2) (equipment { (board (square 10)) (piece \"Mouse\" Each (\"MouseMove\")) (piece \"Elephant\" Each (\"ElephantMove\")) (piece \"Lion\" Each (\"LionMove\")) (regions \"Water\" (sites {\"D4\" \"D7\" \"G4\" \"G7\"}))}) (rules (start { (place \"Elephant1\" (sites {\"E1\" \"F1\"})) (place \"Lion1\" (sites {\"D2\" \"G2\"})) (place \"Mouse1\" (sites {\"E2\" \"F2\"})) (place \"Elephant2\" (sites {\"E10\" \"F10\"})) (place \"Lion2\" (sites {\"D9\" \"G9\"})) (place \"Mouse2\" (sites {\"E9\" \"F9\"}))}) (play (priority { (and { (forEach Piece \"Mouse\" (if (\"IsAround\" \"Lion\") (\"MouseMove\"))) (forEach Piece \"Elephant\" (if (\"IsAround\" \"Mouse\") (\"ElephantMove\"))) (forEach Piece \"Lion\" (if (\"IsAround\" \"Elephant\") (\"LionMove\")))}) (forEach Piece)})) (end (if (\"ThreePiecesInWater\") (result Mover Win))))) 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(define \"Nbors\" (count Sites in:(intersection (sites Around #1) (sites Occupied by:#2)))) (game \"Trike\" (players 2) (equipment { (board (hex Triangle 3)) (piece \"Marker\" Each)}) (rules (meta (swap)) phases:{ (phase \"Opening\" P1 (play (move Add (to (sites Empty)) (then (set Var (last To))))) (nextPhase)) (phase \"Play\" (play (move Add (to (sites LineOfSight Empty at:(var))) (then (set Var (last To))))))} (end (if (no Moves Next) (byScore { (score P1 (+ (if (is Mover P1) 1 0) (\"Nbors\" (last To) P1))) (score P2 (+ (if (is Mover P2) 1 0) (\"Nbors\" (last To) P2)))})))))\n\n###\n\n", "completion": "(define \"Nbors\" (count Sites in:(intersection (sites Around #1) (sites Occupied by:#2)))) (game \"Trike\" (players 2) (equipment { (board (hex Triangle 4)) (piece \"Marker\" Each)}) (rules (meta (swap)) phases:{ (phase \"Opening\" P1 (play (move Add (to (sites Empty)) (then (set Var (last To))))) (nextPhase)) (phase \"Play\" (play (move Add (to (sites LineOfSight Empty at:(var))) (then (set Var (last To))))))} (end (if (no Moves Next) (byScore { (score P1 (+ (if (is Mover P1) 1 0) (\"Nbors\" (last To) P1))) (score P2 (+ (if (is Mover P2) 1 0) (\"Nbors\" (last To) P2)))}))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nResolve is a connection game for two players: a player with Black stones who wins by connecting the East/West sides, and a player with White stones who wins by connecting the North/South sides. Players take turns placing and swapping stones on the intersections of a square grid which is initially empty. Passing is forbidden. Same-colored stones with orthogonal adjacency are connected. The game is over when a player wins by connecting their designated sides of the board with a single group of connected stones of their color, at any time during their turn or their opponent's turn. Cutting stones are any four stones in a generic crosscut configuration. \n \n OX\n XO\n \n On your turn you must select the following one of two actions. \n 1. Place a stone of your color on an empty point. If that stone creates a crosscut, swap it with different adjacent enemy stones that share a crosscut with it, until that stone is no longer part of a crosscut. \n 2. Choose a stone of your color that is part of a crosscut, and use it to resolve crosscuts as in 1. Then place a stone of your color on an empty point, if possible. Order 9 board\n\n###\n\n", "completion": "(define \"Invisible\" (colour 0 0 0 0)) (define \"ColourBackground\" (colour LightTan)) (define \"SquareGrid\" (board (square 9) use:Vertex)) (define \"ResolveTheValue\" (forEach Site (intersection (sites Around #1 Orthogonal) (sites Around (\"CrosscutSites\" #1) Orthogonal)) (move (from #1) (to (site) if:(!= (last From) (to)) (apply (remove (site)))) (then (and (add (piece (id \"Ball\" Next)) (to (var \"LT\"))) (set Var \"LT\" (last To) (then (if (\"HasCrosscuts\" (var \"LT\")) (set NextPlayer (player (mover))) (set Var \"LT\" -1))))))))) (define \"Choose2Resolve\" (forEach Site (sites Occupied by:Mover) (do (set Var \"LT\" (site)) next:(\"ResolveTheValue\" (var \"LT\"))))) (define \"Place\" (move Add (to (sites Empty)) (then (if (and (\"NewTurn\") (\"HasCrosscuts\" (last To))) (set Var \"LT\" (last To) (then (moveAgain))) (set Var \"LT\" -1))))) (define \"HasCrosscuts\" (< 0 (count Sites in:(\"CrosscutSites\" #1)))) (define \"CrosscutSites\" (sites (results from:#1 to:(sites Around (from) Diagonal if:(and (is Mover (who at:(to))) (= 2 (count Pieces Next in:(intersection (sites Around (to) Orthogonal) (sites Around (from) Orthogonal)))))) (to)))) (game \"Resolve\" (players 2) (equipment { \"SquareGrid\" (regions P1 {(sites Side N) (sites Side S)}) (regions P2 {(sites Side W) (sites Side E)}) (piece \"Ball\" P1) (piece \"Ball\" P2)}) (rules (play (if (\"NewTurn\") (or (\"Place\") (\"Choose2Resolve\")) (if (<= 0 (var \"LT\")) (\"ResolveTheValue\" (var \"LT\")) (\"Place\")))) (end { (if (is Connected Orthogonal Mover) (result Mover Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayed on an 8x8 checkered board, with large diagonals drawn on the inner square 4x4 spaces. Four players, seated, from top left, anti-clockwise: red, black, white, green. Each player has four pawns, a knight, a fil, a rook, and a king. The kings begin in the corner space, with the knight to the adjacent square in the row with the king, the rook in the square in the column adjacent to the king, and the fil in the remaining 2x2 square in the corner. The pawns are placed on the orthogonally adjacent squares to this formation. Pieces move as follows: King: One square in any direction. Knight: As a knight in Chess. Rook: Orthogonally any number of spaces. Fil: moves diagonally two spaces, jumping over any piece in the intervening square. Pawns: move forward along the direction of their nearest edge, but capture diagonally forward. Upon reaching the opposite edge of the board, pawns are immediately promoted to \\ \n\n###\n\n", "completion": "(define \"RightPlayer\" (if (is Mover P1) (if (is Active P2) 2 (if (is Active P3) 3 4)) (if (is Mover P2) (if (is Active P3) 3 (if (is Active P4) 4 1)) (if (is Mover P3) (if (is Active P4) 4 (if (is Active P1) 1 2)) (if (is Active P1) 1 (if (is Active P2) 2 3)))))) (define \"PawnMove\" (or { \"StepForwardToEmpty\" \"CaptureForwardDiagonal\"} (then (\"PromoteIfReach\" (sites #1) \"Queen\")))) (define \"CaptureForwardDiagonal\" (move Step (directions {FR FL}) (to if:(= (\"RightPlayer\") (who at:(to))) (\"CapturePiece\")))) (define \"CapturePiece\" (apply (if (= (\"RightPlayer\") (who at:(to))) (and (remove (to)) (and (note player:Next \"Pays into the pot\" to:Next) (set Pot (+ (pot) (amount Next)))))))) (define \"NextCanNotMove\" (not (can Move (do (forEach Piece Next) ifAfterwards:(not (\"IsInCheck\" \"King\" Next)))))) (define \"EmptyorNext\" (or (is Empty (to)) (= (\"RightPlayer\") (who at:(to))))) (game \"Acedrex de los Cuatros Tiempos\" (players 4) (equipment { (board (square 8)) (piece \"King\" Each (move Step (to if:(\"EmptyorNext\") (\"CapturePiece\")))) (piece \"Pawn\" P1 W (\"PawnMove\" Left)) (piece \"Pawn3d\" P1 N (\"PawnMove\" Top)) (piece \"Pawn\" P2 W (\"PawnMove\" Left)) (piece \"Pawn3d\" P2 S (\"PawnMove\" Bottom)) (piece \"Pawn\" P3 E (\"PawnMove\" Right)) (piece \"Pawn3d\" P3 S (\"PawnMove\" Bottom)) (piece \"Pawn\" P4 E (\"PawnMove\" Right)) (piece \"Pawn3d\" P4 N (\"PawnMove\" Top)) (piece \"Knight\" Each (move Leap \"KnightWalk\" (to if:(\"EmptyorNext\") (\"CapturePiece\")))) (piece \"Rook\" Each (move Slide Orthogonal (to if:(= (\"RightPlayer\") (who at:(to))) (\"CapturePiece\")))) (piece \"Bishop\" Each (move Hop Diagonal (between if:True) (to if:(\"EmptyorNext\") (\"CapturePiece\")))) (piece \"Queen\" Each (move Step Diagonal (to if:(\"EmptyorNext\") (\"CapturePiece\"))))}) (rules (start { (place \"King1\" coord:\"H1\") (place \"Knight1\" coord:\"G1\") (place \"Rook1\" coord:\"H2\") (place \"Bishop1\" coord:\"G2\") (place \"Pawn1\" {\"F1\" \"F2\"}) (place \"Pawn3d1\" {\"G3\" \"H3\"}) (place \"King2\" coord:\"H8\") (place \"Knight2\" coord:\"G8\") (place \"Rook2\" coord:\"H7\") (place \"Bishop2\" coord:\"G7\") (place \"Pawn2\" {\"F8\" \"F7\"}) (place \"Pawn3d2\" {\"H6\" \"G6\"}) (place \"King3\" coord:\"A8\") (place \"Knight3\" coord:\"B8\") (place \"Rook3\" coord:\"A7\") (place \"Bishop3\" coord:\"B7\") (place \"Pawn3\" {\"C7\" \"C8\"}) (place \"Pawn3d3\" {\"A6\" \"B6\"}) (place \"King4\" coord:\"A1\") (place \"Knight4\" coord:\"B1\") (place \"Rook4\" coord:\"A2\") (place \"Bishop4\" coord:\"B2\") (place \"Pawn4\" {\"C1\" \"C2\"}) (place \"Pawn3d4\" {\"A3\" \"B3\"})}) phases:{ (phase \"Betting\" (play (move Bet Mover (range 0 100))) (nextPhase Mover)) (phase \"Playing\" (play (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King\" Mover)) (then (if (\"IsInCheck\" \"King\" Next) (if (\"NextCanNotMove\") (forEach Site (sites Occupied by:Next) (and (remove (to)) (and (note player:Next \"Pays into the pot\" to:Next) (set Pot (+ (pot) (amount Next)))))) (and (note player:Next \"Pays into the pot\" to:Next) (set Pot (+ (pot) (amount Next))))))))))} (end (if (no Pieces Next) (result Next Loss))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nIn standard chess, the captured piece is removed from the board and the capturing piece takes its place. In atomic chess, a capture causes an \\ \n\n###\n\n", "completion": "(define \"CaptureForwardDiagonal\" (\"StepToEnemy\" (directions {FR FL}) (then (and { (remove (last To)) (\"Boom\" (last To))})))) (define \"EnPassant\" (move Step (directions {FR FL}) (to if:\"InLocationEnPassant\") (then (and { (remove (ahead (last To) Backward)) (remove (last To)) (\"Boom\" (last To))})))) (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 \"CaptureToPieceAndResetCounter\" (apply (if (\"IsEnemyAt\" (to)) (and { (remove (to)) (\"Boom\" (to)) (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)))))) (define \"Boom\" (forEach Site (sites Around #1 includeSelf:False) (if (and { (is Occupied (site)) (and (not (\"IsPieceAt\" \"Pawn\" P1 (site))) (not (\"IsPieceAt\" \"Pawn\" P2 (site))))}) (remove (site))))) (game \"Atomic Chess\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (piece \"Pawn\" Each (or { (if (is In (from) (sites Start (piece (what at:(from))))) (\"DoubleStepForwardToEmpty\" \"SetEnPassantLocation\")) \"StepForwardToEmpty\" \"CaptureForwardDiagonal\" \"EnPassant\"} (then (and (if (is In (last To) (sites Mover \"Promotion\")) (moveAgain)) (set Counter))))) (piece \"Rook\" Each (move Slide Orthogonal (to if:(\"IsEnemyAt\" (to)) \"CaptureToPieceAndResetCounter\") (\"RememberPieceHasMoved\"))) (piece \"King\" Each (move Step (to if:(is Empty (to))) (\"RememberPieceHasMoved\"))) (piece \"Bishop\" Each (move Slide Diagonal (to if:(\"IsEnemyAt\" (to)) (\"CaptureToPieceAndResetCounter\")))) (piece \"Knight\" Each (move Leap \"KnightWalk\" (to if:(not (\"IsFriendAt\" (to))) (\"CaptureToPieceAndResetCounter\")))) (piece \"Queen\" Each (move Slide (to if:(\"IsEnemyAt\" (to)) (\"CaptureToPieceAndResetCounter\")))) (map \"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:(and (not (\"IsInCheck\" \"King\" Mover)) (\"IsNotOffBoard\" (where \"King\" Mover)))))) (end { (if (or (and (\"IsInCheck\" \"King\" Next) (\"NextCanNotMove\")) (\"IsOffBoard\" (where \"King\" Next))) (result Mover Win)) (if (or (no Moves Mover) (= (counter) 99)) (result Mover Draw))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nA circle, with four points equally spaced along the circumference, as well as a point in the center. A diameter is drawn between two of the outer points and through the center. Two players. Two pieces per player. Players alternate turns placing a piece on the board. When all of the pieces are placed, players alternate turns moving a piece to an empty adjacent point along the lines. The player who blocks the other player from being able to move wins. \n\n###\n\n", "completion": "(game \"Dorvon Cag\" (players 2) (equipment { (board (remove (concentric {1 4}) edges:{{1 0} {0 3}}) use:Vertex) (hand Each) (piece \"Disc\" Each \"StepToEmpty\")}) (rules (start (place \"Disc\" \"Hand\" count:2)) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (\"PhaseMovePiece\" \"Movement\")} (end (\"BlockWin\")))) 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 Ludii game based on the following description\nEach player starts off with 15 balls. Players take turns taking pieces from their reserve pile, and placing them on a 4x4 game board made up of 16 indentations. When four pieces are placed next to each other in a square, one piece can be put on top of the square. That piece can also be one of the player pieces on the board with no other piece on top of it. If the square is completed with all the same color, the player of that color may take two of their own pieces from the board (one or two that are not supporting anything) and put it back into their reserve pile. At the end of the game, the game board should have 4 levels. The first level with 16 pieces, the second level with 9 pieces, the third level with 4 pieces, and the fourth level with 1 piece. A player wins if they put the last piece on the 4th level. \n\n###\n\n", "completion": "(define \"NothingOnTop\" (and { (\"NothingOn\" UNE) (\"NothingOn\" USE) (\"NothingOn\" USW) (\"NothingOn\" UNW)})) (define \"NothingOn\" (if (!= (from) (ahead (from) #1)) (is Empty (ahead (from) #1)) True)) (game \"Pylos\" (players 2) (equipment { (board (square 4 pyramidal:True) use:Vertex) (piece \"Ball\" Each) (hand Each)}) (rules (start (place \"Ball\" \"Hand\" count:15)) (play (if \"SameTurn\" (move (from (sites Occupied by:Mover) if:(\"NothingOnTop\")) (to (handSite Mover)) (then (if (= (var) 1) (and (set Var 0) (moveAgain))))) (or (do (move (from (sites Occupied by:Mover) if:(\"NothingOnTop\")) (to (sites Empty) if:(and (is Flat) (< (layer of:(from)) (layer of:(to)))))) ifAfterwards:(is Flat (last To))) (move (from (sites Occupied by:Mover container:(mover))) (to (sites Empty) if:(is Flat))) (then (if (is Pattern {F R F R F} whats:{(id \"Ball\" Mover)}) (and (set Var 1) (moveAgain))))))) (end (if (= (layer of:(last To)) 3) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nMOVE - On each turn, each player move one of his stones into an adjacent orthogonal empty cell.\n GOAL - Wins the player that makes a (orthogonal or diagonal) 3 in-a-row. \n\n###\n\n", "completion": "(game \"A Simple Game\" (players 2) (equipment { (board (square 4) use:Vertex) (piece \"Ball\" Each (\"StepToEmpty\" Orthogonal)) (hand Each)}) (rules (start { (place \"Ball1\" (intersection (sites Phase 0) (union (sites Top) (sites Bottom)))) (place \"Ball2\" (intersection (sites Phase 1) (union (sites Top) (sites Bottom))))}) (play (forEach Piece)) (end (\"Line3Win\" All)))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"NextHoleFrom\" (\"NextSiteOnTrack\" 1 from:#1 #2)) (define \"AHoleHasMoreThanOneCounter\" (not (all Sites (forEach (sites Mover) if:(< 1 (count at:(site)))) if:(= 0 (count at:(site)))))) (define \"NoPiece\" (all Sites (sites Player \"Home\") if:(= 0 (count at:(site))))) (define \"Columns\" 8) (game \"Tsoro\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"0,E,N1,W\" loop:True P1) (track \"Track2\" \"16,E,N1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"Track1\")) (regions \"Home\" P2 (sites Track \"Track2\")) (regions \"Inner\" P1 (difference (sites Track \"Track1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"Track2\") (sites Top))) (piece \"Seed\" Shared)}) (rules (start (set Count 2 to:(union (sites Top) (sites Bottom)))) (play (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(if \"AHoleHasMoreThanOneCounter\" (> (count at:(from)) 1) (and (= (count at:(from)) 1) (= 0 (count at:(\"NextHoleFrom\" (from) Mover)))))) (then (sow \"Track\" owner:(mover) apply:(if (= (count at:(to)) 1) (if (is In (to) (sites Mover \"Inner\")) (if (> (count at:(\"OppositePit\" (to))) 0) (and (remove (\"OppositePit\" (to))) (if (> (count at:(\"OppositeOuterPit\" (to))) 0) (remove (\"OppositeOuterPit\" (to))))))) (moveAgain)))))) (end (forEach NonMover if:(\"NoPiece\") (result Player Loss)))))\n\n###\n\n", "completion": "4x6-21 board; 8 is most common, 12, 15, and 18 are also popular. Two counters in each hole in the players' outer rows. Sowing occurs in an anti-clockwise direction, only in the two rows belonging to the player. When the final counter lands in an occupied hole, these are picked up and sowing continues. When the final counter lands in an empty hole in the inner row, any counters in the opposite hole in the opponent's inner row are captured. If there also are counters in the opposite hole in the opponent's outer row, these are also captured, but only if there was first a capture from the inner row hole. Players cannot sow from a hole with a single counter unless there are no holes with multiple counters. Single counters can only be sown into an empty hole. Play continues until one player has captured all of the opponent's counters, thus winning the game. 8 Holes per row. END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6 board, one store on either end. Four counters in each hole. Sowing occurs in an anti-clockwise direction and begins in the player's row. When the final counter lands in an occupied hole which is not followed by an empty hole, the contents are picked up and sowing continues. If the final counter falls in an occupied hole followed by an empty hole, or if it falls into an empty hole, the turn ends. Sowing always skips the hole from which the sowing began if it goes all the way around the board. When the final counter falls into an occupied hole in the opponent's row containing three counters, these are captured and the turn ends. Any holes in the opponent's row containing four counters in an unbroken consecutive sequence behind this hole are also captured. Single counters can only be sowed when the next hole is empty. Play continues until one player can no longer play. The player who has captured the most counters wins. \n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (count at:(mapEntry #1))) (define \"NextHoleFrom\" (\"NextSiteOnTrack\" #3 from:#1 #2)) (game \"Kay\" (players 2) (equipment { (mancalaBoard 2 6 (track \"Track\" \"1,E,N,W\" loop:True)) (piece \"Seed\" Shared) (regions \"Home\" P1 (sites Bottom)) (regions \"Home\" P2 (sites Top)) (map {(pair P1 FirstSite) (pair P2 LastSite)})}) (rules (start (set Count 4 to:(sites Track))) (play (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover)) if:(or (< 1 (count at:(from))) (and (= 1 (count at:(from))) (is Empty (\"NextHoleFrom\" (from) \"Track\" 1))))) (then (sow if:True apply:(if (= 4 (count at:(to))) (fromTo (from (to)) (to (mapEntry Mover)) count:(count at:(to))) (if (< 1 (count at:(to))) (if (is Occupied (\"NextHoleFrom\" (to) \"Track\" 1)) (moveAgain)))) includeSelf:False backtracking:(= 4 (count at:(to))))))) (end (\"MancalaByScoreWhen\" (no Moves Next))))) 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. Two six-sided dice. Play occurs only in two quadrants of the board, opposite one another, a player's pieces only leaving their quadrant to bear off. Two pieces are stacked each on the first three points, and three are stacked in the second three points. Players use throws to unstack pieces on their points, unstacking one piece per die which corresponds to that point. Doubles allow the player to unstack or bear off a number of pieces equal to the total number of the throw. When all of the pieces are unstacked, that player may begin bearing their pieces off. Players move according to the number on each die by moving one piece the value on one die then another piece the value on the other die, or by moving one piece the value of one die and then the value of the other. The first player to bear off all their pieces wins. \n\n###\n\n", "completion": "(define \"UnstackHalf\" (forEach Level (last To) (set State at:(last To) level:(level) 1))) (define \"UnstackFull\" (forEach Level (last To) (set State at:(last To) level:(level) 2))) (define \"PieceStacked\" (or (\"PieceFullStacked\" #1) (\"PieceHalfStacked\" #1))) (define \"PieceHalfStacked\" (= (state at:#1) 1)) (define \"PieceFullStacked\" (= (state at:#1) 0)) (define \"PieceUnstacked\" (= (state at:#1) 2)) (define \"BearOff\" (move Remove #1)) (define \"SiteToSelect\" (\"NextSiteOnTrack\" (- (pips) 1) from:(mapEntry \"StartTrack\" (mover)))) (game \"Dubblets\" (players 2) (equipment { (\"BackgammonBoard\" { (track \"Track1\" {0..5} P1 directed:True) (track \"Track2\" {13..18} P2 directed:True)}) (dice d:6 num:2) (piece \"Disc\" Each (forEach Die if:(\"DieNotUsed\") (if (\"IsOffBoard\" (\"NextSiteOnTrack\" (pips))) (\"BearOff\" (from)) (move (from) (to (\"NextSiteOnTrack\" (pips))))))) (hand Each) (map \"StartTrack\" {(pair P1 0) (pair P2 13)})}) (rules (start { (place Stack \"Disc1\" (sites {0..2}) count:2) (place Stack \"Disc1\" (sites {3..5}) count:3) (place Stack \"Disc2\" (sites {13..15}) count:2) (place Stack \"Disc2\" (sites {16..18}) count:3)}) phases:{ (phase \"UnStacking\" (play (\"RollEachNewTurnMove\" (if (or (< 0 (var \"Double\")) (all DiceEqual)) (do (if (>= 0 (var \"Double\")) (set Var \"Double\" (count Pips))) next:(forEach Site (sites Occupied by:Mover) (if (\"PieceFullStacked\" (site)) (move Select (from (site)) (then (if (= 3 (size Stack at:(last To))) (\"UnstackHalf\") (\"UnstackFull\")))) (if (\"PieceHalfStacked\" (site)) (move Select (from (site)) (then (\"UnstackFull\"))))) (then (and (if (< 1 (var \"Double\")) (moveAgain)) (set Var \"Double\" (- (var \"Double\") 1)))))) (forEach Die if:(\"DieNotUsed\") (or (if (\"PieceFullStacked\" \"SiteToSelect\") (move Select (from (\"SiteToSelect\")) (then (and (if (= 3 (size Stack at:(last To))) (\"UnstackHalf\") (\"UnstackFull\")) (\"ReplayNotAllDiceUsed\"))))) (if (\"PieceHalfStacked\" \"SiteToSelect\") (move Select (from (\"SiteToSelect\")) (then (and (\"UnstackFull\") (\"ReplayNotAllDiceUsed\")))))))))) (nextPhase Mover (all Sites (sites Occupied by:Mover) if:(not (\"PieceStacked\" (site)))) \"BearingOff\")) (phase \"BearingOff\" (play (do (if (\"NewTurn\") (roll)) next:(if (or (< 0 (var \"Double\")) (all DiceEqual)) (do (if (>= 0 (var \"Double\")) (set Var \"Double\" (count Pips))) next:(forEach Site (sites Occupied by:Mover) (\"BearOff\" (site)) (then (and (if (< 1 (var \"Double\")) (moveAgain)) (set Var \"Double\" (- (var \"Double\") 1)))))) (forEach Piece top:True)) (then (\"ReplayNotAllDiceUsed\")))) (end (\"EscapeWin\")))})) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"Dam Hariman\" (players 2) (equipment { (\"AlquerqueBoardWithBottomAndTopTriangles\") (piece \"Marker\" Each (or (\"HopSequenceCapture\") (\"StepToEmpty\")))}) (rules (start { (place \"Marker1\" (union {(sites Row 0) (sites Row 1) (sites Row 2) (sites Row 3)})) (place \"Marker2\" (union {(sites Row 5) (sites Row 6) (sites Row 7) (sites Row 8)}))}) (play (if \"SameTurn\" (or (\"HopSequenceCaptureAgain\") (move Pass)) (forEach Piece))) (end (\"NoMoves\" Loss))))\n\n###\n\n", "completion": "5x5 intersecting lines and with a triangular appendage on either side. Each player has sixteen pieces, which are placed on the intersections and move along the lines to the next open intersection. Players can hop opponents pieces to capture them. Multiple captures in one turn are allowed. A player wins when they capture all of the opponent's pieces or block them from being able to move.\n 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 Ludii game based on the following description\nGoal: Score stones where exactly half of the available neighbor sites are occupied by friendly stones at the end of the game.\n The player with the highest score wins.\n \n Start with an empty board. Then on each turn the player adds one of his stones to the board, or passes.\n \n The game ends when both players pass consecutively, and then the score is calculated.\n \n In case of a tie, the last to place a stone loses.\n \n Variant Placement: Add 2 stones at a time after the first placement.\n Variant Goal: Score stones that have exactly 3 friendly neighbors at the end of the game. Goldilock stone has exactly half of the adjacent cells friendly Turns Alternate one stone per turn Hex N+1 / N-1 Grid Order 4 board\n\n###\n\n", "completion": "(define \"DoubleMove\" (then (if (and (is Prev Next) (not (was Pass))) (moveAgain)))) (define \"HexCell\" (board (hex Hexagon 4) use:Cell)) (define \"Hex2Limp\" (board (hex (- 4 1) (+ 4 1)) use:Cell)) (define \"HexLimp\" (board (hex Limping (- 4 1)) use:Cell)) (define \"BoardUsed\" \"Hex2Limp\") (define \"Connection\" Orthogonal) (define \"ScoreHalf\" (forEach Piece (if (= (* 2 (count Pieces Mover in:(sites Around (from) Orthogonal))) (count Sites in:(sites Around (from) Orthogonal))) (set State at:(from) 1) (set State at:(from) 0)) (then (set Score Mover (count Sites in:(intersection (sites Occupied by:Mover) (sites State 1))))))) (define \"Score3\" (forEach Piece (if (= 3 (count Pieces Mover in:(sites Around (from) Orthogonal))) (set State at:(from) 1) (set State at:(from) 0)) (then (set Score Mover (count Sites in:(intersection (sites Occupied by:Mover) (sites State 1))))))) (game \"Goldilocks Stones\" (players 2) (equipment { \"BoardUsed\" (piece \"Ball\" P1) (piece \"Ball\" P2)}) (rules (start (set Score Each 0)) (play (or (move Pass) (move Add (piece (mover)) (to (sites Empty)) (then \"ScoreHalf\")))) (end (if (all Passed) { (if (= (score Mover) (score Next)) (result Mover Loss)) (if (!= (score Mover) (score Next)) (byScore))})))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlay begins with four counters in each hole. Players move by picking up all of the counters in any of the holes in their row and sowing them anti-clockwise. If the next hole after the one in which the final counter is dropped contains counters, these are picked up and sowing continues. If the next hole after the one in which the last counter was sown is empty, the counters in the hole after this one are taken and the turn is over. If that hole is empty, none are taken. When all of the holes in one row are empty, the player whose row still contains counters captures these counters. A new game begins. Each player fills as many of the holes in their row with four counters. The player which cannot fill all of their holes with four counters removes from play all of the holes that cannot be filled, and sets aside the extra counters. They play another round with the same rules as before, but without the eliminated hole(s). The game ends when one player must close all of the holes in their row, thus being unable to play. \n\n###\n\n", "completion": "(define \"NoOwnedHoles\" (if (= #1 P1) (= 0 (size Array (values Remembered \"OwnedP1\"))) (= 0 (size Array (values Remembered \"OwnedP2\"))))) (define \"ForgetValue\" (if (is Mover P1) (forget Value \"OwnedP1\" #1) (forget Value \"OwnedP2\" #1))) (define \"OnlyOnFilledHoles\" (not (is In (to) (union (values Remembered \"OwnedP1\") (values Remembered \"OwnedP2\"))))) (define \"OneRowIsEmpty\" (or (no Pieces All in:(sites P1)) (no Pieces All in:(sites P2)))) (define \"OwnedHoles\" (if (is Mover P1) (sites (values Remembered \"OwnedP1\")) (sites (values Remembered \"OwnedP2\")))) (define \"PlayFromNextHole\" (sites {(\"NextHoleFrom\" (last To afterConsequence:True) 1)})) (define \"NextHoleFrom\" (\"NextSiteOnTrack\" #2 from:#1)) (game \"Bosh\" (players 2) (equipment { (mancalaBoard 2 5 store:None (track \"Track\" \"0,E,N,W\" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece \"Seed\" Shared) (hand Each)}) (rules (start { (set Count 4 to:(sites Track)) (set RememberValue \"OwnedP1\" (sites Bottom)) (set RememberValue \"OwnedP2\" (sites Top))}) phases:{ (phase \"Sowing\" (play (or { (move Select (from (if (\"SameTurn\") \"PlayFromNextHole\" (\"OwnedHoles\")) if:(> (count at:(from)) 0)) (then (sow apply:(if (and (= (count at:(\"NextHoleFrom\" (to) 1)) 0) (> (count at:(\"NextHoleFrom\" (to) 2)) 0)) (fromTo (from (\"NextHoleFrom\" (to) 2)) (to (handSite Mover)) count:(count at:(\"NextHoleFrom\" (to) 2))) (if (> (count at:(\"NextHoleFrom\" (to) 1)) 0) (moveAgain))) skipIf:(\"OnlyOnFilledHoles\"))))} (then (if (\"OneRowIsEmpty\") (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))))))))) (nextPhase (\"NoPieceOnBoard\") \"BetweenRounds\")) (phase \"BetweenRounds\" (play (if (<= 4 (count Cell at:(handSite Mover))) (move (from (handSite Mover)) (to (intersection (sites Empty) (sites Mover))) count:4) (move Pass (then (forEach Site (\"OwnedHoles\") (if (is Empty (site)) (\"ForgetValue\" (site)))))))) (end (if (all Passed) { (if (\"NoOwnedHoles\" 1) (result P2 Win)) (if (\"NoOwnedHoles\" 2) (result P1 Win))})) (nextPhase (all Passed) \"Sowing\"))})) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayed on a standard Backgammon board. Each player has fifteen pieces, which all begin on the leftmost point on each player's side of the board. Both players move anti-clockwise around the board. Both players roll one die, and the player with the higher number plays first. If it is played after another game, the winner of the previous game goes first. The player rolls two die and begins play with that roll. 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, they are played twice. If a player can only play one number but not both, they must play the higher number, if possible. To begin, each player may only move one piece, until it passes the opponent's starting point, after which any pieces can be moved. Pieces may only be moved to an empty point or one occupied by another piece belonging to the player. Players may not block all six points in either player's starting quadrant. If a player has blocked six points in a row, and the opponent has moved all of their pieces to the point adjacent to the blocked points, the player must move to unblock one of the points. Once a player has moved all of their pieces into the final six points of their track, they may begin bearing off. They do so by rolling a number equal to the number of points left in the track, plus one. If they cannot bear off, they must make a legal move with a piece that cannot bear off. If no such move is available, then they must bear off the piece which is furthest from the goal. The first player to bear off all their pieces wins the game and gets one point. If the winner bears off all their pieces before the opponent bears off any, they get two points. \n\n###\n\n", "completion": "(define \"Not14PiecesInThePosition\" (!= (topLevel at:(from)) 13)) (define \"InTheStartingPosition\" (= (from) (mapEntry (mover)))) (define \"PieceInOpponentSide\" (not (\"AllOwnedPiecesIn\" (sites Mover \"Side\")))) (define \"HaveAPieceAndCanEscape\" (and (\"IsFriendAt\" (site)) (< (\"NextSiteOnTrack\" (pips) from:(site)) 0))) (define \"SetScoreOf\" (score #1 (if (is Mover #1) (if (= (\"NumPiece\" #2) 15) 2 1) 0))) (define \"NotEmptyAndNotOffTheBoard\" (and (is Occupied (site)) (\"IsNotOffBoard\" (\"NextSiteFrom\" (site))))) (define \"CanEscape\" (\"IsEndTrack\" (\"NextSiteFrom\" (site)))) (define \"NumPiece\" (size Stack in:(sites Occupied by:#1))) (define \"AllPieceEscaped\" (no Pieces Mover)) (define \"MoveAPieceIf\" (forEach Die replayDouble:True if:#1 (if (or { (not (\"InTheStartingPosition\")) (and (\"InTheStartingPosition\") (\"Not14PiecesInThePosition\")) (\"PieceInOpponentSide\")}) (\"MoveAPiece\" #2)))) (define \"MoveAPiece\" (move (from #1) (to (\"NextSiteFrom\" #1) if:(\"NotAnEnemy\")))) (define \"DieNotUsedAndNoEscapeAndNotOffTheTrack\" (and { (\"DieNotUsed\") (\"IsNotOffBoard\" (\"NextSiteFrom\" (from))) (\"IsNotEndTrack\" (\"NextSiteFrom\" (from)))})) (define \"RemoveAPiece\" (move Remove (site))) (define \"AllPieceInHome\" (\"AllOwnedPiecesIn\" (sites Mover \"Home\"))) (define \"NextSiteFrom\" (\"NextSiteOnTrack\" (pips) from:#1)) (define \"NotAnEnemy\" (not (\"IsEnemyAt\" (to)))) (game \"Fevga\" (players 2) (equipment { (\"BackgammonBoard\" (\"BackgammonTracksSameDirectionOppositeCorners\" End)) (dice num:2) (regions \"Home\" P1 { 20..25}) (regions \"Home\" P2 { 7..12}) (regions \"Side\" P1 { 0..12}) (regions \"Side\" P2 { 13..25}) (map {(pair 1 0) (pair 2 25)}) (piece \"Disc\" Each (\"MoveAPieceIf\" \"DieNotUsedAndNoEscapeAndNotOffTheTrack\" (from)))}) (rules (start { (place Stack \"Disc1\" 0 count:15) (place Stack \"Disc2\" 25 count:15)}) (play (\"RollEachNewTurnMove\" (if \"AllPieceInHome\" (forEach Die replayDouble:True if:(\"DieNotUsed\") (forEach Site (sites Occupied by:Mover) (if (\"NotEmptyAndNotOffTheBoard\") (if (\"CanEscape\") (\"RemoveAPiece\") (\"MoveAPiece\" (site)))) noMoveYet:(firstMoveOnTrack \"Track\" Mover (if \"HaveAPieceAndCanEscape\" \"RemoveAPiece\")) (then \"ReplayNotAllDiceUsed\"))) (max Distance \"Track\" Mover (forEach Piece top:True (then \"ReplayNotAllDiceUsed\")))))) (end (if (\"AllPieceEscaped\") (byScore { (\"SetScoreOf\" P1 P2) (\"SetScoreOf\" P2 P1)}))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n4x6-21 board; 8 is most common, 12, 15, and 18 are also popular. Two counters in each hole in the players' outer rows. Two holes in each player's outer row are selected as misoro. Typically, the left two holes are chosen. At the beginning of the game, players choose whether to capture from one, two, or three extra holes. Sowing occurs in an anti-clockwise direction, only in the two rows belonging to the player. When the final counter lands in an occupied hole, these are picked up and sowing continues. If this final hole is one of the misoro, the player may choose to end their turn instead of continuing to sow. When the final counter lands in an empty hole in the inner row, any counters in the opposite hole in the opponent's inner row are captured. If there also are counters in the opposite hole in the opponent's outer row, these are also captured, but only if there was first a capture from the inner row hole. The player also captures the counters from the agreed-upon number of holes on the opponent's side of the board. Counters in misoro cannot be captured with one of these additional captures. Players cannot sow from a hole with a single counter unless there are no holes with multiple counters. Single counters can only be sown into an empty hole. Play continues until one player has captured all of the opponent's counters, thus winning the game. Players choose the misoro holes. 8 Holes per row. 3 extra captures.\n\n###\n\n", "completion": "(define \"HaveToMakeExtraCapture\" (set Var \"ExtraCapture\" 3)) (define \"NumCapture\" (var \"ExtraCapture\")) (define \"NextHoleFrom\" (\"NextSiteOnTrack\" 1 from:#1 #2)) (define \"AHoleHasMoreThanOneCounter\" (not (all Sites (forEach (sites Mover) if:(< 1 (count at:(site)))) if:(= 0 (count at:(site)))))) (define \"LastHoleSowed\" (sites {(var)})) (define \"NoPiece\" (all Sites (sites Player \"Home\") if:(= 0 (count at:(site))))) (define \"Columns\" 8) (game \"Misoro Tsoro (Additional Capture)\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"0,E,N1,W\" loop:True P1) (track \"Track2\" \"16,E,N1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"Track1\")) (regions \"Home\" P2 (sites Track \"Track2\")) (regions \"Inner\" P1 (difference (sites Track \"Track1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"Track2\") (sites Top))) (regions \"Outer\" P1 (sites Bottom)) (regions \"Outer\" P2 (sites Top)) (piece \"Seed\" Shared)}) (rules (start (set Count 2 to:(union (sites Top) (sites Bottom)))) phases:{ (phase \"Misoro\" (play (move Select (from (forEach (sites Mover \"Outer\") if:(= 0 (state at:(site))))) (then (set State at:(last To) (mover))))) (nextPhase (= 4 (count Turns)) \"Playing\")) (phase \"Playing\" (play (if (< 0 (\"NumCapture\")) (move Select (from (forEach (sites Next) if:(and (= 0 (state at:(site))) (< 0 (count at:(site)))))) (then (and { (if (< 1 (\"NumCapture\")) (moveAgain)) (set Var \"ExtraCapture\" (- (\"NumCapture\") 1)) (remove (last To)) (forEach Site (sites Board) (if (!= 0 (state at:(site))) (set State at:(site) (state at:(site)))))}))) (or (if (and (!= 0 (state at:(var))) (\"SameTurn\")) (move Pass)) (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(if \"AHoleHasMoreThanOneCounter\" (> (count at:(from)) 1) (and (= (count at:(from)) 1) (= 0 (count at:(\"NextHoleFrom\" (from) Mover)))))) (then (and (sow \"Track\" owner:(mover) apply:(if (= (count at:(to)) 1) (if (is In (to) (sites Mover \"Inner\")) (if (> (count at:(\"OppositePit\" (to))) 0) (and { (remove (\"OppositePit\" (to))) (if (> (count at:(\"OppositeOuterPit\" (to))) 0) (remove (\"OppositeOuterPit\" (to)))) (moveAgain) (\"HaveToMakeExtraCapture\")}))) (and (moveAgain) (set Var (to))))) (forEach Site (sites Board) (if (!= 0 (state at:(site))) (set State at:(site) (state at:(site))))))))))))} (end (forEach NonMover if:(\"NoPiece\") (result Player Loss))))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game involves 3 piles. -> The game involves 7 piles.\n(game \"Nim\" (players 2) (equipment { (board (rectangle 1 3)) (piece \"Marker\" Neutral)}) (rules (start { (set Count 1 to:(sites {0 2})) (set Count 2 at:1)}) (play (if \"SameTurn\" (or (move Select (from (last To)) (then (if (= (count at:(last To)) 1) (remove (last To)) (and (set Count at:(last To) (- (count at:(last To)) 1)) (moveAgain))))) (move Pass)) (move Select (from (sites Occupied by:Neutral)) (then (if (= (count at:(last To)) 1) (remove (last To)) (and (set Count at:(last To) (- (count at:(last To)) 1)) (moveAgain))))))) (end (if (no Moves Next) (result Next Win)))))\n\n###\n\n", "completion": "(game \"Nim\" (players 2) (equipment { (board (rectangle 1 7)) (piece \"Marker\" Neutral)}) (rules (start { (set Count 4 to:(sites {0 6})) (set Count 5 to:(sites {1 5})) (set Count 6 to:(sites {2 4})) (set Count 7 at:3)}) (play (if \"SameTurn\" (or (move Select (from (last To)) (then (if (= (count at:(last To)) 1) (remove (last To)) (and (set Count at:(last To) (- (count at:(last To)) 1)) (moveAgain))))) (move Pass)) (move Select (from (sites Occupied by:Neutral)) (then (if (= (count at:(last To)) 1) (remove (last To)) (and (set Count at:(last To) (- (count at:(last To)) 1)) (moveAgain))))))) (end (if (no Moves Next) (result Next Win))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"To Kinegi tou Lagou\" (players 2) (equipment { (board (add (remove (remove (merge { (concentric {1 8}) (shift 0 -5 (concentric {1 4})) (shift 0 5 (concentric {1 4})) (shift -5 0 (concentric {1 4})) (shift 5 0 (concentric {1 4})) (shift 5 5 (concentric {1 8})) (shift 5 -5 (concentric {1 8})) (shift -5 -5 (concentric {1 8})) (shift -5 5 (concentric {1 8}))}) vertices:{20 18 27 11 48 49 50 51 52 41 42 43 44 45 34 35 36 37 30 59 58 57 64 63}) edges:{ {0 1} {0 7} {0 5} {0 3} {33 35} {30 29} {27 25} {39 37}}) edges:{ {15 8} {22 6} {4 12} {19 2} {18 36} {38 20} {40 14} {16 26} {28 24} {23 32} {31 11} {10 34} {5 30} {3 35} {39 1} {27 7}}) use:Vertex) (piece \"Human\" Each (\"StepToEmpty\")) (piece \"Dog\" Each (\"StepToEmpty\")) (piece \"Hare\" Each (\"StepToEmpty\")) (hand Each size:2)}) (rules (start { (place \"Hare2\" (centrePoint)) (place \"Human1\" (handSite P1)) (place \"Dog1\" (handSite P1 1) count:2)}) phases:{ (phase \"PlacementP1\" (play (move (from (sites Hand P1) if:(is Occupied (from))) (to (sites {1..8}) if:(is Empty (to))) (then (if (\"HandOccupied\" P1) (moveAgain))))) (nextPhase (\"HandEmpty\" P1) \"HuntingP2\")) (phase \"HuntingP2\" (play (forEach Piece (then (if (not (can Move (step (from (where \"Hare\" P2)) (to if:(is Empty (to)))))) (and { (addScore P2 (- (count Moves) 3)) (remove (sites Occupied by:All container:\"Board\")) (add (piece \"Hare1\") (to (sites Centre))) (add (piece \"Human2\") (to (handSite P2))) (add (piece \"Dog2\") (to (handSite P2 1)) count:2)}))))) (nextPhase (= 1 (count Sites in:(sites Occupied by:All container:\"Board\"))) \"PlacementP2\")) (phase \"PlacementP2\" (play (move (from (sites Hand P2) if:(is Occupied (from))) (to (intersection (sites Empty) (sites {1..8})) if:(is Empty (to))) (then (if (\"HandOccupied\" P2) (moveAgain))))) (nextPhase (\"HandEmpty\" P2) \"HuntingP1\")) (phase \"HuntingP1\" (play (forEach Piece (then (if (not (can Move (step (from (where \"Hare\" P1)) (to if:(is Empty (to)))))) (addScore P1 (- (count Moves) (+ (score P2) 6))))))) (end (if (!= 0 (score P1)) (byScore))))}))\n\n###\n\n", "completion": "A square, with lines bisecting the sides drawn to the center. A circle is drawn around the central point. arcs are drawn inside the square around the midpoints of the sides and the corners. Diagonals are drawn from the corner arcs to the central circle. One player plays as the hare, one player plays as the hunter and two hounds. The hare begins on the central spot, and the hunter and hounds are placed on three of the points on the central circle. Pieces move to an empty adjacent spot along the lines of the board. The hare moves first. When the hunter and hounds prevent the hare from being able to move, the game ends and the players switch roles. The game has two rounds. END" }, { "prompt": "Construct a Ludii game based on the following description\nOn your turn, you place a hexagonal tile of your color that covers three mutually orthogonally adjacent rhombuses. In Ludii this is done by first selecting one of the rhombuses the tile will cover, then another. The third one is determined by these two selections. When no more placements are possible, the game is over and the winner is the player with the higher score.\n \n The general idea behind the scoring is simple: You get 1 point per empty rhombus that ends up adjacent to more of your hexagons than your opponent's hexagons. However, two slight complications are necessary to exclude all draws in as fair a manner as possible:\n \n 1: You score 1 point every time you make a placement that closes off an odd number of tied rhombuses. (A rhombus is closed off when it is adjacent to no rhombus that can be filled in on a future turn.) This is equivalent to dividing tied cells between you in a \\ \n\n###\n\n", "completion": "(define \"Mark\" (forEach Site (\"UnClaimable\") (set State at:(site) 1))) (define \"Score\" (addScore Mover (% (count Sites in:(forEach (\"UnClaimable\") if:(!= 1 (state at:(site))))) 2))) (define \"Place\" (add (to (intersection (sites Around (last From) Orthogonal includeSelf:True) (sites Around (last To) Orthogonal includeSelf:True))))) (define \"Select\" (move Select (from (sites Empty) if:(\"SomeSite\" (sites Around (from) Empty Orthogonal) (\"SomeSite\" (sites Around (site) Empty Orthogonal) (is Related Orthogonal (site) (from))))) (to (sites Around (from) Empty Orthogonal) if:(\"SomeSite\" (sites Around (to) Empty Orthogonal) (is Related Orthogonal (site) (from)))) #1)) (define \"UnClaimable\" (forEach (sites Empty) if:(and { (= (count Sites in:(sites Around (site) Own Orthogonal)) (count Sites in:(sites Around (site) Enemy Orthogonal))) (not (can Move (move Select (from (sites Around (site) Empty Orthogonal) if:(\"SomeSite\" (sites Around (from) Empty Orthogonal) (\"SomeSite\" (sites Around (site) Empty Orthogonal) (is Related Orthogonal (site) (from))))))))}))) (define \"SomeSite\" (not (all Sites #1 if:(not #2)))) (game \"Residuel\" (players 2) (equipment { (board (remove (rotate 30 (dual (tiling T3636 5))) cells:{0 4 5 73 81 97 142 143 152})) (tile \"Rhombus\" Each)}) (rules (play (\"Select\" (then (do (\"Mark\") next:(do (\"Place\") next:(\"Score\")))))) (end (if (no Moves Next) (byScore { (score P1 (+ { (score P1) (- (max (/ (count Sites in:(sites Occupied by:P1)) 3) (/ (count Sites in:(sites Occupied by:P2)) 3)) (/ (count Sites in:(sites Occupied by:P1)) 3)) (count Sites in:(forEach (sites Empty) if:(> (count Sites in:(intersection (sites Around (site) Orthogonal) (sites Occupied by:P1))) (count Sites in:(intersection (sites Around (site) Orthogonal) (sites Occupied by:P2))))))})) (score P2 (+ { (score P2) (- (max (/ (count Sites in:(sites Occupied by:P1)) 3) (/ (count Sites in:(sites Occupied by:P2)) 3)) (/ (count Sites in:(sites Occupied by:P2)) 3)) (count Sites in:(forEach (sites Empty) if:(> (count Sites in:(intersection (sites Around (site) Orthogonal) (sites Occupied by:P2))) (count Sites in:(intersection (sites Around (site) Orthogonal) (sites Occupied by:P1))))))}))}))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayed on a 10x10 board. Each player has four Amazons (chess queens), with other pieces used as arrows. Two things happen on a turn: an amazon moves like a Chess queen, but cannot cross or enter a space occupied by another amazon or arrow. Then, it shoots an arrow to any space on the board that is along the path of a queen's move from that place. The last player able to make a move wins. \n\n###\n\n", "completion": "(game \"Amazons\" (players 2) (equipment { (board (square 10)) (piece \"Queen\" Each (move Slide (then (moveAgain)))) (piece \"Dot\" Neutral)}) (rules (start { (place \"Queen1\" {\"A4\" \"D1\" \"G1\" \"J4\"}) (place \"Queen2\" {\"A7\" \"D10\" \"G10\" \"J7\"})}) (play (if (is Even (count Moves)) (forEach Piece) (move Shoot (piece \"Dot0\")))) (end (\"BlockWin\")))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"El Perro\" (players 2) (equipment { (\"AlquerqueBoard\" 5 5) (piece \"Goat\" P2 (\"StepToEmpty\" (if (= (value Player Mover) 1) (directions {S SE SW E W}) (directions {N NE NW E W})))) (piece \"Dog\" P1 (or (\"HopCapture\" (from (from)) Adjacent (then (if (can Move (\"HopCapture\" (from (last To)))) (moveAgain)))) (\"StepToEmpty\")))}) (rules (start { (place \"Goat2\" (union (intersection (union (sites Left) (sites Right)) (sites Row 2)) (expand (sites Bottom)))) (place \"Dog1\" (sites Centre))}) (play (if (\"SameTurn\") (or (\"HopCapture\" (from (last To)) Adjacent (then (if (can Move (\"HopCapture\" (from (last To)))) (moveAgain)))) (move Pass)) (forEach Piece) (then (if (not (can Move (forEach Piece (\"StepToEmpty\" (if (= (value Player P2) 1) (directions {S SE SW}) (directions {N NE NW}))) P2))) (set Value P2 (if (= (value Player P2) 1) 0 1)))))) (end (\"NoMovesP1NoPiecesP2\"))))\n\n###\n\n", "completion": "5x5 intersecting lines, with diagonals drawn in the quadrants. One player plays as one dog, which is a large stone, and the other as twelve goats, which are smaller stones. The goats begin on the two rows closest to the player to which they belong, and on the right hand spots in the central row. The dog begins in the central space. \n \n The dog moves first. The dog may move in any direction along the lines of the board. It may capture a goat by hopping over it to an empty adjacent spot on the opposite side of the goat, according to the lines of the board. Multiple captures are allowed. The goats move one space forward orthogonally or diagonally, or sideways, along the lines of the board. \n \n When all of the goats are unable to move forward anymore and all are are in spaces being equivalent to the starting position on the opposite side of the board, they may then commence moving in the opposite direction toward their original starting position, but not backwards with respect to this direction. \n \n The dog wins by capturing all the goats; the goats win by blocking the dog from being able to move. END" }, { "prompt": "Construct a Ludii game based on the following description\n5x5 intersecting lines, with diagonals in the four quadrants. Twelve pieces per player, arranged on the two rows closest to the player and the two spots in the central row to the player's right, leaving the central space empty. Players alternate turns moving a piece to an empty adjacent spot along the lines of the board. A piece belonging to the opponent may be captured when a piece hops over it to an empty adjacent spot immediately on the opposite side of the piece, along the lines of the board. The player who reduces the opponent to five pieces wins. \n\n###\n\n", "completion": "(game \"Ethiopian Capture Game\" (players 2) (equipment { (\"AlquerqueBoard\" 5 5) (piece \"Marker\" Each (or (\"HopCapture\") (\"StepToEmpty\")))}) (rules (start { (place \"Marker1\" (union {(expand (sites Bottom)) (sites {\"D3\" \"E3\"})})) (place \"Marker2\" (union {(sites {\"A3\" \"B3\"}) (expand (sites Top))}))}) (play (forEach Piece)) (end (\"HavingLessPiecesLoss\" Next 5)))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nOrder 5 board -> Order 6 board\n(define \"ColourBackground\" (colour 245 245 245)) (define \"Last2MoveEnd\" (\"BlockWin\")) (define \"AMSEnd\" (if (no Moves Next) (result Mover Loss))) (define \"MoveByDirection\" (forEach Piece (or { (\"AdvancedSquishSlide\" NNE) (\"AdvancedSquishSlide\" E) (\"AdvancedSquishSlide\" SSE) (\"AdvancedSquishSlide\" SSW) (\"AdvancedSquishSlide\" W) (\"AdvancedSquishSlide\" NNW)}))) (define \"AdvancedSquishSlide\" (do (set Var \"OriginGroupSize\" (size Group at:(from)) (then (set Var \"From\" (from)))) next:(move (from (from)) (to (\"AlongLine\" #1) if:(and { (all Sites (sites Between from:(from) to:(to)) if:(is Empty (site))) (\"IsPlayableSiteType\") (\"MoveTowardFriendInSameLine\" #1) (or (is Next (who at:(to))) (<= (var \"OriginGroupSize\") (\"DestinationGroupSize\")))}) (apply (remove (to))))))) (define \"DestinationGroupSize\" (count Sites in:(sites Distance Orthogonal (step (to if:(and (!= (var \"From\") (to)) (is Mover (who at:(to)))))) from:(to) (min 0)))) (define \"FirstFriend\" (sites To (move Hop #1 (between (min 0) if:(or { (= (from) (between)) (is Next (who at:(between))) (is Empty (between))})) (to (sites Board) if:(is Mover (who at:(to))))))) (define \"MoveTowardFriendInSameLine\" (< 0 (count Pieces Mover in:(\"FurtherAlongLine\" #1)))) (define \"FurtherAlongLine\" (sites Distance (step #1 (to if:True)) from:(to) (min 1))) (define \"AlongLine\" (sites Distance (step #1 (to if:True)) from:(from) (min 1))) (define \"IsPlayableSiteType\" (is In (to) (\"PlayableSite\"))) (define \"PlayableSite\" (difference (sites Board) (sites Occupied by:Mover))) (game \"Don't Mosey and The Last Scavenger\" (players 2) (equipment { (board (hex Hexagon 5) use:Cell) (piece \"Disc\" Each)}) (rules (start {(place \"Disc1\" {0 3 7 10 12 15 18 21 24 28 31 34 35 38 41 44 47 52 55 56 59}) (place \"Disc2\" {1 4 5 8 13 16 19 22 25 26 29 32 36 39 42 45 48 50 53 57 60})}) (play \"MoveByDirection\") (end \"Last2MoveEnd\")))\n\n###\n\n", "completion": "(define \"ColourBackground\" (colour 245 245 245)) (define \"Last2MoveEnd\" (\"BlockWin\")) (define \"AMSEnd\" (if (no Moves Next) (result Mover Loss))) (define \"MoveByDirection\" (forEach Piece (or { (\"AdvancedSquishSlide\" NNE) (\"AdvancedSquishSlide\" E) (\"AdvancedSquishSlide\" SSE) (\"AdvancedSquishSlide\" SSW) (\"AdvancedSquishSlide\" W) (\"AdvancedSquishSlide\" NNW)}))) (define \"AdvancedSquishSlide\" (do (set Var \"OriginGroupSize\" (size Group at:(from)) (then (set Var \"From\" (from)))) next:(move (from (from)) (to (\"AlongLine\" #1) if:(and { (all Sites (sites Between from:(from) to:(to)) if:(is Empty (site))) (\"IsPlayableSiteType\") (\"MoveTowardFriendInSameLine\" #1) (or (is Next (who at:(to))) (<= (var \"OriginGroupSize\") (\"DestinationGroupSize\")))}) (apply (remove (to))))))) (define \"DestinationGroupSize\" (count Sites in:(sites Distance Orthogonal (step (to if:(and (!= (var \"From\") (to)) (is Mover (who at:(to)))))) from:(to) (min 0)))) (define \"FirstFriend\" (sites To (move Hop #1 (between (min 0) if:(or { (= (from) (between)) (is Next (who at:(between))) (is Empty (between))})) (to (sites Board) if:(is Mover (who at:(to))))))) (define \"MoveTowardFriendInSameLine\" (< 0 (count Pieces Mover in:(\"FurtherAlongLine\" #1)))) (define \"FurtherAlongLine\" (sites Distance (step #1 (to if:True)) from:(to) (min 1))) (define \"AlongLine\" (sites Distance (step #1 (to if:True)) from:(from) (min 1))) (define \"IsPlayableSiteType\" (is In (to) (\"PlayableSite\"))) (define \"PlayableSite\" (difference (sites Board) (sites Occupied by:Mover))) (game \"Don't Mosey and The Last Scavenger\" (players 2) (equipment { (board (hex Hexagon 6) use:Cell) (piece \"Disc\" Each)}) (rules (start {(place \"Disc1\" {0 3 8 11 14 17 20 21 24 27 32 35 38 41 44 47 50 53 56 59 61 64 67 71 74 77 80 83 85 88}) (place \"Disc2\" {2 5 7 10 13 16 19 23 26 29 31 34 37 40 43 46 49 52 55 58 63 66 69 70 73 76 79 82 87 90})}) (play \"MoveByDirection\") (end \"Last2MoveEnd\"))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"PiecesOwnedBy\" (+ (count Cell at:(handSite #1)) (count in:(sites #1 \"Home\")))) (define \"Columns\" 10) (game \"Okwe (Nigeria)\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" store:None { (track \"Track\" \"0,E,N,W\" loop:True) (track \"TrackSpecialHome1\" \"0,E\" loop:True P1) (track \"TrackSpecialHome2\" \"19,W\" loop:True P2)}) (regions \"OpeningRegion\" P1 (sites {14..17})) (regions \"OpeningRegion\" P2 (sites {2..4})) (piece \"Seed\" Shared) (hand Each) (map \"LeftMost\" {(pair P1 0) (pair P2 (- (* (\"Columns\") 2) 1))}) (regions \"Home\" P1 (sites Bottom)) (regions \"Home\" P2 (sites Top))}) (rules (start { (set Count 5 to:((sites {0 1 4 19..18 15}))) (set Count 1 to:((sites {2 3 5 17 16 14})))}) phases: { (phase \"Opening\" (play (move (from (sites Mover \"OpeningRegion\") if:(is Occupied (from))) (to (handSite Mover)) count:(count at:(from)))) (nextPhase (all Sites (union (sites P1 \"OpeningRegion\") (sites P2 \"OpeningRegion\")) if:(is Empty (site))) \"Sowing\")) (phase \"Sowing\" (play (or (move Select (from (sites Mover \"Home\") if:(is Occupied (from))) (then (sow \"Track\" apply:(if (and (is In (to) (sites Next \"Home\")) (or { (= 1 (count at:(\"OppositePitTwoRows\" (to)))) (= 3 (count at:(\"OppositePitTwoRows\" (to)))) (= 5 (count at:(\"OppositePitTwoRows\" (to))))})) (fromTo (from (\"OppositePitTwoRows\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePitTwoRows\" (to))))) origin:(< 1 (count at:(from)))))) (if (is Occupied Cell (handSite Mover)) (do (set Var \"NumToSow\" (count Cell at:(handSite Mover))) next:(move (from (handSite Mover)) (to (mapEntry \"LeftMost\" Mover)) count:(count Cell at:(handSite Mover)) (then (and (sow count:(var \"NumToSow\") \"TrackSpecialHome\" owner:(mover) origin:True) (set Var \"NumToSow\" 0)))))))))} (end (if (all Sites (sites Board) if:(= 0 (count at:(site)))) { (if (is Empty (handSite P1)) (result P2 Win)) (if (is Empty (handSite P2)) (result P1 Win))}))))\n\n###\n\n", "completion": "2x10-20 board, 10 most common. Opening arrangement: Each player has this opening arrangement (number of counters in each hole, starting from the leftmost hole): 5-5-5-5-5-5-5-1-1-5-1-0-0-0-0-0-0-0-0-0. Boards have even numbers of holes, and the farthest left and farthest right holes are eliminated in succession from this opening arrangement to make smaller boards. The challenger concedes the first move. Opening phase: Player 1 removes the counters in the opponent's final four holes with counters and conceals them from the opponent. Player 2 removes the same counters, except leaving the single counter in the opponent's final hole with counters. Players take the counters from any of their holes and sow them in an anti-clockwise direction. When sowing, the first counter is dropped into the hole from which it just came, unless it is a single counter. If the last counter lands in the opponent's row and the opposite hole contains one, three, or five counters, theses are taken and added to the concealed store. In place of a move, a player may add some or all of the counters from the concealed store, sowing from the leftmost hole in their row. If the sowing reaches the rightmost hole in this row, sowing continues from the leftmost hole rather than continuing into the opponent's rows. Each row has 10 holes. END" }, { "prompt": "Construct a Ludii game based on the following description\n4x4 board, eight pieces each player. Pieces move orthogonally by either jumping a player's own piece to capture an opponent's piece or by moving one space into an empty hole. Captures are not compulsory. The goal is to reduce the opponents pieces to 1 or blocking them so they can no longer move. The game is played on a 4x4 board. The game starts with half the board owned by each player.\n\n###\n\n", "completion": "(game \"Nei-Pat-Kono\" (players 2) (equipment { (board (square 4) use:Vertex) (piece \"Marker\" Each (or (\"StepOrthogonalToEmpty\") (move Hop Orthogonal (between if:(\"IsFriendAt\" (between))) (to if:(\"IsEnemyAt\" (to))))))}) (rules (start { (place \"Marker1\" (expand (sites Bottom) steps:(- (/ (count Rows) 2) 1))) (place \"Marker2\" (expand (sites Top) steps:(- (/ (count Rows) 2) 1)))}) (play (forEach Piece)) (end (if (or (no Moves Next) (<= (count Pieces Next) 1)) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nEach player begins with two pieces on the four corners of the board, with each player's pieces in opposite corners. Players move one piece one or two spaces in any direction orthogonally or diagonally. If the piece is moved on space, another piece is added on the origin space. All of the opponent's pieces adjacent to the space to which the player moved now belong to the player who moved. Play ends when all spaces have been filled or one of the players has no remaining pieces. The player with the most pieces wins. \n\n###\n\n", "completion": "(game \"Ataxx\" (players 2) (equipment { (board (square 7)) (piece \"Marker\" Each (or (move (from) (to (sites Around (from)) if:(is Empty (to))) copy:True) (move (from) (to (difference (expand origin:(from) steps:2) (expand origin:(from))) if:(is Empty (to)))) (then (forEach Site (intersection (sites Around (last To)) (sites Occupied by:Next)) (and (remove (site)) (add (piece (id \"Marker\" Mover)) (to (site))))))))}) (rules (start { (set Score Each 2) (place \"Marker1\" {\"A1\" \"G7\"}) (place \"Marker2\" {\"A7\" \"G1\"})}) (play (forEach Piece (then (and (set Score P1 (count Sites in:(sites Occupied by:P1))) (set Score P2 (count Sites in:(sites Occupied by:P2))))))) (end (if (or (\"NoSites\" (sites Occupied by:Next)) (is Full)) (byScore))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n12x12 checkered board. One player plays with six \\ \n\n###\n\n", "completion": "(game \"Koti Keliya\" (players 2) (equipment { (board (square 12)) (piece \"Leopard\" P1 (move Slide Diagonal (between (max 2)))) (piece \"Cow\" P2 N (\"StepToEmpty\" (directions {FR FL})))}) (rules (start { (place \"Cow2\" (difference (sites Bottom) (sites Phase 0)))}) phases:{ (phase \"Placement\" (play (move Add (to (intersection (sites Phase 1) (sites Empty))))) (nextPhase (not (no Pieces P1)) \"Movement\")) (\"PhaseMovePiece\" \"Movement\")} (end { (if (and (no Moves P1) (is Mover P1)) (result P2 Win)) (if (= 0 (count Sites in:(forEach (sites Occupied by:P2) if:(< (row of:(site)) (row of:(where \"Leopard\" P1)))))) (result P1 Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nMcCooey Chess is played on a hexagonal board with each side having length 6, and each space oriented horizontally. The board has has 91 spaces.\n \n Piece Movement:\n * All pieces other than Pawns move as in Glinski Chess.\n - Kings step one space in any of the 12 directions. They do not castle.\n - Queens slide in any of the 12 directions.\n - Rooks slide in any of the 6 adjacent direction.\n - Bishops slide in any of the 6 'diagonal' directions.\n - Knights move two spaces in any adjacent direction, then one space in another direction.\n * Pawns can advance one space forward without capturing. A Pawn on a Pawn start space but not in the innermost column can advance two spaces forward without capturing. Pawns capture 'diagonally forward' (i.e., to a space ahead connected by an edge, and having the same colour). En Passant capture and Pawn promotion take place as in Glinski Chess.\n \n The game ends on a checkmate or stalemate. \n\n###\n\n", "completion": "(define \"PromoteTo\" (move Promote (last To) #1 Mover)) (define \"IsEnPassantCapture\" (and (is Pending) (= (to) (value Pending)))) (define \"EnPassant_Diag\" (\"EnPassant_Base\" (\"Directions\" {NNW NNE} {SSW SSE}))) (define \"EnPassant_Base\" (move Step #1 (to if:\"IsEnPassantCapture\") (then (remove (var))))) (define \"PawnStep_Double\" (\"PawnHop\" Forward Backward)) (define \"PawnCapture_Diag\" (move Step (\"Directions\" {NNW NNE} {SSW SSE}) (to if:(\"IsEnemyAt\" (to)) (apply (remove (to)))))) (define \"PawnHop\" (move Hop #1 (between if:(is In (between) (sites Empty))) (to if:\"IsToEmpty\") (then (and { (set Pending (ahead (last To) #2)) (set Var (last To))})))) (define \"KingCaptureStep\" (move Step #1 (to if:\"IsToEmptyOrEnemy\" \"CaptureToPieceAndResetCounter\") #2)) (define \"SlideCaptureMove\" (move Slide #1 (to if:(\"IsEnemyAt\" (to)) \"CaptureToPieceAndResetCounter\") #2)) (define \"P12\" (if (is Mover P1) #1 #2)) (define \"IsToEmptyOrEnemy\" (or \"IsToEmpty\" (\"IsEnemyAt\" (to)))) (define \"IsToEmpty\" (is In (to) (sites Empty))) (define \"IsFromInStartCell\" (is In (from) (sites Start (piece (what at:(from)))))) (define \"Directions\" (\"P12\" (directions #1) (directions #2))) (define \"CaptureToPieceAndResetCounter\" (apply (if (\"IsEnemyAt\" (to)) (remove (to) (then (set Counter)))))) (game \"McCooey Chess\" (\"TwoPlayersNorthSouth\") (equipment { (board (rotate 90 (hex 6))) (piece \"King\" Each (\"KingCaptureStep\" All ~)) (piece \"Queen\" Each (\"SlideCaptureMove\" All ~)) (piece \"Rook\" Each (\"SlideCaptureMove\" Orthogonal ~)) (piece \"Bishop\" Each (\"SlideCaptureMove\" Diagonal ~)) (piece \"Knight\" Each (move Leap \"KnightWalk\" (to if:\"IsToEmptyOrEnemy\" \"CaptureToPieceAndResetCounter\"))) (piece \"Pawn\" Each (or { \"StepForwardToEmpty\" (if (and \"IsFromInStartCell\" (not (is In (from) (sites Mover \"CentrePawnStartCell\")))) \"PawnStep_Double\") \"PawnCapture_Diag\" \"EnPassant_Diag\"} (then (and (if (is In (last To) (sites Mover \"PromotionZone\")) (moveAgain)) (set Counter))))) (regions \"CentrePawnStartCell\" P1 (sites {\"D4\"})) (regions \"CentrePawnStartCell\" P2 (sites {\"H8\"})) (regions \"PromotionZone\" P1 (union (sites Side NW) (sites Side NE))) (regions \"PromotionZone\" P2 (union (sites Side SW) (sites Side SE))) (regions \"Region-Dark\" (sites Phase 0)) (regions \"Region-Light\" (sites Phase 2)) (regions \"Region-Medium\" (sites Phase 1))}) (rules (start { (place \"King1\" coord:\"B1\") (place \"Queen1\" coord:\"A2\") (place \"Rook1\" {\"A3\" \"C1\"}) (place \"Bishop1\" {\"A1\" \"B2\" \"C3\"}) (place \"Knight1\" {\"B3\" \"C2\"}) (place \"King2\" coord:\"K10\") (place \"Queen2\" coord:\"J11\") (place \"Rook2\" {\"I11\" \"K9\"}) (place \"Bishop2\" {\"K11\" \"J10\" \"I9\"}) (place \"Knight2\" {\"I10\" \"J9\"}) (place \"Pawn1\" {\"A4\" \"B4\" \"C4\" \"D4\" \"D3\" \"D2\" \"D1\"}) (place \"Pawn2\" {\"H11\" \"H10\" \"H9\" \"H8\" \"I8\" \"J8\" \"K8\"})}) phases:{ (phase \"Movement\" (play (if (\"SameTurn\") (\"PromoteTo\" (piece {\"Queen\" \"Rook\" \"Bishop\" \"Knight\"})) (do (forEach Piece) ifAfterwards:(not (\"IsInCheck\" \"King\" Mover))))) (end { (\"Checkmate\" \"King\") (if (or (no Moves Mover) (= (counter) 100)) (result Mover Draw))}))})) 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 Ludii game based on the following description\n8x8 board. Twelve pieces per player. Pieces move forward diagonally to an empty space on the board. A piece may capture an opponent's adjacent piece by hopping over it to an empty space immediately on the opposite side of the opponent's piece. Multiple captures are allowed. Captures can be made in a forward or backward direction. Captures are compulsory, but it is not required to choose a capture sequence that captures the most pieces. A piece which reaches the opposite edge of the board from where it started is promoted to a king. Kings move any number of spaces forward or backward. They also may capture a single piece if there is at least one empty space beyond it, and can change direction after a capture. Kings must also make all possible captures in a sequence. The player who captures all of the opponent's pieces wins. \n\n###\n\n", "completion": "(define \"IsUnpromoted\" (\"IsPieceAt\" \"Counter\" Mover (last To))) (game \"American Pool Checkers\" (players 2) (\"DraughtsEquipment\" (square 8)) (rules (\"BlackCellsSetup\" 3) (play (if \"SameTurn\" (if \"IsUnpromoted\" (\"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 { (or (forEach Piece \"Counter\" (\"HopInternationalDraughtsStyle\" (from) (then (\"ReplayIfCanMove\" (\"HopInternationalDraughtsStyle\" (from (last To))) (\"PromoteIfReach\" (sites Next) \"DoubleCounter\"))))) (max Moves (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 Ludii game based on the following description\n5x5 board. Twelve pieces per player. Players alternate turns placing a piece on the board, leaving the central space empty. Once all of the pieces have been placed, players alternate turns moving a piece to an empty adjacent space in an orthogonal or diagonal direction. A player may capture an opponent's piece adjacent to one of their own by hopping over it to an empty space immediately on the opposite side of the opponent's piece. Multiple captures are allowed. The player who captures all of their opponent's pieces wins. \n\n###\n\n", "completion": "(game \"Tides\" (players 2) (equipment { (board (square 5)) (piece \"Marker\" Each (or (\"HopSequenceCapture\") (\"StepToEmpty\"))) (hand Each)}) (rules (start (place \"Marker\" \"Hand\" count:12)) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (difference (sites Board) (centrePoint)) if:(is Empty (to))))) (nextPhase Mover (is Empty (handSite Mover)) \"Move\")) (phase \"Move\" (play (if \"SameTurn\" (or (\"HopSequenceCaptureAgain\") (move Pass)) (forEach Piece))) (end (\"CaptureAll\" Next)))})) 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 Ludii game based on the following description\n4x8 board. Two counters in each hole, the holes in the inner row are then vacated. These counters become the \\ \n\n###\n\n", "completion": "(define \"NoSeedsInInner\" (all Sites (sites Mover \"Inner\") if:(= 0 (count at:(site))))) (define \"OppositeOuterPitOuter\" (if (is Mover P1) (+ (to) (* \"Columns\" 3)) (- (to) (* \"Columns\" 3)))) (define \"OppositeOuterPitInner\" (if (is Mover P1) (+ (to) (* \"Columns\" 2)) (- (to) (* \"Columns\" 2)))) (define \"OppositePitInner\" (if (is Mover P1) (+ (to) \"Columns\") (- (to) \"Columns\"))) (define \"Columns\" 8) (game \"Mwambulula\" (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 2 to:(union (sites P1 \"Home\") (sites P2 \"Home\")))) phases:{ (phase \"Opening\" (play (move (from (sites Mover \"Inner\") if:(is Occupied (from))) (to Cell (handSite Mover)) count:2)) (nextPhase Mover \"NoSeedsInInner\" \"Sowing\")) (phase \"Sowing\" (play (or (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(> (count at:(from)) 0)) (then (sow \"Track\" owner:(mover) apply:(if (< 1 (count at:(to))) (if (is In (to) (sites Mover \"Inner\")) (if (is Occupied (\"OppositePitInner\")) (and { (fromTo (from (\"OppositePitInner\")) (to (last From)) count:(count at:(\"OppositePitInner\"))) (if (is Occupied (\"OppositeOuterPitInner\")) (fromTo (from (\"OppositeOuterPitInner\")) (to (last From)) count:(count at:(\"OppositeOuterPitInner\")))) (sow (last From) count:(+ (count at:(\"OppositePitInner\")) (count at:(\"OppositeOuterPitInner\"))) \"Track\" owner:(mover))}) (moveAgain)) (if (is Occupied (\"OppositeOuterPit\" (to))) (and { (fromTo (from (\"OppositeOuterPit\" (to))) (to (last From)) count:(count at:(\"OppositeOuterPit\" (to)))) (if (is Occupied (\"OppositeOuterPitOuter\")) (fromTo (from (\"OppositeOuterPitOuter\")) (to (last From)) count:(count at:(\"OppositeOuterPitOuter\")))) (sow (last From) count:(+ (count at:(\"OppositeOuterPit\" (to))) (count at:(\"OppositeOuterPitOuter\"))) \"Track\" owner:(mover))}) (moveAgain))))))) (if (and (\"NewTurn\") (is Occupied Cell (handSite Mover))) (move Select (from Cell (handSite Mover)) (then (forEach Site (sites Mover \"Home\") (fromTo (from Cell (handSite Mover)) (to (site))))))))))} (end \"ForEachNonMoverNoMovesLoss\"))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nA square board of size 7 is currently selected -> A hexagonal board of size 4 is currently selected\n(game \"Center\" (players 2) (equipment { (piece \"Marker\" Each)}) (rules (play (move Add (to (sites Empty) if:(<= (count Steps All (to) (sites Perimeter)) (count Sites in:(intersection (sites LineOfSight at:(to) All) (sites Occupied by:Mover))))))) (end (if (is Occupied (centrePoint)) (result Next Loss)))))\n\n###\n\n", "completion": "(game \"Center\" (players 2) (equipment { (piece \"Marker\" Each)}) (rules (play (move Add (to (sites Empty) if:(<= (count Steps (to) (sites Perimeter)) (count Sites in:(intersection (sites LineOfSight at:(to)) (sites Occupied by:Mover))))))) (end (if (is Occupied (centrePoint)) (result Next Loss))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe game is played on a board with twelve points on either side. The points form a continuous track in a horseshoe shape; each player progresses in opposite directions (one from their bottom right to the top right, the other from their bottom left to their top left. Each player has 15 pieces. Each player's fifteen pieces begin on the first point of their track. Players move according to the number on each die by moving one piece the value on one die then another piece the value on the other die, or by moving one piece the value of one die and then the value of the other. If doubles are rolled, the player must play the number on each die twice. When a piece lands on a space occupied by one of the opponent's piece, the opponent's piece may not move from that spot until the player's piece is moved from that spot. Two or more of the opponent's pieces may land on this space, but another of the player's pieces may not. When all of the player's pieces are on the final six points, they may be borne off the board. The player who bears off all of their pieces wins. The winning player's score equals the number of the opponent's pieces which are left on the board. Play continues until one player's score reaches 31.\n \n\n###\n\n", "completion": "(games (subgame \"MahbousehSubgame\" result:(score Mover))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"PiecesOwnedBy\" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (define \"Columns\" 6) (game \"Foji\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" store:None (track \"Track\" \"5,W,N,E\" loop:True)) (piece \"Seed\" Shared) (hand Each) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start (set Count 4 to:(sites Track))) (play (if (is Proposed \"End\") (or (move Vote \"End\") (move Vote \"No\")) (or (if (is Cycle) (move Propose \"End\")) (if (\"SameTurn\") (move Select (from \"LastHoleSowed\") (then (sow apply:(if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover)) (if (is Occupied (\"OppositePit\" (to))) (fromTo (from (\"OppositePit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePit\" (to))))))) includeSelf:False))) (do (move Select (from (sites Mover) if:(is Occupied (from))) (then (sow apply:(if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover)) (if (is Occupied (\"OppositePit\" (to))) (fromTo (from (\"OppositePit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePit\" (to))))))) includeSelf:False))) ifAfterwards:(if (is Mover P1) (< 0 (count in:(sites P2))) (< 0 (count in:(sites P1))))))))) (end (\"MancalaByScoreWhen\" (or (no Moves Mover) (is Decided \"End\"))))))\n\n###\n\n", "completion": "2x6 board. Four counters in each hole. A player picks up all of the counters in one of the holes in their row and sows them one-by-one in a clockwise direction in consecutive holes from the hole the pieces originated. The starting hole is always left empty, even if a player sows in a complete circuit of the board, the original house is skipped and sowing continues in the next hole after it. When the final counter falls into an occupied hole, these are picked up and sowing continues. When the final counter of a sowing lands in an empty hole in the player's own row, the contents of the hole in the opponent's row opposite it are captured. If the opponent's holes are all empty, the other player must make a move placing counters in the opponent's row. If not possible, the player captures all the counters in their row. The player who has captured the most counters wins. If the game continues in a repeating loop, the players can agree to end the game and capture the counters remaining in their row.\n END" }, { "prompt": "Construct a Ludii game based on the following description\nThe balls will roll until collision in the direction of the arrow to be selected for each step. For example, while you are trying to send the red ball to the desired place the other ball will roll to and fro as well. Default setup\n\n###\n\n", "completion": "(define \"Move\" (move (from) (to (sites LineOfSight Farthest at:(from) Orthogonal)) (then (fromTo (from (sites Occupied by:P1)) (to (sites LineOfSight Farthest at:(from) SameDirection)))))) (game \"Labirintus\" (players 1) (equipment { (board (rectangle 16 20)) (piece \"Square\" Neutral) (piece \"Ball1\" P1 \"Move\") (piece \"Ball2\" P1 \"Move\") (regions \"Exit2\" {149}) (regions \"Exit1\" {170}) (regions \"Walls\" {0..19 300..319 38 278 277 276 275 255 35 36 55 56 52 53 50 49 48 46 45 44 24 66 86 42 62 82 83 84 95 135 155 175 215 299 279 259 239 219 199 179 159 139 119 99 79 59 39 29 40 60 80 100 120 140 160 180 200 220 240 260 280 258 238 218 217 177 157 137 117 97 92 93 132 133 172 173 211 212 213 231 232 233 273 272 271 270 269 289 229 189 169 150 130 129 128 126 166 167 186 187 226 227 266 267 124 144 164 184 122 142 162 182 222 221 242 262 224 264 284 88 89 90 20})}) (rules (start { (place \"Ball1\" 149) (place \"Ball2\" 170) (place \"Square0\" (sites \"Walls\"))}) (play (forEach Piece)) (end { (if (and (is In (where (id \"Ball1\")) (sites \"Exit1\")) (is In (where (id \"Ball2\")) (sites \"Exit2\"))) (result Mover Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlay occurs on a 3x3 grid. One player places an X, the other places an O and players take turns placing their marks in the grid, attempting to get three in a row of their colour. \n\n###\n\n", "completion": "(game \"Tic-Tac-Toe\" (players 2) (equipment { (board (square 3)) (piece \"Disc\" P1) (piece \"Cross\" P2)}) (rules (play (move Add (to (sites Empty)))) (end (\"Line3Win\")))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game is played with 2 players. -> The game is played with 3 players.\n(define \"AllPiecesInCenter\" (\"AllOwnedPiecesIn\" (sites {(centrePoint)}))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" #2 #1)) (define \"Throw4\" (= (\"ThrowValue\") 4)) (define \"ThrowValue\" (mapEntry \"Throw\" (count Pips))) (game \"Tamman\" (players 2) (equipment { (board (merge { (add (merge { (square 2) (shift 4 0 (square 2)) (shift 0 4 (square 2)) (shift 4 4 (square 2))}) edges:{{2 9} {5 12} {8 15} {6 18} {8 20} {15 27} {17 29} {20 27} {23 30} {26 33} {7 19} {16 28}})}) { (track \"Track1\" \"2,E,N,W,S,E1,N3,E2,S2,W1,N1\" P1 directed:True) (track \"Track2\" \"20,W,S,E,N,W1,S3,W2,N2,E1,S1\" P2 directed:True)}) (\"StickDice\" 4) (piece \"Marker\" Each (move (from (from) level:(level)) (to (\"SiteToMoveOnTrack\" from:(from) (\"ThrowValue\")) if:True (apply (if (< 1 (\"ThrowValue\")) (forEach Site (sites Track Mover \"Track\" from:(\"SiteToMoveOnTrack\" from:(from) 1) to:(\"SiteToMoveOnTrack\" from:(from) (- (\"ThrowValue\") 1))) (if (not (is In (sites \"SafeSites\"))) (forEach Level (site) FromTop (if (\"IsEnemyAt\" (site) level:(level)) (fromTo (from (site) level:(level)) (to (mapEntry \"Entry\" (who at:(site) level:(level)))))))))))))) (regions \"SafeSites\" (sites {2 6 14 20})) (map \"Throw\" {(pair 0 8) (pair 1 1) (pair 2 2) (pair 3 3) (pair 4 4)}) (map \"Entry\" {(pair P1 2) (pair P2 20)})}) (rules (start { (place Stack \"Marker1\" 2 count:4) (place Stack \"Marker2\" 20 count:4)}) (play (\"RollMove\" (forEach Piece) (then (if (and (\"Throw4\") (\"NewTurn\")) (moveAgain))))) (end (if (\"AllPiecesInCenter\") (result Mover Win)))))\n\n###\n\n", "completion": "(define \"AllPiecesInCenter\" (\"AllOwnedPiecesIn\" (sites {(centrePoint)}))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" #2 #1)) (define \"Throw4\" (= (\"ThrowValue\") 4)) (define \"ThrowValue\" (mapEntry \"Throw\" (count Pips))) (game \"Tamman\" (players 3) (equipment { (board (merge { (add (merge { (square 2) (shift 4 0 (square 2)) (shift 0 4 (square 2)) (shift 4 4 (square 2))}) edges:{{2 9} {5 12} {8 15} {6 18} {8 20} {15 27} {17 29} {20 27} {23 30} {26 33} {7 19} {16 28}})}) { (track \"Track1\" \"2,E,N,W,S,E1,N3,E2,S2,W1,N1\" P1 directed:True) (track \"Track2\" \"6,S,E,N,W,S1,E3,S2,W2,N1,E1\" P2 directed:True) (track \"Track3\" \"20,W,S,E,N,W1,S3,W2,N2,E1,S1\" P3 directed:True)}) (\"StickDice\" 4) (piece \"Marker\" Each (move (from (from) level:(level)) (to (\"SiteToMoveOnTrack\" from:(from) (\"ThrowValue\")) if:True (apply (if (< 1 (\"ThrowValue\")) (forEach Site (sites Track Mover \"Track\" from:(\"SiteToMoveOnTrack\" from:(from) 1) to:(\"SiteToMoveOnTrack\" from:(from) (- (\"ThrowValue\") 1))) (if (not (is In (sites \"SafeSites\"))) (forEach Level (site) FromTop (if (\"IsEnemyAt\" (site) level:(level)) (fromTo (from (site) level:(level)) (to (mapEntry \"Entry\" (who at:(site) level:(level)))))))))))))) (regions \"SafeSites\" (sites {2 6 14 20})) (map \"Throw\" {(pair 0 8) (pair 1 1) (pair 2 2) (pair 3 3) (pair 4 4)}) (map \"Entry\" {(pair P1 2) (pair P2 6) (pair P3 20)})}) (rules (start { (place Stack \"Marker1\" 2 count:4) (place Stack \"Marker2\" 6 count:4) (place Stack \"Marker3\" 20 count:4)}) (play (\"RollMove\" (forEach Piece) (then (if (and (\"Throw4\") (\"NewTurn\")) (moveAgain))))) (end (if (\"AllPiecesInCenter\") (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n11x11 intersecting lines, with the central nine points out of play. Diagonal lines connect the corners of the central square of the board to the outer corners. Played with two to four players. Black and white stones fill the board, alternating color, with black in the corners of the board. The first player captures one of the stones on one of the corners of the board. Subsequent moves involve capturing a stone by hopping over it with an adjacent stone to an empty space. Multiple captures are possible, but only one, three, five, or seven are allowed in a turn. If an even number of captures is possible, the final capture cannot be taken. Players are not required to capture as many as may be possible. The game ends when no more captures are possible. The player with the highest score wins: black stones count as one, white as two. 2 Players.\n\n###\n\n", "completion": "(define \"CaptureAgain\" (then (if (and (< (count MovesThisTurn) 6) (can Move (\"Move\" (from (last To))))) (moveAgain) (forEach Site (sites Board) (if (= 1 (state at:(site))) (set State at:(site) 0)))))) (define \"Move\" (move Hop #1 (between if:(and (is Occupied (between)) (!= 1 (state at:(between))))) (to if:(is Empty (to)) (apply (if (is Even (count MovesThisTurn)) (and { (remove (between)) (if (= (what at:(between)) (id \"Marker\" Shared)) (addScore Mover 1) (addScore Mover 2)) (forEach Site (sites Board) (if (= 1 (state at:(site))) (and (remove (site)) (if (= (what at:(site)) (id \"Marker\" Shared)) (addScore Mover 1) (addScore Mover 2)))))}) (set State at:(between) 1)))) #2)) (game \"Pasang\" (players 2) (equipment { (board (add (remove (square 11) vertices:{48 49 50 59 60 61 70 71 72}) edges:{ {0 12} {12 24} {24 36} {10 20} {20 30} {30 40} {75 87} {87 99} {99 111} {71 81} {81 91} {91 101}}) use:Vertex) (piece \"Marker\" Shared (\"Move\" (from) (\"CaptureAgain\"))) (piece \"Disc\" Shared (\"Move\" (from) (\"CaptureAgain\")))}) (rules (start { (place \"Marker\" (forEach (sites {0..47 56..63}) if:(is Even (site)))) (place \"Disc\" (forEach (sites {0..47 56..63}) if:(is Odd (site)))) (place \"Marker\" (forEach (sites {48..55 64..111}) if:(is Odd (site)))) (place \"Disc\" (forEach (sites {48..55 64..111}) if:(is Even (site))))}) phases:{ (phase \"InitPhase\" (play (move Remove (sites Corners) (then (set Score Mover 1)))) (nextPhase \"MainPhase\")) (phase \"MainPhase\" (play (if (\"SameTurn\") (and (move Pass (then (forEach Site (sites Board) (if (= 1 (state at:(site))) (set State at:(site) 0))))) (\"Move\" (from (last To)) (\"CaptureAgain\"))) (forEach Piece Shared))))} (end (if (no Moves Next) (byScore))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6 board. Four counters per hole. Sowing occurs 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", "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 \"Rio Kadalis\" (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 \"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": "Describe the mechanics of the following Ludii game\n(game \"Picaria\" (players 2) (equipment { (board (square 3) use:Vertex) (hand Each) (piece \"Marker\" Each (\"StepToEmpty\" All))}) (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\" All))))\n\n###\n\n", "completion": "Played on a 3x3 board with diagonals in the squares. The board has 9 holes. The pieces can be placed to any empty site. END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayers complete two actions in turns:\n 1. Place a disc of their colour inside any ring.\n 2. Pick up the ring in which they placed their disc and move it somewhere else:\n \u2013 It must be placed horizontally or vertically adjacent to at least another ring.\n \u2013 It must be placed on an empty space (i.e. not over a disc or ring that was placed before).\n - If a player has used up his/her stock of discs, he/she continues by removing one of his/her discs from anywhere on the table and places it in a ring as usual.\n \n However rings and discs must always remain (orthogonally or diagonally) connected to form one unique group. \n \n The winner is the first player who succeeds in placing four of his/her discs or four of his/her rings in a horizontal, vertical or diagonal row. \n\n###\n\n", "completion": "(define \"MoveDisc\" (move (from (from) level:(level)) (to (sites Occupied by:All component:\"Ring\") level:0 if:(\"IsSingletonStack\" (to))) (then (moveAgain)))) (define \"MoveRing\" (move (from (last To)) (to (sites Around (difference (sites Occupied by:All component:\"Ring\") (last To)) Orthogonal if:(is Empty (to)))))) (define \"AddDisc\" (move Add (piece (id \"Disc\" Mover)) (to (sites Occupied by:All component:\"Ring\") level:0 if:(\"IsSingletonStack\" (to))) stack:True (then (moveAgain)))) (define \"AllDiscsPlaced\" (>= (count Turns) (- (* (count Players) (\"NumberOfDiscs\")) 1))) (define \"NumberOfDiscs\" 10) (game \"Ringo\" (players 2) (equipment { (boardless Square) (piece \"Disc\" Each (\"MoveDisc\")) (piece \"Ring\" Each)}) (rules (start { (place \"Ring1\" (ahead (centrePoint) NE)) (place \"Ring1\" (ahead (centrePoint) SE)) (place \"Ring1\" (ahead (centrePoint) SW)) (place \"Ring1\" (ahead (centrePoint) NW)) (place \"Ring2\" (ahead (centrePoint) N)) (place \"Ring2\" (ahead (centrePoint) E)) (place \"Ring2\" (ahead (centrePoint) S)) (place \"Ring2\" (ahead (centrePoint) W))}) phases:{ (phase \"PlacePhase\" (play (do (if (\"NewTurn\") (\"AddDisc\") (\"MoveRing\")) ifAfterwards:(= 1 (count Groups)))) (nextPhase Mover (and (\"NewTurn\") (\"AllDiscsPlaced\")) \"MovePhase\")) (phase \"MovePhase\" (play (do (if (\"NewTurn\") (forEach Piece) (\"MoveRing\")) ifAfterwards:(= 1 (count Groups)))))} (end { (if (is Line 4 what:(id \"Disc\" P1)) (result P1 Win)) (if (is Line 4 what:(id \"Ring\" P1)) (result P1 Win)) (if (is Line 4 what:(id \"Disc\" P2)) (result P2 Win)) (if (is Line 4 what:(id \"Ring\" P2)) (result P2 Win))}))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nThe game is played on a 2x2 board. -> The game is played on a 3x3 board.\n(game \"Spline\" (players 2) (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)))))\n\n###\n\n", "completion": "(game \"Spline\" (players 2) (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))))) 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": "Modify the Ludii game according to the following option changes:\nPlayed on a size 3 board. -> Played on a size 4 board.\n(game \"Master Y\" (players 2) (equipment { (board (hex Triangle 3)) (piece \"Disc\")}) (rules phases:{ (phase \"Opening\" P1 (play (move Add (to (sites Empty)))) (nextPhase \"Playing\")) (phase \"Playing\" (play (move Add (to (sites Empty)) (then (if (= 0 (count MovesThisTurn)) (moveAgain))))))} (end (if (is Connected 3 Sides) (result Mover Win)))))\n\n###\n\n", "completion": "(game \"Master Y\" (players 2) (equipment { (board (hex Triangle 4)) (piece \"Disc\")}) (rules phases:{ (phase \"Opening\" P1 (play (move Add (to (sites Empty)))) (nextPhase \"Playing\")) (phase \"Playing\" (play (move Add (to (sites Empty)) (then (if (= 0 (count MovesThisTurn)) (moveAgain))))))} (end (if (is Connected 3 Sides) (result Mover Win))))) END" }, { "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": "Describe the mechanics of the following Ludii game\n(game \"Bamboo\" (players 2) (equipment { (board (hex 5)) (piece \"Disc\" Each) (piece \"Disc\" Neutral)}) (rules (play (do (move Add (to (sites Empty))) ifAfterwards:(<= (max (results from:(sites Occupied by:Mover) to:1 (* 1 (size Group at:(from))))) (count Groups if:(= (who at:(to)) (mover)))))) (end (\"NoMoves\" Loss))))\n\n###\n\n", "completion": "Each turn a player places a stone of their color on an empty hex. The placement is subject to the following restriction: After your placement you may not have a group containing more stones than the number of groups you have on the board. The first player unable to place a stone loses the game. A size 5 board is currently selected The standard goal is selected, which means that the first player unable to place loses. END" }, { "prompt": "Construct a Ludii game based on the following description\n3x3 intersecting lines. Three pieces per player. Players alternate turns placing a piece on the board. When all of the pieces have been placed, the players alternate turns moving a piece to an empty adjacent spot. A piece which is surrounded on opposite sides by pieces belonging to the opponent cannot be moved. The player who places three of their stones in a row along one of the lines wins. \n\n###\n\n", "completion": "(define \"Surrounded\" (or (if (and (!= (ahead (from) N) (from)) (!= (ahead (from) S) (from))) (and (= (next) (who at:(ahead (from) N))) (= (next) (who at:(ahead (from) S))))) (if (and (!= (ahead (from) E) (from)) (!= (ahead (from) W) (from))) (and (= (next) (who at:(ahead (from) E))) (= (next) (who at:(ahead (from) W))))))) (game \"Triodi (Chios)\" (players 2) (equipment { (board (square 3) use:Vertex) (hand Each) (piece \"Marker\" Each (if (not (\"Surrounded\")) (\"StepToEmpty\")))}) (rules (start (place \"Marker\" \"Hand\" count:3)) phases:{ (phase \"Placement\" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover (\"HandEmpty\" Mover) \"Movement\")) (\"PhaseMovePiece\" \"Movement\")} (end (\"Line3Win\")))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"Bagh Batti\" (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": "5x5 board, played on intersections, with diagonals for each quadrant of the board. One player plays with two tiger pieces, placed on the midpoints of two opposite sides. The other player plays with twenty goats, divided into four stacks of five, placed in the center of each quadrant. The goats move first. Goats may move one at a time to any adjacent vacant spot. More than one goat can be placed on the goats' starting spots, but not elsewhere. The tiger moves in the same manner, but also may capture a piece by hopping over it. Multiple captures can be made on the same turn with subsequent hops, but only the top goat in a stack is captured when a tiger leaps over it. The goal of the goats is to surround the tigers so they cannot move; when one tiger is blocked the other must be blocked on the next turn. The goal of the tigers is to capture all the goats.\n END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"Addi Kul\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 7)) (piece \"Marker\" Each (or (\"StepToEmpty\" (directions {Rightward Leftward Forwards})) (\"HopCapture\")))}) (rules (start { (place \"Marker1\" (expand (sites Bottom) steps:2)) (place \"Marker2\" (expand (sites Top) steps:2))}) (play (forEach Piece)) (end (\"CaptureAll\" Next))))\n\n###\n\n", "completion": "7x7 board. 21 pieces per player, which begin in the three rows closest to each player. The central row of the board remains empty. Players alternate turns moving one of their pieces forward, diagonally, or horizontally on the board. When a player's piece is next to an opponent's piece with an empty space immediately on the opposite side of it, the player's piece may hop over the opponent's piece to capture it. The player who captures all of the opponent's pieces wins. END" }, { "prompt": "Construct a Ludii game based on the following description\nSix or more players (even number), played on two teams. The games Aj Sayil, Aj T'iwil, Aj Sina'anil, Aj Sakakil, and A K'aak'il are played in succession. The game has 6 players.\n\n###\n\n", "completion": "(games { (subgame \"Aj Sayil\" next:1) (subgame \"Aj T'iwil\" next:2) (subgame \"Aj Sina'anil\" next:3) (subgame \"Aj Sakakil\" next:4) (subgame \"A K'aak'il\")}) 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": "Describe the mechanics of the following Ludii game\n(define \"JarlWasCaptured\" (is Triggered \"Surrounded\" P2)) (define \"JarlIsCaptured\" (apply (trigger \"Surrounded\" P2))) (define \"FriendOrCentreOrFortress\" (or (\"IsFriendAt\" (to)) (is In (to) (union (sites Centre) (sites \"Fortresses\"))))) (define \"EmptyButNotCentreOrFortress\" (and (not (is In (between) (union (sites Centre) (sites \"Fortresses\")))) (is Empty (between)))) (define \"Custodial\" (custodial (from (last To)) Orthogonal (between (max 1) if:(\"IsPieceAt\" #1 Next (between)) (apply (remove (between)))) (to if:\"FriendOrCentreOrFortress\"))) (game \"Hnefatafl\" (players 2) (equipment { (board (square 11)) (regions \"Fortresses\" (sites Corners)) (piece \"Thrall\" P1 (move Slide Orthogonal (between if:\"EmptyButNotCentreOrFortress\") (then (and { (\"Custodial\" \"Thrall2\") (surround (from (last To)) Orthogonal (between if:(\"IsPieceAt\" \"Jarl\" P2 (between)) \"JarlIsCaptured\") (to if:\"FriendOrCentreOrFortress\"))})))) (piece \"Thrall\" P2 (move Slide Orthogonal (between if:\"EmptyButNotCentreOrFortress\") (then (\"Custodial\" \"Thrall1\")))) (piece \"Jarl\" P2 (move Slide Orthogonal (then (\"Custodial\" \"Thrall1\"))))}) (rules (start { (place \"Thrall1\" {\"D1\" \"E1\" \"F1\" \"G1\" \"H1\" \"F2\" \"A4\" \"A5\" \"A6\" \"A7\" \"A8\" \"B6\" \"K4\" \"K5\" \"K6\" \"K7\" \"K8\" \"J6\" \"F10\" \"D11\" \"E11\" \"F11\" \"G11\" \"H11\" \"F10\"}) (place \"Thrall2\" {\"F4\" \"E5\" \"F5\" \"G5\" \"D6\" \"E6\" \"G6\" \"H6\" \"E7\" \"F7\" \"G7\" \"F8\"}) (place \"Jarl2\" (centrePoint))}) (play (forEach Piece)) (end { (\"PieceTypeReachWin\" \"Jarl2\" (sites \"Fortresses\") P2) (if \"JarlWasCaptured\" (result P1 Win))})))\n\n###\n\n", "completion": "Played on an 11x11 board. The defending side comprises twelve soldiers and a king, who start the game in a cross formation in the center of the board.\n Their objective is for the king to escape by reaching any of the four corner squares.\n The attackers comprise 24 soldiers positioned in four groups of 6 around the perimeter of the board.\n The King piece is the only piece that can occupy the central and the four corner squares.\n All pieces move orthogonally any number of spaces, and pieces are taken by custodial capture (surrounding an enemy piece on either side with two of a player's pieces). The king piece must be captured by surrounding it on all four sides. The game is played with the common rules. END" }, { "prompt": "Construct a Ludii game based on the following description\nPieces move to any adjacent empty square or jumping one of their pieces over an adjacent piece to the empty point immediately beyond. The game is won by the first player to move all six pieces into a single orthogonally connected group \n\n###\n\n", "completion": "(game \"Groups\" (players 2) (equipment { (board (square 8)) (piece \"Disc\" Each (or (\"StepToEmpty\") (\"HopAllPiecesToEmpty\")))}) (rules (start { (place \"Disc1\" {\"D3\" \"C4\" \"E4\" \"D5\" \"F5\" \"E6\"}) (place \"Disc2\" {\"E3\" \"D4\" \"F4\" \"C5\" \"E5\" \"D6\"})}) (play (forEach Piece)) (end (\"SingleGroupWin\" Mover Orthogonal)))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe 32 pieces in Chex represent the 16 chess pieces on each side of a normal chess game. Each player shuffles his own 16 tiles and places them face down, then white draws his top tile and places it, with the piece oriented so it looks upright to him. Black then draws the top tile in his pile and places it so that it touches white's piece, either orthogonally or diagonally, and oriented so that it looks upright to him.\n \n At that point, white can either add another piece or move his piece on the board. A move must be a legal chess move and may not separate any element of the board; all pieces much remain touching, even if just diagonally, when a move has ended. Thus you can \\ \n\n###\n\n", "completion": "(define \"NextCanNotMove\" (not (can Move (do (forEach Piece Next) ifAfterwards:(not (\"IsInCheck\" \"King\" Next)))))) (game \"Chex\" (\"TwoPlayersNorthSouth\") (equipment { (boardless Square) (hand Each) (tile \"Pawn\" Each numSides:4 (or { \"StepForwardToEmpty\" (\"StepToEnemy\" (directions {FR FL}))})) (tile \"Rook\" Each numSides:4 (\"SlideCapture\" Orthogonal)) (tile \"King\" Each numSides:4 (\"StepToNotFriend\")) (tile \"Bishop\" Each numSides:4 (\"SlideCapture\" Diagonal)) (tile \"Knight\" Each numSides:4 (\"LeapCapture\" \"KnightWalk\")) (tile \"Queen\" Each numSides:4 (\"SlideCapture\"))}) (rules (start { (place Random { (count \"Pawn1\" 8) (count \"Rook1\" 2) (count \"Knight1\" 2) (count \"Bishop1\" 2) (count \"Queen1\" 1) (count \"King1\" 1)} (handSite 1)) (place Random { (count \"Pawn2\" 8) (count \"Rook2\" 2) (count \"Knight2\" 2) (count \"Bishop2\" 2) (count \"Queen2\" 1) (count \"King2\" 1)} (handSite 2)) (forEach Value min:0 max:(topLevel at:(handSite 1)) (set Hidden What at:(handSite 1) level:(value) to:P1)) (forEach Value min:0 max:(topLevel at:(handSite 1)) (set Hidden What at:(handSite 1) level:(value) to:P2)) (forEach Value min:0 max:(topLevel at:(handSite 2)) (set Hidden What at:(handSite 2) level:(value) to:P1)) (forEach Value min:0 max:(topLevel at:(handSite 2)) (set Hidden What at:(handSite 2) level:(value) to:P2))}) (play (if \"SameTurn\" (if (= (count Moves) 1) (move (from (handSite (mover))) (to (centrePoint))) (do (move (from (handSite (mover))) (to (sites Around (union (sites Occupied by:P1 container:\"Board\") (sites Occupied by:P2 container:\"Board\")) Empty))) ifAfterwards:(not (\"IsInCheck\" \"King\" Mover)))) (or (if (is Occupied (handSite (mover))) (move Select (from (handSite (mover))) (then (and { (moveAgain) (set Hidden What at:(last To) level:(topLevel at:(last To)) False to:P1) (set Hidden What at:(last To) level:(topLevel at:(last To)) False to:P2)})))) (do (forEach Piece) ifAfterwards:(and (= 1 (count Groups)) (not (\"IsInCheck\" \"King\" Mover))))))) (end { (if (and { (not (can Move (if (!= (what at:(handSite (mover))) 0) (move Select (from (handSite (mover))))))) (\"IsNotOffBoard\" (where \"King\" Next)) (\"IsInCheck\" \"King\" Next) (not (can Move (do (forEach Piece Next) ifAfterwards:(and (= 1 (count Groups)) (not (\"IsInCheck\" \"King\" Next))))))}) (result Mover Win)) (if (and { \"SameTurn\" (\"IsInCheck\" \"King\" Mover) (not (can Move (do (move (from (handSite (mover))) (to (sites Around (union (sites Occupied by:P1 container:\"Board\") (sites Occupied by:P2 container:\"Board\")) Empty))) ifAfterwards:(not (\"IsInCheck\" \"King\" Mover)))))}) (result Next Win)) (\"DrawIfNoMoves\" Mover)}))) END" }, { "prompt": "Construct a Ludii game based on the following description\n2x6 board with two stores. Four counters in each hole. Players alternate turns sowing from one of the holes on their side of the board in an anticlockwise direction. When a counter lands in one of the opponent's holes, making it contain six counters, those counters are captured. The player who captures the most counters wins.\n \n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (count at:(mapEntry #1))) (game \"Wari\" (players 2) (equipment { (mancalaBoard 2 6 { (track \"Track\" \"1,E,N,W\" loop:True)}) (piece \"Seed\" Shared) (hand Each) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 FirstSite) (pair P2 LastSite)})}) (rules (start (set Count 4 to:(sites Track))) (play (move Select (from (sites Mover) if:(> (count at:(from)) 0)) (then (sow apply:(if (= 6 (count at:(to))) (fromTo (from (to)) (to (mapEntry Mover)) count:6)))))) (end (\"MancalaByScoreWhen\" (no Moves Mover))))) 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": "Modify the Ludii game according to the following option changes:\nPlayed on a Alquerque Board with less diagonal. -> Played on a Alquerque Board with no diagonal.\n(game \"Cercar La Liebre\" (players 2) (equipment { (board (remove (rectangle 5 5 diagonals:Alternating) edges:{ { {2 0} {1 1}} { {0 2} {1 1}} { {0 2} {1 3}} { {1 3} {2 4}} { {2 0} {3 1}} { {3 1} {4 2}} { {4 2} {3 3}} { {3 3} {2 4}}}) use:Vertex) (piece \"Counter\" P1 \"StepToEmpty\") (piece \"Hare\" P2 (or \"HopCapture\" (if \"SameTurn\" (move Pass) \"StepToEmpty\")))}) (rules (start { (place \"Counter1\" (union {(expand (sites Bottom)) (sites {\"A3\" \"E3\"})})) (place \"Hare2\" (centrePoint))}) (play (forEach Piece)) (end (\"NoMovesLossAndLessNumPiecesPlayerLoss\" P1 9))))\n\n###\n\n", "completion": "(game \"Cercar La Liebre\" (players 2) (equipment { (board (square 5) use:Vertex) (piece \"Counter\" P1 \"StepToEmpty\") (piece \"Hare\" P2 (or \"HopCapture\" (if \"SameTurn\" (move Pass) \"StepToEmpty\")))}) (rules (start { (place \"Counter1\" (union {(expand (sites Bottom)) (sites {\"A3\" \"E3\"})})) (place \"Hare2\" (centrePoint))}) (play (forEach Piece)) (end (\"NoMovesLossAndLessNumPiecesPlayerLoss\" P1 9)))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nA size 7 board is currently selected -> A size 8 board is currently selected\n(game \"King And Courtesan\" (\"TwoPlayersNorthSouth\") (equipment { (board (rotate 45 (square 7))) (piece \"Disc\" Each (or { (\"StepToEmpty\" Forwards stack:True) (move Step (to if:(\"IsEnemyAt\" (to)) (apply (and (if (= 2 (size Stack at:(to))) (set Var \"NextLoss\" 1)) (remove (to) count:(size Stack at:(to)))))) stack:True) (move Step (from if:(= 2 (size Stack at:(from)))) Forwards (to if:(is Mover (who at:(to)))))}))}) (rules (start { (place \"Disc1\" (expand (sites Bottom) steps:(- 7 2) Orthogonal)) (place \"Disc2\" (expand (sites Top) steps:(- 7 2) Orthogonal)) (place Stack \"Disc1\" (sites Bottom)) (place Stack \"Disc2\" (sites Top))}) (play (forEach Piece top:True)) (end { (if (= 1 (var \"NextLoss\")) (result Next Loss)) (if (or (and (= (id P1) (who at:(- (* 7 7) 1))) (= 2 (size Stack at:(- (* 7 7) 1)))) (and (= (id P2) (who at:0)) (= 2 (size Stack at:0)))) (result Mover Win))})))\n\n###\n\n", "completion": "(game \"King And Courtesan\" (\"TwoPlayersNorthSouth\") (equipment { (board (rotate 45 (square 8))) (piece \"Disc\" Each (or { (\"StepToEmpty\" Forwards stack:True) (move Step (to if:(\"IsEnemyAt\" (to)) (apply (and (if (= 2 (size Stack at:(to))) (set Var \"NextLoss\" 1)) (remove (to) count:(size Stack at:(to)))))) stack:True) (move Step (from if:(= 2 (size Stack at:(from)))) Forwards (to if:(is Mover (who at:(to)))))}))}) (rules (start { (place \"Disc1\" (expand (sites Bottom) steps:(- 8 2) Orthogonal)) (place \"Disc2\" (expand (sites Top) steps:(- 8 2) Orthogonal)) (place Stack \"Disc1\" (sites Bottom)) (place Stack \"Disc2\" (sites Top))}) (play (forEach Piece top:True)) (end { (if (= 1 (var \"NextLoss\")) (result Next Loss)) (if (or (and (= (id P1) (who at:(- (* 8 8) 1))) (= 2 (size Stack at:(- (* 8 8) 1)))) (and (= (id P2) (who at:0)) (= 2 (size Stack at:0)))) (result Mover Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nGame starts with a cross made from dots.\n During each turn, place a dot to form a straight line that is exactly five dots long and then draw a straight line. This line can not overlap a part of an existing line. For every line drown we get a point. The goal is to maximise the score. \n\n###\n\n", "completion": "(define \"DrawThreeInARowTwoBack\" (and { (add (to Vertex (last From))) (add (to Edge (edge (last From) (last To)))) (add (to Edge (edge (last To) (ahead (last To) steps:1 (directions Vertex from:(last From) to:(last To)))))) (add (to Edge (edge (last From) (ahead (last From) steps:1 (directions Vertex from:(last To) to:(last From)))))) (add (to Edge (edge (ahead (last From) steps:1 (directions Vertex from:(last To) to:(last From))) (ahead (last From) steps:2 (directions Vertex from:(last To) to:(last From))))))})) (define \"ThreeInARowAndTwoBackEmpty\" (and { (is Occupied Vertex (ahead (to) steps:1 (directions Vertex from:(from) to:(to)))) (is Occupied Vertex (ahead (from) steps:1 (directions Vertex from:(to) to:(from)))) (is Occupied Vertex (ahead (from) steps:2 (directions Vertex from:(to) to:(from)))) (is Empty Edge (edge (from) (to))) (is Empty Edge (edge (to) (ahead (to) steps:1 (directions Vertex from:(from) to:(to))))) (is Empty Edge (edge (from) (ahead (from) steps:1 (directions Vertex from:(to) to:(from))))) (is Empty Edge (edge (ahead (from) steps:1 (directions Vertex from:(to) to:(from))) (ahead (from) steps:2 (directions Vertex from:(to) to:(from)))))})) (define \"DrawFourInARowOneBack\" (and { (add (to Vertex (last From))) (add (to Edge (edge (last From) (last To)))) (add (to Edge (edge (last To) (ahead (last To) steps:1 (directions Vertex from:(last From) to:(last To)))))) (add (to Edge (edge (ahead (last To) steps:1 (directions Vertex from:(last From) to:(last To))) (ahead (last To) steps:2 (directions Vertex from:(last From) to:(last To)))))) (add (to Edge (edge (last From) (ahead (last From) steps:1 (directions Vertex from:(last To) to:(last From))))))})) (define \"FourInARowAndOneBackEmpty\" (and { (is Occupied Vertex (ahead (to) steps:1 (directions Vertex from:(from) to:(to)))) (is Occupied Vertex (ahead (to) steps:2 (directions Vertex from:(from) to:(to)))) (is Occupied Vertex (ahead (from) steps:1 (directions Vertex from:(to) to:(from)))) (is Empty Edge (edge (from) (to))) (is Empty Edge (edge (to) (ahead (to) steps:1 (directions Vertex from:(from) to:(to))))) (is Empty Edge (edge (ahead (to) steps:1 (directions Vertex from:(from) to:(to))) (ahead (to) steps:2 (directions Vertex from:(from) to:(to))))) (is Empty Edge (edge (from) (ahead (from) steps:1 (directions Vertex from:(to) to:(from)))))})) (define \"DrawFiveInARow\" (and { (add (to Vertex (last From))) (add (to Edge (edge (last From) (last To)))) (add (to Edge (edge (last To) (ahead (last To) steps:1 (directions Vertex from:(last From) to:(last To)))))) (add (to Edge (edge (ahead (last To) steps:1 (directions Vertex from:(last From) to:(last To))) (ahead (last To) steps:2 (directions Vertex from:(last From) to:(last To)))))) (add (to Edge (edge (ahead (last To) steps:2 (directions Vertex from:(last From) to:(last To))) (ahead (last To) steps:3 (directions Vertex from:(last From) to:(last To))))))})) (define \"FiveInARowEmpty\" (and { (is Occupied Vertex (ahead (to) steps:1 (directions Vertex from:(from) to:(to)))) (is Occupied Vertex (ahead (to) steps:2 (directions Vertex from:(from) to:(to)))) (is Occupied Vertex (ahead (to) steps:3 (directions Vertex from:(from) to:(to)))) (is Empty Edge (edge (from) (to))) (is Empty Edge (edge (to) (ahead (to) steps:1 (directions Vertex from:(from) to:(to))))) (is Empty Edge (edge (ahead (to) steps:1 (directions Vertex from:(from) to:(to))) (ahead (to) steps:2 (directions Vertex from:(from) to:(to))))) (is Empty Edge (edge (ahead (to) steps:2 (directions Vertex from:(from) to:(to))) (ahead (to) steps:3 (directions Vertex from:(from) to:(to)))))})) (define \"SelectVertices\" (move Select (from Vertex (intersection (sites Around (sites Occupied by:P1)) (sites Empty Edge))) (to Vertex (intersection (sites Occupied by:P1) (sites Around (from))) if:#1) (then #2))) (game \"Morpion Solitaire\" (players 1) (equipment { (board (square 20 diagonals:SolidNoSplit) use:Vertex) (piece \"Cross\" P1)}) (rules (start { (place \"Cross\" (sites { 148 128 108..111 165..168 185 205 225..228 131 151 171..174 194 214 234..231 251 271 291..288 248 268}))}) (play (or { (\"SelectVertices\" \"FiveInARowEmpty\" \"DrawFiveInARow\") (\"SelectVertices\" \"FourInARowAndOneBackEmpty\" \"DrawFourInARowOneBack\") (\"SelectVertices\" \"ThreeInARowAndTwoBackEmpty\" \"DrawThreeInARowTwoBack\")} (then (addScore Mover 1)))) (end (if (no Moves Mover) (result P1 Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\n5x5 board, with the central square on each side and the central square of the board marked with an X. Two to four players, each with four pieces, which start on one of the marked squares on the edge of the board. Four cowrie shells used as dice. The throws are as follows, with the value of the throws equaling the number of mouths which land up, all mouths down = 8, and grants the player another throw. Pieces moves in a spiral track around the board in an anti-clockwise direction until they reach the space before the starting point, at which point they proceed around the inner circles in a clockwise direction, and then to the central space. When a player lands on a space occupied by an opponent's piece, the opponent's piece is sent back to their starting position. When a player reaches the central square by an exact throw, it is removed from the board. The first player to remove all four of their pieces from the board wins. The game involves 4 players.\n\n###\n\n", "completion": "(define \"Goal\" 12) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" (\"ThrowValue\"))) (define \"ThrowValue\" (mapEntry \"ThrowDiceValue\" (count Pips))) (game \"Main Pacheh\" (players 4) (equipment { (board (square 5) { (track \"Track1\" \"2,E,N,W,S,E1,N3,E2,S2,W1,12\" P1 directed:True) (track \"Track2\" \"22,W,S,E,N,W1,S3,W2,N2,E1,12\" P2 directed:True) (track \"Track3\" \"14,N,W,S,E,N1,W3,N2,E2,S1,12\" P3 directed:True) (track \"Track4\" \"10,S,E,N,W,S1,E3,S2,W2,N1,12\" P4 directed:True)}) (piece \"Marker\" Each (if (\"IsNotOffBoard\" \"SiteToMoveOnTrack\") (if (or (is Empty \"SiteToMoveOnTrack\") (\"IsEnemyAt\" \"SiteToMoveOnTrack\")) (move (from (from) level:(level)) (to \"SiteToMoveOnTrack\" (\"HittingCapture\" (mapEntry \"StartingPoint\" (who at:(to))))))) (then (if (= \"Goal\" (last To)) (remove (last To)))))) (map \"ThrowDiceValue\" {(pair 0 8) (pair 1 1) (pair 2 2) (pair 3 3) (pair 4 4)}) (map \"StartingPoint\" {(pair 1 2) (pair 2 22) (pair 3 14) (pair 4 10)}) (\"StickDice\" 4)}) (rules (start { (place Stack \"Marker1\" 2 count:4) (place Stack \"Marker2\" 22 count:4) (place Stack \"Marker3\" 14 count:4) (place Stack \"Marker4\" 10 count:4)}) (play (\"RollMove\" (if (can Move (forEach Piece)) (forEach Piece (then (if (= (\"ThrowValue\") 8) (moveAgain)))) (move Pass (then (if (= (\"ThrowValue\") 8) (moveAgain))))))) (end (\"EscapeWin\")))) END" }, { "prompt": "Modify the Ludii game according to the following option changes:\nEach player has 9 holes by row. -> Each player has 12 holes by row.\n(define \"NextSite\" (\"NextSiteOnTrack\" 1 #1)) (define \"FirstSiteToSow\" (if (is Mover P1) (intersection (sites Right) (sites Row 1)) (intersection (sites Left) (sites Row 2)))) (define \"PiecesOwnedBy\" (count in:(sites #1 \"Home\"))) (define \"Columns\" 9) (game \"Nchuwa\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"TrackCCW1\" \"0,E,N1,W\" loop:True P1) (track \"TrackCCW2\" \"18,E,N1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"TrackCCW1\")) (regions \"Home\" P2 (sites Track \"TrackCCW2\")) (regions \"Inner\" P1 (sites Row 1)) (regions \"Inner\" P2 (sites Row 2)) (regions \"Outer\" P1 (sites Row 0)) (regions \"Outer\" P2 (sites Row 3)) (piece \"Seed\" Shared)}) (rules (start (set Count 2 to:(union (sites P1 \"Home\") (sites P2 \"Home\")))) phases:{ (phase \"Opening1\" (play (move Select (from (\"FirstSiteToSow\")) (then (sow \"TrackCCW\" owner:(mover) apply:(set Value Mover (\"NextSite\" from:(to))))))) (nextPhase Mover \"Opening2\")) (phase \"Opening2\" (play (move Select (from (value Player Mover)) (then (sow \"TrackCCW\" owner:(mover) apply:(if (= (count at:(\"NextSite\" from:(to))) 0) (set Value Mover Off) (set Value Mover (\"NextSite\" from:(to)))))))) (nextPhase Mover (\"IsOffBoard\" (value Player Mover)) \"Opening3\")) (phase \"Opening3\" (play (move (from (forEach (sites Mover \"Inner\") if:(!= 0 (count at:(site))))) (to (forEach (sites Mover \"Outer\") if:(= 0 (count at:(site))))) count:2)) (nextPhase Mover \"Opening4\")) (phase \"Opening4\" (play (move Remove (sites Next \"Home\"))) (nextPhase Mover \"Opening5\")) (phase \"Opening5\" (play (move Remove (sites Next \"Home\"))) (nextPhase Mover \"Playing\")) (phase \"Playing\" (play (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(> (count at:(from)) 0)) (then (sow \"TrackCCW\" owner:(mover) apply:(if (= (count at:(to)) 1) (if (is In (to) (sites Mover \"Inner\")) (if (> (count at:(\"OppositePit\" (to))) 0) (and (remove (\"OppositePit\" (to))) (if (> (count at:(\"OppositeOuterPit\" (to))) 0) (remove (\"OppositeOuterPit\" (to))))))) (moveAgain)))))))} (end (forEach Player if:(= 0 (\"PiecesOwnedBy\" Player)) (result Player Loss)))))\n\n###\n\n", "completion": "(define \"NextSite\" (\"NextSiteOnTrack\" 1 #1)) (define \"FirstSiteToSow\" (if (is Mover P1) (intersection (sites Right) (sites Row 1)) (intersection (sites Left) (sites Row 2)))) (define \"PiecesOwnedBy\" (count in:(sites #1 \"Home\"))) (define \"Columns\" 12) (game \"Nchuwa\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"TrackCCW1\" \"0,E,N1,W\" loop:True P1) (track \"TrackCCW2\" \"24,E,N1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"TrackCCW1\")) (regions \"Home\" P2 (sites Track \"TrackCCW2\")) (regions \"Inner\" P1 (sites Row 1)) (regions \"Inner\" P2 (sites Row 2)) (regions \"Outer\" P1 (sites Row 0)) (regions \"Outer\" P2 (sites Row 3)) (piece \"Seed\" Shared)}) (rules (start (set Count 2 to:(union (sites P1 \"Home\") (sites P2 \"Home\")))) phases:{ (phase \"Opening1\" (play (move Select (from (\"FirstSiteToSow\")) (then (sow \"TrackCCW\" owner:(mover) apply:(set Value Mover (\"NextSite\" from:(to))))))) (nextPhase Mover \"Opening2\")) (phase \"Opening2\" (play (move Select (from (value Player Mover)) (then (sow \"TrackCCW\" owner:(mover) apply:(if (= (count at:(\"NextSite\" from:(to))) 0) (set Value Mover Off) (set Value Mover (\"NextSite\" from:(to)))))))) (nextPhase Mover (\"IsOffBoard\" (value Player Mover)) \"Opening3\")) (phase \"Opening3\" (play (move (from (forEach (sites Mover \"Inner\") if:(!= 0 (count at:(site))))) (to (forEach (sites Mover \"Outer\") if:(= 0 (count at:(site))))) count:2)) (nextPhase Mover \"Opening4\")) (phase \"Opening4\" (play (move Remove (sites Next \"Home\"))) (nextPhase Mover \"Opening5\")) (phase \"Opening5\" (play (move Remove (sites Next \"Home\"))) (nextPhase Mover \"Playing\")) (phase \"Playing\" (play (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(> (count at:(from)) 0)) (then (sow \"TrackCCW\" owner:(mover) apply:(if (= (count at:(to)) 1) (if (is In (to) (sites Mover \"Inner\")) (if (> (count at:(\"OppositePit\" (to))) 0) (and (remove (\"OppositePit\" (to))) (if (> (count at:(\"OppositeOuterPit\" (to))) 0) (remove (\"OppositeOuterPit\" (to))))))) (moveAgain)))))))} (end (forEach Player if:(= 0 (\"PiecesOwnedBy\" Player)) (result Player Loss))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"Nine Holes\" (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 pieces on an empty spot on the board. When all pieces are placed, players alternate turns moving a piece to any empty spot on the board. The first player to place their pieces in an orthogonal row along the lines wins. END" }, { "prompt": "Construct a Ludii game based on the following description\nThe board is a double-headed eagle, with two lines of ten holes. One seven-sided die. One side has a special mark, one is blank, and the others are numbered 1-5. The special mark scores 10, the blank side scores -10. Players roll the die, and add up their scores as they go, placing a peg in a hole to mark ten points. The player who reaches 100 points first wins. \n\n###\n\n", "completion": "(define \"Column\" (- (mover) 1)) (define \"Row\" (- (/ (score Mover) 10) 1)) (game \"Pasa\" (players 2) (equipment { (board (rectangle 10 2)) (piece \"Disc\" Each) (dice d:7 from:0 num:1) (map {(pair 0 -10) (pair 1 1) (pair 2 2) (pair 3 3) (pair 4 4) (pair 5 5) (pair 6 6) (pair 7 10)})}) (rules (play (do (roll (then (addScore Mover (mapEntry (count Pips))))) next:(move Pass (then (and (remove (sites Column \"Column\")) (if (>= (score Mover) 10) (add (piece (id \"Disc\" Mover)) (to (intersection (sites Column \"Column\") (sites Row \"Row\")))))))))) (end (if (>= (score Mover) 100) (result Mover Win))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"NextSite\" (if (= (\"NextSiteOnTrack\" 1 #1) (mapEntry Mover)) (\"NextSiteOnTrack\" 2 #1) (\"NextSiteOnTrack\" 1 #1))) (define \"LastHoleSowed\" (sites {(\"NextSite\" from:(last To afterConsequence:True))})) (define \"Columns\" 5) (game \"Sonka\" (players 2) (equipment { (mancalaBoard 2 \"Columns\" { (track \"Track1\" \"11,10,W,S,E\" loop:True P1) (track \"Track2\" \"0,1,E,N,W\" loop:True P2)}) (piece \"Seed\" Shared) (regions \"Home\" P1 (sites Bottom)) (regions \"Home\" P2 (sites Top)) (map {(pair P1 LastSite) (pair P2 FirstSite)})}) (rules (start (set Count 6 to:(union (sites Bottom) (sites Top)))) phases:{ (phase \"Sowing\" (play (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(< 0 (count at:(from)))) (then (sow \"Track\" owner:(mover) apply:(if (!= 0 (count at:(\"NextSite\" from:(to)))) (moveAgain) (if (is In (to) (sites Mover \"Home\")) (if (!= 0 (count at:(\"OppositePit\" (to)))) (fromTo (from (\"OppositePit\" (to))) (to (mapEntry Mover)) count:(count at:(\"OppositePit\" (to))))))))))) (end (if (all Passed) { (if (> 6 (count at:(mapEntry P1))) (result P2 Win)) (if (> 6 (count at:(mapEntry P2))) (result P1 Win))})) (nextPhase (all Passed) \"BetweenRounds\")) (phase \"BetweenRounds\" (play (if (<= 6 (count at:(mapEntry Mover))) (move (from (mapEntry Mover)) (to (intersection (sites Empty) (sites Mover \"Home\"))) count:6))) (nextPhase (all Passed) \"Sowing\"))}))\n\n###\n\n", "completion": "2x5 board with one store on either side. Six counters in each hole. Players play each turn simultaneously. Players sow from the holes in their row in an anti-clockwise direction, including their own store but not the opponent's store. When the final counter is sown, the contents of the next hole are picked up and sowing continues. If this hole is empty, the move ends and the player must wait for the other player to finish the move before they begin again. If the move ends in the player's own row, the player captures the counters in the opponent's row opposite to the one in which the last counter was dropped. Play continues until all of the counters are in the stores. The counters are then redistributed into the holes as at the beginning of the game. The player with extra counters places them in the store. 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": "Modify the Ludii game according to the following option changes:\nThe game has 2 players. -> The game has 3 players.\n(define \"MoveBankor\" (move (from (\"WhereBankor\") level:(\"LevelBankor\")) (to (\"BankorOnTrack\" \"Track\" (\"ThrowValue\"))) (then (and (if (!= (mover) \"StateBankor\") (set State at:(\"WhereBankor\") level:(\"LevelBankor\") (mover))) (if (= (last To) (\"Center\")) (forEach Site (sites Track \"Track\" from:(last From) to:(last To)) (if (!= (site) (last To)) (forEach Level (site) FromTop (remove (site) level:(level))))) (forEach Site (sites Track \"Track\" from:(last From) to:(last To)) (if (!= (site) (last To)) (forEach Level (site) FromTop (fromTo (from (site) level:(level)) (to (last To))))))))))) (define \"Center\" 0) (define \"StateBankor\" (state at:(\"WhereBankor\") level:(\"LevelBankor\"))) (define \"LevelBankor\" (where Level \"Bankor\" Neutral at:(\"WhereBankor\"))) (define \"WhereBankor\" (where \"Bankor\" Neutral)) (define \"BankorPhaseDone\" (or (= (\"WhereBankor\") (\"Center\")) (and (is Occupied (\"Center\")) (>= 1 (count Sites in:(difference (sites Occupied by:All) (\"WhereBankor\"))))))) (define \"BankorOnTrack\" (\"NextSiteOnTrack\" #2 from:(\"WhereBankor\") #1)) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" #2 #1)) (define \"Throw1\" (= (\"ThrowValue\") 1)) (define \"ThrowValue\" (mapEntry \"Throw\" (count Pips))) (game \"Sik\" (players 2) (equipment { (board (spiral turns:5 sites:86) { (track \"Track\" {85..0} directed:True)} use:Vertex) (\"StickDice\" 4) (map \"Throw\" {(pair 0 4) (pair 1 3) (pair 2 0) (pair 3 1) (pair 4 6)}) (piece \"Stick\" Each (move (from (from) level:(level) if:(or (= 1 (state at:(from) level:(level))) (\"Throw1\"))) (to (\"SiteToMoveOnTrack\" \"Track\" (\"ThrowValue\")) if:True) (then (if (!= 1 (state at:(last To) level:(last LevelTo))) (set State at:(last To) level:(last LevelTo) 1))))) (piece \"Bankor\" Neutral)}) (rules (start { (place Stack items:{\"Stick2\" \"Stick1\"} 85) (place Stack \"Bankor0\" 85)}) (play (\"RollMove\" (if (= (\"Center\") (where \"Stick\" Mover)) (if (< (value Player Mover) 2) (move Pass (then (set Value Mover (+ 1 (value Player Mover))))) (if (or (= (mover) (\"StateBankor\")) (= 0 (\"StateBankor\"))) (if (!= 0 (\"ThrowValue\")) (\"MoveBankor\")))) (if (!= 0 (\"ThrowValue\")) (forEach Piece))))) (end { (forEach Player if:(no Pieces Player) (result Player Loss)) (forEach Player if:(\"BankorPhaseDone\") (result Player Win))})))\n\n###\n\n", "completion": "(define \"MoveBankor\" (move (from (\"WhereBankor\") level:(\"LevelBankor\")) (to (\"BankorOnTrack\" \"Track\" (\"ThrowValue\"))) (then (and (if (!= (mover) \"StateBankor\") (set State at:(\"WhereBankor\") level:(\"LevelBankor\") (mover))) (if (= (last To) (\"Center\")) (forEach Site (sites Track \"Track\" from:(last From) to:(last To)) (if (!= (site) (last To)) (forEach Level (site) FromTop (remove (site) level:(level))))) (forEach Site (sites Track \"Track\" from:(last From) to:(last To)) (if (!= (site) (last To)) (forEach Level (site) FromTop (fromTo (from (site) level:(level)) (to (last To))))))))))) (define \"Center\" 0) (define \"StateBankor\" (state at:(\"WhereBankor\") level:(\"LevelBankor\"))) (define \"LevelBankor\" (where Level \"Bankor\" Neutral at:(\"WhereBankor\"))) (define \"WhereBankor\" (where \"Bankor\" Neutral)) (define \"BankorPhaseDone\" (or (= (\"WhereBankor\") (\"Center\")) (and (is Occupied (\"Center\")) (>= 1 (count Sites in:(difference (sites Occupied by:All) (\"WhereBankor\"))))))) (define \"BankorOnTrack\" (\"NextSiteOnTrack\" #2 from:(\"WhereBankor\") #1)) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" #2 #1)) (define \"Throw1\" (= (\"ThrowValue\") 1)) (define \"ThrowValue\" (mapEntry \"Throw\" (count Pips))) (game \"Sik\" (players 3) (equipment { (board (spiral turns:5 sites:86) { (track \"Track\" {85..0} directed:True)} use:Vertex) (\"StickDice\" 4) (map \"Throw\" {(pair 0 4) (pair 1 3) (pair 2 0) (pair 3 1) (pair 4 6)}) (piece \"Stick\" Each (move (from (from) level:(level) if:(or (= 1 (state at:(from) level:(level))) (\"Throw1\"))) (to (\"SiteToMoveOnTrack\" \"Track\" (\"ThrowValue\")) if:True) (then (if (!= 1 (state at:(last To) level:(last LevelTo))) (set State at:(last To) level:(last LevelTo) 1))))) (piece \"Bankor\" Neutral)}) (rules (start { (place Stack items:{\"Stick3\" \"Stick2\" \"Stick1\"} 85) (place Stack \"Bankor0\" 85)}) (play (\"RollMove\" (if (= (\"Center\") (where \"Stick\" Mover)) (if (< (value Player Mover) 2) (move Pass (then (set Value Mover (+ 1 (value Player Mover))))) (if (or (= (mover) (\"StateBankor\")) (= 0 (\"StateBankor\"))) (if (!= 0 (\"ThrowValue\")) (\"MoveBankor\")))) (if (!= 0 (\"ThrowValue\")) (forEach Piece))))) (end { (forEach Player if:(no Pieces Player) (result Player Loss)) (forEach Player if:(\"BankorPhaseDone\") (result Player Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nGoal: Connect all three edge colors with a single group of connected stones of your own color. (As in 'Y') \n \n Turns alternate. The player seeking to connect with the darker color starts.\n \n The turns consist of two parts: a conditional conversion of stones in the vicinity of the last placement, followed by one's own placement.\n \n The conversion part requires one to examine the opponent's stones around (and including) the last placed stone. Then to convert into your own, any that are surrounded by more of their own color than of yours. This is done one-by-one in any desired order, until the condition no longer applies.\n \n When no stone has more friendly neighbors than enemy neighbors, the current player places a new stone onto any empty location.\n The first player to connect all 3 sides is the winner.\n \n If the 122* turn protocol option is selected, the turn begins and ends with a placement, and the conversions occur in between. Hex 4-5 Board (48) Alternating\n\n###\n\n", "completion": "(define \"EdgesOfSide\" (intersection (sites Outer Edge) (forEach of:(difference #1 (sites Corners Vertex)) (sites Incident Edge of:Vertex at:(site))))) (define \"BoardColour\" (colour 215 203 170)) (define \"P2Colour\" (colour White)) (define \"P1Colour\" (colour DarkGreen)) (define \"IsConnectedPlayer\" (is Connected 3 {\"Side1\" \"Side2\" \"Side3\"})) (define \"DefectorMove\" (priority (move Add (to (sites Occupied by:Next) if:(< \"MoverLimit\" (count Pieces Next in:(sites Around (to) Orthogonal))) (apply (remove (to)))) (then (moveAgain))) (\"AddToEmpty\" ~))) (define \"AddToEmpty\" (move Add (to (sites Empty)) #1)) (define \"MoverLimit\" (count Pieces Mover in:(sites Around (to) Orthogonal))) (define \"Side3\" (union (sites Side NW) (sites Side SW))) (define \"Side2\" (union (sites Side SE) (sites Side S))) (define \"Side1\" (union (sites Side NE) (sites Side N))) (game \"Defector Y\" (players 2) (equipment { (board (tri Limping 4) use:Vertex) (piece \"Disc\" Each) (piece \"Counter\" Neutral maxState:2)}) (rules (play (if True (\"DefectorMove\") (priority (\"AddToEmpty\" (then (moveAgain))) (\"DefectorMove\")))) (end { (if (\"IsConnectedPlayer\") (result Mover Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nStart: The game starts with a piece in each cell, which defines the challenge to be solved. \n \n Play: The player then makes a series of moves, each involving the removal of a pair of same-coloured pieces that occupy a box (rectangle) that includes no other pieces of any colour.\n \n End: The player wins by removing all pieces from the board. Conversely, the player loses if there are no legal moves at any point while pieces remain on the board. \n\n###\n\n", "completion": "(define \"IsEmptyRectangle\" (\"IsEmptyLine\" #1 #2 column Row row) (\"IsEmptyLine\" #1 #2 row Column column)) (define \"IsEmptyLine\" (if (> (#3 of:#1) (#3 of:#2)) (\"NumNonEmptySitesBetween\" #1 #2 #4 #5 (and (<= (#3 of:(site)) (#3 of:#1)) (>= (#3 of:(site)) (#3 of:#2)))) (\"NumNonEmptySitesBetween\" #1 #2 #4 #5 (and (<= (#3 of:(site)) (#3 of:#2)) (>= (#3 of:(site)) (#3 of:#1)))))) (define \"NumNonEmptySitesBetween\" (= 0 (count Sites in:(intersection (difference (sites Occupied by:All) (sites {#1 #2})) (forEach (union (sites #3 (#4 of:#1)) (sites #3 (#4 of:#2))) if:#5))))) (game \"BoxOff\" (players 1) (equipment { (board (rectangle 6 8)) (piece \"Disc1\" P1) (piece \"Disc2\" P1) (piece \"Disc3\" P1)}) (rules (start { (place Random {\"Disc1\"} count:16) (place Random {\"Disc2\"} count:16) (place Random {\"Disc3\"} count:16)}) (play (move Select (from (sites Occupied by:All)) (to (difference (sites Occupied by:All) (from)) if:(and { (= (what at:(from)) (what at:(to))) (\"IsEmptyRectangle\" (from) (to))})) (then (and (remove (last From)) (remove (last To)))))) (end { (if (no Pieces Mover) (result Mover Win)) (if (no Moves Mover) (result Mover 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 Ludii game based on the following description\n\n Played on an 8x8 board with pieces with specialized moves: Pawns (8): can move one space orthogonally forward, or two steps orthogonally forward on their first move, capture one space diagonally forward; Rooks (2): can move any number of spaces orthogonally; Bishops (2): can move any number of spaces diagonally; Knight (2): moves in any direction, one space orthogonally with one space forward diagonally; Queens (1): can move any number of spaces orthogonally or diagonally, cannot capture another Queen; Kings (1): can move one space orthogonally or diagonally, but on the first turn may move two squares provided it is not currently in check. The King cannot capture with this move. Castling, En Passant, and Pawn promotion allowed. Pawns promote to Queens when reaching the last row on the board only if that player's Queen has already been captured. An opponent's piece is captured by moving a player's own piece onto a space occupied by the opponent's piece. When a King can be captured on the next turn by an opponent's piece, it is in check. The King must not be in check at the end of the player's turn. If this is not possible, it is checkmate and the opponent wins. If the opponent is reduced to only a king, it is considered a win. Stalemate is also a win for the player causing the stalemate. \n \n \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 \"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 \"CaptureToPiece\" (apply (if (\"IsEnemyAt\" (to)) (remove (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 \"Scachs\" (\"TwoPlayersNorthSouth\") (equipment { (board (square 8)) (\"ChessPawn\" \"Pawn\" (or \"InitialPawnMove\" \"EnPassant\") (then (if (and (\"IsOffBoard\" (where \"Queen\" Mover)) (is In (last To) (sites Mover \"Promotion\"))) (promote (last To) (piece {\"Queen\"}) Mover)))) (\"ChessRook\" \"Rook\" ~ (\"RememberPieceHasMoved\")) (piece \"King\" Each (or (if (and (not (\"IsInCheck\" \"King\" Mover)) (\"HasNeverMoved\" \"King\")) (move Slide (between (exact 2)) (to if:(is Empty (to))))) (\"StepToNotFriend\") \"RememberPieceHasMoved\")) (\"ChessBishop\" \"Bishop\") (\"ChessKnight\" \"Knight\") (piece \"Queen\" Each (move Slide (to if:(and (not (\"IsPieceAt\" \"Queen\" Next (to))) (\"IsEnemyAt\" (to))) \"CaptureToPiece\"))) (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 (do (or (forEach Piece) (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\")))) ifAfterwards:(not (\"IsInCheck\" \"King\" Mover)))) (end { (\"Checkmate\" \"King\") (if (= 1 (count Pieces Next)) (result Mover Win)) (\"BlockWin\")}))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"NoEdgeBetweenCells\" (not (\"NoSites\" (sites Around (to) Own Orthogonal if:(\"NoSites\" (difference \"EdgeInCommon\" (sites Empty Edge))))))) (define \"EdgeInCommon\" (intersection (sites Incident Edge of:Cell at:(from)) (sites Incident Edge of:Cell at:(to)))) (define \"NumContainmentByTurn\" 4) (define \"NumContagionByTurn\" 3) (game \"Contagion\" (players 2) (equipment { (board (rectangle 8 8))}) (rules (start (set Score P2 (* (count Rows) (count Columns)))) phases:{ (phase \"InitContagion\" P1 (play (move Add (to Cell (sites Empty Cell)) (then (and (if (< (count MovesThisTurn) (- \"NumContagionByTurn\" 1)) (moveAgain)) (addScore {P1 P2} {1 -1}))))) (nextPhase (not (is Next Mover)) \"ContagionGrowth\")) (phase \"ContagionGrowth\" P1 (play (move Add (to Cell (sites Empty Cell) if:(\"NoEdgeBetweenCells\")) (then (and (if (< (count MovesThisTurn) (- \"NumContagionByTurn\" 1)) (moveAgain)) (addScore {P1 P2} {1 -1})))))) (phase \"Containment\" P2 (play (move Add (to Edge (sites Empty Edge)) (then (if (< (count MovesThisTurn) (- \"NumContainmentByTurn\" 1)) (moveAgain))))))} (end { (if (> (score P1) (/ (* (count Rows) (count Columns)) 2)) (result P1 Win)) (if (no Moves P1) (result P2 Win))})))\n\n###\n\n", "completion": "The face player places three faces each turn. The edge player places four edges each turn. The face player goes first and can specify any locations on the board on their first turn. On all subsequent turns the face player can only place a face next to another face (orthogonally), that does not pass through an edge. The edge player can place their four lines anywhere. The game is finished when the face player cannot add a piece or if they cover more than half the board. The game is played on a 8x8 board 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 Ludii game based on the following description\nEach row and column is assigned a number. The player then places a number from 1 to 9 in each square so that it adds up to the assigned number in each row and column. Numbers cannot be duplicated in any row or column. \n\n###\n\n", "completion": "(game \"Kakuro\" (players 1) (equipment { (board (rectangle 14 12) (values Cell (range 1 9))) (hints { (hint {2 3} 16) (hint {5 6 7} 24) (hint {9 10} 13) (hint {14 15} 14) (hint {17 18 19} 20) (hint {21 22} 14) (hint {25 26} 3) (hint {28 29} 4) (hint {31 32} 17) (hint {34 35} 3) (hint {37 38} 4) (hint {40 41 42 43 44} 25) (hint {46 47} 16) (hint {49 50 51} 24) (hint {53 54 55} 6) (hint {57 58 59} 24) (hint {61 62 63 64 65} 35) (hint {67 68 69 70 71} 35) (hint {75 76} 17) (hint {80 81} 17) (hint {85 86 87 88 89} 27) (hint {91 92 93 94 95} 22) (hint {97 98 99} 6) (hint {101 102 103} 7) (hint {105 106 107} 7) (hint {109 110} 4) (hint {112 113 114 115 116} 32) (hint {118 119} 16) (hint {121 122} 12) (hint {124 125} 15) (hint {127 128} 14) (hint {130 131} 6) (hint {134 135} 4) (hint {137 138 139} 22) (hint {141 142} 7) (hint {146 147} 7) (hint {149 150 151} 15) (hint {153 154} 6) (hint {3 15} 17) (hint {6 18} 14) (hint {9 21} 16) (hint {28 40} 3) (hint {32 44} 16) (hint {42 54} 4) (hint {25 37 49 61} 19) (hint {2 14 26 38 50 62} 34) (hint {5 17 29 41 53 65} 31) (hint {7 19 31 43 55 67} 38) (hint {10 22 34 46 58 70} 37) (hint {35 47 59 71} 24) (hint {64 76 88} 24) (hint {68 80 92} 24) (hint {51 63 75 87 99} 31) (hint {57 69 81 93 105} 34) (hint {102 114} 4) (hint {85 97 109 121} 11) (hint {112 124} 12) (hint {116 128} 12) (hint {95 107 119 131} 14) (hint {86 98 110 122 134 146} 22) (hint {135 147} 3) (hint {89 101 113 125 137 149} 37) (hint {138 150} 16) (hint {91 103 115 127 139 151} 35) (hint {141 153} 4) (hint {94 106 118 130 142 154} 24)}) (regions HintRegions)}) (rules (play (satisfy { (is Sum (hint)) (all Different)})) (end (if (is Solved) (result P1 Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nPlayed on cross-shaped board, made of five squares, each divided into four squares and with the diagonals of the larger squares drawn. One player plays as seventeen hens, which begin on the points on one of the arms of the cross and along the line immediately perpendicular to that arm, and on the two outermost points on the left and right arms. The other player plays as one fox, which starts on the central point of the board. Players alternate turns moving to an empty adjacent spot along the lines of the board. The hens, however, can only move in a forward or horizontal direction. The fox hops over an adjacent hen to an empty spot immediately on the opposite side of the hen along the lines of the board. At the beginning of the game, the players choose whether to allow the fox the ability to make multiple captures in one turn. If the fox is able to capture but does not, the opponent adds another hen on an empty point in the bottom row. If there is no empty spot on the bottom row, the player waits until there is one to place the new hen. The fox wins by capturing all of the hens or by moving to the furthest line on the hens' side of the board. The hens win by blocking the fox from being able to move.\n The fox can capture one single piece.\n\n###\n\n", "completion": "(define \"BottomEmptySites\" (intersection (sites Empty) (sites Bottom))) (define \"HenAdded\" (set Value Prev (- (value Player Prev) 1))) (define \"DidNotCaptured\" (> (value Player Prev) 0)) (define \"HasNotCaptured\" (if (< (value Player Mover) 0) (set Value Mover 1) (set Value Mover (+ 1 (value Player Mover))))) (define \"HopCustomSequenceCapture\" (move Hop #1 #2 (between if:(\"IsEnemyAt\" (between)) (apply (remove (between) #3))) (to if:(is Empty (to))) (then (if (can Move (hop (from (last To)) #2 (between if:(and (not (is In (between) (sites ToClear))) (\"IsEnemyAt\" (between))) (apply (remove (between) #3))) (to if:(is Empty (to))))) (moveAgain))))) (define \"ShouldCapturedButMoved\" (and (is Pending) (not (is In (last To) (\"SitesWithPossibleCaptureInPreviousTurn\"))))) (define \"SitesWithPossibleCaptureInPreviousTurn\" (sites Pending)) (define \"RememberSiteWithPossibleMultiCapture\" (set Pending (sites To (if (\"SameTurn\") #1 (forEach Piece \"Fox\" #2))))) (define \"RememberSiteWithPossibleCapture\" (set Pending (sites To (forEach Piece \"Fox\" #1)))) (game \"Renard et les Poules\" (players 2) (equipment { (\"CrossBoard\" 3 7 use:Vertex diagonals:Alternating) (hand P1) (piece \"Fox\" P1 S (or (\"HopCapture\") (\"StepToEmpty\"))) (piece \"Hen\" P2 N (\"StepToEmpty\" (directions {Forwards Rightward Leftward})))}) (rules (start { (place \"Fox1\" (centrePoint)) (place \"Hen2\" (union {(expand (sites Bottom)) (sites Row 2) (sites {\"A4\" \"G4\" \"A5\" \"G5\"})}))}) phases:{ (phase \"FoxPhase\" P1 (play (do (\"RememberSiteWithPossibleCapture\" (\"HopCapture\")) next:(forEach Piece (then (if (\"ShouldCapturedButMoved\") (\"HasNotCaptured\"))))))) (phase \"HenPhase\" P2 (play (if (and (\"DidNotCaptured\") (!= 0 (count Sites in:(\"BottomEmptySites\")))) (move Add (to (\"BottomEmptySites\")) (then (and (\"HenAdded\") (moveAgain)))) (forEach Piece))))} (end { (if (no Moves P1) (result P1 Loss)) (if (or (is In (where \"Fox\" P1) (sites Bottom)) (no Pieces P2)) (result P1 Win))}))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe game CrossGeo can be played on graphs with any number of edges in a geometric plane, where there are some edges crossing with other edges. The edge colours are related to the playing rules of each version. For the basic version, CrossGeo, all edges have the same colour; green. In each turn, a player selects an edge to remove it, and all its intersecting edges. The player who removes the last edge is the winner of the game. The second version is the Red-Blue version; CrossGeoR-B. There are two players, one red and one blue. Players can only select the edges of their own colours. In each turn, a player selects an edge to remove it, and all its intersecting lines (of any colour). The last version is CrossGeoR-G-B; there are sets of red, green, and blue edges, with some edges crossing. Players can select the edges of their own colours or of the green colour. Importantly, the green edges are used as shared edges between both players. At each turn, a player selects an edge to remove it and all its intersecting lines (of any colour). For all the versions of CrossGeo, if the current player has no move, then the opposing player wins. The players play on CrossGeo version.\n\n###\n\n", "completion": "(game \"CrossGeo\" (players 2) (equipment { (board (graph vertices:{ {2 0} {3 0} {1 1} {1 2} {0 2} {0 4} {1 3} {1 5} {2 4} {2 2} {4 2} {3 3} {3 1} {5 1} {6 2} {6 1} {8 1} {7 3} {9 3} {9 1} {8 4} {8 2} {10 3} {11 2} {11 1} {13 1} {13 3} {14 2} {10 3} {10 5} {8 5} {9 6} {12 3} {11 4} {13 6} {12 4} {14 6} {11 6} {5 7} {11 7} {8 7} {8 6} {7 6} {7 8} {4 4} {5 3} {6 4} {5 5} {7 5} {6 6} {1 7} {3 7} {2 6} {4 6} {3 5} {13 4}} edges:{ {0 1} {0 2} {2 3} {1 3} {4 5} {5 8} {6 7} {9 10} {11 12} {12 13} {14 15} {15 16} {17 18} {18 19} {20 21} {21 22} {23 27} {24 25} {25 26} {28 29} {29 30} {31 32} {33 34} {35 36} {37 55} {42 43} {38 39} {40 41} {44 46} {46 49} {45 47} {47 48} {52 53} {50 51} {51 54}}) use:Edge) (piece \"Disc\" Each) (piece \"Marker\" Shared)}) (rules (start { (set Shared Edge (sites Board Edge))}) (play (move Remove (sites Occupied by:Shared) (then (forEach Site (sites Crossing at:(last To) All) (remove Edge (to)))))) (end (if (no Moves Mover) (result Next Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nThe puzzle consists of a triangular grid of cells containing digits from 1 to 9. The objective is to fill a grid with digits so that each cell contains a digit and no digit is repeated in any column, row and diagonal in any direction. Also, no digit occurs twice in any of the three larger 3 x 3 square regions and any of the three larger triangular regions enclosed by thick borders. \n\n###\n\n", "completion": "(game \"Sujiken\" (players 1) (equipment { (board (remove (square 9) cells:{ 73 74 75 76 77 78 79 80 65 66 67 68 69 70 71 57 58 59 60 61 62 49 50 51 52 53 41 42 43 44 33 34 35 25 26 17}) (values Cell (range 1 9))) (regions {Columns Rows}) (regions {39 43}) (regions {35 40}) (regions {30 36 41}) (regions {24 31 37}) (regions {17 25 32 38}) (regions {9 18 26 33}) (regions {0 10 19 27 34}) (regions {1 11 20 28}) (regions {2 12 21 29}) (regions {3 13 22}) (regions {4 14 23}) (regions {5 15}) (regions {6 16}) (regions {9 1}) (regions {17 10 2}) (regions {24 18 11 3}) (regions {30 25 19 12 4}) (regions {35 31 26 20 13 5}) (regions {39 36 32 27 21 14 6}) (regions {42 40 37 33 28 22 15 7}) (regions {44 43 41 38 34 29 23 16 8}) (regions {0 1 2 9 10 11 17 18 19}) (regions {3 4 5 12 13 14 20 21 22}) (regions {6 7 8 15 16 23}) (regions {24 25 26 30 31 32 35 36 37}) (regions {27 28 29 33 34 38}) (regions {39 40 41 42 43 44})}) (rules (start (set { {0 6} {1 9} {3 2} {5 8} {7 7} {9 2} {10 1} {12 5} {14 9} {16 3} {20 3} {24 9} {25 3} {26 1} {28 8} {33 9} {34 5} {35 4} {36 8} {42 3} {43 4}})) (play (satisfy (all Different))) (end (if (is Solved) (result P1 Win))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"Move\" (move (from (sites Occupied by:All)) (to (union (sites Around (sites Distance (step Orthogonal (to if:(is In (to) (sites Empty)))) from:(from) (range 1 (count Sites in:(sites Board)))) Orthogonal) (sites Around (from) Orthogonal)) if: (and (= (what at:(from)) (what at:(to))) (not (= (from) (to)))) (apply (and (remove (from)) (remove (to))))))) (game \"Shisen-Sho\" (players 1) (equipment { (board (rectangle (+ 12 0)(+ 14 0))) (piece \"BambooOne\" P1) (piece \"BambooTwo\" P1) (piece \"BambooThree\" P1) (piece \"BambooFour\" P1) (piece \"BambooFive\" P1) (piece \"BambooSix\" P1) (piece \"BambooSeven\" P1) (piece \"BambooEight\" P1) (piece \"BambooNine\" P1) (piece \"CharacterOne\" P1) (piece \"CharacterTwo\" P1) (piece \"CharacterThree\" P1) (piece \"CharacterFour\" P1) (piece \"CharacterFive\" P1) (piece \"CharacterSix\" P1) (piece \"CharacterSeven\" P1) (piece \"CharacterEight\" P1) (piece \"CharacterNine\" P1) (piece \"CircleOne\" P1) (piece \"CircleTwo\" P1) (piece \"CircleThree\" P1) (piece \"CircleFour\" P1) (piece \"CircleFive\" P1) (piece \"CircleSix\" P1) (piece \"CircleSeven\" P1) (piece \"CircleEight\" P1) (piece \"CircleNine\" P1) (piece \"DragonGreen\" P1) (piece \"DragonRed\" P1) (piece \"DragonWhite\" P1) (piece \"FlowerBamboo\" P1) (piece \"FlowerChrysanthemum\" P1) (piece \"FlowerOrchid\" P1) (piece \"FlowerPlum\" P1) (piece \"SeasonSpring\" P1) (piece \"SeasonSummer\" P1) (piece \"SeasonAutumn\" P1) (piece \"SeasonWinter\" P1) (piece \"WindNorth\" P1) (piece \"WindEast\" P1) (piece \"WindWest\" P1) (piece \"WindSouth\" P1) (regions \"TilePlacementRegion\" (sites Board))}) (rules (start { (place Random (sites \"TilePlacementRegion\") {\"BambooOne\" \"BambooTwo\" \"BambooThree\" \"BambooFour\" \"BambooFive\" \"BambooSix\" \"BambooSeven\" \"BambooEight\" \"BambooNine\" \"CharacterOne\" \"CharacterTwo\" \"CharacterThree\" \"CharacterFour\" \"CharacterFive\" \"CharacterSix\" \"CharacterSeven\" \"CharacterEight\" \"CharacterNine\" \"CircleOne\" \"CircleTwo\" \"CircleThree\" \"CircleFour\" \"CircleFive\" \"CircleSix\" \"CircleSeven\" \"CircleEight\" \"CircleNine\" \"DragonGreen\" \"DragonRed\" \"DragonWhite\" \"FlowerBamboo\" \"FlowerChrysanthemum\" \"FlowerOrchid\" \"FlowerPlum\" \"SeasonSpring\" \"SeasonSummer\" \"SeasonAutumn\" \"SeasonWinter\" \"WindNorth\" \"WindEast\" \"WindWest\" \"WindSouth\"} count:4)}) (play \"Move\") (end (if (no Pieces All) (result P1 Win)))))\n\n###\n\n", "completion": "Player choose a pair of identical tiles to connect. If the requirements are met, two tiles will be eliminated. The player\u2019s task is to eliminate all the tiles on the board. The game is over if future moves are not possible and tiles are left on the board, or the player successfully removes all the tiles. Small Size No outer ring of spaces END" }, { "prompt": "Construct a Ludii game based on the following description\nFour 3x5 grids, arranged in four corners of a rectangular board. Three pieces per player. Five cowrie shells used as dice; the value of the throw equaling the number of the mouths which land face up. Players begin by entering their pieces onto the board from the square in the central row of the grid to their right. A single piece may be entered with a throw of 1, or all of the player's pieces may be entered with a throw of 5. Throws of 1 and 5 grant the player another throw, and pieces are moved only after all of the players throws are made. Play proceeds down the central row where the pieces entered, in an anti-clockwise direction until reaching the bottom right hand corner of the left grid, at which point the track continues on the opponent's side of the board from the top right corner of the left board (with respect to the current player), proceeding around the opponent's grids in an anti-clockwise direction until reaching the top left square of the opponent's right grid. At this point, the piece returns to the player's own right grid, on the bottom left corner, and proceeding in an anti-clockwise direction into the central row, and off the board once moving past the final space. When a player lands on a space occupied by an opponent's piece, the opponent's piece is removed from the board and must re-enter as before. Pieces are safe from being sent back when resting on the left two corners of each grid on the left and the right two corners of each grid on the right. The first player to remove all of their pieces from the board wins.\n \n\n###\n\n", "completion": "(define \"ThrowMove\" (if (\"HasToThrow\") (\"RollMove\" (if (\"IfMoveAgain\") (do (set Value Mover (count Pips)) next:(\"Move\")) (move Pass (then (set Value Mover (count Pips)))))) (\"Move\"))) (define \"Move\" (if (and (= \"ThrowValue\" 1) (\"HandOccupied\" Mover)) (move (from (handSite Mover)) (to (mapEntry \"EntrySite\" (mover))) (then (\"ThrowAgainAndPlay\"))) (if (and (= \"ThrowValue\" 5) (\"HandOccupied\" Mover)) (move (from (handSite Mover)) (to (mapEntry \"EntrySite\" (mover))) count:(count Cell at:(handSite Mover)) (then (\"ThrowAgainAndPlay\"))) (forEach Piece)) (then (\"StopTurnIfNoMoveAgain\")))) (define \"IfMoveAgain\" (= (value Player Mover) -2)) (define \"ThrowAgainAndPlay\" (and (moveAgain) (set Value Mover -2))) (define \"StopTurnIfNoMoveAgain\" (if (!= (value Player Mover) -2) (set Value Mover -1))) (define \"HasToThrow\" (< (\"ThrowValue\") 0)) (define \"CaptureEnemyPiece\" (apply if:(\"IsEnemyAt\" (to)) (fromTo (from (to)) (to (handSite Next)) count:(count at:(to))))) (define \"RemoveAPiece\" (move Remove (from))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" (\"ThrowValue\"))) (define \"ThrowValue\" (value Player Mover)) (game \"Len Doat\" (players 2) (equipment { (board (merge { (rectangle 3 5) (shift 7.5 0 (rectangle 3 5)) (shift 0 3.5 (rectangle 3 5)) (shift 7.5 3.5 (rectangle 3 5))}) { (track \"Track1\" \"20,E,N,W,14,W,S,E,44,W,S,E,45,E,N,W,15,E,N1,W,End\" P1 directed:True) (track \"Track2\" \"39,W,S,E,45,E,N,W,15,E,N,W,14,W,S,E,44,W,S1,E,End\" P2 directed:True)}) (\"StickDice\" 5) (hand Each) (piece \"Marker\" Each (if (\"IsEndTrack\" \"SiteToMoveOnTrack\") \"RemoveAPiece\" (if (\"IsNotOffBoard\" \"SiteToMoveOnTrack\") (if (if (not (\"IsEnemyAt\" \"SiteToMoveOnTrack\")) True (not (is In \"SiteToMoveOnTrack\" (sites \"Protect\")))) (move (from) (to \"SiteToMoveOnTrack\" \"CaptureEnemyPiece\") (then (if (or (= 1 (value Player Mover)) (= 5 (value Player Mover))) (\"ThrowAgainAndPlay\")))))))) (map \"EntrySite\" {(pair P1 (coord \"F2\")) (pair P2 (coord \"E5\"))}) (regions \"Protect\" (sites {\"A1\" \"A3\" \"A4\" \"A6\" \"J1\" \"J3\" \"J4\" \"J6\"}))}) (rules (start (place \"Marker\" \"Hand\" count:3)) (play (if (can Move (\"ThrowMove\")) (\"ThrowMove\") (move Pass (then (and (if (or (= 1 (value Player Mover)) (= 5 (value Player Mover))) (\"ThrowAgainAndPlay\")) (\"StopTurnIfNoMoveAgain\")))))) (end (\"EscapeWin\")))) END" }, { "prompt": "Construct a Ludii game based on the following description\nEach player begins at the end of one of the \\ Rules from Seleucid.\n\n###\n\n", "completion": "(define \"SiteAfterBridge\" 10) (define \"MoveOnTrack\" (if (\"IsEndTrack\" (\"SiteToMoveOnTrack\" #1)) \"RemoveAPiece\" (if (and (\"IsNotOffBoard\" (\"SiteToMoveOnTrack\" #1)) (not (\"IsFriendAt\" (\"SiteToMoveOnTrack\" #1)))) (move (from) (to (\"SiteToMoveOnTrack\" #1) \"CaptureEnemyPiece\"))))) (define \"CaptureEnemyPiece\" (\"HittingCapture\" (handSite Next))) (define \"RemoveAPiece\" (move Remove (from))) (define \"SiteToMoveOnTrack\" (\"NextSiteOnTrack\" (\"ThrowValue\") #1)) (define \"ThrowValue\" (if (= 2 (count Pips)) 1 (if (= 1 (count Pips)) 2 3))) (game \"Knossos Game\" (players 2) (equipment { (board (merge { (rectangle 1 4) (shift 1 1 (rectangle 1 2)) (shift 0 -2 (rectangle 3 1)) (shift 3 -2 (rectangle 3 1)) (shift 1.5 4 (scale 2 (rectangle 2 1))) (shift 0 5 (scale 3 (rectangle 1 2)))}) { (track \"TrackBottom1\" \"14,6,7,0,1,4\") (track \"TrackBottom2\" \"15,8,9,3,2,5\") (track \"TrackOpposite1\" \"7,0,1,2,5\") (track \"TrackOpposite2\" \"9,3,2,1,4\") (track \"TrackCross1\" \"0,1,4,10,12,11\") (track \"TrackCross2\" \"3,2,5,10,13,11\") (track \"TrackTop1\" \"10,12,11,End\") (track \"TrackTop2\" \"10,13,11,End\")} use:Vertex) (\"StickDice\" 2) (piece \"RoundPawn\" Each (or { (\"MoveOnTrack\" \"TrackBottom1\") (\"MoveOnTrack\" \"TrackBottom2\") (\"MoveOnTrack\" \"TrackOpposite1\") (\"MoveOnTrack\" \"TrackOpposite2\") (if (is Mover P1) (\"MoveOnTrack\" \"TrackTop1\") (\"MoveOnTrack\" \"TrackTop2\")) (if (and { (not (\"IsFriendAt\" (\"SiteAfterBridge\"))) (= 3 (\"ThrowValue\")) (not (is In (from) (sites \"TopSites\")))}) (if (or (can Move (\"MoveOnTrack\" \"TrackCross1\")) (can Move (\"MoveOnTrack\" \"TrackCross2\"))) (move (from) (to (\"SiteAfterBridge\") \"CaptureEnemyPiece\"))))})) (hand Each) (regions \"TopSites\" (sites {10..13}))}) (rules (start (place \"RoundPawn\" \"Hand\" count:2)) (play (\"RollMove\" (or (forEach Piece) (forEach Piece container:(mover))) (then (if (no Pieces Mover) (and (addScore Mover 1) (if (!= (score Mover) 2) (and { (forEach Site (sites Occupied by:All container:\"Board\") (remove (site))) (if (!= 0 (who at:(handSite P1))) (remove (handSite P1))) (if (!= 0 (who at:(handSite P2))) (remove (handSite P2))) (add (piece (id \"RoundPawn\" P1)) (to (handSite P1)) count:2) (add (piece (id \"RoundPawn\" P2)) (to (handSite P2)) count:2)}))) (if (= 3 (\"ThrowValue\")) (moveAgain)))))) (end (if (= (score Mover) 3) (result Mover Win))))) END" }, { "prompt": "Construct a Ludii game based on the following description\nStructure of Play:\n There is no passing.\n Maroon chooses to remove up to two nodes of the board before passing to White. \n Then White places an initial stone onto a remaining node on the board.\n \n After this play alternates, two turns per player, until one player cannot complete both turns. That player loses\n \n On each of the turns, the current player must either:\n - - place a stone on an empty node that the opponent does not control, or\n - - remove an opponent's stone that the current player controls.\n \n A player controls a node and any stone on it when the count of his stones that are adjacent to the node, exceed those of his opponent by the node-control value chosen for the game, or more. (default is 3)\n \n -- For example 4 is 3 greater than 1, so a node surrounded by 4 White and 1 Maroon is controlled by White if 3 was chosen as the game parameter (also if 1 or 2 were chosen).\n \n There are options for the board size and type, and the number of surplus stones needed to control a node. Order 3 board Hex N/N+2 grid w/even nodes, no center Strategic. Control a site with a surplus of 3 on lines of sight.\n\n###\n\n", "completion": "(define \"ColourBackground\" (colour 135 170 130)) (define \"SquareDiagonal\" (board (square 6) use:Vertex)) (define \"SquareGrid\" (board (square 6) use:Vertex)) (define \"Hex2Limp\" (board (dual (hex (/ 6 2) (+ 2 (/ 6 2)))) use:Vertex)) (define \"BoardUsed\" \"Hex2Limp\") (define \"LoSDirection\" Orthogonal) (define \"MoveTwiceThenScore\" (if (is Prev Next) (moveAgain) (and (\"ScoreFor\" Mover) (\"ScoreFor\" Next)))) (define \"ScoreFor\" (set Score #1 (+ (results from:(forEach (difference (difference (sites Board) (sites Occupied by:#1)) (sites Occupied by:Neutral)) if:(\"IsControlledBy\" #1 (site))) to:(from) (if (is Empty (to)) 1 2))))) (define \"IsControlledBy\" (<= (+ 3 (count Pieces in:(sites Around (#2) \"LoSDirection\" if:(!= 0 (who at:(to)))))) (* 2 (count Pieces #1 in:(sites Around (#2) \"LoSDirection\"))))) (game \"Dogtown Clans\" (players 2) (equipment { \"BoardUsed\" (piece \"Counter\" P1) (piece \"Counter\" P2) (piece \"X\" Neutral) (piece \"Counter\" Neutral)}) (rules (meta (passEnd NoEnd)) (play (if (and (= -1 (var \"DoubleTurnPhase\")) (= 1 (mover))) (or (move Pass) (move Add (piece \"X0\") (to (sites Empty)) (then (if (> 2 (count Pieces in:(sites Occupied by:Neutral))) (moveAgain))))) (or { (move Add (to (sites Empty) if:(not (\"IsControlledBy\" Next (to)))) (then (if (= -1 (var \"DoubleTurnPhase\")) (set Var \"DoubleTurnPhase\" 1) (\"MoveTwiceThenScore\")))) (move Remove (forEach (sites Occupied by:Next) if:(\"IsControlledBy\" Mover (site))) (then (\"MoveTwiceThenScore\")))}) (then (if (no Moves Next) (and (\"ScoreFor\" Mover) (\"ScoreFor\" Next)))))) (end (if (no Moves Mover) (result Mover Loss))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(game \"Diagonals (2002)\" (players 2) (equipment { (board (rectangle 5 10) use:Vertex) (piece \"Ball\" Each) (piece \"Ball\" Neutral)}) (rules (start { (place \"Ball1\" (intersection (expand (sites Bottom)) (sites Right))) (place \"Ball2\" (intersection (expand (sites Top)) (sites Left)))}) (play (or (move Add (to (intersection (sites Direction from:(sites Occupied by:Mover) Diagonal stop:(is Occupied (to))) (sites Empty)))) (move Select (from (forEach (sites Occupied by:Next) if:(!= 0 (count Sites in:(intersection (sites LineOfSight at:(site) Diagonal) (sites Occupied by:Mover)))))) (then (and (remove (last To)) (add (piece (id \"Ball\" Neutral)) (to (last To)))))))) (end (if (and (no Moves P1) (no Moves P2)) (byScore { (score P1 (count Pieces P1)) (score P2 (count Pieces P2))})))))\n\n###\n\n", "completion": "MOVE - On each turn, a player may do one of the following actions:\n - Drop a friendly stone at an empty cell, which is in a diagonal line of sight with another friendly stone, i.e., both stones must be separated by a diagonal line of empty cells. \n - Transform an enemy stone, at a diagonal line of sight of a friendly stone, into a wall (which is a neutral stone).\n \n GOAL - When there are no valid moves, wins the player with more friendly stones. END" }, { "prompt": "Construct a Ludii game based on the following description\nPlay begins with two seeds in each hole. Each player owns the two rows closest to them. Play proceeds by taking the seeds from one hole and sowing them one by one in consecutive holes in an anti-clockwise direction. If the last seed falls in a hole in the inner row, and the opponent's hole opposite it is not empty, then the opponent's seeds in that hole are captured. Players can only play from holes with single counters when there is no other option, and they may not sow into another hole that already contains a counter. Play continues until one player no longer has any seeds. \n\n###\n\n", "completion": "(define \"PiecesOwnedBy\" (+ (count Cell at:(handSite #1)) (count in:(sites #1 \"Home\")))) (define \"Sow\" (move Select (from (sites Mover \"Home\") if:#1) (then (sow \"Track\" owner:(mover) if:(and { (= (count at:(to)) 1) (is In (to) (sites Mover \"Inner\")) (> (count at:(\"OppositePit\" (to))) 0)}) apply:(fromTo (from (\"OppositePit\" (to))) (to (handSite Mover)) count:(count at:(\"OppositePit\" (to)))))))) (define \"Columns\" 7) (game \"Hawalis\" (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)}) (regions \"Home\" P1 (sites Track \"Track1\")) (regions \"Home\" P2 (sites Track \"Track2\")) (regions \"Inner\" P1 (difference (sites Track \"Track1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"Track2\") (sites Top))) (piece \"Seed\" Shared) (hand Each)}) (rules (start (set Count 2 to:(union (sites P1 \"Home\") (sites P2 \"Home\")))) (play (priority (\"Sow\" (> (count at:(from)) 1)) (\"Sow\" (= (count at:(from)) 1)))) (end (\"MancalaByScoreWhen\" (no Moves Mover))))) END" }, { "prompt": "Describe the mechanics of the following Ludii game\n(define \"Line3WithSingleOpponent\" (if (is Line 2 Orthogonal) (or { (\"Line3SingleDirection\" N S) (\"Line3SingleDirection\" S N) (\"Line3SingleDirection\" E W) (\"Line3SingleDirection\" W E)}))) (define \"Line3SingleDirection\" (if (!= (ahead (last To) #1) (last To)) (if (= (mover) (who at:(ahead (last To) #1))) (or (if (!= (ahead (last To) steps:2 #1) (last To)) (if (= (next) (who at:(ahead (last To) steps:2 #1))) (if (!= (ahead (last To) steps:3 #1) (last To)) (if (is Empty (ahead (last To) steps:3 #1)) (remove (ahead (last To) steps:2 #1)))))) (if (!= (ahead (last To) #2) (last To)) (if (= (next) (who at:(ahead (last To) #2))) (if (!= (ahead (last To) steps:2 #2) (last To)) (if (is Empty (ahead (last To) steps:2 #2)) (remove (ahead (last To) #2)))))))))) (game \"Six Insect Game\" (players 2) (equipment { (board (square 4)) (piece \"Marker\" Each (\"StepToEmpty\" Orthogonal (then (\"Line3WithSingleOpponent\"))))}) (rules (start { (place \"Marker1\" (union (intersection (union (sites Right) (sites Left)) (sites Row 1)) (sites Bottom))) (place \"Marker2\" (union (intersection (union (sites Right) (sites Left)) (sites Row 2)) (sites Top)))}) (play (forEach Piece)) (end (\"CaptureAll\" Next))))\n\n###\n\n", "completion": "4x4 board. Six pieces per player, which begin on opposite rows of the board and in the two outer squares in the row in front of it. Players alternate turns moving a piece orthogonally to an adjacent space on the board. When a player moves a piece such that it creates three in a row: two of their own pieces (which must be adjacent to one another) and one of the opponent's pieces (which must have a vacant space on the opposite side of it), the opponent's piece is captured. However, when the opponent's piece moves in line with two of the player's piece on the opponent's turn, the player does not capture the opponent's piece. The player who captures all of the opponent's pieces wins.\n END" }, { "prompt": "Construct a Ludii game based on the following description\n4x6-21 board; 8 is most common, 12, 15, and 18 are also popular. Two counters in each hole in the players' outer rows. Sowing occurs in an anti-clockwise direction, only in the two rows belonging to the player. When the final counter lands in an occupied hole, these are picked up and sowing continues. When the final counter lands in an empty hole in the inner row, any counters in the opposite hole in the opponent's inner row are captured. If there also are counters in the opposite hole in the opponent's outer row, these are also captured, but only if there was first a capture from the inner row hole. Captured counters are then sown on the player's own side of the board, starting with the hole following the one from which the capture was triggered. Players cannot sow from a hole with a single counter unless there are no holes with multiple counters. Single counters can only be sown into an empty hole. Play continues until one player has captured all of the opponent's counters, thus winning the game.\n 8 Holes per row.\n\n###\n\n", "completion": "(define \"NextHoleFrom\" (\"NextSiteOnTrack\" 1 from:#1 #2)) (define \"AHoleHasMoreThanOneCounter\" (not (all Sites (forEach (sites Mover) if:(< 1 (count at:(site)))) if:(= 0 (count at:(site)))))) (define \"NoPiece\" (all Sites (sites Player \"Home\") if:(= 0 (count at:(site))))) (define \"Columns\" 8) (game \"Tsoro (Reentered Captures)\" (players 2) (equipment { (mancalaBoard 4 \"Columns\" store:None { (track \"Track1\" \"0,E,N1,W\" loop:True P1) (track \"Track2\" \"16,E,N1,W\" loop:True P2)}) (regions \"Home\" P1 (sites Track \"Track1\")) (regions \"Home\" P2 (sites Track \"Track2\")) (regions \"Inner\" P1 (difference (sites Track \"Track1\") (sites Bottom))) (regions \"Inner\" P2 (difference (sites Track \"Track2\") (sites Top))) (piece \"Seed\" Shared)}) (rules (start (set Count 2 to:(union (sites Top) (sites Bottom)))) (play (move Select (from (if (\"SameTurn\") \"LastHoleSowed\" (sites Mover \"Home\")) if:(if \"AHoleHasMoreThanOneCounter\" (> (count at:(from)) 1) (and (= (count at:(from)) 1) (= 0 (count at:(\"NextHoleFrom\" (from) Mover)))))) (then (sow \"Track\" owner:(mover) apply:(if (= (count at:(to)) 1) (if (is In (to) (sites Mover \"Inner\")) (if (> (count at:(\"OppositePit\" (to))) 0) (and { (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:(\"OppositeOuterPit\" (to))) (count at:(\"OppositePit\" (to)))) \"Track\" owner:(mover))}))) (moveAgain)))))) (end (forEach NonMover if:(\"NoPiece\") (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 the base of the triangle, and another bisecting this line. One player plays as two tigers, the other as 23 people. One of the tigers begins on any spot on the board. Eight of the people begin on the spots surrounding the central point of the board. The tiger player, on their first turn, removes one of the people and then places the second tiger anywhere on the board. The people then play, placing one of the remaining people on an empty spot on the board. On the tiger's turn, the player may move one of the tigers to an empty adjacent spot along the lines of the board. The tiger may also capture a person by hopping over it to an empty adjacent spot immediately on the opposite side of it along the lines of the board. When all of the people are placed, they move to an empty adjacent spot along the lines of the board on their turn. The tigers win by capturing all the people; the people win by blocking both tigers from being able to move. The two tigers start in the hand.\n\n###\n\n", "completion": "(game \"Rimau-Rimau (Two Tigers)\" (players 2) (equipment { (\"AlquerqueBoardWithBottomAndTopTriangles\") (hand Each) (piece \"Tiger\" P1 (or { (\"StepToEmpty\") (\"HopCapture\")})) (piece \"human\" P2 \"StepToEmpty\")}) (rules (start { (place \"human2\" (difference (expand (sites Centre)) (centrePoint))) (place \"human2\" (handSite P2) count:16) (place \"Tiger1\" (handSite P1) count:2)}) phases:{ (phase \"PlacementFirstTiger\" P1 (play (move (from (handSite P1)) (to (sites Empty)) (then (moveAgain)))) (nextPhase Mover \"RemoveHuman\")) (phase \"RemoveHuman\" P1 (play (move Remove (intersection (sites Board) (sites Occupied by:Next)) (then (moveAgain)))) (nextPhase Mover \"PlacementSecondTiger\")) (phase \"PlacementSecondTiger\" P1 (play (move (from (handSite P1)) (to (sites Empty)))) (nextPhase Mover \"Movement\")) (phase \"PlacementHuman\" P2 (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase (\"HandEmpty\" P2) \"Movement\")) (\"PhaseMovePiece\" \"Movement\" (end { (if (no Moves P1) (result P2 Win)) (if (no Pieces P2) (result P1 Win))}))})) END" } ]