prompt
stringlengths 71
4.65k
| completion
stringlengths 34
5.1k
|
---|---|
Modify the Ludii game according to the following option changes:
Each row has 12 holes. -> Each row has 14 holes.
(define "AllSitesNoMoreThanOne" (all Sites (sites Mover "Home") if:(>= 1 (count at:(site))))) (define "NextHole" ("NextSiteOnTrack" #2 from:#1 "Track")) (define "NoPiece" (all Sites (sites Player "Home") if:(= 0 (count at:(site))))) (define "Columns" 12) (game "Nsolo" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "Track1" "0,E,N1,W" loop:True P1) (track "Track2" "24,E,N1,W" loop:True P2)}) (regions "Home" P1 (sites Track "Track1")) (regions "Home" P2 (sites Track "Track2")) (regions "Inner" P1 (difference (sites Track "Track1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "Track2") (sites Top))) (piece "Seed" Shared)}) (rules (start (set Count 2 to:(union { (sites Bottom) (sites Top) (difference (sites P1 "Inner") (sites Right)) (difference (sites P2 "Inner") (sites Left))}))) (play (if (and ("SameTurn") (= (var "Replay") Undefined)) (move Remove (sites Next "Home")) (if ("AllSitesNoMoreThanOne") (move Select (from (sites Mover "Home") if:(and (is Occupied (from)) (is Empty ("NextHole" (from) 1)))) (then (sow "Track" owner:(mover)))) (move Select (from (if ("SameTurn") (sites {(var "Replay")}) (sites Mover "Home")) if:(> (count at:(from)) 1)) (then (sow "Track" owner:(mover) apply:(if (< 1 (count at:(to))) (if (and (is In (to) (sites Mover "Inner")) (is Occupied ("OppositePit" (to)))) (and (remove ("OppositePit" (to))) (if (is Occupied ("OppositeOuterPit" (to))) (and { (moveAgain) (set Var "Replay" Undefined) (remove ("OppositeOuterPit" (to)))}))) (and (moveAgain) (set Var "Replay" (to))))))))))) (end (forEach NonMover if:("NoPiece") (result Player Loss)))))
###
| (define "AllSitesNoMoreThanOne" (all Sites (sites Mover "Home") if:(>= 1 (count at:(site))))) (define "NextHole" ("NextSiteOnTrack" #2 from:#1 "Track")) (define "NoPiece" (all Sites (sites Player "Home") if:(= 0 (count at:(site))))) (define "Columns" 14) (game "Nsolo" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "Track1" "0,E,N1,W" loop:True P1) (track "Track2" "28,E,N1,W" loop:True P2)}) (regions "Home" P1 (sites Track "Track1")) (regions "Home" P2 (sites Track "Track2")) (regions "Inner" P1 (difference (sites Track "Track1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "Track2") (sites Top))) (piece "Seed" Shared)}) (rules (start (set Count 2 to:(union { (sites Bottom) (sites Top) (difference (sites P1 "Inner") (sites Right)) (difference (sites P2 "Inner") (sites Left))}))) (play (if (and ("SameTurn") (= (var "Replay") Undefined)) (move Remove (sites Next "Home")) (if ("AllSitesNoMoreThanOne") (move Select (from (sites Mover "Home") if:(and (is Occupied (from)) (is Empty ("NextHole" (from) 1)))) (then (sow "Track" owner:(mover)))) (move Select (from (if ("SameTurn") (sites {(var "Replay")}) (sites Mover "Home")) if:(> (count at:(from)) 1)) (then (sow "Track" owner:(mover) apply:(if (< 1 (count at:(to))) (if (and (is In (to) (sites Mover "Inner")) (is Occupied ("OppositePit" (to)))) (and (remove ("OppositePit" (to))) (if (is Occupied ("OppositeOuterPit" (to))) (and { (moveAgain) (set Var "Replay" Undefined) (remove ("OppositeOuterPit" (to)))}))) (and (moveAgain) (set Var "Replay" (to))))))))))) (end (forEach NonMover if:("NoPiece") (result Player Loss))))) END |
Construct a Ludii game based on the following description
Movement is the same as regular amazons. You can move or shoot as many spaces as you want in any orthogonal or diagonal direction. With a hex board you have 6 orthogonal lines of movement (green) as well as 6 diagonal lines of movement (blue).
Like in the original, Amazons still cannot move or shoot through other arrows or other amazons. However the diagonals are a little bit more tricky than the original. If the two orthogonal spaces next to the diagonal line are blocked, than the amazon can no longer use (or continue along) this diagonal. This is important because it reduces the movement capabilities of the amazons and allows a wall of connected arrows to become impenetrable.
One final rule, in order to balance the game (white has first move advantage). On whites first turn he/she can only move an amazon but not shoot an arrow afterwards. This prevents potential too strong opening moves.
The first player to block the opponent wins.
###
| (define "QueenMove" (or (move Slide) (move Slide Diagonal (between if:(is Empty (between))) (to if:("ToEmptyAndBlocked") (apply if:("NotBlockedOrNotMaxSlide")))) #1)) (define "ToEmptyAndNotBlocked" (and (is Empty (to)) (!= 2 ("NumPiecesBetweenDiagonalStep")))) (define "NotBlockedOrNotMaxSlide" (or (= (between) (to)) (!= 2 ("NumPiecesBetweenDiagonalStep")))) (define "ToEmptyAndBlocked" (and (is Empty (to)) (= 2 ("NumPiecesBetweenDiagonalStep")))) (define "NumPiecesBetweenDiagonalStep" (count Sites in:(forEach (intersection (sites Incident Cell of:Cell at:(if (!= (between) Off) (between) (from))) (sites Incident Cell of:Cell at:(to))) if:(is Occupied (site))))) (game "Hex Amazons" (players 2) (equipment { (board (hex 7)) (piece "Queen" Each ("QueenMove" (then (moveAgain)))) (piece "Dot" Neutral)}) (rules (start { (place "Queen1" {"B2" "G2" "E5" "B7"}) (place "Queen2" {"L12" "G12" "L7" "I9"})}) phases:{ (phase "Opening" P1 (play (forEach Piece "QueenMove")) (nextPhase Mover "Playing")) (phase "Playing" (play (if ("SameTurn") (or (move Shoot (piece "Dot0")) (move Shoot (piece "Dot0") Diagonal (between if:(is Empty (between))) (to if:("ToEmptyAndNotBlocked")))) (forEach Piece))))} (end ("BlockWin")))) END |
Construct a Ludii game based on the following description
8x8 board. Two players. Pieces and movement are as follows: King x1, placed on the fifth space from the left on one edge of the board: Moves one space orthogonally or diagonally. Pawns x8, arranged along the row in front of the king: moves one space forward orthogonally or one space forward diagonally to capture. The opponent's pieces are placed in the same position on the opposite side of the board. If the King can be taken on the next turn it is in check, it must not remain in check on the next turn. If the king cannot move out of check, checkmate is declared and the opponent wins.
###
| (game "Shatr ikh Padan" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) ("ChessPawn" "Pawn") ("ChessKing" "King_noCross")}) (rules (start { (place "Pawn1" (sites Row 1)) (place "Pawn2" (sites Row 6)) (place "King_noCross1" coord:"E1") (place "King_noCross2" coord:"D8")}) (play (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King_noCross" Mover)))) (end ("Checkmate" "King_noCross")))) END |
Construct a Ludii game based on the following description
The game is played on a board with twelve points on either side. The points form a continuous track in a horseshoe shape; both players progress in an anti-clockwise direction. Fifteen pieces per player, two six-sided dice. Each player begins with two pieces on the rightmost point on the opposite side of the board. Players move according to the number on each die by moving one piece the number on one die and other the number on the other die, or by moving one piece the total number of both die. Further pieces are entered based on the roll of the dice, the point after the one with the two pieces on it at the beginning being counted as the first point. When entering captured pieces, however, the point where the two pieces start is counted as the first point. The two pieces which start on the board cannot be moved until all of the remaining pieces have been entered on the board. No more than one piece may rest on a point on the first half of the board, except for the two which start and also on the leftmost point on the opposite side of the board from where the player sits. When a piece lands on a point occupied by an opponent's piece, the opponent's piece is removed from the board and must be entered again. Players must enter captured pieces before continuing to move the other pieces on the board. When a piece is captured in the opponent's starting quadrant, a point must be left open or with only one piece, thus allowing the opponent to enter their piece. The player to move all of their pieces off the board wins.
###
| (define "EmptyOrFriednIfNotSpecialRegion" (and (not (is In (to) (sites Mover "OnePieceMax"))) (or ("IsFriendAt" (to)) (is Empty (to))))) (define "OneEnemyPiece" (and ("IsSingletonStack" (to)) ("IsEnemyAt" (to)))) (define "CaptureEnemyPiece" (if ("IsEnemyAt" (to)) (move (from (to)) (to ("BarSite" Next))))) (define "EmptySiteIfOneSpecialRegion" (and (is Empty (to)) (is In (to) (sites Mover "OnePieceMax")))) (define "BarSite" (mapEntry "Bar" #1)) (define "BarEmpty" (is Empty ("BarSite" #1))) (define "SiteToMoveOnTrack" (trackSite Move steps:(pips))) (define "RemoveAPiece" (move Remove (from))) (define "SiteToEnterCapturePiece" ("NextSiteOnTrack" (pips) from:("BarSite" Mover))) (define "SiteToEnter" ("NextSiteOnTrack" (pips) from:(mapEntry "StartTrack" Mover))) (game "Tawula" (players 2) (equipment { ("BackgammonBoard" "BackgammonTracksSameDirectionOppositeCornersWithBars2") (dice d:6 num:2) (piece "Disc" Each (if (or (!= (from) (mapEntry "StartTrack" Mover)) (and (= (from) (mapEntry "StartTrack" Mover)) ("HandEmpty" Mover))) (forEach Die if:("DieNotUsed") (if ("IsOffBoard" "SiteToMoveOnTrack") "RemoveAPiece" (move (from) (to "SiteToMoveOnTrack" if:(or (or ("EmptySiteIfOneSpecialRegion") ("EmptyOrFriednIfNotSpecialRegion")) ("OneEnemyPiece")) (apply ("CaptureEnemyPiece")))))))) (hand Each) (map "Bar" {(pair P1 6) (pair P2 19)}) (map "StartTrack" {(pair P1 25) (pair P2 0)}) (regions "OnePieceMax" P1 (sites {14..18 20..24})) (regions "OnePieceMax" P2 (sites {1..5 7..11}))}) (rules (start { (place Stack "Disc1" 25 count:2) (place Stack "Disc2" 0 count:2) (place Stack "Disc1" (handSite P1) count:13) (place Stack "Disc2" (handSite P2) count:13)}) (play ("RollEachNewTurnMove" (or (if ("BarEmpty" Mover) (forEach Piece top:True) (forEach Die if:("DieNotUsed") (move (from ("BarSite" Mover)) (to ("SiteToEnterCapturePiece") if:(or (or ("EmptySiteIfOneSpecialRegion") ("EmptyOrFriednIfNotSpecialRegion")) ("OneEnemyPiece")) (apply ("CaptureEnemyPiece")))))) (if ("HandOccupied" Mover) (forEach Die if:("DieNotUsed") (move (from (handSite Mover)) (to ("SiteToEnter") if:(or (is Empty (to)) ("OneEnemyPiece")) (apply ("CaptureEnemyPiece")))))) (then ("ReplayNotAllDiceUsed"))))) (end ("EscapeWin")))) END |
Describe the mechanics of the following Ludii game
(define "GoBack" (if (and (!= (to) (regionSite (sites #1 "StartQuadrant") index:0)) (not ("IsFriendAt" (regionSite (sites #1 "StartQuadrant") index:0)))) (regionSite (sites #1 "StartQuadrant") index:0) (if (and (!= (to) (regionSite (sites #1 "StartQuadrant") index:1)) (not ("IsFriendAt" (regionSite (sites #1 "StartQuadrant") index:1)))) (regionSite (sites #1 "StartQuadrant") index:1) (if (and (!= (to) (regionSite (sites #1 "StartQuadrant") index:2)) (not ("IsFriendAt" (regionSite (sites #1 "StartQuadrant") index:2)))) (regionSite (sites #1 "StartQuadrant") index:2) (if (and (!= (to) (regionSite (sites #1 "StartQuadrant") index:3)) (not ("IsFriendAt" (regionSite (sites #1 "StartQuadrant") index:3)))) (regionSite (sites #1 "StartQuadrant") index:3) (if (and (!= (to) (regionSite (sites #1 "StartQuadrant") index:4)) (not ("IsFriendAt" (regionSite (sites #1 "StartQuadrant") index:4)))) (regionSite (sites #1 "StartQuadrant") index:4) (if (and (!= (to) (regionSite (sites #1 "StartQuadrant") index:5)) (not ("IsFriendAt" (regionSite (sites #1 "StartQuadrant") index:5)))) (regionSite (sites #1 "StartQuadrant") index:5) (regionSite (sites #1 "StartQuadrant") index:6)))))))) (define "NoGoBack" ("NoSites" (difference (sites #1 "StartQuadrant") (union (sites {(to)}) (sites Occupied by:Mover))))) (define "NextSiteFrom" ("NextSiteOnTrack" #2 from:#1)) (game "Fallas" (players 2) (equipment { ("TableBoard" "TableTracksOpposite") (dice d:6 num:3) (piece "Disc" Each (forEach Die if:("DieNotUsed") (if ("IsOffBoard" ("NextSiteFrom" (from) (pips))) (move Remove (from)) (move (from (from)) (to ("NextSiteFrom" (from) (pips)) if:("NoEnemyOrOnlyOne" (to)) (apply (if ("IsEnemyAt" (to)) (if ("NoGoBack" Next) (and (remove (to)) (trigger "StartQuadrantFull" Next)) (fromTo (from (to)) (to ("GoBack" Next))))))))) (then "ReplayNotAllDiceUsed"))) (regions "StartQuadrant" P1 (sites {6..11})) (regions "StartQuadrant" P2 (sites {18..23}))}) (rules (start { (place Stack "Disc1" 7 count:13) (place Stack "Disc1" 11 count:2) (place Stack "Disc2" 19 count:13) (place Stack "Disc2" 23 count:2)}) (play ("RollEachNewTurnMove" (forEach Piece))) (end { ("EscapeWin") (if (is Triggered "StartQuadrantFull" P1) (result P2 Win)) (if (is Triggered "StartQuadrantFull" P2) (result P1 Win)) (if (and ("NewTurn") (no Moves Mover)) (result Mover Loss))})))
###
| 2x12 board, divided in half. Spaces on each side take the form of semi-circular sockets, into which the pieces fit. Fifteen pieces per player. Play begins with thirteen pieces on the seventh point of the track, and two pieces on the twelfth point. Three six-sided dice. Players move pieces according to the value of each individual die. Play moves around the board through starting from the quadrant where the pieces begin, through the one where the opponent's pieces begin, and then through the remaining quadrant on the opponent's side of the board, where the pieces are borne off the board. When a piece lands on a spot occupied by a single piece of the opponent, the opponent's piece is sent back to its starting quadrant. If a player's piece is sent back to start, but all of the spaces in their starting quadrant are occupied by the opponent's pieces, the player loses automatically. Also, any roll that allows the player to only move to spaces occupied by the opponent results in an automatic loss for the player. Otherwise, the first player to bear off all their pieces wins. END |
Construct a Ludii game based on the following description
Keryo-Pente is played on a 19x19 Go board. White goes first, and plays their first move on the centre point (unless playing Freestyle). After the opening, players alternate playing one stone of their colour onto any empty point. If their placement results in a pair or a line of three enemy stones being sandwiched between two of their own stones, those enemy stones are captured. The first player to form an orthogonal or diagonal line of five (or more) of their stones, or to capture 15 enemy stones, wins the game. Played on a 19x19 board. Open at the centre point.
###
| (define "Custodial" (custodial (from (last To)) All (between if:(is Next (who at:(between))) (apply (remove (between)))) (to if:(and (or (= 3 (count Steps Vertex All (last To) (to))) (= 4 (count Steps Vertex All (last To) (to)))) (is Mover (who at:(to))))) (then (addScore Mover 1)))) (game "Keryo-Pente" (players 2) (equipment { (board (square 19) use:Vertex) (piece "Ball" Each)}) (rules (start (set Score Each 0)) phases:{ (phase "Opening" (play (move Add (to (sites "J10")))) (nextPhase "General")) (phase "General" (play (move Add (to (sites Empty)) (then "Custodial"))))} (end { (if (is Line 5 All) (result Mover Win)) (if (> (score Mover) 14) (result Mover Win))}))) END |
Modify the Ludii game according to the following option changes:
The game is played with 7 holes per row. -> The game is played with 8 holes per row.
(define "Column" 7) (define "PiecesOwnedBy" (count Cell at:(handSite #1))) (game "Um el-Bil" (players 2) (equipment { (mancalaBoard 2 "Column" store:None (track "Track" "0,E,N,W" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece "Seed" Shared) (hand Each)}) (rules (start (set Count 4 to:(sites Track))) phases:{ (phase "Opening" (play (move Select (from (- ("Column") 1)) (then (sow if:(= (count at:(to)) 1) apply:(fromTo (from (to)) (to (handSite Mover)) count:1))))) (nextPhase "Play")) (phase "Play" (play (move Select (from (sites Mover) if:(< 0 (count at:(from)))) (then (sow if:(= (count at:(to)) 1) apply:(fromTo (from (to)) (to (handSite Mover)) count:1))))))} (end ("MancalaByScoreWhen" (all Sites (sites Board) if:(is Empty (site)))))))
###
| (define "Column" 8) (define "PiecesOwnedBy" (count Cell at:(handSite #1))) (game "Um el-Bil" (players 2) (equipment { (mancalaBoard 2 "Column" store:None (track "Track" "0,E,N,W" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece "Seed" Shared) (hand Each)}) (rules (start (set Count 4 to:(sites Track))) phases:{ (phase "Opening" (play (move Select (from (- ("Column") 1)) (then (sow if:(= (count at:(to)) 1) apply:(fromTo (from (to)) (to (handSite Mover)) count:1))))) (nextPhase "Play")) (phase "Play" (play (move Select (from (sites Mover) if:(< 0 (count at:(from)))) (then (sow if:(= (count at:(to)) 1) apply:(fromTo (from (to)) (to (handSite Mover)) count:1))))))} (end ("MancalaByScoreWhen" (all Sites (sites Board) if:(is Empty (site))))))) END |
Construct a Ludii game based on the following description
5x6 or 6x6 board. Twelve pieces per player. Players take turns placing pieces on the board. Once all the pieces are on the board, players may move one piece orthogonally one space during their turn. Players cannot create a line of more than three in an orthogonal direction, and cannot make a line of three during the placement phase. If three pieces are in an orthogonal line, they cannot be moved again. If a player makes three rows before the opponent makes one, it is an automatic win.
The game is played on a 5x6 board.
###
| (game "Shiva" (players 2) (equipment { (board (rectangle 5 6)) (hand Each) (piece "Marker" Each (if (not (is Line 3 Orthogonal through:(from))) ("StepToEmpty" Orthogonal (then (if (is Line 3 Orthogonal) (if ("IsOffBoard" (value Player Mover)) (set Value Mover 1) (set Value Mover (+ (value Player Mover) 1))))))))}) (rules (start (place "Marker" "Hand" count:12)) phases:{ (phase "Placement" (play (do (move (from (handSite Mover)) (to (sites Empty))) ifAfterwards:(not (is Line 3 Orthogonal)))) (nextPhase (and ("HandEmpty" P1) ("HandEmpty" P2)) "Movement")) (phase "Movement" (play (do (forEach Piece) ifAfterwards:(not (is Line 4 Orthogonal)))))} (end (if (= (value Player Mover) 3) (result Mover Win))))) END |
Modify the Ludii game according to the following option changes:
A size 5 board is currently selected -> A size 6 board is currently selected
(game "Gyre" (players 2) (equipment { (board (hex 5)) (piece "Disc" Each)}) (rules (meta (swap)) (play (move Add (to (sites Empty)))) (end (if (>= (count Sites in:(union (sites Outer) (sites {(centrePoint)}))) (max (results from:(difference (sites Board) (sites Group at:(last To))) to:2 (* (to) (count Sites in:(intersection (union (sites Outer) (sites {(centrePoint)})) (sites Group at:(from) if:(not (is In (to) (sites Group at:(last To))))))))))) (result Mover Win)))))
###
| (game "Gyre" (players 2) (equipment { (board (hex 6)) (piece "Disc" Each)}) (rules (meta (swap)) (play (move Add (to (sites Empty)))) (end (if (>= (count Sites in:(union (sites Outer) (sites {(centrePoint)}))) (max (results from:(difference (sites Board) (sites Group at:(last To))) to:2 (* (to) (count Sites in:(intersection (union (sites Outer) (sites {(centrePoint)})) (sites Group at:(from) if:(not (is In (to) (sites Group at:(last To))))))))))) (result Mover Win))))) END |
Modify the Ludii game according to the following option changes:
Each row has 4 holes. -> Each row has 5 holes.
(define "PiecesOwnedBy" (count Cell at:(handSite #1))) (game "I" (players 2) (equipment { (mancalaBoard 2 4 store:None (track "Track" "0,E,N,W" loop:True)) (piece "Seed" Shared) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (hand Each)}) (rules (start (set Count 4 to:(sites Track))) (play (move Select (from (sites Mover) if:(> (count at:(from)) 1)) (then (sow apply:(if (or (= 2 (count at:(to))) (= 3 (count at:(to)))) (and { (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))) (if (!= (to) (ahead (to) E)) (if (or (= 2 (count at:(ahead (to) E))) (= 3 (count at:(ahead (to) E)))) (fromTo (from (ahead (to) E)) (to (handSite Mover)) count:(count at:(ahead (to) E))))) (if (!= (to) (ahead (to) W)) (if (or (= 2 (count at:(ahead (to) W))) (= 3 (count at:(ahead (to) W)))) (fromTo (from (ahead (to) W)) (to (handSite Mover)) count:(count at:(ahead (to) W)))))})))))) (end ("MancalaByScoreWhen" (and (no Moves P1) (no Moves P2))))))
###
| (define "PiecesOwnedBy" (count Cell at:(handSite #1))) (game "I" (players 2) (equipment { (mancalaBoard 2 5 store:None (track "Track" "0,E,N,W" loop:True)) (piece "Seed" Shared) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (hand Each)}) (rules (start (set Count 4 to:(sites Track))) (play (move Select (from (sites Mover) if:(> (count at:(from)) 1)) (then (sow apply:(if (or (= 2 (count at:(to))) (= 3 (count at:(to)))) (and { (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))) (if (!= (to) (ahead (to) E)) (if (or (= 2 (count at:(ahead (to) E))) (= 3 (count at:(ahead (to) E)))) (fromTo (from (ahead (to) E)) (to (handSite Mover)) count:(count at:(ahead (to) E))))) (if (!= (to) (ahead (to) W)) (if (or (= 2 (count at:(ahead (to) W))) (= 3 (count at:(ahead (to) W)))) (fromTo (from (ahead (to) W)) (to (handSite Mover)) count:(count at:(ahead (to) W)))))})))))) (end ("MancalaByScoreWhen" (and (no Moves P1) (no Moves P2)))))) END |
Construct a Ludii game based on the following description
An isosceles triangle, with a line intersecting the two equal sides, another line drawn from the apex to the midpoint of this line. A line extending below the base, and another line perpendicular to this one. One player plays as the tiger, and another player as three goats. The tiger begins at the apex of the triangle, the goats on the three points on the bottom line (the two ends and the place where it intersects with the other line. Players alternate turns moving a piece to an empty adjacent spot. The tiger may capture a goat by hopping over it to an empty adjacent spot along the lines of the board. The tiger wins by capturing all of the goats; the goats win by blocking the tiger from being able to move.
###
| (game "Bam Blang Beh Khla" (players 2) (equipment { (board (add (remove (merge { (shift 0.4 -1 (scale 0.6 (rectangle 1 3))) (shift 0.2 0 (scale 0.8 2 (wedge 2))) (shift 0 -0.5 (scale 1 2.5 (wedge 2)))}) edges:{{3 8} {3 7} {3 9}}) edges:{{6 9} {4 7} {1 8}}) use:Vertex) (piece "Tiger" P1 (or "HopCapture" "StepToEmpty")) (piece "Goat" P2 "StepToEmpty")}) (rules (start { (place "Tiger1" (sites Top)) (place "Goat2" (sites Bottom))}) (play (forEach Piece)) (end ("NoMovesP1NoPiecesP2")))) END |
Describe the mechanics of the following Ludii game
(define "NextSite" ("NextSiteOnTrack" 1 #1)) (define "FirstSiteToSow" (if (is Mover P1) (intersection (sites Right) (sites Row 1)) (intersection (sites Left) (sites Row 2)))) (define "PiecesOwnedBy" (count in:(sites #1 "Home"))) (define "Columns" 6) (game "Nchuwa" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "TrackCCW1" "0,E,N1,W" loop:True P1) (track "TrackCCW2" "12,E,N1,W" loop:True P2)}) (regions "Home" P1 (sites Track "TrackCCW1")) (regions "Home" P2 (sites Track "TrackCCW2")) (regions "Inner" P1 (sites Row 1)) (regions "Inner" P2 (sites Row 2)) (regions "Outer" P1 (sites Row 0)) (regions "Outer" P2 (sites Row 3)) (piece "Seed" Shared)}) (rules (start (set Count 2 to:(union (sites P1 "Home") (sites P2 "Home")))) phases:{ (phase "Opening1" (play (move Select (from ("FirstSiteToSow")) (then (sow "TrackCCW" owner:(mover) apply:(set Value Mover ("NextSite" from:(to))))))) (nextPhase Mover "Opening2")) (phase "Opening2" (play (move Select (from (value Player Mover)) (then (sow "TrackCCW" owner:(mover) apply:(if (= (count at:("NextSite" from:(to))) 0) (set Value Mover Off) (set Value Mover ("NextSite" from:(to)))))))) (nextPhase Mover ("IsOffBoard" (value Player Mover)) "Opening3")) (phase "Opening3" (play (move (from (forEach (sites Mover "Inner") if:(!= 0 (count at:(site))))) (to (forEach (sites Mover "Outer") if:(= 0 (count at:(site))))) count:2)) (nextPhase Mover "Opening4")) (phase "Opening4" (play (move Remove (sites Next "Home"))) (nextPhase Mover "Opening5")) (phase "Opening5" (play (move Remove (sites Next "Home"))) (nextPhase Mover "Playing")) (phase "Playing" (play (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover "Home")) if:(> (count at:(from)) 0)) (then (sow "TrackCCW" owner:(mover) apply:(if (= (count at:(to)) 1) (if (is In (to) (sites Mover "Inner")) (if (> (count at:("OppositePit" (to))) 0) (and (remove ("OppositePit" (to))) (if (> (count at:("OppositeOuterPit" (to))) 0) (remove ("OppositeOuterPit" (to))))))) (moveAgain)))))))} (end (forEach Player if:(= 0 ("PiecesOwnedBy" Player)) (result Player Loss)))))
###
| 4x6, 9, 12, or 15. Two counters in each hole. Players begin by sowing from the rightmost hole in the inner row, placing one counter in each of the first two holes, then picking up the counters from the next hole and continuing to sow until the next hole after the sowing is empty (this should be the hole from which the sowing began). Each player then takes two counters from any of the holes in their inner row and places them in any empty hole in the outer row. The player then captures the counters in the opponent's opposite holes. The player then removes the contents of any one of the opponent's holes. Once both players have done this, the main phase begins. Players move by sowing from any of the holes on their side of the board in an anti-clockwise direction. When the final counter lands in an occupied hole, these are picked up and sowing continues. When they fall into an empty hole, the sowing ends. If this hole is in the inner row, the contents of the opponent's opposite hole in the inner row are also taken. If there are also counters in the opponent's outer row opposite, these are also taken. The player may also capture the contents of any other hole in the inner or outer row. Single counters may be moved. The player who captures all of their opponent's counters wins. Each player has 6 holes by row. END |
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 (counselor): One square diagonally. 2 x Rook (rook): Any number of spaces orthogonally. 2 x Fil (elephant): Two squares diagonally, jumping over the first. Cannot capture another Fil. 2 x Knight: Moves as a chess knight. 8 x Pawn: Moves one space forward orthogonally; one space forward diagonally to capture. No en passant. Promoted to Fers when reaching the eighth rank. No castling. An opponent's piece is captured by moving a player's own piece onto a space occupied by the opponent's piece. When a Shah can be captured on the next turn by an opponent's piece, it is in check. The Shah must not be in check at the end of the player's turn. If this is not possible, it is checkmate and the opponent wins. Stalemate results in a win for that player causing it.
###
| (game "Medieval Chess" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) ("ChessPawn" "Pawn" ~ (then ("ReplayInMovingOn" (sites Mover "Promotion")))) ("ChessRook" "Rook") ("ChessKing" "King_noCross") (piece "Bishop_noCross" Each (move Hop Diagonal (between if:True) (to if:(or (is Empty (to)) ("IsEnemyAt" (to))) (apply (remove (to)))))) ("ChessKnight" "Knight") (piece "Ferz_noCross" Each ("StepToNotFriend" Diagonal)) (regions "Promotion" P1 (sites Top)) (regions "Promotion" P2 (sites Bottom))}) (rules (start { (place "Pawn1" (sites Row 1)) (place "Pawn2" (sites Row 6)) (place "Rook1" {"A1" "H1"}) (place "Knight1" {"B1" "G1"}) (place "Bishop_noCross1" {"C1" "F1"}) (place "Ferz_noCross1" coord:"D1") (place "King_noCross1" coord:"E1") (place "Rook2" {"A8" "H8"}) (place "Knight2" {"B8" "G8"}) (place "Bishop_noCross2" {"C8" "F8"}) (place "Ferz_noCross2" coord:"D8") (place "King_noCross2" coord:"E8")}) (play (if "SameTurn" (move Promote (last To) (piece "Ferz_noCross") Mover) (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King_noCross" Mover))))) (end { ("Checkmate" "King_noCross") (if (= (count Pieces Next) 1) (result Mover Win)) ("BlockWin")}))) END |
Construct a global Ludii definition which fulfills the following requirements.
Returns the next site on a track.
###
| (define "NextSiteOnTrack" (trackSite Move #2 #3 steps:#1)) END |
Construct a Ludii game based on the following description
Played on a Go-like board (6x6 or larger, but a 19x19 go board is ideal) with two colors of stones (usually white and black). Black goes first by placing one stone. Play continues with each player playing two stones per turn. The first player to make a line of six in a row wins.
###
| (game "Connect6" (players 2) (equipment { (board (square 19) use:Vertex) (piece "Marker" Each)}) (rules phases:{ (phase "Opening" (play (move Add (to (sites Empty)))) (nextPhase "Playing")) (phase "Playing" (play (move Add (to (sites Empty)) (then (if (is Even (count Moves)) (moveAgain))))) (nextPhase "Playing"))} (end (if (is Line 6 All) (result Mover Win))))) END |
Construct a Ludii game based on the following description
Played on the Fox and Geese board, but the top arm of the cross is surrounded by a double line, indicating it is a fortress, in which one player puts two officers. The opponent has 24 pieces, which occupy the points outside the fortress. Officers may capture one of the opponent's pieces by hopping over it to an empty space immediately on the opposite side of the opponent's piece. If the officer does not capture when it is possible, it is huffed. The soldiers win by occupying all of the points in the fortress or by blocking the officers from being able to move; the officers win by capturing enough soldiers to prevent this.
###
| (define "RememberSiteWithPossibleCapture" (forEach Site (sites From (forEach Piece "Marker" ("HopCapture"))) (remember Value "From" (site)))) (game "Asalto" (players 2) (equipment { ("CrossBoard" 3 7 use:Vertex diagonals:Alternating) (piece "Marker" P1 (or ("HopCapture") "StepToEmpty")) (piece "Marker" P2 "StepToEmpty")}) (rules (start { (place "Marker1" (sites {"C6" "E6"})) (place "Marker2" (union (expand (union (sites Right) (sites Left))) (expand (sites Bottom) steps:3)))}) (play (if (is Mover P1) (do ("RememberSiteWithPossibleCapture") next:(forEach Piece) (then (and (if (!= 0 (count Sites in:(sites (values Remembered "From")))) (if (= 1 (count Steps (last From) (last To))) (and (forEach Site (sites (values Remembered "From")) (remove (site))) (if (is In (last From) (sites (values Remembered "From"))) (remove (last To)))))) (forget Value All)))) (forEach Piece))) (end { (if (no Pieces P2) (result P1 Win)) (if (or (or (no Pieces P1) (no Moves P1)) (all Sites (expand (sites Top) steps:2) if:(= (who at:(site)) P2))) (result P2 Win))}))) END |
Construct a Ludii game based on the following description
4x7-15 (odd number only) board. One piece in each hole in the outer row. Four palm branches used as dice, with one side white and the other side yellow. The throws are equal to the number of white sides that fall up; when only yellow sides are up, the score is 6. When a player throws 1, 4, or 6, the player throws again. Players take turns throwing, until one throws 1, and that player begins to play. Each player moves in a boustrophedon path, from left to right in the row closest to them, right to left in the second row, and left to right in the third row. From there, the player may move again into the second row and continue as before, or move into the fourth row, proceeding from right to left, as long as at least one of the opponent's pieces remains there. The piece may enter the third row again upon reaching the end of the fourth row, but only when the player has either no pieces in their first row, or one group of pieces in the same spot (see below). When a piece has moved out of the fourth row, it may not enter it again during the game. When a player's piece lands in the same spot as another piece belonging to the player, the pieces may move as one piece. When a player's piece lands on a space occupied by an opponent's, piece, the opponent's piece is captured. The player who captures all of the opponent's pieces wins. Each row has 7 holes.
###
| (define "Move" (or { (if ("IsInTrack" (site) "HomeTrack") (move (from (site)) (to ("NextSiteOnTrack" ("ThrowValue") from:(site) "HomeTrack") "CaptureEnemyPiece") count:(count at:(site)))) (if ("IsInTrack" (site) "MiddleTrack") (move (from (site)) (to ("NextSiteOnTrack" ("ThrowValue") from:(site) "MiddleTrack") "CaptureEnemyPiece") count:(count at:(site)))) (if ("IsInTrack" (site) "EnemyTrack") (if (if (is In (site) (sites Next "Home")) True (and (!= 0 ("CountPiecesInHome" Next)) ("PieceDidNotGoToEnemyHome" (site)))) (move (from (site)) (to ("NextSiteOnTrack" ("ThrowValue") from:(site) "EnemyTrack") "CaptureEnemyPiece") count:(count at:(site)) (then (if (and (is In (last To) (sites Next "Home")) ("PieceDidNotGoToEnemyHome" (last To))) ("PieceGoesToEnemyHome" (last To)))))))})) (define "IsInTrack" (is In #1 (sites Track Mover #2))) (define "PieceDidNotGoToEnemyHome" (= 0 (state at:#1))) (define "PieceGoesToEnemyHome" (set State at:#1 1)) (define "CountPiecesInHome" (count Pieces #1 in:(sites #1 "Home"))) (define "CaptureEnemyPiece" (apply if:("IsEnemyAt" (to)) (remove (to) count:(count at:(to))))) (define "Tab" (= 1 ("ThrowValue"))) (define "SpecialThrows" (is In ("ThrowValue") (sites {1 4 6}))) (define "ThrowValue" (mapEntry (count Pips))) (game "Tab" (players 2) (equipment { (board (rectangle 4 7) { (track "HomeTrack1" "0,E,N1,W" P1 directed:True) (track "HomeTrack2" "27,W,S1,E" P2 directed:True) (track "MiddleTrack" "13,W,N1,E" loop:True) (track "EnemyTrack1" "14,E,N1,W,S1,E" P1 directed:True) (track "EnemyTrack2" "13,W,S1,E,N1,W" P2 directed:True)} use:Vertex) (piece "Stick" Each) (regions "AllSites" (sites Board)) ("StickDice" 4) (map "Throw" {(pair 0 6) (pair 1 1) (pair 2 2) (pair 3 3) (pair 4 4)}) (regions "Home" P1 (sites Bottom)) (regions "Home" P2 (sites Top))}) (rules (start { (place "Stick1" (sites Bottom)) (place "Stick2" (sites Top))}) phases:{ (phase "InitGame" (play ("RollMove" (move Pass) (then (if ("Tab") (moveAgain))))) (nextPhase ("Tab") "Play")) (phase "Play" (play ("RollMove" (forEach Site (sites Occupied by:Mover) ("Move")) (then (if ("SpecialThrows") (moveAgain))))))} (end ("CaptureAll" Next)))) END |
Construct a Ludii game based on the following description
8x8 board. One player plays with the following pieces: Raja (x1): moves one space in any direction; Mantri (x1): moves any distance orthogonally or diagonally; Ushtra (x2): moves diagonally any distance; Vaha (x2): move orthogonally one space and then diagonally another, jumping over any intervening pieces; Danti (x2): moves orthogonally any distance. Padati (x8): move forward orthogonally one space or one space diagonally forward to capture. When a Padati reaches the opposite edge of the board, it is promoted to a Mantri and is moved immediately to the space it last moved from. The opponent plays as one Raja, which can move as any of the other pieces. This Raja cannot move to a space adjacent to the opponent's Raja. An opponent's piece is captured by moving one of the player's own pieces onto the space occupied by the opponent's piece. If the Raja can be captured on the opponent's next turn, it is in check. The Raja cannot be in check at the end of the player's turn. If this is impossible, the opponent wins. Check and checkmate rules apply to the player with a single Raja.
###
| (game "Cittabhramanrpasya Khelanam" (players {(player S) (player N)}) (equipment { (board (square 8)) (piece "Pawn" P1 (or "StepForwardToEmpty" ("StepToEnemy" (directions {FR FL})) (then (if (is In (last To) (sites Mover "Promotion")) (and (promote (last To) (piece "Ferz_noCross") Mover) (fromTo (from (last To)) (to (last From)))))))) (piece "Rook" P1 ("SlideCapture" ~ Orthogonal)) (piece "King_noCross" P1 ("StepToNotFriend")) (piece "Elephant" P1 ("SlideCapture" ~ Diagonal)) (piece "Knight" P1 ("LeapCapture" "KnightWalk")) (piece "Ferz_noCross" P1 ("SlideCapture")) (piece "King_noCross" P2 (or (move Leap "KnightWalk" (to if:(and (not ("IsFriendAt" (to))) (not (is In (to) (sites Around (where "King-noCross" Next))))) (apply (remove (to))))) (move Slide (to if:("IsEnemyAt" (to)) (apply if:(not (is In (to) (sites Around (where "King-noCross" Next)))) (remove (to))))))) (regions "Promotion" P1 (sites Bottom))}) (rules (start { (place "Pawn1" (sites Row 6)) (place "Rook1" {"A8" "H8"}) (place "Knight1" {"B8" "G8"}) (place "Elephant1" {"C8" "F8"}) (place "Ferz_noCross1" coord:"E8") (place "King_noCross1" coord:"D8") (place "King_noCross2" coord:"E1")}) (play (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King_noCross" Mover)))) (end ("Checkmate" "King_noCross")))) END |
Describe the mechanics of the following Ludii game
(define "MadeACompleteCircuit" (if (= 1 (value Player Mover)) (is In (value Piece at:(where "Marker" Mover)) (sites Track "TrackCW" from:("NextSite" (last From) "TrackCW") to:(last To))) (is In (value Piece at:(where "Marker" Mover)) (sites Track "TrackCCW" from:("NextSite" (last From) "TrackCCW") to:(last To))))) (define "MoveOn" (if ("IsNotOffBoard" #1) (if (or (is In #1 (sites Empty)) ("IsEnemyAt" #1)) (move (from (from) level:(level)) (to #1 ("HittingCapture" (value Piece at:(to)))))) #2)) (define "RememberSelectedTrack" (then (if ("IsOffBoard" (value Player Mover)) #1))) (define "SelectCCW" (set Value Mover 2)) (define "SelectCW" (set Value Mover 1)) (define "SiteToMoveOnTrackCCW" ("NextSiteOnTrack" ("ThrowValue") "TrackCCW")) (define "SiteToMoveOnTrackCW" ("NextSiteOnTrack" ("ThrowValue") "TrackCW")) (define "NextSite" ("NextSiteOnTrack" 1 from:#1 #2)) (define "SiteToMoveOnSelectedTrack" (if (= (value Player Mover) 2) ("NextSiteOnTrack" ("ThrowValue") "TrackCCW") ("NextSiteOnTrack" ("ThrowValue") "TrackCW"))) (define "ThrowValue" (count Pips)) (game "Kawasukuts" (players 2) (equipment { ("FortyStonesWithFourGapsBoard" { (track "TrackCW" {39 35 33 31 29 27 25 23 21 19 38 17 15 13 11 9 7 5 3 1 37 0 2 4 6 8 10 12 14 16 36 18 20 22 24 26 28 30 32 34} loop:True) (track "TrackCCW" {39 34 32 30 28 26 24 22 20 18 36 16 14 12 10 8 6 4 2 0 37 1 3 5 7 9 11 13 15 17 38 19 21 23 25 27 29 31 33 35} loop:True)}) (regions "Gates" (sites {36..39})) (piece "Marker" Each (if ("IsOffBoard" (value Player Mover)) (or ("MoveOn" ("SiteToMoveOnTrackCW") ("RememberSelectedTrack" ("SelectCW"))) ("MoveOn" ("SiteToMoveOnTrackCCW") ("RememberSelectedTrack" ("SelectCCW")))) ("MoveOn" "SiteToMoveOnSelectedTrack"))) (dice d:2 facesByDie:{{0 2} {0 3} {0 10}} num:3) (hand Each)}) (rules (start (place "Marker" "Hand")) phases:{ (phase "Placement" (play (move (from (handSite Mover)) (to (sites "Gates")) (then (set Value at:(last To) (last To))))) (nextPhase Mover "Playing")) (phase "Playing" (play ("RollMove" (forEach Piece))) (end (if (and (!= 0 ("ThrowValue")) ("MadeACompleteCircuit")) (result Mover Win))))}))
###
| Forty stones, arranged in a circle, with larger gaps (doors) between the stones after every ten. The gaps between the stones are the playing spaces. Any number of players. One stick per player. Three sticks used as dice, one marked with two notches, one marked with three notches, the other marked with ten notches. The value of the throw is the number of notches which land face up. Players move their sticks around the board, beginning at one of the doors. Players may choose in which direction to proceed around the board. When a player lands on the same space as an opponent, the opponent's piece is sent back to the starting door. The first player to complete the circuit of the board wins. The game has 2 players. END |
Construct a global Ludii definition which fulfills the following requirements.
Defines a regular cross board tilled by squares (example: Pachisi).
###
| (define "CrossBoard" (board ("CrossGraph" #1 #2 #4) #3)) END |
Construct a Ludii game based on the following description
The game is played on a board with twelve points on either side. The points form a continuous track in a horseshoe shape; each player progresses in opposite directions (one from their bottom right to the top right, the other from their bottom left to their top left). Each player has fifteen pieces, which all begin on the first point of their track. Three dice are used. Players move according to the number on each die by moving one piece the value on one die then another piece the value on the other die, or by moving one piece the value of one die and then the value of the other. When a player rolls triples, the throw is played three times. If a player throws a pair among the three dice, they play the dice as normal if the third die has a greater value than the value which appears twice. If the value of the third die is lower, the player plays the doubles twice and the single value once. When a piece lands on a point with a single piece belonging to the opponent, the opponent's piece is removed from the board and must enter again from the quadrant of the board from which it began. When a piece reaches the end of the track, it may bear off the board with a throw greater than the number of points remaining in the track. The player who bears off all their pieces first wins.
###
| (define "Move" (forEach Site (sites Occupied by:Mover) (if ("CanEscape" #1) ("RemoveAPiece") (move (from (site)) (to #1 if:("NoEnemyOrOnlyOne" (to)) ("CaptureToBar")))) #2)) (define "CaptureToBar" ("HittingCapture" ("Bar" (next)))) (define "CanStillLowerDie" (or (or (= (count MovesThisTurn) (value Player Mover)) (and (= (count MovesThisTurn) 0) (< (value Player Mover) 0))) (and (!= (count MovesThisTurn) 0) (= (value Player Mover) 0)))) (define "CanStillPlayDouble" (not (and (= (value Player Mover) 0) (!= (count MovesThisTurn) 0)))) (define "LowerValue" (if (and (= (face 26) (face 27)) (> (face 26) (face 28))) (face 28) (if (and (= (face 26) (face 28)) (> (face 26) (face 27))) (face 27) (face 26)))) (define "DoubleValue" (if (and (= (face 26) (face 27)) (> (face 26) (face 28))) (face 26) (if (and (= (face 26) (face 28)) (> (face 26) (face 27))) (face 26) (face 27)))) (define "TwoDiceEqualLastLower" (or { (and (= (face 26) (face 27)) (> (face 26) (face 28))) (and (= (face 26) (face 28)) (> (face 26) (face 27))) (and (= (face 27) (face 28)) (> (face 27) (face 26)))})) (define "UpdateCounterDoublePlay" (and (if (< (count MovesThisTurn) 4) (moveAgain)) (if (< (value Player Mover) 3) (if (< (value Player Mover) 0) (set Value Mover 1) (set Value Mover (+ 1 (value Player Mover)))) (set Value Mover 0)))) (define "UpdateCounterTriplePlay" (if (< (value Player Mover) 8) (and (moveAgain) (if (< (value Player Mover) 0) (set Value Mover 1) (set Value Mover (+ 1 (value Player Mover))))) (set Value Mover 0))) (define "Bar" (mapEntry #1)) (define "CanEscape" ("IsOffBoard" #1)) (define "AllPieceEscaped" (no Pieces Mover)) (define "RemoveAPiece" (move Remove (site))) (define "NextSiteFromDistDouble" ("NextSiteOnTrack" ("DoubleValue") from:#1)) (define "NextSiteFromDistLower" ("NextSiteOnTrack" ("LowerValue") from:#1)) (define "NextSiteFromDistTripleDice" ("NextSiteOnTrack" (/ (count Pips) 3) from:#1)) (define "NextSiteFrom" ("NextSiteOnTrack" (pips) from:#1)) (game "Garanguet" (players 2) (equipment { ("BackgammonBoard" ("BackgammonTracksWithBar")) (dice num:3) (piece "Disc" Each) (map {(pair 1 6) (pair 2 19)}) (regions "Home" P1 { 7..12}) (regions "Home" P2 { 20..25})}) (rules (start { (place Stack "Disc1" 12 count:15) (place Stack "Disc2" 25 count:15)}) (play ("RollEachNewTurnMove" (if (all DiceEqual) ("Move" ("NextSiteFromDistTripleDice" (site)) (then ("UpdateCounterTriplePlay"))) (if ("TwoDiceEqualLastLower") (or (if ("CanStillPlayDouble") ("Move" ("NextSiteFromDistDouble" (site)) (then ("UpdateCounterDoublePlay")))) (if ("CanStillLowerDie") ("Move" ("NextSiteFromDistLower" (site)) (then (if (< (count MovesThisTurn) 4) (moveAgain) (set Value Mover 0)))))) (forEach Die if:("DieNotUsed") ("Move" ("NextSiteFrom" (site)) (then ("ReplayNotAllDiceUsed")))))))) (end (if ("AllPieceEscaped") (result Mover Win))))) END |
Construct a global Ludii definition which fulfills the following requirements.
Defines all the equipment used in most of the draught games.
###
| (define "DraughtsEquipment" (equipment { (board #1 #2) (piece "Counter" P1 N) (piece "Counter" P2 S) (piece "DoubleCounter" Each) (regions P1 (sites Bottom)) (regions P2 (sites Top)) #3})) END |
Construct a Ludii game based on the following description
10x10 board. Pieces move as follows: Raja (x1): moves one space in any direction; Crown Prince (placed to the left of the Raja, x1): moves like any of the other pieces; Kotwal (Police Chief, placed to the right of the Raja, x1): Moves like the Elephant and the Vaha; Mantri (x1): moves any distance orthogonally or diagonally; Elephant (x2): moves diagonally any distance; Vaha (two placed in front of the Queens, x4): move orthogonally one space and then diagonally another, jumping over any intervening pieces; Chariot (x2): moves orthogonally any distance; Queen (placed in front of the Raja and Crown Prince, x2): move one square orthogonally or diagonally; Padati (placed in the second row, except for the central two squares, x8): move forward orthogonally one space or one space diagonally forward to capture. When a Padati reaches the opposite edge of the board, it is promoted to a Mantri and is moved immediately to the space it last moved from. An opponent's piece is captured by moving one of the player's own pieces onto the space occupied by the opponent's piece. If the Raja can be captured on the opponent's next turn, it is in check. The Raja cannot be in check at the end of the player's turn. If this is impossible, the opponent wins. When a player is reduced to only their Raja and Padati, the opponent wins. In the case of a stalemate, the player in stalemate may remove any of the opponent's pieces (except their Raja).
###
| (game "Shataranja" ("TwoPlayersNorthSouth") (equipment { (board (square 10)) ("ChessPawn" "Pawn" ~ (then (if (is In (last To) (sites Mover "Promotion")) (and (promote (last To) (piece "Bishop_noCross") Mover) (fromTo (from (last To)) (to (last From))))))) ("ChessRook" "Rook") ("ChessKing" "King_noCross") ("ChessRook" "Elephant") ("ChessKnight" "Knight") ("ChessKing" "Queen") (piece "Ferz_noCross" Each (or ("SlideCapture") ("LeapCapture" "KnightWalk"))) ("ChessQueen" "Bishop_noCross") (piece "Commoner" Each (or ("SlideCapture" Diagonal) ("LeapCapture" "KnightWalk"))) (regions "Promotion" P1 (sites Top)) (regions "Promotion" P2 (sites Bottom))}) (rules (start { (place "Pawn1" (difference (sites Row 1) (sites {"E2" "F2"}))) (place "Pawn2" (difference (sites Row 8) (sites {"E2" "F2"}))) (place "Queen1" {"E2" "F2"}) (place "Queen2" {"E9" "F9"}) (place "Rook1" {"A1" "J1"}) (place "Knight1" {"B1" "I1" "E3" "F3"}) (place "Elephant1" {"C1" "H1"}) (place "Ferz_noCross1" coord:"E1") (place "Commoner1" coord:"G1") (place "Bishop_noCross1" coord:"D1") (place "King_noCross1" coord:"F1") (place "Rook2" {"A10" "J10"}) (place "Knight2" {"B10" "I10" "E8" "F8"}) (place "Elephant2" {"C10" "H10"}) (place "Ferz_noCross2" coord:"F10") (place "Commoner2" coord:"D10") (place "Bishop_noCross2" coord:"G10") (place "King_noCross2" coord:"E10")}) (play (if (no Moves Mover) (move Remove (difference (sites Occupied by:Next) (where "King_noCross" Next))) (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King_noCross" Mover))))) (end { ("Checkmate" "King_noCross") (if (and { (no Pieces Next "Ferz_noCross") (no Pieces Next "Queen") (no Pieces Next "Knight") (no Pieces Next "Bishop_noCross") (no Pieces Next "Elephant") (no Pieces Next "Rook") (no Pieces Next "Commoner")}) (result Mover Win))}))) END |
Construct a Ludii game based on the following description
The game begins with the pieces set out as in the diagram. 2. The king's side takes the first move, play then alternating between players. 3. In his turn a player moves one of his pieces along a straight line, horizontally or vertically. 4. No piece may land on another, nor is there any jumping. 5. Only the king can land on the central space, though other pieces can pass through it. 6. Only the king may move to the spaces occupied by the fixed men: see rule 11. 7. The king is captured by surrounding him on all four sides by counts. If he is next to the central square or the edge of the board, he may be captured by surrounding him on the other three sides. 8. Dukes and counts are captured by surrounding them with enemies on two opposite sides, horizontally or vertically. Two or three men may be captured simultaneously if each falls between the moving piece and another enemy. 9. The fixed men in the corners may be used to capture pieces by either player. 10. A piece may come to rest voluntarily between two others, without being captured. 11. If the king moves to one of the squares occupied by the fixed men, he has escaped the board and wins the game. 12. If the king is captured by his opponents, then he has lost the game. The rules are describing with the Cyningstan ruleset.
###
| (define "JarlButNotTheExpandedCentre" (and ("IsPieceAt" "Jarl" P2 (between)) (not (is In (between) (expand origin:(centrePoint) Orthogonal))))) (define "JarlAndExpandedCentre" (and ("IsPieceAt" "Jarl" P2 (between)) (is In (between) (expand origin:(centrePoint) Orthogonal)))) (define "AFriendOrTheCentre" (or ("IsFriendAt" (to)) (is In (to) (sites Centre)))) (define "EmptyButNotFortress" (and (not (is In (between) (sites "Fortresses"))) (is Empty (between)))) (define "JarlWasCaptured" (is Triggered "Surrounded" P2)) (define "CaptureJarl" (apply (trigger "Surrounded" P2))) (define "Custodial" (custodial (from (last To)) Orthogonal (between (max 1) if:("IsPieceAt" #1 Next (between)) (apply (remove (between)))) (to if:(or { ("IsFriendAt" (to)) (is In (to) (sites "Fortresses")) (and (is In (to) (sites Centre)) (is Empty (to)))})))) (game "Alea Evangelii" (players 2) (equipment { (board (square 19)) (regions "Fortresses" (expand (sites Corners))) (piece "Thrall" P1 (move Slide Orthogonal (between if:"EmptyButNotFortress") (to (apply if:(!= (to) (centrePoint)))) (then (or { ("Custodial" "Thrall2") (surround (from (last To)) Orthogonal (between if:"JarlAndExpandedCentre" "CaptureJarl") (to if:"AFriendOrTheCentre")) (custodial (from (last To)) Orthogonal (between if:"JarlButNotTheExpandedCentre" "CaptureJarl") (to if:("IsFriendAt" (to))))})))) (piece "Thrall" P2 (move Slide Orthogonal (between if:"EmptyButNotFortress") (to (apply if:(!= (to) (centrePoint)))) (then ("Custodial" "Thrall1")))) (piece "Jarl" P2 (move Slide Orthogonal (to (apply if:(!= (to) (centrePoint))))))}) (rules (start { (place "Thrall1" {"C1" "F1" "N1" "Q1" "A3" "F3" "N3" "S3" "H4" "L4" "G5" "I5" "K5" "M5" "A6" "C6" "Q6" "S6" "E7" "O7" "D8" "P8" "E9" "O9" "E11" "O11" "D12" "P12" "E13" "O13" "A14" "C14" "Q14" "S14" "G15" "I15" "K15" "M15" "H16" "L16" "A17" "F17" "N17" "S17" "C19" "F19" "N19" "Q19"}) (place "Thrall2" {"J4" "F6" "N6" "J7" "I8" "K8" "H9" "J9" "L9" "D10" "G10" "I10" "K10" "M10" "P10" "H11" "J11" "L11" "I12" "K12" "J13" "F14" "N14" "J16"}) (place "Jarl2" (centrePoint))}) (play (forEach Piece)) (end { ("PieceTypeReachWin" "Jarl2" (sites "Fortresses") P2) (if "JarlWasCaptured" (result P1 Win))}))) END |
Modify the Ludii game according to the following option changes:
Played on a size 3 board. -> Played on a size 4 board.
Min group size 3. -> Min group size 4.
(define "GroupCount" (+ (count Groups if:(= (who at:(to)) P1) min:3) (count Groups if:(= (who at:(to)) P2) min:3))) (game "Odd" (players 2) (equipment { (board (rotate 90 (hex 3))) (piece "Marker" Each) (hand Shared size:2)}) (rules (start { (place "Marker1" (handSite Shared)) (place "Marker2" (handSite Shared 1))}) (play (move (from (sites Hand Shared)) (to (sites Empty)) copy:True)) (end (if (is Full) (if (is Odd (+ (count Groups if:(= (who at:(to)) P1) min:3) (count Groups if:(= (who at:(to)) P2) min:3))) (result P1 Win)) (result P2 Win)))))
###
| (define "GroupCount" (+ (count Groups if:(= (who at:(to)) P1) min:4) (count Groups if:(= (who at:(to)) P2) min:4))) (game "Odd" (players 2) (equipment { (board (rotate 90 (hex 4))) (piece "Marker" Each) (hand Shared size:2)}) (rules (start { (place "Marker1" (handSite Shared)) (place "Marker2" (handSite Shared 1))}) (play (move (from (sites Hand Shared)) (to (sites Empty)) copy:True)) (end (if (is Full) (if (is Odd (+ (count Groups if:(= (who at:(to)) P1) min:4) (count Groups if:(= (who at:(to)) P2) min:4))) (result P1 Win)) (result P2 Win))))) END |
Modify the Ludii game according to the following option changes:
The board has 1 row. -> The board has 2 rows.
The board has 2 columns. -> The board has 3 columns.
The player has 2 safe teleportations. -> The player has 3 safe teleportations.
2 robots. -> 3 robots.
(define "SafeTeleportation" (fromTo (from (where (id "Human"))) (to (sites Random (difference (sites Empty) (sites Around (sites Occupied by:Shared))))) (then ("RobotThreat")))) (define "Teleportation" (fromTo (from (where (id "Human"))) (to (sites Random)) (then ("RobotThreat")))) (define "KillRobotsIfColliding" (forEach Site (sites Occupied by:Shared) (if (>= (count at:(site)) 2) (and (remove (site)) (add (piece "Rubble0") (to (site))))))) (define "RobotThreat" (forEach Site (sites Occupied by:Shared) ("GoCloser" NE ("GoCloser" NW ("GoCloser" SW ("GoCloser" SE ("GoCloser" E ("GoCloser" W ("GoCloser" N ("GoCloser" S)))))))))) (define "GoCloser" (if ("CloserToHuman" #1) ("MoveRobot" #1) #2)) (define "MoveRobot" (if ("IsPieceAt" "Rubble" Neutral (ahead (site) #1)) (remove (site)) (fromTo (from (site)) (to (ahead (site) #1) (apply (if ("IsPieceAt" "Human" P1 (to)) (remove (to)))))))) (define "CloserToHuman" (> (count Steps Orthogonal (site) (where (id "Human"))) (count Steps Orthogonal (ahead (site) #1) (where (id "Human"))))) (define "NumSafeTeleportation" 2) (define "NumRobots" 2) (game "Chase" (players 1) (equipment { (board (rectangle 1 2)) (piece "Human" P1 ("StepToEmpty" ~ (then ("RobotThreat")))) (piece "Robot" Shared) (piece "Rubble" Neutral)}) (rules (start { (place Random {"Human"}) (place Random {"Robot"} count:("NumRobots")) (set Score P1 ("NumSafeTeleportation"))}) (play (or { (forEach Piece) (move Pass (then ("Teleportation"))) (if (< 0 (score P1)) (move Select (from (where (id "Human"))) (then (and (set Score Mover (- (score P1) 1)) ("SafeTeleportation")))))} (then ("KillRobotsIfColliding")))) (end { (if (no Pieces Mover) (result Mover Loss)) (if (no Pieces "Robot") (result Mover Win))})))
###
| (define "SafeTeleportation" (fromTo (from (where (id "Human"))) (to (sites Random (difference (sites Empty) (sites Around (sites Occupied by:Shared))))) (then ("RobotThreat")))) (define "Teleportation" (fromTo (from (where (id "Human"))) (to (sites Random)) (then ("RobotThreat")))) (define "KillRobotsIfColliding" (forEach Site (sites Occupied by:Shared) (if (>= (count at:(site)) 2) (and (remove (site)) (add (piece "Rubble0") (to (site))))))) (define "RobotThreat" (forEach Site (sites Occupied by:Shared) ("GoCloser" NE ("GoCloser" NW ("GoCloser" SW ("GoCloser" SE ("GoCloser" E ("GoCloser" W ("GoCloser" N ("GoCloser" S)))))))))) (define "GoCloser" (if ("CloserToHuman" #1) ("MoveRobot" #1) #2)) (define "MoveRobot" (if ("IsPieceAt" "Rubble" Neutral (ahead (site) #1)) (remove (site)) (fromTo (from (site)) (to (ahead (site) #1) (apply (if ("IsPieceAt" "Human" P1 (to)) (remove (to)))))))) (define "CloserToHuman" (> (count Steps Orthogonal (site) (where (id "Human"))) (count Steps Orthogonal (ahead (site) #1) (where (id "Human"))))) (define "NumSafeTeleportation" 3) (define "NumRobots" 3) (game "Chase" (players 1) (equipment { (board (rectangle 2 3)) (piece "Human" P1 ("StepToEmpty" ~ (then ("RobotThreat")))) (piece "Robot" Shared) (piece "Rubble" Neutral)}) (rules (start { (place Random {"Human"}) (place Random {"Robot"} count:("NumRobots")) (set Score P1 ("NumSafeTeleportation"))}) (play (or { (forEach Piece) (move Pass (then ("Teleportation"))) (if (< 0 (score P1)) (move Select (from (where (id "Human"))) (then (and (set Score Mover (- (score P1) 1)) ("SafeTeleportation")))))} (then ("KillRobotsIfColliding")))) (end { (if (no Pieces Mover) (result Mover Loss)) (if (no Pieces "Robot") (result Mover Win))}))) END |
Construct a global Ludii definition which fulfills the following requirements.
Checks if a player has a less or equal number of pieces and lose. This ludemeplex can be used only in an ending condition.
###
| (define "HavingLessPiecesLoss" (if (<= (count Pieces #1) #2) (result #1 Loss))) END |
Construct a Ludii game based on the following description
Pieces move one space orthogonally. Pieces are captured through the custodial capture move, but a piece moving in between two other pieces is not automatically captured. The goal of the player with the king is to reach the edge of the board. The goal of the other player is to capture the king. The game is played with the common rules.
###
| (define "EmptyButNotTheCentre" (and (not (is In (to) (sites Centre))) (is Empty (to)))) (define "JarlWasCaptured" (is Triggered "Surrounded" P2)) (define "JarlIsCaptured" (apply (trigger "Surrounded" P2))) (game "ArdRi" (players 2) (equipment { (board (square 7)) (piece "Thrall" P1 (move Step Orthogonal (to if:"EmptyButNotTheCentre") (then (or { ("CustodialCapturePieceType" "Thrall2" Orthogonal (max 1)) (surround (from (last To)) Orthogonal (between if:(= (what at:(between)) (id "Jarl2")) "JarlIsCaptured") (to if:(or ("IsFriendAt" (to)) (is In (to) (sites Centre)))))})))) (piece "Thrall" P2 (move Step Orthogonal (to if:"EmptyButNotTheCentre") (then ("CustodialCapturePieceType" "Thrall1" Orthogonal (max 1))))) (piece "Jarl" P2 ("StepToEmpty" Orthogonal (then ("CustodialCapturePieceType" "Thrall1" Orthogonal (max 1)))))}) (rules (start { (place "Thrall1" {"C1" "D1" "E1" "D2" "A3" "A4" "A5" "B4" "G3" "G4" "G5" "F4" "D6" "C7" "D7" "E7"}) (place "Thrall2" (difference (expand (sites Centre)) (sites Centre))) (place "Jarl2" (centrePoint))}) (play (forEach Piece)) (end { ("PieceTypeReachWin" "Jarl2" (sites Outer) P2) (if "JarlWasCaptured" (result P1 Win))}))) END |
Construct a Ludii game based on the following description
2x12 board, with spaces as points, divided in two. Fifteen pieces per player. Two six-sided die. Players move according to the number on each die by moving one piece the value on one die then another piece the value on the other die, or by moving one piece the value of one die and then the value of the other. The lowest value of the dice must be played; if it cannot, the player does not move. When a player throws doubles, they play the values on each die, as well as the values on the opposite side of the dice (I.e., double 6 if double 1 is thrown, 5 if 2, 3 if 4). However, the values on the bottom can only be played if all of the top values are played. The first double throw is only played once, but every subsequent double throw is played twice, and the top values must be played twice before using the bottom values. Bottom values do not have to be played, or only some of the bottom values may be played if the player wishes. In addition, an extra throw is granted for the second and subsequent throws of doubles. Players enter their pieces onto opposite sections of the board, and proceed around the board toward the section where the opponent enters the board, and then bearing pieces off the board. A player may not land on a point with two or more of the opponent's pieces. A player's piece may land on a point with a single opponent's piece. The opponent's piece is removed from the board and must enter again. The first player to remove all of their pieces from the board wins.
###
| (define "MoveOppositeDice" (forEach Value (values Remembered "Opposite") (if ("IsOffBoard" ("NextSiteFrom" (from) (value))) (move Remove (from)) (move (from (from)) (to ("NextSiteFrom" (from) (value)) if:("NoEnemyOrOnlyOne" (to)) (apply (and (if ("IsEnemyAt" (to)) (fromTo (from (to)) (to (handSite Next)))) (forget Value "Opposite" (value)))))) (then (if (!= 0 (size Array (values Remembered "Opposite"))) (moveAgain) (and { (set Var "PlayOpposite" 0) (set Pending) (moveAgain)})))))) (define "DoubleDieValue" (face 28)) (define "NextSiteFrom" ("NextSiteOnTrack" #2 from:#1)) (game "Contrare Puff" (players 2) (equipment { ("BackgammonBoard" "BackgammonTracksWithHands") (dice d:6 num:2) (piece "Disc" Each (forEach Die replayDouble:(= 1 (value Player Mover)) if:("DieNotUsed") (if ("IsOffBoard" ("NextSiteFrom" (from) (pips))) (move Remove (from)) (move (from (from)) (to ("NextSiteFrom" (from) (pips)) if:("NoEnemyOrOnlyOne" (to)) ("HittingCapture" (handSite (who at:(to))))))) (then (if (not (all DiceUsed)) (moveAgain) (if (= 1 (value Player Mover)) (if (and (all DiceEqual) (= 0 (size Array (values Remembered)))) (and (moveAgain) (set Var "PlayOpposite" 1))) (set Value Mover 1)))))) (hand Each)}) (rules (start { (place Stack "Disc1" (handSite P1) count:15) (place Stack "Disc2" (handSite P2) count:15)}) (play (do (if (or (is Pending) ("NewTurn")) (roll)) next:(if (= 1 (var "PlayOpposite")) (or { (forEach Piece ("MoveOppositeDice") top:True) (forEach Piece container:(mover) ("MoveOppositeDice") top:True) (move Pass (then (and { (forget Value "Opposite" All) (set Var "PlayOpposite" 0) (set Pending) (moveAgain)})))}) (do (if (and { (= 0 (count MovesThisTurn)) (all DiceEqual) (= 1 (value Player Mover))}) (and (remember Value "Opposite" (- 7 ("DoubleDieValue"))) (remember Value "Opposite" (- 7 ("DoubleDieValue"))))) next:(or (forEach Piece top:True) (forEach Piece container:(mover) top:True)))))) (end ("EscapeWin")))) END |
Describe the mechanics of the following Ludii game
(define "Icosahedron" (board (add (remove (tri Limping 4) vertices:{0 1 3 4 5 6 7 8 9 10 11 13 15 17 18 19 20 23 24 25 26 27 31 32 34 35 36 37 39 40 42 43 44 45 46 47}) edges:{ {0 1} {0 2} {0 3} {0 9} {0 10} {1 2} {1 4} {1 6} {6 11} {7 11} {8 11} {1 9} {2 3} {3 5} {3 8} {3 10} {6 9} {8 10} {9 10} {9 11} {10 11}}) use:Vertex)) (define "HexCell" (board (hex Hexagon 6) use:Cell)) (define "HexHex" (board (tri Hexagon 6) use:Vertex)) (define "TriSquare" (board (tiling T33434 (- 6 2)) use:Vertex)) (define "HexLimp" (board (tri Limping (- 6 1)) use:Vertex)) (define "SquareGrid" (board (square 6) use:Vertex)) (define "BoardUsed" "HexHex") (define "Connection" Orthogonal) (define "PiePhase" (phase "Pie" (play (if (is Mover P1) (or { (move Add (piece (mover)) (to (sites Empty))) (move Add (piece (next)) (to (sites Empty))) (move Pass)} (then (if (< 0 (counter)) (set NextPlayer (player (next))) (moveAgain)))) (or (move Propose "Accept Pie Offer and Move" (then (set NextPlayer (player (mover))))) (move Propose "Swap Pieces" (then (do (forEach Site (sites Occupied by:Mover) (remember Value (site))) next:(forEach Site (sites Occupied by:Next) (and (remove (site)) (add (piece (mover)) (to (site))))) (then (forEach Value (values Remembered) (and (remove (value)) (add (piece (next)) (to (value)))) (then (and (forget Value All) (set NextPlayer (player (next))))))))))))) (nextPhase (or (is Proposed "Swap Pieces") (is Proposed "Accept Pie Offer and Move")) "Placement"))) (define "SpecialOrthoScoring" (and (set Score Mover (* (max (sizes Group Orthogonal Mover)) (count Pieces Next))) (set Score Next (* (max (sizes Group Orthogonal Next)) (count Pieces Mover))))) (define "SpecialScoring" (and (set Score Mover (* (max (sizes Group Orthogonal Mover)) (count Pieces Next))) (set Score Next (* (max (sizes Group Orthogonal Next)) (count Pieces Mover))))) (define "SimpleOrthoScoring" (set Score Mover (max (sizes Group Orthogonal Mover)))) (define "SimpleScoring" (set Score Mover (max (sizes Group Orthogonal Mover)))) (game "Faraday" (players 2) (equipment { "BoardUsed" (piece "Ball" P1) (piece "Ball" P2)}) (rules (meta (no Repeat Positional)) (start (set Score Each 0)) phases:{ "PiePhase" (phase "Placement" (play (move Add (piece (mover)) (to (sites Empty) if:(or (<= 3 (count Pieces Next in:(sites Around (to) Orthogonal))) (< 0 (- (count Pieces Next in:(sites Around (to) Orthogonal)) (count Pieces Mover in:(sites Around (to) Orthogonal)))))) (then (and { ("SimpleOrthoScoring") (set Var "Last2Move" (mover)) (if (not (no Moves Mover)) (moveAgain))})))) (end (if (all Passed) { (if (!= (score Mover) (score Next)) (byScore)) (if (and (= (score Mover) (score Next)) (= (var "Last2Move") (mover))) (result Mover Loss)) (if (and (= (score Mover) (score Next)) (!= (var "Last2Move") (mover))) (result Mover Loss))} (byScore))))}))
###
| Goal: End the game with the highest scoring group. A group scores one point for each stone it contains.
Definitions: A group, as in Go, is every stone that can be reached from a selected stone through a series of adjacent stones of the same color.
Play:
Start with a pie offer of 1 to 3 stones of any color combination. (Player 1 does this by making 3 placements, or passes; after which Player 2 may choose to play, or to have the pieces exchanged with the opposite colors)
Turns alternate.
On a turn, a player places a series of stones, one at a time, (as described below) until no more placements are possible, and then passes. Order of placement matters.
Placements are made to empty cells that:
-- 1) have more neighbors that are oppositely charged than similarly charged, or
-- 2) have 3 or more oppositely charged neighbors.
The game ends when neither player can play.
The largest group for each player is then scored. In case of a tie the last to place a stone loses.
Variants:
Exception for Surplus Charge
Immediately after placing to a cell with 4 or more oppositely charged neighbors, the player MUST, if possible, place the next stone on an otherwise unplayable empty cell with an equal number of both types of charge around it. Hex Grid - Standard Order 6 board Largest orthogonal group scores 1 point per piece. END |
Describe the mechanics of the following Ludii game
(define "FirstEmptyHole" (trackSite FirstSite Mover "TrackCW" from:#1 if:(is Empty (to)))) (define "NextHoleFrom" ("NextSiteOnTrack" #3 from:#1 #2)) (define "PlayFromNextLastHole" (sites {("NextHoleFrom" (last To afterConsequence:True) "TrackCCW" 1)})) (define "Columns" 8) (game "Mangola" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "TrackCCW1" "0,E,N1,W" loop:True P1) (track "TrackCCW2" "16,E,N1,W" loop:True P2) (track "TrackCW1" "7,W,N1,E" loop:True P1) (track "TrackCW2" "23,W,N1,E" loop:True P2)}) (regions "Home" P1 (sites Track "TrackCCW1")) (regions "Home" P2 (sites Track "TrackCCW2")) (regions "Inner" P1 (difference (sites Track "TrackCCW1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "TrackCCW2") (sites Top))) (regions "LeftMost" P1 (intersection (sites Left) (sites Track "TrackCCW1"))) (regions "LeftMost" P2 (intersection (sites Right) (sites Track "TrackCCW2"))) (regions "EndHoles" P1 (intersection (union (sites Left) (sites Right)) (sites Track "TrackCCW1"))) (regions "EndHoles" P2 (intersection (union (sites Left) (sites Right)) (sites Track "TrackCCW2"))) (piece "Seed" Shared) (hand Each)}) (rules (start (set Count 2 to:(union (sites P1 "Home") (sites P2 "Home")))) phases:{ (phase "Opening1" (play (move Select (from (if ("SameTurn") "PlayFromNextLastHole" (sites Mover "LeftMost")) if:(> (count at:(from)) 0)) (then (sow numPerHole:2 "TrackCCW" owner:(mover) apply:(if (is Occupied ("NextHoleFrom" (to) "TrackCCW" 1)) (moveAgain)))))) (nextPhase Mover (not (is Next Mover)) "Opening2")) (phase "Opening2" (play (move Select (from (if ("SameTurn") (sites {(var "Replay")}) (sites Mover "EndHoles")) if:(> (count at:(from)) 1)) (then (sow "TrackCCW" owner:(mover) apply:(if (< 1 (count at:(to))) (and { (moveAgain) (set Var "Replay" (to)) (if (and { (is In (to) (sites Mover "Inner")) (is Occupied ("OppositeOuterPit" (to))) (is Occupied ("OppositePit" (to)))}) (and { (fromTo (from ("OppositeOuterPit" (to))) (to ("NextHoleFrom" ("FirstEmptyHole" (to)) "TrackCCW" 1)) count:(count at:("OppositeOuterPit" (to)))) (fromTo (from ("OppositePit" (to))) (to ("NextHoleFrom" ("FirstEmptyHole" (to)) "TrackCCW" 1)) count:(count at:("OppositePit" (to)))) (sow ("NextHoleFrom" ("FirstEmptyHole" (to)) "TrackCCW" 1) count:(+ (count at:("OppositePit" (to))) (count at:("OppositeOuterPit" (to)))) "TrackCCW" owner:(mover))}))}) (fromTo (from (to)) (to ("NextHoleFrom" (to) "TrackCCW" 1)) count:1)))))) (nextPhase Mover (not (is Next Mover)) "Sowing")) (phase "Sowing" (play (move Select (from (if ("SameTurn") (sites {(var "Replay")}) (sites Mover "Home")) if:(> (count at:(from)) 1)) (then (sow "TrackCCW" owner:(mover) apply:(if (< 1 (count at:(to))) (and { (moveAgain) (set Var "Replay" (to)) (if (and { (is In (to) (sites Mover "Inner")) (is Occupied ("OppositeOuterPit" (to))) (is Occupied ("OppositePit" (to)))}) (and { (fromTo (from ("OppositeOuterPit" (to))) (to ("NextHoleFrom" ("FirstEmptyHole" (to)) "TrackCCW" 1)) count:(count at:("OppositeOuterPit" (to)))) (fromTo (from ("OppositePit" (to))) (to ("NextHoleFrom" ("FirstEmptyHole" (to)) "TrackCCW" 1)) count:(count at:("OppositePit" (to)))) (sow ("NextHoleFrom" ("FirstEmptyHole" (to)) "TrackCCW" 1) count:(+ (count at:("OppositePit" (to))) (count at:("OppositeOuterPit" (to)))) "TrackCCW" owner:(mover))}))}) (fromTo (from (to)) (to ("NextHoleFrom" (to) "TrackCCW" 1)) count:1)))))))} (end ("ForEachPlayerNoMovesLoss"))))
###
| 4x8 board. Two counters in each hole. Play begins with each player taking the two counters in the leftmost hole of either the inner or outer row and placing them both in the following hole in an anti-clockwise direction, and continuing with the two counters in the next hole, until there is an alternating pattern of holes with four counters followed by empty holes in all of the player's holes. On the next turn, the player sows from one of the holes on the end of one of their rows. Sowing occurs in an anti-clockwise direction. After this turn, sowing can be from any hole on the player's side of the board. Single counters cannot be sown. When the final counter falls into an occupied hole, the player picks up these counters and continues to sow. When the final counter is supposed to fall into an empty hole, it is not placed there but placed in the next hole. When the final counter falls into an occupied hole in the inner row, any counters in the opponent's two holes opposite are captured. These are then sown on the player's side of the board, beginning with the first occupied hole immediately after an empty hole before the hole from which the capture was made. Play continues until one player can no longer play, and the opponent wins. END |
Describe the mechanics of the following Ludii game
(game "Driesticken" (players 2) (equipment { (board (square 3) use:Vertex) (hand Each) (piece "Marker" Each (move (from) (to (sites Empty))))}) (rules (start (place "Marker" "Hand" count:3)) phases:{ (phase "Placement" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase ("HandEmpty" P2) "Movement")) ("PhaseMovePiece" "Movement")} (end ("Line3Win" Orthogonal))))
###
| 3x3 intersecting lines. Three pieces per player. Players alternate turns placing pieces on an empty spot on the board. When all pieces are placed, players alternate turns moving a piece to any empty spot on the board. The first player to place their pieces in an orthogonal row along the lines wins.
END |
Construct a Ludii game based on the following description
A series of three parallel lines are drawn, with diagonals connecting the outer lines at intervals, crossing each other at the central line. Sixteen spaces each row. Pieces begin on all of the points on the board, except the central point and the leftmost point of the central row. Pieces are moved along the intersections, and they are placed on the board on opposing sides, leaving the central spot empty. The first player moves to this spot along one of the lines, and the opponent jumps this pieces, thereby capturing it.
###
| (game "Kolowis Awithlaknannai" (players 2) (equipment { (board (merge { (repeat 1 1 step:{{0.5 0} {1 0}} (poly {{-0.5 0} {0.5 0} {0 0.5}})) (repeat 1 1 step:{{0.5 0} {1 0}} (poly {{-0.5 0} {0.5 0} {0 -0.5}})) (repeat 15 1 step:{{0.5 0} {1 0}} (poly {{0.5 0} {0 0.5} {1 0.5}})) (repeat 15 1 step:{{0.5 0} {1 0}} (poly {{0.5 0} {0 -0.5} {1 -0.5}})) (shift 0.5 0 (rectangle 1 15))}) use:Vertex) (piece "Counter" Each (or ("HopCapture") ("StepToEmpty")))}) (rules (start { (place "Counter1" (difference (union (sites Bottom) (sites Direction from:(centrePoint) W)) (coord "A2"))) (place "Counter2" (union (sites Direction from:(centrePoint) E) (sites Top)))}) (play (forEach Piece)) (end ("NoMoves" Loss)))) END |
Construct a global Ludii definition which fulfills the following requirements.
Defines a graphics turtle walk to get the locations where can move a Chess giraffe.
###
| (define "GiraffeWalk" { {F F F R F F} {F F F L F F}}) END |
Construct a Ludii game based on the following description
The game is played on a board with twelve points on either side. The points form a continuous track in a horseshoe shape; each player progresses in opposite directions (one from their bottom right to the top right, the other from their bottom left to their top left. Each player has 15 pieces. The starting position is as such, numbering the points from the origin of each player's track: Point six: five pieces. Point 8: three pieces. Point 13: five pieces. Point 24: two pieces. Play begins by each player rolling one die; the player who rolls the highest plays first, and then rolls again to begin play. Players move according to the number on each die by moving one piece the number on one die and another the number on the other die, or by moving one piece twice (once for each die). If doubles are rolled, the player must play the number on each die twice. Players cannot end their move on a point with multiple opposing pieces. If a player ends the turn on a point with one opposing piece, that piece is placed in the middle of the board (not on a point) and must reenter the board according the the next die roll, counting the origin point as a move of one. They cannot reenter on a point with two or more pieces. No other pieces can move until all of the pieces belonging to that player are removed from the center. When all of a player's pieces are on their final six points, they may start removing pieces from the board. They can do so by rolling a 6 to move from the 6th point, and so on down to 1. Players must use all available moves presented by the dice. The first player to remove all of their pieces wins.
###
| (define "HaveAPieceAndCanEscape" (and ("IsFriendAt" (site)) (< ("NextSiteOnTrack" (pips) from:(site)) 0))) (define "SetScoreOf" (set Score #1 (if (is Mover #1) (if (= ("NumPiece" #2) 15) 2 1) 0))) (define "NotEmptyAndNotOffTheBoard" (and (is Occupied (site)) ("IsNotOffBoard" ("NextSiteFrom" (site))))) (define "CanEscape" ("IsEndTrack" ("NextSiteFrom" (site)))) (define "NumPiece" (size Stack in:(sites Occupied by:#1))) (define "AllPieceEscaped" (no Pieces Mover)) (define "MoveAPieceIf" (forEach Die replayDouble:True if:#1 ("MoveAPiece" #2))) (define "MoveAPiece" (move (from #1) (to ("NextSiteFrom" #1) if:("NoEnemyOrOnlyOne" (to)) ("IfEnemyBlotIt")))) (define "DieNotUsedAndNoEscapeAndNotOffTheTrack" (and { ("DieNotUsed") ("IsNotOffBoard" ("NextSiteFrom" (from))) ("IsNotEndTrack" ("NextSiteFrom" (from)))})) (define "RemoveAPiece" (move Remove (site))) (define "AllPieceInHome" ("AllOwnedPiecesIn" (sites Mover))) (define "Bar" (mapEntry (mover))) (define "NextSiteFrom" ("NextSiteOnTrack" (pips) from:#1)) (define "BarEmpty" (is Empty "Bar")) (define "IfEnemyBlotIt" ("HittingCapture" (mapEntry (next)))) (game "Frangieh" (players 2) (equipment { ("BackgammonBoard" ("BackgammonTracksWithBar" End)) (dice num:2) (regions P1 { 20..25}) (regions P2 { 7..12}) (map {(pair 1 6) (pair 2 19)}) (piece "Disc" Each ("MoveAPieceIf" "DieNotUsedAndNoEscapeAndNotOffTheTrack" (from)))}) (rules (start { (place Stack "Disc1" 0 count:5) (place Stack "Disc1" 12 count:2) (place Stack "Disc1" 17 count:3) (place Stack "Disc1" 20 count:5) (place Stack "Disc2" 4 count:3) (place Stack "Disc2" 7 count:5) (place Stack "Disc2" 13 count:5) (place Stack "Disc2" 25 count:2)}) (play ("RollEachNewTurnMove" (if "AllPieceInHome" (forEach Die replayDouble:True if:("DieNotUsed") (forEach Site (sites Occupied by:Mover) (if ("NotEmptyAndNotOffTheBoard") (if ("CanEscape") ("RemoveAPiece") ("MoveAPiece" (site)))) noMoveYet:(firstMoveOnTrack "Track" Mover (if "HaveAPieceAndCanEscape" "RemoveAPiece")) (then ("ReplayNotAllDiceUsed")))) (if "BarEmpty" (forEach Piece top:True) ("MoveAPieceIf" ("DieNotUsed") ("Bar")) (then (if (not (all DiceUsed)) (if (can Move (if "BarEmpty" (forEach Piece top:True) ("MoveAPieceIf" ("DieNotUsed") ("Bar")))) (moveAgain)))))))) (end (if ("AllPieceEscaped") (result Mover Win))))) END |
Describe the mechanics of the following Ludii game
(define "IsUnpromoted" ("IsPieceAt" "Counter" Mover (last To))) (define "HopMan" (move Hop (from #1) (between if:(and (not (is In (between) (sites ToClear))) ("IsEnemyAt" (between))) (apply (remove (between) at:EndOfTurn))) (to if:(is Empty (to))) #2)) (game "HexDame" (players 2) (equipment { (board (rotate 90 (hex 5))) (piece "Counter" P1 N) (piece "Counter" P2 S) (piece "DoubleCounter" Each) (regions P1 (union (sites Side SW) (sites Side SE))) (regions P2 (union (sites Side NW) (sites Side NE)))}) (rules (start { (place "Counter1" (expand (sites Bottom) steps:3)) (place "Counter2" (expand (sites Top) steps:3))}) (play (if "SameTurn" (if "IsUnpromoted" (max Moves ("HopMan" (last To) (then ("ReplayIfCanMove" ("HopMan" (last To)) ("PromoteIfReach" (sites Next) "DoubleCounter"))))) (max Moves ("HopSequenceCaptureAgain" before:10 after:10 at:EndOfTurn))) (priority { (max Moves (or (forEach Piece "Counter" ("HopMan" (from) (then ("ReplayIfCanMove" ("HopMan" (last To)) ("PromoteIfReach" (sites Next) "DoubleCounter"))))) (forEach Piece "DoubleCounter" ("HopSequenceCapture" before:10 after:10 at:EndOfTurn)))) (or (forEach Piece "Counter" ("StepToEmpty" (directions {Forward FL FR})) (then ("PromoteIfReach" (sites Next) "DoubleCounter"))) (forEach Piece "DoubleCounter" (move Slide)))}))) (end ("BlockWin"))))
###
| Pieces move one step forward. Otherwise, the rules are the same as International Draughts: Pieces can jump an opponent's adjacent player to capture it. Pieces can move forward or backwards. When a piece reaches the opposite edge of the board from its starting position, it becomes a king and can may move and jump over any number of spaces diagonally. Captures are compulsory and the maximum number of jumps must be made. Winning is achieved by capturing all the opponent's pieces or by blocking them from moving. END |
Construct a global Ludii definition which fulfills the following requirements.
Checks if a group of pieces has some liberties around it. The specified directions (by default Adjacent) are the directions between the elements of the group.
###
| (define "HasFreedom" (> (count Liberties #1) 0)) END |
Construct a Ludii game based on the following description
Square with diagonals and lines connecting the midpoints of the sides. Three pieces per player. The first player places their piece in the center. Players alternate turns placing a piece on an empty spot on the board. The first player to make three in a row wins.
###
| (game "Ngrin" (players 2) (equipment { (board (square 3 diagonals:Alternating) use:Vertex) (piece "Marker" Each)}) (rules phases:{ (phase "Opening" (play (move Add (to (centrePoint)))) (nextPhase "Playing")) (phase "Playing" (play (move Add (to (sites Empty)))))} (end ("Line3Win")))) END |
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. When the final counter lands in an occupied hole the counters are picked up and sowing continues, unless the hole contained three counters, causing it to contain four, in which case the counters are captured. An unbroken sequence of holes with four counters in them behind the hole from which the first capture was made are also captured. In addition, any holes which were sown into during the course of the turn which now contain four counters are captured by the owner of the row. Play continues until there are only eight counters left. The first player to make a capture with these eight counters captures them all. The player with the most counters wins.
###
| (define "LastHoleSowed" (sites {(var "To")})) (define "PiecesOwnedBy" (+ (count at:(mapEntry #1)) (count in:(sites #1)))) (game "Duene" (players 2) (equipment { (mancalaBoard 2 6 (track "Track" "1,E,N,W" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 FirstSite) (pair P2 LastSite)}) (piece "Seed" Shared)}) (rules (start (set Count 4 to:(sites Track))) phases:{ (phase "Playing" (play (move Select (from (if ("SameTurn") ("LastHoleSowed") (sites Mover)) if:(< 0 (count at:(from)))) (then (do (and (set Var "From" (last From)) (sow apply:(and (set Var "To" (to)) (if (= (count at:(to)) 4) (fromTo (from (to)) (to (mapEntry (mover))) count:(count at:(to))) (if (> (count at:(to)) 1) (moveAgain)))) backtracking:(= (count at:(to)) 4))) next:(and { (pass) (forEach Site (forEach (sites Track from:(var "From") to:(var "To")) if:(and (is In (site) (sites P1)) (= 4 (count at:(site))))) (fromTo (from (site)) (to (mapEntry P1)) count:(count at:(site)))) (forEach Site (forEach (sites Track from:(var "From") to:(var "To")) if:(and (is In (site) (sites P2)) (= 4 (count at:(site))))) (fromTo (from (site)) (to (mapEntry P2)) count:(count at:(site))))}))))) (nextPhase (<= (count in:(sites Track)) 8) "EndGame")) (phase "EndGame" (play (move Select (from (if ("SameTurn") ("LastHoleSowed") (sites Mover)) if:(< 0 (count at:(from)))) (then (sow apply:(if (= (count at:(to)) 4) (forEach Site (sites Track) (if (< 0 (count at:(site))) (fromTo (from (site)) (to (mapEntry (mover))) count:(count at:(site))))) (if (> (count at:(to)) 1) (moveAgain))))))))} (end ("MancalaByScoreWhen" (all Sites (sites Track) if:(= 0 (count at:(site)))))))) END |
Construct a Ludii game based on the following description
2x6 board. 72 counters are distributed unevenly into the holes by one player in both rows, placing at least four in each hole. The opponent moves first, but may flip the board around if they prefer that arrangement. Each move must begin from the rightmost hole in a player's row or the next closest hole to it from which it is possible to move. Counters are sowed in an anti-clockwise direction. If the last counter falls into a hole making it odd, these are picked up and sowing continues. If it lands in a hole making it even, these counters are captured as are the ones in the opposite hole. If the previous hole also has an even number, these and the ones in the opposite hole are captured. If the last counter falls into an empty hole, the turn ends. If a player has no counters in their holes, the opponent must give them one counter, to be placed in the leftmost hole and played from there. Play ends when the board is cleared of counters. Each player counts the number of counters they captured. The player with more counters is given a score equal to the difference in the number of counters. Another round begins as before, with the loser distributing the counters and the winner playing first.. The game is won when a player accumulates sixty points.
###
| (define "RightMostNotEmpty" (trackSite FirstSite "TrackCW" from:(mapEntry "RightMost" Mover) if:(and (is In (to) (sites Mover)) (is Occupied (to))))) (define "EmptyBoardOrOne" (= 1 (count in:(sites Board)))) (define "NoCounters" (all Sites (sites #1) if:(= 0 (count at:(site))))) (define "FourInEach" (all Sites (sites Board) if:(<= 4 (count at:(site))))) (define "Columns" 6) (game "Li'b al-Ghashim" (players 2) (equipment { (mancalaBoard 2 "Columns" store:None { (track "TrackCCW" "0,E,N,W" loop:True) (track "TrackCW" "5,W,N,E" loop:True)}) (piece "Seed" Shared) (hand Each) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map "RightMost" {(pair P1 5) (pair P2 6)})}) (rules (start (place "Seed" (handSite P1) count:72)) phases:{ (phase "Opening1" (play (or { (if (is Occupied Cell (handSite P1)) (forEach Value min:1 max:(count Cell at:(handSite P1)) (move (from (handSite P1)) (to (sites Board)) count:(value))) (forEach Site (sites Board) (if (is Occupied (site)) (move (from (site)) (to (sites Board) if:(!= (to) (from)))))) (then (moveAgain))) (if (and (is Empty (handSite P1)) ("FourInEach")) (move Pass))})) (nextPhase (was Pass) "Opening2")) (phase "Opening2" (play (or (move Pass (then (and (set Pending) (moveAgain)))) (move Swap Players P1 P2 (then (and (set NextPlayer (player 1)) (set Pending)))))) (nextPhase "Sowing")) (phase "Sowing" (play (if (and ("NewTurn") ("NoCounters" Next)) (move (from (sites Mover) if:(is Occupied (from))) (to ("RightMostNotEmpty"))) (move Select (from (if (and (not (is Pending)) ("SameTurn")) (sites {(var "Replay")}) (sites Mover)) if:(is Occupied (from))) (then (sow "TrackCCW" if:True apply:(if (is Odd (count at:(to))) (and (moveAgain) (set Var "Replay" (to))) (and (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))) (if (is Occupied ("OppositePitTwoRows" (to))) (fromTo (from ("OppositePitTwoRows" (to))) (to (handSite Mover)) count:(count at:("OppositePitTwoRows" (to))))))) backtracking:(and (is Occupied (to)) (is Even (count at:(to))))))) (then (if ("EmptyBoardOrOne") (and { (if (< (count Cell at:(handSite P1)) (count Cell at:(handSite P2))) (addScore P2 (- (count Cell at:(handSite P2)) (count Cell at:(handSite P1)))) (addScore P1 (- (count Cell at:(handSite P1)) (count Cell at:(handSite P2))))) (if (is Occupied Cell (handSite P2)) (fromTo (from (handSite P2)) (to (handSite P1)) count:(count Cell at:(handSite P2)))) (forEach Site (sites Board) (if (is Occupied (site)) (fromTo (from (site)) (to Cell (handSite P1)) count:(count at:(site)))))}))))) (nextPhase ("EmptyBoardOrOne") "Opening1"))} (end (forEach Player if:(<= 60 (score Player)) (result Player Win))))) END |
Construct a Ludii game based on the following description
Players take turns removing a piece of their colour whose number is higher than the last piece they removed (free choice of first piece). The mover loses if they remove an even numbered piece.
###
| (define "StoreStateRemoved" (set Value Mover (state at:(last To)))) (define "LastStateRemove" (value Player Mover)) (game "Greater Even Loss" (players 2) (equipment { (board (square 4)) (piece "Disc" Each)}) (rules (start { (place "Disc1" {"A1"} state:1) (place "Disc1" {"B1"} state:2) (place "Disc1" {"C1"} state:3) (place "Disc1" {"D1"} state:4) (place "Disc1" {"A2"} state:5) (place "Disc1" {"B2"} state:6) (place "Disc1" {"C2"} state:7) (place "Disc1" {"D2"} state:8) (place "Disc2" {"A3"} state:5) (place "Disc2" {"B3"} state:6) (place "Disc2" {"C3"} state:7) (place "Disc2" {"D3"} state:8) (place "Disc2" {"A4"} state:1) (place "Disc2" {"B4"} state:2) (place "Disc2" {"C4"} state:3) (place "Disc2" {"D4"} state:4)}) (play (move Select (from (forEach (sites Occupied by:Mover) if:(> (state at:(site)) ("LastStateRemove")))) (then (and ("StoreStateRemoved") (remove (last To)))))) (end (if (is Even "LastStateRemove") (result Mover Loss))))) END |
Construct a global Ludii definition which fulfills the following requirements.
Defines the most popular backgammon tracks in using the bar of the board.
###
| (define "BackgammonTracksWithBar" { (track "Track1" {6 12..7 5..0 13..18 20..25 #1} P1 directed:True) (track "Track2" {19 25..20 18..13 0..5 7..12 #1} P2 directed:True)}) END |
Construct a Ludii game based on the following description
4x4, 8, 10, 16, or 22 board. Two counters in each hole. Sowing occurs in an anti-clockwise direction. When the final counter of a sowing lands in an occupied hole, the contents are picked up and sowing continues. When the final counter lands in an empty hole in the player's inner row, the contents of the opponent's hole in the inner row opposite it are captured, and if there are counters also in the corresponding outer row hole, these are also captured. The player may also capture from another hole from the opponent's side of the board of their choosing. The turn ends. If the final counter lands in an empty hole in the player's outer row, the turn ends. Play continues until one player captures all of the opponent's counters, thus winning. Each player has 4 holes on each row.
###
| (define "PiecesOwnedBy" (count in:(sites #1 "Home"))) (define "Columns" 4) (game "Tshuba" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "Track1" "0,E,N1,W" loop:True P1) (track "Track2" "8,E,N1,W" loop:True P2)}) (regions "Home" P1 (sites Track "Track1")) (regions "Home" P2 (sites Track "Track2")) (regions "Inner" P1 (difference (sites Track "Track1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "Track2") (sites Top))) (piece "Seed" Shared) (hand Each)}) (rules (start (set Count 2 to:(union (sites P1 "Home") (sites P2 "Home")))) (play (if (= 1 (var "ExtraCapture")) (move Remove (difference (sites Next "Home") (sites Empty)) count:(count at:(to)) (then (set Var "ExtraCapture" 0))) (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover)) if:(< 0 (count at:(from)))) (then (sow "Track" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover "Inner")) (and { (if (> (count at:("OppositePit" (to))) 0) (remove ("OppositePit" (to)) count:(count at:("OppositePit" (to))))) (if (> (count at:("OppositeOuterPit" (to))) 0) (remove ("OppositeOuterPit" (to)) count:(count at:("OppositeOuterPit" (to))))) (set Var "ExtraCapture" 1) (moveAgain)})))))))) (end (if (all Sites (sites Next "Home") if:(= 0 (count at:(site)))) (result Mover Win))))) END |
Describe the mechanics of the following Ludii game
(define "ReplaceByLargePiece" (fromTo (from (handSite Mover)) (to (between)))) (define "LargePieveAvailable" ("HandOccupied" Mover)) (define "Team2OnlyOnStartSitesTeam1" (all Sites ("SitesOccupiedTeam2") if:(is In (site) ("StartSitesTeam1")))) (define "Team1OnlyOnStartSitesTeam2" (all Sites ("SitesOccupiedTeam1") if:(is In (site) ("StartSitesTeam2")))) (define "StartSitesTeam2" (union (sites P2) (sites P3))) (define "StartSitesTeam1" (union (sites P1) (sites P4))) (define "SitesOccupiedTeam2" (union (sites Occupied by:P2) (sites Occupied by:P3))) (define "SitesOccupiedTeam1" (union (sites Occupied by:P1) (sites Occupied by:P4))) (define "ScoreTeam2" (+ (score P2) (score P3))) (define "ScoreTeam1" (+ (score P1) (score P4))) (game "Awithlaknakwe" (players {(player N) (player E) (player S) (player W)}) (equipment { (board (merge (merge (merge (merge (square 13 diagonals:Solid) (shift 3 -1 (rectangle 2 7 diagonals:Solid))) (shift 3 12 (rectangle 2 7 diagonals:Solid))) (shift -3.5 5.5 (rotate 90 (rectangle 2 7 diagonals:Solid)))) (shift 9.5 5.5 (rotate 90 (rectangle 2 7 diagonals:Solid)))) use:Vertex) (piece "Counter" Each ("StepToEmpty" (directions {FR FL}))) (piece "DoubleCounter" Each ("StepToEmpty" (directions {Rightward Forwards Leftward}))) (regions "Home" P1 (sites {"D9" "E8" "F7" "G6" "H5" "I4"})) (regions "Home" P2 (sites {"I22" "H21" "G20" "F19" "E18" "D17"})) (regions "Home" P3 (sites {"Q22" "R21" "S20" "T19" "U18" "V17"})) (regions "Home" P4 (sites {"V9" "U8" "T7" "S6" "R5" "Q4"})) (hand Each)}) (rules (start { (set Team 1 {P1 P4}) (set Team 2 {P2 P3}) (place "Counter1" (sites P1)) (place "Counter2" (sites P2)) (place "Counter3" (sites P3)) (place "Counter4" (sites P4)) (place "DoubleCounter" "Hand")}) (play (forEach Piece (then (custodial (from (last To)) Orthogonal (between (max 1) if:("IsEnemyAt" (between)) (apply (and { (remove (between)) (if ("LargePieveAvailable") ("ReplaceByLargePiece")) (addScore Mover 1)}))) (to if:("IsFriendAt" (to))))))) (end (if (and ("Team1OnlyOnStartSitesTeam2") ("Team2OnlyOnStartSitesTeam1")) { (if (> ("ScoreTeam1") ("ScoreTeam2")) (result Team1 Win)) (if (< ("ScoreTeam1") ("ScoreTeam2")) (result Team2 Win)) (if (= ("ScoreTeam1") ("ScoreTeam2")) (result Mover Draw))}))))
###
| 12x12 board, with a line of six extra squares centered on each side. Diagonals in every square. Pieces are played on the intersections of lines. Played with two or four players; with four players, the top and left players play against the bottom and right players. Six pieces per player, with one larger piece. Each player's six pieces begin on the central intersection of the extra spaces. Pieces move one spot at a time diagonally. When a player surrounds an opponent's piece on two opposite sides, this piece is captured. The piece is then replaced by the larger piece, which may move diagonally or orthogonally. Pieces may not move backward. When all of the players' remaining pieces reach the starting squares of the opponent, the player with the most captured pieces wins. END |
Describe the mechanics of the following Ludii game
(define "LetADiscOnTheFromLocation" (add (piece "Disc0") (to (last From)))) (game "Go with the Floe" (players 2) (equipment { (board (keep (square 8) (poly { {-3 4} {4 -3} {11 4} {4 11}}))) (piece "Seal" P1 N (or (move Slide (between (max 2) trail:(id "Disc0"))) (move Hop (between if:("IsPieceAt" "Disc0" Neutral (between))) (to if:(is Empty (to))) (then "LetADiscOnTheFromLocation")))) (piece "Bear" P2 (or { (move Slide (between (max 2) trail:(id "Disc0"))) (move Hop (between if:("IsPieceAt" "Disc0" Neutral (between))) (to if:(is Empty (to))) (then "LetADiscOnTheFromLocation")) (move Step (to if:("IsPieceAt" "Seal1" P1 (to)) (apply (remove (to)))) (then (and (remove (last To)) ("LetADiscOnTheFromLocation"))))})) (piece "Disc" Neutral)}) (rules (start { (place "Bear2" {"G2" "G7"}) (place "Seal1" {"B2" "B7"})}) (play (forEach Piece)) (end { (if ("NoSites" (sites Occupied by:All)) (result P2 Win)) (if (and (no Moves P1) (not (can Move (forEach Piece "Bear" (step (to if:("IsPieceAt" "Seal1" P1 (to)))))))) (result P1 Win)) (if (all Passed) (result P1 Win))})))
###
| Players take turns moving their pieces. Black starts. Players may: Move one or two empty spaces in any direction, or hop over one ring marker in any direction into an empty space. multiple jumps. White may capture an opponent's piece by moving onto its space from an adjacent one. Both the white and black pieces are removed from play. After moving or capturing, the moving player places a hole-in-the-ice ring marker on the moving tokens starting space and any empty space passed over. The goal for the white player is to capture both black tokens. The goal for the black player is to isolate at least one of their pieces so that it cannot be captured. If both players cannot play, black wins. END |
What does the following global Ludii definition do?
(define "StickDice" (dice d:2 from:0 num:#1))
###
| Defines a specified number of D2 dice with values 0 and 1. END |
Describe the mechanics of the following Ludii game
(game "Ko-app-paw-na" (players 2) (equipment { (board (square 5) use:Vertex) (piece "Rabbit" P1 "StepToEmpty") (piece "Counter" P2 (or "HopCapture" "StepToEmpty")) (regions P1 (union (expand (sites Top)) (sites {"A3" "E3"})))}) (rules (start { (place "Rabbit1" (union (expand (sites Bottom)) (sites {"A3" "E3"}))) (place "Counter2" (centrePoint))}) (play (forEach Piece)) (end { (if (= (sites P1) (sites Occupied by:P1)) (result P1 Win)) (if (= (count Pieces P1) 11) (result P2 Win))})))
###
| One player has a single piece, the other has twelve, playing as jackrabbits. The player playing as the jackrabbits attempts to move all of their pieces to the opposite side of the board until they form the same configuration as the starting position on the opposite side. Pieces move orthogonally to accomplish this. The opponent's goal is to capture one of the jackrabbits by hopping over it. END |
Modify the Ludii game according to the following option changes:
The version of game with 3 players. -> The version of game with 4 players.
The game is played on a 3x3 board. -> The game is played on a 4x4 board.
(game "Yavalath" (players 3) (equipment { (board (rotate 90 (hex 3))) (piece "Marker" Each)}) (rules (play (priority {(move Add (to (union (sites Winning Mover (add (to (sites Empty)))) (sites Winning Next (add (to (sites Empty))))))) (move Add (to (sites Empty)))})) (end { (if (is Line 4) (result Mover Win)) (if (is Line 3) (result Mover Loss))})))
###
| (game "Yavalath" (players 4) (equipment { (board (rotate 90 (hex 4))) (piece "Marker" Each)}) (rules (play (priority {(move Add (to (union (sites Winning Mover (add (to (sites Empty)))) (sites Winning Next (add (to (sites Empty))))))) (move Add (to (sites Empty)))})) (end { (if (is Line 4) (result Mover Win)) (if (is Line 3) (result Mover Loss))}))) END |
Modify the Ludii game according to the following option changes:
The game is played on a 9x9 board -> The game is played on a 13x13 board
(define "CaptureSurroundedPiece" (enclose (from (last To)) Orthogonal (between if:("IsEnemyAt" (between)) (apply (and (addScore Mover 1) (remove (between))))))) (game "Go" (players 2) (equipment { (board (square 9) use:Vertex) (piece "Marker" Each)}) (rules (meta (no Repeat)) (play (or (do (move Add (to (sites Empty)) (then "CaptureSurroundedPiece")) ifAfterwards:("HasFreedom" Orthogonal)) (move Pass))) (end (if (all Passed) (byScore { (score P1 (+ (score P1) (size Territory P1))) (score P2 (+ (score P2) (size Territory P2)))})))))
###
| (define "CaptureSurroundedPiece" (enclose (from (last To)) Orthogonal (between if:("IsEnemyAt" (between)) (apply (and (addScore Mover 1) (remove (between))))))) (game "Go" (players 2) (equipment { (board (square 13) use:Vertex) (piece "Marker" Each)}) (rules (meta (no Repeat)) (play (or (do (move Add (to (sites Empty)) (then "CaptureSurroundedPiece")) ifAfterwards:("HasFreedom" Orthogonal)) (move Pass))) (end (if (all Passed) (byScore { (score P1 (+ (score P1) (size Territory P1))) (score P2 (+ (score P2) (size Territory P2)))}))))) END |
Modify the Ludii game according to the following option changes:
The board is a square board of size 4x4. -> The board is a square board of size 6x6.
(define "ReverseBoundedPieces" (custodial (from (site)) (between if:(is Enemy (state at:(between))) (apply (allCombinations (add (piece "Disc0" state:(mover)) (to (site))) (flip (between))))) (to if:(is Friend (state at:(to)))))) (game "Reversi" (players 2) (equipment { (board (square 4)) (piece "Disc" Neutral (flips 1 2))}) (rules (start { (place "Disc0" (difference (sites Centre) (sites Phase 1)) state:1) (place "Disc0" (difference (sites Centre) (sites Phase 0)) state:2)}) phases:{ (phase "Playing" (play (forEach Site (sites Empty) (append "ReverseBoundedPieces" (then (and (set Score P1 (count Sites in:(sites State 1))) (set Score P2 (count Sites in:(sites State 2)))))))))} (end (if (all Passed) (byScore)))))
###
| (define "ReverseBoundedPieces" (custodial (from (site)) (between if:(is Enemy (state at:(between))) (apply (allCombinations (add (piece "Disc0" state:(mover)) (to (site))) (flip (between))))) (to if:(is Friend (state at:(to)))))) (game "Reversi" (players 2) (equipment { (board (square 6)) (piece "Disc" Neutral (flips 1 2))}) (rules (start { (place "Disc0" (difference (sites Centre) (sites Phase 1)) state:1) (place "Disc0" (difference (sites Centre) (sites Phase 0)) state:2)}) phases:{ (phase "Playing" (play (forEach Site (sites Empty) (append "ReverseBoundedPieces" (then (and (set Score P1 (count Sites in:(sites State 1))) (set Score P2 (count Sites in:(sites State 2)))))))))} (end (if (all Passed) (byScore))))) END |
Construct a Ludii game based on the following description
A move of a player consists of two parts: he first makes a normal move with one of his pieces (this is not obligatory), but no piece may move to a goal, i.e., to e1 or e9. (Pieces like rooks and queens however may move across it, e.g. from d1 to f1.) However, no captures are made, and check is disregarded. Then, after this move, the player may, if he can, have a piece kick the ball.
A piece can kick the ball if the ball is adjacent to it (i.e., a kings move away.) The ball moves in the same way as the piece that kicks the ball, and the ball must be moved directly away from the piece. Also, the ball cannot be moved to or over occupied squares (except when a knight kicks the ball). For instance, a rook on a3 can kick a ball on a4 to squares a5, a6, a7, a8, a9, as long as the ball isn't moved to an occupied square; but a rook on a3 cannot kick a ball on b4.
A knight can kick the ball to any square, a knight-move away from the square where the ball was before the kick, but not to a square, adjacent to the knight.
When the ball is kicked to a square adjacent to another piece of the same player, the player may make another kick. This is called a `pass'. If after a second kick, a third kick is possible, the player may also make this third kick, and similar for successive kicks. Making an infinite number of passes, in order to draw the game, however is not allowed. Note that when kicking, only the ball moves but all normal pieces remain on the same places.
The object of the game is to kick to ball to the goal at the opponents side of the board. However, it is not allowed to kick the ball into or across the goal from a square on the 1st or 9th row.
###
| (define "CanKickAgainWithoutMoving" (and (set Pending) (moveAgain))) (define "KickBallAgainWithoutMoving" (is Pending)) (define "KickTheBall" (if ("KickerIsA" "Knight" #1) (move (from (where "Ball" Shared)) (to (sites To (leap (from (where "Ball" Shared)) "KnightWalk" (to if:(is Empty (to))))) if:(not (is In (to) (sites Around #1))))) (if ("KickerIsA" "King" #1) (move (from (where "Ball" Shared)) (to (sites To (step (from (where "Ball" Shared)) ("SameDirection" #1) (to if:(is Empty (to))))) if:(if ("InBottomOrTop" #1) (not (is In (to) (sites "Goals"))) True))) (if ("KickerIsA" "Queen" #1) (move (from (where "Ball" Shared)) (to (sites To (slide (from (where "Ball" Shared)) ("SameDirection" #1) (between if:(if ("InBottomOrTop" #1) ("NotInOrThroughGoal") (is Empty (between)))))))) (if ("KickerIsA" "Rook" #1 Orthogonal) (move (from (where "Ball" Shared)) (to (sites To (slide (from (where "Ball" Shared)) ("SameDirection" #1) (between if:(if ("InBottomOrTop" #1) ("NotInOrThroughGoal") (is Empty (between)))))))) (if ("KickerIsA" "Bishop" #1 Diagonal) (move (from (where "Ball" Shared)) (to (sites To (slide (from (where "Ball" Shared)) ("SameDirection" #1) (between if:(if ("InBottomOrTop" #1) ("NotInOrThroughGoal") (is Empty (between)))))))))))) #2)) (define "NotInOrThroughGoal" (and (is Empty (between)) (not (is In (between) (sites "Goals"))))) (define "InBottomOrTop" (is In #1 (union (sites Bottom) (sites Top)))) (define "KickerIsA" (and ("IsPieceAt" #1 Mover #2) (is In (where "Ball" Shared) (sites Around #2 #3)))) (define "SameDirection" (directions Cell from:#1 to:(where "Ball" Shared))) (game "Football Chess" (players 2) (equipment { (board (square 9)) (piece "Rook" Each (move Slide Orthogonal (to (apply if:(not (is In (to) (sites "Goals"))))))) (piece "King" Each (move Step (to if:(and (is Empty (to)) (not (is In (to) (sites "Goals"))))))) (piece "Bishop" Each (move Slide Diagonal (to (apply if:(not (is In (to) (sites "Goals"))))))) (piece "Knight" Each (move Leap "KnightWalk" (to if:(and (is Empty (to)) (not (is In (to) (sites "Goals"))))))) (piece "Queen" Each (move Slide (to (apply if:(not (is In (to) (sites "Goals"))))))) (piece "Ball" Shared) (regions "Goals" (sites {"E1" "E9"})) (map "Goal" {(pair P1 "E9") (pair P2 "E1")})}) (rules (meta (no Repeat PositionalInTurn)) (start { (place "Rook1" {"A1" "I1"}) (place "Knight1" {"B1" "H1"}) (place "Bishop1" {"C1" "G1"}) (place "Queen1" coord:"D1") (place "King1" coord:"F1") (place "Rook2" {"A9" "I9"}) (place "Knight2" {"B9" "H9"}) (place "Bishop2" {"C9" "G9"}) (place "Queen2" coord:"D9") (place "King2" coord:"F9") (place "Ball" {"E5"})}) (play (if ("SameTurn") (or (if ("KickBallAgainWithoutMoving") (forEach Site (sites Around (where "Ball" Shared)) ("KickTheBall" (site)) (then (if (can Move (forEach Site (sites Around (where "Ball" Shared)) ("KickTheBall" (site)))) ("CanKickAgainWithoutMoving")))) ("KickTheBall" (last To) (then (if (can Move (forEach Site (sites Around (where "Ball" Shared)) ("KickTheBall" (site)))) ("CanKickAgainWithoutMoving"))))) (move Pass)) (or (forEach Piece (then (if (can Move ("KickTheBall" (last To))) (moveAgain)))) (forEach Site (sites Around (where "Ball" Shared)) ("KickTheBall" (site)) (then (if (can Move (forEach Site (sites Around (where "Ball" Shared)) ("KickTheBall" (site)))) ("CanKickAgainWithoutMoving"))))))) (end { (if (= (where "Ball" Shared) (mapEntry P1)) (result P1 Win)) (if (= (where "Ball" Shared) (mapEntry P2)) (result P2 Win))}))) END |
Construct a global Ludii definition which fulfills the following requirements.
Checks if a level is at the top of a stack.
###
| (define "IsTopLevel" (= (topLevel at:#1) (level))) END |
Construct a global Ludii definition which fulfills the following requirements.
Defines the capture of an enemy piece returning to a site. This ludemeplex can be used only as an effect.
###
| (define "HittingCapture" (apply if:("IsEnemyAt" (to)) (fromTo (from (to)) (to #1)))) 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 8x8 board.
(define "StepMove" ("StepToEmpty" (directions { Forward Leftward Rightward}))) (game "Dodgem" (players 2) (equipment { (board (square 4)) (piece "Car" P1 E (if (is In (from) (sites Right)) (move Remove (from)) ("StepMove"))) (piece "Car" P2 N (if (is In (from) (sites Top)) (move Remove (from)) ("StepMove")))}) (rules (start { (place "Car1" (difference (sites Left) (sites {"A1"}))) (place "Car2" (difference (sites Bottom) (sites {"A1"})))}) (play (forEach Piece)) (end ("EscapeWin"))))
###
| (define "StepMove" ("StepToEmpty" (directions { Forward Leftward Rightward}))) (game "Dodgem" (players 2) (equipment { (board (square 8)) (piece "Car" P1 E (if (is In (from) (sites Right)) (move Remove (from)) ("StepMove"))) (piece "Car" P2 N (if (is In (from) (sites Top)) (move Remove (from)) ("StepMove")))}) (rules (start { (place "Car1" (difference (sites Left) (sites {"A1"}))) (place "Car2" (difference (sites Bottom) (sites {"A1"})))}) (play (forEach Piece)) (end ("EscapeWin")))) END |
Modify the Ludii game according to the following option changes:
1 seed per hole. -> 2 seeds per hole.
(define "LeftMost" (trackSite FirstSite from:(trackSite FirstSite if:(not (is Mover (who at:(to))))) if:(is Mover (who at:(to))))) (define "NumSeed" 1) (define "Columns" 8) (game "Quendo" (players 4) (equipment { (mancalaBoard 4 "Columns" store:None { (track "Track" "0,E,N,W,S2" loop:True)}) (piece "Seed" Each) (hand Each)}) (rules (start { (place "Seed1" (sites {0..4}) counts:{"NumSeed"}) (place "Seed2" (sites {5..7 15 23}) counts:{"NumSeed"}) (place "Seed3" (sites {31..27}) counts:{"NumSeed"}) (place "Seed4" (sites {26..24 16 8}) counts:{"NumSeed"})}) (play (if (!= 1 (count Pieces Mover)) (move Select (from ("LeftMost")) (then (sow sowEffect:(if (and (!= (mover) (what at:(to))) (is Occupied (to))) (and (remove (to) count:(count at:(to))) (add (piece (id "Seed" Mover)) (to (to)) count:(count at:(to)))))))) (move (from ("LeftMost")) (to (trackSite FirstSite from:(from) if:("IsEnemyAt" (to))) (apply (and (remove (to) count:(count at:(to))) (add (piece (id "Seed" Mover)) (to (to)) count:(count at:(to))))))))) (end (forEach NonMover if:(no Pieces Player) (result Player Loss)))))
###
| (define "LeftMost" (trackSite FirstSite from:(trackSite FirstSite if:(not (is Mover (who at:(to))))) if:(is Mover (who at:(to))))) (define "NumSeed" 2) (define "Columns" 8) (game "Quendo" (players 4) (equipment { (mancalaBoard 4 "Columns" store:None { (track "Track" "0,E,N,W,S2" loop:True)}) (piece "Seed" Each) (hand Each)}) (rules (start { (place "Seed1" (sites {0..4}) counts:{"NumSeed"}) (place "Seed2" (sites {5..7 15 23}) counts:{"NumSeed"}) (place "Seed3" (sites {31..27}) counts:{"NumSeed"}) (place "Seed4" (sites {26..24 16 8}) counts:{"NumSeed"})}) (play (if (!= 1 (count Pieces Mover)) (move Select (from ("LeftMost")) (then (sow sowEffect:(if (and (!= (mover) (what at:(to))) (is Occupied (to))) (and (remove (to) count:(count at:(to))) (add (piece (id "Seed" Mover)) (to (to)) count:(count at:(to)))))))) (move (from ("LeftMost")) (to (trackSite FirstSite from:(from) if:("IsEnemyAt" (to))) (apply (and (remove (to) count:(count at:(to))) (add (piece (id "Seed" Mover)) (to (to)) count:(count at:(to))))))))) (end (forEach NonMover if:(no Pieces Player) (result Player Loss))))) END |
Modify the Ludii game according to the following option changes:
Played on a 9x9 board. -> Played on a 13x13 board.
(game "Gomoku" (players 2) (equipment { (board (square 9) use:Vertex) (piece "Marker" Each)}) (rules (play (move Add (to (sites Empty)))) (end (if (is Line 5 All exact:True) (result Mover Win)))))
###
| (game "Gomoku" (players 2) (equipment { (board (square 13) use:Vertex) (piece "Marker" Each)}) (rules (play (move Add (to (sites Empty)))) (end (if (is Line 5 All exact:True) (result Mover Win))))) END |
Construct a Ludii game based on the following description
The goal is to place eight queens on a standard Chess board so that none of them can take another. The puzzle is played on a 8x8 board
###
| (game "N Queens" (players 1) (equipment { (board (square 8) (values Cell (range 0 1))) (regions {AllDirections})}) (rules (play (satisfy { (is Count (sites Board) of:1 8) (all Different except:0)})) (end (if (is Solved) (result P1 Win))))) END |
Construct a Ludii game based on the following description
2x6-12 board, six is the most common. Four counters in each hole. A player moves by picking up the contents of one of their holes and sowing them in an anti-clockwise direction. If the final counter lands in an occupied hole, the contents of this hole are picked up and sowing continues. If the final counter falls into an empty hole, the turn ends. If the final counter falls into a hole containing three counters, making it four after the sowing, then these counters are captured and the turn ends. If at any time during sowing a player drops a counter into a hole to make it contain four, these are captured. If a player cannot move because there are no counters in their holes, they pass. When eight counters are left, the player to first capture a group of four also takes the remaining four counters on the board. Each player has 6 holes.
###
| (define "PiecesOwnedBy" (count Cell at:(handSite #1))) (game "Hoyito" (players 2) (equipment { (mancalaBoard 2 6 store:None (track "Track" "0,E,N,W" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece "Seed" Shared) (hand Each)}) (rules (start (set Count 4 to:(sites Track))) (play (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover)) if:(> (count at:(from)) 0)) (then (sow apply:(if (= (count at:(to)) 4) (if (<= (count in:(sites Board)) 8) (forEach Site (sites Board) (if (> (count at:(site)) 0) (fromTo (from (site)) (to (handSite Mover)) count:(count at:(site))))) (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to)))) (if (< (count at:(to)) 1) (moveAgain))))))) (end ("MancalaByScoreWhen" (no Moves Mover))))) END |
Describe the mechanics of the following Ludii game
(game "Huli-Mane Ata" (players 2) (equipment { (board (scale 1 2 (wedge 4 3)) use:Vertex) (hand P1) (piece "Lamb" P1 ("StepToEmpty")) (piece "Tiger" P2 (or ("StepToEmpty") ("HopCapture")))}) (rules (start { (place "Lamb1" (handSite P1) count:5) (place "Tiger2" (sites Top))}) phases:{ (phase "Opening" P1 (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) ("PhaseMovePiece" "Movement")} (end { (if (no Moves P2) (result P1 Win)) (if (< (count Pieces P1) 4) (result P2 Win))})))
###
| A triangle, with a line drawn from the apex to the base, and two lines drawn through the height connecting the opposite two sides. One player plays as one tiger, the other as five lambs. The tiger begins on the apex of the triangle. The tiger moves to an empty adjacent spot along the lines of the board. The player who plays as the lambs plays first, placing a lamb on an empty spot on the board, and then the tiger player moves. When all of the lambs are placed, the lambs move in the same manner as the tiger. The tiger may capture a lamb by hopping over it to an empty space on the opposite adjacent side of the lamb along the lines on the board. The lambs win when they block the tiger from being able to move, the tiger wins by capturing enough lambs so that it cannot be blocked. END |
Construct a Ludii game based on the following description
Two arcs which meet, in the shape of a horn, curving to the left. Nine points along the left side, and eight along the right, with one at the apex. Zig-zag lines connect points on either side of the board, connecting the first on the left to the first on the right, the first on the right to the second on the left, the second on the left to the second on the right, and so on. One player plays as the cow and the calf (black). The cow begins on the first point on the left, the calf on the second point on the right. The other player plays as two children (white), which begin on the second point on the left and the first point on the right. Players alternate turns moving a piece to an empty adjacent spot along the lines on the board. The cow never moves from its position. The calf plays first. The calf wins when it reaches the cow; the children win when they force the calf onto the apex of the board (the pasture).
###
| (game "Uxrijn Ever" (players 2) (equipment { (board (graph vertices:{ {0 0} {5 0} {0.17 1} {4.65 1} {0.3 2} {4.3 2} {0.38 3} {3.9 3} {0.25 4} {3.5 4} {-0.13 5} {2.97 5} {-0.75 6} {2.2 6} {-1.47 7} {0.95 7} {-2.22 8} {-3 9}} edges:{ {0 1} {0 2} {2 4} {4 6} {6 8} {8 10} {10 12} {12 14} {14 16} {16 17} {1 3} {3 5} {5 7} {7 9} {9 11} {11 13} {13 15} {1 2} {2 3} {3 4} {4 5} {5 6} {6 7} {7 8} {8 9} {9 10} {10 11} {11 12} {12 13} {13 14} {14 15} {15 16} {15 17}}) use:Vertex) (piece "Cow" P1) (piece "Calf" P1 (move Step (to if:(or ("IsPieceAt" "Cow" P1 (to)) (is Empty (to))) (apply (remove (to)))))) (piece "Human" P2 "StepToEmpty")}) (rules (start { (place "Cow1" 0) (place "Calf1" 3) (place "Human2" (sites {1 2}))}) (play (forEach Piece)) (end { (if (is In (where "Calf" P1) (sites Top)) (result P2 Win)) (if (= 1 (count Sites in:(sites Occupied by:P1))) (result P1 Win))}))) END |
Construct a Ludii game based on the following description
17x17 intersecting lines, with alternating black and white points, four equally spaced along the third and fifteenth rank and two along the seventh and eleventh rows, forming a large square. Each player has two kinds of piece, six bull-shaped pieces and 144 round pieces. To begin, players place their bull-shaped pieces on the opposite-color marked points on the board. Then, players alternate turns placing one of their pieces in an adjacent space next to one of their bull pieces. Once all of the bull pieces have been surrounded, the main phase of play begins. Players alternate turns placing one of their pieces on the board. The player who encloses the greatest number of empty spaces wins.
###
| (game "Dorvolz" (players 2) (equipment { (board (square 17) use:Vertex) (hand Each size:2) (piece "Bull" Each) (piece "Marker" Each) (regions "BullSites" P1 (sites {"C3" "K3" "O7" "C11" "G15" "O15"})) (regions "BullSites" P2 (sites {"G3" "O3" "C7" "O11" "C15" "K15"}))}) (rules (start { (place "Bull1" (handSite P1) count:6) (place "Bull2" (handSite P2) count:6) (place "Marker1" (handSite P1 1) count:144) (place "Marker2" (handSite P2 1) count:144)}) phases:{ (phase "BullPlacement" (play (move (from (handSite Mover)) (to (intersection (sites Empty) (sites Mover))))) (nextPhase Mover (= 6 (count Sites in:(intersection (sites Board) (sites Occupied by:Mover)))) "MarkerPlacementAroundBull")) (phase "MarkerPlacementAroundBull" (play (move (from (handSite Mover 1)) (to (intersection (sites Empty) (sites Around (sites Mover) All))))) (nextPhase Mover (= 54 (count Sites in:(intersection (sites Board) (sites Occupied by:Mover)))) "Playing")) (phase "Playing" (play (move (from (handSite Mover 1)) (to (sites Empty)))) (end (if (and ("HandEmpty" P1) ("HandEmpty" P2)) (byScore { (score P1 (size Territory P1 All)) (score P2 (size Territory P2 All))}))))})) END |
Construct a global Ludii definition which fulfills the following requirements.
Defines a hop move in all the directions specified (by default Adjacent) over a friend to an empty site. The friend piece is removed.
###
| (define "HopFriendCapture" (move Hop #1 #2 (between if:("IsFriendAt" (between)) (apply (remove (between)))) (to if:(is Empty (to))) #3)) END |
Describe the mechanics of the following Ludii game
(define "OppositePit" (if (is Mover P1) (+ (to) "Columns") (- (to) "Columns"))) (define "StoreLastHoleSowed" (set Var (to))) (define "LastHoleSowed" (sites {(var)})) (define "SowingEndInMyStore" (= (to) (mapEntry Mover))) (define "LastCounterInTheStore" (set Pending)) (define "WasInStore" (is Pending)) (define "PiecesCaptured" (count at:(mapEntry #1))) (define "Columns" 7) (game "Sungka" (players 2) (equipment { (mancalaBoard 2 "Columns" (track "Track" "7,W,WNW,ENE,E,ESE" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 FirstSite) (pair P2 LastSite)}) (piece "Seed" Shared)}) (rules (start (set Count "Columns" to:(union (sites P1) (sites P2)))) phases:{ (phase "Sowing" (play (move Select (from (if (and ("SameTurn") (not ("WasInStore"))) "LastHoleSowed" (sites Mover)) if:(< 0 (count at:(from)))) (then (sow apply:(if ("SowingEndInMyStore") (and (moveAgain) ("LastCounterInTheStore")) (if (and {(is In (to) (sites Mover)) (= (count at:(to)) 1) (< 0 (count at:"OppositePit"))}) (fromTo (from "OppositePit") (to (mapEntry (mover))) count:(count at:"OppositePit")) (if (> (count at:(to)) 1) (and (moveAgain) ("StoreLastHoleSowed"))))) skipIf:(= (to) (mapEntry Next)))))) (end (if (all Passed) { (if (> 7 (count at:(mapEntry P1))) (result P2 Win)) (if (> 7 (count at:(mapEntry P2))) (result P1 Win))})) (nextPhase (all Passed) "BetweenRounds")) (phase "BetweenRounds" (play (if (<= 7 (count at:(mapEntry Mover))) (move (from (mapEntry Mover)) (to (intersection (sites Empty) (sites Mover))) count:7))) (nextPhase (all Passed) "Sowing"))}))
###
| 2x7 board, with two stores. Each player owns the store to their left. Seven counters per hole. Players take counters from one hole and sow them in a clockwise direction starting in the next hole from which the counters were taken. Players include their own store when sowing but ignore their opponent's store. If last counter falls into an empty hole, move ends. If it is on the player's side, the counters in the opponent's hole opposite are taken and added to the player's store. If the last counter falls into the player's store, the player may sow counters from another hole on their side. If the last counter drops into an occupied hole on either side of the board, the counters are picked up and sowing continues until the last counter drops into an empty hole. When all of the counters are in the players' stores, a new round begins. Players fill their holes with the counters in their store. Any holes which cannot be filled with seven counters are out of play for this round; any extra counters go back in the store. Play continues until one player cannot fill any holes, and the opponent wins. END |
Construct a Ludii game based on the following description
The first player (Grey) has their home area on the left; the second player (Black) on the right.
In the initial setup phase players move their pieces from their hand to their home area. By default the pieces will be placed vertically. Press 'r' whilst moving it, to place one horizontally.
Finally the players take turns to guess spaces in their opponent's home area. These are revealed to be either water or a ship according to the following code: <b>C</b>arrier - 5 spaces; <b>B</b>attleship - 4 spaces; <b>D</b>estroyer - 3 spaces; <b>S</b>ubmarine - 3 spaces; <b>P</b>atrol Boat - 2 spaces.
###
| (define "DeclareVictory" (if (= (id #1) (var)) (result #1 Win))) (define "CheckForVictory" (if (and (>= (count Turns) 10) (= 0 (count Sites in:(intersection (sites Hidden to:Mover) (sites Occupied by:Next))))) (set Var (id Mover) (then (forEach Site (sites Board) (set Hidden at:(site) False to:Next)))))) (define "ClearShotSpace" (set State at:(last From) ("Hit") (then (set Hidden at:(last From) False to:Mover #1)))) (define "DefinePiece" (piece #3 Each) (tile #1 Each #2 (move (from if:(is In (from) (sites Hand Mover))) (to (intersection (sites Mover "Defence") (sites Empty))) (then (do (forEach Site (sites LargePiece at:(last To)) (remember Value (site)) (then (remove (last To)))) next:(do (forEach Value (values Remembered) (add (piece (id #3 Mover)) (to (value)) (then (set State at:(last To) 0)))) next:(forget Value All))))))) (define "Waves" (difference (sites Empty) (sites Hidden to:All))) (define "Hit" 1) (game "Battleships" (players 2) (equipment { (board (rectangle 10 20)) ("DefinePiece" "CarrierTemplate" { {F F F F} {L F F F F}} "Carrier") ("DefinePiece" "BattleshipTemplate" { {F F F} {L F F F}} "Battleship") ("DefinePiece" "DestroyerTemplate" { {F F} {L F F}} "Destroyer") ("DefinePiece" "SubmarineTemplate" { {F F} {L F F}} "Submarine") ("DefinePiece" "PatrolBoatTemplate" { {F} {L F}} "PatrolBoat") (regions "Defence" P1 (expand (sites Left) steps:9)) (regions "Defence" P2 (expand (sites Right) steps:9)) (hand Each size:5)}) (rules (start { (set Hidden (sites P1 "Defence") to:P2) (set Hidden (sites P2 "Defence") to:P1) (set Hidden (sites Hand P1) to:P2) (set Hidden (sites Hand P2) to:P1) (place "CarrierTemplate1" (handSite P1 0)) (place "CarrierTemplate2" (handSite P2 0)) (place "BattleshipTemplate1" (handSite P1 1)) (place "BattleshipTemplate2" (handSite P2 1)) (place "DestroyerTemplate1" (handSite P1 2)) (place "DestroyerTemplate2" (handSite P2 2)) (place "SubmarineTemplate1" (handSite P1 3)) (place "SubmarineTemplate2" (handSite P2 3)) (place "PatrolBoatTemplate1" (handSite P1 4)) (place "PatrolBoatTemplate2" (handSite P2 4))}) phases: { (phase "Setup" (play (forEach Piece container:(mover))) (nextPhase (>= (count Turns) 10) "Playing")) (phase "Playing" (play (move Select (from (intersection (sites Next "Defence") (sites Hidden to:Mover))) (then ("ClearShotSpace" (then ("CheckForVictory")))))))} (end { ("DeclareVictory" P1) ("DeclareVictory" P2)}))) END |
Construct a Ludii game based on the following description
4x8 board. Two counters in each hole. Sowing proceeds in an anti-clockwise direction. The first move must begin from the second hole from the right in the player's outer row, and proceed as follows, and is played simultaneously by both players: sow the two counters from that first hole, capture the counters in the opponent's two opposite holes and sow them, starting in the rightmost hole in the outer row, capture from the opposite two holes on the opponent's side and sow them again from the same hole. When the final counter falls in an occupied hole, those counters are picked up and sowing continues. The opening move ends when the final counter falls in an empty hole. The main phase then begins. When the final counter falls into an occupied hole in the player's inner row and both of the opposite holes on the opponent's side of the board are occupied, the counters in the opposite holes are captured and sown beginning in the first hole that was sown into to begin the sowing that caused the capture. When the final counter falls into an occupied hole and a capture is not possible, the contents of the hole are picked up and sowing continues. When the final counter lands in an empty hole, the turn ends. Players cannot sow from a hole containing a single counter. The player who captures all of their opponent's counters wins.
###
| (define "Columns" 8) (game "Otep" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "Track1" "0,E,N1,W" loop:True P1) (track "Track2" "16,E,N1,W" loop:True P2)}) (regions "Home" P1 (sites Track "Track1")) (regions "Home" P2 (sites Track "Track2")) (regions "Inner" P1 (difference (sites Track "Track1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "Track2") (sites Top))) (piece "Seed" Shared) (map "SecondRightOuter" {(pair P1 14) (pair P2 17)}) (map "RightOuter" {(pair P1 15) (pair P2 16)}) (hand Each)}) (rules (start (set Count 2 to:(sites Board))) phases:{ (phase "Opening1" (play (move Select (from (mapEntry "SecondRightOuter" Mover)) (then (sow "Track" owner:(mover) apply:(and (fromTo (from ("OppositePit" (last From))) (to (mapEntry "RightOuter" Mover)) count:2) (fromTo (from ("OppositeOuterPit" (last From))) (to (mapEntry "RightOuter" Mover)) count:2)))))) (nextPhase Mover "Opening2")) (phase "Opening2" (play (move Select (from (mapEntry "RightOuter" Mover)) (then (sow "Track" owner:(mover) apply:(and (fromTo (from ("OppositePit" (last From))) (to (mapEntry "RightOuter" Mover)) count:2) (fromTo (from ("OppositeOuterPit" (last From))) (to (mapEntry "RightOuter" Mover)) count:2)))))) (nextPhase Mover "Opening3")) (phase "Opening3" (play (move Select (from (if ("SameTurn") "LastHoleSowed" (sites {(mapEntry "RightOuter" Mover)}))) (then (sow "Track" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain)))))) (nextPhase Mover (not (is Next Prev)) "Sowing")) (phase "Sowing" (play (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover)) if:(> (count at:(from)) 1)) (then (sow "Track" owner:(mover) apply:(if (and { (is In (to) (sites Mover "Inner")) (< 1 (count at:(to))) (is Occupied ("OppositeOuterPit" (to))) (is Occupied ("OppositePit" (to)))}) (and { (fromTo (from ("OppositeOuterPit" (to))) (to (last From)) count:(count at:("OppositeOuterPit" (to)))) (fromTo (from ("OppositePit" (to))) (to (last From)) count:(count at:("OppositePit" (to)))) (sow (last From) count:(+ (count at:("OppositePit" (to))) (count at:("OppositeOuterPit" (to)))) "Track" owner:(mover))}) (if (< 1 (count at:(to))) (moveAgain))))))))} (end ("ForEachPlayerNoMovesLoss")))) END |
Modify the Ludii game according to the following option changes:
Each row has 9 holes. -> Each row has 10 holes.
(define "AllSitesNoMoreThanOne" (all Sites (sites Mover "Home") if:(>= 1 (count at:(site))))) (define "NextHole" ("NextSiteOnTrack" #2 from:#1 "Track")) (define "NoPiece" (all Sites (sites Player) if:(= 0 (count at:(site))))) (define "Columns" 9) (game "Njombwa (Two Counters)" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "Track1" "0,E,N1,W" loop:True P1) (track "Track2" "18,E,N1,W" loop:True P2)}) (regions "Home" P1 (sites Track "Track1")) (regions "Home" P2 (sites Track "Track2")) (regions "Inner" P1 (difference (sites Track "Track1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "Track2") (sites Top))) (piece "Seed" Shared)}) (rules (start { (set Count 2 to:(difference (sites Board) (sites {9 (+ 1 9) (- (* 9 3) 1) (- (* 9 3) 2)}))) (set Count 1 to:(sites {(+ 9 1) (- (* 9 3) 2)}))}) (play (if ("AllSitesNoMoreThanOne") (move Select (from (sites Mover "Home") if:(and (is Occupied (from)) (is Empty ("NextHole" (from) 1)))) (then (sow "Track" owner:(mover)))) (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover "Home")) if:(> (count at:(from)) 1)) (then (sow "Track" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (and (is In (to) (sites Mover "Inner")) (is Occupied ("OppositePit" (to)))) (and (remove ("OppositePit" (to))) (if (is Occupied ("OppositeOuterPit" (to))) (remove ("OppositeOuterPit" (to)))))))))))) (end (forEach NonMover if:("NoPiece") (result Player Loss)))))
###
| (define "AllSitesNoMoreThanOne" (all Sites (sites Mover "Home") if:(>= 1 (count at:(site))))) (define "NextHole" ("NextSiteOnTrack" #2 from:#1 "Track")) (define "NoPiece" (all Sites (sites Player) if:(= 0 (count at:(site))))) (define "Columns" 10) (game "Njombwa (Two Counters)" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "Track1" "0,E,N1,W" loop:True P1) (track "Track2" "20,E,N1,W" loop:True P2)}) (regions "Home" P1 (sites Track "Track1")) (regions "Home" P2 (sites Track "Track2")) (regions "Inner" P1 (difference (sites Track "Track1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "Track2") (sites Top))) (piece "Seed" Shared)}) (rules (start { (set Count 2 to:(difference (sites Board) (sites {10 (+ 1 10) (- (* 10 3) 1) (- (* 10 3) 2)}))) (set Count 1 to:(sites {(+ 10 1) (- (* 10 3) 2)}))}) (play (if ("AllSitesNoMoreThanOne") (move Select (from (sites Mover "Home") if:(and (is Occupied (from)) (is Empty ("NextHole" (from) 1)))) (then (sow "Track" owner:(mover)))) (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover "Home")) if:(> (count at:(from)) 1)) (then (sow "Track" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (and (is In (to) (sites Mover "Inner")) (is Occupied ("OppositePit" (to)))) (and (remove ("OppositePit" (to))) (if (is Occupied ("OppositeOuterPit" (to))) (remove ("OppositeOuterPit" (to)))))))))))) (end (forEach NonMover if:("NoPiece") (result Player Loss))))) END |
Construct a Ludii game based on the following description
Fifteen corn kernels are placed in a line; the playing spaces are the empty spaces between the kernels. Four corn kernels used as dice, marked on one side. The value of a throw is equal to the number of marked sides that land up, except when no marked sides are up, when the value is 5. Any number of players, who play on two teams, each starting from one side of the board. Five pieces per player. Players take turns moving pieces according to the throws of the corn, with two throws per turn. When a player reaches the opposite end of the board, they move to the start and continue moving in the same direction. If a piece lands on a space occupied by an opponent's piece, the player then moves in the reverse direction, carrying the opponent's piece with it in an attempt to move past the starting point and off the board. When the player moves past the starting point and then moves off the board, the opponent's piece is captured. The player who made the capture enters their piece again on their next turn. However, if the opponent lands on a piece carrying one of their pieces away, they then start carrying both of those pieces back to their starting point, freeing the captured piece and capturing the other player's piece. Players belonging to the same team may land on the same spot, but both are taken back to start if the opponent lands on them. Players cannot enter more than one of their pieces on the board at one time. The first team to capture all of the opposing team's pieces wins. The game has 6 players.
###
| (define "CapturedPiecesFollowCapturingPiece" (forEach Level (last From) FromTop (if ("CapturedPiece" (state at:(last From) level:(level))) (fromTo (from (last From) level:(level)) (to (last To)))))) (define "RebirthCapturingPiece" (add (piece (id "Stick" Mover)) (to (handSite Mover)))) (define "RemoveCapturedPieces" (forEach Level (last From) FromTop (if ("CapturedPiece" (state at:(last From) level:(level))) (remove (last From) level:(level))))) (define "EnterAPiece" (move (from (handSite Mover)) (to ("NextSiteOnTrack" (- "ThrowValue" 1) from:("EntryPoint" (mover)) "Track")))) (define "FreePiece" (= 0 #1)) (define "CapturedPiece" (= 2 #1)) (define "CapturingPiece" (= 1 #1)) (define "CaptureMove" (forEach Level (last To) FromTop (and (if ("IsEnemyAt" (last To) level:(level)) ("SetCapturePiece" at:(last To) level:(level))) (if ("IsFriendAt" (last To) level:(level)) ("SetCapturingPiece" at:(last To) level:(level)))))) (define "AtLeastAnEnemyPieceThere" (is In #1 (sites Occupied by:Enemy top:False))) (define "UnsetCapturingPieces" (forEach Level (last From) FromTop (if ("IsFriendAt" (last From) level:(level)) ("UnsetCapturingPiece" at:(last From) level:(level))))) (define "UnsetCapturingPiece" (set State #1 #2 0)) (define "SetCapturingPiece" (set State #1 #2 1)) (define "SetCapturePiece" (set State #1 #2 2)) (define "NoPieceOnBoard" (< (count Pieces Mover in:(sites Board)) 1)) (define "EntryPoint" (mapEntry "Entry" (mover))) (define "ThrowValue" (mapEntry "Throw" (count Pips))) (game "Boolik" (players 6) (equipment { (board (rectangle 1 15) { (track "Track1" {0..13} loop:True P1) (track "Track2" {13..0} loop:True P2) (track "CaptureTrack1" {13..0} P1 directed:True) (track "CaptureTrack2" {0..13} P2 directed:True) (track "Track3" {0..13} loop:True P3) (track "Track4" {13..0} loop:True P4) (track "CaptureTrack3" {13..0} P3 directed:True) (track "CaptureTrack4" {0..13} P4 directed:True) (track "Track5" {0..13} loop:True P5) (track "Track6" {13..0} loop:True P6) (track "CaptureTrack5" {13..0} P5 directed:True) (track "CaptureTrack6" {0..13} P6 directed:True)} use:Edge) (piece "Stick" Each (or (if ("FreePiece" (state at:(from) level:(level))) (move (from (from) level:(level)) (to ("NextSiteOnTrack" ("ThrowValue") from:(from) "Track")) (then (if ("AtLeastAnEnemyPieceThere" (last To)) ("CaptureMove"))))) (if ("CapturingPiece" (state at:(from) level:(level))) (if ("IsNotOffBoard" ("NextSiteOnTrack" ("ThrowValue") from:(from) "CaptureTrack")) (move (from (from) level:(level)) (to ("NextSiteOnTrack" ("ThrowValue") from:(from) "CaptureTrack")) (then (and ("CapturedPiecesFollowCapturingPiece") ("UnsetCapturingPieces")))) (move Remove (from) level:(level) (then (and { ("UnsetCapturingPieces") ("RemoveCapturedPieces") ("RebirthCapturingPiece")}))))))) (regions "AllSites" (sites Board Vertex)) (map "Throw" {(pair 0 5) (pair 1 1) (pair 2 2) (pair 3 3) (pair 4 4)}) (map "Entry" { (pair 1 0) (pair 2 13) (pair 3 0) (pair 4 13) (pair 5 0) (pair 6 13) (pair 7 0) (pair 8 13) (pair 9 0) (pair 10 13) (pair 11 0) (pair 12 13) (pair 13 0) (pair 14 13) (pair 15 0) (pair 16 13)}) ("StickDice" 4) (hand Each)}) (rules (start { (set Team 1 {P1 P3 P5}) (set Team 2 {P2 P4 P6}) (place Stack "Stick1" (handSite P1) count:5) (place Stack "Stick2" (handSite P2) count:5) (place Stack "Stick3" (handSite P3) count:5) (place Stack "Stick4" (handSite P4) count:5) (place Stack "Stick5" (handSite P5) count:5) (place Stack "Stick6" (handSite P6) count:5)}) (play ("RollMove" (or { (if (and ("NoPieceOnBoard") (is Occupied (handSite Mover))) ("EnterAPiece")) (forEach Piece)}) (then (if (and (not (no Pieces Mover)) ("NewTurn")) (moveAgain))))) (end ("CaptureAllTeam")))) END |
Construct a Ludii game based on the following description
GROUP - A connected chain of friendly stones.
TURN - Initially, Black drops one stone of either color, then for the remaining turns players drop two stones of either color.
GOAL - After the board is full, wins the player with the higher product between its two largest groups. If both products are equal, wins the player with less stones on board (note: draws are impossible).
###
| (define "ProductBiggestGroups" (* (max (sizes Group #1)) (max (difference (sizes Group #1) (max (sizes Group #1)))))) (game "Product" (players 2) (equipment { (board (hex 5)) (piece "Marker" Each)}) (rules (play (move Add (to (sites Empty)))) (end (if (is Full) (byScore { (score P1 ("ProductBiggestGroups" P1)) (score P2 ("ProductBiggestGroups" P2))}))))) END |
Describe the mechanics of the following Ludii game
(game "Tre Guti" (players 2) (equipment { (board (square 3) use:Vertex) (hand Each) (piece "Marker" Each (or ("StepToEmpty") ("HopCapture")))}) (rules (start (place "Marker" "Hand" count:3)) phases:{ (phase "Placement" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase ("HandEmpty" P2) "Movement")) ("PhaseMovePiece" "Movement")} (end ("CaptureAll" Next))))
###
| 3x3 crossed lines, pieces move on the intersections and along the lines. Three pieces per player. In the placement phase, players alternate turns placing one of their pieces on an empty spot. When all of the pieces are placed, Players attempt to capture their opponent's pieces by hopping over them. The player who captures all of the opponent's pieces wins. END |
Construct a global Ludii definition which fulfills the following requirements.
Defines backgammon tracks following the same direction for each player but starting from opposite corners in using the bar of the board.
###
| (define "BackgammonTracksSameDirectionOppositeCornersWithBars2" { (track "Track1" {6 25..20 18..13 0..5 7..12 #1} P1 directed:True) (track "Track2" {19 0..5 7..12 25..20 18..13 #1} P2 directed:True)}) END |
Construct a Ludii game based on the following description
5x5 intersecting lines with diagonals in the four quadrants. Twelve pieces per player, arranged on the intersections of the lines, on the first two ranks in front of each player and the two to the right of the player in the central rank. Pieces move in any direction one space. A piece may capture an opponent's piece by hopping over it to an empty space in a straight line. Captures are obligatory. If a player does not capture when they are supposed to, the opponent may remove that piece immediately and then play as normal. Once pieces reach the opposite side of the board from their starting position at the end of their turn, they are promoted and can move in any direction and over any distance. The player who captures all of their opponent's pieces or blocks them from being able to move wins.
###
| (define "HuffOnePieceOf" (move Select (from #1 if:(is Occupied (from))) (then (and { (remove (last To)) (moveAgain) (set Value Prev 0)})))) (define "ShouldCapturedButMoved" (and (is In (last From) ("SitesWithPossibleCaptureInPreviousTurn")) (is In (last From) (sites Empty)))) (define "SitesWithPossibleCaptureInPreviousTurn" (sites Pending)) (define "RememberSiteWithPossibleCapture" (set Pending (sites From (or (forEach Piece "Counter" ("Hop")) (forEach Piece "DoubleCounter" ("Hop")))))) (define "DidNotCaptured" (= (value Player Prev) 1)) (define "HasNotCaptured" (set Value Mover 1)) (define "HasCaptured" (set Value Mover 0)) (define "Hop" ("HopCapture" ~ ~ (then (and ("PromoteIfReach" (sites Next) "DoubleCounter") ("HasCaptured"))))) (game "Kharberg" (players 2) (equipment { ("AlquerqueBoard" 5 5) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece "Counter" Each (or ("Hop") ("StepToEmpty" ~ (then ("HasNotCaptured"))) (then ("PromoteIfReach" (sites Next) "DoubleCounter")))) (piece "DoubleCounter" Each (or ("Hop") (move Slide (then ("HasNotCaptured")))))}) (rules (start { (place "Counter1" (union {(expand (sites Bottom)) (sites {"D3" "E3"})})) (place "Counter2" (union {(sites {"A3" "B3"}) (expand (sites Top))}))}) (play (or (if ("DidNotCaptured") (or (if ("ShouldCapturedButMoved") ("HuffOnePieceOf" (last To))) ("HuffOnePieceOf" ("SitesWithPossibleCaptureInPreviousTurn")))) (do ("RememberSiteWithPossibleCapture") next:(forEach Piece)))) (end ("BlockWin")))) END |
Construct a Ludii game based on the following description
TURN - On each turn, each player drops a neutral stone on an empty cell provided that it does not share the same row, column or diagonal with all the stones already on board.
GOAL - Wins the last player to move
###
| (game "First Attack" (players 2) (equipment { (board (square 8)) (piece "Ball" Shared)}) (rules (play (move Add (piece "Ball") (to (sites Empty) if:(all Sites (sites Direction from:(to) Adjacent) if:(is Empty (site)))))) (end ("BlockWin")))) END |
Construct a global Ludii definition which fulfills the following requirements.
Defines two opposite table tracks.
###
| (define "TableTracksOpposite2" { (track "Track1" {11..0 12..23 #1} P1 directed:True) (track "Track2" {23..12 0..11 #1} P2 directed:True)}) END |
Construct a Ludii game based on the following description
The board consists of 5x5 intersecting lines with diagonals of each quadrant. Pieces are placed on the intersections and can move along the lines. Each player has 12 pieces. Pieces can move to one adjacent point. Captures can be made by hopping over an opponent's piece. The goal is to capture all of the opponent's pieces.
###
| (game "Bara Guti" (players 2) (equipment { ("AlquerqueBoard" 5 5) (piece "Marker" Each (or ("HopCapture") ("StepToEmpty")))}) (rules ("BeforeAfterCentreSetup" "Marker1" "Marker2") (play (forEach Piece)) (end ("CaptureAll" Next)))) END |
Construct a Ludii game based on the following description
2x12 board, divided in half. Spaces on each side take the form of semi-circular sockets, into which the pieces fit. Fifteen pieces per player. One player places all of their pieces on the sixth point of one of the quadrants of the board, and the other player places all of their pieces on the fifth point of the same quadrant. Three six-sided dice. Players move according to the number on each die by moving one piece the value on one die then another piece the value on the other die, or by moving one piece the value of one die and then the value of the other. Players move the pieces along the same track around the board, which ends on the quadrant on the other side of the board from the starting quadrant. When a piece is moved to a space occupied by a piece belonging to the opponent, the opponent's piece is sent back to the starting point. The first player to bear off all of their pieces from the board wins. All the pieces start in the first quadrant. The game involves 3 dice.
###
| (define "UseDie" (forEach Die if:("DieNotUsed") #1)) (define "PieceMove" (if ("IsOffBoard" #1) "RemoveAPiece" (if ("NoEnemyOrOnlyOne" #1) (move (from) (to #1 ("HittingCapture" (handSite (who at:(to))))))))) (define "RemoveAPiece" (move Remove (from))) (define "SiteToMoveOnTrackAtSix" ("NextSiteOnTrack" 6)) (define "SiteToMoveOnTrackAtFive" ("NextSiteOnTrack" 5)) (define "SiteToMoveOnTrackAtFour" ("NextSiteOnTrack" 4)) (define "SiteToMoveOnTrackAtThree" ("NextSiteOnTrack" 3)) (define "SiteToMoveOnTrackAtTwo" ("NextSiteOnTrack" 2)) (define "SiteToMoveOnTrackAtOne" ("NextSiteOnTrack" 1)) (game "Cab e Quinal" (players 2) (equipment { ("TableBoard" "TableTracksSameDirectionWithHands") (dice d:6 num:3) (hand Each) (piece "Disc" Each ("UseDie" ("PieceMove" ("NextSiteOnTrack" (pips)))))}) (rules (start { (place Stack "Disc1" 5 count:15) (place Stack "Disc2" 4 count:15)}) (play ("RollEachNewTurnMove" (or (forEach Piece top:True) (forEach Piece container:(mover) top:True) (then (if (or (= (value Player Mover) Undefined) (not (all DiceUsed))) (moveAgain) (if (and (all DiceUsed) (= (value Player Mover) 1)) (set Value Mover Undefined))))))) (end { ("EscapeWin") (if (and (no Moves P1) (no Moves P2)) (result Mover Draw))}))) END |
Modify the Ludii game according to the following option changes:
Opponent pieces become friends (Defector Y) -> Freinly pieces become Opponent's pieces
Triangle-8 Board (36) -> Triangle-15 Board (120)
(define "EdgesOfSide" (intersection (sites Outer Edge) (forEach of:(difference #1 (sites Corners Vertex)) (sites Incident Edge of:Vertex at:(site))))) (define "BoardColour" (colour 215 203 170)) (define "P2Colour" (colour White)) (define "P1Colour" (colour DarkGreen)) (define "IsConnectedAtStartOfFirstMove" (and (is Next (next)) ("IsConnectedPlayer")) (and (= 1) ("IsConnectedPlayer"))) (define "IsWinningConnectionAtSite" (is Connected 3 at:#1 { "Side1" "Side2" "Side3"})) (define "StonesOfIn" (intersection (sites Occupied by:#1) #2)) (define "FlipFromTo" (move Add (piece (id "Disc" #2)) (to (sites Occupied by:#1) if:(< ("NeighborCountOf" #2) (("NeighborCountOf" #1))) (apply (remove (to)))))) (define "AddToEmpty" (move Add (to (sites Empty)) (then (set Var "MoveInTurn" (% (+ 3 (var "MoveInTurn")) 2))))) (define "NeighborCountOf" (count Pieces #1 in:(sites Around (to) Orthogonal))) (define "Side3" (union (sites Side NW) (sites Side SW))) (define "Side2" (union (sites Side SE) (sites Side S))) (define "Side1" (union (sites Side NE) (sites Side N))) (define "AnyOfTheseSitesMeetThisCondition" (< 0 (size Array (array (forEach #1 #2))))) (game "00'Y'" (players 2) (equipment { (board (tri 8) use:Vertex) (piece "Disc" Each) (piece "Counter" Neutral maxState:2)}) (rules (play (priority { (if ("SameTurn") ("FlipFromTo" Next Mover)) ("AddToEmpty")} (then (if (or (= 1 (var "MoveInTurn")) (can Move ("FlipFromTo" Next Mover))) (moveAgain) (if ("AnyOfTheseSitesMeetThisCondition" (sites Occupied by:Next) if:("IsWinningConnectionAtSite" (site))) (trigger "Win" Next)))))) (end { (if (is Triggered "Win" Next) (result Next Win)) (if (and (no Moves Mover) ("AnyOfTheseSitesMeetThisCondition" (sites Occupied by:Next) if:("IsWinningConnectionAtSite" (site)))) (result Next Win))})))
###
| (define "EdgesOfSide" (intersection (sites Outer Edge) (forEach of:(difference #1 (sites Corners Vertex)) (sites Incident Edge of:Vertex at:(site))))) (define "BoardColour" (colour 215 203 170)) (define "P2Colour" (colour White)) (define "P1Colour" (colour DarkGreen)) (define "IsConnectedAtStartOfFirstMove" (and (is Next (next)) ("IsConnectedPlayer")) (and (= 1) ("IsConnectedPlayer"))) (define "IsWinningConnectionAtSite" (is Connected 3 at:#1 { "Side1" "Side2" "Side3"})) (define "StonesOfIn" (intersection (sites Occupied by:#1) #2)) (define "FlipFromTo" (move Add (piece (id "Disc" #2)) (to (sites Occupied by:#1) if:(< ("NeighborCountOf" #2) (("NeighborCountOf" #1))) (apply (remove (to)))))) (define "AddToEmpty" (move Add (to (sites Empty)) (then (set Var "MoveInTurn" (% (+ 3 (var "MoveInTurn")) 2))))) (define "NeighborCountOf" (count Pieces #1 in:(sites Around (to) Orthogonal))) (define "Side3" (union (sites Side NW) (sites Side SW))) (define "Side2" (union (sites Side SE) (sites Side S))) (define "Side1" (union (sites Side NE) (sites Side N))) (define "AnyOfTheseSitesMeetThisCondition" (< 0 (size Array (array (forEach #1 #2))))) (game "00'Y'" (players 2) (equipment { (board (tri 15) use:Vertex) (piece "Disc" Each) (piece "Counter" Neutral maxState:2)}) (rules (play (priority { (if ("SameTurn") ("FlipFromTo" Mover Next)) ("AddToEmpty")} (then (if (or (= 1 (var "MoveInTurn")) (can Move ("FlipFromTo" Mover Next))) (moveAgain) (if ("AnyOfTheseSitesMeetThisCondition" (sites Occupied by:Next) if:("IsWinningConnectionAtSite" (site))) (trigger "Win" Next)))))) (end { (if (is Triggered "Win" Next) (result Next Win)) (if (and (no Moves Mover) ("AnyOfTheseSitesMeetThisCondition" (sites Occupied by:Next) if:("IsWinningConnectionAtSite" (site)))) (result Next Win))}))) END |
Construct a global Ludii definition which fulfills the following requirements.
Allows to remove one piece of the enemy player.
###
| (define "RemoveAnyEnemyPiece" (move Remove (sites Occupied by:Enemy container:"Board") #1)) 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. The points form a continuous track in a horseshoe shape; each player progresses in opposite directions (one from their bottom right to the top right, the other from their bottom left to their top left). Fifteen pieces per player. The starting position is as such, number the points from the origin of each player's track: point six: five pieces; point 8: three pieces; point 13: five pieces; point 24: two pieces. Two dice. Players move according to the number on each die by moving one piece the value on one die then another piece the value on the other die, or by moving one piece the value of one die and then the value of the other. When a player's piece lands on a spot occupied by a single piece belonging to the opponent, the opponent's piece is sent back to the quadrant in which that player started with two pieces. Players bear off their pieces at the end of their track. The first player to bear off all their pieces wins.
###
| (define "GoBack" (if (and (!= (to) (regionSite (sites #1 "StartQuadrant") index:0)) (not ("IsFriendAt" (regionSite (sites #1 "StartQuadrant") index:0)))) (regionSite (sites #1 "StartQuadrant") index:0) (if (and (!= (to) (regionSite (sites #1 "StartQuadrant") index:1)) (not ("IsFriendAt" (regionSite (sites #1 "StartQuadrant") index:1)))) (regionSite (sites #1 "StartQuadrant") index:1) (if (and (!= (to) (regionSite (sites #1 "StartQuadrant") index:2)) (not ("IsFriendAt" (regionSite (sites #1 "StartQuadrant") index:2)))) (regionSite (sites #1 "StartQuadrant") index:2) (if (and (!= (to) (regionSite (sites #1 "StartQuadrant") index:3)) (not ("IsFriendAt" (regionSite (sites #1 "StartQuadrant") index:3)))) (regionSite (sites #1 "StartQuadrant") index:3) (if (and (!= (to) (regionSite (sites #1 "StartQuadrant") index:4)) (not ("IsFriendAt" (regionSite (sites #1 "StartQuadrant") index:4)))) (regionSite (sites #1 "StartQuadrant") index:4) (if (and (!= (to) (regionSite (sites #1 "StartQuadrant") index:5)) (not ("IsFriendAt" (regionSite (sites #1 "StartQuadrant") index:5)))) (regionSite (sites #1 "StartQuadrant") index:5) (if (and (!= (to) (regionSite (sites #1 "StartQuadrant") index:6)) (not ("IsFriendAt" (regionSite (sites #1 "StartQuadrant") index:6)))) (regionSite (sites #1 "StartQuadrant") index:6) Off)))))))) (define "NextSiteFrom" ("NextSiteOnTrack" #2 from:#1)) (game "Todas Tablas" (players 2) (equipment { ("TableBoard" "TableTracksOpposite2") (dice d:6 num:2) (piece "Disc" Each (forEach Die if:("DieNotUsed") (if ("IsOffBoard" ("NextSiteFrom" (from) (pips))) (move Remove (from)) (move (from (from)) (to ("NextSiteFrom" (from) (pips)) if:("NoEnemyOrOnlyOne" (to)) ("HittingCapture" ("GoBack" Next))))) (then ("ReplayNotAllDiceUsed")))) (regions "StartQuadrant" P1 (sites {6..11})) (regions "StartQuadrant" P2 (sites {18..23}))}) (rules (start { (place Stack "Disc1" 6 count:5) (place Stack "Disc1" 4 count:3) (place Stack "Disc1" 12 count:5) (place Stack "Disc1" 23 count:2) (place Stack "Disc2" 18 count:5) (place Stack "Disc2" 16 count:3) (place Stack "Disc2" 0 count:5) (place Stack "Disc2" 11 count:2)}) (play ("RollEachNewTurnMove" (forEach Piece))) (end ("EscapeWin")))) END |
Construct a Ludii game based on the following description
Three concentric circles, with four diameters dividing it into eight equal sections. Twelve pieces per player, placed on the points on one half of the circle, leaving the central point open. Players alternate turns moving one of their pieces to an empty adjacent spot along the lines. A piece may capture an opponent's piece by hopping over it to an empty spot immediately on the opposite side of the opponent's piece along the lines. The player who captures all of the opponent's pieces wins.
###
| (game "Bara Guti (Bihar)" (players 2) (equipment { (board (concentric {1 8 8 8}) use:Vertex) (piece "Counter" Each (or ("HopRotationalCapture") ("StepRotationalToEmpty")))}) (rules (start { (place "Counter1" (sites {2..5 10..13 18..21})) (place "Counter2" (sites {1 9 17 6..8 14..16 22..24}))}) (play (forEach Piece)) (end ("CaptureAll" Next)))) END |
Construct a Ludii game based on the following description
The board is a five-pointed star. The player has nine pieces. The player attempts to place all the pieces on the board. The player choses a point, then moves the piece two spaces in a straight line. The piece may move through a spot occupied by another piece, but must land on an empty space. The player wins by successfully placing all nine pieces.
###
| (game "Pentalpha" (players 1) (equipment { ("StarBoard" 5) (hand Each) (piece "Marker" P1 ("HopFriendCapture"))}) (rules (start (place "Marker" (handSite P1) count:9)) (play (if (is Even (count Moves)) (move (from (handSite Mover)) (to (sites Empty)) (then (moveAgain))) (forEach Piece (if (= (from) (last To)) (move Hop (between if:(or ("IsFriendAt" (between)) (is Empty (between)))) (to if:(is Empty (to)))))))) (end { (if (and (is Even (count Moves)) ("HandEmpty" Mover)) (result Mover Win)) (if (no Moves Next) (result Mover Loss))}))) END |
Construct a Ludii game based on the following description
Choose between two versions:
-- Place the most stones, or
-- Form the largest group.
Ties are broken by relying on a cascading comparison of largest groups;
- With a standard choice of breaking the tie in favor of the underdog.
The board starts empty.
Players take turns in sequence. Passing is allowed.
The game ends when all players have passed in succession.
On a turn, the mover either:
1: Places a stone on an empty site, - or -
2: Replaces an opponent's stone with their own,
---- But replacing a stone is only allowed when there are more stones around that site of the captured stone's color than there are of the mover's own color.
Note: On boards with diagonals, diagonally adjacent stones are part of the count used to allow or disallow capture.
At the end of the game, players count all their stones, or count the stones in their largest group, depending on the goal. Which stones belong to a given group are determined by orthogonal connections.
In the case of a tie between the leading players, each pair of those players compares the size of their largest remaining group after any tied pairs have been removed.
This difference is added to the score of the player with the larger group in that pairing - (or to the score of other player in that pairing, in the case of underdog tie-breaking)
The winner of the game is decided by these amended scores.
Ties may still remain. Also ties between non-leading players are not resolved. Order 4 board Triangle-Square N-2: Capture-compare all 7 adjacent directions. Scoring - groups connect only in the 5 edge-edge directions. Score a point for each stone placed. While ignoring paired groups of equal size, if your largest group is SMALLER, augment your score by the difference between your largest group and the largest group for every tied opponent. 2 players
###
| (define "ColourBackground" (colour 136 175 96)) (define "SquareDiagonal" (board (square (- (* 2 4) 2)) use:Vertex)) (define "SquareGrid" (board (square 4) use:Cell)) (define "TriSquare" (board (tiling T33434 (- 4 2)) use:Vertex)) (define "HexCell" (board (hex Hexagon 4) use:Cell)) (define "Hex2Limp" (board (hex (- 4 1) (+ 4 1)) use:Cell)) (define "HexLimp" (board (hex Limping (- 4 1)) use:Cell)) (define "BoardUsed" "TriSquare") (define "ConnectionDirection" All) (define "ScoreConnection" Adjacent) (define "Anemone" (or { (move Pass) (move Claim (to (sites Empty))) (forEach Site (difference (difference (sites Board) (sites Empty)) (sites Occupied by:Mover)) (if ("LessQtyAroundSiteThanAnother" (who at:(site))) (move Remove (site) (then (claim (to (last To)))))))} (then ("Scoring" ("StoneCount" (player)))))) (define "LessQtyAroundSiteThanAnother" (> (max 0 (count Pieces of:#1 in:(sites Around (site) "ConnectionDirection"))) (max 0 (count Pieces of:(mover) in:(sites Around (site) "ConnectionDirection"))))) (define "StoneCount" (count Sites in:(sites Occupied by:Player))) (define "GroupCount" (max 0 (max (sizes Group "ScoreConnection" of:#1)))) (define "Tied4FirstPlace" (= (#1) (max (difference (values Remembered "Scores") #1)))) (define "LargerGroup" (max 0 (max (difference (sizes Group "ScoreConnection" of:#1) (sizes Group "ScoreConnection" of:#2))))) (define "CascadeLoses" (max 0 (- ("LargerGroup" (value) (player)) ("LargerGroup" (player) (value))))) (define "CascadeWins" (max 0 (- ("LargerGroup" (player) (value)) ("LargerGroup" (value) (player))))) (define "Scoring" (if (all Passed) (do (forEach Player (remember Value "Scores" #1)) next:(do (forEach Player (if ("Tied4FirstPlace" #1) (and (remember Value "Tied" (player)) (set Score Player #1)) (set Score Player #1))) next:(do (forEach Value (values Remembered "Tied") (forEach (players All if:(is In (player) (values Remembered "Tied"))) (addScore (player (player)) ("CascadeLoses")))) next:(forget Value "Scores" All (then (forget Value "Tied" All)))))) (forEach Player (set Score Player #1)))) (game "Windflowers" (players 2) (equipment { "BoardUsed" (piece "Ball" Each)}) (rules (start (set Score Each 0)) (play "Anemone") (end (if (all Passed) (byScore))))) END |
Modify the Ludii game according to the following option changes:
Each row has 9 holes. -> Each row has 11 holes.
(define "Move" (or { (if ("IsInTrack" (site) "HomeTrack") (move (from (site)) (to ("NextSiteOnTrack" ("ThrowValue") from:(site) "HomeTrack") "CaptureEnemyPiece") count:(count at:(site)))) (if ("IsInTrack" (site) "MiddleTrack") (move (from (site)) (to ("NextSiteOnTrack" ("ThrowValue") from:(site) "MiddleTrack") "CaptureEnemyPiece") count:(count at:(site)))) (if ("IsInTrack" (site) "EnemyTrack") (if (if (is In (site) (sites Next "Home")) True (and (!= 0 ("CountPiecesInHome" Next)) ("PieceDidNotGoToEnemyHome" (site)))) (move (from (site)) (to ("NextSiteOnTrack" ("ThrowValue") from:(site) "EnemyTrack") "CaptureEnemyPiece") count:(count at:(site)) (then (if (and (is In (last To) (sites Next "Home")) ("PieceDidNotGoToEnemyHome" (last To))) ("PieceGoesToEnemyHome" (last To)))))))})) (define "IsInTrack" (is In #1 (sites Track Mover #2))) (define "PieceDidNotGoToEnemyHome" (= 0 (state at:#1))) (define "PieceGoesToEnemyHome" (set State at:#1 1)) (define "CountPiecesInHome" (count Pieces #1 in:(sites #1 "Home"))) (define "CaptureEnemyPiece" (apply if:("IsEnemyAt" (to)) (remove (to) count:(count at:(to))))) (define "Tab" (= 1 ("ThrowValue"))) (define "SpecialThrows" (is In ("ThrowValue") (sites {1 4 6}))) (define "ThrowValue" (mapEntry (count Pips))) (game "Tab" (players 2) (equipment { (board (rectangle 4 9) { (track "HomeTrack1" "0,E,N1,W" P1 directed:True) (track "HomeTrack2" "35,W,S1,E" P2 directed:True) (track "MiddleTrack" "17,W,N1,E" loop:True) (track "EnemyTrack1" "18,E,N1,W,S1,E" P1 directed:True) (track "EnemyTrack2" "17,W,S1,E,N1,W" P2 directed:True)} use:Vertex) (piece "Stick" Each) (regions "AllSites" (sites Board)) ("StickDice" 4) (map "Throw" {(pair 0 6) (pair 1 1) (pair 2 2) (pair 3 3) (pair 4 4)}) (regions "Home" P1 (sites Bottom)) (regions "Home" P2 (sites Top))}) (rules (start { (place "Stick1" (sites Bottom)) (place "Stick2" (sites Top))}) phases:{ (phase "InitGame" (play ("RollMove" (move Pass) (then (if ("Tab") (moveAgain))))) (nextPhase ("Tab") "Play")) (phase "Play" (play ("RollMove" (forEach Site (sites Occupied by:Mover) ("Move")) (then (if ("SpecialThrows") (moveAgain))))))} (end ("CaptureAll" Next))))
###
| (define "Move" (or { (if ("IsInTrack" (site) "HomeTrack") (move (from (site)) (to ("NextSiteOnTrack" ("ThrowValue") from:(site) "HomeTrack") "CaptureEnemyPiece") count:(count at:(site)))) (if ("IsInTrack" (site) "MiddleTrack") (move (from (site)) (to ("NextSiteOnTrack" ("ThrowValue") from:(site) "MiddleTrack") "CaptureEnemyPiece") count:(count at:(site)))) (if ("IsInTrack" (site) "EnemyTrack") (if (if (is In (site) (sites Next "Home")) True (and (!= 0 ("CountPiecesInHome" Next)) ("PieceDidNotGoToEnemyHome" (site)))) (move (from (site)) (to ("NextSiteOnTrack" ("ThrowValue") from:(site) "EnemyTrack") "CaptureEnemyPiece") count:(count at:(site)) (then (if (and (is In (last To) (sites Next "Home")) ("PieceDidNotGoToEnemyHome" (last To))) ("PieceGoesToEnemyHome" (last To)))))))})) (define "IsInTrack" (is In #1 (sites Track Mover #2))) (define "PieceDidNotGoToEnemyHome" (= 0 (state at:#1))) (define "PieceGoesToEnemyHome" (set State at:#1 1)) (define "CountPiecesInHome" (count Pieces #1 in:(sites #1 "Home"))) (define "CaptureEnemyPiece" (apply if:("IsEnemyAt" (to)) (remove (to) count:(count at:(to))))) (define "Tab" (= 1 ("ThrowValue"))) (define "SpecialThrows" (is In ("ThrowValue") (sites {1 4 6}))) (define "ThrowValue" (mapEntry (count Pips))) (game "Tab" (players 2) (equipment { (board (rectangle 4 11) { (track "HomeTrack1" "0,E,N1,W" P1 directed:True) (track "HomeTrack2" "43,W,S1,E" P2 directed:True) (track "MiddleTrack" "21,W,N1,E" loop:True) (track "EnemyTrack1" "22,E,N1,W,S1,E" P1 directed:True) (track "EnemyTrack2" "21,W,S1,E,N1,W" P2 directed:True)} use:Vertex) (piece "Stick" Each) (regions "AllSites" (sites Board)) ("StickDice" 4) (map "Throw" {(pair 0 6) (pair 1 1) (pair 2 2) (pair 3 3) (pair 4 4)}) (regions "Home" P1 (sites Bottom)) (regions "Home" P2 (sites Top))}) (rules (start { (place "Stick1" (sites Bottom)) (place "Stick2" (sites Top))}) phases:{ (phase "InitGame" (play ("RollMove" (move Pass) (then (if ("Tab") (moveAgain))))) (nextPhase ("Tab") "Play")) (phase "Play" (play ("RollMove" (forEach Site (sites Occupied by:Mover) ("Move")) (then (if ("SpecialThrows") (moveAgain))))))} (end ("CaptureAll" Next)))) END |
Construct a global Ludii definition which fulfills the following requirements.
Defines a rectangular graph with Alquerque-style alternating diagonals with four triangle extension on each side.
###
| (define "AlquerqueGraphWithFourTriangles" (merge { (shift 2 2 (square 5 diagonals:Alternating)) (shift 2 0 (wedge 3)) (shift 5 3 (rotate 90 (wedge 3))) (shift 2 6 (rotate 180 (wedge 3))) (shift -1 3 (rotate 270 (wedge 3)))})) END |
Construct a Ludii game based on the following description
8x8 board. Four players. Two dice. Four pawns, one ship, one horse, one elephant, and one king per player. The king moves one square in any direction. Pawns move one square forward, and capture one square forward diagonally. Horses move three squares diagonally. Ships move two squares diagonally. The Elephant moves any number of squares orthogonally. Moves are determined by dice roll: 5= pawn or king, 4= elephant, 3= horse, 2= ship. Captures are made by moving onto the space occupied by an opponent's piece. If a ship moves into a space to make a 2x2 square with only ships, it captures the other three ships. Pawns may promote but only to the other piece that begins in that rank or file, including a king, and that piece must have already been captured. Points are awarded based on captures: pawns=1, ships=2, horses=3, elephants=4, kings=5. If a player captures their opponents' three kings while theirs remains, they receive 54 points. The player who accumulates the most points wins. The rules are describing with the Wikipedia ruleset.
###
| (define "PlayAPiece" (forEach Die (if (= (pips) 5) (or (forEach Piece "Pawn") (forEach Piece "King_noCross")) (if (= (pips) 4) (forEach Piece "Elephant") (if (= (pips) 3) (forEach Piece "Knight") (if (= (pips) 2) (forEach Piece "Boat"))))))) (define "PromoteTo" (if ("IsOffBoard" (where #1 Mover)) (move Promote (last To) (piece #1) Mover (then #2)))) (define "CaptureForwardDiagonal" (move Step (directions {FR FL}) (to if:("IsEnemyAt" (to)) "CaptureToPieceAndAddScore"))) (define "CaptureToPieceAndAddScore" (apply (if (is Occupied (to)) (and (addScore Mover (value Piece at:(to))) (remove (to)))))) (game "Chaturaji" (players {(player N) (player W) (player S) (player E)}) (equipment { (board (square 8)) (dice d:4 from:2 num:1) (piece "Pawn" Each (or "StepForwardToEmpty" "CaptureForwardDiagonal" (then (if (is In (last To) (sites Mover "Promotion")) (and (moveAgain) (set Pending)))))) (piece "Boat" Each (move Hop Diagonal (to if:(not ("IsFriendAt" (to))) "CaptureToPieceAndAddScore"))) (piece "Knight" Each (move Leap "KnightWalk" (to if:(not ("IsFriendAt" (to))) "CaptureToPieceAndAddScore"))) (piece "Elephant" Each (move Slide Orthogonal (between if:(is Empty (between))) (to if:("IsEnemyAt" (to)) "CaptureToPieceAndAddScore"))) (piece "King_noCross" Each (move Step (to if:(not ("IsFriendAt" (to))) "CaptureToPieceAndAddScore"))) (regions "Promotion" P1 (sites Top)) (regions "Promotion" P2 (sites Left)) (regions "Promotion" P3 (sites Bottom)) (regions "Promotion" P4 (sites Right))}) (rules (start { (place "Pawn1" {"A2" "B2" "C2" "D2"} value:1) (place "Pawn2" {"G1" "G2" "G3" "G4"} value:1) (place "Pawn3" {"H7" "G7" "E7" "F7"} value:1) (place "Pawn4" {"B5" "B6" "B7" "B8"} value:1) (place "Boat1" coord:"A1" value:2) (place "Boat2" coord:"H1" value:2) (place "Boat3" coord:"H8" value:2) (place "Boat4" coord:"A8" value:2) (place "Knight1" coord:"B1" value:3) (place "Knight2" coord:"H2" value:3) (place "Knight3" coord:"G8" value:3) (place "Knight4" coord:"A7" value:3) (place "Elephant1" coord:"C1" value:4) (place "Elephant2" coord:"H3" value:4) (place "Elephant3" coord:"F8" value:4) (place "Elephant4" coord:"A6" value:4) (place "King_noCross1" coord:"D1" value:5) (place "King_noCross2" coord:"H4" value:5) (place "King_noCross3" coord:"E8" value:5) (place "King_noCross4" coord:"A5" value:5)}) (play ("RollEachNewTurnMove" (if (and ("SameTurn") (is Pending)) (or { ("PromoteTo" "Boat" (set Value at:(last To) 2)) ("PromoteTo" "Knight" (set Value at:(last To) 3)) ("PromoteTo" "Elephant" (set Value at:(last To) 4)) ("PromoteTo" "King_noCross" (set Value at:(last To) 5))}) "PlayAPiece" (then (if (can Move "PlayAPiece") (moveAgain)))))) (end (if (= (count Pieces Mover) (- (count Pieces All) 1)) (byScore))))) END |
Construct a Ludii game based on the following description
Wagner is a non-capturing game. Initially, each player places a stone at any vertex (not the centre) to maintain the graph colouring rules (i.e., no two friendly pieces are adjacent to each other). Each turn a player moves a friendly stone to an adjacent empty site. The goal is to make all the friendly pieces into a single group.
###
| (game "Wagner" (players 2) (equipment { (board (graph vertices:{ {2 0} {5 0} {0 2} {0 5} {7 2} {7 5} {2 7} {5 7}} edges:{ {0 1} {0 2} {0 7} {1 4} {1 6} {2 3} {2 5} {3 4} {3 6} {4 5} {5 7} {6 7}}) use:Vertex) (piece "Marker" Each ("StepToEmpty"))}) (rules (start { (set P1 Vertex (sites {0 5 6})) (set P2 Vertex (sites {1 2 7}))}) (play (forEach Piece)) (end (if (= 1 (count Groups if:(= (who at:(to)) (mover)))) (result Mover Win))))) END |
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. Two pieces per player. Four stick dice are used, each with one marked side. Each die is marked differently for a different value: 4, 6, 14, 15. The throws are as follows: All marked sides up = 5; three marked sides up = 3; two marked sides up = 2, one marked side up = the value of the marked side; zero marked sides up = 10. Throws of 14 may instead be played as a throw of 1, whenever the player chooses. Players’ pieces enter on the branching arcs. Players move in opposite directions around the board, and then back down the arc in which they started, moving their pieces off the board. If a player lands on the same spot as the opponent, the opponent’s piece is removed from the board and must re-enter. A player's piece is allowed to occupy the same space as that player's other piece. On the last side of the rectangle before completing a circuit of the board, only throws of 1, 2, or 3 are used. Players must make an exact throw to get a piece off the board. The first player to remove their pieces from the board wins.
###
| (define "Movement" (if (if (not (is In (from) (sites Mover "LastSide"))) True (or { (= ("ThrowValue") 1) (= ("ThrowValue") 2) (= ("ThrowValue") 3)})) (or (if (= 14 ("ThrowValue")) (if ("IsEndTrack" ("SiteToMoveOnTrack" 1)) "RemoveAPiece" (move (from (from) level:(level)) (to ("SiteToMoveOnTrack" 1) ("HittingStackCapture" (handSite (who at:(to) level:(level)))))))) (if ("IsEndTrack" ("SiteToMoveOnTrack" ("ThrowValue"))) "RemoveAPiece" (move (from (from) level:(level)) (to ("SiteToMoveOnTrack" ("ThrowValue")) ("HittingStackCapture" (handSite (who at:(to) level:(level)))))))))) (define "RemoveAPiece" (move Remove (from) level:(level))) (define "ThrowValue" (mapEntry "Throw" (count Pips))) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" #1)) (game "Romavoa" (players 2) (equipment { ("KintsBoard" { (track "Track1" "46,5,SSE,N,E,S,W,NNW2,End" P1 directed:True) (track "Track2" "47,41,NNW,W,S,E,N,SSE2,End" P2 directed:True)}) (regions "AllSites" (sites Board)) (regions "LastSide" P1 (sites {6..9 23..27})) (regions "LastSide" P2 (sites {27 33..40})) (dice d:2 facesByDie:{{0 4} {0 6} {0 14} {0 15}} num:4) (piece "Marker" Each ("Movement")) (hand Each) (map "Throw" { (pair 0 10) (pair 39 5) (pair 24 3) (pair 25 3) (pair 35 3) (pair 33 3) (pair 10 2) (pair 18 2) (pair 19 2) (pair 20 2) (pair 21 2) (pair 29 2)})}) (rules (start { (place Stack "Marker1" (handSite P1) count:2) (place Stack "Marker2" (handSite P2) count:2)}) (play ("RollMove" (or (forEach Piece) (forEach Piece container:(mover))))) (end ("EscapeWin")))) END |
Construct a Ludii game based on the following description
Tri-It-Out is a 2-player strategy game played on a hex grid.
Definitions:
-- A 'Triangle' means a pattern of 3 counters that are equidistant from each other, it may be in any orientation including orientations with edges that do not follow grid lines.
-- A 'Mixed Triangle' is a triangle made of more than one player's counters.
-- A 'Restricted Location' is an empty intersection that would form a Mixed Triangle if either player placed a piece there; that is it would form a Triangle that includes a mixed-color pair of counters already on the board.
The goal is to have the FEWEST counters on the board when no further play is possible. In the case of a tie, the player who would have been next to make a placement loses.
Turns consist of:
-- 1) a Placement of a piece onto an empty site that is not a 'Restricted Location'.
-- 2) If any new Mixed Triangles are created, a Capture is made by removing one opponent's piece from one of them.
A player must continue to take a series of consecutive turns until a Placement is made that cannot be followed by a Capture. Standard Rules Board & size: Hexhex with edges alternating 3 and 4
###
| (define "Tri78Bug" (tri {7 8 7 10 6})) (define "Tri57Bug" (tri {5 7 5 8 5})) (define "Tri56Bug" (tri {5 6 5 7 5})) (define "Tri46Bug" (tri {4 6 4 7 4})) (define "EndCondition" (no Moves Mover)) (define "Sites2Capture" ("TriangleSites" (sites Occupied by:Next) (sites Occupied by:Next) { (value Player (mover))})) (define "OutstandingCaptures" (< 0 (size Array (array "Sites2Capture")))) (define "TriangleSites" (union { ("Due2Step" {F} #1 #2 #3) ("Due2Step" {F R F} #1 #2 #3) ("Due2Step" {F F} #1 #2 #3) ("Due2Step" {F R F F} #1 #2 #3) ("Due2Step" {F F R F} #1 #2 #3) ("Due2Step" {F F R F F} #1 #2 #3) ("Due2Step" {F F F} #1 #2 #3) ("Due2Step" {F R F F F} #1 #2 #3) ("Due2Step" {F F F R F} #1 #2 #3) ("Due2Step" {F F R F F F} #1 #2 #3) ("Due2Step" {F F F R F F} #1 #2 #3) ("Due2Step" {F F F F} #1 #2 #3) ("Due2Step" {F F F R F F F} #1 #2 #3) ("Due2Step" {F R F F F F} #1 #2 #3) ("Due2Step" {F F F F R F} #1 #2 #3) ("Due2Step" {F F F F R F F} #1 #2 #3) ("Due2Step" {F F R F F F F} #1 #2 #3) ("Due2Step" {F F F F F} #1 #2 #3) ("Due2Step" {F F F R F F F F} #1 #2 #3) ("Due2Step" {F F F F R F F F} #1 #2 #3) ("Due2Step" {F F F F F R F} #1 #2 #3) ("Due2Step" {F R F F F F F} #1 #2 #3)})) (define "Due2Step" (intersection (sites Board) (sites (results from:#2 to:(intersection (sites (from) { #1} rotations:True) #3) (if (!= 0 (size Array (intersection (intersection (array (sites (from) { #1} rotations:True)) (array (sites (to) { #1} rotations:True))) (array #4)))) (from) -1))))) (game "Tri-It-Out" (players 2) (equipment { (board (tri {3 4 3 4 3}) use:Vertex) (piece "Counter" Each)}) (rules (meta (no Repeat PositionalInTurn)) (start { (set Score Each 0)}) (play (if (is Pending) (move Remove (sites Pending) (then (and (set Value Mover Infinity) (moveAgain)))) (move Add (to (difference (sites Empty) ("TriangleSites" (sites Empty) (sites Occupied by:P1) (sites Occupied by:P2))) (apply (set Value Mover (to)))) (then (if "OutstandingCaptures" (and (set Pending "Sites2Capture") (moveAgain))))) (then (set Score P1 (- (count Pieces P1)) (then (set Score P2 (- (count Pieces P2)))))))) (end { (if (and { (no Moves Next) False}) (result Mover Loss)) (if (and (no Moves Next) (= (count Pieces P1) (count Pieces P2))) (result Mover Loss)) (if (and (no Moves Next) (!= (count Pieces P1) (count Pieces P2))) (byScore))}))) END |
Construct a Ludii game based on the following description
To be reconstructed. Rules as inferred by Murray 1951. One player is the bean, and the other player plays with twelve corn kernels. The corn kernels move along the lines. The goal is to corner the bean so that it cannot move. The bean may hop over the corn kernels to capture them or move to an adjacent empty point along the lines. The bean wins by reducing the opponent to nine corn kernels. The coyote can jump to capture.
###
| (game "Pon Chochotl" (players 2) (equipment { ("AlquerqueBoard" 5 5) (piece "Corn" P1 "StepToEmpty") (piece "Bean" P2 (or ("HopCapture") (if ("SameTurn") (move Pass) ("StepToEmpty"))))}) (rules (start { (place "Corn1" (union {(expand (sites Bottom)) (sites {"A3" "E3"})})) (place "Bean2" (centrePoint))}) (play (forEach Piece)) (end ("NoMovesLossAndLessNumPiecesPlayerLoss" P1 9)))) END |
Construct a Ludii game based on the following description
The rules are the same as for Halma. Pieces move one space orthogonally or diagonally. They may jump over a piece of any color. Multiple jumps in one turn are possible. Jumps do not capture. The player who first places all of their pieces in the opponent's starting position wins. The game is played on a board 8x8.
###
| (define "HopSequence" ("Hop" #1 (then (if (can Move ("Hop" (last To))) (moveAgain))))) (define "Hop" (move Hop (from #1) (between if:(is Occupied (between))) (to if:(and ("IsEmptyAndNotVisited" (to)) (or (not ("FromIsOnTheRegionToFill" #1)) ("ToIsOnTheRegionToFill" (to))))) #2)) (define "ToIsOnTheRegionToFill" (is In #1 (sites (player (mapEntry (mover)))))) (define "FromIsOnTheRegionToFill" (is In #1 (sites (player (mapEntry (mover)))))) (game "Grasshopper" (players 2) (equipment { (board (square 8)) (piece "Counter" Each) (regions "Home" P1 (expand origin:(coord "A1") steps:3 Orthogonal)) (regions "Home" P2 (expand origin:(coord "H8") steps:3 Orthogonal)) (map {(pair P1 P2) (pair P2 P1)})}) (rules (start { (place "Counter1" (sites P1)) (place "Counter2" (sites P2))}) phases:{ (phase "Movement" (play (forEach Piece (or ("HopSequence" (from)) (move Step (to if:(and (is Empty (to)) (or (not (is In (from) (sites Next))) (is In (to) (sites Next))))))))) (nextPhase (is Mover (next)) "MultiJump")) (phase "MultiJump" (play (or ("HopSequence" (last To)) (move Pass))) (nextPhase (not (is Mover (next))) "Movement"))} (end ("FillWin" (sites (player (mapEntry (mover)))))))) END |
Construct a Ludii game based on the following description
Two concentric circles, with two perpendicular diameters intersecting both circles, and four other lines, positioned diagonally, connecting the circumferences of the two circles. Six pieces per player. which begin on opposite sides of the circle from the other player, three on each circle. Players alternate turns moving their pieces. Pieces move three spaces along the lines on the board, regardless of whether they are occupied, capturing any piece on the third. Pieces may change direction in a turn, as long as the lines are followed and there is no backtracking. The player who captures all of the opponent's pieces wins.
###
| (game "Toono" (players 2) (equipment { (board (add (concentric {1 0 8 8}) edges:{{0 2} {0 4} {0 6} {0 8}}) use:Vertex) (piece "Marker" Each (move (from) (to (sites Distance from:(from) (exact 3)) if:(not ("IsFriendAt" (to))) (apply (if ("IsEnemyAt" (to)) (remove (to)))))))}) (rules (start { (place "Marker1" (difference (expand (sites Bottom) steps:2) (expand (sites Top) steps:2))) (place "Marker2" (difference (expand (sites Top) steps:2) (expand (sites Bottom) steps:2)))}) (play (forEach Piece)) (end ("CaptureAll" Next)))) END |
Construct a Ludii game based on the following description
10x10 board. Each player has one piece and move according to the roll of one die. Representations of snakes and ladders are scattered throughout the board, connecting two spaces. If a player lands at the bottom of the ladder at the end of their move, they advance to the space at the top of the ladder. If a player ends their turn on a space with the head of a snake, they move down to the space with the tail of the snake. The first player to move off the last space of the board wins.
###
| (game "Gyan Chaupar" (players 4) (equipment { (board (square 10) (track "Track" "0,E,N1,W,N1,E,N1,W,N1,E,N1,W,N1,E,N1,W,N1,E,N1,W" directed:True)) (piece "Pawn" Each (move (from (from) level:(level)) (to (mapEntry ("NextSiteOnTrack" (count Pips)))))) (dice num:1) (map { (pair "B1" "C4") (pair "D1" "G2") (pair "H1" "J4") (pair "A3" "B5") (pair "E4" "D5") (pair "H3" "D9") (pair "J8" "J10") (pair "A8" "A10") (pair "J6" "G7") (pair "B7" "C2") (pair "G5" "F3") (pair "E2" "F1") (pair "D7" "A6") (pair "C10" "C8") (pair "H10" "H8") (pair "E10" "E8") (pair "G9" "D3") (pair "H6" "E6") (pair "I5" "J2")})}) (rules (start (place Stack items:{"Pawn4" "Pawn3" "Pawn2" "Pawn1"} coord:"A1")) (play ("RollMove" (forEach Piece))) (end ("ReachWin" (sites {(trackSite EndSite)}) Mover)))) END |
Construct a global Ludii definition which fulfills the following requirements.
Defines a piece moving like a gold in Shogi. The effect of the capture have to be defined.
###
| (define "ShogiGold" (piece #1 Each (move Step (directions {Forward Backward Rightward Leftward FL FR}) (to if:(not ("IsFriendAt" (to))) #2) #3))) END |
Construct a Ludii game based on the following description
Rectangular board, with 32 points along each long side. Lines connect the points opposite each other, as well as a diagonal line connecting each point on the left to the next highest point on the right (e.g., the first left point with the second right point, the second left point with the third right point, an so on). One player plays as the calf, which begins in the bottom right corner. The second player plays as two children, which begin in the bottom left corner and the second point on the right. Players alternate turns moving one of their pieces to an empty adjacent spot on the board along the lines. The children move first, and cannot move backward during the game. The calf can move in any direction. The children win by forcing the calf to move to the top left corner of the board, the calf wins by returning to its starting point after first having left it.
###
| (game "Neg Tugal Tuux" (players 2) (equipment { (board (add (scale 15 1 (rectangle 32 2)) edges:{ {0 3} {2 5} {4 7} {6 9} {8 11} {10 13} {12 15} {14 17} {16 19} {18 21} {20 23} {22 25} {24 27} {26 29} {28 31} {30 33} {32 35} {34 37} {36 39} {38 41} {40 43} {42 45} {44 47} {46 49} {48 51} {50 53} {52 55} {54 57} {56 59} {58 61} {60 63}}) use:Vertex) (piece "Cow" P2 "StepToEmpty") (piece "Human" P1 (move Step (to if:(and (is Empty (to)) (>= 1 (- (from) (to)))))))}) (rules (start { (place "Cow2" 1) (place "Human1" (sites {0 3}))}) (play (forEach Piece)) (end { (if (and (is Mover P2) (= 1 (where "Cow2" P2))) (result P2 Win)) (if (= 62 (where "Cow2" P2)) (result P1 Win))}))) END |
Construct a Ludii game based on the following description
Each player has three pieces. Pieces are initially placed three-in a row on side nearest the player. Pieces can move to an adjacent space connected to it by a line. The goal is to create three in a row through the central space.
###
| (game "Shisima" (players 2) (equipment { (board (concentric {1 8}) use:Vertex) (piece "Marker" Each "StepToEmpty")}) (rules (start { (place "Marker1" {1 8 7}) (place "Marker2" {3 4 5})}) (play (forEach Piece)) (end (if (and (= (what at:(centrePoint)) (mover)) (is Line 3)) (result Mover Win))))) END |
Construct a Ludii game based on the following description
2x12, 15, 18, 21, or 24 board. Two counters per hole. Typically played by a team of players, who consult each other about the moves to be made. Sowing occurs most commonly in an anti-clockwise direction, but can be played clockwise if the players agree. Play begins with one player picking up the counters in one of the holes in their row and sowing them, then picking up the counters in the hole following the one in which the last counter was sown, and continuing to sow in this way until there is a pattern of holes with three counters alternating with empty holes. The players then decide who gets to play first. Players sow counters from a hole in their row in the agreed-upon direction. When the final counter lands in an occupied hole, these counters are picked up and sowing continues. When the last counter falls into an empty hole, the sowing ends. If the sowing ends in the player's own row, any counters in the opponent's hole opposite are captured. Once both players are reduced to only single counters in their holes, when a player reaches the end of their row with a counter, it is captured instead of continuing to sow it to the opponent's rows. The player who is the last in possession of counters wins. Each player has 12 holes and sow anti-clockwise.
###
| (define "OnlyOneCounterInEachHole" (all Sites (sites Board) if:(<= (count at:(site)) 1))) (define "NoCounters" (all Sites (sites #1) if:(= 0 (count at:(site))))) (define "NextHole" ("NextSiteOnTrack" 1 from:#1 "Track")) (define "PlayFromLastHole" (last To afterConsequence:True)) (define "Columns" 12) (game "Andada" (players 2) (equipment { (mancalaBoard 2 "Columns" store:None (track "Track" "0,E,N,W" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece "Seed" Shared) (hand Each)}) (rules (start (set Count 2 to:(sites Track))) phases:{ (phase "Opening" (play (move Select (from (if ("SameTurn") (sites {("NextHole" ("PlayFromLastHole"))}) (sites Mover)) if:(> (count at:(from)) 0)) (then (sow (then (if (is Occupied ("NextHole" ("PlayFromLastHole"))) (moveAgain))))))) (nextPhase (is Mover P2) "Playing")) (phase "Playing" (play (move Select (from (if ("SameTurn") (sites {"PlayFromLastHole"}) (sites Mover)) if:(> (count at:(from)) 0)) (then (sow apply:(if (= 1 (count at:(to))) (if ("OnlyOneCounterInEachHole") (if (is In ("NextHole" (to)) (sites Next)) (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to)))) (if (and (is Occupied ("OppositePit" (to))) (is In (to) (sites Mover))) (fromTo (from ("OppositePit" (to))) (to (handSite Mover)) count:(count at:("OppositePit" (to)))))) (moveAgain)))))) (end (forEach Player if:("NoCounters" Player) (result Player Loss))))})) END |
Describe the mechanics of the following Ludii game
(define "NoEdgeBetweenCells" ("NoSites" (intersection (sites Occupied by:Shared on:Edge) ("EdgeInCommon" #1 #2)))) (define "EdgeInCommon" (intersection (sites Incident Edge of:Cell at:#1) (sites Incident Edge of:Cell at:#2))) (game "Maze" (players 1) (equipment { (board (remove (square 20) cells:{ 0 20 40 60 80 100 120 140 1 21 41 61 81 2 22 42 62 3 23 4 5 6 19 39 59 79 99 119 139 159 18 38 58 78 98 17 37 57 77 16 36 15 14 13})) (piece "Marker" Shared) (piece "Cross" Neutral) (piece "Human" P1 (move Step Orthogonal (to if:(and (is Empty (to)) ("NoEdgeBetweenCells" (from) (to)))) (then (add (piece (id "Cross" Neutral)) (to (last From)))))) (regions "Exit" {5})}) (rules (start { (set Shared Edge (union (sites Outer Edge) (sites {692 693 694 696 672 651 630 589 568 673 653 676 656 657 658 678 719 699 701 702 682 724 684 705 706 727 686 728 709 689 648 607 566 668 611 612 613 614 615 677 634 595 574 575 596 637 553 533 532 552 572 551 530 550 509 489 528 508 467 447 427 386 365 366 364 363 385 405 425 466 387 408 409 410 411 429 449 470 431 472 492 430 432 473 514 453 389 368 348 327 390 474 515 556 597 618 598 639 660 661 662 641 620 621 601 581 561 627 626 625 624 623 646 586 585 565 544 543 542 505 504 463 462 461 460 459 458 457 456 443 402 361 341 279 422 421 420 419 418 417 416 401 400 379 398 183 201 238 319 298 318 277 256 276 317 255 275 316 336 356 376 295 294 314 334 354 313 374 292 291 312 311 271 250 230 212 211 210 228 229 193 174 175 157 138 121 89 74 88 75 61 33 11 34 36 64 49 63 77 91 106 123 159 196 214 122 158 80 94 109 108 124 160 127 163 200 144 143 162 199 161 198 216 234 253 252 522 502 521 582 583 563 479 478 519 498 539 579 558 517 476 435 414 434 475 516 413 351 392 372 371 330 309 289 288 287 286 308 267 227 190 246 245 244 172 171 189 207 153 135 118 102 119 101 85 71 70 69 84 99 116 10 19 32 45 44 58 8 17 29 42 26 27 67 82 114 150 132 131 149 186 148 185 222 242 169 224 264 305 325 284 283 282 303 323 590}))) (place "Human" 336)}) (play (forEach Piece)) (end { (if (no Moves Mover) (result Mover Loss)) (if (is In (where (id "Human")) (sites "Exit")) (result Mover Win))})))
###
| The human piece can move to any orthogonal empty cells if the edge belonging to these two cells is empty. After moving a cross is added to the previous cell. The goal is to find the path between the starting point and the door. A lost is encountered in case of no legal moves. The board in Cross+A. END |
Modify the Ludii game according to the following option changes:
The game starts with 3 discs for the second player. -> The game starts with 4 discs for the second player.
(game "Kaooa" (players 2) (equipment { ("StarBoard" 5) (hand Each) (piece "Marker" P1 (or ("HopSequenceCapture") "StepToEmpty")) (piece "Marker" P2 "StepToEmpty")}) (rules (start { (place "Marker1" (handSite P1) count:1) (place "Marker2" (handSite P2) count:3)}) phases:{ (phase "Placement" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) ("PhaseMovePiece" "Movement" (end ("NoMoves" Loss)))}))
###
| (game "Kaooa" (players 2) (equipment { ("StarBoard" 5) (hand Each) (piece "Marker" P1 (or ("HopSequenceCapture") "StepToEmpty")) (piece "Marker" P2 "StepToEmpty")}) (rules (start { (place "Marker1" (handSite P1) count:1) (place "Marker2" (handSite P2) count:4)}) phases:{ (phase "Placement" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) ("PhaseMovePiece" "Movement" (end ("NoMoves" Loss)))})) END |
Construct a Ludii game based on the following description
Goal: Simultaneously create two or more rows of exactly four stones of your color.
Play: White starts by placing a white stone at an empty cell. Players then take turns placing two stones of their color at empty cells, one stone after another.
In each placement, players are not allowed to create a single
4-in-a-row of their color, unless that placement simultaneously
creates at least one other 4-in-a-row of their color to win the game.
This means that players may NOT make a single 4-in-a-row of their color on the first placement of their turn even if they can make a second 4-in-a-row on their second placement.
In no event are players allowed to create 5 (or more) -in-a-row of their color.
The first player to make simultaneous 4-in-a-rows of their color wins immediately, whether it was their first or second placement. The game is played on a 13x13 board.
###
| (define "NumSimultaneousFourInARow" (+ { (if ("FourInARow" N) 1 0) (if ("FourInARow" NE) 1 0) (if ("FourInARow" E) 1 0) (if ("FourInARow" SE) 1 0)})) (define "FourInARow" (is Line 4 #1 exact:True)) (define "MoreThan4InARow" (is Line 5)) (game "Yavalax" (players 2) (equipment { (board (square 13)) (piece "Marker" Each)}) (rules phases:{ (phase "Opening" (play (move Add (to (sites Empty)))) (nextPhase "General")) (phase "General" (play (do (move Add (to (sites Empty)) (then (if ("NewTurn") (moveAgain)))) ifAfterwards:(and (not ("MoreThan4InARow")) (!= 1 ("NumSimultaneousFourInARow"))))))} (end (if (<= 2 ("NumSimultaneousFourInARow")) (result Mover Win))))) END |
Construct a Ludii game based on the following description
Structure of Play:
There is no passing.
Maroon chooses to remove up to two nodes of the board before passing to White.
Then White places an initial stone onto a remaining node on the board.
After this play alternates, two turns per player, until one player cannot complete both turns. That player loses
On each of the turns, the current player must either:
- - place a stone on an empty node that the opponent does not control, or
- - remove an opponent's stone that the current player controls.
A player controls a node and any stone on it when the count of his stones in line-of-sight of the node, exceed those of his opponent by the node-control value chosen for the game, or more. (default is 3)
('in line-of-site of the node' refers to the first stone in each radial grid direction.)
There are options for the board size and type, and the number of surplus stones needed to control a node. Order 2 board Hex N/N+2 grid w/even nodes, no center Strategic. Control a site with a surplus of 3 on lines of sight.
###
| (define "ColourBackground" (colour 135 170 130)) (define "SquareDiagonal" (board (square 4) use:Vertex)) (define "SquareGrid" (board (square 4) use:Vertex)) (define "Hex2Limp" (board (dual (hex (/ 4 2) (+ 2 (/ 4 2)))) use:Vertex)) (define "BoardUsed" "Hex2Limp") (define "LoSDirection" Orthogonal) (define "MoveTwiceThenScore" (if (is Prev Next) (moveAgain) (and ("ScoreFor" Mover) ("ScoreFor" Next)))) (define "IsControlledBy" (<= (+ 3 (count Pieces in:(difference (sites LineOfSight Piece at:#2 "LoSDirection") (sites Occupied by:Neutral)))) (* 2 (count Pieces #1 in:(sites LineOfSight Piece at:#2 "LoSDirection"))))) (define "ScoreFor" (set Score #1 (+ (results from:(forEach (difference (difference (sites Board) (sites Occupied by:#1)) (sites Occupied by:Neutral)) if:("IsControlledBy" #1 (site))) to:(from) (if (is Empty (to)) 1 2))))) (game "Double-Move Situ" (players 2) (equipment { "BoardUsed" (piece "Counter" P1) (piece "Counter" P2) (piece "X" Neutral) (piece "Counter" Neutral)}) (rules (meta (passEnd NoEnd)) (play (if (and (= -1 (var "DoubleTurnPhase")) (= 1 (mover))) (or (move Pass) (move Add (piece "X0") (to (sites Empty)) (then (if (> 2 (count Pieces in:(sites Occupied by:Neutral))) (moveAgain))))) (or { (move Add (to (sites Empty) if:(not ("IsControlledBy" Next (to)))) (then (if (= -1 (var "DoubleTurnPhase")) (set Var "DoubleTurnPhase" 1) ("MoveTwiceThenScore")))) (move Remove (forEach (sites Occupied by:Next) if:("IsControlledBy" Mover (site))) (then ("MoveTwiceThenScore")))}) (then (if (no Moves Next) (and ("ScoreFor" Mover) ("ScoreFor" Next)))))) (end (if (no Moves Mover) (result Mover Loss))))) END |
Construct a Ludii game based on the following description
2x12 board, divided in half. Spaces on each side take the form of points. Fifteen pieces per player. Three six-sided dice. Players move according to the number on each die by moving one piece the value on one die then another piece the value on the other die, or by moving one piece the value of one die and then the value of the other. One player begins with all of their pieces on the space furthest to the left on their side, the other with their pieces on the point directly opposite it. Pieces move in opposite directions around the board, only on the left half of the board where the pieces begin, toward the point where the opponent's pieces begin, and bearing off the board from there. A player cannot have two of their pieces on the same spot in the starting quadrant. When a piece lands on the same space as an opponent's piece, the opponent's piece is sent back to where it began. The first person to bear off all their pieces wins.
###
| (define "CanEscape" ("IsOffBoard" #1)) (define "AllPieceEscaped" (no Pieces Mover)) (define "NotEnemyOrOnlyOne" (or (and ("IsEnemyAt" (to)) ("IsSingletonStack" (to))) (and (if (not (is In (to) (sites Mover))) True (is Empty (to))) (not ("IsEnemyAt" (to)))))) (define "Bar" (mapEntry (mover))) (define "RemoveAPiece" (move Remove (site))) (define "NextSiteFromDist6" ("NextSiteOnTrack" 6 from:#1)) (define "NextSiteFrom" ("NextSiteOnTrack" (pips) from:#1)) (game "Ludus Lombardorum" (players 2) (equipment { ("BackgammonBoard" { (track "Track1" {6 0..5 18..12} P1 directed:True) (track "Track2" {19 12..18 5..0} P2 directed:True)}) (dice num:3) (map {(pair 1 19) (pair 2 6)}) (piece "Disc" Each) (regions P1 { 0..5}) (regions P2 { 13..18})}) (rules (start { (place Stack "Disc1" 0 count:15) (place Stack "Disc2" 13 count:15)}) (play ("RollEachNewTurnMove" (forEach Die if:("DieNotUsed") (forEach Site (sites Occupied by:Mover) (if ("CanEscape" ("NextSiteFrom" (site))) ("RemoveAPiece") (move (from (site)) (to ("NextSiteFrom" (site)) if:("NotEnemyOrOnlyOne") ("HittingCapture" ("Bar")))))) (then ("ReplayNotAllDiceUsed"))))) (end (if ("AllPieceEscaped") (result Mover Win))))) END |
Subsets and Splits