prompt
stringlengths
71
4.65k
completion
stringlengths
34
5.1k
Construct a Ludii game based on the following description 8x8 checkered board, the dark spaces placed so that the bottom right corner is a dark space. Twelve pieces per player, placed on the dark spaces of the first three rows closest to the players. Players alternate turns moving a piece forward diagonally to an empty space. Pieces may capture an opponent's piece by hopping over it to an empty adjacent space, in a forwards or backwards direction. Captures are not compulsory, multiple captures are possible, the maximum capture possible is not required. When a piece reaches the opposite edge of the board from where it started at the end of its turn, it it promoted. If it lands on the edge of the board in the middle of a capturing sequence, it is not promoted. Promoted pieces may move any distance diagonally forward or backward, and may capture any number of opponent's pieces it leaps over. The player who captures all of the opponent's pieces wins. ###
(define "IsUnpromoted" ("IsPieceAt" "Counter" Mover (last To))) (define "HopDiagonalDoubleCounter" ("HopCaptureDistance" (from) Diagonal (range 1 (count Rows)) (then ("ReplayIfCanMove" ("HopCaptureDistance" (from (last To)) Diagonal (range 1 (count Rows))))))) (define "HopDiagonalCounter" ("HopCapture" (from) Diagonal (then ("ReplayIfCanMove" ("HopCapture" (from (last To)) Diagonal) ("PromoteIfReach" (sites Next) "DoubleCounter"))))) (game "Damspel" ("TwoPlayersNorthSouth") ("DraughtsEquipment" (square 8)) (rules ("WhiteCellsSetup" 3) (play (if ("SameTurn") (if ("IsUnpromoted") (or (move Pass (then (forEach Site (sites Next) (if ("IsPieceAt" "Counter" Mover (site)) (promote (site) (piece "DoubleCounter") Mover))))) ("HopCapture" (from (last To)) Diagonal (then ("ReplayIfCanMove" ("HopCapture" (from (last To)) Diagonal) ("PromoteIfReach" (sites Next) "DoubleCounter"))))) (or (move Pass) ("HopCaptureDistance" (from (last To)) Diagonal (range 1 (count Rows)) (then ("ReplayIfCanMove" ("HopCaptureDistance" (from (last To)) Diagonal (range 1 (count Rows)))))))) (or (forEach Piece "Counter" (or ("StepToEmpty" (directions {FR FL}) (then ("PromoteIfReach" (sites Next) "DoubleCounter"))) "HopDiagonalCounter")) (forEach Piece "DoubleCounter" (or (move Slide Diagonal) ("HopDiagonalDoubleCounter")))))) (end ("CaptureAll" Next)))) END
Construct a Ludii game based on the following description 2x6 board with two stores. Seven counters in each hole. Play moves in an anti-clockwise direction and players sow into the store on their right hand side. A move may begin from any of the player's holes except their store. If the last counter falls into the store, they can sow again from any of the holes in their row. If it lands in a hole with counters in it, these are picked up and sowing continues. If the last counter falls into an empty hole the move ends, but if the hole is in the player's own row, any counters in the hole opposite it are captured and placed in the store. When no more moves can be made, a new round begins and each player fills as many holes as they can by putting seven in each. Surplus counters are placed in the store. Any unfilled holes are excluded from play. Play continues until one player cannot fill a hole with seven counters, and the opponent wins. ###
(define "NoLegalMoves" (all Sites (forEach (difference (union (sites Bottom) (sites Top)) (sites Empty)) if:(is In (site) (values Remembered))) if:(= 0 (count at:(site))))) (define "AllPossibleHolesFilled" (or (and (> 7 (count at:(mapEntry P2))) (= 42 (count in:(sites Bottom)))) (and (> 7 (count at:(mapEntry P1))) (= 42 (count in:(sites Top)))))) (define "PlayableSites" (forEach (sites Mover "Home") if:(is In (site) (values Remembered)))) (define "CaptureEnoughSeed" (> 7 (count in:(difference (sites Board) (mapEntry Mover))))) (define "Columns" 6) (game "Galatjang" (players 2) (equipment { (mancalaBoard 2 "Columns" { (track "Track1" "1,E,ENE,WNW,W" loop:True P1) (track "Track2" "12,W,WSW,ESE,E" loop:True P2)}) (piece "Seed" Shared) (regions "Home" P1 (sites Bottom)) (regions "Home" P2 (sites Top)) (map {(pair P1 LastSite) (pair P2 FirstSite)})}) (rules (start { (set Count 7 to:(union (sites Bottom) (sites Top))) (forEach Value min:1 max:12 (set RememberValue (value)))}) phases:{ (phase "Round" (play (move Select (from (if (and (not (is Pending)) ("SameTurn")) ("LastHoleSowed") ("PlayableSites")) if:(> (count at:(from)) 0)) (then (sow "Track" owner:(mover) apply: (if (= (to) (mapEntry Mover)) (and (moveAgain) (set Pending)) (if (> (count at:(to)) 1) (moveAgain) (if (and (is In (to) (sites Mover "Home")) (> (count at:("OppositePit" (to))) 0)) (fromTo (from ("OppositePit" (to))) (to (mapEntry Mover)) count:(count at:("OppositePit" (to))))))) (then (if ("NoLegalMoves") (and (forEach Site (difference (sites P1 "Home") (sites Empty)) (fromTo (from (site)) (to (mapEntry P1)) count:(count at:(site)))) (forEach Site (difference (sites P2 "Home") (sites Empty)) (fromTo (from (site)) (to (mapEntry P2)) count:(count at:(site))))))))))) (nextPhase ("NoLegalMoves") "BetweenRound")) (phase "BetweenRound" (play (if (>= (count at:(mapEntry Mover)) 7) (move (from (mapEntry Mover)) (to (intersection (sites Empty) (sites Mover "Home"))) count:7) (then (if ("AllPossibleHolesFilled") (and (forget Value All) (forEach Site (sites Board) (if (= 7 (count at:(site))) (remember Value (site))))))))) (nextPhase ("AllPossibleHolesFilled") "Round"))} (end (if ("CaptureEnoughSeed") (result Mover Win))))) END
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 awarded according to the selected option. The board starts empty. Players take alternating turns placing one of their stones onto an empty site. Directly after placement, every site of the board must remain connected to an empty perimeter site via a continuous path of empty sites, and the stone that was placed must be next to any 2 empty sites. Capture After placement, simultaneously remove all the stones adjacent to the placed stone that are no longer next to 2 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: -- Captured opponent's stones -- Count of one's own groups -- 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 tie-breaker option that was selected before the game: 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 17 moves each Hex N / N-1 Grid, about 5% less moves Scoring Option: Score a point for each piece in your largest group and each opponent piece you capture Tiebreaker is largest group (excluding tied pairs) LOSES. If all are paired, last placement wins. ###
(define "ColourBackground" (colour 126 130 156)) (define "TriSquare" (board (tiling T33434 (- 5 2)) use:Vertex)) (define "HexCell" (board (hex Hexagon 5) use:Cell)) (define "Hex2Limp" (board (hex (- 5 1) (+ 5 1)) use:Cell)) (define "HexLimp" (board (hex Limping (- 5 1)) use:Cell)) (define "BoardUsed" "HexLimp") (define "ConnectionDirection" Orthogonal) (define "ScoreConnectionDirection" Orthogonal) (define "AllHave1Connection2Edge" (all Sites #1 if:(or (and (is Empty (site)) (is In (site) (sites Outer))) (!= Infinity (count Steps (step "ConnectionDirection" (to if:(is Empty (to)))) (site) (difference (sites Outer) (site))))))) (define "Capture" (forEach Value (array #1) (if (> 2 (count Sites in:(sites Around (value) "ConnectionDirection" if:(is Empty (to))))) (remove (value))))) (define "CaptureScores" (forEach Value (array #1) (if (> 2 (count Sites in:(sites Around (value) "ConnectionDirection" if:(is Empty (to))))) (if (is Mover (who at:(value))) (remove (value)) (remove (value) (then (if (is Empty (handSite Mover)) (add (piece (id "Disc" Next)) (to (handSite Mover)) (then (set Value at:(handSite Mover) (+ 1 (value Piece at:(handSite Mover)))))) (set Value at:(handSite Mover) (+ 1 (value Piece at:(handSite Mover))))))))))) (define "CascadeTiebreaker" (if (= (var "MoverScore") (var "NextScore")) (and (set Score Mover (- 0 ("CascadeScore" Mover Next))) (set Score Next (- 0 ("CascadeScore" Next Mover)))) ("NoTiebreaker"))) (define "NoTiebreaker" (and (set Score Mover (var "MoverScore")) (set Score Next (var "NextScore")))) (define "CascadeScore" (max 0 (max (difference (sizes Group "ScoreConnectionDirection" #1) (sizes Group "ScoreConnectionDirection" #2))))) (define "BonusOpponent" (set Var "MoverScore" (+ ("GroupCount" Mover) (count Groups "ScoreConnectionDirection" if:(= (who at:(to)) (next)))) (then (set Var "NextScore" (+ ("GroupCount" Next) (count Groups "ScoreConnectionDirection" if:(= (who at:(to)) (mover)))) (then ("CascadeTiebreaker")))))) (define "BonusMover" (set Var "MoverScore" (+ ("GroupCount" Mover) (count Groups "ScoreConnectionDirection" if:(= (who at:(to)) (mover)))) (then (set Var "NextScore" (+ ("GroupCount" Next) (count Groups "ScoreConnectionDirection" if:(= (who at:(to)) (next)))) (then ("CascadeTiebreaker")))))) (define "PlusCaptureScore" (set Var "MoverScore" (+ (value Piece at:(handSite Mover)) ("GroupCount" Mover)) (then (set Var "NextScore" (+ (value Piece at:(handSite Next)) ("GroupCount" Next)) (then ("CascadeTiebreaker")))))) (define "GroupScore" (set Var "MoverScore" ("GroupCount" Mover) (then (set Var "NextScore" ("GroupCount" Next) (then ("CascadeTiebreaker")))))) (define "GroupCount" (max 0 (max (sizes Group "ScoreConnectionDirection" #1)))) (game "Branching Coral" (players 2) (equipment { "BoardUsed" (piece "Ball" Each) (piece "Disc" Each) (hand Each size:1)}) (rules (start (set Score Each 0)) (play (do (move Add (to (sites Empty) if:(< 1 (count Sites in:(intersection (sites Around (to) "ConnectionDirection") (sites Empty)))))) ifAfterwards:("AllHave1Connection2Edge" (intersection (sites Around (last To) "ConnectionDirection") (sites Empty))) (then (do ("CaptureScores" (intersection (sites Occupied by:All) (sites Around (last To) "ConnectionDirection"))) next:("PlusCaptureScore"))))) (end (if (no Moves Next) { (if (= (score Mover) (score Next)) (result Mover Win)) (if (!= (score Mover) (score Next)) (byScore))})))) END
Describe the mechanics of the following Ludii game (define "CounterMove" (or { ("StepToEmpty" Diagonal) (move Slide Orthogonal (between (exact 2))) ("HopCapture" (from) Diagonal ("MoveAgainIfCanCaptureAgain")) ("OrthogonalHopCaptureCounter" (from) ("MoveAgainIfCanCaptureAgain"))})) (define "MoveAgainIfCanCaptureAgain" (then ("ReplayIfCanMove" (or ("HopCapture" (from (last To)) Diagonal) ("OrthogonalHopCaptureCounter" (from (last To))))))) (define "OrthogonalHopCaptureCounter" (do (move Hop #1 Orthogonal (between before:2 after:2 if:(and (= 2 (count Steps (from) (between))) ("IsEnemyAt" (between))) (apply (remove (between)))) (to if:(is Empty (to)))) ifAfterwards:(is In (last To) (sites Phase 1)) #2)) (game "The Babylonian" (players 2) (equipment { (board (square 10)) (piece "Counter" Each "CounterMove") (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules ("WhiteCellsSetup" 4) (play (if ("SameTurn") (or { ("HopCapture" (from (last To)) Diagonal ("MoveAgainIfCanCaptureAgain")) ("OrthogonalHopCaptureCounter" (from (last To)) ("MoveAgainIfCanCaptureAgain")) (move Pass)}) (forEach Piece))) (end ("CaptureAll" Next)))) ###
10x10 checkered board. Twenty pieces per player, arranged on the four rows closest to the player. Pieces move orthogonally or diagonally in any direction, only on the white spaces. Pieces may capture by jumping over an enemy piece to an empty space on the other side of it. Multiple captures in one turn are allowed. The player to capture all of the opponent's pieces wins. END
Construct a global Ludii definition which fulfills the following requirements. Checks if a site is empty and not visited so far in the same turn. ###
(define "IsEmptyAndNotVisited" (and (is Empty #1) (not (is Visited #1)))) END
Construct a Ludii game based on the following description Played on a board with 36 holes arranged in a square, with a gap in the center of each side. There are two semi circles of five holes on the outside of two opposite corners of the board. The central space of these semicircles is marked. One or two pieces per player. Four stick dice are used, with one marked side. Each die is marked differently for a different value: 4, 6, 14, 15. The throws are as follows: All marked sides up = 5; three marked sides up = 3; two marked sides up = 2, one marked side up = the value of the marked side; zero marked sides up = 10. Players’ pieces enter on the branching arcs. The second piece cannot enter before the first one leaves the arc. Players move in opposite directions around the board. If a player lands on the same spot as the opponent, the opponent’s piece is removed from the board and must re-enter. Player must make an exact throw to get a piece off the board. The player to get both of their pieces around the board, and then to reach the marked space with an exact throw. When a piece is in the hole before the marked space, they may throw anything but 14 or 15 to exit the board. The first player to remove their piece(s) from the board wins. Each player has 2 pieces. ###
(define "PieceCanEnterOnlyIfNoPieceOnArc" (and (= (from) (handSite Mover)) (all Sites (sites Occupied by:Mover) if:(not (is In (site) (sites Mover "Arc")))))) (define "PieceAlreadyEntered" (!= (from) (handSite Mover))) (define "Movement" (if ("IsEndTrack" ("SiteToMoveOnTrack")) "RemoveAPiece" (if ("IsNotOffBoard" ("SiteToMoveOnTrack")) (if (not ("IsFriendAt" ("SiteToMoveOnTrack"))) (move (from) (to ("SiteToMoveOnTrack") "CaptureEnemyPiece")))))) (define "RemoveAPiece" (move Remove (from))) (define "CaptureEnemyPiece" ("HittingCapture" (handSite Next))) (define "ThrowValue" (mapEntry "Throw" (count Pips))) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" ("ThrowValue"))) (game "Kints" (players 2) (equipment { ("KintsBoard" { (track "Track1" "46,5,SSE,N,E,S,W,NNW2,End" P1 directed:True) (track "Track2" "47,41,NNW,W,S,E,N,SSE2,End" P2 directed:True)}) (regions "AllSites" (sites Board)) (regions "Arc" P1 (sites {1..5})) (regions "Arc" P2 (sites {41..45})) (dice d:2 facesByDie:{{0 4} {0 6} {0 14} {0 15}} num:4) (piece "Marker" Each (if (or ("PieceAlreadyEntered") ("PieceCanEnterOnlyIfNoPieceOnArc")) ("Movement"))) (hand Each) (map "Throw" { (pair 0 10) (pair 39 5) (pair 24 3) (pair 25 3) (pair 35 3) (pair 33 3) (pair 10 2) (pair 18 2) (pair 19 2) (pair 20 2) (pair 21 2) (pair 29 2)})}) (rules (start (place "Marker" "Hand" count:2)) (play ("RollMove" (or (forEach Piece) (forEach Piece container:(mover))))) (end ("EscapeWin")))) END
Construct a Ludii game based on the following description 2x8 board, with a store on either end. Each player owns the store to their right. Eight counters in each hole. Players alternate turns sowing in an anti-clockwise direction from one of the holes on their side of the board. Sowing always includes the player's store (but not the opponent's store), and sowing cannot begin from the store. When the final counter lands in an occupied hole, the contents of that hole are picked up and sowing continues. If the last counter lands in the player's store, they may choose any of the holes on their side of the board and continue sowing from it. When the final counter lands in an empty hole, the counters in the opposite hole are captured. Play continues until all of the counters are captured. A new round begins. Players fill the holes on their side of the board with their captured counters. If a player cannot fill a hole with the required number of counters, the hole is closed and is out of play for that round. Play continues as before. Play continues in successive rounds until one player closes all of their opponent's holes and wins. ###
(define "Stores" (sites {(mapEntry P1) (mapEntry P2)})) (define "NoPieceOnBoard" (no Pieces All in:(union (sites Top) (sites Bottom)))) (define "PlayableSites" (sites (values Remembered "Playable"))) (define "Columns" 8) (game "Ovalhu" (players 2) (equipment { (mancalaBoard 2 "Columns" { (track "Track1" "1,E,17,16,W" loop:True P1) (track "Track2" "1,E,N,W,0" loop:True P2)}) (piece "Seed" Shared) (map {(pair P1 LastSite) (pair P2 FirstSite)}) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start { (set RememberValue "Playable" (union (sites Top) (sites Bottom))) (set Count 8 to:(union (sites Bottom) (sites Top)))}) phases:{ (phase "Sowing" (play (or { (move Select (from (if (and (is Pending) ("SameTurn")) (sites {(var "Replay")}) (sites Mover)) if:(and (is Occupied (from)) (is In (from) ("PlayableSites")))) (then (sow "Track" owner:(mover) apply:(if (or (is In (to) ("Stores")) (< 1 (count at:(to)))) (and (moveAgain) (if (not (is In (to) ("Stores"))) (and (set Pending) (set Var "Replay" (to))))) (if (is Occupied ("OppositePitTwoRows" (to))) (fromTo (from ("OppositePitTwoRows" (to))) (to (mapEntry Mover)) count:(count at:("OppositePitTwoRows" (to)))))) skipIf:(and (not (is In (to) ("Stores"))) (not (is In (to) ("PlayableSites")))))))} (then (if ("NoPieceOnBoard") (forget Value "Playable" All))))) (end (if ("NoPieceOnBoard") { (if (> 8 (count at:(mapEntry P1))) (result P2 Win)) (if (> 8 (count at:(mapEntry P2))) (result P1 Win))})) (nextPhase ("NoPieceOnBoard") "BetweenRounds")) (phase "BetweenRounds" (play (if (not (all Sites (sites Mover) if:(is Occupied (site)))) (if (<= 8 (count at:(mapEntry Mover))) (move (from (mapEntry Mover)) (to (sites Mover) if:(is Empty (to))) count:8 (then (remember Value "Playable" (last To))))))) (nextPhase (all Passed) "Sowing"))})) END
Construct a Ludii game based on the following description 4 or 6x10 board. Six pieces per player, with one piece placed on each of the three spaces on either end of the long row closest to the player. Three casting sticks, each with a round and a flat side, are used as dice. The throws are as follows: One flat side up = 1; two flat sides up = 2; three flat sides up = 4, zero flat sides up = 6. A player must throw a 1 to move each piece for the first time. Players move according to the throws, except on throws of 1, which are tabulated for use later. Players continue to throw until they throw 2. Pieces move along a boustrophedon path, beginning from left to right in the row closest to them. Pieces are captured when an player's piece lands on a spot occupied by an opponent's piece. Players may used tabulated throws to supplement a throw in order to make a capture. The player who captured the most pieces wins. 6 rows. ###
(define "ActiveInactivedPiece" (move Select (from (sites Occupied by:Mover) if:("InactivedPiece")) (then (and ("ActivePiece") (moveAgain))))) (define "ActivePiece" (set State at:(last From) 1)) (define "InactivedPiece" (= (state at:(from)) 0)) (define "ReinitTabule" (set Value Mover 0)) (define "TabuleThrowOne" (if (> (value Player Mover) 0) (set Value Mover (+ 1 (value Player Mover))) (set Value Mover 1))) (define "CapturesAreImpossible" (and (= (count Sites in:(difference (sites Occupied by:P1) (sites Top))) 0) (= (count Sites in:(difference (sites Occupied by:P2) (sites Bottom))) 0))) (define "CaptureEnemyPiece" (apply if:("IsEnemyAt" (to)) (remove (to) (then (addScore Mover 1))))) (define "ThrowValue" (mapEntry (count Pips))) (define "StartSites" (union (intersection (sites #1) (expand (sites Left) steps:2)) (intersection (sites #1) (expand (sites Right) steps:2)))) (game "Sijat El Taba" (players 2) (equipment { (board (rectangle 6 10) { (track "Track1" "0,E,N1,W,N1,E,N1,W,N1,E,N1,W" P1 directed:True) (track "Track2" "59,W,S1,E,S1,W,S1,E,S1,W,S1,E" P2 directed:True)}) (piece "Marker" Each (if (= (state at:(from)) 1) (or (if ("IsNotOffBoard" ("NextSiteOnTrack" ("ThrowValue"))) (if (or (is In ("NextSiteOnTrack" ("ThrowValue")) (sites Empty)) ("IsEnemyAt" ("NextSiteOnTrack" ("ThrowValue")))) (move (from) (to ("NextSiteOnTrack" ("ThrowValue")) "CaptureEnemyPiece")))) (if ("IsNotOffBoard" ("NextSiteOnTrack" (+ (value Player Mover) ("ThrowValue")))) (if ("IsEnemyAt" ("NextSiteOnTrack" (+ (value Player Mover) ("ThrowValue")))) (move (from) (to ("NextSiteOnTrack" (+ (value Player Mover) ("ThrowValue"))) "CaptureEnemyPiece") (then ("ReinitTabule")))))))) ("StickDice" 3) (map {(pair 1 1) (pair 2 2) (pair 3 4) (pair 0 6)})}) (rules (start { (place "Marker1" ("StartSites" Bottom)) (place "Marker2" ("StartSites" Top))}) (play ("RollMove" (if (= (mapEntry (count Pips)) 1) (or (move Pass (then (and ("TabuleThrowOne") (moveAgain)))) ("ActiveInactivedPiece")) (if (= (mapEntry (count Pips)) 2) (forEach Piece) (forEach Piece (then (moveAgain))))))) (end (if ("CapturesAreImpossible") (byScore))))) END
Describe the mechanics of the following Ludii game (game "Knight's Tour" (players 1) (equipment { (board (square 8)) (piece "Knight" P1)}) (rules phases:{ (phase "Placement" (play (move Add (to (sites Empty)))) (nextPhase "Movement")) (phase "Movement" (play (move Leap (from (last To)) "KnightWalk" (to if:(is Empty (to))) (then (add (to (last From)))))))} (end { (if (>= (count Moves) (count Sites "Board")) (result P1 Win)) (if (no Moves P1) (result P1 Loss))}))) ###
Played with one knight on a Chess board. The goal is to move the knight onto every square of the board only once using its typical move as in Chess. END
Construct a global Ludii definition which fulfills the following requirements. Checks if only one single group with pieces owned by a player exists. ###
(define "IsSingleGroup" (= 1 (count Groups #2 if:(= (who at:(to)) #1)))) END
Describe the mechanics of the following Ludii game (define "IsKing" (= 3 (size Stack at:#1))) (define "IsGeneral" (= 2 (size Stack at:#1))) (define "IsSoldier" ("IsSingletonStack" #1)) (define "DoesNotHaveThreeGeneral" (!= 3 (count Sites in:(forEach (sites Occupied by:Mover) if:(= 2 (size Stack at:(site))))))) (define "NoKing" (all Sites (sites Occupied by:Mover) if:(!= 3 (size Stack at:(site))))) (define "HopGeneral" (move Hop #1 Orthogonal (between #2 #3 if:(and (not (is In (between) (sites ToClear))) ("IsEnemyAt" (between))) (apply (remove (between) at:EndOfTurn count:(size Stack at:(between))))) (to if:(is Empty (to))) stack:True (then (if (can Move (hop (from (last To)) Orthogonal (between #2 #3 if:(and (not (is In (between) (sites ToClear))) ("IsEnemyAt" (between)))) (to if:(is Empty (to))))) (moveAgain))))) (define "Hop" (move Hop (from #1) #2 (between if:(and (not (is In (between) (sites ToClear))) ("IsEnemyAt" (between))) (apply (remove (between) at:EndOfTurn count:(size Stack at:(between))))) (to if:(is Empty (to))) stack:True #3)) (game "Fenix" (players 2) (equipment { (board (square 9)) (piece "Fenix" Each)}) (rules (start { (place "Fenix1" (expand (intersection (sites Bottom) (sites Right)) steps:6 Orthogonal) value:1) (place "Fenix2" (expand (intersection (sites Top) (sites Left)) steps:6 Orthogonal) value:1)}) phases:{ (phase "Setup" (play (move (from (sites Occupied by:Mover) if:("IsSingletonStack" (from))) (to (sites Around (from) Own Orthogonal) if:(and { (!= (from) (to)) (< (size Stack at:(to)) 3) (if ("NoKing") True (< (size Stack at:(to)) 2)) (if ("DoesNotHaveThreeGeneral") True (not ("IsSingletonStack" (to))))})))) (nextPhase Mover (and (not ("NoKing")) (not ("DoesNotHaveThreeGeneral"))) "Play")) (phase "Play" (play (if ("SameTurn") (max Moves withValue:True (if ("IsSoldier" (last To)) ("Hop" (last To) Orthogonal (then ("ReplayIfCanMove" ("Hop" (last To) Orthogonal)))) (if ("IsKing" (last To)) ("Hop" (last To) ~ (then ("ReplayIfCanMove" ("Hop" (last To))))) (if ("IsGeneral" (last To)) ("HopGeneral" (from (last To)) before:(count Columns) after:(count Columns) at:EndOfTurn))))) (if ("NoKing") (forEach Piece (if ("IsSoldier" (from)) (move Step Orthogonal (to if:(and ("IsFriendAt" (to)) (= 2 (size Stack at:(to))))) stack:True))) (priority { (max Moves withValue:True (forEach Piece (if ("IsSoldier" (from)) ("Hop" (from) Orthogonal (then ("ReplayIfCanMove" ("Hop" (last To) Orthogonal)))) (if ("IsKing" (from)) ("Hop" (from) ~ (then ("ReplayIfCanMove" ("Hop" (last To))))) (if ("IsGeneral" (from)) ("HopGeneral" (from) before:(count Columns) after:(count Columns) at:EndOfTurn)))))) (forEach Piece (if ("IsSoldier" (from)) (or (move Step Orthogonal (to if:(is Empty (to))) stack:True) (if ("DoesNotHaveThreeGeneral") (move Step Orthogonal (to if:(and ("IsFriendAt" (to)) ("IsSingletonStack" (to)))) stack:True))) (if ("IsGeneral" (from)) (move Slide Orthogonal stack:True) (if ("IsKing" (from)) ("StepToEmpty" ~ stack:True)))))})))) (end (if ("NoKing") (result Mover Loss))))})) ###
Each player, on their first five turns, uses some of their own pieces to create one King and three Generals, in any preferred order. A General is made by placing any single piece on top of an orthogonally adjacent piece, and a King is made by placing any single piece on top of an orthogonally adjacent General. - Soldiers move orthogonally one step to an adjacent square. - Generals move any distance in a straight line orthogonally, like a Chess Rook. - The King moves one step to any adjacent square, like a Chess King Capture is compulsory if possible. - A Soldier or King captures by jumping over an enemy piece occupying a square to which it can legally move and landing on the square immediately beyond it in the same direction, provided that the landing square is vacant. - A General captures in the same way, but may move any number of vacant squares before the captured piece, and may land on any successive vacant square in line of travel beyond the captured piece. If the capturing piece can then make another capture, it must, and it must continue doing so until all possible consecutive captures have been made. An enemy piece can only be jumped once in a single turn. If it is reached a second time it forms a block and ends the turn. At the end of a capturing turn all captured pieces must be removed from the board before the next player moves. If more than one capture is possible you must choose that which captures the greatest number of pieces, counting a King as three, a General as two, and a Soldier as one. If two possible capturing moves offer an equal number of pieces, you may freely choose between them. If one or more of your Generals is captured in one turn, you may create just one General (not more) from two orthogonally adjacent Soldiers anywhere on the board. If your King is captured you must, if possible, use your next turn to create another King by placing a Soldier on top of an adjacent General. If you are unable to create another King, when your King is captured, you lose the game. The game is played on a 9x9 square board. END
Construct a Ludii game based on the following description 5x5 intersecting lines, with diagonals in each quadrant. At the midpoint of each side, the apex of a triangle. A line is drawn from the apex to the base of each triangle, and another line bisecting this one and the two opposite sides of the triangle. One player plays as two tigers, the other as 25 people. One tiger begins on the central point, and the other may be placed anywhere on the board. Players alternate turns, with the person playing as the people first placing a person on the board, and then one of the tigers moving to an empty adjacent spot along the lines of the board. When all of the people have been placed, the people move on the board in the same fashion. The tigers may capture one of the people by jumping over it to an empty adjacent spot immediately on the opposite side of one of the people along the lines of the board. The tigers win when they capture enough people so that the people cannot block the tiger, the people win when they can block the tiger from being able to move. ###
(game "Mysore Tiger Game (Two Tigers)" (players 2) (equipment { ("AlquerqueBoardWithFourTriangles") (hand Each) (piece "Human" P2 ("StepToEmpty")) (piece "Tiger" P1 (or ("StepToEmpty") ("HopCapture")))}) (rules (start { (place "Human2" (handSite P2) count:25) (place "Tiger1" (sites Centre)) (place "Tiger1" (handSite P1))}) phases:{ (phase "Opening" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) ("PhaseMovePiece" "Movement")} (end ("NoMovesP1NoPiecesP2")))) END
Construct a Ludii game based on the following description 3x3 intersecting lines, with triangles extending on opposite ends of the large square and the central line extending to the apices. One player plays as three notched sticks, called hares, and the other as three sharp sticks, known as the hounds. Players alternate turns placing a piece on the board. When the players have placed all of their pieces on the board, they move one of their pieces to an empty adjacent spot along the lines. The first player to block their opponent from being able to move wins. ###
(game "Janes Soppi (Symmetrical)" (players 2) (equipment { (board (remove ("ThreeMensMorrisGraphWithLeftAndRightTriangles") edges:{{6 4} {4 2} {0 4} {4 8}}) use:Vertex) (hand Each) (piece "Hound" P1 "StepToEmpty") (piece "Hare" P2 "StepToEmpty")}) (rules (start { (place "Hound1" (handSite P1) count:3) (place "Hare2" (handSite P2) count:3)}) phases:{ (phase "Placement" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) ("PhaseMovePiece" "Movement")} (end ("BlockWin")))) END
Construct a Ludii game based on the following description 12x12 checkered board. Thirty pieces per player, placed on the white spaces in the first five ranks on each player's side. Pieces move diagonally forward or backward. The opponent's pieces are captured by hopping over them. Multiple hops by one piece are allowed in one turn if they are possible. When they reach the opposite edge of the board from where they started, they become Kings. Kings may move diagonally any number of spaces. They may capture pieces proceeding along its diagonal in one direction, as long as the next space beyond the piece to be captured is empty. It may not hop over any pieces which belong to the same player, or those belonging to the opponent except to capture them. Multiple captures for the King can only be made along the same diagonal, except when it makes a capture that brings it to the edge of the board, it can make another capture along the next available diagonal, if possible. The player who captures all of the opponent's pieces wins. ###
(define "DoubleCounterHopAgain" ("HopDistance" (from (last To)) (if (is In (last To) (sites Outer)) (difference Diagonal OppositeDirection) SameDirection))) (define "DoubleCounterHop" ("HopDistance" Diagonal)) (define "HopDistance" (move Hop #1 #2 (between before:(count Rows) if:("IsEnemyAt" (between)) (apply (remove (between)))) (to if:(is Empty (to))) (then ("ReplayIfCanMove" (hop (from (last To)) (if (is In (last To) (sites Outer)) (difference Diagonal OppositeDirection) SameDirection) (between before:(count Rows) if:(and (not (is In (between) (sites ToClear))) ("IsEnemyAt" (between))) (apply (remove (between)))) (to if:(is Empty (to)))))))) (define "JumpToPromotionZone" (is In (last To) (sites Next))) (define "IsUnpromoted" ("IsPieceAt" "Counter" Mover (last To))) (game "Dam" (players 2) ("DraughtsEquipment" (square 12)) (rules ("WhiteCellsSetup" 5) (play (if "SameTurn" (or (if "IsUnpromoted" ("HopDiagonalSequenceCaptureAgain") ("DoubleCounterHopAgain")) (move Pass)) (or (forEach Piece "Counter" (or ("HopDiagonalSequenceCapture") ("StepToEmpty" Diagonal))) (forEach Piece "DoubleCounter" (or ("DoubleCounterHop") (move Slide (directions Diagonal))))) (then (if (and "IsUnpromoted" "JumpToPromotionZone") (promote (last To) (piece "DoubleCounter") Mover))))) (end ("BlockWin")))) END
Construct a Ludii game based on the following description Two rows of four piles. Six counters in each pile. A player picks up the counters in one of her piles and sows them anti-clockwise, beginning in the place from which the pile originated. Any piles containing 2, 4, or 6 counters at the end of sowing are captured. Play continues until all of the counters have been captured. The player who captures the most counters wins. ###
(define "PiecesOwnedBy" (count Cell at:(handSite #1))) (define "NumPiecesOnBoard" (count in:(sites Track))) (game "Oure Ngat" (players 2) (equipment { (mancalaBoard 2 4 store:None (track "Track" "0,E,N,W" loop:True)) (piece "Seed" Shared) (regions "Home" P1 (sites Bottom)) (regions "Home" P2 (sites Top)) (hand Each)}) (rules (start (set Count 6 to:(sites Track))) (play (move Select (from (sites Mover "Home") if:(> (count at:(from)) 0)) (then (sow origin:True (then (forEach Site (sites Track) (if (is In (count at:(site)) (sites {2 4 6})) (fromTo (from (site)) (to (handSite Mover)) count:(count at:(site)))))))))) (end ("MancalaByScoreWhen" (= 0 ("NumPiecesOnBoard")))))) END
Construct a Ludii game based on the following description 2x6 board, which two stores. Four counters in each hole. Sowing proceeds in an anti-clockwise direction. When the final counter of a sowing falls in to an occupied hole, these counters are picked up and sowing continues. When the final hole lands in an empty hole, if the hole is in the player's row, the contents of the opponent's opposite hole are captured. If the empty hole is in the opponent's row, the turn ends. A player must play so that the opponent is able to play on their next turn, if possible. The player who captures the most counters wins. ###
(define "PiecesOwnedBy" (+ (count at:(mapEntry #1)) (count in:(sites #1)))) (define "Columns" 6) (game "J'odu" (players 2) (equipment { (mancalaBoard 2 "Columns" (track "Track" "1,E,N,W" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 FirstSite) (pair P2 LastSite)}) (piece "Seed" Shared)}) (rules (start (set Count 4 to:(sites Track))) (play (do (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover)) if:(< 0 (count at:(from)))) (then (sow apply:(if (> (count at:(to)) 1) (moveAgain) (if (is In (to) (sites Mover)) (fromTo (from ("OppositePit" (to))) (to (mapEntry (mover))) count:(count at:("OppositePit" (to))))))))) ifAfterwards:(< 0 (count in:(if (is Mover P1) (sites P2) (sites P1)))))) (end ("MancalaByScoreWhen" (no Moves Mover))))) END
Describe the mechanics of the following Ludii game (define "IsUnpromoted" ("IsPieceAt" "Counter" Mover (last To))) (define "HopMan" ("HopCapture" (from #1) (directions {Forward Rightward Leftward}) #2)) (define "PromotedHopOrthogonalSequenceCapture" ("HopCaptureDistance" #1 #2 ~ (then ("ReplayIfCanMove" ("HopCaptureDistanceNotAlreadyHopped" (from (last To)) (difference Orthogonal OppositeDirection)))))) (game "Dama (Comoros)" (players 2) ("DraughtsEquipment" (square 8)) (rules (start { (place "Counter1" (union (sites Row 1) (sites Row 2))) (place "Counter2" (union (sites Row 5) (sites Row 6)))}) (play (if "SameTurn" (or (if "IsUnpromoted" ("HopMan" (last To) (then ("ReplayIfCanMove" ("HopMan" (last To)) ("PromoteIfReach" (sites Next) "DoubleCounter")))) ("PromotedHopOrthogonalSequenceCapture" (from (last To)) (difference Orthogonal OppositeDirection))) (move Pass)) (or { (forEach Piece "Counter" ("HopMan" (from) (then ("ReplayIfCanMove" ("HopMan" (last To)) ("PromoteIfReach" (sites Next) "DoubleCounter"))))) (forEach Piece "DoubleCounter" ("PromotedHopOrthogonalSequenceCapture" (from) Orthogonal)) (forEach Piece "Counter" ("StepToEmpty" (directions {Forward Rightward Leftward})) (then ("PromoteIfReach" (sites Next) "DoubleCounter"))) (forEach Piece "DoubleCounter" (move Slide Orthogonal))}))) (end ("BlockWin")))) ###
8x8 board. 16 pieces per player, lined up in the second and third rows (first row on each side is empty). Pieces move forward or horizontally one space, and capture opponents' pieces by jumping in these directions. When they reach the opposite side, they become a king and can jump opponents' pieces from any distance orthogonally. Multiple captures cannot be made by moving 180 degrees from the previous jump. Pieces can be promoted to king mid-jump. Winning is achieved by capturing all of the other player's pieces or by blocking them so they cannot move. END
Construct a Ludii game based on the following description Played on a 19x19 board. The board begins empty. One player plays as black, the other as white. The black player begins by placing a piece on one of the intersections on the board. Players alternate turns placing a piece on the board. A player may pass at any time. A piece or a group of pieces are captured when they are completely surrounded on all sides on adjacent intersections by the opposing player. Stones may be placed in a position where they are surrounded. Stones cannot be placed to recreate a previous position. The game ends when both players pass consecutively. Players then fill in the spaces in their captured territory with their own pieces. Players total the number of intersections their pieces occupy. The player with the highest total wins. ###
(game "Weiqi" (players 2) (equipment { (board (square 19) use:Vertex) (piece "Marker" Each)}) (rules (meta (no Repeat)) (play (or (move Add (to (sites Empty)) (then ("EncloseCapture" Orthogonal))) (move Pass))) (end (if (all Passed) (byScore { (score P1 (+ (count Pieces P1) (size Territory P1))) (score P2 (+ (count Pieces P2) (size Territory P2)))}))))) END
Construct a Ludii game based on the following description 8x8 checkered board, with the left corner black for each player. Pieces with specialized moves, as follows: Noyion (x1): moves one space in any direction; Merzé (x1, \ ###
(define "NextCanNotMove" (not (can Move (do (forEach Piece Next) ifAfterwards:(not ("IsInCheck" "King_noCross" Next)))))) (game "Shodra" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) (hand Each size:5) ("ChessKing" "King_noCross") ("ChessRook" "Rook") (piece "Camel" Each (move Hop Diagonal (between if:True) (to if:(or (is Empty (to)) ("IsEnemyAt" (to))) (apply (remove (to)))))) ("ChessKnight" "Knight") ("ChessPawn" "Pawn" (if (is In (from) (sites Start (piece (what at:(from))))) ("DoubleStepForwardToEmpty")) (then ("PromoteIfReach" (sites Mover "Promotion") "Dog"))) (piece "Dog" Each ("StepToNotFriend" Diagonal)) (regions "Promotion" P1 (sites Top)) (regions "Promotion" P2 (sites Bottom))}) (rules (start { (place "Pawn1" (sites Row 1)) (place "Pawn2" (sites Row 6)) (place "Rook1" {"A1" "H1"}) (place "Knight1" {"B1" "G1"}) (place "Camel1" {"C1" "F1"}) (place "Dog1" coord:"D1") (place "King_noCross1" coord:"E1") (place "Rook2" {"A8" "H8"}) (place "Knight2" {"B8" "G8"}) (place "Camel2" {"C8" "F8"}) (place "Dog2" coord:"D8") (place "King_noCross2" coord:"E8")}) (play (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King_noCross" Mover)))) (end (if (and ("IsInCheck" "King_noCross" Next) ("NextCanNotMove")) { (if (no Pieces Next "Pawn") (result Mover Win)) (if (!= (count Pieces Next "Pawn") 0) (result Mover Draw))})))) END
Modify the Ludii game according to the following option changes: 12 Holes per row. -> 15 Holes per row. 1 extra capture. -> 2 extra captures. (define "HaveToMakeExtraCapture" (set Var "ExtraCapture" 1)) (define "NumCapture" (var "ExtraCapture")) (define "NextHoleFrom" ("NextSiteOnTrack" 1 from:#1 #2)) (define "AHoleHasMoreThanOneCounter" (not (all Sites (forEach (sites Mover) if:(< 1 (count at:(site)))) if:(= 0 (count at:(site)))))) (define "LastHoleSowed" (sites {(var)})) (define "NoPiece" (all Sites (sites Player "Home") if:(= 0 (count at:(site))))) (define "Columns" 12) (game "Misoro Tsoro (Additional Capture)" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "Track1" "0,E,N1,W" loop:True P1) (track "Track2" "24,E,N1,W" loop:True P2)}) (regions "Home" P1 (sites Track "Track1")) (regions "Home" P2 (sites Track "Track2")) (regions "Inner" P1 (difference (sites Track "Track1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "Track2") (sites Top))) (regions "Outer" P1 (sites Bottom)) (regions "Outer" P2 (sites Top)) (piece "Seed" Shared)}) (rules (start (set Count 2 to:(union (sites Top) (sites Bottom)))) phases:{ (phase "Misoro" (play (move Select (from (forEach (sites Mover "Outer") if:(= 0 (state at:(site))))) (then (set State at:(last To) (mover))))) (nextPhase (= 4 (count Turns)) "Playing")) (phase "Playing" (play (if (< 0 ("NumCapture")) (move Select (from (forEach (sites Next) if:(and (= 0 (state at:(site))) (< 0 (count at:(site)))))) (then (and { (if (< 1 ("NumCapture")) (moveAgain)) (set Var "ExtraCapture" (- ("NumCapture") 1)) (remove (last To)) (forEach Site (sites Board) (if (!= 0 (state at:(site))) (set State at:(site) (state at:(site)))))}))) (or (if (and (!= 0 (state at:(var))) ("SameTurn")) (move Pass)) (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover "Home")) if:(if "AHoleHasMoreThanOneCounter" (> (count at:(from)) 1) (and (= (count at:(from)) 1) (= 0 (count at:("NextHoleFrom" (from) Mover)))))) (then (and (sow "Track" owner:(mover) apply:(if (= (count at:(to)) 1) (if (is In (to) (sites Mover "Inner")) (if (> (count at:("OppositePit" (to))) 0) (and { (remove ("OppositePit" (to))) (if (> (count at:("OppositeOuterPit" (to))) 0) (remove ("OppositeOuterPit" (to)))) (moveAgain) ("HaveToMakeExtraCapture")}))) (and (moveAgain) (set Var (to))))) (forEach Site (sites Board) (if (!= 0 (state at:(site))) (set State at:(site) (state at:(site))))))))))))} (end (forEach NonMover if:("NoPiece") (result Player Loss))))) ###
(define "HaveToMakeExtraCapture" (set Var "ExtraCapture" 2)) (define "NumCapture" (var "ExtraCapture")) (define "NextHoleFrom" ("NextSiteOnTrack" 1 from:#1 #2)) (define "AHoleHasMoreThanOneCounter" (not (all Sites (forEach (sites Mover) if:(< 1 (count at:(site)))) if:(= 0 (count at:(site)))))) (define "LastHoleSowed" (sites {(var)})) (define "NoPiece" (all Sites (sites Player "Home") if:(= 0 (count at:(site))))) (define "Columns" 15) (game "Misoro Tsoro (Additional Capture)" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "Track1" "0,E,N1,W" loop:True P1) (track "Track2" "30,E,N1,W" loop:True P2)}) (regions "Home" P1 (sites Track "Track1")) (regions "Home" P2 (sites Track "Track2")) (regions "Inner" P1 (difference (sites Track "Track1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "Track2") (sites Top))) (regions "Outer" P1 (sites Bottom)) (regions "Outer" P2 (sites Top)) (piece "Seed" Shared)}) (rules (start (set Count 2 to:(union (sites Top) (sites Bottom)))) phases:{ (phase "Misoro" (play (move Select (from (forEach (sites Mover "Outer") if:(= 0 (state at:(site))))) (then (set State at:(last To) (mover))))) (nextPhase (= 4 (count Turns)) "Playing")) (phase "Playing" (play (if (< 0 ("NumCapture")) (move Select (from (forEach (sites Next) if:(and (= 0 (state at:(site))) (< 0 (count at:(site)))))) (then (and { (if (< 1 ("NumCapture")) (moveAgain)) (set Var "ExtraCapture" (- ("NumCapture") 1)) (remove (last To)) (forEach Site (sites Board) (if (!= 0 (state at:(site))) (set State at:(site) (state at:(site)))))}))) (or (if (and (!= 0 (state at:(var))) ("SameTurn")) (move Pass)) (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover "Home")) if:(if "AHoleHasMoreThanOneCounter" (> (count at:(from)) 1) (and (= (count at:(from)) 1) (= 0 (count at:("NextHoleFrom" (from) Mover)))))) (then (and (sow "Track" owner:(mover) apply:(if (= (count at:(to)) 1) (if (is In (to) (sites Mover "Inner")) (if (> (count at:("OppositePit" (to))) 0) (and { (remove ("OppositePit" (to))) (if (> (count at:("OppositeOuterPit" (to))) 0) (remove ("OppositeOuterPit" (to)))) (moveAgain) ("HaveToMakeExtraCapture")}))) (and (moveAgain) (set Var (to))))) (forEach Site (sites Board) (if (!= 0 (state at:(site))) (set State at:(site) (state at:(site))))))))))))} (end (forEach NonMover if:("NoPiece") (result Player Loss))))) END
Construct a Ludii game based on the following description Played on a board similar to Surakarta, but smaller. Players begin with four pieces, arranged in the square of spaces in their bottom right corner. Players take turns moving a piece to one adjacent spot. To capture an opponent's piece, you must move along the curved loops. The spot at the immediate end of the loop must be empty, but the piece may continue as far as the player wishes, including moving along successive loops, or until they make a capture or are stopped by their own piece. The pieces are placed in the corners. ###
(define "SlideToCapture" (move Slide "AllTracks" (between if:(or (= (between) (from)) (is Empty (between)))) (to if:("IsEnemyAt" (to)) (apply if:False (remove (to)))))) (game "Ja-Jeon-Geo-Gonu" (players 2) (equipment { (board (square 4) { (track "Track1" {14 14 11 10 9 8 8 13 9 5 1 1 4 5 6 7 7 2 6 10} loop:True directed:True) (track "Track2" {11 11 14 10 6 2 2 7 6 5 4 4 1 5 9 13 13 8 9 10} loop:True directed:True)} use:Vertex) (piece "Disc" Each (or { ("StepToEmpty" Orthogonal) ("SlideToCapture")}))}) (rules (start { (place "Disc1" {"A3" "B3" "A4" "B4"}) (place "Disc2" {"C1" "D1" "C2" "D2"})}) (play (forEach Piece)) (end ("CaptureAll" Next)))) END
Describe the mechanics of the following Ludii game (define "RemoveEnemyPiece" (if (is Mover P1) ("IsSingletonStack" ("EnemySite" P2 "Track2")) ("IsSingletonStack" ("EnemySite" P1 "Track1")))) (define "EnemySite" ("NextSiteFrom" (mapEntry "Start" #1) #2 (- (pips) 1))) (define "NextSiteFrom" ("NextSiteOnTrack" #3 from:#1 #2)) (game "Ketch-Dolt" (players 2) (equipment { ("BackgammonBoard" { (track "Track1" {26 12..7} P1 directed:True) (track "Track2" {27 25..20} P2 directed:True)}) (dice d:6 num:2) (piece "Disc" Each (or (if (is Empty (handSite Mover)) (forEach Die if:("DieNotUsed") (if ("IsOffBoard" ("NextSiteFrom" (from) "Track" (pips))) (do (if ("RemoveEnemyPiece") (trigger "ShouldCapture" Mover)) next:(move Remove (from)))) (then ("ReplayNotAllDiceUsed")))) (forEach Die if:("DieNotUsed") (or (if ("RemoveEnemyPiece") (move (from (if (is Mover P1) ("EnemySite" P2 "Track2") ("EnemySite" P1 "Track1"))) (to (handSite Next)))) (move (from (from)) (to ("NextSiteFrom" (from) "Track" (pips)) (apply (if ("RemoveEnemyPiece") (trigger "ShouldCapture" Mover)))))) (then ("ReplayNotAllDiceUsed"))))) (hand Each) (map "Start" {(pair P1 12) (pair P2 25)})}) (rules (start { (place Stack "Disc1" (handSite P1) count:15) (place Stack "Disc2" (handSite P2) count:15)}) (play ("RollEachNewTurnMove" (or (forEach Piece) (forEach Piece container:(mover))))) (end { (if (is Triggered "ShouldCapture" P1) (result P1 Loss)) (if (is Triggered "ShouldCapture" P2) (result P2 Loss)) ("EscapeWin")}))) ###
2x12 board, divided in half, where the spaces are rendered as points. Fifteen pieces per player. Two six-sided dice. Players move according to the number on each die by moving one piece the value on one die then another piece the value on the other die, or by moving one piece the value of one die and then the value of the other. The players enter their pieces on the board on the points corresponding to the throws of the dice. A player who rolls a number corresponding to a point on the opponent's side of the board that contains a piece should remove the piece from the opponent's point, which must be reentered. If the player fails to do so, they lose instantly. Otherwise, players continue to place their pieces until all are on the board, and they then bear the pieces off from the same quadrant of the board. The first player to bear off all their pieces wins. END
Modify the Ludii game according to the following option changes: 9 x 9 board -> 10 x 10 board (define "HopCounter" (move Hop (from #1) #2 (between if:(and (not (is In (between) (sites ToClear))) ("IsEnemyAt" (between))) (apply (remove (between) at:EndOfTurn))) (to if:(is Empty (to))) #3)) (game "Gauntlet" (players {(player N) (player W)}) (equipment { (board (square 9)) (piece "Counter" Each) (piece "DoubleCounter" Each) (regions "RunnerGoal" P1 (difference (sites Top) (sites Corners))) (regions "RunnerGoalRed" Neutral (intersection (difference (sites Top) (sites Corners)) (sites Phase 0))) (regions "RunnerGoalPink" Neutral (intersection (difference (sites Top) (sites Corners)) (sites Phase 1)))}) (rules (start { (place "Counter1" (difference (sites Bottom) (sites Corners))) (place "DoubleCounter2" (difference (sites Left) (sites Corners))) (place "Counter2" (difference (sites Right) (sites Corners)))}) (play (priority { (max Moves (or (forEach Piece "Counter" ("HopCounter" (from) Forward (then (if (can Move ("HopCounter" (last To) Forward)) (moveAgain))))) (forEach Piece "DoubleCounter" ("HopCounter" (from) Backward (then (if (can Move ("HopCounter" (last To) Backward)) (moveAgain))))))) (or (forEach Piece "Counter" (move Step (directions Forward) (to if:(is Empty (to))))) (forEach Piece "DoubleCounter" (move Step (directions Backward) (to if:(is Empty (to))))))})) (end { (if (no Moves Next) (result Next Loss)) (if (is In (last To) (sites Mover)) (result Mover Win))}))) ###
(define "HopCounter" (move Hop (from #1) #2 (between if:(and (not (is In (between) (sites ToClear))) ("IsEnemyAt" (between))) (apply (remove (between) at:EndOfTurn))) (to if:(is Empty (to))) #3)) (game "Gauntlet" (players {(player N) (player W)}) (equipment { (board (square 10)) (piece "Counter" Each) (piece "DoubleCounter" Each) (regions "RunnerGoal" P1 (difference (sites Top) (sites Corners))) (regions "RunnerGoalRed" Neutral (intersection (difference (sites Top) (sites Corners)) (sites Phase 0))) (regions "RunnerGoalPink" Neutral (intersection (difference (sites Top) (sites Corners)) (sites Phase 1)))}) (rules (start { (place "Counter1" (difference (sites Bottom) (sites Corners))) (place "DoubleCounter2" (difference (sites Left) (sites Corners))) (place "Counter2" (difference (sites Right) (sites Corners)))}) (play (priority { (max Moves (or (forEach Piece "Counter" ("HopCounter" (from) Forward (then (if (can Move ("HopCounter" (last To) Forward)) (moveAgain))))) (forEach Piece "DoubleCounter" ("HopCounter" (from) Backward (then (if (can Move ("HopCounter" (last To) Backward)) (moveAgain))))))) (or (forEach Piece "Counter" (move Step (directions Forward) (to if:(is Empty (to))))) (forEach Piece "DoubleCounter" (move Step (directions Backward) (to if:(is Empty (to))))))})) (end { (if (no Moves Next) (result Next Loss)) (if (is In (last To) (sites Mover)) (result Mover Win))}))) END
Construct a Ludii game based on the following description 8x8 board. The pieces move as follows: King (x1): one space in any direction' Queen (x1): moves one square diagonally. On its first move, the Queen may jump diagonally two squares. The Queen cannot capture when making this move. Bishop (x2): jumps exactly two squares diagonally; Knight (x2): moves one space orthogonally and then one space diagonally, jumping over the intervening spaces; Rook (x2): moves any distance orthogonally; Pawns (x8): move one square forward orthogonally or one square forward diagonally to capture. Pawns may move two squares on their first move, but only if there have been no captures yet in the game. When reaching the opposite edge of the board, pawns may be promoted to Queen if the Queen has already been taken. If the King can be captured on the opponent's next move, it is in check. The King must not be in check at the end of the player's turn. If this is impossible, it is checkmate, and the opponent wins. ###
(define "CaptureForwardDiagonal" (move Step (directions {FR FL}) (to if:("IsEnemyAt" (to)) "CaptureToPiece"))) (define "RememberMoved" (set State at:#1 1)) (define "MovedBefore" (= 1 (state at:#1))) (define "HadACapture" (= (var) 1)) (define "CaptureToPiece" (apply (if ("IsEnemyAt" (to)) (remove (to) (then (set Var 1)))))) (game "Acedrex (Alfonso)" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) ("ChessKing" "King" (then (set Var 1))) (piece "Queen" Each (or (move Step Diagonal (to if:(not ("IsFriendAt" (to))) "CaptureToPiece")) (if (not ("MovedBefore" (from))) (move Hop Diagonal (between if:True) (to if:(is Empty (to))))) (then (if (not ("MovedBefore" (last To))) ("RememberMoved" (last To)))))) (piece "Bishop" Each (move Hop Diagonal (between if:True) (to if:(not ("IsFriendAt" (to))) "CaptureToPiece"))) ("ChessKnight" "Knight" (then (set Var 1))) ("ChessRook" "Rook" (then (set Var 1))) (piece "Pawn" Each (or { (if (and (not ("HadACapture")) (is In (from) (sites Start (piece (what at:(from)))))) ("DoubleStepForwardToEmpty")) "StepForwardToEmpty" "CaptureForwardDiagonal"} (then (if (and ("IsOffBoard" (where "Queen" Mover)) (is In (last To) (sites Mover "Promotion"))) (promote (last To) (piece "Queen") Mover))))) (regions "Promotion" P1 (sites Top)) (regions "Promotion" P2 (sites Bottom))}) (rules (start { (place "Pawn1" (sites Row 1)) (place "Pawn2" (sites Row 6)) (place "Rook1" {"A1" "H1"} state:1) (place "Knight1" {"B1" "G1"}) (place "Bishop1" {"C1" "F1"}) (place "Queen1" coord:"D1") (place "King1" coord:"E1" state:1) (place "Rook2" {"A8" "H8"} state:1) (place "Knight2" {"B8" "G8"}) (place "Bishop2" {"C8" "F8"}) (place "Queen2" coord:"D8") (place "King2" coord:"E8" state:1)}) (play (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King" Mover)))) (end ("Checkmate" "King")))) END
Construct a Ludii game based on the following description This game is played on an empty 1row x n column board with m stones on each side. At each turn, each player must do one of the following actions. Move a stone forward (i.e., left to one player, right to the other) or jump over one enemy stone, landing on the immediate empty cell. The player who makes the last move wins the game. The game is played on a 1x5 board. ###
(define "MoveOfThePiece" (or (move Hop Forward (between if:("IsEnemyAt" (between))) (to if:(is Empty (to)))) ("StepForwardToEmpty"))) (game "Toads and Frogs" (players 2) (equipment { (board (rectangle 1 5)) (piece "Toad" P1 E "MoveOfThePiece") (piece "Frog" P2 W "MoveOfThePiece")}) (rules (start { (place "Toad1" (expand (sites Left) steps:(- 2 1))) (place "Frog2" (expand (sites Right) steps:(- 2 1)))}) (play (forEach Piece)) (end ("BlockWin")))) END
Construct a Ludii game based on the following description 5x12 board, played on the intersections of lines. Twelve pieces per player, arranged along the side of twelve closest to the player. Pieces move along a boustrophedon track, one player starting from left to right in their starting row and the other from right to left in their starting row. Moves are determined by the throw of six cowries: one mouth up = 1, two mouth up = 2, three mouths up = 3, four mouths up = 4, five mouths up = 1 (0 and 6 mouths up are not specified, but are between 10 and 20 and the move can be split to make captures). A player must roll 1 or (0 or 6) to begin. When a piece moves to a spot occupied by an opponent's piece, it is captured. The goal of the game is to reduce the other player to one or two pieces. 0 or 6 mouths correspond to 10. ###
(define "RemovePiece" (apply (if ("IsEnemyAt" (to)) (remove (to))))) (define "CanMove" (= (value Player Mover) 1)) (define "AllowToBegin" (is In (count Pips) (sites {0 1 5 6}))) (game "Awangdu" (players 2) (equipment { (board (rectangle 5 12) { (track "Track1" "0,E,N1,W,N1,E,N1,W,N1,E" P1 directed:True) (track "Track2" "59,W,S1,E,S1,W,S1,E,S1,W" P2 directed:True)} use:Vertex) ("StickDice" 6) (piece "Disc" Each (if (not ("IsFriendAt" ("NextSiteOnTrack" (mapEntry (var))))) (move (from) (to ("NextSiteOnTrack" (mapEntry (var))) ("RemovePiece"))))) (map {(pair 0 10) (pair 1 1) (pair 2 2) (pair 3 3) (pair 4 4) (pair 5 1) (pair 6 10)})}) (rules (start { (place "Disc1" (sites Bottom)) (place "Disc2" (sites Top))}) (play ("RollMove" (if (or ("CanMove") ("AllowToBegin")) (do (set Var (count Pips)) next:(forEach Piece (then (if (not ("CanMove")) (set Value Mover 1)))))))) (end ("HavingLessPiecesLoss" Next 2)))) END
Modify the Ludii game according to the following option changes: The board is a square 8x8 -> The board is a square 10x10 (define "SizeStart" 2) (game "Bajr" (players {(player NE) (player SW)}) (equipment { (board (square 8)) (piece "Counter" Each ("StepToEmpty" (directions {Forwards Leftward Rightward}))) (regions "Home" P1 (expand (intersection (sites Bottom) (sites Left)) steps:"SizeStart" Orthogonal)) (regions "Home" P2 (expand (intersection (sites Top) (sites Right)) steps:"SizeStart" Orthogonal)) (map {(pair P1 P2) (pair P2 P1)})}) (rules (start { (place "Counter1" (sites P1)) (place "Counter2" (sites P2))}) (play (forEach Piece)) (end ("FillWin" (sites (player (mapEntry (mover)))))))) ###
(define "SizeStart" 3) (game "Bajr" (players {(player NE) (player SW)}) (equipment { (board (square 10)) (piece "Counter" Each ("StepToEmpty" (directions {Forwards Leftward Rightward}))) (regions "Home" P1 (expand (intersection (sites Bottom) (sites Left)) steps:"SizeStart" Orthogonal)) (regions "Home" P2 (expand (intersection (sites Top) (sites Right)) steps:"SizeStart" Orthogonal)) (map {(pair P1 P2) (pair P2 P1)})}) (rules (start { (place "Counter1" (sites P1)) (place "Counter2" (sites P2))}) (play (forEach Piece)) (end ("FillWin" (sites (player (mapEntry (mover)))))))) END
Describe the mechanics of the following Ludii game (game "Three Men's Morris" (players 2) (equipment { ("ThreeMensMorrisBoard") (hand Each) (piece "Marker" Each "StepToEmpty")}) (rules (start (place "Marker" "Hand" count:3)) phases:{ (phase "Placement" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase ("HandEmpty" P2) "Movement")) ("PhaseMovePiece" "Movement")} (end ("Line3Win")))) ###
3x3 intersecting lines with diagonals. Play occurs on the intersections of the lines. Each player has three pieces. Play begins with each player placing pieces on empty points. If they make three in a row along the lines, they win. Once all pieces are place, players take turns moving pieces one spot to an adjacent point along the lines trying to make three in a row. The pieces can move to any empty adjacent sites. END
Construct a Ludii game based on the following description Cross-shaped board, made of four 3x3 intersecting lines with diagonals. One player plays as the fox, which begins on the central space of the board. The other player plays as the lambs, who start in the spaces of one arm of the cross and the line of seven spots in front of that arm. Players alternate turns moving their pieces along the lines. The fox may capture one lamb by hopping over it in a straight line to an empty space on the opposite side of it. The fox wins by capturing seven lambs, the lambs win by blocking the fox so it cannot move. ###
(game "Refskak" (players 2) (equipment { ("CrossBoard" 3 7 use:Vertex diagonals:Alternating) (piece "Lamb" P1 "StepToEmpty") (piece "Fox" P2 (or "HopCapture" "StepToEmpty"))}) (rules (start { (place "Fox2" (centrePoint)) (place "Lamb1" (union (expand (sites Bottom) steps:2) (sites {"A3" "B3" "F3" "G3"})))}) (play (forEach Piece)) (end ("NoMovesLossAndLessNumPiecesPlayerLoss" P1 6)))) END
Construct a Ludii game based on the following description A board is dead if it contains at least one set of three stones in a straight orthogonal or diagonal line. A board that is not dead is alive. On their turn, a player must place a piece on an empty square of a living board. When all boards are dead, the player who made the last placement loses. ###
(game "Notakto" (players 2) (equipment { (board (union { (square 3) (shift 0 4 (square 3)) (shift 0 8 (square 3)) (shift 0 12 (square 3)) (shift 4 0 (square 3)) (shift 4 4 (square 3)) (shift 4 8 (square 3)) (shift 4 12 (square 3)) (shift 8 0 (square 3)) (shift 8 4 (square 3)) (shift 8 8 (square 3)) (shift 8 12 (square 3)) (shift 12 0 (square 3)) (shift 12 4 (square 3)) (shift 12 8 (square 3)) (shift 12 12 (square 3))})) (piece "Marker" Each)}) (rules (play (move Add (to (sites Empty) if:(= 0 (state at:(to)))) (then (if (is Line 3) (forEach Site (expand origin:(last To) steps:2) (set State at:(site) 1)))))) (end (if (no Moves Next) (result Mover Loss))))) END
Modify the Ludii game according to the following option changes: The game is played on a 4x4 board. -> The game is played on a 5x5 board. (game "Breakthrough" ("TwoPlayersNorthSouth") (equipment { (board (square 4)) (piece "Pawn" Each (or { "StepForwardToEmpty" (move Step (directions {FR FL}) (to if:(or (is Empty (to)) ("IsEnemyAt" (to))) (apply (remove (to)))))})) (regions P1 (sites Top)) (regions P2 (sites Bottom))}) (rules (start { (place "Pawn1" (expand (sites Bottom))) (place "Pawn2" (expand (sites Top)))}) (play (forEach Piece)) (end ("ReachWin" (sites Mover) Mover)))) ###
(game "Breakthrough" ("TwoPlayersNorthSouth") (equipment { (board (square 5)) (piece "Pawn" Each (or { "StepForwardToEmpty" (move Step (directions {FR FL}) (to if:(or (is Empty (to)) ("IsEnemyAt" (to))) (apply (remove (to)))))})) (regions P1 (sites Top)) (regions P2 (sites Bottom))}) (rules (start { (place "Pawn1" (expand (sites Bottom))) (place "Pawn2" (expand (sites Top)))}) (play (forEach Piece)) (end ("ReachWin" (sites Mover) Mover)))) END
Modify the Ludii game according to the following option changes: The game is played on a 10x10 board -> The game is played on a 14x14 board (game "Chameleon" (players 2) (equipment { (board (hex Diamond 10)) (piece "Marker" Each) (hand Shared size:2) (regions P1 {(sites Side NE) (sites Side SW)}) (regions P2 {(sites Side NW) (sites Side SE)})}) (rules (meta (swap)) (start { (place "Marker1" (handSite Shared)) (place "Marker2" (handSite Shared 1))}) (play (move (from (sites Hand Shared)) (to (sites Empty)) copy:True)) (end { (if (is Connected Mover) (result Mover Win)) (if (is Connected Next) (result Next Win))}))) ###
(game "Chameleon" (players 2) (equipment { (board (hex Diamond 14)) (piece "Marker" Each) (hand Shared size:2) (regions P1 {(sites Side NE) (sites Side SW)}) (regions P2 {(sites Side NW) (sites Side SE)})}) (rules (meta (swap)) (start { (place "Marker1" (handSite Shared)) (place "Marker2" (handSite Shared 1))}) (play (move (from (sites Hand Shared)) (to (sites Empty)) copy:True)) (end { (if (is Connected Mover) (result Mover Win)) (if (is Connected Next) (result Next Win))}))) END
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. The enemy piece is removed. ###
(define "HopCapture" (move Hop #1 #2 (between if:("IsEnemyAt" (between)) (apply (remove (between)))) (to if:(is Empty (to))) #3)) END
Describe the mechanics of the following Ludii game (define "PiecesOwnedBy" (count at:(mapEntry #1))) (define "Columns" 7) (game "Chongka'" (players 2) (equipment { (mancalaBoard 2 "Columns" { (track "Track1" "7,W,WNW,ENE,E" loop:True P1) (track "Track2" "7,W,N,E,ESE" loop:True P2)}) (piece "Seed" Shared) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 FirstSite) (pair P2 LastSite)})}) (rules (start (set Count 7 to:(union (sites P1) (sites P2)))) (play (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover)) if:(> (count at:(from)) 0)) (then (sow "Track" owner:(mover) apply:(if (and { (> (count at:(to)) 1) (is In (to) (union (sites P1) (sites P2)))}) (moveAgain) (if (and (is In (to) (sites Mover)) (> (count at:("OppositePit" (to))) 0)) (fromTo (from ("OppositePit" (to))) (to (mapEntry Mover)) count:(count at:("OppositePit" (to)))))))))) (end ("MancalaByScoreWhen" (and (no Moves Mover) (no Moves Next)))))) ###
2x7 board with two stores. Seven counters in each hole. Players move from one of the holes in their row, sowing in a clockwise direction, and including the player's store, which is to the left, but not the opponent's store. If the final counter of a sowing lands in an occupied hole (not a store), sowing continues. If it lands into an empty hole, the turn is over. If the empty hole is in the player's own row, the contents of the hole opposite in the opponent's row are captured and placed in the store. The person who captures the most counters wins. END
Construct a Ludii game based on the following description Overflow is played on a checkered board initially filled with neutral stackable pieces, one per square. The dark squares make up the house of the Dark player, and the light squares make up the house of the Light player. The goal is to empty your opponent's house. There are two types of moves in Overflow, both of which are sowing moves, somewhat akin to what you see in mancalas. All moves are bound by the restriction that there must always be exactly one orthodiagonally connected group of stacks on the board. The one kind of sowing only drops pieces onto already occupied squares and the other kind spills out of both the group of already occupied squares and out of the board itself, hence the names: contained moves and overflow moves. Sowing in general: Sowing in general is picking up a stack from any square and distributing its pieces along one of the 8 directions onto a contiguous line of squares – usually placing one of the N pieces from the chosen stack in each of the N or so squares in the sowing direction. The details are given below. Overflow moves: An overflow move involves sowing into empty squares – possibly in addition to occupied squares – and over the edge of the board. It's important to remember that these two things always go together in this game, namely (1) sowing over the edge and (2) sowing into empty squares. That is to say, if you are to sow into one or more empty squares, the number of squares in the chosen sowing direction must be smaller than the number of stones in the chosen stack. The pieces that end up outside the board are removed from the game. Contained moves: Contained moves only sow onto already occupied squares. A contained move must sow the chosen stack as far as possible. If it's impossible to sow each of the pieces in the stack into an occupied square of its own, you place the remainder of the pieces on the last occupied square you reached. You are not obligated to chose the stack that can be sown the farthest, but whatever stack you chose, if you do not make an overflow move move with it, you must chose a sowing direction that allows you to sow onto as many occupied squares as possible. You may always chose freely between contained moves and overflow moves when both kinds are available. Note that no stack will have both a contained move and an overflow move available in the same direction. All moves are completely determined by the choice of stack and direction. A 6x6 board is currently selected ###
(define "UpdateScores" (and (set Score P1 (count Sites in:(forEach (sites Phase 1) if:(is Occupied (site))))) (set Score P2 (count Sites in:(forEach (sites Phase 0) if:(is Occupied (site))))))) (define "DistanceToEndSquare" (count Sites in:(sites Direction from:(last From) ("LastDirection" Cell) stop:(is Empty (to)) distance:(size Stack at:(last From))))) (define "EnoughSpaceInDirection" (<= (size Stack at:(from)) (count Sites in:(sites Direction from:(from) (directions Cell from:(from) to:#1) distance:(size Stack at:(from)))))) (define "ZeroEmptyInRangeInDirection" (= 0 (count Sites in:(intersection (sites Empty) (sites Direction from:(from) (directions Cell from:(from) to:#1) distance:(size Stack at:(from))))))) (define "ContainedMove" (move Select (from (sites Occupied by:P1)) (to (sites Around (from) NotEmpty) if:(and (or ("EnoughSpaceInDirection" (to)) ("ZeroEmptyInRangeInDirection" (to))) (all Sites (sites Around (from) NotEmpty) if:(not (and (< (count Sites in:(sites Direction from:(from) (directions Cell from:(from) to:(to)) stop:(is Empty (to)) distance:(size Stack at:(from)))) (count Sites in:(sites Direction from:(from) (directions Cell from:(from) to:(site)) stop:(is Empty (to)) distance:(size Stack at:(from))))) (or ("EnoughSpaceInDirection" (site)) ("ZeroEmptyInRangeInDirection" (site)))))))) (then (forEach Site (sites Direction from:(last From) ("LastDirection" Cell) stop:(is Empty (to)) distance:(size Stack at:(last From))) (if (= ("DistanceToEndSquare") (count Steps (last From) (site))) (add (piece "Disc1") (to (site)) count:(- (size Stack at:(last From)) (- ("DistanceToEndSquare") 1)) stack:True) (add (piece "Disc1") (to (site)) stack:True)))))) (define "OverflowMove" (move Select (from (sites Occupied by:P1)) (to (sites Around (from)) if:(and (not ("EnoughSpaceInDirection" (to))) (not ("ZeroEmptyInRangeInDirection" (to))))) (then (forEach Site (sites Direction from:(last From) ("LastDirection" Cell) distance:(size Stack at:(last From))) (add (piece "Disc1") (to (site)) stack:True))))) (game "Overflow" (players 2) (equipment { (board (square 6)) (piece "Disc" P1)}) (rules (start { (place "Disc1" (sites Board)) (set Score P1 (count Sites in:(sites Phase 1))) (set Score P2 (count Sites in:(sites Phase 0)))}) (play (do (or ("ContainedMove") ("OverflowMove") (then (remove (last From) count:(size Stack at:(last From))))) ifAfterwards:(= 1 (count Groups)) (then ("UpdateScores")))) (end (if (= 0 (* (score P1) (score P2))) (byScore))))) END
Construct a Ludii game based on the following description 2x6 board with two stores. Four counters in each hole. Sowing occurs in an anti-clockwise direction from a hole in the player's row. If the final counter falls into a hole in the opponent's row containing two counters, making it contain three, they are captured. Any holes containing three counters in an unbroken line behind it in the opponent's row are also captured. A player cannot sow into a hole from which they sowed until it has been sown into by the opponent. Play continues until no more captures are possible, and the players win the counters they captured and the counters on their side of the board. A new round begins. The player with fewer counters fills up their holes from right to left with four counters. The opponent fills the same number of holes, and continues to play, holding any remaining counters for future rounds, if necessary. Play proceeds as before with the present number of holes in play. Play continues until one player cannot fill any holes. ###
(define "NoMoreCapturePossible" (not (can Move (or (move Select (from (sites (values Remembered "OwnedP1")) if:(and (not (is In (from) (values Remembered "P1SowFrom"))) (< 0 (count at:(from)))))) (move Select (from (sites (values Remembered "OwnedP2")) if:(and (not (is In (from) (values Remembered "P2SowFrom"))) (< 0 (count at:(from)))))))))) (define "RemmemberNextOwnedHoles" (if (is Next P1) (remember Value "OwnedP1" #1) (remember Value "OwnedP2" #1))) (define "RemmemberOwnedHoles" (if (is Mover P1) (remember Value "OwnedP1" #1) (remember Value "OwnedP2" #1))) (define "OwnedHoles" (if (is Mover P1) (sites (values Remembered "OwnedP1")) (sites (values Remembered "OwnedP2")))) (define "ForgetValue" (if (is Mover P1) (forget Value "OwnedP1" #1) (forget Value "OwnedP2" #1))) (define "RightMostEmpty" (trackSite FirstSite "TrackCW" from:(mapEntry "RightMost" Mover) if:(is Empty (to)))) (define "NoPieceOnBoard" (all Sites (union (sites P1) (sites P2)) if:(= 0 (count at:(site))))) (define "NextHole" ("NextSiteOnTrack" #2 from:#1 "Track")) (define "PossibleSowFrom" (if (is Mover P1) (not (is In (from) (values Remembered "P1SowFrom"))) (not (is In (from) (values Remembered "P2SowFrom"))))) (define "PiecesOwnedBy" (+ (count at:(mapEntry #1)) (count in:(sites #1)))) (define "Columns" 6) (game "Adi" (players 2) (equipment { (mancalaBoard 2 "Columns" { (track "TrackCCW" "1,E,N,W" loop:True) (track "TrackCW" "6,W,N,E" loop:True)}) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 FirstSite) (pair P2 LastSite)}) (piece "Seed" Shared) (map "RightMost" {(pair P1 6) (pair P2 7)}) (map "CorrespondingHoles" {(pair 1 12) (pair 2 11) (pair 3 10) (pair 4 9) (pair 5 8) (pair 6 7) (pair 7 6) (pair 8 5) (pair 9 4) (pair 10 3) (pair 11 2) (pair 12 1)})}) (rules (start { (set Count 4 to:(sites Track)) (set RememberValue "OwnedP1" (sites Bottom)) (set RememberValue "OwnedP2" (sites Top))}) phases:{ (phase "Sowing" (play (or { (move Select (from ("OwnedHoles") if:(and ("PossibleSowFrom") (< 0 (count at:(from))))) (then (and { (sow "TrackCCW" if:(and (is In (to) (sites Next)) (= (count at:(to)) 3)) apply:(fromTo (from (to)) (to (mapEntry (mover))) count:(count at:(to))) backtracking:True) (forEach Value (array (sites Track from:(last From) to:("NextHole" (last From) (min 12 (count at:(last From)))))) (if (is Mover P1) (if (is In (value) (values Remembered "P2SowFrom")) (forget Value "P2SowFrom" (value))) (if (is In (value) (values Remembered "P1SowFrom")) (forget Value "P1SowFrom" (value))))) (if (is Mover P1) (remember Value "P1SowFrom" (last From)) (remember Value "P2SowFrom" (last From)))})))} (then (if ("NoMoreCapturePossible") (and { (forEach Site (sites P1) (if (< 0 (count at:(site))) (fromTo (from (site)) (to (mapEntry P1)) count:(count at:(site))))) (forEach Site (sites P2) (if (< 0 (count at:(site))) (fromTo (from (site)) (to (mapEntry P2)) count:(count at:(site))))) (forget Value "OwnedP1" All) (forget Value "OwnedP2" All) (forget Value "P1SowFrom" All) (forget Value "P2SowFrom" All) (if (>= (+ (count at:(mapEntry P2)) (count in:(sites P2))) (+ (count at:(mapEntry P1)) (count in:(sites P1)))) (set NextPlayer (player 1)) (set NextPlayer (player 2)))}))))) (end (if ("NoPieceOnBoard") { (if (> 4 (count at:(mapEntry P1))) (result P2 Win)) (if (> 4 (count at:(mapEntry P2))) (result P1 Win))})) (nextPhase ("NoPieceOnBoard") "BetweenRounds")) (phase "BetweenRounds" (play (if (<= 4 (count at:(mapEntry Mover))) (move (from (mapEntry Mover)) (to ("RightMostEmpty")) count:4 (then (and ("RemmemberOwnedHoles" (last To)) (if (<= 4 (count at:(mapEntry Mover))) (moveAgain) (forEach Site (sites Mover) (if (is Occupied (site)) (and (fromTo (from (mapEntry Next)) (to (mapEntry "CorrespondingHoles" (site))) count:(count at:(site))) ("RemmemberNextOwnedHoles" (mapEntry "CorrespondingHoles" (site)))))))))))) (nextPhase (> 4 (count at:(mapEntry Mover))) "Sowing"))})) END
Construct a Ludii game based on the following description 8x8 board. The pieces move as follows, with the number per player: 1 x King (king): moves one space orthogonally or diagonally. 1 x Queen: One square diagonally. 2 x Rook: Any number of spaces orthogonally. 2 x Fil (elephant): Two squares diagonally, jumping over the first. Cannot capture another Fil. 2 x Knight: Moves as a chess knight. 8 x Pawn: Moves one space forward orthogonally; one space forward diagonally to capture. No en passant. Promoted to Queen when reaching the eighth rank. The pieces begin in the following position: Fils on the third and sixth spaces of the first row, King on the fifth space of the first row, Rooks on the third and sixth spaces of the second row, Knights on the fourth and fifth spaces of the second row, Pawns on the third row, the Queen sharing a space with the Pawn in the fifth space. Kings are on the same column. The only time two pieces can be on the same space is in this initial arrangement. No castling. An opponent's piece is captured by moving a player's own piece onto a space occupied by the opponent's piece. When a King can be captured on the next turn by an opponent's piece, it is in check. The King must not be in check at the end of the player's turn. If this is not possible, it is checkmate and the opponent wins. Stalemate results in a win for that player causing it. Capturing all of an opponent's pieces except the King also results in a win. ###
(define "NextCanNotMove" (not (can Move (do (forEach Piece Next) ifAfterwards:(not ("IsInCheck" "King" Next)))))) (define "CaptureForwardDiagonal" (move Step (from (from) level:(level)) (directions {FR FL}) (to if:("IsEnemyAt" (to)) (apply (forEach Level (to) (remove (to) level:(level))))))) (define "CaptureToPiece" (apply (if ("IsEnemyAt" (to)) (forEach Level (to) (remove (to) level:(level)))))) (game "Short Assize" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) (piece "King" Each (move Step (from (from) level:(level)) (to if:(not ("IsFriendAt" (to))) "CaptureToPiece"))) (piece "Rook" Each (move Slide (from (from) level:(level)) Orthogonal (to if:("IsEnemyAt" (to)) "CaptureToPiece"))) (piece "Bishop" Each (move Hop (from (from) level:(level)) Diagonal (between if:True) (to if:(not ("IsFriendAt" (to))) "CaptureToPiece"))) (piece "Knight" Each (move Leap (from (from) level:(level)) "KnightWalk" (to if:(not ("IsFriendAt" (to))) "CaptureToPiece"))) (piece "Queen" Each (move Step (from (from) level:(level)) Diagonal (to if:(not ("IsFriendAt" (to))) "CaptureToPiece"))) (piece "Pawn" Each (or (move Step (from (from) level:(level)) Forward (to if:(is Empty (to)))) "CaptureForwardDiagonal" (then (if (is In (last To) (sites Mover "Promotion")) (promote (last To) (piece (id "Queen" Mover))))))) (regions "Promotion" P1 (sites Top)) (regions "Promotion" P2 (sites Bottom))}) (rules (start { (place "Bishop1" (sites {"C1" "F1"})) (place "Rook1" (sites {"C2" "F2"})) (place "Knight1" (sites {"D2" "E2"})) (place "King1" coord:"E1") (place Stack "Pawn1" (sites Row 2)) (place Stack "Queen1" (sites {"D3"})) (place "Bishop2" (sites {"C8" "F8"})) (place "Rook2" (sites {"C7" "F7"})) (place "Knight2" (sites {"D7" "E7"})) (place "King2" coord:"E8") (place Stack "Pawn2" (sites Row 5)) (place Stack "Queen2" (sites {"D6"}))}) (play (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King" Mover)))) (end { (if (and ("IsInCheck" "King" Next) ("NextCanNotMove")) (result Mover Win)) ("BlockWin") (if (= (count Pieces Next) 1) (result Mover Win))}))) END
Construct a Ludii game based on the following description The player must color in the circles on the intersections. Numbers in the squares indicate the number of adjacent circles which should be colored. ###
(game "Squaro" (players 1) (equipment { (board (square 6) (values Vertex (range 0 1)) use:Vertex) (hints { (hint 0 3) (hint 1 3) (hint 2 2) (hint 3 0) (hint 4 2) (hint 5 3) (hint 6 2) (hint 7 1) (hint 8 0) (hint 9 2) (hint 10 2) (hint 11 1) (hint 12 2) (hint 13 2) (hint 14 3) (hint 15 3) (hint 16 3) (hint 17 4) (hint 18 3) (hint 19 2) (hint 20 3) (hint 21 4) (hint 22 4) (hint 23 3) (hint 24 1)} Cell) (regions "AllSites" (sites Board))}) (rules (play (satisfy (forAll Cell (is Count Vertex (sites Incident Vertex of:Cell at:(from)) of:1 (hint Cell at:(from)))))) (end (if (is Solved) (result P1 Win))))) END
Modify the Ludii game according to the following option changes: Seega rules applied to a 17x17 board. -> Kharebga rules applied to a 17x18 board. (define "Custodial" (custodial (from (last To)) Orthogonal (between (max 1) if:(= (what at:(between)) (id #1)) (apply (remove (between)))) (to if:("FriendOrCentre")))) (define "JarlButNotTheExpandedCentre" (and (= (what at:(between)) (id "Jarl2")) (and (!= (between) ("Castle")) (not (is In (between) (sites "OrthogonalSitesCentre")))))) (define "JarlAndExpandedCentre" (and (= (what at:(between)) (id "Jarl2")) (or (= (between) ("Castle")) (is In (between) (sites "OrthogonalSitesCentre"))))) (define "FriendOrCentre" (or ("IsFriendAt" (to)) (= (to) ("Castle")))) (define "CaptureJarl" (apply (trigger "Surrounded" P2))) (define "JarlWasCaptured" (is Triggered "Surrounded" P2)) (define "Castle" (centrePoint)) (define "Custodial" (custodial (from (last To)) Orthogonal (between (max 1) if:(= (what at:(between)) (id #1)) (apply (remove (between)))) (to if:("FriendOrCentre")))) (define "JarlButNotTheExpandedCentre" (and (= (what at:(between)) (id "Jarl2")) (and (!= (between) ("Castle")) (not (is In (between) (sites "OrthogonalSitesCentre")))))) (define "JarlAndExpandedCentre" (and (= (what at:(between)) (id "Jarl2")) (or (= (between) ("Castle")) (is In (between) (sites "OrthogonalSitesCentre"))))) (define "FriendOrCentre" (or ("IsFriendAt" (to)) (= (to) ("Castle")))) (define "CaptureJarl" (apply (trigger "Surrounded" P2))) (define "JarlWasCaptured" (is Triggered "Surrounded" P2)) (define "Castle" (centrePoint)) (define "NoRepetition" (meta (no Repeat))) (game "Poprad Game" (players 2) (equipment { (board (square 17)) (piece "Marker" Each ("StepToEmpty" Orthogonal (then ("CustodialCapture" Orthogonal (max 1))))) (hand Each)}) (rules ("NoRepetition") (start (place "Marker" "Hand" count:144)) phases:{ (phase "Placement" (play (move (from (handSite Mover)) (to (difference (sites Board) (centrePoint)) if:(is Empty (to))) (then (if (and (is Occupied (handSite Mover)) ("NewTurn")) (moveAgain))))) (nextPhase Mover (is Empty (handSite Mover)) "Capture")) ("PhaseMovePiece" "Capture")} (end ("HavingLessPiecesLoss" Next 1)))) ###
(define "Custodial" (custodial (from (last To)) Orthogonal (between (max 1) if:(= (what at:(between)) (id #1)) (apply (remove (between)))) (to if:("FriendOrCentre")))) (define "JarlButNotTheExpandedCentre" (and (= (what at:(between)) (id "Jarl2")) (and (!= (between) ("Castle")) (not (is In (between) (sites "OrthogonalSitesCentre")))))) (define "JarlAndExpandedCentre" (and (= (what at:(between)) (id "Jarl2")) (or (= (between) ("Castle")) (is In (between) (sites "OrthogonalSitesCentre"))))) (define "FriendOrCentre" (or ("IsFriendAt" (to)) (= (to) ("Castle")))) (define "CaptureJarl" (apply (trigger "Surrounded" P2))) (define "JarlWasCaptured" (is Triggered "Surrounded" P2)) (define "Castle" (centrePoint)) (define "Custodial" (custodial (from (last To)) Orthogonal (between (max 1) if:(= (what at:(between)) (id #1)) (apply (remove (between)))) (to if:("FriendOrCentre")))) (define "JarlButNotTheExpandedCentre" (and (= (what at:(between)) (id "Jarl2")) (and (!= (between) ("Castle")) (not (is In (between) (sites "OrthogonalSitesCentre")))))) (define "JarlAndExpandedCentre" (and (= (what at:(between)) (id "Jarl2")) (or (= (between) ("Castle")) (is In (between) (sites "OrthogonalSitesCentre"))))) (define "FriendOrCentre" (or ("IsFriendAt" (to)) (= (to) ("Castle")))) (define "CaptureJarl" (apply (trigger "Surrounded" P2))) (define "JarlWasCaptured" (is Triggered "Surrounded" P2)) (define "Castle" (centrePoint)) (define "NoRepetition" (meta (no Repeat))) (game "Poprad Game" (players 2) (equipment { (board (rectangle 17 18)) (piece "Marker" Each (move Slide Orthogonal (then ("CustodialCapture" Orthogonal (max 1))))) (hand Each)}) (rules ("NoRepetition") (start (place "Marker" "Hand" count:152)) phases:{ (phase "Placement" (play (move (from (handSite Mover)) (to (difference (sites Board) (centrePoint)) if:(is Empty (to))) (then (if (and (is Occupied (handSite Mover)) ("NewTurn")) (moveAgain))))) (nextPhase Mover (is Empty (handSite Mover)) "Capture")) ("PhaseMovePiece" "Capture")} (end ("HavingLessPiecesLoss" Next 1)))) END
Construct a Ludii game based on the following description The game is played on a cruciform board adapted from an Alquerque board. One player plays as the fox, the other as the geese. The geese begin in a set starting position; the person playing as the fox may choose any available spot to place the fox as their first move. Players move as in Alquerque, but only the fox can hop to capture. The goal of the geese is to block the fox from being able to move; the fox's goal is to capture all of the geese. The game starts with 13 geese. ###
(game "Fox and Geese" (players 2) (equipment { ("CrossBoard" 3 7 use:Vertex diagonals:Alternating) (hand P1) (piece "Fox" P1 (or ("HopCapture") "StepToEmpty")) (piece "Goose" P2 "StepToEmpty")}) (rules (start { (place "Goose2" (union (expand (sites Bottom)) (sites Row 2))) (place "Fox1" (handSite P1))}) phases:{ (phase "Placement" P1 (play (move (from (handSite P1)) (to (sites Empty)))) (nextPhase ("HandEmpty" P1) "Movement")) (phase "Movement" (play (forEach Piece)))} (end ("NoMovesLossAndNoPiecesPlayerLoss" P2)))) END
Construct a Ludii game based on the following description 8x8 board. The pieces move as follows, with the number per player: 1 x King (king): moves one space orthogonally or diagonally. The King may leap to the second or third square on its first move, or move as a Knight, and does not hop over an opponent's piece. The King also cannot capture with this move. 1 x Queen: One square diagonally. On its first move, the Queen may jump diagonally two squares. The Queen cannot capture when making this move. 2 x Rook: Any number of spaces orthogonally. 2 x Bishop: Two squares diagonally, jumping over the first. Cannot capture another Bishop. 2 x Knight: Moves one space orthogonally and then one space diagonally, jumping over any intervening pieces. 8 x Pawn: Moves one space forward orthogonally; one space forward diagonally to capture. May move two spaces on its first move. En passant is not allowed. Promoted to Queen when reaching the eighth rank, and may make the Queen's leap on its first move after being promoted. If this promotion is made with the opponent's King at the distance of the extended move, it does not give check on that turn. No castling. An opponent's piece is captured by moving a player's own piece onto a space occupied by the opponent's piece. When a King can be captured on the next turn by an opponent's piece, it is in check. The King must not be in check at the end of the player's turn. If this is not possible, it is checkmate and the opponent wins. Stalemate results in a draw. ###
(define "PieceHasMoved" (set State at:#1 0)) (define "RememberPieceHasMoved" (then (if (= (state at:(last To)) 1) ("PieceHasMoved" (last To))))) (game "Lombard Chess" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) (piece "King" Each (or ("StepToNotFriend") (if (= 1 (state at:(from))) (or (move Hop (between (range 1 2) if:(not ("IsEnemyAt" (between)))) (to if:(is Empty (to)))) ("LeapToEmpty" "KnightWalk"))) ("RememberPieceHasMoved"))) ("ChessRook" "Rook") (piece "Bishop" Each (move Hop Diagonal (between if:True) (to if:(not ("IsFriendAt" (to))) (apply (if ("IsEnemyAt" (to)) (remove (to))))))) ("ChessKnight" "Knight") (piece "Queen" Each (or ("StepToNotFriend" Diagonal "RememberPieceHasMoved") (if (= 1 (state at:(from))) (move Hop Diagonal (between if:True) (to if:(is Empty (to))))) ("RememberPieceHasMoved"))) ("ChessPawn" "Pawn" (if (is In (from) (sites Start (piece (what at:(from))))) ("DoubleStepForwardToEmpty")) (then (if (is In (last To) (sites Mover "Promotion")) (and (promote (last To) (piece (id "Queen" Mover))) (set State at:(last To) 1))))) (regions "Promotion" P1 (sites Top)) (regions "Promotion" P2 (sites Bottom))}) (rules (start { (place "Pawn1" (sites Row 1)) (place "Pawn2" (sites Row 6)) (place "Rook1" {"A1" "H1"}) (place "Knight1" {"B1" "G1"}) (place "Bishop1" {"C1" "F1"}) (place "Queen1" coord:"D1" state:1) (place "King1" coord:"E1" state:1) (place "Rook2" {"A8" "H8"}) (place "Knight2" {"B8" "G8"}) (place "Bishop2" {"C8" "F8"}) (place "Queen2" coord:"D8" state:1) (place "King2" coord:"E8" state:1)}) (play (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King" Mover)) (then (if (and (= 1 (state at:(where "King" Next))) ("IsInCheck" "King" Next)) ("PieceHasMoved" (where "King" Next)))))) (end { ("Checkmate" "King") ("DrawIfNoMoves" Next)}))) END
Construct a global Ludii definition which fulfills the following requirements. Defines a sequence of hop move in all the diagonal directions over an enemy to an empty site. ###
(define "HopDiagonalSequenceCapture" (move Hop Diagonal (between #1 #2 if:("IsEnemyAt" (between)) (apply (remove (between) #3))) (to if:(is Empty (to))) (then (if (can Move (hop (from (last To)) Diagonal (between #1 #2 if:(and (not (is In (between) (sites ToClear))) ("IsEnemyAt" (between)))) (to if:(is Empty (to))))) (moveAgain))))) END
Construct a global Ludii definition which fulfills the following requirements. Checks if a site is phase 0. ###
(define "IsPhaseZero" (= 0 (phase of:#1))) END
Construct a Ludii game based on the following description 2048 is played on a plain 4×4 grid, with numbered tiles that slide when a player moves them. Every turn, a new tile randomly appears in an empty spot on the board with a value of either 2 or 4. Tiles slide as far as possible in the chosen direction until they are stopped by either another tile or the edge of the grid. If two tiles of the same number collide while moving, they will merge into a tile with the total value of the two tiles that collided. The resulting tile cannot merge with another tile again in the same move. The game is won when a tile with a value of 2048 appears on the board. ###
(define "ApplySlideS" (seq { ("ApplySlideLine" Row 1 S) ("ApplySlideLine" Row 2 S) ("ApplySlideLine" Row 3 S) ("ResetState")})) (define "ApplySlideN" (seq { ("ApplySlideLine" Row 2 N) ("ApplySlideLine" Row 1 N) ("ApplySlideLine" Row 0 N) ("ResetState")})) (define "ApplySlideE" (seq { ("ApplySlideLine" Column 2 E) ("ApplySlideLine" Column 1 E) ("ApplySlideLine" Column 0 E) ("ResetState")})) (define "ApplySlideW" (seq { ("ApplySlideLine" Column 1 W) ("ApplySlideLine" Column 2 W) ("ApplySlideLine" Column 3 W) ("ResetState")})) (define "ResetState" (forEach Site (sites State 1) (set State at:(site) 0))) (define "ApplySlideLine" (forEach Site (sites #1 #2) (if (is Occupied (site)) (if (and (= (what at:(site)) (what at:("LineOfSightPiece" #3))) (= 0 (state at:("LineOfSightPiece" #3)))) (and { (remove (site)) (remove ("LineOfSightPiece" #3)) (add (piece (mapEntry "Promotion" (what at:(site)))) (to ("LineOfSightPiece" #3))) (set State at:("LineOfSightPiece" #3) 1) (addScore P1 (mapEntry "Score" (mapEntry "Promotion" (what at:(site)))))}) (if (!= 0 (count Sites in:("LineOfSightEmpty" #3))) (fromTo (from (site)) (to ("LineOfSightEmpty" #3)))))))) (define "LineOfSightEmpty" (sites LineOfSight Farthest at:(site) #1)) (define "LineOfSightPiece" (regionSite (sites LineOfSight Piece at:(site) #1) index:0)) (define "SlideS" (move Select (from 10) (to 6) (then #1))) (define "SlideN" (move Select (from 6) (to 10) (then #1))) (define "SlideE" (move Select (from 5) (to 6) (then #1))) (define "SlideW" (move Select (from 6) (to 5) (then #1))) (define "CanSlideS" ("CanSlide" Bottom S)) (define "CanSlideN" ("CanSlide" Top N)) (define "CanSlideE" ("CanSlide" Right E)) (define "CanSlideW" ("CanSlide" Left W)) (define "CanSlide" (not (all Sites (difference (sites Occupied by:Shared) (sites #1)) if:(and (= 0 (count Sites in:(sites LineOfSight Farthest at:(site) #2))) (!= (what at:(site)) (what at:(regionSite (sites LineOfSight Piece at:(site) #2) index:0))))))) (game "2048" (players 1) (equipment { (board (square 4)) (piece "Square2" Shared) (piece "Square4" Shared) (piece "Square8" Shared) (piece "Square16" Shared) (piece "Square32" Shared) (piece "Square64" Shared) (piece "Square128" Shared) (piece "Square256" Shared) (piece "Square512" Shared) (piece "Square1024" Shared) (piece "Square2048" Shared) (map "Promotion" { (pair (id "Square2" Shared) (id "Square4" Shared)) (pair (id "Square4" Shared) (id "Square8" Shared)) (pair (id "Square8" Shared) (id "Square16" Shared)) (pair (id "Square16" Shared) (id "Square32" Shared)) (pair (id "Square32" Shared) (id "Square64" Shared)) (pair (id "Square64" Shared) (id "Square128" Shared)) (pair (id "Square128" Shared) (id "Square256" Shared)) (pair (id "Square256" Shared) (id "Square512" Shared)) (pair (id "Square512" Shared) (id "Square1024" Shared)) (pair (id "Square1024" Shared) (id "Square2048" Shared))}) (map "Score" { (pair (id "Square2" Shared) 2) (pair (id "Square4" Shared) 4) (pair (id "Square8" Shared) 8) (pair (id "Square16" Shared) 16) (pair (id "Square32" Shared) 32) (pair (id "Square64" Shared) 64) (pair (id "Square128" Shared) 128) (pair (id "Square256" Shared) 256) (pair (id "Square512" Shared) 512) (pair (id "Square1024" Shared) 1024) (pair (id "Square2048" Shared) 2048)})}) (rules (start (place Random {"Square2"} count:2)) (play (or { (if ("CanSlideW") ("SlideW" ("ApplySlideW"))) (if ("CanSlideE") ("SlideE" ("ApplySlideE"))) (if ("CanSlideN") ("SlideN" ("ApplySlideN"))) (if ("CanSlideS") ("SlideS" ("ApplySlideS")))} (then (if (< (value Random (range 1 8)) 2) (add (piece "Square4") (to (sites Random (sites Empty) num:1))) (add (piece "Square2") (to (sites Random (sites Empty) num:1))))))) (end { (if ("IsNotOffBoard" (where "Square2048" Shared)) (result Mover Win)) (if (no Moves Next) (result Mover Loss))}))) END
Construct a Ludii game based on the following description 5x5 intersecting lines, with diagonals drawn in each quadrant. Ten pieces per player, which begin on the two rows closes to the player. Players alternate turns moving a piece to an empty adjacent spot along the lines. A piece may capture an opponent's piece by hopping over it along the lines of the board to an empty spot immediately on the opposite side of the opponent's piece. The player who captures all of the opponent's pieces wins. Each player has 10 pieces. ###
(game "Terhuchu (Small)" (players 2) (equipment { ("AlquerqueBoard" 5 5) (piece "Marker" Each (or ("StepToEmpty") ("HopCapture")))}) (rules (start { (place "Marker1" (expand (sites Bottom))) (place "Marker2" (expand (sites Top)))}) (play (forEach Piece)) (end ("CaptureAll" Next)))) END
Construct a Ludii game based on the following description A triangle, with a point in the center and lines connecting it to the apex and the midpoints of the two sides which meet at the apex. One person plays as the tiger, which begins on the apex. The other person plays as three people. Players alternate turns, with the person playing as the people first placing a person on the board, and then the tiger moving to an empty adjacent spot along the lines of the board. When all of the people have been placed, the people move on the board in the same fashion. The tiger may capture one of the people by jumping over it to an empty adjacent spot immediately on the opposite side of one of the people along the lines of the board. The tiger wins when it captures one person, the people win when they can block the tiger from being able to move. ###
(game "Mysore Tiger Game" (players 2) (equipment { (board (add (remove (scale 1 2 (wedge 3)) vertices:{5}) edges:{{4 5}}) use:Vertex) (hand P1) (piece "Human" P1 ("StepToEmpty")) (piece "Tiger" P2 (or ("StepToEmpty") ("HopCapture")))}) (rules (start { (place "Human1" (handSite P1) count:3) (place "Tiger2" (sites Top))}) phases:{ (phase "Opening" P1 (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) ("PhaseMovePiece" "Movement")} (end { (if (no Moves P2) (result P1 Win)) (if (< (count Pieces P1) 3) (result P2 Win))}))) END
Construct a Ludii game based on the following description 4x8 board. 32 counters per player. Players may arrange the counters however they like in their holes. Players sow by taking the counters from one of their holes and dropping them one by one in an anti-clockwise direction only in the two rows closest to them. When the last counter lands in an empty hole, the turn is over. When the last counter falls into an occupied hole, the contents of this hole are picked up and sowing continues. If the final counter falls into an occupied hole in the inner row, and the two holes opposite it in the opponent's rows are occupied, the counters in these two rows of the opponent are taken. They are then sown on the player's side of the board beginning from the hole that received the first counter of the sowing that led to the capture. Both of the opponent's holes must be occupied to capture. Clockwise sowing is allowed in certain circumstances. If a clockwise move from the four holes on the left hand side of the players board (i.e., the left two holes in the outer row or the left two hole in the inner row) can lead to a capture, a clockwise move is allowed. Sowing cannot occur with single counters. The player who can no longer move loses. ###
(define "NextHole" ("NextSiteOnTrack" #3 from:#1 #2)) (define "Columns" 8) (game "Mweso" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "TrackCCW1" "0,E,N1,W" loop:True P1) (track "TrackCCW2" "16,E,N1,W" loop:True P2) (track "TrackCW1" "7,W,N1,E" loop:True P1) (track "TrackCW2" "24,E,S1,W" loop:True P2)}) (piece "Seed" Shared) (regions "Home" P1 (sites Track "TrackCCW1")) (regions "Home" P2 (sites Track "TrackCCW2")) (regions "Inner" P1 (difference (sites Track "TrackCCW1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "TrackCCW2") (sites Top))) (regions "Left" P1 (intersection (sites Track "TrackCCW1") (expand (sites Left)))) (regions "Left" P2 (intersection (sites Track "TrackCCW2") (expand (sites Right)))) (hand Each)}) (rules (start { (set Count 32 at:(handSite P1)) (set Count 32 at:(handSite P2))}) phases:{ (phase "Placing" (play (move (from (handSite Mover)) (to (sites Mover "Home")) count:1)) (nextPhase Mover (is Empty (handSite Mover)) "Sowing")) (phase "Sowing" (play (or { (if (!= 2 (var "Direction")) (move Select (from (if ("SameTurn") (sites {(var "Replay")}) (sites Mover "Home")) if:(< 1 (count at:(from)))) (then (sow "TrackCCW" owner:(mover) apply:(if (< 1 (count at:(to))) (and { (set Var "Direction" 1) (moveAgain) (set Var "Replay" (to)) (if (is In (to) (sites Mover "Inner")) (if (and (is Occupied ("OppositePit" (to))) (is Occupied ("OppositeOuterPit" (to)))) (and { (fromTo (from ("OppositePit" (to))) (to (last From)) count:(count at:("OppositePit" (to)))) (fromTo (from ("OppositeOuterPit" (to))) (to (last From)) count:(count at:("OppositeOuterPit" (to)))) (sow (last From) count:(+ (count at:("OppositePit" (to))) (count at:("OppositeOuterPit" (to)))) "TrackCCW" owner:(mover))})))}) (set Var "Direction" 0)))))) (if (!= 1 (var "Direction")) (move Select (from (if ("SameTurn") (sites {(var "Replay")}) (sites Mover "Left")) if:(and (< 1 (count at:(from))) (if ("SameTurn") True (if (is In ("NextHole" (from) "TrackCW" (count at:(from))) (sites Mover "Inner")) (and (is Occupied ("OppositePit" ("NextHole" (from) "TrackCW" (count at:(from))))) (is Occupied ("OppositeOuterPit" ("NextHole" (from) "TrackCW" (count at:(from)))))) False)))) (then (sow "TrackCW" owner:(mover) apply:(if (< 1 (count at:(to))) (and { (set Var "Direction" 2) (moveAgain) (set Var "Replay" (to)) (if (is In (to) (sites Mover "Inner")) (if (and (is Occupied ("OppositePit" (to))) (is Occupied ("OppositeOuterPit" (to)))) (and { (fromTo (from ("OppositePit" (to))) (to (last From)) count:(count at:("OppositePit" (to)))) (fromTo (from ("OppositeOuterPit" (to))) (to (last From)) count:(count at:("OppositeOuterPit" (to)))) (sow (last From) count:(+ (count at:("OppositePit" (to))) (count at:("OppositeOuterPit" (to)))) "TrackCCW" owner:(mover))})))}) (set Var "Direction" 0))))))})) (end (if (and (not (is Next Mover)) (no Moves Next)) (result Mover Win))))})) END
Construct a Ludii game based on the following description Ciri Amber can be played on any undirected and weighted graph. Initially, all the edges have the same colour. Each turn, a player removes a coloured edge and gets a score equals to the cost of that edge. The game is over when the graph becomes regular. The game is won by the player with the highest score. The version of the game played with 2 players. ###
(game "Ciri Amber" (players 2) (equipment { (board (complete (regular Star 7)) use:Edge) (piece "Marker" Neutral)}) (rules (start { (set Neutral Edge (sites Board Edge)) (set Cost 1 Edge at:0) (set Cost 2 Edge at:1) (set Cost 3 Edge at:2) (set Cost 1 Edge at:3) (set Cost 2 Edge at:4) (set Cost 3 Edge at:5) (set Cost 1 Edge at:6) (set Cost 2 Edge at:7) (set Cost 3 Edge at:8) (set Cost 3 Edge at:9) (set Cost 1 Edge at:10) (set Cost 2 Edge at:11) (set Cost 3 Edge at:12) (set Cost 1 Edge at:13) (set Cost 2 Edge at:14) (set Cost 3 Edge at:15) (set Cost 1 Edge at:16) (set Cost 2 Edge at:17) (set Cost 3 Edge at:18) (set Cost 3 Edge at:19) (set Cost 1 Edge at:20)}) (play (move Remove (sites Occupied by:Neutral) (then (addScore Mover (cost Edge at:(last To)))))) (end (if (is RegularGraph Neutral) (byScore))))) END
Modify the Ludii game according to the following option changes: The version of the game played with 3 players. -> The version of the game played with 4 players. (game "Radran" (players 3) (equipment { (board (graph vertices:{{0 0} {5 0} {10 0} {0 5} {5 5} {10 5} {0 10} {5 10} {10 10}} edges:{{0 1} {0 2} {0 3} {0 4} {0 5} {0 6} {0 7} {1 2} {1 3} {1 4} {1 5} {1 6} {1 8} {2 3} {2 4} {2 5} {2 7} {2 8} {3 4} {3 6} {3 7} {3 8} {4 5} {4 6} {4 7} {4 8} {5 6} {5 8} {5 7} {6 7} {6 8} {7 8}}) use:Edge) (piece "Marker" Neutral)}) (rules (start { (set Cost 1 Edge at:0) (set Cost 2 Edge at:1) (set Cost 3 Edge at:2) (set Cost 1 Edge at:3) (set Cost 2 Edge at:4) (set Cost 3 Edge at:5) (set Cost 1 Edge at:6) (set Cost 2 Edge at:7) (set Cost 3 Edge at:8) (set Cost 3 Edge at:9) (set Cost 1 Edge at:10) (set Cost 2 Edge at:11) (set Cost 3 Edge at:12) (set Cost 1 Edge at:13) (set Cost 2 Edge at:14) (set Cost 3 Edge at:15) (set Cost 1 Edge at:16) (set Cost 2 Edge at:17) (set Cost 3 Edge at:18) (set Cost 3 Edge at:19) (set Cost 1 Edge at:20) (set Cost 2 Edge at:21) (set Cost 3 Edge at:22) (set Cost 1 Edge at:23) (set Cost 2 Edge at:24) (set Cost 3 Edge at:25) (set Cost 1 Edge at:26) (set Cost 2 Edge at:27) (set Cost 3 Edge at:28) (set Cost 3 Edge at:29) (set Cost 1 Edge at:30) (set Cost 2 Edge at:31)}) (play (move Add (piece "Marker0") (to Edge (sites Empty Edge)) (then (addScore Mover (cost Edge at:(last To)))))) (end (if (is RegularGraph Neutral) (byScore))))) ###
(game "Radran" (players 4) (equipment { (board (graph vertices:{{0 0} {5 0} {10 0} {0 5} {5 5} {10 5} {0 10} {5 10} {10 10}} edges:{{0 1} {0 2} {0 3} {0 4} {0 5} {0 6} {0 7} {1 2} {1 3} {1 4} {1 5} {1 6} {1 8} {2 3} {2 4} {2 5} {2 7} {2 8} {3 4} {3 6} {3 7} {3 8} {4 5} {4 6} {4 7} {4 8} {5 6} {5 8} {5 7} {6 7} {6 8} {7 8}}) use:Edge) (piece "Marker" Neutral)}) (rules (start { (set Cost 1 Edge at:0) (set Cost 2 Edge at:1) (set Cost 3 Edge at:2) (set Cost 1 Edge at:3) (set Cost 2 Edge at:4) (set Cost 3 Edge at:5) (set Cost 1 Edge at:6) (set Cost 2 Edge at:7) (set Cost 3 Edge at:8) (set Cost 3 Edge at:9) (set Cost 1 Edge at:10) (set Cost 2 Edge at:11) (set Cost 3 Edge at:12) (set Cost 1 Edge at:13) (set Cost 2 Edge at:14) (set Cost 3 Edge at:15) (set Cost 1 Edge at:16) (set Cost 2 Edge at:17) (set Cost 3 Edge at:18) (set Cost 3 Edge at:19) (set Cost 1 Edge at:20) (set Cost 2 Edge at:21) (set Cost 3 Edge at:22) (set Cost 1 Edge at:23) (set Cost 2 Edge at:24) (set Cost 3 Edge at:25) (set Cost 1 Edge at:26) (set Cost 2 Edge at:27) (set Cost 3 Edge at:28) (set Cost 3 Edge at:29) (set Cost 1 Edge at:30) (set Cost 2 Edge at:31)}) (play (move Add (piece "Marker0") (to Edge (sites Empty Edge)) (then (addScore Mover (cost Edge at:(last To)))))) (end (if (is RegularGraph Neutral) (byScore))))) END
Construct a Ludii game based on the following description 9x9 intersecting lines. Forty pieces per player. Players alternate turns placing a piece on an empty space on the board. When all of the pieces are placed, players alternate turns moving a piece to an empty adjacent spot on the board. When a player places three of their pieces in an orthogonal or diagonal line, they remove one of the opponent's pieces. Players also remove one of the opponent's pieces when they place four pieces so that they are one the four corners of one of the squares on the board. Pieces which are in these patterns cannot be removed from the board. The player who removes all of the opponent's pieces wins. ###
(define "IfLine3OrSquareMoveAgain" (then (if (or (is Line 3 All) ("SquarePattern")) (moveAgain)))) (define "RemoveEnemyPieceNotInLine3AndNotInSquare" (move Remove (forEach (sites Occupied by:Next container:"Board") if:(and (not (is Line 3 All through:(site))) (not ("SquarePattern" from:(site))))))) (define "SquarePattern" (is Pattern {F R F R F R F} #1)) (game "Xanan Zirge" (players 2) (equipment { (board (square 9) use:Vertex) (hand Each) (piece "Marker" Each ("StepToEmpty" ~ "IfLine3OrSquareMoveAgain"))}) (rules (start (place "Marker" "Hand" count:40)) phases:{ (phase "Placement" (play (if "SameTurn" "RemoveEnemyPieceNotInLine3AndNotInSquare" (move (from (handSite Mover)) (to (sites Empty)) "IfLine3OrSquareMoveAgain"))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) (phase "Movement" (play (if "SameTurn" "RemoveEnemyPieceNotInLine3AndNotInSquare" (forEach Piece))))} (end ("CaptureAll" Next)))) END
Construct a Ludii game based on the following description 5x5 board. Players begin by placing their pieces two-by-two in places as they see fit, except for the central space. Once all the spaces except the central one are filled, the player who placed their pieces last moves a piece one space orthogonally to the empty space. Pieces are captured by surrounding them on either side by a player's own pieces. Multiple captures are allowed, and multiple pieces can be captured in a single move. A player may move their piece between two of the opponent's pieces without it resulting in a capture. Pieces in the central spot cannot be captured. If a player cannot move, the opponent must move so that the player can move on their next turn. The player to capture all of the opponent's pieces wins. ###
(define "Custodial" (custodial #1 Orthogonal (between (max 1) if:"EnemyOutsideCentre" #2) (to if:("IsFriendAt" (to))))) (define "CaptureAndMoveAgain" (apply (and (remove (between)) (if "FlankFromOrthogonalStep" (moveAgain) (if (no Moves Next) (and (set Pending) (moveAgain))))))) (define "FlankFromOrthogonalStep" (or { (can Move ("Custodial" (from (ahead (last To) N)))) (can Move ("Custodial" (from (ahead (last To) E)))) (can Move ("Custodial" (from (ahead (last To) W)))) (can Move ("Custodial" (from (ahead (last To) S))))})) (define "EnemyOutsideCentre" (and ("IsEnemyAt" (between)) (!= (centrePoint) (between)))) (game "Shantarad" (players 2) (equipment { (board (square 5)) (hand Each) (piece "Marker" Each ("StepToEmpty" Orthogonal (then ("Custodial" (from (last To)) "CaptureAndMoveAgain"))))}) (rules (start (place "Marker" "Hand" count:12)) phases:{ (phase "Placement" (play (if (= (count Moves) 24) (forEach Piece) (move (from (handSite Mover)) (to (difference (sites Empty) (centrePoint))) (then (if (or (= (count Moves) 24) ("NewTurn")) (moveAgain)))))) (nextPhase (= (count Moves) 25) "Movement")) (phase "Movement" (play (if "SameTurn" (move Step (from (last To)) Orthogonal (to if:(and (is Empty (to)) (or { (and ("IsEnemyAt" (ahead (to) W)) ("IsFriendAt" (ahead (ahead (to) W) W))) (and ("IsEnemyAt" (ahead (to) E)) ("IsFriendAt" (ahead (ahead (to) E) E))) (and ("IsEnemyAt" (ahead (to) N)) ("IsFriendAt" (ahead (ahead (to) N) N))) (and ("IsEnemyAt" (ahead (to) S)) ("IsFriendAt" (ahead (ahead (to) S) S)))}))) (then ("Custodial" (from (last To)) "CaptureAndMoveAgain"))) (do (forEach Piece) ifAfterwards:(not (no Moves Next))))))} (end ("CaptureAll" Next)))) END
Construct a Ludii game based on the following description Played on an 8x8 board with pieces with specialized moves. The pieces are as follows, and placed on the outer rank in the following order, starting from the left corner and moving in, with the placement mirrored on the right side (the Mantri is placed to the right of the Rajah): Tor (2): can move any number of spaces orthogonally; Kudah (2): moves in any direction, one space orthogonally with one space forward diagonally, jumping over any intervening pieces; Gajah (2): can move any number of spaces diagonally; Rajah (1): can move one space orthogonally or diagonally; Mantri (1): can move any number of spaces orthogonally or diagonally; Bidah (8), placed in front of the other pieces: can move one space forward, or one space diagonally to capture. A Bidah may move two squares on its first move. Bidahs may capture en passant only when it is blocked from moving forward by another of the opponent's Bidahs; the blocked Bidah has the option in this scenario of capturing with an en passant move, with the option of capturing either of the two Bidahs in question. The Rajah, for its first move may move like a Kudah as long as it has never been checked. Players capture pieces by moving onto a space occupied by an opponent's piece. Castling occurs by moving the Rajah to the left or the right two squares, regardless of any intervening pieces; the Tor is not moved as part of this move. Promotion of Bidahs occur when they reach the opposite edge of the board, but only immediately if they reach the Tor's square. If it captures on the square next to the Tor's square, from the square in front of the Tor's square, it must move backward diagonally to the square in front of the Tor's square on a subsequent turn and continue before promotion. A Bidah reaching the Kudah's square must move backward diagonally once, to the right or left, before being promoted; a Bidah reaching the Gajah's square must move backward diagonally right or left two spaces, and a Bidah reaching the Raja or Mantri's square must move backward diagonally three squares before being promoted. Bidah's can be promoted to whatever piece the player wishes. If the Rajah can be captured on the opponent's next turn, it is in check. The Rajah must not be in check at the end of the player's turn. If this is impossible, it is checkmate and the opponent wins. If a player is reduced to only their Rajah, it can make the move of any piece. ###
(define "EnPassant" (move Step (directions {FR FL}) (to if:(and ("InLocationEnPassant") (= (id "Pawn" Next) (what at:(ahead (from) Forward))))) (then (remove (ahead (last To) Backward))))) (define "InLocationEnPassant" (and (is Pending) (= (to) (value Pending)))) (define "SetEnPassantLocation" (then (set Pending (ahead (last To) Backward)))) (define "RememberPieceHasMoved" (then (if (= (state at:(last To)) 1) ("PieceHasMoved" (last To))))) (define "PieceHasMoved" (set State at:#1 0)) (define "HasNeverMoved" (= (state at:#1) 1)) (game "Main Chator (Selangor)" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) (piece "Pawn" Each (if (= 0 (state at:(from))) (or { (if (is In (from) (sites Start (piece (what at:(from))))) ("DoubleStepForwardToEmpty" "SetEnPassantLocation")) "StepForwardToEmpty" ("StepToEnemy" (directions {FR FL})) "EnPassant" (move Step (directions {FR FL}) (to if:(and ("InLocationEnPassant") (= (id "Pawn" Next) (what at:(ahead (from) Forward))))) (then (remove (ahead (last From) (if (is Mover P1) N S)))))} (then (if (is In (last To) (sites Mover "Promotion")) (if (is In (last To) (sites Corners)) (moveAgain) (if (is In (last To) (intersection (sites Mover "Promotion") (expand (sites Corners)))) (set State at:(last To) 1) (if (is In (last To) (intersection (sites Mover "Promotion") (expand (sites Corners) steps:2))) (set State at:(last To) 2) (set State at:(last To) 3))))))) ("StepToEmpty" (directions {BR BL}) (then (and (if (= 1 (state at:(last To))) (moveAgain)) (set State at:(last To) (- (state at:(last To)) 1))))))) ("ChessRook" "Rook") (piece "King_noCross" Each (if (= (count Pieces Mover) 1) (or ("LeapCapture" "KnightWalk") ("SlideCapture")) (or { ("StepToNotFriend") (if (and ("HasNeverMoved" (from)) (!= (value Player Mover) (mover))) ("LeapToEmpty" "KnightWalk" (then (set Value Mover (mover))))) (if ("HasNeverMoved" (from)) (move Hop (directions {E W}) (between if:True) (to if:(is Empty (to)))))} "RememberPieceHasMoved"))) ("ChessBishop" "Elephant") ("ChessKnight" "Knight") ("ChessQueen" "Ferz_noCross") (regions "Promotion" P1 (sites Top)) (regions "Promotion" P2 (sites Bottom))}) (rules (start { (place "Pawn1" (sites Row 1)) (place "Pawn2" (sites Row 6)) (place "Rook1" {"A1" "H1"}) (place "Knight1" {"B1" "G1"}) (place "Elephant1" {"C1" "F1"}) (place "King_noCross1" coord:"D1" state:1) (place "Ferz_noCross1" coord:"E1") (place "Rook2" {"A8" "H8"}) (place "Knight2" {"B8" "G8"}) (place "Elephant2" {"C8" "F8"}) (place "King_noCross2" coord:"E8" state:1) (place "Ferz_noCross2" coord:"D8")}) (play (if "SameTurn" (move Promote (last To) (piece {"Knight" "Elephant" "Rook" "Ferz_noCross"}) Mover) (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King_noCross" Mover)) (then (if (!= (next) (value Player Next)) (if ("IsInCheck" "King_noCross" Next) (set Value Next (next)))))))) (end { ("Checkmate" "King_noCross") ("MisereBlockWin") (if (= (count Pieces Next) 1) (result Mover Win))}))) END
Construct a Ludii game based on the following description Players alternate their turns using one piece to either move or capture exclusively per turn. Pieces may only move one space per turn either straight forward, diagonally forward, or sideways along a line onto a vacant adjacent intersection point. They cannot move backwards in any direction until they are promoted to Kings. However, pieces can make capturing moves backward. Captures are compulsory. Captured pieces are removed from the board. For pieces that have not yet been promoted to King, their captures are done by the short leap as in draughts and Alquerque. A piece leaps over an adjacent enemy piece onto a vacant adjacent intersection point on the other side. The leap must be in a straight line following the pattern on the board. Even pieces that are not yet promoted to King can capture enemy pieces backwards. A player's piece must continue to capture within a turn provided each capture meets the criteria of the short leap. A piece is promoted to King when it reaches the other player's first rank. Kings can move any number of unoccupied spaces in any available direction following the pattern of the board like the King in international draughts. Kings can leap over an enemy piece (and only one enemy piece per leap) from any distance and land any distance behind it onto a vacant intersection point as in the King in international draughts. The King must continue to capture within the turn if it is able to do so. The player who captures all of their opponent's pieces is the winner. ###
(define "HopSequenceCapture" (move Hop Adjacent (between #1 #2 if:("IsEnemyAt" (between)) (apply (remove (between) #3))) (to if:(is Empty (to))) (then (if (can Move (hop (from (last To)) Adjacent (between #1 #2 if:(and (not (is In (between) (sites ToClear))) ("IsEnemyAt" (between)))) (to if:(is Empty (to))))) (moveAgain))))) (define "HopSequenceCaptureAgain" (move Hop (from (last To)) Adjacent (between #1 #2 if:(and (not (is In (between) (sites ToClear))) ("IsEnemyAt" (between))) (apply (remove (between) #3))) (to if:(is Empty (to))) (then (if (can Move (hop (from (last To)) Adjacent (between #1 #2 if:(and (not (is In (between) (sites ToClear))) ("IsEnemyAt" (between)))) (to if:(is Empty (to))))) (moveAgain))))) (define "HopStyle" (move Hop #1 #2 (between if:(and (not (is In (between) (sites ToClear))) ("IsEnemyAt" (between))) (apply (remove (between)))) (to if:(is Empty (to))) #3)) (define "IsUnpromoted" ("IsPieceAt" "Counter" Mover (last To))) (game "Permainan-Tabal" ("TwoPlayersNorthSouth") (equipment { ("AlquerqueBoardWithBottomAndTopTriangles") (piece "Counter" P1 N) (piece "Counter" P2 S) (piece "DoubleCounter" Each) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start { (place "Counter1" (difference (expand (sites Bottom) steps:4) (sites Row 4))) (place "Counter2" (difference (expand (sites Top) steps:4) (sites Row 4)))}) (play (if "SameTurn" (if "IsUnpromoted" ("HopStyle" (from (last To)) Adjacent (then ("ReplayIfCanMove" ("HopStyle" (from (last To)) Adjacent) ("PromoteIfReach" (sites Next) "DoubleCounter")))) ("HopSequenceCaptureAgain" before:(count Rows) after:(count Rows))) (priority { (or (forEach Piece "Counter" ("HopStyle" (from) Adjacent (then ("ReplayIfCanMove" ("HopStyle" (from (last To)) Adjacent) ("PromoteIfReach" (sites Next) "DoubleCounter"))))) (forEach Piece "DoubleCounter" ("HopSequenceCapture" before:(count Rows) after:(count Rows)))) (or (forEach Piece "Counter" ("StepToEmpty" (directions {Forwards Rightward Leftward})) (then ("PromoteIfReach" (sites Next) "DoubleCounter"))) (forEach Piece "DoubleCounter" (move Slide Adjacent)))}))) (end ("BlockWin")))) END
Construct a Ludii game based on the following description Two rows of seven holes. Twelve counters in each hole, except in the central hole of each row, one of which has one counter and the other is empty. Players do not own a row of holes, rather each player owns the six holes on one side of the central holes. Sowing occurs in an anti-clockwise direction. Neither player may begin sowing from the central holes. When sowing ends, if the next hole after the hole in which the final counter was placed is occupied, these counters are picked up and sown. If this hole is empty, the counters in the hole opposite it are captured. Play continues until all of the counters have been captured. The player who captures the most pieces wins. ###
(define "LastHolePlayed" (last To afterConsequence:True)) (define "NextHole" ("NextSiteOnTrack" 1 from:#1)) (define "NumPiecesOnBoard" (count in:(sites Track))) (define "PiecesOwnedBy" (count Cell at:(handSite #1))) (define "Columns" 7) (game "Kanji Guti" (players 2) (equipment { (mancalaBoard 2 "Columns" store:None (track "Track" "0,E,N,W" loop:True)) (piece "Seed" Shared) (hand Each) (regions "Home" P1 (expand (sites Left) steps:2)) (regions "Home" P2 (expand (sites Right) steps:2))}) (rules (start { (set Count 1 at:(coord "D1")) (set Count 12 to:(difference (sites Track) (sites Centre)))}) (play (move Select (from (if ("SameTurn") (sites {("NextHole" "LastHolePlayed")}) (sites Mover)) if:(< 0 (count at:(from)))) (then (sow apply:(if (> (count at:("NextHole" (to))) 0) (moveAgain) (if (> (count at:("OppositePitTwoRows" ("NextHole" (to)))) 0) (fromTo (from ("OppositePitTwoRows" ("NextHole" (to)))) (to (handSite Mover)) count:(count at:("OppositePitTwoRows" ("NextHole" (to))))))))))) (end ("MancalaByScoreWhen" (= 0 ("NumPiecesOnBoard")))))) END
Construct a Ludii game based on the following description 5x5 intersecting lines, with the diagonals of every 2x2 square formed. On one side, a diamond intersects with the central point of that side, with diagonals drawn in the diamond. One player plays as the monk, placed at the intersection of the diamond and the main board. The other player plays as fifteen water pieces, placed on each point along the perimeter of the main board. Players take turns moving their pieces to one adjacent point following the lines on the board. The monk may capture two water pieces by moving to an empty space between two water pieces. The goal of the water pieces is to trap the monk on the far point of the diamond. The monk wins by capturing all of the water. ###
(game "Shui Yen Ho-Shang" (players 2) (equipment { (board (merge (rotate 45 (shift 1.5 4.2 (square 2 diagonals:Solid))) (square 5 diagonals:Alternating)) use:Vertex) (piece "Marker" P1 "StepToEmpty") (piece "Marker" P2 (move Step (to if:(is Empty (to))) (then ("InterveneCapture"))))}) (rules (start { (place "Marker2" coord:"C5") (place "Marker1" (difference (sites Outer) (sites {"B6" "C7" "D6"})))}) (play (forEach Piece)) (end { (if (no Pieces P1) (result P2 Win)) (if (and (no Moves P2) (is In (where "Marker" P2) (sites {"C7"}))) (result P1 Win))}))) END
Describe the mechanics of the following Ludii game (define "NextNoPieceInRegion" (all Sites (sites Occupied by:Next) if:(not (is In (site) #1)))) (define "AgressiveMoves" (forEach Piece (if (is In (from) ("AgressiveRegion")) (or (move Slide ("LastDirection" Cell) (between (exact "LastDistance") if:(is Empty (between))) (to if:(or (is Empty (to)) (and ("IsEnemyAt" (to)) (or (is Empty (ahead (to) ("LastDirection" Cell))) (= (ahead (to) ("LastDirection" Cell)) (to))))) (apply (if ("IsEnemyAt" (to)) (if (= (ahead (to) ("LastDirection" Cell)) (to)) (remove (to)) (fromTo (from (to)) (to (ahead (to) ("LastDirection" Cell))))))))) (if (and { (= ("LastDistance") 2) ("IsEnemyAt" (ahead (from) ("LastDirection" Cell))) (is Empty (ahead (from) steps:2 ("LastDirection" Cell))) (if (= (from) (ahead (from) steps:3 ("LastDirection" Cell))) True (is Empty (ahead (from) steps:3 ("LastDirection" Cell))))}) (move (from (from)) (to (ahead (from) steps:2 ("LastDirection" Cell))) (then (if (= (ahead (last To) ("LastDirection" Cell)) (last To)) (remove (ahead (last From) ("LastDirection" Cell))) (fromTo (from (ahead (last From) ("LastDirection" Cell))) (to (ahead (last To) ("LastDirection" Cell)))))))))))) (define "AgressiveRegion" (if (is In (last To) (sites "Dark")) (sites "Light") (sites "Dark"))) (game "Shobu" (players 2) (equipment { (board (merge { (square 4) (shift 5 0 (square 4)) (shift 0 5 (square 4)) (shift 5 5 (square 4))})) (piece "Ball" Each) (regions "BottomDark" (expand origin:(coord "A1") steps:3)) (regions "TopDark" (expand origin:(coord "A5") steps:3)) (regions "BottomLight" (expand origin:(coord "E1") steps:3)) (regions "TopLight" (expand origin:(coord "E5") steps:3)) (regions "Home" P1 (union (sites "BottomDark") (sites "BottomLight"))) (regions "Home" P2 (union (sites "TopLight") (sites "TopDark"))) (regions "Light" (expand (sites Right) steps:3)) (regions "Dark" (expand (sites Left) steps:3))}) (rules (start { (place "Ball1" (union (sites Bottom) (sites Row 4))) (place "Ball2" (union (sites Top) (sites Row 3)))}) phases:{ (phase "Passive" (play (do (forEach Piece (if (is In (from) (sites Mover "Home")) (move Slide (between (max 2) if:(is Empty (between))))) (then (moveAgain))) ifAfterwards:(can Move ("AgressiveMoves")))) (nextPhase Mover "Aggressive")) (phase "Aggressive" (play ("AgressiveMoves")) (nextPhase Mover "Passive"))} (end (if (or { ("NextNoPieceInRegion" (sites "BottomDark")) ("NextNoPieceInRegion" (sites "TopDark")) ("NextNoPieceInRegion" (sites "BottomLight")) ("NextNoPieceInRegion" (sites "TopLight"))}) (result Mover Win))))) ###
Your turn is in two parts. First, a player may move one of their stones up to two spaces in any direction, including diagonally, in what is called a passive (or set up) move. Second, they take a more aggressive move, which must be the same direction and number of spaces as the first move. It is this second move that allows you to push stones across the board - or off the board's edge. A passive move can be done only if it can be followed by an aggressive move. Remove all four of your opponent's stones from just one of the four boards to win. END
Modify the Ludii game according to the following option changes: The game is played on a 7x7 board. -> The game is played on a 9x9 board. (game "Seega" (players 2) (equipment { (board (square 7)) (hand Each) (piece "Marker" Each ("StepToEmpty" Orthogonal (then ("CustodialCapture" Orthogonal (max 1)))))}) (rules (start (place "Marker" "Hand" count:24)) phases:{ (phase "Placement" (play (move (from (handSite Mover)) (to (difference (sites Empty) (centrePoint))) (then (if ("NewTurn") (moveAgain))))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) ("PhaseMovePiece" "Movement")} (end ("CaptureAll" Next)))) ###
(game "Seega" (players 2) (equipment { (board (square 9)) (hand Each) (piece "Marker" Each ("StepToEmpty" Orthogonal (then ("CustodialCapture" Orthogonal (max 1)))))}) (rules (start (place "Marker" "Hand" count:40)) phases:{ (phase "Placement" (play (move (from (handSite Mover)) (to (difference (sites Empty) (centrePoint))) (then (if ("NewTurn") (moveAgain))))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) ("PhaseMovePiece" "Movement")} (end ("CaptureAll" Next)))) END
Construct a Ludii game based on the following description Four 3x8 rectangles, arranged in a cross. The third square in the outer rows of each arm, counting from the outer corners, are marked. Four players, each with four pieces. Pieces enter the board from the center of the board, down the central row of the player's arm, around the board in an anti-clockwise direction, and then back up the central row to the central space. Six cowries used as dice, the throws are as follows: one mouth up = 10; two mouths up = 2; three mouths up = 3; four mouths up = 4; five mouths up = 25; six mouths up = 12; zero mouths up = 6. Throws of 10 and 25 allow a player to enter a piece onto the board. When a piece lands on a space occupied by an opponent's piece, the opponent's piece is sent back to start. Pieces on the same spot as another piece belonging to the player and pieces on marked squares are safe from being sent to start. The player who moves all of their pieces off the board first wins. ###
(define "IsSpecialThrow" (is In ("ThrowValue") (array {10 25}))) (define "EnterAPiece" (move (from (handSite Mover)) (to (centrePoint) if:(not ("IsFriendAt" (to))) ("HittingCapture" (handSite (who at:(to))))))) (define "ThrowValue" (mapEntry "Throw" (count Pips))) (game "Barjis" (players 4) (equipment { ("PachisiBoard" { (track "Track1" "96,9,S,E1,N,11,E,N,W,53,N,W,S,42,W,S,E,8,S,E1,N8" P1 directed:True) (track "Track2" "96,26,W,S,E,8,S,E,N,11,E,N,W,53,N,W,S,42,W,S1,E8" P2 directed:True) (track "Track3" "96,52,N,W,S,42,W,S,E,8,S,E,N,11,E,N,W,53,N,W1,S8" P3 directed:True) (track "Track4" "96,27,E,N,W,53,N,W,S,42,W,S,E,8,S,E,N,11,E,N1,W8" P4 directed:True)}) (hand Each) ("StickDice" 6) (piece "Pawn" Each (if ("IsOffBoard" ("NextSiteOnTrack" ("ThrowValue"))) (move Remove (from)) (move (from (from)) (to ("NextSiteOnTrack" ("ThrowValue")) if:(or (is Empty (to)) (and ("IsEnemyAt" (to)) (not (is In (to) (sites "SafeSites"))))) ("HittingCapture" (handSite (who at:(to)))))))) (map "Throw" {(pair 0 6) (pair 1 10) (pair 2 2) (pair 3 3) (pair 4 4) (pair 5 25) (pair 6 12)}) (regions "SafeSites" (sites {60 62 16 48 87 89 37 2}))}) (rules (start (place "Pawn" "Hand" count:4)) (play ("RollMove" (or (forEach Piece) (if (and ("IsSpecialThrow") (is Occupied (handSite Mover))) ("EnterAPiece"))))) (end ("EscapeWin")))) END
Describe the mechanics of the following Ludii game (define "ConnectedEdges" (!= 0 (count Sites in:(forEach (sites Occupied by:#1) if:(is Connected at:(site) Orthogonal #1))))) (game "Kanguruh" (players 2) (equipment { (board (square 8)) (piece "Kangaroo" Each (move Hop (between if:(is Occupied (between))) (to if:(is Empty (to)) (apply (and { (if ("IsEnemyAt" (between)) (remove (between))) (remember Value (from)) (remember Value (to))}))) (then ("ReplayIfCanMove" (hop (from (last To)) (between if:(is Occupied (between))) (to if:(and (is Empty (to)) (not (is In (to) (values Remembered)))))) (forget Value All)))))}) (rules (start { (place "Kangaroo1" (expand (sites Bottom))) (place "Kangaroo2" (expand (sites Top)))}) (play (if ("SameTurn") (or (move Pass (then (forget Value All))) (move Hop (from (last To)) (between if:(is Occupied (between))) (to if:(and (is Empty (to)) (not (is In (to) (values Remembered)))) (apply (and (if ("IsEnemyAt" (between)) (remove (between))) (remember Value (to))))) (then ("ReplayIfCanMove" (hop (from (last To)) (between if:(is Occupied (between))) (to if:(and (is Empty (to)) (not (is In (to) (values Remembered)))))) (forget Value All))))) (forEach Piece))) (end (if (no Moves Next) (byScore { (score P1 (count Pieces P1)) (score P2 (count Pieces P2))}))))) ###
TURNS - At each turn, each player must move one of his stones (called Kangaroos): - A stone must jump over one (orthogonal or diagonal) adjacent stone landing on the immediate next empty cell. - If the jumped enemy stones are captured and removed from the board. - Jumps can be multiple but are not mandatory. GOAL - The game ends when one player cannot move. The winner is the one with more stones. END
Describe the mechanics of the following Ludii game (define "StepMove" ("StepToEmpty" (directions { Forward Leftward Rightward}))) (game "Dodgem" (players 2) (equipment { (board (square 3)) (piece "Car" P1 E (if (is In (from) (sites Right)) (move Remove (from)) ("StepMove"))) (piece "Car" P2 N (if (is In (from) (sites Top)) (move Remove (from)) ("StepMove")))}) (rules (start { (place "Car1" (difference (sites Left) (sites {"A1"}))) (place "Car2" (difference (sites Bottom) (sites {"A1"})))}) (play (forEach Piece)) (end ("EscapeWin")))) ###
Played on a nxn board. Each player has n-1 cars, that can move either forward or up and down. Cars can leave the board once they have reached the opposite edge. First player to run out of legal moves wins. The game is played on a 3x3 board. END
Construct a global Ludii definition which fulfills the following requirements. Defines a sequence of hop move in all the diagonal directions over an enemy to an empty site from the last ``to'' location of the previous move. ###
(define "HopDiagonalSequenceCaptureAgain" (move Hop (from (last To)) Diagonal (between #1 #2 if:(and (not (is In (between) (sites ToClear))) ("IsEnemyAt" (between))) (apply (remove (between) #3))) (to if:(is Empty (to))) (then (if (can Move (hop (from (last To)) Diagonal (between #1 #2 if:(and (not (is In (between) (sites ToClear))) ("IsEnemyAt" (between)))) (to if:(is Empty (to))))) (moveAgain))))) END
Construct a Ludii game based on the following description The players take it in turns to choose one block and \ The board has 4 rows. The board has 5 columns. ###
(define "EatTopLeftCorner" (is In (last To) (intersection (sites Top) (sites Left)))) (define "EatChocolate" (move Remove (sites Occupied by:Shared) (then ("EatBottomRight")))) (define "EatBottomRight" (forEach Site (sites Occupied by:Shared) (if (and (>= (row of:(last To)) (row of:(site))) (<= (column of:(last To)) (column of:(site)))) (remove (site))))) (game "Chomp" (players 2) (equipment { (board (rectangle 4 5)) (piece "Chocolate" Shared)}) (rules (start (place "Chocolate" (sites Board))) (play ("EatChocolate")) (end (if ("EatTopLeftCorner") (result Mover Loss))))) END
Modify the Ludii game according to the following option changes: Board & size: Hexhex with edges alternating 4 and 5 -> Board & size: Equiversi Hexhex with edges alternating 5 and 7 (define "Tri78Bug" (tri {7 8 7 10 6})) (define "Tri57Bug" (tri {5 7 5 8 5})) (define "Tri56Bug" (tri {5 6 5 7 5})) (define "Tri46Bug" (tri {4 6 4 7 4})) (define "EndCondition" (or {(no Moves Next) (all Passed)})) (define "Placement" (do (forget Value All) next:(move Add (piece (id "Disc" Mover)) (to (sites Empty)) (then (if (can Move ("OpponentHop" (from if:(!= (from) (last To))))) (moveAgain)))))) (define "ForcedHop" (if (= 0 (size Array (values Remembered))) ("OpponentHop" (from if:(!= (from) (last To)))) ("OpponentHop" (from if:(= (from) (last To)))))) (define "OpponentHop" (forEach Piece (move Hop #1 Orthogonal (between if:("IsAJumpableSite") (apply (set Pending (between)))) (to if:(is Empty (to))) (then (and { (remember Value (value Pending)) (remove (value Pending)) (add (piece (id "Disc" Mover)) (to (value Pending)))} (then (and { (set Pending) (if ("CanHop" (from (last To))) (moveAgain))}))))))) (define "CanHop" (can Move (forEach Piece (move Hop #1 Orthogonal (between if:("IsAJumpableSite")) (to if:(is Empty (to))))))) (define "IsAJumpableSite" (is In (between) (difference (sites Occupied by:Next) (sites (values Remembered))))) (define "SameTurn" (is Prev Mover)) (game "Claim Jumpers" (players 2) (equipment { (board (tri {4 5 4 5 4}) use:Vertex) (piece "Disc" Each)}) (rules (start (set Score Each 0)) (play (if ("SameTurn") ("ForcedHop") ("Placement") (then (and (set Score Mover (count Pieces Mover)) (set Score Next (count Pieces Next)))))) (end { (if (and "EndCondition" (= (score Mover) (score Next))) (result Mover Win)) (if (and "EndCondition" (!= (score Mover) (score Next))) (byScore))}))) ###
(define "Tri78Bug" (tri {7 8 7 10 6})) (define "Tri57Bug" (tri {5 7 5 8 5})) (define "Tri56Bug" (tri {5 6 5 7 5})) (define "Tri46Bug" (tri {4 6 4 7 4})) (define "EndCondition" (or {(no Moves Next) (all Passed)})) (define "Placement" (do (forget Value All) next:(move Add (piece (id "Disc" Mover)) (to (sites Empty)) (then (if (can Move ("OpponentHop" (from if:(!= (from) (last To))))) (moveAgain)))))) (define "ForcedHop" (if (= 0 (size Array (values Remembered))) ("OpponentHop" (from if:(!= (from) (last To)))) ("OpponentHop" (from if:(= (from) (last To)))))) (define "OpponentHop" (forEach Piece (move Hop #1 Orthogonal (between if:("IsAJumpableSite") (apply (set Pending (between)))) (to if:(is Empty (to))) (then (and { (remember Value (value Pending)) (remove (value Pending)) (add (piece (id "Disc" Mover)) (to (value Pending)))} (then (and { (set Pending) (if ("CanHop" (from (last To))) (moveAgain))}))))))) (define "CanHop" (can Move (forEach Piece (move Hop #1 Orthogonal (between if:("IsAJumpableSite")) (to if:(is Empty (to))))))) (define "IsAJumpableSite" (is In (between) (difference (sites Occupied by:Next) (sites (values Remembered))))) (define "SameTurn" (is Prev Mover)) (game "Claim Jumpers" (players 2) (equipment { (board "Tri57Bug" use:Vertex) (piece "Disc" Each)}) (rules (start (set Score Each 0)) (play (if ("SameTurn") ("ForcedHop") ("Placement") (then (and (set Score Mover (count Pieces Mover)) (set Score Next (count Pieces Next)))))) (end { (if (and "EndCondition" (= (score Mover) (score Next))) (result Mover Win)) (if (and "EndCondition" (!= (score Mover) (score Next))) (byScore))}))) END
Describe the mechanics of the following Ludii game (game "Flowers" (players 2) (equipment { (board (dual (tiling T33336 3))) (piece "Marker" P1) (piece "Marker" P2)}) (rules (play (move Add (to (sites Empty)))) (end (if (is Line 4 Orthogonal) (result Mover Win))))) ###
Players take turns placing a piece of their colour, and win by making an orthogonally connected line of 4 of their colour (diagonal steps don't count). END
Construct a Ludii game based on the following description Setup: Pieces of each color start distributed symmetrically on every 3rd cell of the board. (For a game on an order 4 board, the outer cells are not used.) Play - Decide which player will play with which color (Dark or Light). - Light is the first player to play. - Passing is not allowed. - The game ends when a player cannot move. On each turn, the mover chooses a piece and slides it over empty cells towards a friendly piece in the same line (but not necessarily visible from the moving piece's point of view.) The sliding piece must either: - stop on an empty cell next to a friendly piece to form a group of friendly pieces that is larger than the group it started in, or - stop at the first opponent's piece and remove it. The Last Scavenger. A piece must slide toward a friendly piece, either to reach a location where it forms a group larger than where it started, or to reach an opponent's piece, which is then removed. Last to move wins. Order 4 board ###
(define "ColourBackground" (colour 245 245 245)) (define "Last2MoveEnd" ("BlockWin")) (define "AMSEnd" (if (no Moves Next) (result Mover Loss))) (define "MoveByDirection" (forEach Piece (or { ("AdvancedSquishSlide" NNE) ("AdvancedSquishSlide" E) ("AdvancedSquishSlide" SSE) ("AdvancedSquishSlide" SSW) ("AdvancedSquishSlide" W) ("AdvancedSquishSlide" NNW)}))) (define "AdvancedSquishSlide" (do (set Var "OriginGroupSize" (size Group at:(from)) (then (set Var "From" (from)))) next:(move (from (from)) (to ("AlongLine" #1) if:(and { (all Sites (sites Between from:(from) to:(to)) if:(is Empty (site))) ("IsPlayableSiteType") ("MoveTowardFriendInSameLine" #1) (or (is Next (who at:(to))) (<= (var "OriginGroupSize") ("DestinationGroupSize")))}) (apply (remove (to))))))) (define "DestinationGroupSize" (count Sites in:(sites Distance Orthogonal (step (to if:(and (!= (var "From") (to)) (is Mover (who at:(to)))))) from:(to) (min 0)))) (define "FirstFriend" (sites To (move Hop #1 (between (min 0) if:(or { (= (from) (between)) (is Next (who at:(between))) (is Empty (between))})) (to (sites Inner) if:(is Mover (who at:(to))))))) (define "MoveTowardFriendInSameLine" (< 0 (count Pieces Mover in:("FurtherAlongLine" #1)))) (define "FurtherAlongLine" (sites Distance (step #1 (to if:True)) from:(to) (min 1))) (define "AlongLine" (sites Distance (step #1 (to if:True)) from:(from) (min 1))) (define "IsPlayableSiteType" (is In (to) ("PlayableSite"))) (define "PlayableSite" (difference (sites Inner) (sites Occupied by:Mover))) (game "Don't Mosey and The Last Scavenger" (players 2) (equipment { (board (hex Hexagon 5) use:Cell) (piece "Disc" Each)}) (rules (start {(place "Disc1" {7 12 15 21 24 28 31 38 41 44 47 52}) (place "Disc2" {8 13 16 19 22 29 32 36 39 45 48 53})}) (play "MoveByDirection") (end "Last2MoveEnd"))) END
Modify the Ludii game according to the following option changes: The game is played on the Graph2. -> The game is played on the Graph3. (game "Oriath" (players 1) (equipment { (board (remove (complete (regular Star 8)) edges:{ {0 1} {2 3}}) use:Edge)}) (rules (play (move Add (to Edge (sites Empty Edge)))) (end { (if (is RegularGraph Mover) (result Mover Win))}))) ###
(game "Oriath" (players 1) (equipment { (board (graph vertices:{ {2 0} {9 0} {6 1} {4 2} {9 2} {3 3} {0 4} {3 5} {6 3} {8 5} {11 4} {2 8} {7 7} {9 8}} edges:{ {0 1} {0 2} {0 3} {0 4} {0 5} {0 6} {0 7} {0 8} {0 9} {0 10} {0 11} {0 12} {0 13} {1 2} {1 3} {1 4} {1 5} {1 6} {1 7} {1 8} {1 9} {1 10} {1 11} {1 12} {1 13} {2 3} {2 4} {2 5} {2 6} {2 7} {2 8} {2 9} {2 10} {2 11} {2 12} {2 13} {3 4} {3 5} {3 6} {3 7} {3 8} {3 9} {3 10} {3 11} {3 12} {3 13} {4 5} {4 6} {4 7} {4 8} {4 9} {4 10} {4 11} {4 12} {4 13} {5 6} {5 7} {5 8} {5 9} {5 10} {5 11} {5 12} {5 13} {6 7} {6 8} {6 9} {6 10} {6 11} {6 12} {6 13} {7 8} {7 9} {7 10} {7 11} {7 12} {7 13} {8 9} {8 10} {8 11} {8 12} {8 13} {9 10} {9 11} {9 12} {9 13} {10 11} {10 12} {10 13} {11 12} {11 13} {12 13}}) use:Edge)}) (rules (play (move Add (to Edge (sites Empty Edge)))) (end { (if (is RegularGraph Mover) (result Mover Win))}))) END
Describe the mechanics of the following Ludii game (define "InitTwoSeed" 7 20) (define "InitOneSeed" 8 19) (define "Columns" 7) (game "Chisolo" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "TrackCCW1" "0,E,N1,W" loop:True P1) (track "TrackCCW2" "14,E,N1,W" loop:True P2) (track "TrackCW1" "6,W,N1,E" loop:True P1) (track "TrackCW2" "21,E,S1,W" loop:True P2)}) (regions "Home" P1 (sites Track "TrackCCW1")) (regions "Home" P2 (sites Track "TrackCCW2")) (regions "Inner" P1 (difference (sites Track "TrackCCW1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "TrackCCW2") (sites Top))) (regions "FourLeftInner" P1 (sites {7..10})) (regions "FourLeftInner" P2 (sites {17..20})) (piece "Seed" Shared) (hand Each)}) (rules (start { (set Count 3 to:(difference (union (sites P1 "Home") (sites P2 "Home")) (union (sites P1 "FourLeftInner") (sites P2 "FourLeftInner")))) (set Count 1 to:(sites {"InitOneSeed"})) (set Count 2 to:(sites {"InitTwoSeed"}))}) phases: { (phase "SowingCW" (play (if (and ("SameTurn") (= (var "CaptureOther") 1)) (move (from (sites Next) if:(is Occupied (from))) (to (handSite Mover)) count:(count at:(from)) (then (set Var "CaptureOther" 0))) (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover "Home")) if:(is Occupied (from))) (then (sow "TrackCW" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover "Inner")) (if (is Occupied ("OppositePit" (to))) (and { (fromTo (from ("OppositePit" (to))) (to (handSite Mover)) count:(count at:("OppositePit" (to)))) (if (is Occupied ("OppositeOuterPit" (to))) (fromTo (from ("OppositeOuterPit" (to))) (to (handSite Mover)) count:(count at:("OppositeOuterPit" (to))))) (moveAgain) (set Var "CaptureOther" 1)}))))))))) (nextPhase Mover (not (is Next Mover)) "Sowing")) (phase "Sowing" (play (if (and ("SameTurn") (= (var "CaptureOther") 1)) (move (from (sites Next) if:(is Occupied (from))) (to (handSite Mover)) count:(count at:(from)) (then (set Var "CaptureOther" 0))) (or (if (or (<= (value Player Mover) 0) (= (value Player Mover) 1)) (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover "Home")) if:(is Occupied (from))) (then (and (sow "TrackCW" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover "Inner")) (if (is Occupied ("OppositePit" (to))) (and { (fromTo (from ("OppositePit" (to))) (to (handSite Mover)) count:(count at:("OppositePit" (to)))) (if (is Occupied ("OppositeOuterPit" (to))) (fromTo (from ("OppositeOuterPit" (to))) (to (handSite Mover)) count:(count at:("OppositeOuterPit" (to))))) (moveAgain) (set Var "CaptureOther" 1)}))))) (set Value Mover 1))))) (if (or (<= (value Player Mover) 0) (= (value Player Mover) 2)) (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover "Home")) if:(is Occupied (from))) (then (and (sow "TrackCCW" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover "Inner")) (if (is Occupied ("OppositePit" (to))) (and { (fromTo (from ("OppositePit" (to))) (to (handSite Mover)) count:(count at:("OppositePit" (to)))) (if (is Occupied ("OppositeOuterPit" (to))) (fromTo (from ("OppositeOuterPit" (to))) (to (handSite Mover)) count:(count at:("OppositeOuterPit" (to))))) (moveAgain) (set Var "CaptureOther" 1)}))))) (set Value Mover 2)))))))))} (end ("ForEachPlayerNoMovesLoss")))) ###
4x7-10 board (seven most common). Three counters in each hole, except the leftmost four in the inner row which have, from right to left: 0-0-1-2. On the first turn, sowing occurs in a clockwise direction. On the second turn, the player may sow in either direction, but must continue in the chosen direction for the rest of the game. When the final counter lands in an empty hole in the inner row, the contents of the hole in the opponent's inner row are also captured. If there are also contents in the opponent's outer row hole opposite, these are also taken. When a capture is made, the player may then capture the counters in any one of the opponent's holes as well. If the final counter lands in an occupied hole, the player picks up these counters and continues sowing. The player who captures all of the opponent's counters wins. Each player has 7 holes on each row. Starting positions of the Natatu ruleset. No Opening. Capture all the opposite holes. END
Construct a global Ludii definition which fulfills the following requirements. Checks if the next player has no legal moves and apply a specific result to the next player. This ludemeplex can be used only in an ending condition. ###
(define "NoMoves" (if (no Moves Next) (result Next #1))) END
Construct a Ludii game based on the following description 4x8 board, occasionally 4x9 or 10. One counter in each hole. Sowing occurs in an anti-clockwise direction. The players start by each making a stylised move. Sowing begins from the rightmost hole in the outer row. When the final counter lands in an occupied hole, these counters are picked up and sowing continues. When the sowing reaches the hole immediately before the one from which the sowing began (I.e,, the second-to-right hole in the outer row), these two counters are picked up and both placed in the rightmost hole in the outer row. The player then removes the two counters in the second-to-right hole in the inner row from the board. When both players complete this move, the main phase of the game begins. Players sow from any hole in their two rows. When the final counter lands in an occupied hole, these counters are picked up and sowing continues. When the final counter lands in an empty hole in the inner row, the counters in the opponent's opposite hole in their inner row are captured. If there are also counters in the opponent's opposite hole in the outer row, these are also captured, but only when a capture from the inner row was also made. Players cannot sow single counters, unless there are no holes with multiple counters left, in which case single counters may be sown into an empty hole. Play continues until one player has captured all of the opponent's counters, thus winning the game. Each row has 8 holes. ###
(define "AllSitesNoMoreThanOne" (all Sites (sites Mover "Home") if:(>= 1 (count at:(site))))) (define "SecondToRightInnerRow" (if (is Mover P1) (intersection (sites Mover "Inner") (difference (expand (sites Right)) (sites Right))) (intersection (sites Mover "Inner") (difference (expand (sites Left)) (sites Left))))) (define "RightMostHole" (if (is Mover P1) (intersection (sites Mover "Outer") (sites Right)) (intersection (sites Mover "Outer") (sites Left)))) (define "NextHole" ("NextSiteOnTrack" #2 from:#1 "Track")) (define "NoPiece" (all Sites (sites Player) if:(= 0 (count at:(site))))) (define "Columns" 8) (game "Njombwa (One Counter)" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "Track1" "0,E,N1,W" loop:True P1) (track "Track2" "16,E,N1,W" loop:True P2)}) (regions "Home" P1 (sites Track "Track1")) (regions "Home" P2 (sites Track "Track2")) (regions "Inner" P1 (difference (sites Track "Track1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "Track2") (sites Top))) (regions "Outer" P1 (sites Bottom)) (regions "Outer" P2 (sites Top)) (piece "Seed" Shared)}) (rules (start (set Count 1 to:(sites Board))) phases:{ (phase "Opening1" (play (move Select (from (if ("SameTurn") "LastHoleSowed" ("RightMostHole")) if:(> (count at:(from)) 0)) (then (sow "Track" owner:(mover) apply:(if (and (not (is In ("NextHole" (to) 1) ("RightMostHole"))) (< 1 (count at:(to)))) (moveAgain)))))) (nextPhase Mover (not (is Next Mover)) "Opening2")) (phase "Opening2" (play (move (from (sites Mover "Home") if:(is In ("NextHole" (from) 1) ("RightMostHole"))) (to ("RightMostHole")) count:2)) (nextPhase Mover "Opening3")) (phase "Opening3" (play (move Remove ("SecondToRightInnerRow"))) (nextPhase Mover "Sowing")) (phase "Sowing" (play (if ("AllSitesNoMoreThanOne") (move Select (from (sites Mover "Home") if:(and (is Occupied (from)) (is Empty ("NextHole" (from) 1)))) (then (sow "Track" owner:(mover)))) (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover "Home")) if:(> (count at:(from)) 1)) (then (sow "Track" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (and (is In (to) (sites Mover "Inner")) (is Occupied ("OppositePit" (to)))) (and (remove ("OppositePit" (to))) (if (is Occupied ("OppositeOuterPit" (to))) (remove ("OppositeOuterPit" (to)))))))))))))} (end (forEach NonMover if:("NoPiece") (result Player Loss))))) END
Construct a Ludii game based on the following description Pieces begin on opposite sides of the square. Players take turns moving the piece to an empty spot either orthogonally or diagonally, but one orthogonal direction is forbidden. The player who blocks the other player from being able to move wins. The piece are already placed on the board. ###
(game "Pong Hau K'i" (players 2) (equipment { (board (add (remove ("AlquerqueGraph" 3 3) vertices:{1 3 5 7}) edges:{{3 0} {0 1} {1 4}}) use:Vertex) (hand Each) (piece "Disc" Each "StepToEmpty")}) (rules (start {(place "Disc1" {"A3" "C3"}) (place "Disc2" {"A1" "C1"})}) (play (forEach Piece)) (end ("NoMoves" Loss)))) END
Modify the Ludii game according to the following option changes: The game is played on a 6x6 board. -> The game is played on a 8x8 board. (define "HopSequence" ("HopCapture" (from #1) #2 (then ("ReplayIfCanMove" ("HopCapture" (from (last To)) SameDirection))))) (game "Konane" (players 2) (equipment { (board (square 6)) (piece "Marker" Each)}) (rules (start { (place "Marker1" (sites Phase 1)) (place "Marker2" (sites Phase 0))}) phases:{ (phase "OpeningP1" P1 (play (move Remove (intersection (union (sites Corners) (sites Centre)) (sites Phase 1)))) (nextPhase Mover "Movement")) (phase "OpeningP2" P2 (play (move Remove (sites Around (last To) Own))) (nextPhase Mover "Movement")) (phase "Movement" (play (if "SameTurn" (or ("HopSequence" (last To) SameDirection) (move Pass)) (forEach Piece "Marker" ("HopSequence" (from) Orthogonal)))))} (end ("NoMoves" Loss)))) ###
(define "HopSequence" ("HopCapture" (from #1) #2 (then ("ReplayIfCanMove" ("HopCapture" (from (last To)) SameDirection))))) (game "Konane" (players 2) (equipment { (board (square 8)) (piece "Marker" Each)}) (rules (start { (place "Marker1" (sites Phase 1)) (place "Marker2" (sites Phase 0))}) phases:{ (phase "OpeningP1" P1 (play (move Remove (intersection (union (sites Corners) (sites Centre)) (sites Phase 1)))) (nextPhase Mover "Movement")) (phase "OpeningP2" P2 (play (move Remove (sites Around (last To) Own))) (nextPhase Mover "Movement")) (phase "Movement" (play (if "SameTurn" (or ("HopSequence" (last To) SameDirection) (move Pass)) (forEach Piece "Marker" ("HopSequence" (from) Orthogonal)))))} (end ("NoMoves" Loss)))) END
Construct a Ludii game based on the following description 2x9 board, with two stores in between the holes. Players own the store to their right. Nine counters in each hole. A player takes all of the counters from one of the holes in their row and sows them anti-clockwise. The first stone is dropped into the hole that was just emptied, except when there is only one stone, in which case it is moved to the next hole. If the last counter falls into an opponent's hole making this hole have an even number of counters, these counters are captured and placed in the player's store. Otherwise, the turn ends. When the last counter falls into an opponent's hole, making it contain three counters, it is made into a \ ###
(define "PiecesOwnedBy" (+ (count at:(mapEntry #1)) (count in:(sites #1)))) (define "CaptureFromTuzOf" (if (and (> ("Tuz" #1) 0) (> (count at:("Tuz" #1)) 0)) (fromTo (from ("Tuz" #1)) (to (mapEntry #1)) count:(count at:("Tuz" #1))))) (define "Tuz" (value Player #1)) (define "Columns" 9) (game "Toguz Kumalak" (players 2) (equipment { (board (merge { (rectangle 1 9) (shift 2.5 1 (rectangle 1 1)) (shift 5.5 1 (rectangle 1 1)) (shift 0 2 (rectangle 1 9))}) (track "Track" "0,E,19,W" loop:True) use:Vertex) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 9) (pair P2 10)}) (piece "Seed" Shared)}) (rules (start (set Count 9 to:(sites Track))) (play (move Select (from (sites Mover) if:(> (count at:(from)) 0)) (then (sow apply:(if (and (is In (to) (sites Next)) (is Even (count at:(to)))) (fromTo (from (to)) (to (mapEntry (mover))) count:(count at:(to))) (if (and { (is In (to) (sites Next)) (= (count at:(to)) 3) (< ("Tuz" Mover) 0) (if (< ("Tuz" Next) 0) True (!= (+ (to) ("Tuz" Next)) 19))}) (and (set Value Mover (to)) (fromTo (from (to)) (to (mapEntry (mover))) count:(count at:(to)))))) origin:(!= (count at:(last From)) 1) (then (and ("CaptureFromTuzOf" P1) ("CaptureFromTuzOf" P2))))))) (end ("MancalaByScoreWhen" (no Moves Mover))))) END
Describe the mechanics of the following Ludii game (game "Temeen Tavag" (players 2) (equipment { (board (remove (rotate 45 (concentric {1 4})) edges:{{1 4}}) use:Vertex) (hand Each) (piece "Disc" Each "StepToEmpty")}) (rules (start (place "Disc" "Hand" count:2)) phases:{ (phase "Placement" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) ("PhaseMovePiece" "Movement")} (end ("BlockWin")))) ###
An X, with a rounded line connecting the four endpoints of the X, but leaving two unconnected. A circle is drawn between these two unconnected endpoints. Two pieces per player. Players alternate turns placing one of their pieces on an empty point on the board. When all of the pieces are placed, players alternate turns moving one of the pieces to an empty adjacent point on the board, moving along the lines. The player who blocks their opponent from being able to move wins. The board is a circle. END
Construct a Ludii game based on the following description Each player has 24 pieces, which are placed on the intersections of the lines and move along the lines to an adjacent intersection. Players may capture opponents' pieces by jumping them. Captures are not obligatory. Multiple captures can be made. A player wins by capturing all of the opponent's pieces. ###
(game "Peralikatuma" (players 2) (equipment { ("AlquerqueBoardWithFourTriangles") (piece "Marker" Each)}) (rules (start { (place "Marker1" (union {(expand (sites Bottom) steps:2) (expand (sites Right) steps:3) (sites {"F3" "G3" "F4" "F6" "F7" "G7"})})) (place "Marker2" (union {(expand (sites Top) steps:2) (expand (sites Left) steps:3) (sites {"C3" "D3" "D4" "D6" "D7" "C7"})}))}) (play (if "SameTurn" (or ("HopSequenceCaptureAgain") (move Pass)) (forEach Piece "Marker" (or ("HopSequenceCapture") ("StepToEmpty"))))) (end ("NoMoves" Loss)))) END
Describe the mechanics of the following Ludii game (define "Move" (if (no Pieces Mover) (if (is Mover P1) (forEach Piece ("PieceMove" "Track3") P3) (if (is Mover P3) (forEach Piece ("PieceMove" "Track1") P1) (if (is Mover P4) (forEach Piece ("PieceMove" "Track2") P2) (forEach Piece ("PieceMove" "Track4") P4)))) (forEach Piece))) (define "PieceMove" (or (if (and {(= 0 (count MovesThisTurn)) ("Triple") ("HasASixThreeOrTwo") (= 3 ("CountPieceTypeInStack" (mover) (from)))}) (move (from (from) level:(level)) (to ("NextSiteOnTrack" (* 2 ("Die1")) from:(from) #1)) (then (forEach Level (last From) FromTop (if (is Mover (who at:(last From) level:(level))) (fromTo (from (last From) level:(level)) (to (last To)))))))) (forEach Die if:("DieNotUsed") (if ("IsEndTrack" ("NextSiteOnTrack" (pips) from:(from) #1)) (move Remove (from) level:(level)) (move (from (from) level:(level)) (to ("NextSiteOnTrack" (pips) from:(from) #1)))) (then ("ReplayNotAllDiceUsed"))) (then (forEach Level (last To) FromTop (if (and ("IsEnemyAt" (last To) level:(level)) (= 1 ("CountPieceTypeInStack" (who at:(last To) level:(level)) (last To)))) (fromTo (from (last To) level:(level)) (to (mapEntry "Start" (who at:(last To) level:(level)))))))))) (define "HasASixThreeOrTwo" (or { (is AnyDie 6) (is AnyDie 3) (is AnyDie 2)})) (define "CountPieceTypeInStack" (count Pieces of:#1 in:(sites {#2}))) (define "HasDouble" (or { (= ("Die1") ("Die2")) (= ("Die1") ("Die3")) (= ("Die2") ("Die3"))})) (define "Die3" (face 99)) (define "Die2" (face 98)) (define "Die1" (face 97)) (define "Triple" (all DiceEqual)) (game "Chaupar" (players 4) (equipment { ("PachisiBoard" { (track "Track1" "61,S,E,N,11,E,N,W,53,N,W,S,42,W,S,E,8,54,E1,N7,End" P1 directed:True) (track "Track2" "21,W,S,E,8,S,E,N,11,E,N,W,53,N,W,S,42,W,S1,E7,End" P2 directed:True) (track "Track3" "88,N,W,S,42,W,S,E,8,S,E,N,11,E,N,W,53,N,W1,S7,End" P3 directed:True) (track "Track4" "32,E,N,W,53,N,W,S,42,W,S,E,8,S,E,N,11,E,N1,W7,End" P4 directed:True)}) (dice d:4 faces:{1 2 5 6} num:3) (map "Start" {(pair P1 61) (pair P2 21) (pair P3 88) (pair P4 32)}) (piece "Pawn" Each ("PieceMove" "Track"))}) (rules (start { (set Team 1 {P1 P3}) (set Team 2 {P2 P4}) (place Stack "Pawn1" (sites {61 58 59 56})) (place Stack "Pawn2" (sites {21 20 0 1})) (place Stack "Pawn3" (sites {91 88 93 90})) (place Stack "Pawn4" (sites {33 32 49 50}))}) (play ("RollEachNewTurnMove" ("Move"))) (end ("EscapeTeamWin")))) ###
Four 3x8 rectangles arranged in a cross with a large empty square in the center. Two teams of two players, or by two players playing with two sets of pieces. The pieces move along the outer track of the board according to the throw of three four-sided dice with values of 1, 2, 5 and 6. The values of each die must be played individually, except in certain cases. Each player has four pieces, which begin on the sixth and seventh space of the central row and the seventh and eight space in the right hand row of the arm of the board belonging to the player. If a piece lands on a space occupied by an opponent, the opponent's piece is sent back to the starting position. If two of a player's pieces are on the same space, they cannot be sent to the beginning. In addition, when three pieces are on the same spaces, if triple sixes are thrown the pieces may move twelve spaces together. The same rule applies for threes and twos, moving six and four, respectively. After completing a circuit of the board, the pieces then move into the central row of squares in the arm where the player began. The player must then move off all of their pieces by an exact roll. If a player has removed all of their pieces from the board and their partner is still playing, the player rolls on what would be their turn and the partner moves according to these rolls in addition to their own turn. The player or team to remove all of their pieces from the board first wins. END
What does the following global Ludii definition do? (define "AlquerqueBoard" (board ("AlquerqueGraph" #1 #2) use:Vertex)) ###
Defines a rectangular board with Alquerque-style alternating diagonals. END
Describe the mechanics of the following Ludii game (game "Sudoku" (players 1) (equipment { (board (square 9) (values Cell (range 1 9))) (regions {Columns Rows SubGrids})}) (rules (start (set { {1 9} {6 4} {11 8} {12 5} {16 1} {20 1} {25 6} {26 8} {30 1} {34 3} {40 4} {41 5} {42 7} {46 5} {50 7} {55 7} {58 9} {60 2} {65 3} {66 6} {72 8}})) (play (satisfy (all Different))) (end (if (is Solved) (result P1 Win))))) ###
Played on a 9x9 grid divided into 3x3 groups of 9 or \ END
Construct a Ludii game based on the following description 3x6 board. Each player owns the row closest to them and the half of the central row to their right. Play begins with three counters in each hole. During the first phase of the game, the players race each other (i.e., do not take turns) to be the first person to drop the last counter into an empty hole. Play moves from left to right in the row closest to the player, right to left in the central row, and left to right in the furthest row. Upon reaching the final hole in the opponent's row, play continues with the first hole in the player's own row. In the first phase, Players take counters from the leftmost hole in their row and sow them in the appropriate direction. When the final counter lands in a hole with counters, they are picked up and sowing continues until the last counter is dropped into an empty hole. Play continues in phase two in the same manner as before, but the players take turns and the player who \ ###
(define "OppositePit" (if (is Mover P1) (+ (to) (* "Columns" 2)) (- (to) (* "Columns" 2)))) (define "NextRowPit" (if (is Mover P1) (+ (to) "Columns") (- (to) "Columns"))) (define "Columns" 6) (define "HasCaptured" (is Pending)) (define "LastHoleSowed" (if (is Pending) ("LastPitSowed") (sites {(last To afterConsequence:True)}))) (define "LastPitSowed" (sites Pending)) (define "StoreLastPitSowed" (set Pending (to))) (define "PiecesOwnedBy" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (game "Abalala'e" (players 2) (equipment { (mancalaBoard 3 "Columns" store:None { (track "Track" "0,E,N1,W5,N1,E" loop:True P1) (track "Track" "17,W,S1,E5,S1,W" loop:True P2)}) (regions "Home" P1 (union (sites Bottom) (sites {"D2" "E2" "F2"}))) (regions "Home" P2 (union (sites Top) (sites {"A2" "B2" "C2"}))) (regions "LeftPart" P1 (sites {"A1" "B1" "C1"})) (regions "LeftPart" P2 (sites {"D3" "E3" "F3"})) (regions "MiddleRow" (sites {"A2" "B2" "C2" "D2" "E2" "F2"})) (map "LeftHole" {(pair P1 0) (pair P2 17)}) (piece "Seed" Shared) (hand Each)}) (rules (start (set Count 3 to:(union (sites P1 "Home") (sites P2 "Home")))) (play (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover "Home")) if:(> (count at:(from)) 0)) (then (sow count:(if ("HasCaptured") 1 (count at:(last To))) "Track" owner:(mover) apply:(if (> (count at:(to)) 1) (moveAgain) (if (is In (to) (sites Mover "Home")) (if (is In (to) (sites "MiddleRow")) (if (> (count at:"NextRowPit") 0) (and { (fromTo (from "NextRowPit") (to (handSite Mover)) count:(count at:"NextRowPit")) (moveAgain) ("StoreLastPitSowed")})) (if (is In (to) (sites Mover "LeftPart")) (and { (if (> (count at:"NextRowPit") 0) (and { (fromTo (from "NextRowPit") (to (handSite Mover)) count:(count at:"NextRowPit")) (moveAgain) ("StoreLastPitSowed")})) (if (> (count at:"OppositePit") 0) (and { (fromTo (from "OppositePit") (to (handSite Mover)) count:(count at:"OppositePit")) (moveAgain) ("StoreLastPitSowed")}))}) (if (> (count at:"OppositePit") 0) (and { (fromTo (from "OppositePit") (to (handSite Mover)) count:(count at:"OppositePit")) (moveAgain) ("StoreLastPitSowed")})))))))))) (end ("MancalaByScoreWhen" (or { (all Sites (sites P1 "Home") if:(= 0 (count at:(site)))) (all Sites (sites P2 "Home") if:(= 0 (count at:(site))))}))))) END
Construct a Ludii game based on the following description 5x5 intersecting lines, with diagonals in each quadrant. Two triangles, the apexes of which intersect with the square at the midpoint of opposite sides. One line bisecting the base of the triangle, and another bisecting this line. Each player has sixteen pieces, which begin on the points of one triangle and the two rows of points in front of it, thus leaving the central row of points empty. Players alternate turns moving a piece to an empty adjacent spot along the lines. A piece may capture an opponent's piece by hopping over it to an empty space immediately on the opposite side of the piece, along the lines of the board. The first player to capture all of the opponent's pieces wins. ###
(game "Dam (Singapore)" (players 2) (equipment { ("AlquerqueBoardWithBottomAndTopTriangles") (piece "Marker" Each (or ("HopCapture") ("StepToEmpty")))}) (rules (start { (place "Marker1" (union {(sites Row 0) (sites Row 1) (sites Row 2) (sites Row 3)})) (place "Marker2" (union {(sites Row 5) (sites Row 6) (sites Row 7) (sites Row 8)}))}) (play (forEach Piece)) (end ("CaptureAll" Next)))) END
Construct a Ludii game based on the following description STONE PLACEMENT Players take turns adding their stones to the board, one stone per turn. Black makes the first placement of the game. Each player will always have a placement available on his turn and must make one. OBJECT OF THE GAME To win you must connect two of your islands, which are exactly opposite each other, with a contiguous sequence of your stones. The stones of your islands can be included in the sequence. ###
(game "Atoll" (players 2) (equipment { (board (remove (rotate 90 (hex Rectangle 13 12)) cells:{138 139 148 149 0 1 10 11 69 80})) (piece "Marker" Each)}) (rules (start { (place "Marker1" (sites {132 133 134 135 131 120 108 97 85 7 6 5 4 8 19 31 42 54})) (place "Marker2" (sites {136 137 138 139 64 53 41 30 18 3 2 1 0 121 109 98 86 75}))}) (play (move Add (to (sites Empty)))) (end (if (is Mover P1) { (if (or (is Connected {(sites {132..135}) (sites {4..7})}) (is Connected {(sites {131 120 108 97 85}) (sites {54 42 31 19 8})})) (result Mover Win)) (if (or (is Connected {(sites {121 109 98 86 75}) (sites {64 53 41 30 18})}) (is Connected {(sites {136..139}) (sites {0..3})})) (result Mover Win))})))) END
Construct a Ludii game based on the following description Take turns placing stones on a hexhex board of size 4, or a square board of an odd size not larger than 9. The winner is the player who places a stone on the center cell. A placement N steps away from the perimeter must have at least N friendly pieces in sight. On the square board, pieces see in all 8 directions. A square board of size 9 is currently selected The pie rule is currently not in force. ###
(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))))) END
Construct a Ludii game based on the following description 5x5 board, with an X in the central square of each side of the board, as well as the central square of the board. Two players. Two pieces per player. Four cowrie shells used as dice. Throws have the value of the number of mouths that land face up, with no mouths up = 8. Players start on opposite sides of the board, the first point on their track being the marked square on that side. Players move in an anti-clockwise direction around the board, until reaching the space before the starting space, at which point they move into the space above it, and proceed around the inner part of the board in a clockwise direction, until below the central square. Players enter a piece with a throw of 1. Throws of 1 or 8 give the player another turn. When a player's piece lands on the same space as a space with an opponent's piece, the opponent's piece is removed from the board and must enter again, and the player causing this receives another throw. Pieces resting on a marked square cannot be sent back to start. To reach the central space, the player must throw the exact number required. The first player to move both pieces to the central space first wins. ###
(define "AllPiecesOnCentre" (and (= 1 (count Sites in:(sites Occupied by:#1 top:False))) (is In (centrePoint) (sites Occupied by:#1 top:False)))) (define "Throw1" (= ("ThrowValue") 1)) (define "IsSpecialThrow" (is In ("ThrowValue") (sites {1 8}))) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" #2 #1)) (define "ThrowValue" (mapEntry "Throw" (count Pips))) (game "Siga (Sri Lanka)" (players 2) (equipment { (board (square 5) { (track "Track1" "2,E,N,W,S,E1,N3,E2,S2,W1,N1" P1 directed:True) (track "Track2" "22,W,S,E,N,W1,S3,W2,N2,E1,S1" P2 directed:True)}) (piece "Marker" Each (move (from (from) level:(level)) (to ("SiteToMoveOnTrack" from:(from) ("ThrowValue")) if:True (apply (if (and (not (is In (to) (sites "SafeSites"))) ("IsEnemyAt" (to))) (and (forEach Level (to) FromTop (fromTo (from (to) level:(level)) (to (handSite (who at:(to) level:(level)))))) (moveAgain))))))) (hand Each) ("StickDice" 4) (map "Throw" {(pair 0 8) (pair 1 1) (pair 2 2) (pair 3 3) (pair 4 4)}) (map "Entry" {(pair P1 2) (pair P2 22)}) (regions "SafeSites" (sites {2 10 12 14 22}))}) (rules (start { (place Stack "Marker1" (handSite P1) count:2) (place Stack "Marker2" (handSite P2) count:2)}) (play ("RollMove" (or (if (and (is Occupied (handSite Mover)) ("Throw1")) (move (from (handSite Mover)) (to (mapEntry "Entry" (mover))))) (forEach Piece)) (then (if ("IsSpecialThrow") (moveAgain))))) (end (if ("AllPiecesOnCentre" Mover) (result Mover Win))))) END
Construct a Ludii game based on the following description Players alternate turns. A player's turn consists on either placing piece on an empty field on board, or sliding one of their pieces into an empty one on the board. Players cannot pass. If each player performs three slides in a row then the game ends immediately as a draw. A player wins when any of the opponent's pieces are surrounded and cannot move. If one of a player's own pieces is surrounded on their turn, they lose even if an opponent's stone is surrounded at the same time. ###
(define "SurroundedMySelf" ("NoSites" (sites Around (last To) if:(is Empty (to))))) (define "SurroundedOver" (is Triggered "Surrounded" #1)) (define "ThreeSlideInARow" (= (counter) 5)) (define "SurroundedOf" (surround (from (last To)) Orthogonal (between if:(is #1 (who at:(between))) (apply #2)) (to if:(is Occupied (to))))) (game "Susan" (players 2) (equipment { (board (hex 5)) (piece "Marker" Each "StepOrthogonalToEmpty")}) (rules (play (or (move Add (to (sites Empty)) (then (set Counter))) (forEach Piece) (then (priority ("SurroundedOf" Friend (trigger "Surrounded" (mover))) ("SurroundedOf" Enemy (trigger "Surrounded" (next))))))) (end { (if "ThreeSlideInARow" (result Mover Draw)) (if "SurroundedMySelf" (result Next Win)) (if ("SurroundedOver" P1) (result P2 Win)) (if ("SurroundedOver" P2) (result P1 Win))}))) END
Construct a Ludii game based on the following description 2x6-9 holes with a store on either end. Play starts with same number of counters in each hole as number of holes in the row (6 counters if 6 holes in a row, etc). Store on either end. A player's store is the store to their left. Stores are included when sowing. Play begins from any hole belonging to the player. Counters are sowed clockwise: if the final counter lands in an empty hole, in player's own row, they take the counters in the opposite hole and place them in the store. If play ends in the store, they can then take counters from any of their holes and sow again. if play ends in an empty hole in the opponent's row, play ends. If play ends in a hole with counters, those are collected and sowing continues. A round ends when there are no counters left in a player's row. The opponent then takes all remaining counters and adds them to their store. Next round begins with each player taking the counters from their store and placing the same number of counters in the holes as when the game began, starting from right to left. Surplus counters are placed in the store. Unfilled holes are excluded from play in this round. Play continues as before. Play continues with as many rounds as needed until one player does not have enough counters to fill a single hole. Each player has 6 holes. ###
(define "RightMostEmpty" (trackSite FirstSite from:(mapEntry "RightMost" Mover) if:(is Empty (to)))) (define "OneRowIsEmpty" (or (all Sites (sites Bottom) if:(= 0 (count at:(site)))) (all Sites (sites Top) if:(= 0 (count at:(site)))))) (define "NoPieceOnBoard" (all Sites (union (sites Top) (sites Bottom)) if:(= 0 (count at:(site))))) (define "PlayableSites" (sites (values Remembered "Playable"))) (define "Columns" 6) (game "Main Chongkak" (players 2) (equipment { (mancalaBoard 2 "Columns" (track "Track" "0,ENE,E,ESE,WSW,W" loop:True)) (piece "Seed" Shared) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 FirstSite) (pair P2 LastSite)}) (map "RightMost" {(pair P1 ("Columns")) (pair P2 (+ ("Columns") 1))})}) (rules (start { (set RememberValue "Playable" (union (sites Top) (sites Bottom))) (set Count "Columns" to:(union (sites Bottom) (sites Top)))}) phases:{ (phase "Sowing" (play (or { (move Select (from (if (and (not (is Pending)) ("SameTurn")) (sites {(var "Replay")}) (sites Mover)) if:(and (is Occupied (from)) (is In (from) ("PlayableSites")))) (then (sow apply:(if (and (is In (to) (sites Mover)) (= 1 (count at:(to)))) (if (is Occupied ("OppositePit" (to))) (fromTo (from ("OppositePit" (to))) (to (mapEntry Mover)) count:(count at:("OppositePit" (to))))) (if (= (to) (mapEntry Mover)) (and (set Pending) (moveAgain)) (if (and (< 1 (count at:(to))) (!= (to) (mapEntry Next))) (and (moveAgain) (set Var "Replay" (to)))))) skipIf:(and {(not (is In (to) ("PlayableSites"))) (!= (to) (mapEntry P1)) (!= (to) (mapEntry P2))}))))} (then (if ("OneRowIsEmpty") (and { (forEach Site (sites P1) (fromTo (from (site)) (to (mapEntry P1)) count:(count at:(site)))) (forEach Site (sites P2) (fromTo (from (site)) (to (mapEntry P2)) count:(count at:(site)))) (forget Value "Playable" All)}))))) (end (if ("NoPieceOnBoard") { (if (> ("Columns") (count at:(mapEntry P1))) (result P2 Win)) (if (> ("Columns") (count at:(mapEntry P2))) (result P1 Win))})) (nextPhase ("NoPieceOnBoard") "BetweenRounds")) (phase "BetweenRounds" (play (if (not (all Sites (sites Mover) if:(is Occupied (site)))) (if (<= ("Columns") (count at:(mapEntry Mover))) (move (from (mapEntry Mover)) (to "RightMostEmpty") count:("Columns") (then (remember Value "Playable" (last To))))))) (nextPhase (all Passed) "Sowing"))})) END
Construct a Ludii game based on the following description 2x12 board, divided in half. Spaces on each side take the form of semi-circular sockets, into which the pieces fit. Twelve pieces per player. Two dice. Players move according to the number on each die by moving one piece the value on one die then another piece the value on the other die, or by moving one piece the value of one die and then the value of the other. Each player enters their pieces into their home section of the board (to the left of one player, to the right of the other player, and move pieces along a horseshoe-shaped track around the board toward the other player's home space. At the beginning of play, the first player will choose one quadrant of the board, and the goal of the game will be for one player to move two pieces onto each of the six places in that quadrant. When a piece lands on a space occupied by a single piece of the opponent, the opponent's piece is removed from the board, and must be reentered. The quadrant selected is the top left one. ###
(define "RemoveAPiece" (move Remove (from))) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" (pips))) (game "Los Doze Canes" (players 2) (equipment { ("TableBoard" "TableTracksOppositeWithHands") (dice d:6 num:2) (piece "Disc" Each (forEach Die if:("DieNotUsed") (if ("NoEnemyOrOnlyOne" ("SiteToMoveOnTrack")) (move (from) (to "SiteToMoveOnTrack" ("HittingCapture" (handSite Next))))))) (hand Each)}) (rules (start { (place Stack "Disc1" (handSite P1) count:12) (place Stack "Disc2" (handSite P2) count:12)}) (play ("RollEachNewTurnMove" (or (forEach Piece top:True) (forEach Piece container:(mover) top:True) (then ("ReplayNotAllDiceUsed"))))) (end { (if (and { (= 2 (size Stack at:18)) (= 2 (size Stack at:19)) (= 2 (size Stack at:20)) (= 2 (size Stack at:21)) (= 2 (size Stack at:22)) (= 2 (size Stack at:23)) (= 0 (count Sites in:(difference (sites Occupied by:Mover) (sites {18..23}))))}) (result Mover Win)) (if (and (< 2 (size Stack at:12)) (< 2 (size Stack at:0))) (result Mover Draw))}))) END
Construct a Ludii game based on the following description 4x8 board. Two counters in each hole. Opening play: Two players play simultaneously, lifting and sowing counters from their outer rows. Rules for sowing and capturing are the same as in the main phase of the game except that all holes in each player's outer rows are considered to be in opposition and back captures can be made from them. Once a counter has been sown into the inner row, this ceases and captures can only be made from the inner row. The opening ends when both players reach an empty hole, and the first player to do so begins play in the main phase. Main phase: Play begins from any hole on the player's side of the board with counters in it. Singletons cannot move. Sowing happens in an anti-clockwise direction. If the last counter lands in an empty hole, the turn is over. For capturing: four holes are in opposition when one player has the front row hole occupied and the opponent has both of the holes opposite it occupied. If the last hole in a sowing is in opposition, the player takes the counters in both of the opponent's holes and places them in the empty hole from which the player lifted the counters. The player then sows the captured counters from this hole. Further captures in the sowing can occur in the same way. If the last counter lands on a hole that is occupied but not in opposition, these counters are picked up and sowing continues. Play ends when one player captures all the opponent's counters or one player cannot play. The player who cannot play loses. Each row has 8 holes. ###
(define "NextHole" ("NextSiteOnTrack" #3 from:#1 #2)) (define "CorrespondingOuterPit" (if (is Mover P1) (- #1 "Columns") (+ #1 "Columns"))) (define "Columns" 8) (game "Pereauni" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "TrackCCW1" "0,E,N1,W" loop:True P1) (track "TrackCCW2" "16,E,N1,W" loop:True P2)}) (regions "Home" P1 (sites Track "TrackCCW1")) (regions "Home" P2 (sites Track "TrackCCW2")) (regions "Inner" P1 (difference (sites Track "TrackCCW1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "TrackCCW2") (sites Top))) (regions "Outer" P1 (sites Bottom)) (regions "Outer" P2 (sites Top)) (piece "Seed" Shared)}) (rules (start (set Count 2 to:(union (sites P1 "Home") (sites P2 "Home")))) phases:{ (phase "OuterPhase" (play (move Select (from (if ("SameTurn") (sites {(var "Replay")}) (sites Mover "Outer")) if:(if ("SameTurn") (< 0 (count at:(from))) (< 1 (count at:(from))))) (then (sow count:(if ("SameTurn") (var "Count") (count at:(last From))) "TrackCCW" owner:(mover) apply:(and (if (< 1 (count at:(to))) (and (moveAgain) (if (and (is Occupied ("OppositePit" (to))) (is In (to) (sites Mover "Inner"))) (and { (fromTo (from ("OppositePit" (to))) (to ("CorrespondingOuterPit" (to))) count:(count at:("OppositePit" (to)))) (if (is Occupied ("OppositeOuterPit" (to))) (fromTo (from ("OppositeOuterPit" (to))) (to ("CorrespondingOuterPit" (to))) count:(count at:("OppositeOuterPit" (to))))) (set Var "Replay" ("CorrespondingOuterPit" (to))) (if (= 1 (count at:("CorrespondingOuterPit" (to)))) (set Var "Count" (+ { 1 (count at:("OppositePit" (to))) (count at:("OppositeOuterPit" (to)))})) (set Var "Count" (+ (count at:("OppositePit" (to))) (count at:("OppositeOuterPit" (to))))))}) (and (set Var "Replay" (to)) (set Var "Count" (count at:(to))))))) (if (!= 1 (value Player Mover)) (set Value Mover 1))))))) (nextPhase Mover (= 1 (count at:(last To afterConsequence:True))) "MainPhase")) (phase "MainPhase" (play (move Select (from (if ("SameTurn") (sites {(var "Replay")}) (sites Mover)) if:(if ("SameTurn") (< 0 (count at:(from))) (< 1 (count at:(from))))) (then (sow count:(if ("SameTurn") (var "Count") (count at:(last From))) "TrackCCW" owner:(mover) apply: (if (< 1 (count at:(to))) (and (moveAgain) (if (and { (is Occupied ("OppositePit" (to))) (is In (to) (sites Mover "Inner"))}) (and { (fromTo (from ("OppositePit" (to))) (to ("CorrespondingOuterPit" (to))) count:(count at:("OppositePit" (to)))) (if (is Occupied ("OppositeOuterPit" (to))) (fromTo (from ("OppositeOuterPit" (to))) (to ("CorrespondingOuterPit" (to))) count:(count at:("OppositeOuterPit" (to))))) (set Var "Replay" ("CorrespondingOuterPit" (to))) (if (= 1 (count at:("CorrespondingOuterPit" (to)))) (set Var "Count" (+ { 1 (count at:("OppositePit" (to))) (count at:("OppositeOuterPit" (to)))})) (set Var "Count" (+ (count at:("OppositePit" (to))) (count at:("OppositeOuterPit" (to))))))}) (and (set Var "Replay" (to)) (set Var "Count" (count at:(to))))))))))))} (end ("BlockWin")))) END
Modify the Ludii game according to the following option changes: Each player has 7 holes. -> Each player has 8 holes. (define "RightMostEmpty" (trackSite FirstSite from:(mapEntry "RightMost" Mover) if:(is Empty (to)))) (define "OneRowIsEmpty" (or (all Sites (sites Bottom) if:(= 0 (count at:(site)))) (all Sites (sites Top) if:(= 0 (count at:(site)))))) (define "NoPieceOnBoard" (all Sites (union (sites Top) (sites Bottom)) if:(= 0 (count at:(site))))) (define "PlayableSites" (sites (values Remembered "Playable"))) (define "Columns" 7) (game "Main Chongkak" (players 2) (equipment { (mancalaBoard 2 "Columns" (track "Track" "0,ENE,E,ESE,WSW,W" loop:True)) (piece "Seed" Shared) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 FirstSite) (pair P2 LastSite)}) (map "RightMost" {(pair P1 ("Columns")) (pair P2 (+ ("Columns") 1))})}) (rules (start { (set RememberValue "Playable" (union (sites Top) (sites Bottom))) (set Count "Columns" to:(union (sites Bottom) (sites Top)))}) phases:{ (phase "Sowing" (play (or { (move Select (from (if (and (not (is Pending)) ("SameTurn")) (sites {(var "Replay")}) (sites Mover)) if:(and (is Occupied (from)) (is In (from) ("PlayableSites")))) (then (sow apply:(if (and (is In (to) (sites Mover)) (= 1 (count at:(to)))) (if (is Occupied ("OppositePit" (to))) (fromTo (from ("OppositePit" (to))) (to (mapEntry Mover)) count:(count at:("OppositePit" (to))))) (if (= (to) (mapEntry Mover)) (and (set Pending) (moveAgain)) (if (and (< 1 (count at:(to))) (!= (to) (mapEntry Next))) (and (moveAgain) (set Var "Replay" (to)))))) skipIf:(and {(not (is In (to) ("PlayableSites"))) (!= (to) (mapEntry P1)) (!= (to) (mapEntry P2))}))))} (then (if ("OneRowIsEmpty") (and { (forEach Site (sites P1) (fromTo (from (site)) (to (mapEntry P1)) count:(count at:(site)))) (forEach Site (sites P2) (fromTo (from (site)) (to (mapEntry P2)) count:(count at:(site)))) (forget Value "Playable" All)}))))) (end (if ("NoPieceOnBoard") { (if (> ("Columns") (count at:(mapEntry P1))) (result P2 Win)) (if (> ("Columns") (count at:(mapEntry P2))) (result P1 Win))})) (nextPhase ("NoPieceOnBoard") "BetweenRounds")) (phase "BetweenRounds" (play (if (not (all Sites (sites Mover) if:(is Occupied (site)))) (if (<= ("Columns") (count at:(mapEntry Mover))) (move (from (mapEntry Mover)) (to "RightMostEmpty") count:("Columns") (then (remember Value "Playable" (last To))))))) (nextPhase (all Passed) "Sowing"))})) ###
(define "RightMostEmpty" (trackSite FirstSite from:(mapEntry "RightMost" Mover) if:(is Empty (to)))) (define "OneRowIsEmpty" (or (all Sites (sites Bottom) if:(= 0 (count at:(site)))) (all Sites (sites Top) if:(= 0 (count at:(site)))))) (define "NoPieceOnBoard" (all Sites (union (sites Top) (sites Bottom)) if:(= 0 (count at:(site))))) (define "PlayableSites" (sites (values Remembered "Playable"))) (define "Columns" 8) (game "Main Chongkak" (players 2) (equipment { (mancalaBoard 2 "Columns" (track "Track" "0,ENE,E,ESE,WSW,W" loop:True)) (piece "Seed" Shared) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 FirstSite) (pair P2 LastSite)}) (map "RightMost" {(pair P1 ("Columns")) (pair P2 (+ ("Columns") 1))})}) (rules (start { (set RememberValue "Playable" (union (sites Top) (sites Bottom))) (set Count "Columns" to:(union (sites Bottom) (sites Top)))}) phases:{ (phase "Sowing" (play (or { (move Select (from (if (and (not (is Pending)) ("SameTurn")) (sites {(var "Replay")}) (sites Mover)) if:(and (is Occupied (from)) (is In (from) ("PlayableSites")))) (then (sow apply:(if (and (is In (to) (sites Mover)) (= 1 (count at:(to)))) (if (is Occupied ("OppositePit" (to))) (fromTo (from ("OppositePit" (to))) (to (mapEntry Mover)) count:(count at:("OppositePit" (to))))) (if (= (to) (mapEntry Mover)) (and (set Pending) (moveAgain)) (if (and (< 1 (count at:(to))) (!= (to) (mapEntry Next))) (and (moveAgain) (set Var "Replay" (to)))))) skipIf:(and {(not (is In (to) ("PlayableSites"))) (!= (to) (mapEntry P1)) (!= (to) (mapEntry P2))}))))} (then (if ("OneRowIsEmpty") (and { (forEach Site (sites P1) (fromTo (from (site)) (to (mapEntry P1)) count:(count at:(site)))) (forEach Site (sites P2) (fromTo (from (site)) (to (mapEntry P2)) count:(count at:(site)))) (forget Value "Playable" All)}))))) (end (if ("NoPieceOnBoard") { (if (> ("Columns") (count at:(mapEntry P1))) (result P2 Win)) (if (> ("Columns") (count at:(mapEntry P2))) (result P1 Win))})) (nextPhase ("NoPieceOnBoard") "BetweenRounds")) (phase "BetweenRounds" (play (if (not (all Sites (sites Mover) if:(is Occupied (site)))) (if (<= ("Columns") (count at:(mapEntry Mover))) (move (from (mapEntry Mover)) (to "RightMostEmpty") count:("Columns") (then (remember Value "Playable" (last To))))))) (nextPhase (all Passed) "Sowing"))})) END
Construct a Ludii game based on the following description Each piece has four dichotomous attributes – color, height, shape, and consistency – so each piece is either black or white, tall or short, square or round, and hollow or solid. The object is to place the fourth piece in a row in which all four pieces have at least one attribute in common. The twist is that your opponent gets to choose the piece you place on the board each turn. ###
(game "Quarto" (players 2) (equipment { (board (square 4) use:Vertex) (piece "Disc" Each) (piece "Square" Each) (hand Shared size:16)}) (rules (start { (place "Disc1" (handSite Shared 0)) (place "Disc1" (handSite Shared 1) value:1) (place "Disc1" (handSite Shared 2) state:1) (place "Disc1" (handSite Shared 3) state:1 value:1) (place "Disc2" (handSite Shared 4)) (place "Disc2" (handSite Shared 5) value:1) (place "Disc2" (handSite Shared 6) state:1) (place "Disc2" (handSite Shared 7) state:1 value:1) (place "Square1" (handSite Shared 8)) (place "Square1" (handSite Shared 9) value:1) (place "Square1" (handSite Shared 10) state:1) (place "Square1" (handSite Shared 11) state:1 value:1) (place "Square2" (handSite Shared 12)) (place "Square2" (handSite Shared 13) value:1) (place "Square2" (handSite Shared 14) state:1) (place "Square2" (handSite Shared 15) state:1 value:1)}) phases:{ (phase "Select" (play (move Select (from Cell (difference (sites Hand Shared) (sites Empty 1))))) (nextPhase "Place")) (phase "Place" (play (move (from Cell (last From)) (to (sites Empty)) (then (moveAgain)))) (end { (if (is Line 4 All whats:{(id "Disc" P1) (id "Disc" P2)}) (result Mover Win)) (if (is Line 4 All whats:{(id "Square" P1) (id "Square" P2)}) (result Mover Win)) (if (is Line 4 All P1) (result Mover Win)) (if (is Line 4 All P2) (result Mover Win)) (if (is Line 4 All whats:{(id "Disc" P1) (id "Disc" P2) (id "Square" P1) (id "Square" P2)} if:(= 0 (state at:(to)))) (result Mover Win)) (if (is Line 4 All whats:{(id "Disc" P1) (id "Disc" P2) (id "Square" P1) (id "Square" P2)} if:(= 1 (state at:(to)))) (result Mover Win)) (if (is Line 4 All whats:{(id "Disc" P1) (id "Disc" P2) (id "Square" P1) (id "Square" P2)} if:(= 0 (value Piece at:(to)))) (result Mover Win)) (if (is Line 4 All whats:{(id "Disc" P1) (id "Disc" P2) (id "Square" P1) (id "Square" P2)} if:(= 1 (value Piece at:(to)))) (result Mover Win))}) (nextPhase "Select"))})) END
Construct a Ludii game based on the following description 4x6-16 board. Play begins with two counters in each hole. The first move must be from the inner row. Play begins from any of the player's holes, sowing clockwise. When the final counter lands in an occupied hole, these are picked up and sowing continues. Captures are made when the final counter falls into an empty hole in the inner row, and the opponent's hole opposite contains counters. If it is, they are captured, and if the hole in to outer row opposite also contains counters, these are also captured. If the final counter falls into an empty hole and a capture cannot happen, the turn is over. Play ends when one player cannot move. Each player has 6 holes. ###
(define "PiecesOwnedBy" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (define "PlayFrom" (play (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover #1)) if:(> (count at:(from)) 0)) (then (sow "Track" owner:(mover) apply:(if (= (count at:(to)) 1) (if (is In (to) (sites Mover "Inner")) (if (> (count at:("OppositePit" (to))) 0) (and (fromTo (from ("OppositePit" (to))) (to (handSite Mover)) count:(count at:("OppositePit" (to)))) (if (> (count at:("OppositeOuterPit" (to))) 0) (fromTo (from ("OppositeOuterPit" (to))) (to (handSite Mover)) count:(count at:("OppositeOuterPit" (to)))))))) (moveAgain))))))) (define "Columns" 6) (game "Muvalavala (Luena)" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "Track1" "5,W,N1,E" loop:True P1) (track "Track2" "17,W,N1,E" loop:True P2)}) (regions "Home" P1 (sites Track "Track1")) (regions "Home" P2 (sites Track "Track2")) (regions "Inner" P1 (difference (sites Track "Track1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "Track2") (sites Top))) (piece "Seed" Shared) (hand Each)}) (rules (start (set Count 2 to:(union (sites P1 "Home") (sites P2 "Home")))) phases:{ (phase "Opening" ("PlayFrom" "Inner") (nextPhase (>= (count Turns) 2) "Playing")) (phase "Playing" ("PlayFrom" "Home"))} (end ("MancalaByScoreWhen" (no Moves Mover))))) END
Construct a Ludii game based on the following description Two rows of six holes encircling a larger hole in the center. Two counters in each hole, except the center hole. Players move by removing the counters from one of the holes in their row and sowing them in an anti-clockwise direction. If the final counter of the sowing falls into an occupied hole, these counters are picked up and sowing continues. When the final counter falls into an empty hole, the turn ends. If the final counter falls into a hole already containing two others, the player takes these counters and covers the hole. The three counters are sown beginning with the following hole. When sowing, if a player reaches a covered hole in their row, they skip it and continue sowing with the next available hole. If the player reaches a covered hole in the opponent's row, the counter that would fall into it is instead deposited into the central hole. If this is the final counter, the turn ends. It is possible to sow a single counter. The player who can no longer sow from their row loses. ###
(define "EnemySites" (if (is Mover P1) (sites P2) (sites P1))) (define "NextHoleFrom" ("NextSiteOnTrack" #2 from:#1)) (game "Deka" (players 2) (equipment { (board (merge { (rectangle 1 5) (rectangle 3 1) (shift 0 2 (rectangle 1 5)) (shift 4 0 (rectangle 3 1)) (shift 2 1 (square 1))}) (track "Track" "0,E,N,W,S1" loop:True) use:Vertex) (regions P1 (sites {0..4 11})) (regions P2 (sites {5..10})) (piece "Seed" Shared)}) (rules (start (set Count 2 to:(difference (sites Board) 12))) (play (or { (move Select (from (if ("SameTurn") (sites {(var "Replay")}) (sites Mover)) if:(is Occupied (from))) (then (sow apply:(if (not (and (is In (to) (sites Next)) (= (next) (state at:(to))))) (if (= 3 (count at:(to))) (and { (fromTo (from (to)) (to ("NextHoleFrom" (to) 1)) count:3) (sow ("NextHoleFrom" (to) 1) count:3 skipIf:(and (is In (to) (sites Mover)) (= 1 (state at:(to))))) (set State at:(to) 1)}) (if (< 1 (count at:(to))) (and (moveAgain) (set Var "Replay" (to)))))) skipIf:(and (is In (to) (sites Mover)) (= (mover) (state at:(to)))))))} (then (forEach Site ("EnemySites") (if (= 1 (state at:(site))) (and (fromTo (from (site)) (to (centrePoint)) count:(count at:(site))) (set State at:(site) 1))))))) (end ("ForEachPlayerNoMovesLoss")))) END
Construct a Ludii game based on the following description 3x5 intersecting lines. Six pieces per player, arranged on the two short rows on opposite sides of the board. Players alternate turns moving a piece to an empty adjacent spot. Pieces move orthogonally in a horizontal or forward direction only. To capture, a piece may jump over an adjacent opponent's piece to an empty spot immediately on the opposite side of the piece along the lines of the board. Pieces may capture in a backwards direction. The player who captures all of the opponent's pieces wins. ###
(game "Xarajlt" ("TwoPlayersNorthSouth") (equipment { (board (rectangle 5 3) use:Vertex) (piece "Marker" Each (or ("StepToEmpty" (directions {Forward FR FL})) ("HopOrthogonalCapture")))}) (rules (start { (place "Marker1" (expand (sites Bottom))) (place "Marker2" (expand (sites Top)))}) (play (forEach Piece)) (end ("CaptureAll" Next)))) END
Construct a Ludii game based on the following description Rectangular board, divided into three sections lengthwise. Ten lines divide the outer two sections widthwide. Twelve pieces per player, which begin on the outer intersections closest to the player. Four stick dice, with front and back sides distinguished one from the other. Throws are as follows: Four backs up = kiust. Three backs up = 6; two backs up = 3; one back up = 2; four fronts up = four throws of 6. A throw of kiust is required to enter the opponent's inner row. The pieces of the left hand player move from left to right and then right to left in the next row, then left to right in the following row, then proceeding to circulate in the central two rows in a clockwise direction. The right hand player's pieces move from right to left in their home row, then left to right in the next row, then right to left in the third row, circulating in an anti-clockwise direction. Pieces landing on an opponent's piece with a throw of 2 in the central rows capture the opponent's piece. A player may only pass an opponent's piece without capture with a throw of 3. The player who captures all of the opponent's pieces wins. ###
(define "Move" (if (is In (from) ("MiddleSites")) (move (from (from)) (to ("NextSiteOnTrack" ("ThrowValue") "LoopTrack") if:(and { (if ("IsEnemyAt" (to)) (= 2 ("ThrowValue")) (is Empty (to))) (if (is In (to) (sites Next "Home")) (= 1 (var "Kiust")) True) (if (or (and (= 2 ("ThrowValue")) ("IsEnemyAt" (to))) (= 3 ("ThrowValue"))) True (all Sites (sites Track from:("NextSiteOnTrack" 1 from:(from) "LoopTrack") to:("NextSiteOnTrack" (- ("ThrowValue") 1) from:(from) "LoopTrack")) if:(not ("IsEnemyAt" (site)))))}) (apply ("CaptureMove")))) (move (from (from)) (to ("NextSiteOnTrack" ("ThrowValue") "Track") if:(and { (if (is In (to) ("MiddleSites")) (if ("IsEnemyAt" (to)) (= 2 ("ThrowValue")) (is Empty (to))) (is Empty (to))) (if (is In (to) (sites Next "Home")) (= 1 (var "Kiust")) True) (if (or (and (= 2 ("ThrowValue")) ("IsEnemyAt" (to))) (= 3 ("ThrowValue"))) True (all Sites (sites Track from:("NextSiteOnTrack" 1 from:(from) "Track") to:("NextSiteOnTrack" (- ("ThrowValue") 1) from:(from) "Track")) if:(not ("IsEnemyAt" (site)))))}) (apply ("CaptureMove")))) (then (and (if (= (count Pips) 4) (and (if (!= 1 (value Player Mover)) (moveAgain)) (if (<= (value Player Mover) 0) (set Value Mover 3) (set Value Mover (- (value Player Mover) 1))))) (set Var "Kiust" 0))))) (define "CanEnterKiust" (= (var "Kiust") 1)) (define "CaptureMove" (if ("IsEnemyAt" (to)) (remove (to)))) (define "MiddleSites" (difference (sites Board) (union (sites Left) (sites Right)))) (define "ThrowValue" (mapEntry "Throw" (count Pips))) (game "Kiust Oyun" (players 2) (equipment { (board (merge { (scale 2 1 (rectangle 12 2)) (shift 2 0 (scale 4 1 (rectangle 12 2))) (shift 6 0 (scale 2 1 (rectangle 12 2)))}) { (track "Track1" "22,S,E1,N,E1,S" P1 directed:True) (track "Track2" "47,S,W1,N,W1,S" P2 directed:True) (track "LoopTrack1" "1,N,E1,S" loop:True P1) (track "LoopTrack2" "24,N,W1,S" loop:True P2)} use:Vertex) ("StickDice" 4) (piece "Marker" Each ("Move")) (map "Throw" {(pair 0 0) (pair 3 6) (pair 2 3) (pair 1 2) (pair 4 6)}) (regions "Home" P1 (expand (sites Left))) (regions "Home" P2 (expand (sites Right)))}) (rules (start { (place "Marker1" (sites Left)) (place "Marker2" (sites Right))}) (play (do (if (or (= (var "Kiust") 1) ("NewTurn")) (roll)) next:(if (= 0 ("ThrowValue")) (move Pass (then (and (moveAgain) (set Var "Kiust" 1)))) (forEach Piece)))) (end ("CaptureAll" Next)))) END
Construct a Ludii game based on the following description Seven concentric circles or squares. Four players. One piece per player. One player has a stick, which is hidden in their fist. The next player attempts to guess which hand holds the stick. If the player guessing guesses correctly, they enter their piece in the first circle or advances it to the next circle, and the stick is passed to them. If the guessing player guesses incorrectly, the player holding the stick moves their piece into the first circle or advances it to the next circle. The player with the stick keeps it until the next player guesses the hand holding the stick. The first player to reach the central circle wins. ###
(define "NextSitePrev" (if (is Prev P1) ("NextSite" from:(where "Marker" Prev) "Track1") (if (is Prev P2) ("NextSite" from:(where "Marker" Prev) "Track2") (if (is Prev P3) ("NextSite" from:(where "Marker" Prev) "Track3") ("NextSite" from:(where "Marker" Prev) "Track4"))))) (define "NextSite" ("NextSiteOnTrack" 1 #1 #2)) (game "Ashere" (players 4) (equipment { (board (concentric {4 4 4 4 4 4 4 4}) { (track "Track1" {28 24 20 16 12 8 4 0} P1 directed:True) (track "Track2" {29 25 21 17 13 9 5 1} P2 directed:True) (track "Track3" {30 26 22 18 14 10 6 2} P3 directed:True) (track "Track4" {31 27 23 19 15 11 7 3} P4 directed:True)} use:Vertex) (piece "Marker" Each) (piece "Stick" Shared) (hand Each size:2)}) (rules (start { (place "Marker1" 28) (place "Marker2" 29) (place "Marker3" 30) (place "Marker4" 31)}) phases:{ (phase "Hiding" (play (move Add (piece (id "Stick" Shared)) (to Cell (sites Hand Mover)) (then (set Hidden Cell at:(last To) to:Next)))) (nextPhase "Guessing")) (phase "Guessing" (play (move Select (from Cell (sites Hand Prev)) (then (and (if (is Empty (last To)) (and (fromTo (from (where "Marker" Prev)) (to ("NextSitePrev"))) (if (not (is In ("NextSitePrev") (sites Centre))) (set NextPlayer (player (prev))))) (and { (moveAgain) (fromTo (from (where "Marker" Mover)) (to ("NextSite" from:(where "Marker" Mover))))})) (remove Cell (sites Hand Prev)))))) (nextPhase "Hiding"))} (end (if (!= (- (count Players) (count Active)) (count Sites in:(forEach (sites Centre) if:(is Occupied (site))))) { (if (and (is Active P1) (is In (where "Marker" P1) (sites Centre))) (result P1 Win)) (if (and (is Active P2) (is In (where "Marker" P2) (sites Centre))) (result P2 Win)) (if (and (is Active P3) (is In (where "Marker" P3) (sites Centre))) (result P3 Win)) (if (and (is Active P4) (is In (where "Marker" P4) (sites Centre))) (result P4 Win))})))) END
Construct a Ludii game based on the following description The rules are exactly the same as in Chess, except the Queen also has the ability to move as a knight. ###
(define "InitialPawnMove" (if (is In (from) (sites Start (piece (what at:(from))))) ("DoubleStepForwardToEmpty" "SetEnPassantLocation"))) (define "EnPassant" (move Step (directions {FR FL}) (to if:"InLocationEnPassant") (then (remove (ahead (last To) Backward))))) (define "InLocationEnPassant" (and (is Pending) (= (to) (value Pending)))) (define "SetEnPassantLocation" (then (set Pending (ahead (last To) Backward)))) (define "Castling" (if (and ("HasNeverMoved" "King") (not ("IsInCheck" "King" Mover))) (or (if (and ("HasNeverMoved" "RookLeft") (can Move ("CastleRook" "RookLeft" E 3 (is Empty (to))))) "BigCastling") (if (and ("HasNeverMoved" "RookRight") (can Move ("CastleRook" "RookRight" W 2 (is Empty (to))))) "SmallCastling")))) (define "BigCastling" ("DecideToCastle" "King" W 2 "KingNotCheckedAndToEmpty" (then ("CastleRook" "RookLeft" E 3 True)))) (define "SmallCastling" ("DecideToCastle" "King" E 2 "KingNotCheckedAndToEmpty" (then ("CastleRook" "RookRight" W 2 True)))) (define "CastleRook" (slide (from (mapEntry #1 (mover))) #2 (between (exact #3) if:#4) (to if:True (apply ("PieceHasMoved" (from)))))) (define "DecideToCastle" (move Slide (from (mapEntry #1 (mover))) #2 (between (exact #3) if:#4) (to if:True (apply ("PieceHasMoved" (from)))) #5)) (define "KingNotCheckedAndToEmpty" (and (is Empty (to)) (not ("IsInCheck" "King" Mover at:(to))))) (define "RememberPieceHasMoved" (then (if (= (state at:(last To)) 1) ("PieceHasMoved" (last To))))) (define "PieceHasMoved" (set State at:#1 0)) (define "HasNeverMoved" (= (state at:(mapEntry #1 (mover))) 1)) (game "Amazon Chess" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) ("ChessPawn" "Pawn" (or "InitialPawnMove" "EnPassant") (then (and ("ReplayInMovingOn" (sites Mover "Promotion")) (set Counter)))) ("ChessRook" "Rook" (then (set Counter)) ("RememberPieceHasMoved")) ("ChessKing" "King" (then (set Counter)) ("RememberPieceHasMoved")) ("ChessBishop" "Bishop" (then (set Counter))) ("ChessKnight" "Knight" (then (set Counter))) (piece "Queen" Each (or ("SlideCapture" ~ ~ (then (set Counter))) ("LeapCapture" "KnightWalk" (then (set Counter))))) (map "King" {(pair 1 "E1") (pair 2 "E8")}) (map "RookLeft" {(pair 1 "A1") (pair 2 "A8")}) (map "RookRight" {(pair 1 "H1") (pair 2 "H8")}) (regions "Promotion" P1 (sites Top)) (regions "Promotion" P2 (sites Bottom))}) (rules (start { (place "Pawn1" (sites Row 1)) (place "Pawn2" (sites Row 6)) (place "Rook1" {"A1" "H1"} state:1) (place "Knight1" {"B1" "G1"}) (place "Bishop1" {"C1" "F1"}) (place "Queen1" coord:"D1") (place "King1" coord:"E1" state:1) (place "Rook2" {"A8" "H8"} state:1) (place "Knight2" {"B8" "G8"}) (place "Bishop2" {"C8" "F8"}) (place "Queen2" coord:"D8") (place "King2" coord:"E8" state:1)}) (play (if "SameTurn" (move Promote (last To) (piece {"Queen" "Knight" "Bishop" "Rook"}) Mover) (do (or (forEach Piece) ("Castling")) ifAfterwards:(not ("IsInCheck" "King" Mover))))) (end { ("Checkmate" "King") (if (or (no Moves Mover) (= (counter) 100)) (result Mover Draw))}))) END
Construct a Ludii game based on the following description The object of the game is to be the first player to occupy the opponent's castle with two of your own pieces, or, to capture all of your opponent's pieces while retaining two or more of your own pieces. Both knights and pawns can move either horizontally, vertically, or diagonally in three ways, as follows: One space in any direction (like a king in chess). This is called a plain move. A leaping move (called cantering) over an adjacent friendly piece to a vacant space immediately beyond. Multiple leaps over a player's own pieces are permitted. Cantering is always optional (never obligatory). A jumping move over an adjacent enemy piece to a vacant space immediately beyond. The enemy piece is captured and removed from the board. As in checkers, multiple jumps are allowed, and capturing is obligatory whenever it is possible. Pawns may make any of the three moves, but only one type of move per turn. Knights have a fourth option: a combination move consisting of a canter immediately followed by a jump (capture). This is called the knight's charge. The knight may, in this single move, perform multiple canters (or just one), followed by multiple jumps (or just one); but the canter(s) must precede the jump(s). A knight may not combine a plain move with a canter or a jump. ###
(define "GoalFilledby" (= (sites #2) (sites Occupied by:#1))) (define "NotEnoughPieceForTheMover" (and (>= (count Pieces Mover) 2) (= (count Pieces Next) 0))) (define "NotEnoughPieceForBothPlayer" (and (< (count Pieces Mover) 2) (< (count Pieces Next) 2))) (define "HopSequence" ("Hop" #1 #2 (then (if (and (not ("InTheGoal" (last To))) (can Move ("Hop" (last To) #2))) #3)))) (define "Hop" (move Hop (from #1) #2 (to if:(and (is In (to) "EmptyButNotEnemyGoal") (not (is Visited (to))))) #3)) (define "Step" (move Step (to if:(if ("InTheGoal" (from)) (and (is Empty (to)) ("InTheGoal" (to))) (is In (to) "EmptyButNotEnemyGoal"))))) (define "OnAnEnemy" (between if:("IsEnemyAt" (between)) (apply (remove (between))))) (define "WasAKnight" ("IsPieceAt" "Knight" Mover (last To))) (define "WasJumpingAFriend" (is Pending)) (define "MoveAgainAfterJumpingEnemy" (moveAgain)) (define "MoveAgainAfterJumpingFriend" (and (moveAgain) (set Pending))) (define "OnAFriend" (between if:("IsFriendAt" (between)))) (define "EmptyButNotEnemyGoal" (difference (sites Empty) (sites Mover))) (define "InTheGoal" (is In #1 (sites Next))) (game "Camelot" (players 2) (equipment { (board (keep (rectangle 12 16) (poly { {0 7} {1 10} {4 13} {12 13} {15 10} {16 7} {16 5} {15 2} {13 0} {3 0} {1 2} {0 5}}))) (piece "Pawn" Each (or (if (not ("InTheGoal" (from))) ("HopSequence" (from) "OnAFriend" "MoveAgainAfterJumpingFriend")) "Step")) (piece "Knight" Each (or (if (not ("InTheGoal" (from))) ("HopSequence" (from) "OnAFriend" "MoveAgainAfterJumpingFriend")) "Step")) (regions P1 (sites {"A6" "A7"})) (regions P2 (sites {"P6" "P7"}))}) (rules (start { (place "Pawn1" {"F4" "F5" "F6" "F7" "F8" "F9" "G5" "G6" "G7" "G8"}) (place "Knight1" {"F3" "G4" "G9" "F10"}) (place "Pawn2" {"K4" "K5" "K6" "K7" "K8" "K9" "J5" "J6" "J7" "J8"}) (place "Knight2" {"K3" "J4" "J9" "K10"})}) (play (if "SameTurn" (if "WasJumpingAFriend" (if "WasAKnight" (priority { ("HopSequence" (last To) "OnAnEnemy" "MoveAgainAfterJumpingEnemy") (or ("HopSequence" (last To) "OnAFriend" "MoveAgainAfterJumpingFriend") (move Pass))}) (or ("HopSequence" (last To) "OnAFriend" "MoveAgainAfterJumpingFriend") (move Pass))) ("HopSequence" (last To) "OnAnEnemy" "MoveAgainAfterJumpingEnemy")) (priority { (forEach Site (sites Mover) (if (= (who at:(site)) (mover)) (priority { ("HopSequence" (site) "OnAnEnemy" "MoveAgainAfterJumpingEnemy") (or ("HopSequence" (site) "OnAFriend" "MoveAgainAfterJumpingFriend") "Step")}))) (forEach Piece (move Hop "OnAnEnemy" (to if:(if ("InTheGoal" (from)) (and (is Empty (to)) ("InTheGoal" (to))) (is In (to) "EmptyButNotEnemyGoal"))) (then (if (and (not ("InTheGoal" (last To))) (can Move (hop (from (last To)) "OnAnEnemy" (to if:(is Empty (to)))))) "MoveAgainAfterJumpingEnemy")))) (forEach Piece)}))) (end { (if ("GoalFilledby" P1 P2) (result P1 Win)) (if ("GoalFilledby" P2 P1) (result P2 Win)) (if "NotEnoughPieceForTheMover" (result Mover Win)) (if "NotEnoughPieceForBothPlayer" (result Mover Draw))}))) END
Construct a Ludii game based on the following description 3x3 intersecting lines, with diagonals. Three pieces per player. Players alternate turns placing one of their pieces on the board. Once all of the pieces are placed, players take turns moving one of their pieces to an adjacent empty spot. The first player to make an orthogonal line with their pieces wins. ###
(game "Wure Dune" (players 2) (equipment { ("ThreeMensMorrisBoard") (hand Each) (piece "Marker" Each ("StepToEmpty" All))}) (rules (start (place "Marker" "Hand" count:3)) phases:{ (phase "Placement" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase ("HandEmpty" P2) "Movement")) ("PhaseMovePiece" "Movement")} (end ("Line3Win" Orthogonal)))) END
Construct a Ludii game based on the following description Goal: Scoring is based on your largest group (x2), with an extra point given to the first player to create a given size. The player with the largest group at the end of the game thus wins, and ties go to the first player to achieve this goal. Setup: Yellow starts by creating a set-up, then Orange begins actual play - Pass to skip this phase To create a set-up, Yellow first places a black blocking stone on any intersection and then a Yellow stone on an empty edge position. Orange then either begins play, or else exchanges the yellow piece with his own. Play: Players take turns placing their piece on an empty intersection that is either along the edge or next to another friendly piece, but never adjacent to an enemy position. These placements are subject to 2 possible additional restrictions selected by the players before starting: A) The number range of friendly neighbors the piece being placed may have: (Standard is to play with no restriction.) and/or B) The maximum number of neighbors that are allowed for the pieces against which the piece may be placed, with 2 being standard play. Ending the game. Play continues until both players pass consecutively, and then the final scores are compared. Board & size: Hexhex with edges alternating 4 and 6 Place next to any friendly piece(s), but not next to pieces that already have more than 2 neighbors. ###
(define "ScoreUpdate" (if (> (* 2 (size Group at:(last To))) (score Mover)) (if (> (* 2 (size Group at:(last To))) (score Next)) (set Score Mover (+ 1 (* 2 (size Group at:(last To))))) (set Score Mover (* 2 (size Group at:(last To))))))) (define "SitesTooDense" (forEach (sites Occupied by:Mover) if:(<= 3 (count Pieces Mover in:(sites Around (site)))))) (game "RootZone" (players 2) (equipment { (board (tri {4 6 4 7 4}) use:Vertex) (piece "Disc" Each) (piece "Disc" Neutral)}) (rules (play (if (= -1 (counter)) (or (move Pass) (move Add (piece "Disc0") (to (sites Board)))) (or { (if (= 1 (counter)) (move Select (from (sites Occupied by:Enemy)) (then (remove (last To) (then (add (to (last To)))))))) (move Pass) (move Add (to (difference (union (sites Outer) (sites Around (sites Occupied by:Mover))) (union { (sites Around (sites Occupied by:Enemy)) (sites Around "SitesTooDense") (sites Around (sites Occupied by:Neutral))})) if:(and (is Empty (to)) (>= 6 (count Pieces Mover in:(sites Around (to)))))) (then "ScoreUpdate"))}))) (end (if (all Passed) (byScore))))) END
Construct a Ludii game based on the following description 2x6 board. Five counters in each hole. Sowing occurs from any hole in the player's row in a clockwise direction. If the final counter lands into an empty hole, it is captured. If there is an unbroken line of holes behind it also having single counters, these are also captured. The player who captures the most counters wins. ###
(define "PiecesOwnedBy" (count Cell at:(handSite #1))) (game "Vai Lung Thlan" (players 2) (equipment { (mancalaBoard 2 6 store:None (track "Track" "5,W,N,E" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece "Seed" Shared) (hand Each)}) (rules (start (set Count 5 to:(sites Track))) (play (move Select (from (sites Mover) if:(< 0 (count at:(from)))) (then (sow if:(= (count at:(to)) 1) apply:(fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))) backtracking:True)))) (end ("MancalaByScoreWhen" (no Moves Mover))))) END
Modify the Ludii game according to the following option changes: P2 has 4 tries. -> The game is played on a 6x6 board. (define "AddWhiteHint" ("AddHint" "Disc1")) (define "AddBlackHint" ("AddHint" "Disc2")) (define "AddHint" (add (piece #1) (to (regionSite ("HintPositions") index:(value))))) (define "CombinationFound" (and (= 0 (count Sites in:(intersection (sites Empty) (sites Row ("RowToCheck"))))) (= "NumColumn" (count Sites in:(forEach (sites Row ("RowToCheck")) if:("PositionAndColorOK")))))) (define "PositionAndColorOK" (= (what at:(site)) (what at:(coord row:0 column:(column of:(site)))))) (define "CombinationToFindPlaced" (= 0 (count Sites in:(intersection (sites Empty) (sites Bottom))))) (define "CombinationPlaced" (= 0 (count Sites in:(intersection (sites Empty) (sites Row ("RowToPlace")))))) (define "ColorInSolution" (is In (what at:(regionSite (sites Bottom) index:(value))) (results from:(sites Row ("RowToPlace")) to:0 (what at:(from))))) (define "RightPositionAndColor" (= (what at:(regionSite (sites Row ("RowToPlace")) index:(value))) (what at:(coord row:0 column:(value))))) (define "HintPositions" (union (sites Row (+ "RowToPlace" 1)) (sites Row (- "RowToPlace" 1)))) (define "RowToCheck" (- "TopRow" (* 3 (- ("NumTry") 1)))) (define "RowToPlace" (- "TopRow" (* 3 ("NumTry")))) (define "NumTry" (var)) (define "TopRow" (+ 2 (* 3 (- "NumRow" 1)))) (define "NumColumn" 4) (define "NumRow" 4) (game "Mastermind" (players 2) (equipment { (board (merge { (rectangle (+ 1 "NumRow") "NumColumn") (shift "NumColumn" 0.75 (repeat "NumRow" 1 step:{{1 0} {0 1}} (poly {{0 0} {0 0.5} {0.5 0.5} {0.5 0}})))}) use:Vertex) (piece "Marker1" Shared) (piece "Marker2" Shared) (piece "Marker3" Shared) (piece "Marker4" Shared) (piece "Marker5" Shared) (piece "Marker6" Shared) (piece "Marker7" Shared) (piece "Marker8" Shared) (piece "Disc1" Shared) (piece "Disc2" Shared) (hand Shared size:8)}) (rules (start { (place "Marker1" (handSite Shared)) (place "Marker2" (handSite Shared 1)) (place "Marker3" (handSite Shared 2)) (place "Marker4" (handSite Shared 3)) (place "Marker5" (handSite Shared 4)) (place "Marker6" (handSite Shared 5)) (place "Marker7" (handSite Shared 6)) (place "Marker8" (handSite Shared 7))}) phases:{ (phase "Placement" P1 (play (move (from (sites Hand Shared)) (to (intersection (sites Empty) (sites Bottom))) copy:True (then (and { (set Hidden at:(last To) to:P2) (if ("CombinationToFindPlaced") (set Var 0) (moveAgain))}))))) (phase "Finding" P2 (play (move (from (sites Hand Shared)) (to (intersection (sites Empty) (sites Row ("RowToPlace")))) copy:True (then (and (moveAgain) (if ("CombinationPlaced") (and (forEach Value min:0 max:(- "NumColumn" 1) (if ("RightPositionAndColor") ("AddBlackHint") (if ("ColorInSolution") ("AddWhiteHint")))) (set Var (+ 1 ("NumTry"))) (then (if (or ("CombinationFound") (>= "NumTry" "NumRow")) (forEach Site (sites Bottom) (set Hidden at:(site) False to:P2)))))))))) (end { (if ("CombinationFound") (result P2 Win)) (if (>= "NumTry" "NumRow") (result P1 Win))}))})) ###
(define "AddWhiteHint" ("AddHint" "Disc1")) (define "AddBlackHint" ("AddHint" "Disc2")) (define "AddHint" (add (piece #1) (to (regionSite ("HintPositions") index:(value))))) (define "CombinationFound" (and (= 0 (count Sites in:(intersection (sites Empty) (sites Row ("RowToCheck"))))) (= "NumColumn" (count Sites in:(forEach (sites Row ("RowToCheck")) if:("PositionAndColorOK")))))) (define "PositionAndColorOK" (= (what at:(site)) (what at:(coord row:0 column:(column of:(site)))))) (define "CombinationToFindPlaced" (= 0 (count Sites in:(intersection (sites Empty) (sites Bottom))))) (define "CombinationPlaced" (= 0 (count Sites in:(intersection (sites Empty) (sites Row ("RowToPlace")))))) (define "ColorInSolution" (is In (what at:(regionSite (sites Bottom) index:(value))) (results from:(sites Row ("RowToPlace")) to:0 (what at:(from))))) (define "RightPositionAndColor" (= (what at:(regionSite (sites Row ("RowToPlace")) index:(value))) (what at:(coord row:0 column:(value))))) (define "HintPositions" (union (sites Row (+ "RowToPlace" 1)) (sites Row (- "RowToPlace" 1)))) (define "RowToCheck" (- "TopRow" (* 3 (- ("NumTry") 1)))) (define "RowToPlace" (- "TopRow" (* 3 ("NumTry")))) (define "NumTry" (var)) (define "TopRow" (+ 2 (* 3 (- "NumRow" 1)))) (define "NumColumn" 4) (define "NumRow" 6) (game "Mastermind" (players 2) (equipment { (board (merge { (rectangle (+ 1 "NumRow") "NumColumn") (shift "NumColumn" 0.75 (repeat "NumRow" 1 step:{{1 0} {0 1}} (poly {{0 0} {0 0.5} {0.5 0.5} {0.5 0}})))}) use:Vertex) (piece "Marker1" Shared) (piece "Marker2" Shared) (piece "Marker3" Shared) (piece "Marker4" Shared) (piece "Marker5" Shared) (piece "Marker6" Shared) (piece "Marker7" Shared) (piece "Marker8" Shared) (piece "Disc1" Shared) (piece "Disc2" Shared) (hand Shared size:8)}) (rules (start { (place "Marker1" (handSite Shared)) (place "Marker2" (handSite Shared 1)) (place "Marker3" (handSite Shared 2)) (place "Marker4" (handSite Shared 3)) (place "Marker5" (handSite Shared 4)) (place "Marker6" (handSite Shared 5)) (place "Marker7" (handSite Shared 6)) (place "Marker8" (handSite Shared 7))}) phases:{ (phase "Placement" P1 (play (move (from (sites Hand Shared)) (to (intersection (sites Empty) (sites Bottom))) copy:True (then (and { (set Hidden at:(last To) to:P2) (if ("CombinationToFindPlaced") (set Var 0) (moveAgain))}))))) (phase "Finding" P2 (play (move (from (sites Hand Shared)) (to (intersection (sites Empty) (sites Row ("RowToPlace")))) copy:True (then (and (moveAgain) (if ("CombinationPlaced") (and (forEach Value min:0 max:(- "NumColumn" 1) (if ("RightPositionAndColor") ("AddBlackHint") (if ("ColorInSolution") ("AddWhiteHint")))) (set Var (+ 1 ("NumTry"))) (then (if (or ("CombinationFound") (>= "NumTry" "NumRow")) (forEach Site (sites Bottom) (set Hidden at:(site) False to:P2)))))))))) (end { (if ("CombinationFound") (result P2 Win)) (if (>= "NumTry" "NumRow") (result P1 Win))}))})) END
Construct a global Ludii definition which fulfills the following requirements. If the mover is filling all the spaces of a region with his pieces, the mover is winning. This ludemeplex can be used only in an ending condition. ###
(define "FillWin" (if (= (sites Occupied by:Mover) #1) (result Mover Win))) END