prompt
stringlengths
71
4.65k
completion
stringlengths
34
5.1k
Construct a Ludii game based on the following description First, 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. The Giant piece can step to an empty site, the dwarves can step only forward to the top of the board. 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. ###
(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
Construct a Ludii game based on the following description 4x12 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. ###
(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
Construct a Ludii game based on the following description Each 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. ###
(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
Construct a Ludii game based on the following description The 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 ###
(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
Construct a Ludii game based on the following description The 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. 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. ###
(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
Modify the Ludii game according to the following option changes: The game is playing with two players. -> The game is playing with three players. (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))))) ###
(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
Construct a Ludii game based on the following description Triangle, 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. ###
(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
Construct a Ludii game based on the following description Some 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. ###
(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
Construct a Ludii game based on the following description 8x8 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 \ ###
(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
Construct a Ludii game based on the following description Goal: Score the most points: -- One point for each stone in one's largest group. -- Bonus points are also added to the scores according to the selected option. The board starts empty. Players take turns in alternation, placing one of their own stones onto an empty site. Restriction on placement: Every site of the board must remain connected to an empty perimeter site via a continuous path of empty sites. There is no passing. The game ends when no more placements can be made. Players score one point for every stone in their largest group, then, if applicable, score bonus points according to the selected option. Bonus Options are: -- Count of one's own groups. Standard -- Count of the opponent's groups -- No Bonus The player with the higher score wins. If the scores are tied, the game is decided by the tiebreaker option used: A: Cascading largest group LOSES -- i.e. negative scores -- This excludes tied pairs; If all groups are paired, last to place. 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. ###
(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
Construct a Ludii game based on the following description 4x7 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. ###
(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
Construct a Ludii game based on the following description In 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.) A man has capability to move based on its relative position to other friendly men on the board, as follows: - If a man is orthogonally adjacent to a friendly man, then both have the ability to move as a rook in chess. - If a man is diagonally adjacent to a friendly man, then both have the ability to move as a chess bishop. - If a man is a knight's move away from a friendly man, then both have the ability to move as a knight. 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. 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. Checks, checkmate, and captures are as in standard chess. If a player has no legal moves, they lose the game. ###
(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
Construct a Ludii game based on the following description The 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. ###
(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
Describe the mechanics of the following Ludii game (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")))) ###
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
Construct a Ludii game based on the following description Connect 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. ###
(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
Construct a Ludii game based on the following description Board 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. ###
(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
Describe the mechanics of the following Ludii game (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))))) ###
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
Construct a Ludii game based on the following description TODO ###
(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
Describe the mechanics of the following Ludii game (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))))) ###
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
Describe the mechanics of the following Ludii game (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))))) ###
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
Construct a Ludii game based on the following description The 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. ###
(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
Construct a Ludii game based on the following description 2x6 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. ###
(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
Construct a Ludii game based on the following description 8x8 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. ###
(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
Construct a Ludii game based on the following description Each turn you must perform exactly one of the following two actions: 1. Add a friendly piece orthogonally adjacent to one of your pieces. 2. Remove an enemy group. 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 ###
(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
Modify the Ludii game according to the following option changes: Each row has 12 holes. -> Each row has 14 holes. (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))))) ###
(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
What does the following global Ludii definition do? (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)) ###
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
Modify the Ludii game according to the following option changes: Board & size: Hexhex with edges alternately 3 and 4 -> Board & size: Hexhex with edges alternately 4 and 5 Movement: Pieces step or hop once, to the first empty position in that direction. -> Movement: Pieces step to an adjacent empty position. (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))))) ###
(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
Describe the mechanics of the following Ludii game (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)))) ###
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
Construct a Ludii game based on the following description Same 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. ###
(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
Describe the mechanics of the following Ludii game (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)))) ###
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
Construct a Ludii game based on the following description Starchess 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. 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. Piece Movement: * Knights move as in Glinsky Chess. - They move two spaces in any adjacent direction, then one space in another direction. * Kings can move one space in any of those same six adjacent directions. There is no castling. * Queens can slide in any of the six adjacent directions from their current space---North, South, or 60 degrees off either of those. * Rooks can slide forward or backward only in their given column. * Bishops can slide in only four of the adjacent directions: they cannot slide North or South. * 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. The game ends on a checkmate or stalemate. 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. ###
(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
Construct a Ludii game based on the following description TURN - On each turn, each player slides (orthogonally or diagonally) a stone until it hits another stone or a wall. If it stops because of a stone, the moving stone and all adjacent stones (of either color) are removed. GOAL - The player with no stones onboard loses. 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. ###
(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
Describe the mechanics of the following Ludii game (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))))) ###
White starts by placing one disc or ring on any cell of the board. Then, each player in turn must perform two actions: 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 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. The disc-ring pair (a disc inside a ring) cannot be modified for the rest of the game. END
Construct a Ludii game based on the following description Played 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. ###
(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
Construct a global Ludii definition which fulfills the following requirements. Defines a graphics turtle walk to build a large L piece. ###
(define "LWalk" { {L F R F F} {R F L F F}}) END
Construct a Ludii game based on the following description Players 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 ###
(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
Construct a Ludii game based on the following description 8x8 board. Pieces have special moves, as follows: Rátu (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áran; Pateh (minister), moves orthogonally or diagonally any number of spaces; Mántri (x2); move diagonally any distance; Járan (horse) x2, moves orthogonally one space then diagonal one space from there, jumping over any intervening pieces; Práhu (vessel) x2, moves orthogonally any distance; Bídak (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ídak 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áhu moves next to the Rátu, and then at any turn in the future the Rátu may move to the space on the other side of it, provided the Rátu has not yet been checked and that the space to which it moves remains available. The Rátu cannot be in check at the end of its turn. When this is unavoidable, it is checkmate and the opponent wins. If the Rátu is the only piece belonging to the player on the board, that player wins. ###
(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
Construct a Ludii game based on the following description One 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. ###
(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
Construct a Ludii game based on the following description 2 players. Each plays Discs. - --- 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. --- Play. On your turn you may do one of the following: 1. Pass 2. Place one of your stones on an empty cell of the board is not adjacent to your existing stones. 3. Move to a location with fewer adjacent enemies than the starting location. Moves are made in one of the following ways while keeping the above restriction: -- A. Step to an adjacent empty location. -- B. Hop your opponent's stone and replace it with a mutual enemy piece. -- C. Hop a mutual enemy piece and replace it with a stone from your supply. 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 ###
(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
Construct a Ludii game based on the following description The 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. ###
(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
Construct a Ludii game based on the following description The game is played on a board with twelve points on either side. The points form a continuous track in a horseshoe shape; each player progresses in opposite directions (one from their bottom right to the top right, the other from their bottom left to their top left. 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. ###
(games (subgame "JulbaharSubgame" result:(score Mover))) END
Construct a Ludii game based on the following description 2x8 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. ###
(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
Construct a global Ludii definition which fulfills the following requirements. Returns the number of steps between the last `from' location and the last `to' location. ###
(define "LastDistance" (count Steps #1 (last From) (last To))) END
Construct a Ludii game based on the following description 5x5 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. ###
(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
Describe the mechanics of the following Ludii game (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))}))) ###
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
Modify the Ludii game according to the following option changes: The game is played on a 14x14 board. -> The game is played on a 15x15 board. (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))))) ###
(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
Describe the mechanics of the following Ludii game (define "InitialPawnMove" (if (is In (from) (sites Start (piece (what at:(from))))) ("DoubleStepForwardToEmpty" "SetEnPassantLocation"))) (define "EnPassant" (move Step (directions {FR FL}) (to if:"InLocationEnPassant") (then (remove (ahead (last To) Backward))))) (define "InLocationEnPassant" (and (is Pending) (= (to) (value Pending)))) (define "SetEnPassantLocation" (then (set Pending (ahead (last To) Backward)))) (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))}))) ###
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
Modify the Ludii game according to the following option changes: Triangle-8 Board (36) -> Triangle-15 Board (120) (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))}))) ###
(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
Construct a Ludii game based on the following description At 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. The first player plays with crosses, the second with circles. Each player, on his turn, must place his marker on the grid onto an empty cell respecting the following rule: 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). Pretty much the same as what happens in Connect4, except here there are four dropping directions. If the marker reaches the opposite side without encountering any obstacles, the move is illegal. 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. If there are no available moves, the game ends in a draw. The game is played on a 15x15 board. Look and feel: Retro ###
(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
Describe the mechanics of the following Ludii game (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))}))) ###
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). END
Construct a Ludii game based on the following description 7x7 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. ###
(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
Construct a Ludii game based on the following description 2x7 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. 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. ###
(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
Construct a Ludii game based on the following description Goal: Connect all three edge colors with a single group of connected stones of your own color. (As in 'Y') 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. The moves consist of two parts: placement, then conditional 'flipping' of stones: - Placement is to any empty location. - 'Flipping' means changing the color of a stone that has more neighbors of its own color than enemy neighbors. Flipping is restricted to the selected option. Stones are flipped one at a time until no more can flip. Options are: -- 00'Y': All - Each applicable stone flips, one at a time with cascading effects, until no more can flip. -- Defector Y: Enemies flip into Friends - these might be pieces near/at the stone just placed placed, and/or a stone the opponent flipped. -- Friends flip into Enemies - these might be pieces near/at the opponent's last placements or flips. 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) ###
(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
Construct a Ludii game based on the following description The game is played on a 10x10 board. Four of the squares are marked and are considered to contain a watering hole. Each player has two elephants, two lions and two mice. Pieces do not take other pieces. Their movement is as follows: mice move like rooks, lions move like bishops, and elephants move like queens. Like their chess counterparts, the pieces cannot jump over other pieces. 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. 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. 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. One wins the game by occupying three of the watering holes with own pieces. ###
(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
Modify the Ludii game according to the following option changes: Played on a size 3 board. -> Played on a size 4 board. (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)))}))))) ###
(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
Construct a Ludii game based on the following description Resolve 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. OX XO On your turn you must select the following one of two actions. 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. 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 ###
(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
Construct a Ludii game based on the following description Played 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 \ ###
(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
Construct a Ludii game based on the following description In standard chess, the captured piece is removed from the board and the capturing piece takes its place. In atomic chess, a capture causes an \ ###
(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
Construct a Ludii game based on the following description A 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. ###
(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
Construct a global Ludii definition which fulfills the following requirements. Defines 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. ###
(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
Construct a Ludii game based on the following description Each 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. ###
(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
Construct a Ludii game based on the following description MOVE - On each turn, each player move one of his stones into an adjacent orthogonal empty cell. GOAL - Wins the player that makes a (orthogonal or diagonal) 3 in-a-row. ###
(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
Describe the mechanics of the following Ludii game (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))))) ###
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
Construct a Ludii game based on the following description 2x6 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. ###
(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
Construct a Ludii game based on the following description 2x12 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. ###
(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
Describe the mechanics of the following Ludii game (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)))) ###
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. END
Construct a global Ludii definition which fulfills the following requirements. Defines a slide move to capture an enemy piece. ###
(define "SlideCapture" (move Slide #1 #2 (to if:("IsEnemyAt" (to)) (apply (remove (to) #3))) #4)) END
Construct a Ludii game based on the following description Goal: Score stones where exactly half of the available neighbor sites are occupied by friendly stones at the end of the game. The player with the highest score wins. Start with an empty board. Then on each turn the player adds one of his stones to the board, or passes. The game ends when both players pass consecutively, and then the score is calculated. In case of a tie, the last to place a stone loses. Variant Placement: Add 2 stones at a time after the first placement. 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 ###
(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
Construct a Ludii game based on the following description Play 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. ###
(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
Construct a Ludii game based on the following description Played 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. ###
(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
Construct a Ludii game based on the following description 4x6-21 board; 8 is most common, 12, 15, and 18 are also popular. Two counters in each hole in the players' outer rows. 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. ###
(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
Modify the Ludii game according to the following option changes: The game involves 3 piles. -> The game involves 7 piles. (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))))) ###
(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
Describe the mechanics of the following Ludii game (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))))})) ###
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
Construct a Ludii game based on the following description On 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. 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: 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 \ ###
(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
Construct a Ludii game based on the following description Played 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. ###
(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
Describe the mechanics of the following Ludii game (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")))) ###
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. 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. 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. The dog wins by capturing all the goats; the goats win by blocking the dog from being able to move. END
Construct a Ludii game based on the following description 5x5 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. ###
(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
Modify the Ludii game according to the following option changes: Order 5 board -> Order 6 board (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"))) ###
(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
Describe the mechanics of the following Ludii game (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))})))) ###
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
Construct a Ludii game based on the following description 4x4 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. ###
(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
Construct a Ludii game based on the following description Each 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. ###
(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
Construct a Ludii game based on the following description 12x12 checkered board. One player plays with six \ ###
(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
Construct a Ludii game based on the following description McCooey Chess is played on a hexagonal board with each side having length 6, and each space oriented horizontally. The board has has 91 spaces. Piece Movement: * All pieces other than Pawns move as in Glinski Chess. - Kings step one space in any of the 12 directions. They do not castle. - Queens slide in any of the 12 directions. - Rooks slide in any of the 6 adjacent direction. - Bishops slide in any of the 6 'diagonal' directions. - Knights move two spaces in any adjacent direction, then one space in another direction. * 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. The game ends on a checkmate or stalemate. ###
(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
Construct a global Ludii definition which fulfills the following requirements. Defines a sequence of hop move in all the adjacent directions over an enemy to an empty site. ###
(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
Construct a Ludii game based on the following description 8x8 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. ###
(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
Construct a Ludii game based on the following description 5x5 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. ###
(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
Construct a global Ludii definition which fulfills the following requirements. Defines a step move to all the directions specified (adjacent by default) to an empty site. ###
(define "StepToEmpty" (move Step #1 (to if:(is Empty (to))) #2)) END
Construct a Ludii game based on the following description 4x8 board. Two counters in each hole, the holes in the inner row are then vacated. These counters become the \ ###
(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
Modify the Ludii game according to the following option changes: A square board of size 7 is currently selected -> A hexagonal board of size 4 is currently selected (game "Center" (players 2) (equipment { <Board> (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))))) ###
(game "Center" (players 2) (equipment { <Board> (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
Construct a Ludii game based on the following description The game is played on a board with twelve points on either side. The points form a continuous track in a horseshoe shape; each player progresses in opposite directions (one from their bottom right to the top right, the other from their bottom left to their top left. Each player has 15 pieces. Each player's fifteen pieces begin on the first point of their track. Players move according to the number on each die by moving one piece the value on one die then another piece the value on the other die, or by moving one piece the value of one die and then the value of the other. If doubles are rolled, the player must play the number on each die twice. 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. ###
(games (subgame "MahbousehSubgame" result:(score Mover))) END
Describe the mechanics of the following Ludii game (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")))))) ###
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. END
Construct a Ludii game based on the following description The 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 ###
(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
Construct a Ludii game based on the following description Play occurs on a 3x3 grid. One player places an X, the other places an O and players take turns placing their marks in the grid, attempting to get three in a row of their colour. ###
(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
Modify the Ludii game according to the following option changes: The game is played with 2 players. -> The game is played with 3 players. (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))))) ###
(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
Construct a Ludii game based on the following description 11x11 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. ###
(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
Construct a Ludii game based on the following description 2x6 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. ###
(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
Describe the mechanics of the following Ludii game (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)))) ###
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
Construct a Ludii game based on the following description Players complete two actions in turns: 1. Place a disc of their colour inside any ring. 2. Pick up the ring in which they placed their disc and move it somewhere else: – It must be placed horizontally or vertically adjacent to at least another ring. – It must be placed on an empty space (i.e. not over a disc or ring that was placed before). - 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. However rings and discs must always remain (orthogonally or diagonally) connected to form one unique group. 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. ###
(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
Modify the Ludii game according to the following option changes: The game is played on a 2x2 board. -> The game is played on a 3x3 board. (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))))) ###
(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
Construct a global Ludii definition which fulfills the following requirements. Defines a rectangular board with Alquerque-style alternating diagonals with a triangle extension at the bottom. ###
(define "AlquerqueBoardWithBottomTriangle" (board ("AlquerqueGraphWithBottomTriangle") use:Vertex)) END