prompt
stringlengths 71
4.65k
| completion
stringlengths 34
5.1k
|
---|---|
Construct a Ludii game based on the following description
Played on a Tables board with sockets for the pieces instead of points. Fifteen pieces per player. Three six-sided dice. Players move according to the number on each die by moving one piece the value on one die, another piece the value on another die, and another piece the value on the final die, by moving one piece the value of two of the die subsequently, and a second piece the value of the remaining die, or one piece the value of each die subsequently. Pieces begin off the board. Players must enter all of their pieces onto one half of the board (one player entering in the quadrant to their right and the other player's entering into the quadrant on their left), according to the throws of the dice. Once a player has entered all of their pieces, they move through all of the quadrants of the board toward the quadrant where the opponent entered their pieces. A piece landing on a space with a single opponent's piece sends the opponent's piece back to start, and it must be reentered. Once players enter all of their pieces into the final quadrant, they may bear off their pieces. They can do so by rolling a 6 to move from the sixth point, and so on down to 1. Throughout the game, a player must use the maximum number of moves presented by the dice. The first player to remove all of their pieces wins.
###
| (define "AllPiecesInLastQuadrant" ("AllOwnedPiecesIn" (sites Mover "LastQuadrant"))) (define "NextSiteFrom" ("NextSiteOnTrack" #2 from:#1)) (game "Buffa de Baldrac" (players 2) (equipment { ("TableBoard" ("TableTracksOpposite" End)) (dice d:6 num:3) (piece "Disc" Each (or (forEach Die combined:True if:(and ("DieNotUsed") (<= 0 ("NextSiteFrom" (from) (pips)))) (move (from (from)) (to ("NextSiteFrom" (from) (pips)) if:("NoEnemyOrOnlyOne" (to)) ("HittingCapture" (handSite Next)))) (then ("ReplayNotAllDiceUsed"))) (if ("AllPiecesInLastQuadrant") (forEach Die combined:True if:(and ("DieNotUsed") ("IsEndTrack" ("NextSiteFrom" (from) (pips)))) (move Remove (from)) (then ("ReplayNotAllDiceUsed")))))) (regions "FirstQuadrant" P1 (sites {0..5})) (regions "FirstQuadrant" P2 (sites {12..17})) (regions "LastQuadrant" P1 (sites {12..17})) (regions "LastQuadrant" P2 (sites {0..5})) (map "StartTrack" {(pair P1 0) (pair P2 12)}) (hand Each)}) (rules (start { (place Stack "Disc1" (handSite P1) count:15) (place Stack "Disc2" (handSite P2) count:15)}) (play (max Moves ("RollEachNewTurnMove" (if (is Occupied (handSite Mover)) (forEach Die combined:True if:(and ("DieNotUsed") (is In ("NextSiteFrom" (mapEntry "StartTrack" (mover)) (- (pips) 1)) (sites Mover "FirstQuadrant"))) (move (from (handSite Mover)) (to ("NextSiteFrom" (mapEntry "StartTrack" (mover)) (- (pips) 1)) if:("NoEnemyOrOnlyOne" (to)))) (then ("ReplayNotAllDiceUsed"))) (forEach Piece top:True))))) (end ("EscapeWin")))) END |
Construct a Ludii game based on the following description
A square, with diagonals, but one side of the square has been removed. Two pieces per player. Players alternate turns placing a piece on an empty spot on the board. When the pieces are placed, players alternate turns moving one of their pieces to an empty adjacent spot along the lines. The player who blocks the other from being able to move wins.
###
| (game "Do Guti" (players 2) (equipment { (board (add (remove ("AlquerqueGraph" 3 3) vertices:{1 3 5 7}) edges:{{3 0} {0 1} {1 4}}) use:Vertex) (hand Each) (piece "Disc" Each "StepToEmpty")}) (rules (start (place "Disc" "Hand" count:2)) phases:{ (phase "Placement" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) ("PhaseMovePiece" "Movement")} (end ("NoMoves" Loss)))) END |
Construct a global Ludii definition which fulfills the following requirements.
Move again if the player can do the move specified.
###
| (define "ReplayIfCanMove" (if (can Move #1) (moveAgain) #2)) END |
Modify the Ludii game according to the following option changes:
A 3x3 board is currently selected. -> A 4x4 board is currently selected.
(game "Compart" (players 2) (equipment { (board (square 3) use:Vertex) (piece "Marker" Each)}) (rules (meta (swap)) (play (move Add (to (sites Empty) if:(not (is In (to) (sites (values Remembered)))) (apply (addScore Mover 1))) (then (do (forEach Site (sites Group at:(last To) if:(not (is Enemy (who at:(to))))) (remember Value (site))) next:(if (< 0 (count Sites in:(difference (sites Empty) (sites (values Remembered))))) (moveAgain) (forget Value All)))))) (end (if (is Full) { (if (= (score P1) (score P2)) (result Mover Win)) (if True (byScore misere:True))}))))
###
| (game "Compart" (players 2) (equipment { (board (square 4) use:Vertex) (piece "Marker" Each)}) (rules (meta (swap)) (play (move Add (to (sites Empty) if:(not (is In (to) (sites (values Remembered)))) (apply (addScore Mover 1))) (then (do (forEach Site (sites Group at:(last To) if:(not (is Enemy (who at:(to))))) (remember Value (site))) next:(if (< 0 (count Sites in:(difference (sites Empty) (sites (values Remembered))))) (moveAgain) (forget Value All)))))) (end (if (is Full) { (if (= (score P1) (score P2)) (result Mover Win)) (if True (byScore misere:True))})))) END |
Construct a Ludii game based on the following description
Three concentric squares with lines connecting their midpoints. Nine pieces per player. Players alternate turns placing pieces on the board or moving one piece on the board to an adjacent empty spot. The first player to get three of their pieces in a row wins.
###
| (game "Sujjua" (players 2) (equipment { ("NineMensMorrisBoard") (piece "Marker" Each ("StepToEmpty" Orthogonal)) (hand Each)}) (rules (start (place "Marker" "Hand" count:9)) (play (or (if ("HandOccupied" Mover) (move (from (handSite Mover)) (to (sites Empty)))) (forEach Piece))) (end ("Line3Win" Orthogonal)))) END |
Modify the Ludii game according to the following option changes:
The players play on LastEdgeR-B version. -> The players play on LastEdgeR-G-B version.
(game "LastEdge" (players 2) (equipment { (board (graph vertices:{ {0 0} {0 1} {0 2} {0 3} {0 4} {1 0} {1 1} {1 2} {1 3} {1 4} {2 0} {2 1} {2 2} {2 3} {2 4} {3 0} {3 1} {3 2} {3 3} {3 4} {4 0} {4 1} {4 2} {4 3} {4 4}} edges:{ {0 1} {0 5} {1 6} {1 2} {2 7} {2 3} {3 8} {3 4} {4 9} {5 6} {5 10} {6 11} {6 7} {7 12} {7 8} {8 13} {8 9} {9 14} {10 11} {11 12} {12 13} {13 14} {10 15} {11 16} {12 17} {13 18} {14 19} {15 16} {15 20} {16 21} {20 21} {16 17} {17 22} {21 22} {17 18} {18 23} {22 23} {18 19} {19 24} {23 24}}) use:Vertex) (piece "Disc" Each) (piece "Marker" Shared)}) (rules (start { (set P1 Edge (sites {0..9 34 35 36})) (set P2 Edge (difference (sites Board Edge) (sites {0..9 34 35 36})))}) (play (forEach Site (sites Board) (if (< 0 (count Sites in:(sites Incident Edge of:Vertex at:(to) Mover))) (move Add (to (intersection (sites Empty) (sites {(to)}))) (then (forEach Site (sites Incident Edge of:Vertex at:(last To)) (remove Edge (to)))))))) (end ("BlockWin"))))
###
| (game "LastEdge" (players 2) (equipment { (board (graph vertices:{ {0 0} {0 1} {0 2} {0 3} {0 4} {1 0} {1 1} {1 2} {1 3} {1 4} {2 0} {2 1} {2 2} {2 3} {2 4} {3 0} {3 1} {3 2} {3 3} {3 4} {4 0} {4 1} {4 2} {4 3} {4 4}} edges:{ {0 1} {0 5} {1 6} {1 2} {2 7} {2 3} {3 8} {3 4} {4 9} {5 6} {5 10} {6 11} {6 7} {7 12} {7 8} {8 13} {8 9} {9 14} {10 11} {11 12} {12 13} {13 14} {10 15} {11 16} {12 17} {13 18} {14 19} {15 16} {15 20} {16 21} {20 21} {16 17} {17 22} {21 22} {17 18} {18 23} {22 23} {18 19} {19 24} {23 24}}) use:Vertex) (piece "Disc" Each) (piece "Marker" Shared)}) (rules (start { (set P1 Edge (sites {0..5 13..20})) (set P2 Edge (sites {9..12 23..30})) (set Shared Edge (difference (sites Board Edge) (union (sites {0..5 13..20}) (sites {9..12 23..30}))))}) (play (forEach Site (sites Board) (if (> (count Sites in:(difference (sites Incident Edge of:Vertex at:(to) All) (sites Incident Edge of:Vertex at:(to) Next))) 0) (move Add (to (intersection (sites Empty) (sites {(to)}))) (then (forEach Site (sites Incident Edge of:Vertex at:(last To)) (remove Edge (to)))))))) (end ("BlockWin")))) END |
Construct a Ludii game based on the following description
Two rows of five holes arranged in a circle around four stores in the center. Each player has five holes on one half of the circle. Ten counters in each hole. Players sow from their holes, and can choose to sow any number of counters, but must leave at least one in the starting hole. Sowing occurs in an anti-clockwise direction. If sowing ends in a hole making its contents an odd number of counters, they are captured, but not more than nine. If the sowing ends and the last counter makes the contents of a hole an even number and the next hole has an odd number of counters, the contents of the odd hole are taken, but not more than nine. In both situations, if there is an unbroken sequence of holes with an odd number of counters, these are all taken, but not more than nine from each.
###
| (define "PiecesOwnedBy" (count at:(mapEntry #1))) (define "NextHoleFrom" ("NextSiteOnTrack" 1 from:#1 #2)) (game "Okwe (Achalla)" (players 2) (equipment { (board (add (concentric {10}) vertices:{{0.45 0.45} {-0.45 -0.45} {0.45 -0.45} {-0.45 0.45}}) (track "Track" {0 2 4 6 8 9 7 5 3 1} loop:True) use:Vertex) (regions P1 (sites {0..4})) (regions P2 (sites {5..9})) (map {(pair P1 11) (pair P2 10)}) (piece "Seed" Shared)}) (rules (start (set Count 10 to:(sites Track))) (play (forEach Site (forEach (sites Mover) if:(< 1 (count at:(site)))) (forEach Value min:2 max:(count at:(site)) (do (set Var (value)) next:(move Select (from (site)) (then (sow count:(var) if:True apply:(if (and (<= (count at:(to)) 9) (is Odd (count at:(to)))) (fromTo (from (to)) (to (mapEntry (mover))) count:(count at:(to))) (if (and (<= (count at:("NextHoleFrom" (to))) 9) (is Odd (count at:("NextHoleFrom" (to))))) (fromTo (from ("NextHoleFrom" (to))) (to (mapEntry (mover))) count:(count at:("NextHoleFrom" (to)))))) origin:True backtracking:(and (<= (count at:(to)) 9) (is Odd (count at:(to))))))))))) (end ("MancalaByScoreWhen" (and (no Moves P1) (no Moves P2)))))) END |
What does the following global Ludii definition do?
(define "HopOrthogonalCapture" (move Hop Orthogonal (between if:("IsEnemyAt" (between)) (apply (remove (between)))) (to if:(is Empty (to)))))
###
| Defines a hop move in all the orthogonal directions over an enemy to an empty site. The enemy piece is removed. END |
Construct a Ludii game based on the following description
Four 3x8 rectangles, arranged in a cross shape with a large square space in the center. The outer corners of each square are marked with a cross, as are the third and sixth space from the same corner. Four players, playing on two teams. Four pieces per player. The pieces are red, green, yellow, and black. Players start with one piece on the sixth and seventh space of the central row in their arm, and two pieces on the third space in the outer row of their arm, to the right. Two rectangular four-sided dice, with the following throws: 1, 3, 4, 6. Players use the throw of a die to move a piece; they may therefore may move two pieces each the value of one of the dice, or one piece twice, using the value of each dice. Play moves down the central track of the player's arm, around the outer perimeter of the board in an anti-clockwise direction, and back up the central row of the player's arm, proceeding into the large central square. When a player's piece moves into a space occupied by an opponent's piece, the opponent's piece is sent to the central square, from which it must begin again. A player cannot move into their central row, approaching the end of the track, unless two of their team member's pieces have moved past the player's own pieces. If two or more of the team member's pieces remain behind the player's own pieces, the player's pieces may not advance past the final three spaces in the left hand track of their home arm of the board. Neither they, nor any of the team's pieces, can proceed until two of the team member's pieces are placed, by exact throws, on the left inner corner of the arm of the player wishing to advance. These two pieces must then proceed together; i.e., only on double throws of the dice, with the exception that a double they cannot be used if it would cause them to land on a space occupied by a team member waiting to move. Once a double throw is successfully made and both pieces moved, the waiting pieces may proceed up the central row. When players cannot move the throws, they pass their turn. Players must move into the central square with an exact throw. The first team to place all of their pieces in the central square wins.
###
| (define "PawnPiece" (if (= #1 1) (id "Pawn" P1) (if (= #1 2) (id "Pawn" P2) (if (= #1 3) (id "Pawn" P3) (id "Pawn" P4))))) (define "Centre" 96) (define "SetValueAlly" (if (is Mover P1) (set Value P3 #1) (if (is Mover P3) (set Value P1 #1) (if (is Mover P2) (set Value P4 #1) (set Value P2 #1))))) (define "ValueAlly" (if (is Mover P1) (value Player P3) (if (is Mover P3) (value Player P1) (if (is Mover P2) (value Player P4) (value Player P2))))) (define "RightCentralAlly" (if (is Mover P1) (sites P3 "RightCentral") (if (is Mover P3) (sites P1 "RightCentral") (if (is Mover P2) (sites P4 "RightCentral") (sites P2 "RightCentral"))))) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" #2 #1)) (game "Pahada Keliya" (players 4) (equipment { ("PachisiBoard" { (track "Track1" "96,9,S,E,N,11,E,N,W,53,N,W,S,42,W,S,E,8,S,E1,N7,End" P1 directed:True) (track "Track2" "96,26,W,S,E,8,S,E,N,11,E,N,W,53,N,W,S,42,W,S1,E7,End" P2 directed:True) (track "Track3" "96,52,N,W,S,42,W,S,E,8,S,E,N,11,E,N,W,53,N,W1,S7,End" P3 directed:True) (track "Track4" "96,27,E,N,W,53,N,W,S,42,W,S,E,8,S,E,N,11,E,N1,W7,End" P4 directed:True)}) (dice d:4 faces:{1 3 4 6} num:2) (piece "Pawn" Each (forEach Die if:("DieNotUsed") (if ("IsEndTrack" ("SiteToMoveOnTrack" from:(from) (pips))) (move Remove (from) level:(level)) (move (from (from) level:(level)) (to ("SiteToMoveOnTrack" from:(from) (pips)) if:(if (not (is In (to) (sites Mover "CentralRow"))) True (if (or (is In (from) (sites Mover "CentralRow")) (= (from) ("Centre"))) True (<= 1 (value Player Mover)))) (apply (if ("IsEnemyAt" (to)) (forEach Level (to) FromTop (and { (if (= 1 (state at:(to) level:(level))) ("SetValueAlly" (- ("ValueAlly") 1))) (remove (to) level:(level)) (add (piece ("PawnPiece" (who at:(to) level:(level)))) (to (centrePoint)))}))))) (then (if (and (= 0 (state at:(last To) level:(last LevelTo))) (is In (last To) ("RightCentralAlly"))) (and (set State at:(last To) 1) ("SetValueAlly" (+ 1 ("ValueAlly")))))))) (then ("ReplayNotAllDiceUsed")))) (regions "CentralRow" P1 (sites Direction from:55 N included:True distance:7)) (regions "CentralRow" P2 (sites Direction from:19 E included:True distance:7)) (regions "CentralRow" P3 (sites Direction from:94 S included:True distance:7)) (regions "CentralRow" P4 (sites Direction from:34 W included:True distance:7)) (regions "RightCentral" P1 (sites Direction from:56 N included:True distance:7)) (regions "RightCentral" P2 (sites Direction from:0 E included:True distance:7)) (regions "RightCentral" P3 (sites Direction from:93 S included:True distance:7)) (regions "RightCentral" P4 (sites Direction from:50 W included:True distance:7))}) (rules (start { (set Team 1 {P1 P3}) (set Team 2 {P2 P4}) (place Stack "Pawn1" 61) (place Stack "Pawn1" 58) (place Stack "Pawn1" 62 count:2) (place Stack "Pawn2" 21) (place Stack "Pawn2" 20) (place Stack "Pawn2" 2 count:2) (place Stack "Pawn3" 88) (place Stack "Pawn3" 91) (place Stack "Pawn3" 87 count:2) (place Stack "Pawn4" 32) (place Stack "Pawn4" 33) (place Stack "Pawn4" 48 count:2)}) (play ("RollEachNewTurnMove" (forEach Piece))) (end ("EscapeTeamWin")))) END |
Construct a global Ludii definition which fulfills the following requirements.
Defines a rectangular board with Alquerque-style alternating diagonals with eight triangle extensions.
###
| (define "AlquerqueBoardWithEightTriangles" (board (merge { (shift 2 2 (square 5 diagonals:Alternating)) (shift 2 0 (wedge 3)) (shift 5 3 (rotate 90 (wedge 3))) (shift 2 6 (rotate 180 (wedge 3))) (shift -1 3 (rotate 270 (wedge 3))) (shift 0.65 1.15 (scale 0.5 (rotate -45 (wedge 3)))) (shift 5.35 1.15 (scale 0.5 (rotate 45 (wedge 3)))) (shift 5.35 5.85 (scale 0.5 (rotate 135 (wedge 3)))) (shift 0.65 5.85 (scale 0.5 (rotate -135 (wedge 3))))}) use:Vertex)) END |
Construct a global Ludii definition which fulfills the following requirements.
Defines starting rules placing one counter on each white cell of a square board (e.g. Starting rules of Draughts).
###
| (define "WhiteCellsSetup" (start { (place "Counter1" (difference (expand (sites Bottom) steps:(- #1 1)) (sites Phase 0))) (place "Counter2" (difference (expand (sites Top) steps:(- #1 1)) (sites Phase 0)))})) END |
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 "IsNotCut" (not (is Pattern {F R F R F} whats:{(mover) (next)}))) (game "Crossway" (players 2) (equipment { (board (square 9) use:Vertex) (piece "Marker" Each) (regions P1 {(sites Side N) (sites Side S)}) (regions P2 {(sites Side W) (sites Side E)})}) (rules (meta (swap)) (play (do (move Add (to (sites Empty))) ifAfterwards:"IsNotCut")) (end (if (is Connected All Mover) (result Mover Win)))))
###
| (define "IsNotCut" (not (is Pattern {F R F R F} whats:{(mover) (next)}))) (game "Crossway" (players 2) (equipment { (board (square 13) use:Vertex) (piece "Marker" Each) (regions P1 {(sites Side N) (sites Side S)}) (regions P2 {(sites Side W) (sites Side E)})}) (rules (meta (swap)) (play (do (move Add (to (sites Empty))) ifAfterwards:"IsNotCut")) (end (if (is Connected All Mover) (result Mover Win))))) END |
Describe the mechanics of the following Ludii game
(game "El Zorro" ("TwoPlayersNorthSouth") (equipment { ("CrossBoard" 3 7 use:Vertex diagonals:Alternating) (piece "Fox" P1 (or ("HopCapture") "StepToEmpty")) (piece "Hen" P2 ("StepToEmpty" (directions {Rightward Leftward Forwards})))}) (rules (start { (place "Hen2" (union (sites Top) (expand (sites Row 4)))) (place "Fox1" (intersection (union (sites Column 4) (sites Column 2)) (sites Bottom)))}) (play (forEach Piece)) (end { (if (all Sites (expand (sites Bottom) steps:2) if:(= (who at:(site)) P2)) (result P2 Win)) (if (no Pieces P2) (result P1 Win))})))
###
| Five squares which are each divided with lines connecting the midpoints of their sides and diagonals. The five squares are arranged in a cross-shaped board. One player plays as two foxes the other as twenty hens. The hens begin on the twenty spaces on one half of the board, the foxes on the bottom two corners of the square on the opposite arm of the cross. The foxes may move in any direction, and hop over a hen to an empty space immediately adjacent on the opposite side of the hen along the lines of the board to capture. The hens may not move backward. The foxes win by capturing all the hens, the hens win by occupying all of the spaces in the square of the arm of the cross opposite from where they began. END |
Describe the mechanics of the following Ludii game
(game "Kotu Ellima" (players 2) (equipment { ("AlquerqueBoardWithFourTriangles") (piece "Marker" Each (or ("HopCapture") ("StepToEmpty")))}) (rules (start { (place "Marker1" (union {(expand (sites Bottom) steps:2) (expand (sites Right) steps:3) (sites {"F3" "G3" "E4" "F4" "F6" "F7" "G7"})})) (place "Marker2" (union {(expand (sites Top) steps:2) (expand (sites Left) steps:3) (sites {"C3" "D3" "D4" "D6" "E6" "D7" "C7"})}))}) (play (forEach Piece)) (end ("NoMoves" Loss))))
###
| From the starting position, each player takes turns moving one piece to an adjacent point connected to its current position by a line. Captures are made by hopping over an adjacent piece. The player who captures all the opponent's pieces wins. END |
Construct a global Ludii definition which fulfills the following requirements.
Checks if the next player has no legal moves and the next player loses and checks if a specific player has no pieces to lose. This ludemeplex can be used only in an ending condition.
###
| (define "NoMovesLossAndNoPiecesPlayerLoss" { ("NoMoves" Loss) (if (no Pieces #1) (result #1 Win))}) END |
Construct a Ludii game based on the following description
Start with a tile of each colour placed next to each other. Players take turns adding a tile of their colour touching at least one existing tile. Win by making a line of four (or more) of your colour, but lose by making a line of three of your colour beforehand. The game uses hexagonal tiles.
###
| (define "NumTiles" 24) (game "Bravalath" (players 2) (equipment { (boardless Hexagonal) (tile "Hex" Each numSides:6)}) (rules (start { (place "Hex1" (centrePoint)) (place "Hex2" (ahead (centrePoint) E))}) (play (move Add (to (sites Playable) if:(<= 1 (count Sites in:(sites Around (to) NotEmpty)))))) (end { (if (is Line 4) (result Mover Win)) (if (is Line 3) (result Mover Loss))}))) END |
Describe the mechanics of the following Ludii game
(define "CanMoveANewShip" (not (all Sites (difference (expand origin:(mapEntry "Port" P1)) (mapEntry "Port" Mover)) if:(is Occupied (site))))) (define "CapturingPortNotAttacked" (> 3 (count Sites in:(forEach (sites LineOfSight at:(if (is Mover P1) (mapEntry "Port" P2) (mapEntry "Port" P1))) if:(if (is Mover P1) (= (who at:(site)) P1) (= (who at:(site)) P2)))))) (define "AttackByAtLeast3" (<= 3 (count Sites in:(forEach (sites LineOfSight at:(site)) if:(= (who at:(site)) Mover))))) (game "Archimedes" (players 2) (equipment { (board (square 8)) (piece "Ball" Each (move Slide (between if:(and (is Empty (between)) (!= (between) (mapEntry "Port" Mover)))))) (map "Port" {(pair P1 "H8") (pair P2 "A1")}) (hand Each)}) (rules (start { (place "Ball1" (difference (expand origin:(mapEntry "Port" P1) steps:4 Orthogonal) (sites {"D8" "H4" "H8"}))) (place "Ball2" (difference (expand origin:(mapEntry "Port" P2) steps:4 Orthogonal) (sites {"A5" "A1" "E1"})))}) (play (if ("SameTurn") (move Slide (from (mapEntry "Port" Mover))) (or (forEach Piece (then (forEach Site (sites Occupied by:Next) (if ("AttackByAtLeast3") (fromTo (from (site)) (to (handSite Next))))))) (if (and { (is Occupied (handSite Mover)) (is Empty (mapEntry "Port" Mover)) ("CanMoveANewShip")}) (move (from (handSite Mover)) (to (mapEntry "Port" Mover)) (then (moveAgain))))))) (end (if (and ("IsFriendAt" (if (is Mover P1) (mapEntry "Port" P2) (mapEntry "Port" P1))) ("CapturingPortNotAttacked")) (result Mover Win)))))
###
| MOVING
Each player moves one ship each turn. A ship moves any number of empty squares in a straight line, either vertically, horizontally, or diagonally (that is, like a chess queen). However, a ship may never end its turn in its home port.
DESTROYING SHIPS
Two opposing ships \ END |
Construct a Ludii game based on the following description
Six or more players, even number of players, played on two teams. The board consists of twenty kernels of corn, spaced evenly in a line. If there are ten to fourteen players, the board is expanded to 25 kernels. If there are more than sixteen players, it is expanded to 30. Sticks are used to play, (five per player), and are played in the spaces between corn kernels. Dice are also corn kernels, with one side marked with a black dot. Four dice are used, the value of a move determined by the number of black dots that land face up. Each player has two throws on their turn, and moves after the second throw. The throws both must be used, and can be used in any order. Each team's home is the side of the board to their left. Each team moves toward the opposite end of the track, and then back to home. All of the players on one team play in succession, and then the players on the other team play next. Players enter the men on their throws and move along the track. Each player may have only one piece on the board at a time. When a player reaches the team's home field, the piece may be re-entered. Reaching the home field does not require an exact throw, and if one throw brings a player home, they may use the second throw to enter it again. If a piece lands on that of an opponent, it is captured. Pieces are allowed to move forward or backward if the move captures a piece. The captures piece is placed on top of the piece that captured it, and the stack now moves toward the capturing player's home space. If the player successfully carries the captured piece to the team's home space, the piece is permanently captured and removed from play. If the opposing side lands on the same space as the stack, they are stacked with the opponent's piece, and the opponent begins carrying the stack to the opposing team's side. Any pieces captured belonging to the team which brings them back to their home are returned to their players. Pieces belonging to the same team may occupy the same space with no consequence for the game. When one team has no more counters left to enter, the winner is the team that captured most of the opposing team's pieces.
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 "CaptureMove" (forEach Level (last To) FromTop (and (if ("IsEnemyAt" (last To) level:(level)) ("SetCapturePiece" at:(last To) level:(level))) (if ("IsFriendAt" (last To) level:(level)) ("SetCapturingPiece" at:(last To) level:(level)))))) (define "AtLeastAnEnemyPieceThere" (is In #1 (sites Occupied by:Enemy top:False))) (define "FreePiece" (= 0 #1)) (define "CapturedPiece" (= 2 #1)) (define "CapturingPiece" (= 1 #1)) (define "UnsetCapturingPieces" (forEach Level (last From) FromTop (if ("IsFriendAt" (last From) level:(level)) ("UnsetCapturingPiece" at:(last From) level:(level))))) (define "UnsetCapturingPiece" (set State #1 #2 0)) (define "SetCapturingPiece" (set State #1 #2 1)) (define "SetCapturePiece" (set State #1 #2 2)) (define "NoPieceOnBoard" (< (count Pieces Mover in:(sites Board)) 1)) (define "ThrowValue" (count Pips)) (game "Aj Sina'anil" (players 6) (equipment { (board (rectangle 1 20) { (track "Track1" {19 0..18} P1 directed:True) (track "Track2" {20 0..18} P2 directed:True) (track "Track3" {21 0..18} P3 directed:True) (track "Track4" {22 18..0} P4 directed:True) (track "Track5" {23 18..0} P5 directed:True) (track "Track6" {24 18..0} P6 directed:True) (track "CaptureTrack1" {18..0} P1 directed:True) (track "CaptureTrack2" {18..0} P2 directed:True) (track "CaptureTrack3" {18..0} P3 directed:True) (track "CaptureTrack4" {0..18} P4 directed:True) (track "CaptureTrack5" {0..18} P5 directed:True) (track "CaptureTrack6" {0..18} P6 directed:True)} use:Edge) (regions "AllSites" (sites Board Vertex)) (piece "Stick" Each (forEach Value (values Remembered "Throws") (or (if ("FreePiece" (state at:(from) level:(level))) (or (if ("IsOffBoard" ("NextSiteOnTrack" (value) from:(from) "Track")) (move (from (from) level:(level)) (to (handSite Mover) (apply (forget Value "Throws" (value))))) (move (from (from) level:(level) if:(if (is In (from) (sites Hand Mover)) ("NoPieceOnBoard") True)) (to ("NextSiteOnTrack" (value) from:(from) "Track") (apply (forget Value "Throws" (value)))) (then (if ("AtLeastAnEnemyPieceThere" (last To)) ("CaptureMove"))))) (if (and (is In (from) (sites Board)) ("IsNotOffBoard" ("NextSiteOnTrack" (value) from:(from) "CaptureTrack"))) (if ("AtLeastAnEnemyPieceThere" ("NextSiteOnTrack" (value) from:(from) "CaptureTrack")) (move (from (from) level:(level)) (to ("NextSiteOnTrack" (value) from:(from) "CaptureTrack") (apply (forget Value "Throws" (value)))) (then ("CaptureMove"))))))) (if ("CapturingPiece" (state at:(from) level:(level))) (if ("IsOffBoard" ("NextSiteOnTrack" (value) from:(from) "CaptureTrack")) (do (forget Value "Throws" (value)) next:(move Remove (from) level:(level) (then (and { ("UnsetCapturingPieces") ("RemoveCapturedPieces") ("RebirthCapturingPiece")})))) (move (from (from) level:(level)) (to ("NextSiteOnTrack" (value) from:(from) "CaptureTrack") (apply (forget Value "Throws" (value)))) (then (and ("CapturedPiecesFollowCapturingPiece") ("UnsetCapturingPieces"))))))))) ("StickDice" 4) (hand Each)}) (rules (start { (set Team 1 {P1 P2 P3}) (set Team 2 {P4 P5 P6}) (place Stack "Stick1" (handSite P1) count:5) (place Stack "Stick2" (handSite P2) count:5) (place Stack "Stick3" (handSite P3) count:5) (place Stack "Stick4" (handSite P4) count:5) (place Stack "Stick5" (handSite P5) count:5) (place Stack "Stick6" (handSite P6) count:5)}) phases:{ (phase "ThrowPhase" (play ("RollMove" (move Pass (then (if (not (no Pieces Mover)) (and { (if (!= 0 ("ThrowValue")) (do (remember Value "Throws" ("ThrowValue")) ifAfterwards:(can Move (or (forEach Piece container:(mover)) (forEach Piece))))) (moveAgain) (if ("SameTurn") (set Pending))})))))) (nextPhase (is Pending) "MovePhase")) (phase "MovePhase" (play (or (forEach Piece) (forEach Piece container:(mover)) (then (if (< 0 (size Array (values Remembered "Throws"))) (moveAgain))))) (nextPhase (= 0 (size Array (values Remembered "Throws"))) "ThrowPhase"))} (end ("CaptureAllTeam")))) END |
Construct a Ludii game based on the following description
3x3 intersecting lines, with diagonals drawn in the square. Three pieces per player, which begin on the three points on opposite sides of the board. Players alternate turns moving a piece to an empty adjacent spot along the lines of the board. The first player to place three of their pieces in a row along one of the lines which is not one of the sides of the square, wins.
###
| (game "T'mbl" (players 2) (equipment { (board (square 3 diagonals:Alternating) use:Vertex) (piece "Marker" Each ("StepToEmpty"))}) (rules (start { (place "Marker1" (sites Top)) (place "Marker2" (sites Bottom))}) (play (forEach Piece)) (end (if (and (is In (centrePoint) (sites Occupied by:Mover)) (is Line 3)) (result Mover Win))))) END |
Construct a Ludii game based on the following description
Overview:
In Seesaw the players (North and South) command opposing armies with soldiers that can promote. Your army starts out as a single soldier and your promotion area evolves as you deploy more soldiers. Every time a soldier promotes it grows - first into a 2-stack, then a 3-stack, and so on.
The central idea of Seesaw is the 2-fold significance of stack-size:
(i) Odd-sized stacks move forwards, and even-sized stacks move backwards, and
(ii) on any given turn, a stack can take as many steps as it likes from 1 up to its size.
This results in soldiers seesawing up and down the board as their strength increases to the point where the game is forced to conclude in one side completely eliminating the other.
How to play:
On your turn, you must either make a stack-move, or place a new stack.
1. Placing a new stack:
A newly placed stack will always be of size 1. You may only place a stack on an empty cell next to a cell of your color. These cells are promotion cells, and each cell you place a new stack on automatically turns into a promotion cell of your color.
2. Stackmoves:
You only ever move one stack per turn, but that stack may be able to move several steps or capture several enemy stacks, depending on its size.
The number of steps a stack may take is the number of pieces in it, i.e. its size.
2.1 Non-capturing moves: On turns where you do not have to capture an enemy (see below) all the steps a stack takes is either constrained to the 3 upward directions or to the 3 downward directions, depending on the size and the owner of the stack. South's forward directions are the 3 upward directions, and North's forward directions are the 3 downward directions.
2.2 Capturing moves: If one or more of your stacks can reach an enemy by lifting the restraint on direction, you must capture such a reachable enemy by replacement. If that stack did not spend all its steps reaching the captured enemy, you can, before you end your turn, spend the left-over steps by making a non-capturing move. However, if yet an enemy is in range immediately after you have captured (counting only the steps left over), you must capture again.
3. Promoting: Your odd-sized stacks promote when they end up on a promotion cell belonging to your opponent at the end of your turn. Your even-sized stacks promote when they end up on a promotion cell belonging to you at the end of your turn.
The object of Seesaw is to capture all your opponent's soldiers. More precisely: If, at the end of your turn, your opponent has no stacks on the board, you have won the game. A base 4 board is currently selected
###
| (define "CaptureRange" (if (> (var) 1) (intersection (sites Around (intersection ("Reachable" (var)) (sites Around (sites Occupied by:Enemy component:"Disc")))) (sites Occupied by:Enemy component:"Disc")) (intersection (sites Around (from)) (sites Occupied by:Enemy component:"Disc")))) (define "Reachable" (sites Distance (step (to if:(= 0 ("StackSize" (to))))) from:(from) (range 1 (- #1 1)))) (define "Promote" (if ("Promotes" (last To)) (add (piece (id "Disc" Mover)) (to (last To)) stack:True))) (define "Promotes" (= (+ (* 1 (% ("StackSize" #1) 2)) (% (mover) (- 3 (% ("StackSize" #1) 2)))) (* (who at:#1 level:0) (count Stack at:#1 if:(or (= (id "Hex" Next) (what at:(to) level:(level))) (= (id "Hex" Mover) (what at:(to) level:(level)))))))) (define "StepsTaken" (count Steps (step (to if:(or (= (last To) (to)) (= 0 ("StackSize" (to)))))) (last From) (last To))) (define "EmptyInRange" (if (is Odd ("StackSize" (from))) (sites Distance (step Forwards (to if:(= 0 ("StackSize" (to))))) from:(from) (range 1 (var))) (sites Distance (step Backwards (to if:(= 0 ("StackSize" (to))))) from:(from) (range 1 (var))))) (define "StackSize" (count Stack at:#1 if:(or ("IsPieceAt" "Disc" Next (to) level:(level)) ("IsPieceAt" "Disc" Mover (to) level:(level))))) (define "Capture" (do (if (= 0 (count MovesThisTurn)) ("ResetMoveCount")) next:(move (from if:(= (* (from) (if (< 0 (count MovesThisTurn)) 1 0)) (* (last To) (if (< 0 (count MovesThisTurn)) 1 0)))) (to ("CaptureRange") (apply (remove (to) count:("StackSize" (to))))) count:("StackSize" (from)) stack:True))) (define "DeductMoves" (set Var (- (var) ("StepsTaken")) #1)) (define "ResetMoveCount" (set Var ("StackSize" (from)))) (define "Step" (do (if (= 0 (count MovesThisTurn)) ("ResetMoveCount")) next:(move (from if:(= (* (from) (if (< 0 (count MovesThisTurn)) 1 0)) (* (last To) (if (< 0 (count MovesThisTurn)) 1 0)))) (to ("EmptyInRange")) count:("StackSize" (from)) stack:True))) (define "Deploy" (move Add (piece (id "Hex" Mover)) (to (sites Around (sites Occupied by:Mover component:"Hex" top:False)) if:(is Empty (to))) (then (add (piece (id "Disc" Mover)) (to (last To)) stack:True)))) (game "Seesaw" ("TwoPlayersNorthSouth") (equipment { (board (rotate 30 (hex 4))) (piece "Disc" Each) (tile "Hex" Each)}) (rules (start { (place Stack "Hex1" 0) (place Stack "Disc1" 0) (place Stack "Hex2" (* 4 (* 3 (- 4 1)))) (place Stack "Disc2" (* 4 (* 3 (- 4 1))))}) (play (if (can Move (forEach Piece "Disc" ("Capture") top:True)) (forEach Piece "Disc" ("Capture") top:True (then ("DeductMoves" (then (if (< 0 (var)) (moveAgain) ("Promote")))))) (if (< 0 (count MovesThisTurn)) (or (forEach Piece "Disc" ("Step") top:True) (move Pass) (then ("Promote"))) (or (forEach Piece "Disc" ("Step") top:True (then ("Promote"))) ("Deploy"))))) (end (if (= 0 (count Sites in:(sites Occupied by:Next component:"Disc"))) (result Next Loss))))) END |
Construct a Ludii game based on the following description
4x8 board. Four pieces in each of the holes in the inner two rows. Sowing occurs in an anti-clockwise direction. Single counters cannot be sown. When the final counter of a sowing falls into an occupied hole, these counters are picked up and the sowing continues. If this hole is in the player's inner row, the counters in the opponent's opposite holes in both rows are captured. Both the inner and outer opposite holes must contain counters for a capture to occur. Play continues with the captured counters, and the player sows these beginning with the next hole after the last one on the player's side from which they picked up holes. Captures cannot be made on the first move. Clockwise sowing can begin from the following holes only if it will allow a capture to occur: the rightmost and leftmost holes of the outer row, the second from the right and second from the left holes in the inner row. Direction can be changed in the middle of a turn if the final counter lands in one of these holes and a clockwise move will result in a capture. When no capture is available, the player must resume in an anti-clockwise direction. When the final counter falls into an empty hole, the turn ends.
###
| (define "NextHoleFrom" ("NextSiteOnTrack" #3 from:#1 #2)) (define "Columns" 8) (game "Kubuguza" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "TrackCCW1" "0,E,N1,W" loop:True P1) (track "TrackCCW2" "16,E,N1,W" loop:True P2) (track "TrackCW1" "7,W,N1,E" loop:True P1) (track "TrackCW2" "23,W,N1,E" loop:True P2)}) (regions "Home" P1 (sites Track "TrackCCW1")) (regions "Home" P2 (sites Track "TrackCCW2")) (regions "Inner" P1 (difference (sites Track "TrackCCW1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "TrackCCW2") (sites Top))) (regions "HolesCW" P1 (sites {15 8 1 6})) (regions "HolesCW" P2 (sites {16 23 25 30})) (piece "Seed" Shared) (hand Each)}) (rules (start (set Count 3 to:(union (sites P1 "Inner") (sites P2 "Inner")))) (play (or (move Select (from (if ("SameTurn") (sites {(var "Replay")}) (sites Mover "Home")) if:(> (count at:(from)) 1)) (then (sow "TrackCCW" owner:(mover) apply:(if (< 1 (count at:(to))) (and (if (and { (> (count Turns) 2) (is In (to) (sites Mover "Inner")) (is Occupied ("OppositeOuterPit" (to))) (is Occupied ("OppositePit" (to)))}) (and { (fromTo (from ("OppositeOuterPit" (to))) (to (last From)) count:(count at:("OppositeOuterPit" (to)))) (fromTo (from ("OppositePit" (to))) (to (last From)) count:(count at:("OppositePit" (to)))) (set Var "Replay" (last From))}) (set Var "Replay" (to))) (moveAgain)))))) (move Select (from (if ("SameTurn") (sites {(var "Replay")}) (sites Mover "HolesCW")) if:(and { (> (count at:(from)) 1) (is In (from) (sites Mover "HolesCW")) (if (is In ("NextHoleFrom" (from) "TrackCW" (count at:(from))) (sites Mover "Inner")) (and (is Occupied ("OppositeOuterPit" ("NextHoleFrom" (from) "TrackCW" (count at:(from))))) (is Occupied ("OppositePit" ("NextHoleFrom" (from) "TrackCW" (count at:(from)))))) False)})) (then (sow "TrackCW" owner:(mover) apply:(if (< 1 (count at:(to))) (and (if (and { (> (count Turns) 2) (is In (to) (sites Mover "Inner")) (is Occupied ("OppositeOuterPit" (to))) (is Occupied ("OppositePit" (to)))}) (and { (fromTo (from ("OppositeOuterPit" (to))) (to (last From)) count:(count at:("OppositeOuterPit" (to)))) (fromTo (from ("OppositePit" (to))) (to (last From)) count:(count at:("OppositePit" (to)))) (set Var "Replay" (last From))}) (set Var "Replay" (to))) (moveAgain)))))))) (end ("ForEachPlayerNoMovesLoss")))) END |
Construct a Ludii game based on the following description
Played on a board of three concentric squares, with a line bisecting the perimeters of each square on each side, but not extending inside the perimeter of the central square. Play occurs on the intersections of the lines and the corners of the squares. Each player has nine pieces. Play begins with each player placing pieces on empty points. If they make three in a row along the lines, they can remove one of the opponent's pieces. They cannot remove an opponent's piece that is in a three-in-a-row formation. Once all pieces are placed, players take turns moving pieces one spot to an adjacent point along the lines. If a player makes three in a row, an opponent's piece is removed as in the first phase of the game. The game is won when the opponent is reduced to two pieces. A player may also win by blocking their opponent from being able to move.
###
| (game "Mylna" (players 2) (equipment { ("NineMensMorrisBoard") (piece "Marker" Each ("StepToEmpty" Orthogonal (then ("ReplayIfLine3" Orthogonal)))) (hand Each)}) (rules (start (place "Marker" "Hand" count:9)) phases:{ (phase "Placement" (play (if "SameTurn" ("RemoveAnyEnemyPieceNotInLine3" Orthogonal) (move (from (handSite Mover)) (to (sites Empty)) (then ("ReplayIfLine3" Orthogonal))))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) (phase "Movement" (play (if "SameTurn" ("RemoveAnyEnemyPieceNotInLine3" Orthogonal) (forEach Piece))))} (end { ("HavingLessPiecesLoss" Next 2) ("BlockWin")}))) END |
Construct a Ludii game based on the following description
8x8 checkered board, the dark spaces placed so that the bottom right corner is a dark space. Twelve pieces per player, placed on the dark spaces of the first three rows closest to the players. Players alternate turns moving a piece forward diagonally to an empty space. Pieces may capture an opponent's piece by hopping over it to an empty adjacent space. Captures are compulsory, multiple captures are possible, the maximum capture possible is not required. When a piece reaches the opposite edge of the board from where it started, it stops moving (if in a capture sequence), becomes a king, and the turn ends. Kings may move any distance diagonally forward or backward, and may capture any number of opponent's pieces it leaps over. The player who captures all of the opponent's pieces wins.
###
| (define "IsUnpromoted" ("IsPieceAt" "Counter" Mover (last To))) (define "HopDiagonalDoubleCounter" ("HopCaptureDistance" (from) Diagonal (range 1 (count Rows)) (then ("ReplayIfCanMove" ("HopCaptureDistance" (from (last To)) Diagonal (range 1 (count Rows))))))) (define "HopDiagonalCounter" ("HopCapture" (from) Diagonal (then ("PromoteIfReach" (sites Next) "DoubleCounter" ("ReplayIfCanMove" ("HopCapture" (from (last To)) Diagonal)))))) (game "Damenspiel" ("TwoPlayersNorthSouth") ("DraughtsEquipment" (square 8)) (rules ("WhiteCellsSetup" 3) (play (if ("SameTurn") (if ("IsUnpromoted") ("HopCapture" (from (last To)) Diagonal (then ("PromoteIfReach" (sites Next) "DoubleCounter" ("ReplayIfCanMove" ("HopCapture" (from (last To)) Diagonal))))) ("HopCaptureDistance" (from (last To)) Diagonal (range 1 (count Rows)) (then ("ReplayIfCanMove" ("HopCaptureDistance" (from (last To)) Diagonal (range 1 (count Rows))))))) (priority { (or (forEach Piece "Counter" "HopDiagonalCounter") (forEach Piece "DoubleCounter" "HopDiagonalDoubleCounter")) (or (forEach Piece "Counter" ("StepToEmpty" (directions {FR FL}) (then ("PromoteIfReach" (sites Next) "DoubleCounter")))) (forEach Piece "DoubleCounter" (move Slide Diagonal)))}))) (end ("CaptureAll" Next)))) END |
Construct a Ludii game based on the following description
3x3 board, without the outer edges of the square. Three pieces per player. Players alternate turns placing the pieces on an empty space on the board. When all of the pieces have been placed, players move pieces to an adjacent empty space on the board. the first player to place all three of their pieces in an orthogonal or diagonal line wins.
###
| (game "Tuk Tak" (players 2) (equipment { (board (square 3)) (hand Each) (piece "Marker" Each "StepToEmpty")}) (rules (start (place "Marker" "Hand" count:3)) phases:{ (phase "Placement" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase ("HandEmpty" P2) "Movement")) ("PhaseMovePiece" "Movement")} (end ("Line3Win")))) END |
Modify the Ludii game according to the following option changes:
Order 3 board -> Order 4 board
Square 2N grid w/even nodes, no center -> Square 2N grid w/even nodes, no center
Highly tactical. Control a site with a surplus of 1 on lines of sight. -> Tactical. Control a site with a surplus of 2 on lines of sight.
(define "ColourBackground" (colour 135 170 130)) (define "SquareDiagonal" (board (square 6) use:Vertex)) (define "SquareGrid" (board (square 6) use:Vertex)) (define "Hex2Limp" (board (dual (hex (/ 6 2) (+ 2 (/ 6 2)))) use:Vertex)) (define "BoardUsed" "SquareDiagonal") (define "LoSDirection" All) (define "MoveTwiceThenScore" (if (is Prev Next) (moveAgain) (and ("ScoreFor" Mover) ("ScoreFor" Next)))) (define "IsControlledBy" (<= (+ 1 (count Pieces in:(difference (sites LineOfSight Piece at:#2 "LoSDirection") (sites Occupied by:Neutral)))) (* 2 (count Pieces #1 in:(sites LineOfSight Piece at:#2 "LoSDirection"))))) (define "ScoreFor" (set Score #1 (+ (results from:(forEach (difference (difference (sites Board) (sites Occupied by:#1)) (sites Occupied by:Neutral)) if:("IsControlledBy" #1 (site))) to:(from) (if (is Empty (to)) 1 2))))) (game "Double-Move Situ" (players 2) (equipment { "BoardUsed" (piece "Counter" P1) (piece "Counter" P2) (piece "X" Neutral) (piece "Counter" Neutral)}) (rules (meta (passEnd NoEnd)) (play (if (and (= -1 (var "DoubleTurnPhase")) (= 1 (mover))) (or (move Pass) (move Add (piece "X0") (to (sites Empty)) (then (if (> 2 (count Pieces in:(sites Occupied by:Neutral))) (moveAgain))))) (or { (move Add (to (sites Empty) if:(not ("IsControlledBy" Next (to)))) (then (if (= -1 (var "DoubleTurnPhase")) (set Var "DoubleTurnPhase" 1) ("MoveTwiceThenScore")))) (move Remove (forEach (sites Occupied by:Next) if:("IsControlledBy" Mover (site))) (then ("MoveTwiceThenScore")))}) (then (if (no Moves Next) (and ("ScoreFor" Mover) ("ScoreFor" Next)))))) (end (if (no Moves Mover) (result Mover Loss)))))
###
| (define "ColourBackground" (colour 135 170 130)) (define "SquareDiagonal" (board (square 8) use:Vertex)) (define "SquareGrid" (board (square 8) use:Vertex)) (define "Hex2Limp" (board (dual (hex (/ 8 2) (+ 2 (/ 8 2)))) use:Vertex)) (define "BoardUsed" "SquareGrid") (define "LoSDirection" Orthogonal) (define "MoveTwiceThenScore" (if (is Prev Next) (moveAgain) (and ("ScoreFor" Mover) ("ScoreFor" Next)))) (define "IsControlledBy" (<= (+ 2 (count Pieces in:(difference (sites LineOfSight Piece at:#2 "LoSDirection") (sites Occupied by:Neutral)))) (* 2 (count Pieces #1 in:(sites LineOfSight Piece at:#2 "LoSDirection"))))) (define "ScoreFor" (set Score #1 (+ (results from:(forEach (difference (difference (sites Board) (sites Occupied by:#1)) (sites Occupied by:Neutral)) if:("IsControlledBy" #1 (site))) to:(from) (if (is Empty (to)) 1 2))))) (game "Double-Move Situ" (players 2) (equipment { "BoardUsed" (piece "Counter" P1) (piece "Counter" P2) (piece "X" Neutral) (piece "Counter" Neutral)}) (rules (meta (passEnd NoEnd)) (play (if (and (= -1 (var "DoubleTurnPhase")) (= 1 (mover))) (or (move Pass) (move Add (piece "X0") (to (sites Empty)) (then (if (> 2 (count Pieces in:(sites Occupied by:Neutral))) (moveAgain))))) (or { (move Add (to (sites Empty) if:(not ("IsControlledBy" Next (to)))) (then (if (= -1 (var "DoubleTurnPhase")) (set Var "DoubleTurnPhase" 1) ("MoveTwiceThenScore")))) (move Remove (forEach (sites Occupied by:Next) if:("IsControlledBy" Mover (site))) (then ("MoveTwiceThenScore")))}) (then (if (no Moves Next) (and ("ScoreFor" Mover) ("ScoreFor" Next)))))) (end (if (no Moves Mover) (result Mover Loss))))) END |
Construct a Ludii game based on the following description
7x7 board, with diagonals in the square formed by the central 3x3 lines. 24 pieces per player. Black plays first. Players alternate turns placing a piece on one of the empty spots on the board. The first stone must be placed in the central spot. They attempt to orthogonally surround an empty point with four of their pieces, making a square. When all of the pieces are placed, players alternate turns removing one of their opponent's pieces from the board. They then move one of their pieces along the lines of the board to the place left vacant by the piece they removed. When a player makes a new square, they may remove another of the opponent's pieces from the board. Pieces that are in a square around an empty point may not be captured, and captures are not made in the placement phase. The player who captures all of the opponent's pieces wins.
###
| (define "HowManySquareSurroundedEmptyPoint" (count Sites in:(forEach (sites Around (last To)) if:(if (is Empty (site)) (or ("SurroundedDirections" N S W E) ("SurroundedDirections" NE SE SW NW)))))) (define "SurroundedDirections" (and { (is In (last To) (sites {(ahead (site) #1) (ahead (site) #2) (ahead (site) #3) (ahead (site) #4)})) (is Mover (who at:(ahead (site) #1))) (is Mover (who at:(ahead (site) #2))) (is Mover (who at:(ahead (site) #3))) (is Mover (who at:(ahead (site) #4)))})) (game "Fang" (players 2) (equipment { (board (add (square 7) edges:{{16 24} {24 32} {30 24} {24 18}}) use:Vertex) (piece "Marker" Each ("StepToEmpty" ~ (then (if (> ("HowManySquareSurroundedEmptyPoint") 0) (and (set Value Mover "HowManySquareSurroundedEmptyPoint") (moveAgain)))))) (hand Each)}) (rules (start (place "Marker" "Hand" count:24)) phases:{ (phase "FirstPlacement" P1 (play (move (from (handSite Mover)) (to (sites Centre)))) (nextPhase "Placement")) (phase "Placement" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover ("HandEmpty" Mover) "Playing")) (phase "Playing" (play (if ("SameTurn") (move Remove (sites Occupied by:Next) (then (if (> (value Player Mover) 1) (and (moveAgain) (set Value Mover (- (value Player Mover) 1))) (set Value Mover 0)))) (forEach Piece))))} (end ("CaptureAll" Next)))) END |
Construct a Ludii game based on the following description
Played on an 8x8 board with pieces with specialized moves: Pawns (8): can move one space forward; Rooks (2): can move any number of spaces orthogonally; Bishops (2): can move any number of spaces diagonally; Knight (2): moves in any direction, one space orthogonally with one space forward diagonally; Queens (1): can move any number of spaces orthogonally or diagonally; Kings (1): can move one space orthogonally or diagonally. Players capture pieces by moving onto a space occupied by an opponent's piece. Player wins when they checkmate the other player's king.
###
| (define "InitialPawnMove" (if (is In (from) (sites Start (piece (what at:(from))))) ("DoubleStepForwardToEmpty" "SetEnPassantLocation"))) (define "EnPassant" (move Step (directions {FR FL}) (to if:"InLocationEnPassant") (then (remove (ahead (last To) Backward))))) (define "InLocationEnPassant" (and (is Pending) (= (to) (value Pending)))) (define "SetEnPassantLocation" (then (set Pending (ahead (last To) Backward)))) (define "Castling" (if (and ("HasNeverMoved" "King") (not ("IsInCheck" "King" Mover))) (or (if (and ("HasNeverMoved" "RookLeft") (can Move ("CastleRook" "RookLeft" E 3 (is Empty (to))))) "BigCastling") (if (and ("HasNeverMoved" "RookRight") (can Move ("CastleRook" "RookRight" W 2 (is Empty (to))))) "SmallCastling")))) (define "BigCastling" ("DecideToCastle" "King" W 2 "KingNotCheckedAndToEmpty" (then ("CastleRook" "RookLeft" E 3 True)))) (define "SmallCastling" ("DecideToCastle" "King" E 2 "KingNotCheckedAndToEmpty" (then ("CastleRook" "RookRight" W 2 True)))) (define "CastleRook" (slide (from (mapEntry #1 (mover))) #2 (between (exact #3) if:#4) (to if:True (apply ("PieceHasMoved" (from)))))) (define "DecideToCastle" (move Slide (from (mapEntry #1 (mover))) #2 (between (exact #3) if:#4) (to if:True (apply ("PieceHasMoved" (from)))) #5)) (define "KingNotCheckedAndToEmpty" (and (is Empty (to)) (not ("IsInCheck" "King" Mover at:(to))))) (define "RememberPieceHasMoved" (then (if (= (state at:(last To)) 1) ("PieceHasMoved" (last To))))) (define "PieceHasMoved" (set State at:#1 0)) (define "HasNeverMoved" (= (state at:(mapEntry #1 (mover))) 1)) (game "Chess" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) ("ChessPawn" "Pawn" (or "InitialPawnMove" "EnPassant") (then (and ("ReplayInMovingOn" (sites Mover "Promotion")) (set Counter)))) ("ChessRook" "Rook" (then (set Counter)) ("RememberPieceHasMoved")) ("ChessKing" "King" (then (set Counter)) ("RememberPieceHasMoved")) ("ChessBishop" "Bishop" (then (set Counter))) ("ChessKnight" "Knight" (then (set Counter))) ("ChessQueen" "Queen" (then (set Counter))) (map "King" {(pair 1 "E1") (pair 2 "E8")}) (map "RookLeft" {(pair 1 "A1") (pair 2 "A8")}) (map "RookRight" {(pair 1 "H1") (pair 2 "H8")}) (regions "Promotion" P1 (sites Top)) (regions "Promotion" P2 (sites Bottom))}) (rules (start { (place "Pawn1" (sites Row 1)) (place "Pawn2" (sites Row 6)) (place "Rook1" {"A1" "H1"} state:1) (place "Knight1" {"B1" "G1"}) (place "Bishop1" {"C1" "F1"}) (place "Queen1" coord:"D1") (place "King1" coord:"E1" state:1) (place "Rook2" {"A8" "H8"} state:1) (place "Knight2" {"B8" "G8"}) (place "Bishop2" {"C8" "F8"}) (place "Queen2" coord:"D8") (place "King2" coord:"E8" state:1)}) (play (if "SameTurn" (move Promote (last To) (piece {"Queen" "Knight" "Bishop" "Rook"}) Mover) (do (or (forEach Piece) ("Castling")) ifAfterwards:(not ("IsInCheck" "King" Mover))))) (end { ("Checkmate" "King") (if (or (no Moves Mover) (= (counter) 99)) (result Mover Draw))}))) END |
Construct a Ludii game based on the following description
Each side has a line of pawns. The pawns move as in chess i.e. The pawn moves forwards one square (optionally two squares on its first move) and captures diagonally forwards one square by replacing the opponent’s piece. The rule of En Passant is also allowed. White goes first. The first person to reach the other side is the winner. You also win if it is your opponent’s move and they have no moves left.
In Ludii, options are also available to add each of the five other Chess piece types. In the variant with the king piece, if you capture the opponent king, you win as well. The game is played with only pawns.
###
| (define "InitialPawnMove" (if (is In (from) (sites Start (piece (what at:(from))))) ("DoubleStepForwardToEmpty" "SetEnPassantLocation"))) (define "EnPassant" (move Step (directions {FR FL}) (to if:"InLocationEnPassant") (then (remove (ahead (last To) Backward))))) (define "InLocationEnPassant" (and (is Pending) (= (to) (value Pending)))) (define "SetEnPassantLocation" (then (set Pending (ahead (last To) Backward)))) (game "The Pawn Game" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) ("ChessPawn" "Pawn" (or "InitialPawnMove" "EnPassant")) (regions P1 (sites Top)) (regions P2 (sites Bottom))}) (rules (start { (place "Pawn1" (sites Row 1)) (place "Pawn2" (sites Row 6))}) (play (forEach Piece)) (end { ("ReachWin" (sites Mover) Mover) ("BlockWin")}))) END |
Modify the Ludii game according to the following option changes:
The board has 13 holes. -> The board is an Alquerque board.
(game "Picaria" (players 2) (equipment { (board (square 3 diagonals:Solid) use:Vertex) (hand Each) (piece "Marker" Each ("StepToEmpty" All))}) (rules (start (place "Marker" "Hand" count:3)) phases:{ (phase "Placement" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase ("HandEmpty" P2) "Movement")) ("PhaseMovePiece" "Movement")} (end ("Line3Win" All))))
###
| (game "Picaria" (players 2) (equipment { ("AlquerqueBoard" 3 3) (hand Each) (piece "Marker" Each ("StepToEmpty" All))}) (rules (start (place "Marker" "Hand" count:3)) phases:{ (phase "Placement" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase ("HandEmpty" P2) "Movement")) ("PhaseMovePiece" "Movement")} (end ("Line3Win" All)))) END |
Construct a Ludii game based on the following description
The game starts in drawing a ground line and several line segments such that each line segment is connected to the ground. Any number of segments may meet at a point, and thus there may be multiple paths to ground. Every turn, the current player selects any line segment to be removed. Every line segment no longer connected to the ground by any path falls. The first player who is unable to move loses. In addition to the standard Hackenbush, there are two variants; HackenbushR-B and HackenbushR-G-B. For the Hackenbush version, all the lines are in the same colour (green). At each turn, the current player selects a coloured line to be removed, also removing any other line segments that become disconnected from the ground as a result. The game is over when there are no green edges in the graph. The second version is the Red-Blue version; HackenbushR-B. There is one red player, and one blue player. The players can remove only edges of their own colour. The last version is HackenbushR-G-B; there is a graph with red, green, and blue edges. Players may remove edges of their own colour, as well as the shared colour. For all the versions of Hackenbush, if the current player has no move, then the opposing player wins. The game is played on the Graph1. The players play on Hackenbush version.
###
| (define "Ground" (sites Bottom)) (define "NotConnectedToTheGround" (= 0 (count Sites in:(intersection ("Ground") (sites Group Edge at:(site) if:(is Occupied (to))))))) (define "RemoveCutBranch" (forEach Site (sites Group Edge at:(site)) (remove Edge (site)))) (game "Hackenbush" (players 2) (equipment { (board (graph vertices:{ {0 0} {2 0} {4 0} {6 0} {8 0} {10 0} {15 0} {4 2} {4 4} {6 4} {3 5} {4 6} {10 2} {10 4} {8 4} {12 5} {10 6}} edges:{ {0 1} {1 2} {2 3} {4 3} {4 5} {6 5} {2 7} {7 8} {7 9} {8 10} {8 11} {5 12} {12 14} {12 13} {13 15} {13 16}}) use:Edge) (piece "Marker" Each) (piece "Disc" Shared) (piece "Cross" Neutral) (regions All (expand (sites Bottom)))}) (rules (start { (set Neutral Edge ("Ground")) (set Shared Edge (difference (sites Board Edge) (sites {0..5})))}) (play (move Remove (sites Occupied by:Shared) (then (forEach Site (sites Incident Edge of:Edge at:(last To)) (if ("NotConnectedToTheGround") ("RemoveCutBranch")))))) (end (if (no Moves Mover) (result Next Win))))) END |
Construct a global Ludii definition which fulfills the following requirements.
Defines the most popular backgammon tracks.
###
| (define "BackgammonTracks" { (track "Track1" {12..7 5..0 13..18 20..25 #1} P1 directed:True) (track "Track2" {25..20 18..13 0..5 7..12 #1} P2 directed:True)}) END |
Modify the Ludii game according to the following option changes:
The game is played on a 10x10 board. -> The game is played on a 14x14 board.
The board is a diamond tiling by square. -> The board is a diamond tiling by triangle.
The connection between two stones is using all the orthogonal directions. -> The connection between two stones is using all the directions.
(game "Diagonal Hex" (players 2) (equipment { (board (square Diamond 10)) (piece "Marker" Each) (regions P1 { (sites Side NE) (sites Side SW)}) (regions P2 { (sites Side NW) (sites Side SE)})}) (rules (meta (swap)) (play (move Add (to (sites Empty)))) (end (if (is Connected Orthogonal Mover) (result Mover Win)))))
###
| (game "Diagonal Hex" (players 2) (equipment { (board (tri Diamond 14)) (piece "Marker" Each) (regions P1 { (sites Side NE) (sites Side SW)}) (regions P2 { (sites Side NW) (sites Side SE)})}) (rules (meta (swap)) (play (move Add (to (sites Empty)))) (end (if (is Connected All Mover) (result Mover Win))))) END |
Construct a Ludii game based on the following description
5x5 intersecting lines, with diagonals drawn in the four quadrants of the board. Two triangles, their apices intersecting the main board at opposite midpoints. The bast of the triangle is bisected by a line drawn from the apex, and this line is bisected and intersects with the other two sides of the triangle. one player plays as two tigers, which start on the central point. The other player has 23 sheep, eight of which start on the board, on the points immediately adjacent to the tigers. Pieces move one space along the lines to an empty adjacent spot. The tigers may capture an unbroken line of sheep in one direction, provided there is an unoccupied space at the opposite end of the line. The player with the sheep replaces any captured sheep from those remaining in their hand. The tigers win when they capture all of the sheep; the sheep win when they block the tigers from being able to move.
###
| (define "BigHop" (move Hop (between (range 1 9) if:#1 (apply (remove (between)))) (to if:(is Empty (to))))) (game "Merimueng-rimueng" (players 2) (equipment { ("AlquerqueBoardWithBottomAndTopTriangles") (hand P2) (piece "Tiger" P1 (or { ("StepToEmpty") ("BigHop" ("IsEnemyAt" (between)))})) (piece "Sheep" P2 "StepToEmpty")}) (rules (start { (place "Sheep2" (difference (expand (sites Centre)) (centrePoint))) (place Stack "Sheep2" (handSite P2) count:15) (place Stack "Tiger1" (sites Centre) counts:{2})}) phases:{ (phase "Movement" (play (forEach Piece top:True)) (end ("NoMovesP1NoPiecesP2")) (nextPhase (and ("HandOccupied" P2) (< (count Sites in:(sites Occupied by:P2 container:"Board")) 8)) "Placement")) (phase "Placement" (play (move (from (handSite Mover)) (to (sites Empty)) (then (moveAgain)))) (nextPhase (or ("HandEmpty" P2) (= (count Sites in:(sites Occupied by:P2 container:"Board")) 8)) "Movement"))})) END |
Construct a Ludii game based on the following description
The board consists of three intersecting lines, with diagonals drawn in the square formed. On opposite ends of the square, the central line is extended beyond the square and lines drawn from the adjacent corners to the end of this line, forming two triangles at opposite ends. One player takes the part of three white towers, the other the part of a single black army piece. First the army moves their piece, then the towers move one of their pieces, play alternating thereafter until the game is ended. A tower piece may move one step along a marked line in any forward or sideways direction. Tower pieces cannot move backwards, diagonally or otherwise, towards the end of the board from which they started. The army may move one step in any direction along a marked line. The army wins by passing the towers and reaching the end of the board from which they started. The towers win by trapping the army so that it cannot move in its turn. The towers can move in sideway and forwards (including diagonal and orthogonal forward). The army can move in all the directions. The army can not move. The game is played according to the rules of Lucas with the pieces already on the board.
###
| (game "Jeu Militaire" (players 2) (equipment { (board (rotate 90 ("ThreeMensMorrisGraphWithLeftAndRightTriangles")) use:Vertex) (piece "Pawn" P1 ("StepToEmpty")) (piece "Pawn" P2 N ("StepToEmpty" (directions {Forwards Rightward Leftward}))) (regions "Home" P2 (sites {"B1" "C2" "A2"})) (regions "Home" P1 (sites {"B2"}))}) (rules (start { (place "Pawn1" (sites P1)) (place "Pawn2" (sites P2))}) (play (forEach Piece)) (end { (if (no Moves P1) (result P2 Win)) (if (is In (where "Pawn" P1) (sites P2)) (result P1 Win))}))) END |
Modify the Ludii game according to the following option changes:
Played on a size 8 board. -> Played on a size 9 board.
(game "Fivalath" (players 2) (equipment { (board (square 8) use:Vertex) (piece "Ball" Each)}) (rules (play (move Add (to (sites Empty)))) (end { (if (is Line 5 All) (result Mover Win)) (if (is Line 4 All) (result Mover Loss))})))
###
| (game "Fivalath" (players 2) (equipment { (board (square 9) use:Vertex) (piece "Ball" Each)}) (rules (play (move Add (to (sites Empty)))) (end { (if (is Line 5 All) (result Mover Win)) (if (is Line 4 All) (result Mover Loss))}))) END |
Describe the mechanics of the following Ludii game
(define "OneRowIsEmpty" (or (all Sites (sites P1) if:(= 0 (count at:(site)))) (all Sites (sites P2) if:(= 0 (count at:(site)))))) (define "PiecesOwnedBy" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (define "NextHoleFrom" ("NextSiteOnTrack" #2 from:#1)) (define "Columns" 6) (game "Tap Urdy" (players 2) (equipment { (mancalaBoard 2 "Columns" store:None (track "Track" "5,W,N,E" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (hand Each) (piece "Seed" Shared)}) (rules (start (set Count 4 to:(sites Track))) (play (move Select (from (if ("SameTurn") ("LastHoleSowed") (sites Next)) if:(< 0 (count at:(from)))) (then (sow apply:(if (and (!= (count at:("NextHoleFrom" (to) 1)) 0) (> (count at:(to)) 1)) (moveAgain) (if (and (= (count at:("NextHoleFrom" (to) 1)) 0) (> (count at:(to)) 1)) (fromTo (from ("NextHoleFrom" (to) 2)) (to (handSite (mover))) count:(count at:("NextHoleFrom" (to) 2))))))))) (end ("MancalaByScoreWhen" ("OneRowIsEmpty")))))
###
| 2x6 board. Four counters in each hole. Players sow counters in a clockwise directions from one of the holes in their opponent's row. When the final counter lands in an occupied hole, the contents of that hole are picked up and sowing continues, unless the next hole is empty, in which case the contents of the next hole after the empty hole are captured. When the final counter falls in an empty hole, the turn ends. Play continues until all of the holes are empty in one of the rows. The player who captured the most counters wins. END |
Construct a Ludii game based on the following description
Each player starts the game with four pieces:
- a Lion (king) in the center of the home row
- a Giraffe (rook) to the right of the king
- an Elephant (bishop) to the left of the king
- a Chick (pawn) in front of the king
Each piece moves as in standard shogi, but is limited to moving one square per turn. If the Chick advances to reach the final rank, it promotes to a Hen, which can move one square any way except diagonally backwards (like the gold general in shogi).
As in shogi, if a Hen is captured, it may only be dropped back into play as a Chick. However, standard restrictions on where one may drop a Chick, such as not being allowed to give immediate checkmate, have two Chicks on a file, or drop the Chick on the final rank, do not apply. A chick dropped on the final rank, however, does not promote (and may make no further moves until it is recaptured).
If the players play the same position three turns in a row, the game is a draw.
###
| (define "Promote" (move Promote (last To) (piece (id "Chicken" Mover)))) (define "InLastRank" (is In #1 (sites Mover "LastRank"))) (define "StepMove" (move Step #1 (to if:(not ("IsFriendAt" (to))) "CapturePiece") #2)) (define "CapturePiece" (apply (if ("IsEnemyAt" (to)) (if ("IsPieceAt" "Lion" Next (to)) (remove (to)) (add (piece (mapEntry "Captured" (what at:(to)))) (to (mapEntry "Where" (what at:(to))))))))) (game "Let's Catch the Lion" ("TwoPlayersNorthSouth") (equipment { (board (rectangle 4 3)) (tile "Giraffe" Each ("StepMove" Orthogonal)) (tile "Elephant" Each ("StepMove" Diagonal)) (tile "Chick" Each ("StepMove" Forward (then (if ("InLastRank" (last To)) ("Promote"))))) (tile "Chicken" Each ("StepMove" (directions {Forward Backward Rightward Leftward FL FR}))) (tile "Lion" Each ("StepMove" Adjacent)) (map "Captured" { (pair (id "Giraffe" P1) (id "Giraffe" P2)) (pair (id "Giraffe" P2) (id "Giraffe" P1)) (pair (id "Elephant" P1) (id "Elephant" P2)) (pair (id "Elephant" P2) (id "Elephant" P1)) (pair (id "Chick" P1) (id "Chick" P2)) (pair (id "Chick" P2) (id "Chick" P1)) (pair (id "Chicken" P1) (id "Chick" P2)) (pair (id "Chicken" P2) (id "Chick" P1))}) (map "Where" { (pair (id "Giraffe" P1) (handSite P2)) (pair (id "Giraffe" P2) (handSite P1)) (pair (id "Elephant" P1) (handSite P2 1)) (pair (id "Elephant" P2) (handSite P1 1)) (pair (id "Chick" P1) (handSite P2 2)) (pair (id "Chick" P2) (handSite P1 2)) (pair (id "Chicken" P1) (handSite P2 2)) (pair (id "Chicken" P2) (handSite P1 2))}) (regions "LastRank" P1 (sites Top)) (regions "LastRank" P2 (sites Bottom)) (hand Each size:3)}) (rules (start { (place "Giraffe1" coord:"C1") (place "Giraffe2" coord:"A4") (place "Chick1" coord:"B2") (place "Chick2" coord:"B3") (place "Lion1" coord:"B1") (place "Lion2" coord:"B4") (place "Elephant1" coord:"A1") (place "Elephant2" coord:"C4")}) (play (or (move (from (sites Occupied by:Mover container:"Hand" components:{"Giraffe" "Chick" "Elephant"})) (to (sites Empty))) (forEach Piece))) (end { (if (is Cycle) (result Mover Draw)) (if (or ("IsOffBoard" (where "Lion" Next)) (is In (where "Lion" Mover) (sites Mover "LastRank"))) (result Mover Win))}))) END |
Construct a global Ludii definition which fulfills the following requirements.
Ends a mancala game when a condition is verified in computing the score of each player thanks to a ludemeplex called "PiecesOwnedBy" taking in input the role of P1 or P2. This ludemeplex can be used only in an ending condition.
###
| (define "MancalaByScoreWhen" (if #1 (byScore { (score P1 ("PiecesOwnedBy" P1)) (score P2 ("PiecesOwnedBy" P2))}))) END |
Construct a Ludii game based on the following description
5x5 holes. Twelve pieces per player, which begin in the two rows closest to each player and in the two holes to the right of the central hole. The central hole remains empty.
Players alternate turns moving a piece to an empty adjacent hole sideways or forward diagonally or orthogonally. Unpromoted pieces cannot move or capture backwards. A player may capture an opponent's piece by hopping over it to an empty space immediately on the opposite side of it, in one of the allowed directions.
The huff rules applies: when a player does not make a capture that they should, the opponent removes the piece that should have captured.
When a piece reaches a corner space on the opposite side of the board from where it starts, it is promoted to Dama. The Dama can move and capture any distance orthogonally or diagonally, and may also move backwards.
The player who captures all of the opponent's pieces wins.
###
| (define "ShouldCapturedButMoved" (and (is In (last From) ("SitesWithPossibleCaptureInPreviousTurn")) (is In (last From) (sites Empty)))) (define "HuffOnePieceOf" (move Select (from #1 if:(is Occupied (from))) (then (and { (remove (last To)) (moveAgain) (set Value Prev 0)})))) (define "SitesWithPossibleCaptureInPreviousTurn" (sites Pending)) (define "RememberSiteWithPossibleCapture" (set Pending (sites From (or (forEach Piece "Disc" ("HopDisc")) (forEach Piece "DiscDouble" ("HopCaptureDistance" ~ All)))))) (define "DidNotCaptured" (= (value Player Prev) 1)) (define "HasNotCaptured" (set Value Mover 1)) (define "HasCaptured" (set Value Mover 0)) (define "HopDiscDouble" ("HopCaptureDistance" ~ All ~ (then ("HasCaptured")))) (define "HopDisc" ("HopCapture" ~ (directions {Rightward Leftward Forwards} of:All) (then (and ("PromoteIfReach" (sites Next) "DiscDouble") ("HasCaptured"))))) (game "La Dama" ("TwoPlayersNorthSouth") (equipment { (board (square 5) use:Vertex) (piece "Disc" Each (or ("HopDisc") ("StepToEmpty" (directions {Rightward Leftward Forwards} of:All) (then ("HasNotCaptured"))) (then ("PromoteIfReach" (sites Next) "DiscDouble")))) (piece "DiscDouble" Each (or ("HopDiscDouble") (move Slide All (then ("HasNotCaptured"))))) (regions P1 (intersection (sites Corners) (sites Bottom))) (regions P2 (intersection (sites Corners) (sites Top)))}) (rules (start { (place "Disc1" (union {(expand (sites Bottom)) (sites {"D3" "E3"})})) (place "Disc2" (union {(sites {"A3" "B3"}) (expand (sites Top))}))}) (play (or (if ("DidNotCaptured") (or (if ("ShouldCapturedButMoved") ("HuffOnePieceOf" (last To))) ("HuffOnePieceOf" ("SitesWithPossibleCaptureInPreviousTurn")))) (do ("RememberSiteWithPossibleCapture") next:(forEach Piece)))) (end ("CaptureAll" Mover)))) END |
Describe the mechanics of the following Ludii game
(define "CommanderOfWasCapture" (is Triggered "CommanderCaptured" #1)) (define "CaptureCommandeOf" (trigger "CommanderCaptured" #1)) (define "CommanderOfWasCapture" (is Triggered "CommanderCaptured" #1)) (define "CaptureCommandeOf" (trigger "CommanderCaptured" #1)) (define "StepOrChangeDirection" (or (move Step #1 (to if:(not ("IsFriendAt" (to))) (apply "RemovePiece")) #2) (move Set Rotation))) (define "SlideOrChangeDirection" (or (move Slide #1 (between #2) (to if:("IsEnemyAt" (to)) (apply "RemovePiece"))) (move Set Rotation))) (define "RemovePiece" (remove (to))) (game "Ploy" (players 2) (equipment { (board (square 9) use:Vertex) (piece "Commander" Each ("StepOrChangeDirection" (directions {FR FL BL BR} of:All))) (piece "Shield" Each ("StepOrChangeDirection" (directions Forward of:All) (then (moveAgain)))) (piece "LanceW" Each ("SlideOrChangeDirection" (directions Forwards of:All) (max 3))) (piece "LanceY" Each ("SlideOrChangeDirection" (directions {FR FL Backward} of:All) (max 3))) (piece "LanceT" Each ("SlideOrChangeDirection" (directions {Forward Rightward Leftward} of:All) (max 3))) (piece "ProbeI" Each ("SlideOrChangeDirection" (directions {Forward Backward} of:All) (max 2))) (piece "ProbeMinV" Each ("SlideOrChangeDirection" (directions {Forward FR} of:All) (max 2))) (piece "ProbeBigV" Each ("SlideOrChangeDirection" (directions {FR FL} of:All) (max 2)))}) (rules (start { (place "Commander1" coord:"E1" rotation:0) (place "Shield1" {"D3" "E3" "F3"} rotation:0) (place "ProbeI1" coord:"E2" rotation:0) (place "ProbeBigV1" {"D2" "F2"} rotation:0) (place "ProbeMinV1" coord:"C2" rotation:0) (place "ProbeMinV1" coord:"G2" rotation:7) (place "LanceW1" {"D1" "F1"} rotation:0) (place "LanceY1" {"C1" "G1"} rotation:0) (place "LanceT1" {"B1" "H1"} rotation:0) (place "Commander2" coord:"E9" rotation:4) (place "Shield2" {"D7" "E7" "F7"} rotation:4) (place "ProbeI2" coord:"E8" rotation:4) (place "ProbeBigV2" {"D8" "F8"} rotation:4) (place "ProbeMinV2" coord:"C8" rotation:3) (place "ProbeMinV2" coord:"G8" rotation:4) (place "LanceW2" {"D9" "F9"} rotation:4) (place "LanceY2" {"C9" "G9"} rotation:4) (place "LanceT2" {"B9" "H9"} rotation:4)}) (play (if "SameTurn" (or (move Set Rotation (to (last To))) (move Pass)) (forEach Piece))) (end (if (or ("IsOffBoard" (where "Commander" Next)) (= (count Pieces Next) 1)) (result Mover Win)))))
###
| The goal is to capture the enemy Commander, or reduce the opponent army to a single Commander. Each piece has an indicator which determines at which directions the piece can move. This can be altered by rotating the piece 45 degrees= to the left or right. Rotating the piece costs a move. Each player has 3 Shields, 5 Probes, 6 Lances, and one Commander. The Shield moves one step and has only one movement freedom at any time. The Probe slides two steps and has two freedoms. The Lance slides three steps and has three freedoms. The Commander has four, but can only move one step. A player must either make a direction move or a motion move. The three Shields are the only pieces that can perform a direction move immediately after a motion move. Capture occurs by displacement. The two players version of Ploy. END |
Construct a Ludii game based on the following description
5x5 intersecting lines with diagonals drawn in the four quadrants. Twelve pieces per player. which begin on two rows closest to the player and the two spaces in the central row on the player's right. Players alternate turns moving a piece to an empty adjacent point on the board, along the lines in a forward or sideways direction. A player may capture an opponent's piece by hopping over it to an empty space on immediately on the opposite side of it along the lines on the board. Captures are compulsory, and if the opponent realizes that the player did not make a possible capture, the opponent immediately captures the player's piece that could have captured but didn't. Regular pieces cannot capture backwards. When a piece reaches the farthest row on the opposite side of the board from where they started, it is promoted to a king, which can move and capture any distance along the lines of the board. The player who captures all of their opponent's pieces wins.
###
| (define "ShouldCapturedButMoved" (and (is In (last From) ("SitesWithPossibleCaptureInPreviousTurn")) (is In (last From) (sites Empty)))) (define "HuffOnePieceOf" (move Select (from #1 if:(is Occupied (from))) (then (and { (remove (last To)) (moveAgain) (set Value Prev 0)})))) (define "SitesWithPossibleCaptureInPreviousTurn" (sites Pending)) (define "RememberSiteWithPossibleCapture" (set Pending (sites From (or (forEach Piece "Counter" ("HopCounter")) (forEach Piece "DoubleCounter" ("HopCaptureDistance")))))) (define "DidNotCaptured" (= (value Player Prev) 1)) (define "HasNotCaptured" (set Value Mover 1)) (define "HasCaptured" (set Value Mover 0)) (define "HopCounter" ("HopCapture" ~ (directions {Forwards Rightward Leftward}) (then (and ("PromoteIfReach" (sites Next) "DoubleCounter") ("HasCaptured"))))) (game "Dama (Alquerque)" ("TwoPlayersNorthSouth") (equipment { ("AlquerqueBoard" 5 5) (piece "Counter" Each (or ("HopCounter") ("StepToEmpty" (directions {Forwards Rightward Leftward}) (then ("HasNotCaptured"))) (then ("PromoteIfReach" (sites Next) "DoubleCounter")))) (piece "DoubleCounter" Each (or ("HopCaptureDistance" ~ ~ ~ (then ("HasCaptured"))) (move Slide (then ("HasNotCaptured"))))) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start { (place "Counter1" (union {(expand (sites Bottom)) (sites {"D3" "E3"})})) (place "Counter2" (union {(sites {"A3" "B3"}) (expand (sites Top))}))}) (play (or (if ("DidNotCaptured") (or (if ("ShouldCapturedButMoved") ("HuffOnePieceOf" (last To))) ("HuffOnePieceOf" ("SitesWithPossibleCaptureInPreviousTurn")))) (do ("RememberSiteWithPossibleCapture") next:(forEach Piece)))) (end ("CaptureAll" Mover)))) END |
Construct a Ludii game based on the following description
Each turn you must move one of your stacks, in a straight line orthogonally or diagonally, a distance exactly equal to the size of that stack.
If it lands on an empty space, the stack grows by 1.
If it lands on an enemy, the enemy is removed and your stack shrinks down to size 1.
It is not legal to land on a friendly stack.
Jumping over stacks is allowed.
Stacks may also jump off the board, removing themselves from the game.
Passing is not allowed.
Definitions for crown and king: In this implementation, the king-stack will have a red stroke color. This red ring is the crown. Which stack has the crown is determined like this: After your move, if there is, among your stacks, a unique stack of the biggest size, the crown will be on that stack. There is no other way the crown can change heads. The piece with a crown on it is the king.
Goal: If the enemy king is removed from the game, you win.
Note: In this implementation, jumping off the board is only possible if the stack can reach exactly 1 row or column beyond the perimeter. But it seems to always be the case that it is possible to jump off the board when a stack is big enough. Please let Michael know if you encounter a scenario where a piece is stuck. This should not be allowed according to the rules of the game.
###
| (define "Move" (or ("MoveToEmpty") ("Capture") #1)) (define "Capture" (move (from) (to (sites Around (from) Enemy distance:(size Stack at:(from))) (apply (and { (if (= 1 (state at:(to))) (set Var "MoverHasWon" 1)) (set Var (state at:(from))) (remove (to) count:(size Stack at:(to)))}))) count:(size Stack at:(from)) stack:True (then (if (< 1 (size Stack at:(last To))) (and (remove (last To) count:(- (size Stack at:(last To)) 1)) (set State at:(last To) (var))))))) (define "MoveToEmpty" (move (from) (to (sites Around (from) Empty distance:(size Stack at:(from))) (apply (if (and { (= 1 (state at:(from))) (is In (to) (sites Outer))}) (set Var "MoverHasLost" 1)))) count:(size Stack at:(from)) stack:True (then (add (to (last To) level:0) stack:True)))) (define "UpdateKing" (if (= 1 (count Sites in:(forEach (sites Occupied by:Mover) if:(= (size Stack at:(site)) (max (results from:(sites Occupied by:Mover) to:0 (size Stack at:(from)))))))) (forEach Piece (if (= (size Stack at:(from)) (max (results from:(sites Occupied by:Mover) to:0 (size Stack at:(from))))) (set State at:(from) 1) (set State at:(from) 0)) Mover top:True))) (game "Lielow" (players 2) (equipment { (board (square 10)) (piece "Disc" Each)}) (rules (start { (place "Disc1" (difference (difference (expand (sites Bottom) steps:2) (expand (sites Bottom) steps:1)) (sites Outer))) (place "Disc2" (difference (difference (expand (sites Top) steps:2) (expand (sites Top) steps:1)) (sites Outer)))}) (play (forEach Piece ("Move") Mover top:True (then (do (remove (sites Outer) count:(size Stack at:(last To))) next:("UpdateKing"))))) (end { (if (= 1 (var "MoverHasLost")) (result Mover Loss)) (if (= 1 (var "MoverHasWon")) (result Mover Win))}))) END |
Construct a Ludii game based on the following description
5x6 board. Each player has twelve pieces. Players alternate placing their pieces until they are all placed on the board. Players cannot make a row of three pieces in the placement phase. Once the pieces are all on the board, they may be moved one space orthogonally. The goal is to make a line of three, which allows the player to capture one of the opponent's pieces. In the case that a move creates two lines of three, only one capture is made. The player who captures the most pieces wins. Matches are typically played to a score of ten, with a player scoring one point by winning a game, and two points for winning without any of their pieces being captured.
###
| (define "NoLine3" (not (is Line 3 Orthogonal))) (game "Dra" (players 2) (equipment { (board (rectangle 5 6)) (hand Each) (piece "Marker" Each ("StepToEmpty" Orthogonal (then ("ReplayIfLine3" Orthogonal exact:True))))}) (rules (start (place "Marker" "Hand" count:12)) phases:{ (phase "Placement" (play (do (move (from (handSite Mover)) (to (sites Empty))) ifAfterwards:"NoLine3")) (nextPhase ("HandEmpty" P2) "Movement")) (phase "Movement" (play (if "SameTurn" "RemoveAnyEnemyPiece" (forEach Piece))) (end ("HavingLessPiecesLoss" Next 2)))})) END |
Construct a Ludii game based on the following description
Omny is played on the cells of any hexagonal grid where some or all of the cells are designated star cells. Players take turns placing a stone of one's own color on an empty cell. A group is a set of connected stones of the same color. A cut of a group X is any set of connected cells (empty or occupied by either player) including no stones in X. You win by making a group such that none of its cuts include more than half the cells of the board. For serious play it is advised to play with a balance rule in force.
In Misère Omny you lose if you make a group whose cuts each contain no more than half of the star cells. A hex board is currently selected A size 7 board is currently selected The currently selected star cells are all the cells on the board. The pie rule is currently in force The standard win condition is currently selected.
###
| (define "StarCells" (sites Board)) (game "Omny" (players 2) (equipment { (board (hex 7)) (piece "Disc" Each)}) (rules (play (if (= 1 (var)) (or (move Swap Players P1 P2) (move Add (to (sites Empty)) (then (set Var 0)))) (move Add (to (sites Empty)) (then (if (= 1 (count Moves)) (set Var 1)))))) (end (if (>= (count Sites in:("StarCells")) (max (results from:(difference (sites Board) (sites Group at:(last To))) to:2 (* (to) (count Sites in:(intersection ("StarCells") (sites Group at:(from) if:(not (is In (to) (sites Group at:(last To))))))))))) (result Mover Win))))) END |
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 "SecondToRightInnerRow" (if (is Mover P1) (intersection (sites Mover "Inner") (difference (expand (sites Right)) (sites Right))) (intersection (sites Mover "Inner") (difference (expand (sites Left)) (sites Left))))) (define "RightMostHole" (if (is Mover P1) (intersection (sites Mover "Outer") (sites Right)) (intersection (sites Mover "Outer") (sites Left)))) (define "NextHole" ("NextSiteOnTrack" #2 from:#1 "Track")) (define "NoPiece" (all Sites (sites Player) if:(= 0 (count at:(site))))) (define "Columns" 9) (game "Njombwa (One Counter)" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "Track1" "0,E,N1,W" loop:True P1) (track "Track2" "18,E,N1,W" loop:True P2)}) (regions "Home" P1 (sites Track "Track1")) (regions "Home" P2 (sites Track "Track2")) (regions "Inner" P1 (difference (sites Track "Track1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "Track2") (sites Top))) (regions "Outer" P1 (sites Bottom)) (regions "Outer" P2 (sites Top)) (piece "Seed" Shared)}) (rules (start (set Count 1 to:(sites Board))) phases:{ (phase "Opening1" (play (move Select (from (if ("SameTurn") "LastHoleSowed" ("RightMostHole")) if:(> (count at:(from)) 0)) (then (sow "Track" owner:(mover) apply:(if (and (not (is In ("NextHole" (to) 1) ("RightMostHole"))) (< 1 (count at:(to)))) (moveAgain)))))) (nextPhase Mover (not (is Next Mover)) "Opening2")) (phase "Opening2" (play (move (from (sites Mover "Home") if:(is In ("NextHole" (from) 1) ("RightMostHole"))) (to ("RightMostHole")) count:2)) (nextPhase Mover "Opening3")) (phase "Opening3" (play (move Remove ("SecondToRightInnerRow"))) (nextPhase Mover "Sowing")) (phase "Sowing" (play (if ("AllSitesNoMoreThanOne") (move Select (from (sites Mover "Home") if:(and (is Occupied (from)) (is Empty ("NextHole" (from) 1)))) (then (sow "Track" owner:(mover)))) (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover "Home")) if:(> (count at:(from)) 1)) (then (sow "Track" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (and (is In (to) (sites Mover "Inner")) (is Occupied ("OppositePit" (to)))) (and (remove ("OppositePit" (to))) (if (is Occupied ("OppositeOuterPit" (to))) (remove ("OppositeOuterPit" (to)))))))))))))} (end (forEach NonMover if:("NoPiece") (result Player Loss)))))
###
| (define "AllSitesNoMoreThanOne" (all Sites (sites Mover "Home") if:(>= 1 (count at:(site))))) (define "SecondToRightInnerRow" (if (is Mover P1) (intersection (sites Mover "Inner") (difference (expand (sites Right)) (sites Right))) (intersection (sites Mover "Inner") (difference (expand (sites Left)) (sites Left))))) (define "RightMostHole" (if (is Mover P1) (intersection (sites Mover "Outer") (sites Right)) (intersection (sites Mover "Outer") (sites Left)))) (define "NextHole" ("NextSiteOnTrack" #2 from:#1 "Track")) (define "NoPiece" (all Sites (sites Player) if:(= 0 (count at:(site))))) (define "Columns" 10) (game "Njombwa (One Counter)" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "Track1" "0,E,N1,W" loop:True P1) (track "Track2" "20,E,N1,W" loop:True P2)}) (regions "Home" P1 (sites Track "Track1")) (regions "Home" P2 (sites Track "Track2")) (regions "Inner" P1 (difference (sites Track "Track1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "Track2") (sites Top))) (regions "Outer" P1 (sites Bottom)) (regions "Outer" P2 (sites Top)) (piece "Seed" Shared)}) (rules (start (set Count 1 to:(sites Board))) phases:{ (phase "Opening1" (play (move Select (from (if ("SameTurn") "LastHoleSowed" ("RightMostHole")) if:(> (count at:(from)) 0)) (then (sow "Track" owner:(mover) apply:(if (and (not (is In ("NextHole" (to) 1) ("RightMostHole"))) (< 1 (count at:(to)))) (moveAgain)))))) (nextPhase Mover (not (is Next Mover)) "Opening2")) (phase "Opening2" (play (move (from (sites Mover "Home") if:(is In ("NextHole" (from) 1) ("RightMostHole"))) (to ("RightMostHole")) count:2)) (nextPhase Mover "Opening3")) (phase "Opening3" (play (move Remove ("SecondToRightInnerRow"))) (nextPhase Mover "Sowing")) (phase "Sowing" (play (if ("AllSitesNoMoreThanOne") (move Select (from (sites Mover "Home") if:(and (is Occupied (from)) (is Empty ("NextHole" (from) 1)))) (then (sow "Track" owner:(mover)))) (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover "Home")) if:(> (count at:(from)) 1)) (then (sow "Track" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (and (is In (to) (sites Mover "Inner")) (is Occupied ("OppositePit" (to)))) (and (remove ("OppositePit" (to))) (if (is Occupied ("OppositeOuterPit" (to))) (remove ("OppositeOuterPit" (to)))))))))))))} (end (forEach NonMover if:("NoPiece") (result Player Loss))))) END |
Describe the mechanics of the following Ludii game
(define "EagleMovement" (sites To (if (and ("IsNotOffBoard" (ahead (from) #1)) (not ("IsFriendAt" (ahead (from) #1)))) (or (fromTo (from) (to (ahead (from) #1))) (slide (from (ahead (from) #1)) #2 (to if:("IsEnemyAt" (to)))))))) (define "RhinoMovement" (sites To (if ("IsNotOffBoard" (ahead (from) #1)) (slide (from (ahead (from) #1)) #2 (to if:("IsEnemyAt" (to))))))) (define "PromotedPiece" (if (is In (last To) (sites Corners)) (id "Rook" Mover) (if (or (= (column of:(last To)) 1) (= (column of:(last To)) 10)) (id "Lion" Mover) (if (or (= (column of:(last To)) 2) (= (column of:(last To)) 9)) (id "Rhino" Mover) (if (or (= (column of:(last To)) 3) (= (column of:(last To)) 8)) (id "Giraffe" Mover) (if (or (= (column of:(last To)) 4) (= (column of:(last To)) 7)) (id "Crocodile" Mover) (id "Eagle" Mover))))))) (define "RememberPieceHasMoved" (then (if (= (state at:(last To)) 1) "PieceHasMoved"))) (define "PieceHasMoved" (set State at:(last To) 0)) (define "HasNeverMoved" (= (state at:(from)) 1)) (game "Grande Acedrex" ("TwoPlayersNorthSouth") (equipment { (board (square 12)) ("ChessPawn" "Pawn" ~ (then (if (is In (last To) (sites Mover "Promotion")) (promote (last To) (piece "PromotedPiece"))))) ("ChessBishop" "Crocodile") (piece "Eagle" Each (move (from) (to (union { ("EagleMovement" NW (directions {N W})) ("EagleMovement" NE (directions {N E})) ("EagleMovement" SW (directions {S W})) ("EagleMovement" SE (directions {E S}))}) (apply if:("IsEnemyAt" (to)) (remove (to)))))) (piece "Rhino" Each (move (from) (to (union { ("RhinoMovement" N (directions {NE NW})) ("RhinoMovement" W (directions {NW SW})) ("RhinoMovement" S (directions {SW SE})) ("RhinoMovement" E (directions {SE NE}))}) (apply if:("IsEnemyAt" (to)) (remove (to)))))) (piece "Giraffe" Each ("LeapCapture" "GiraffeWalk")) ("ChessRook" "Rook") (piece "Lion" Each ("LeapCapture" { {F F F}})) (piece "King" Each (or ("StepToNotFriend") (if "HasNeverMoved" (move Hop Forwards (between if:True) (to if:(not ("IsFriendAt" (to))) (apply (if ("IsEnemyAt" (to)) (remove (to))))))) "RememberPieceHasMoved")) (regions "Promotion" P1 (sites Top)) (regions "Promotion" P2 (sites Bottom))}) (rules (start { (place "Pawn1" (sites Row 3)) (place "Rook1" (sites {"A1" "L1"})) (place "Lion1" (sites {"B1" "K1"})) (place "Rhino1" (sites {"C1" "J1"})) (place "Giraffe1" (sites {"D1" "I1"})) (place "Crocodile1" (sites {"E1" "H1"})) (place "Eagle1" coord:"F1") (place "King1" coord:"G1" state:1) (place "Pawn2" (sites Row 8)) (place "Rook2" (sites {"A12" "L12"})) (place "Lion2" (sites {"B12" "K12"})) (place "Rhino2" (sites {"C12" "J12"})) (place "Giraffe2" (sites {"D12" "I12"})) (place "Crocodile2" (sites {"E12" "H12"})) (place "Eagle2" coord:"F12") (place "King2" coord:"G12" state:1)}) (play (do (or { (forEach Piece "Pawn") (forEach Piece "King") (forEach Piece "Rook") (forEach Piece "Lion") (forEach Piece "Giraffe") (forEach Piece "Eagle") (forEach Piece "Crocodile") (forEach Piece "Rhino")}) ifAfterwards:(not ("IsInCheck" "King" Mover)))) (end ("Checkmate" "King"))))
###
| 12x12 checkered board. Each player begins with 24 pieces with special moves: King (x1): Moves one space orthogonally or diagonally or may jump over one space forward orthogonally or diagonally on its first move; Aanca (x2): Moves diagonally one and one space orthogonally in the same direction, and may continue moving in that same direction any distance; Crocodile (x2): moves diagonally any distance; Giraffe (x2): moves two spaces diagonally and then one orthogonally in the same direction, jumping over any intervening pieces; Rhinoceros (x2): moves diagonally one space and then one orthogonally in the same directions, jumping over any intervening pieces, and then may continue along the diagonal in the same direction; Lion (x2); jumps orthogonally three spaces away. Rook (x2): moves any distance orthogonally; Pawns (12): move forward orthogonally one pace or diagonally one space to capture. When they reach the opposite edge of the board, they are promoted to the piece which began in that space. If this is the King's space, it is promoted to Aanca. The opening position is for white: Rook, Lion, Rhinoceros, Giraffe, Crocodile, Aanca, King, Crocodile, Giraffe, Rhinoceros, Lion, Rook. This is mirrored for black so that the kings face each other. The pawns begin on the fourth row. Pieces are captured when a piece lands on a space occupied by the opposing player. The goal is to checkmate the King. When the King can be captured on the opponent's next turn, it is in check. The player must remove the King from check on their next turn. If the King cannot move out of check, it is checkmated and the opponent wins. The rules of Alfonso X without dice. END |
Construct a Ludii game based on the following description
Starting with the runner player, players alternate moving one of their checker tokens. Each token moves in one orthogonal direction only.
Runner tokens move vertically from the first rank, either by moving into an adjacent empty space or by jumping over an adjacent opponent token into an empty space and capturing the jumped token.
Blocker tokens move horizontally in a similar manner - the left tokens always move toward the right and the right tokens always move towards the left.
In the standard/introductory game, played on an 8x8 board, captures are mandatory and multiple capture are possible with maximum capture sequences having priority. In tournament games, played on a 10 x 10 board, captures are optional.
Blocker tokens may not jump over or capture other blocker tokens.
The game ends when a runner token reaches the last rank or the runner player cannot move.
Two games should be played, with players swapping roles. At the end of each game, the runner player scores the rank/row of each of his or her remaining tokens on the board. The player with the highest score after two games wins the match. 8 x 8 board Forced captures
###
| (define "HopCounter" (move Hop (from #1) #2 (between if:(and (not (is In (between) (sites ToClear))) ("IsEnemyAt" (between))) (apply (remove (between) at:EndOfTurn))) (to if:(is Empty (to))) #3)) (game "Gauntlet" (players {(player N) (player W)}) (equipment { (board (square 8)) (piece "Counter" Each) (piece "DoubleCounter" Each) (regions "RunnerGoal" P1 (difference (sites Top) (sites Corners))) (regions "RunnerGoalRed" Neutral (intersection (difference (sites Top) (sites Corners)) (sites Phase 0))) (regions "RunnerGoalPink" Neutral (intersection (difference (sites Top) (sites Corners)) (sites Phase 1)))}) (rules (start { (place "Counter1" (difference (sites Bottom) (sites Corners))) (place "DoubleCounter2" (difference (sites Left) (sites Corners))) (place "Counter2" (difference (sites Right) (sites Corners)))}) (play (priority { (max Moves (or (forEach Piece "Counter" ("HopCounter" (from) Forward (then (if (can Move ("HopCounter" (last To) Forward)) (moveAgain))))) (forEach Piece "DoubleCounter" ("HopCounter" (from) Backward (then (if (can Move ("HopCounter" (last To) Backward)) (moveAgain))))))) (or (forEach Piece "Counter" (move Step (directions Forward) (to if:(is Empty (to))))) (forEach Piece "DoubleCounter" (move Step (directions Backward) (to if:(is Empty (to))))))})) (end { (if (no Moves Next) (result Next Loss)) (if (is In (last To) (sites Mover)) (result Mover Win))}))) END |
Construct a Ludii game based on the following description
Black plays first, then turns alternate. On his turn, a player must place a stone of his color on an empty point of the board. At the end of a turn, all groups on the board (both friendly and enemy) must have at least one liberty. Otherwise the player's move is illegal. Whoever can't make a move on his turn loses. The game is played on 9x9 board.
###
| (define "NoCapture" (not (can Move ("EncloseCapture" Orthogonal)))) (game "NoGo" (players 2) (equipment { (board (square 9) use:Vertex) (piece "Marker" Each)}) (rules (play (do (move Add (to (sites Empty))) ifAfterwards:(and ("HasFreedom" Orthogonal) "NoCapture"))) (end ("NoMoves" Loss)))) END |
Construct a Ludii game based on the following description
The player must insert numbers so that the sums of lines in all three directions equal the same number. Numbers cannot be repeated.
###
| (game "Magic Hexagon" (players 1) (equipment { (board (hex 3) (values Cell (range 1 19))) (regions { (sites {0 1 2}) (sites {3 4 5 6}) (sites {7 8 9 10 11}) (sites {12 13 14 15}) (sites {16 17 18}) (sites {2 6 11}) (sites {1 5 10 15}) (sites {0 4 9 14 18}) (sites {3 8 13 17}) (sites {7 12 16}) (sites {0 3 7}) (sites {1 4 8 12}) (sites {2 5 9 13 16}) (sites {6 10 14 17}) (sites {11 15 18})}) (regions HintRegions)}) (rules (play (satisfy { (all Different (sites Board)) (is Sum 38)})) (end (if (is Solved) (result P1 Win))))) END |
Construct a Ludii game based on the following description
On your turn you have to options:
• Noncapturing move: Step kingwise away from the center of the line you are stepping along.
• Capturing move: Capture queenwise any enemy not farther away from the center of the line you are moving along.
Only if you have no moves may you pass. The game is over when only one player has pieces left. That player is the winner. A 6x6 board is currently selected
###
| (define "Capture" (move (from) (to (intersection (sites Occupied by:Next) (sites Direction from:(from) (directions {#1 #2}) stop:(is Occupied (to)) stopIncluded:True)) if:(not (> (min (count Sites in:(sites Direction from:(from) #1)) (count Sites in:(sites Direction from:(from) #2))) (min (count Sites in:(sites Direction from:(to) #1)) (count Sites in:(sites Direction from:(to) #2))))) (apply (remove (to)))))) (define "Step" (move Step (from) (to if:(and { (is Empty (to)) (or { (and (or (= (from) (+ (to) 6)) (= (from) (- (to) 6))) ("Outward" N S)) (and (or (= (from) (+ (to) 1)) (= (from) (- (to) 1))) ("Outward" E W)) (and (or (= (from) (+ (to) (+ 6 1))) (= (from) (- (to) (+ 6 1)))) ("Outward" SW NE)) (and (or (= (from) (+ (to) (- 6 1))) (= (from) (- (to) (- 6 1)))) ("Outward" SE NW))})})))) (define "Outward" (< (max (count Sites in:(sites Direction from:(from) #1)) (count Sites in:(sites Direction from:(from) #2))) (max (count Sites in:(sites Direction from:(to) #1)) (count Sites in:(sites Direction from:(to) #2))))) (game "Zola" (players 2) (equipment { (board (square 6)) (piece "Disc" Each)}) (rules (start { (place "Disc1" (sites Phase 0)) (place "Disc2" (sites Phase 1))}) (play (forEach Piece (or { ("Capture" N S) ("Capture" NE SW) ("Capture" E W) ("Capture" SE NW) ("Step")}))) (end (if (or (no Pieces P1) (no Pieces P2)) (result Mover Win))))) END |
Describe the mechanics of the following Ludii game
(define "MoveTo" (forEach Site (sites Occupied by:Mover) (if ("CanEscape" #1) ("RemoveAPiece") (move (from (site)) (to #1 if:("NoEnemyOrOnlyOne" (to)) ("HittingCapture" ("Bar"))))))) (define "CanEscape" ("IsOffBoard" #1)) (define "AllPieceEscaped" (no Pieces Mover)) (define "Bar" (mapEntry (mover))) (define "RemoveAPiece" (move Remove (site))) (define "NextSiteFromDist6" ("NextSiteOnTrack" 6 from:#1)) (define "NextSiteFrom" ("NextSiteOnTrack" (pips) from:#1)) (game "Baralie" (players 2) (equipment { ("BackgammonBoard" "BackgammonTracksSameDirectionWithBar") (dice num:2) (map {(pair 1 19) (pair 2 6)}) (piece "Disc" Each)}) (rules (start { (place Stack "Disc1" 12 count:15) (place Stack "Disc2" 11 count:14) (place Stack "Disc2" 10)}) (play ("RollEachNewTurnMove" (if (all DiceUsed) ("MoveTo" ("NextSiteFromDist6" (site))) (forEach Die if:("DieNotUsed") ("MoveTo" ("NextSiteFrom" (site))) (then (moveAgain)))))) (end (if ("AllPieceEscaped") (result Mover Win)))))
###
| 2x12 board, divided in half, where the spaces are rendered as points. Fifteen pieces per player. Two six-sided dice. Both players begin on the same side of the board, one player with fifteen pieces on the rightmost point, the other player with fourteen pieces on the point behind it, and one on the point behind that. Players move according to the number on each die by moving one piece the value on one die then another piece the value on the other die, or by moving one piece the value of one die and then the value of the other. On each throw the player also plays a throw of 6 in addition to the throw presented by the dice. Pieces move in an anti-clockwise direction around the board. A piece cannot move to a point that is occupied by more than one of the opponent's pieces. If a piece lands on a point occupied by a single piece belonging to the opponent, the opponent's piece is removed from the board and must enter again from the leftmost point in the row where the pieces began. A piece may be borne off the board when a throw is greater than the number of points left on the board. The first player to bear all of their pieces off the board wins. END |
Construct a Ludii game based on the following description
The board is a track of any number of spaces, made in the sand. Any number of players, playing with one piece. One piece is the hyena. Four nut shells are used as dice, with the following throws: four of all the same side = 20; two of the same side = 2; any other throw = 0. The first player to reach the end of the track then plays as the hyena. The hyena moves twice the value of the throw. When the hyena overtakes a player's piece, it is removed from the board and the player loses. The game involves 8 players. The track is composed of 100 spaces
###
| (define "SetHyenaPlayer" (and (add (piece "Hyena") (to 0) stack:True) (set Var (id Mover)))) (define "HyenaPlayer" (var)) (define "SiteHyenaToMove" ("SiteToMoveOnTrack" from:(where "Hyena" Shared) (* 2 ("ThrowValue")))) (define "SiteToMove" (if (= (from) (handSite Mover)) ("SiteToMoveOnTrack" from:0 (- ("ThrowValue") 1)) ("SiteToMoveOnTrack" from:(from) ("ThrowValue")))) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" #2 #1)) (define "ThrowValue" (mapEntry "Throw" (count Pips))) (game "Nama" (players 8) (equipment { (board (rectangle 100 1) (track "Track" {0..99} directed:True)) (hand Each) (hand Shared) (piece "Marker" Each (if ("IsOffBoard" ("SiteToMove")) (move Remove (from) level:(level) (then (if ("IsOffBoard" (where "Hyena" Shared)) ("SetHyenaPlayer")))) (move (from (from) level:(level)) (to ("SiteToMove")) stack:True))) (piece "Hyena" Shared) ("StickDice" 4) (map "Throw" {(pair 0 0) (pair 1 0) (pair 2 2) (pair 3 0) (pair 4 20)})}) (rules (start (place "Marker" "Hand")) (play ("RollMove" (if (< 0 ("ThrowValue")) (if (= ("HyenaPlayer") (id Mover)) (if ("IsOffBoard" ("SiteHyenaToMove")) (move Remove (where "Hyena" Shared) (then (forEach Site (sites Board) (if (is Occupied (site)) (remove (site) count:(size Stack at:(site))))))) (move (from (where "Hyena" Shared)) (to ("SiteHyenaToMove")) (then (forEach Value min:1 max:(- (* 2 ("ThrowValue")) 1) (if (is Occupied ("SiteToMoveOnTrack" from:(last From) (value))) (remove ("SiteToMoveOnTrack" from:(last From) (value)) count:(size Stack at:("SiteToMoveOnTrack" from:(last From) (value))))))))) (or (forEach Piece) (forEach Piece container:(mover))))))) (end { (forEach Player if:(and { (> ("HyenaPlayer") 0) (!= (player) ("HyenaPlayer")) ("IsOffBoard" (where "Hyena" Shared))}) (result Player Loss)) (if (and (= (id Mover) ("HyenaPlayer")) ("IsOffBoard" (where "Hyena" Shared))) (result Mover Win)) (forEach Player if:(and (!= (player) ("HyenaPlayer")) (no Pieces of:(player))) (result Player Loss))}))) END |
What does the following global Ludii definition do?
(define "StepDiagonalToEmpty" (move Step Diagonal (to if:(is Empty (to)))))
###
| Defines a step move to all the diagonal directions to an empty site. END |
Construct a Ludii game based on the following description
A player can move a piece to any empty adjacent cell of the same color; so, on an open board, six moves are possible. Throughout the game, a player's pieces are restricted to cells of the same color.
A captured piece is immediately removed from the game.
A player captures a regular enemy piece by surrounding it on three sides.
A player captures an enemy captain by surrounding it on three sides, with the caveat that one of the surrounding pieces must be a captain. (Three regular pieces are insufficient and the enemy captain would be unaffected.)
An enemy piece on the edge of the board can be captured by surrounding it on two sides, with the caveat that one of the surrounding pieces must be a captain. (Two regular pieces are insufficient.)
If a piece (regular or captain) is moved to a cell already surrounded by three enemy pieces, it is instantly captured, unless the move itself performed a capture.
A player wins the game by reducing the opponent to two pieces.
###
| (define "PieceMove" (move Step (to if:(and (is Empty (to)) (= (phase of:(from)) (phase of:(to))))) (then (and { ("SuicideSurrounded") ("SurroundedEnemyOnOuterEdge") ("SurroundedThrall") ("SurroundedJarl")})))) (define "SuicideSurrounded" (if (not (can Move (or { ("SurroundedEnemyOnOuterEdge") ("SurroundedThrall") ("SurroundedJarl")}))) (if ("SiteSurrounded") (remove (last To))))) (define "SiteSurrounded" (= 3 (count Sites in:(intersection (sites Around (last To) Orthogonal) (sites Occupied by:Next))))) (define "SurroundedEnemyOnOuterEdge" ("Surrounded" if:(and { (is In (between) (sites Outer)) ("IsPhaseZero" (between)) ("IsEnemyAt" (between))}) with:(piece (id "Jarl" Mover)))) (define "SurroundedJarl" ("Surrounded" if:(and (or (not (is In (between) (sites Outer))) (and (is In (between) (sites Outer)) ("IsPhaseOne" (between)))) ("IsPieceAt" "Jarl" Next (between))) with:(piece (id "Jarl" Mover)))) (define "SurroundedThrall" ("Surrounded" if:(and (or (not (is In (between) (sites Outer))) (and (is In (between) (sites Outer)) ("IsPhaseOne" (between)))) ("IsPieceAt" "Thrall" Next (between))))) (define "Surrounded" (surround (from (last To)) Orthogonal (between #1 (apply (remove (between)))) (to if:("IsFriendAt" (to))) #2)) (game "Bizingo" (players 2) (equipment { (board (remove (tri 13) cells:{ 0 1 13 25 11 12 24 36 165..168})) (piece "Thrall" Each ("PieceMove")) (piece "Jarl" Each ("PieceMove"))}) (rules (start { (place "Thrall1" (sites {32..36 53..58 72 74..76 78})) (place "Jarl1" (sites {73 77})) (place "Thrall2" (sites {137..139 126..129 113..117 98 100 101 103})) (place "Jarl2" (sites {99 102}))}) (play (forEach Piece)) (end (forEach Player if:(<= (count Pieces Player) 2) (result Player Loss))))) END |
Construct a Ludii game based on the following description
2x7 board, with two stores. Seven counters in each hole. Players sow from any hole on their side of the board, in a clockwise direction, and sow into the store on their left, but not the one on the right. When the final counter of a sowing lands in an occupied hole that is not the store, the player picks up these counters and continues sowing. When then final counter lands in an empty hole, the turn ends. When the final counter lands in the store, the turn ends. Play continues until all of the counters are in the stores, and the player with the most counters in their store wins.
###
| (define "NotMoverStore" (!= (to) (mapEntry Mover))) (define "PiecesOwnedBy" (count at:(mapEntry #1))) (game "Chungcajon" (players 2) (equipment { (mancalaBoard 2 7 { (track "Track1" "7,W,WNW,ENE,E" loop:True P1) (track "Track2" "8,E,ESE,WSW,W" loop:True P2)}) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 FirstSite) (pair P2 LastSite)}) (piece "Seed" Shared)}) (rules (start (set Count 7 to:(union (sites P1) (sites P2)))) (play (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover)) if:(> (count at:(from)) 0)) (then (sow "Track" owner:(mover) if:(and (> (count at:(to)) 1) ("NotMoverStore")) apply:(moveAgain))))) (end ("MancalaByScoreWhen" (all Sites (union (sites P1) (sites P2)) if:(= 0 (count at:(site)))))))) END |
Construct a Ludii game based on the following description
Players take turns placing their pieces on one empty space on the board, with the goal of making a line with stones connected diagonally of at least length 4. The length of the line is 4 or more. The game is played on a 11x11 board. The board is a diamond tiling by hexagon. The game uses the swap rule. The first player to connect their two sides wins. The connection between two stones is using all the diagonal directions.
###
| (game "Broken Line" (players 2) (equipment { (board (hex Diamond 11)) (piece "Marker" Each)}) (rules (meta (swap)) (play (move Add (to (sites Empty)))) (end (if (is Line 4 Diagonal) (result Mover Win))))) END |
Modify the Ludii game according to the following option changes:
12 Holes per row. -> 15 Holes per row.
(define "NextHoleFrom" ("NextSiteOnTrack" 1 from:#1 #2)) (define "AHoleHasMoreThanOneCounter" (not (all Sites (forEach (sites Mover) if:(< 1 (count at:(site)))) if:(= 0 (count at:(site)))))) (define "LastHoleSowed" (sites {(var)})) (define "NoPiece" (all Sites (sites Player "Home") if:(= 0 (count at:(site))))) (define "Columns" 12) (game "Musoro Tsoro" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "Track1" "0,E,N1,W" loop:True P1) (track "Track2" "24,E,N1,W" loop:True P2)}) (regions "Home" P1 (sites Track "Track1")) (regions "Home" P2 (sites Track "Track2")) (regions "Inner" P1 (difference (sites Track "Track1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "Track2") (sites Top))) (regions "Outer" P1 (sites Bottom)) (regions "Outer" P2 (sites Top)) (piece "Seed" Shared)}) (rules (start { (place "Seed" (intersection (sites Top) (sites Left)) counts:{3} state:2) (place "Seed" (intersection (sites Bottom) (sites Right)) counts:{3} state:1) (set Count 2 to:(union (difference (sites Top) (sites Left)) (difference (sites Bottom) (sites Right))))}) (play (or (if (and (!= 0 (state at:(var))) ("SameTurn")) (move Pass)) (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover "Home")) if:(if "AHoleHasMoreThanOneCounter" (> (count at:(from)) 1) (and (= (count at:(from)) 1) (= 0 (count at:("NextHoleFrom" (from) Mover)))))) (then (and (sow "Track" owner:(mover) apply:(if (= (count at:(to)) 1) (if (is In (to) (sites Mover "Inner")) (if (> (count at:("OppositePit" (to))) 0) (and (remove ("OppositePit" (to))) (if (> (count at:("OppositeOuterPit" (to))) 0) (remove ("OppositeOuterPit" (to))))))) (and (moveAgain) (set Var (to))))) (forEach Site (sites Board) (if (!= 0 (state at:(site))) (set State at:(site) (state at:(site)))))))))) (end (forEach NonMover if:("NoPiece") (result Player Loss)))))
###
| (define "NextHoleFrom" ("NextSiteOnTrack" 1 from:#1 #2)) (define "AHoleHasMoreThanOneCounter" (not (all Sites (forEach (sites Mover) if:(< 1 (count at:(site)))) if:(= 0 (count at:(site)))))) (define "LastHoleSowed" (sites {(var)})) (define "NoPiece" (all Sites (sites Player "Home") if:(= 0 (count at:(site))))) (define "Columns" 15) (game "Musoro Tsoro" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "Track1" "0,E,N1,W" loop:True P1) (track "Track2" "30,E,N1,W" loop:True P2)}) (regions "Home" P1 (sites Track "Track1")) (regions "Home" P2 (sites Track "Track2")) (regions "Inner" P1 (difference (sites Track "Track1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "Track2") (sites Top))) (regions "Outer" P1 (sites Bottom)) (regions "Outer" P2 (sites Top)) (piece "Seed" Shared)}) (rules (start { (place "Seed" (intersection (sites Top) (sites Left)) counts:{3} state:2) (place "Seed" (intersection (sites Bottom) (sites Right)) counts:{3} state:1) (set Count 2 to:(union (difference (sites Top) (sites Left)) (difference (sites Bottom) (sites Right))))}) (play (or (if (and (!= 0 (state at:(var))) ("SameTurn")) (move Pass)) (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover "Home")) if:(if "AHoleHasMoreThanOneCounter" (> (count at:(from)) 1) (and (= (count at:(from)) 1) (= 0 (count at:("NextHoleFrom" (from) Mover)))))) (then (and (sow "Track" owner:(mover) apply:(if (= (count at:(to)) 1) (if (is In (to) (sites Mover "Inner")) (if (> (count at:("OppositePit" (to))) 0) (and (remove ("OppositePit" (to))) (if (> (count at:("OppositeOuterPit" (to))) 0) (remove ("OppositeOuterPit" (to))))))) (and (moveAgain) (set Var (to))))) (forEach Site (sites Board) (if (!= 0 (state at:(site))) (set State at:(site) (state at:(site)))))))))) (end (forEach NonMover if:("NoPiece") (result Player Loss))))) END |
Modify the Ludii game according to the following option changes:
The length of the line is 3 or more. -> The length of the line is 5 or more.
The game is played on a 10x10 board. -> The game is played on a 14x14 board.
The board is a diamond tiling by square. -> The board is a diamond tiling by triangle.
The connection between two stones is using all the orthogonal directions. -> The connection between two stones is using all the directions.
(game "Broken Line" (players 2) (equipment { (board (square Diamond 10)) (piece "Marker" Each)}) (rules (meta (swap)) (play (move Add (to (sites Empty)))) (end (if (is Line 3 Orthogonal) (result Mover Win)))))
###
| (game "Broken Line" (players 2) (equipment { (board (tri Diamond 14)) (piece "Marker" Each)}) (rules (meta (swap)) (play (move Add (to (sites Empty)))) (end (if (is Line 5 All) (result Mover Win))))) END |
Describe the mechanics of the following Ludii game
(define "MoveIn" (forEach Piece (move Select (from) (to (sites Around (from)) if:("EmptyWithEnemyIn" #1 #2)) (then (and "MoveThePiece" (directional (from #3) #4 "RemoveEnemyPiece")))) #5)) (define "MoveAgain" (then (if (can Move ("CaptureFromLast" (last To))) (moveAgain)))) (define "CaptureFromLast" (or ("MoveAgainIn" #1 (to) SameDirection (last To) ("LastDirection" Vertex)) ("MoveAgainIn" #1 (from) OppositeDirection (last From) (directions Vertex from:(last To) to:(last From))))) (define "MoveAgainIn" (move Select (from #1) (to (sites Around #1) if:("EmptyButNotVisitedWithEnemyIn" #2 #3)) (then (and { "MoveThePiece" (directional (from #4) #5 "RemoveEnemyPiece") (if (can Move (or ("CaptureAgainIn" #1 (to) SameDirection) ("CaptureAgainIn" #1 (from) OppositeDirection))) (moveAgain))})))) (define "MoveThePiece" (fromTo (from (last From)) (to (last To)))) (define "RemoveEnemyPiece" (to if:("IsEnemyAt" (to)) (apply (remove (to))))) (define "EmptyWithEnemyIn" (and (is Empty (to)) ("IsEnemyAt" (ahead #1 #2)))) (define "EmptyButNotVisitedWithEnemyIn" (and { (not (is Visited (to))) (is Empty (to)) ("IsEnemyAt" (ahead #1 #2))})) (define "CaptureAgainIn" (move Select (from #1) (to (sites Around #1) if:(and { (not (is Visited (to))) (is Empty (to)) ("IsEnemyAt" (ahead #2 #3))})))) (game "Vela" (players 2) (equipment { ("AlquerqueBoard" 5 9) (piece "Marker" Each)}) (rules (start { (place "Marker1" (union (expand (sites Bottom)) (sites {"B3" "D3" "G3" "I3"}))) (place "Marker2" (union (sites {"A3" "C3" "F3" "H3"}) (expand (sites Top))))}) phases:{ (phase "CapturingFirstPhase" (play (priority { (if (is Mover P1) (or ("MoveIn" (to) SameDirection (last To) ("LastDirection" Vertex)) ("MoveIn" (from) OppositeDirection (last From) (directions Vertex from:(last To) to:(last From))))) (forEach Piece "StepToEmpty")})) (nextPhase (<= (count Pieces P2) 5) "FanoronaPhase")) (phase "FanoronaPhase" (play (if "SameTurn" (or (if (is Occupied (last To)) ("CaptureFromLast" (last To)) ("CaptureFromLast" (last From))) (move Pass)) (priority { (or ("MoveIn" (to) SameDirection (last To) ("LastDirection" Vertex) "MoveAgain") ("MoveIn" (from) OppositeDirection (last From) (directions Vertex from:(last To) to:(last From)) "MoveAgain")) (forEach Piece "StepToEmpty")}))) (end (if (no Pieces Mover) (result Next Win))))}))
###
| 9x5 intersecting lines with diagonals in each square formed by 3x3 intersecting lines. Each player has 22 pieces, starting on the intersections of the lines except in the centre position, placed on opposite rows of the board, but alternating in the central row. Pieces move to an adjacent intersection along the lines. In the first phase of play, one player cannot capture until they have been reduced to five pieces. The opponent may only capture, according to the following rules, but only one piece at a time is captured, even when multiple would normally be allowed. When the one player is reduced to five pieces, play continues as follows. Players must capture pieces when possible. Capturing is accomplished by moving to an adjacent intersection to an opposing piece in the continuing direction of the capturing stones movement, or by moving away from an adjacent opposing pieces in such a direction. When an opponent's piece is captured, all other of the opponent's pieces in that line are also captured. Multiple captures can be made, but cannot be done by moving twice in the same direction. Multiple captures are optional. A player wins by capturing all of the other player's pieces. END |
Construct a Ludii game based on the following description
TURNS - At each turn, each player slides (vertically or horizontally) a stone into the only empty cell.
GOAL - Wins the player who made the last move.
###
| (game "Lewthwaite's Game" (players 2) (equipment { (board (square 5) use:Vertex) (piece "Ball" Each (move Slide))}) (rules (start { (place "Ball1" (sites Phase 1)) (place "Ball2" (difference (sites Phase 0) (sites Centre)))}) (play (forEach Piece)) (end ("BlockWin")))) END |
Construct a Ludii game based on the following description
4x8 board. Two counters in each hole. Opening play: Players rearrange their counters so that there are four counters in each hole of their outer row. If they play with the second array, they take turns sowing from each of the holes with four counters, beginning with the rightmost hole, placing two in the first hole and one in each of the following. Main phase: Play begins from any hole on the player's side of the board with counters in it. Singletons cannot move. Sowing happens in an anti-clockwise direction. If the last counter lands in an empty hole, the turn is over. For capturing: Holes are in 'opposition' when one player has the front row hole occupied and the opponent has both of the holes opposite it occupied. If the last hole in a sowing is in opposition, the player takes the counters in both of the opponent's holes and places them in the empty hole from which the player lifted the counters. The player then sows the captured counters from this hole. Further captures in the sowing can occur in the same way. However, each player has two hole from which clockwise plays can be made: the leftmost hole in the outer row and the second from the left in the inner row. Clockwise moves can only be made from these holes if they immediately lead to a capture. When the captured counters are sown, starting from the same hole, they can also be sown clockwise if they lead to a capture. If they cannot lead to a capture, they are sown anti-clockwise. Another alternative the player has is that, if the player plays clockwise from one of these holes and therefore makes a capture, the captured counters may be placed in the hole and left there, and the player may play instead from the other hole from which clockwise captures are allowed in a clockwise direction, if it leads to a capture. The player may continue playing from this hole as above until the possibilities to move are exhausted, and then may move from any hole in an anti-clockwise direction. Multiple captures can only be made in a clockwise direction from these holes if it is made on the first sowing of the turn. Otherwise, only one clockwise capture can be made and sowing must proceed in an anti-clockwise direction. If the last counter lands on a hole that is occupied but not in opposition, these counters are picked up and sowing continues. Play ends when one player captures all the opponent's counters or one player cannot play. The player who cannot play loses. A player may also win by capturing the counters from both of the opponent's end holes in the inner row in a single turn.
###
| (define "RightMostWithFour" (trackSite FirstSite Mover "TrackCW" from:(if (= (value Player Mover) Undefined) (mapEntry "RightMost" Mover) (value Player Mover)) if:(= 4 (count at:(to))))) (define "NextHole" ("NextSiteOnTrack" #3 from:#1 #2)) (define "OuterPhaseOppositePit" (if (is Mover P1) (+ (to) (* 3 ("Columns"))) (- (to) (* ("Columns") 3)))) (define "Columns" 8) (game "Ikibuguzo (Opening 2)" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "TrackCCW1" "0,E,N1,W" loop:True P1) (track "TrackCCW2" "16,E,N1,W" loop:True P2) (track "TrackCW1" "7,W,N1,E" loop:True P1) (track "TrackCW2" "24,E,S1,W" loop:True P2)}) (regions "Home" P1 (sites Track "TrackCCW1")) (regions "Home" P2 (sites Track "TrackCCW2")) (regions "Inner" P1 (difference (sites Track "TrackCCW1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "TrackCCW2") (sites Top))) (map "RightMost" {(pair P1 7) (pair P2 24)}) (map "LeftMostOuter" {(pair P1 0) (pair P2 31)}) (map "SecondLeftInner" {(pair P1 9) (pair P2 22)}) (piece "Seed" Shared) (hand Each)}) (rules (start (set Count 4 to:(union (sites Bottom) (sites Top)))) phases:{ (phase "FirstMove" (play (move (from ("RightMostWithFour")) (to ("NextHole" (from) "TrackCCW" 1)) count:2 (then (and { (fromTo (from (last From)) (to ("NextHole" (last From) "TrackCCW" 2)) count:1) (fromTo (from (last From)) (to ("NextHole" (last From) "TrackCCW" 3)) count:1) (set Value Mover (last From))})))) (nextPhase Mover (= (last From) (mapEntry "LeftMostOuter" Mover)) "MainPhase")) (phase "MainPhase" (play (or (move Select (from (if ("SameTurn") (sites {(var "Replay")}) (sites {(mapEntry "LeftMostOuter" Mover) (mapEntry "SecondLeftInner" Mover)})) if:(and { if:(if ("SameTurn") (< 0 (count at:(from))) (< 1 (count at:(from)))) (is In (from) (sites {(mapEntry "LeftMostOuter" Mover) (mapEntry "SecondLeftInner" Mover)})) (is In ("NextHole" (from) "TrackCW" (count at:(from))) (sites Mover "Inner")) (is Occupied ("OppositePit" ("NextHole" (from) "TrackCW" (count at:(from))))) (is Occupied ("OppositeOuterPit" ("NextHole" (from) "TrackCW" (count at:(from)))))})) (then (sow "TrackCW" owner:(mover) apply: (if (< 1 (count at:(to))) (and (moveAgain) (if (and { (is Occupied ("OppositePit" (to))) (is Occupied ("OppositeOuterPit" (to))) (is In (to) (sites Mover "Inner"))}) (and { (fromTo (from ("OppositePit" (to))) (to (last From)) count:(count at:("OppositePit" (to)))) (fromTo (from ("OppositeOuterPit" (to))) (to (last From)) count:(count at:("OppositeOuterPit" (to)))) (set Var "Replay" (from))}) (set Var "Replay" (to)))))))) (move Select (from (if ("SameTurn") (sites {(var "Replay")}) (sites Mover)) if:(if ("SameTurn") (< 0 (count at:(from))) (< 1 (count at:(from))))) (then (sow "TrackCCW" owner:(mover) apply: (if (< 1 (count at:(to))) (and (moveAgain) (if (and { (is Occupied ("OppositePit" (to))) (is Occupied ("OppositeOuterPit" (to))) (is In (to) (sites Mover "Inner"))}) (and { (fromTo (from ("OppositePit" (to))) (to (last From)) count:(count at:("OppositePit" (to)))) (fromTo (from ("OppositeOuterPit" (to))) (to (last From)) count:(count at:("OppositeOuterPit" (to)))) (set Var "Replay" (from))}) (set Var "Replay" (to)))))))))) (end ("BlockWin")))})) END |
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 "Nao Gutiya Baithaneka" (players 1) (equipment { ("StarBoard" 5) (hand Each) (piece "Marker" P1 ("HopFriendCapture"))}) (rules (start (place "Marker" (handSite P1) count:9)) (play (if (is Even (count Moves)) (move (from (handSite Mover)) (to (sites Empty)) (then (moveAgain))) (forEach Piece (if (= (from) (last To)) (move Hop (between if:(or ("IsFriendAt" (between)) (is Empty (between)))) (to if:(is Empty (to)))))))) (end { (if (and (is Even (count Moves)) ("HandEmpty" Mover)) (result Mover Win)) (if (no Moves Next) (result Mover Loss))}))) END |
Construct a Ludii game based on the following description
4x13 board. Thirteen pieces per player, arranged on the outer rows of the board. Played with six sticks which function as dice. Pieces move according to the throws of the dice. Play progresses from left to right in the player's home row, and then from right to left in the second row, left to right in the third row, and then right to left in the opponent's row. A throw of 1 is required for each piece to being moving it. When a player's piece lands on a space occupied by a piece belonging to the opponent, the opponent's piece is captured. The player who captures all of the opponent's pieces wins.
###
| (define "AllPieceInOpponentHome" (and (= (count Sites in:(difference (sites Occupied by:P1) (sites P2))) 0) (= (count Sites in:(difference (sites Occupied by:P2) (sites P1))) 0))) (define "CaptureEnemyPiece" (apply if:("IsEnemyAt" (to)) (remove (to)))) (define "InactivePiece" (= (state at:(from)) 1)) (define "ActivatedPiece" (= (state at:(from)) 0)) (define "ActivatePiece" (if (= (state at:(last To)) 1) (set State at:(last To) 0))) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" (count Pips))) (game "Sig (Tozeur)" (players 2) (equipment { (board (rectangle 4 13) { (track "Track1" "0,E,N1,W,N1,E,N1,W" P1 directed:True) (track "Track2" "51,W,S1,E,S1,W,S1,E" P2 directed:True)} use:Vertex) (piece "Stick" Each (if (or ("ActivatedPiece") (and (= (count Pips) 1) ("InactivePiece"))) (if ("IsNotOffBoard" "SiteToMoveOnTrack") (if (or (is In "SiteToMoveOnTrack" (sites Empty)) ("IsEnemyAt" "SiteToMoveOnTrack")) (move (from) (to "SiteToMoveOnTrack" "CaptureEnemyPiece"))) (then ("ActivatePiece"))))) (regions "AllSites" (sites Board)) ("StickDice" 6) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start { (place "Stick1" (sites Bottom) state:1) (place "Stick2" (sites Top) state:1)}) (play ("RollMove" (forEach Piece))) (end { ("CaptureAll" Next) (if ("AllPieceInOpponentHome") (result Mover Draw))}))) END |
Describe the mechanics of the following Ludii game
(define "StoreStateRemoved" (set Value Mover (state at:(last To)))) (define "LastStateRemove" (value Player Mover)) (game "Greater Loss" (players 2) (equipment { (board (square 4)) (piece "Disc" Each)}) (rules (start { (place "Disc1" {"A1"} state:1) (place "Disc1" {"B1"} state:2) (place "Disc1" {"C1"} state:3) (place "Disc1" {"D1"} state:4) (place "Disc1" {"A2"} state:5) (place "Disc1" {"B2"} state:6) (place "Disc1" {"C2"} state:7) (place "Disc1" {"D2"} state:8) (place "Disc2" {"A3"} state:5) (place "Disc2" {"B3"} state:6) (place "Disc2" {"C3"} state:7) (place "Disc2" {"D3"} state:8) (place "Disc2" {"A4"} state:1) (place "Disc2" {"B4"} state:2) (place "Disc2" {"C4"} state:3) (place "Disc2" {"D4"} state:4)}) (play (move Select (from (forEach (sites Occupied by:Mover) if:(> (state at:(site)) ("LastStateRemove")))) (then (and ("StoreStateRemoved") (remove (last To)))))) (end (if (= 0 (count Sites in:(forEach (sites Occupied by:Mover) if:(= 8 (state at:(site)))))) (result Mover Loss)))))
###
| Players take turns removing a piece of their colour whose number is higher than the last piece they removed (free choice of first piece). The player who removes their highest numbered piece loses. END |
Modify the Ludii game according to the following option changes:
Board & size: Hexhex with edges alternating 2 and 4 -> Board & size: Hexhex with edges alternating 6 and 8
Must place next to 1-2 friendly pieces, -> Must place next to exactly one friendly piece,
but not next to enemy pieces. -> but not next to pieces that already have more than 1 neighbor.
(define "ScoreUpdate" (if (> (* 2 (size Group at:(last To))) (score Mover)) (if (> (* 2 (size Group at:(last To))) (score Next)) (set Score Mover (+ 1 (* 2 (size Group at:(last To))))) (set Score Mover (* 2 (size Group at:(last To))))))) (define "SitesTooDense" (forEach (sites Occupied by:Mover) if:(<= 6 (count Pieces Mover in:(sites Around (site)))))) (game "RootZone" (players 2) (equipment { (board (tri {2 4 2 4 2}) use:Vertex) (piece "Disc" Each) (piece "Disc" Neutral)}) (rules (play (if (= -1 (counter)) (or (move Pass) (move Add (piece "Disc0") (to (sites Board)))) (or { (if (= 1 (counter)) (move Select (from (sites Occupied by:Enemy)) (then (remove (last To) (then (add (to (last To)))))))) (move Pass) (move Add (to (difference (union (sites Outer) (sites Around (sites Occupied by:Mover))) (union { (sites Around (sites Occupied by:Enemy)) (sites Around "SitesTooDense") (sites Around (sites Occupied by:Neutral))})) if:(and (is Empty (to)) (>= 2 (count Pieces Mover in:(sites Around (to)))))) (then "ScoreUpdate"))}))) (end (if (all Passed) (byScore)))))
###
| (define "ScoreUpdate" (if (> (* 2 (size Group at:(last To))) (score Mover)) (if (> (* 2 (size Group at:(last To))) (score Next)) (set Score Mover (+ 1 (* 2 (size Group at:(last To))))) (set Score Mover (* 2 (size Group at:(last To))))))) (define "SitesTooDense" (forEach (sites Occupied by:Mover) if:(<= 2 (count Pieces Mover in:(sites Around (site)))))) (game "RootZone" (players 2) (equipment { (board (tri {6 8 6 10 5}) use:Vertex) (piece "Disc" Each) (piece "Disc" Neutral)}) (rules (play (if (= -1 (counter)) (or (move Pass) (move Add (piece "Disc0") (to (sites Board)))) (or { (if (= 1 (counter)) (move Select (from (sites Occupied by:Enemy)) (then (remove (last To) (then (add (to (last To)))))))) (move Pass) (move Add (to (difference (union (sites Outer) (sites Around (sites Occupied by:Mover))) (union { (sites Around (sites Occupied by:Enemy)) (sites Around "SitesTooDense") (sites Around (sites Occupied by:Neutral))})) if:(and (is Empty (to)) (>= 1 (count Pieces Mover in:(sites Around (to)))))) (then "ScoreUpdate"))}))) (end (if (all Passed) (byScore))))) END |
Construct a Ludii game based on the following description
Played on an 8x8 board with a double contingent of chess pawns. Pieces move forward one orthogonally or diagonally. Pieces can capture by moving diagonally. The first player to reach the opponent's edge of the board wins. A player also can win if they capture all of the opponent's pieces. The board is tiling by square. The game is played on a 8x8 board.
###
| (game "Breakthrough" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) (piece "Pawn" Each (or { "StepForwardToEmpty" (move Step (directions {FR FL}) (to if:(or (is Empty (to)) ("IsEnemyAt" (to))) (apply (remove (to)))))})) (regions P1 (sites Top)) (regions P2 (sites Bottom))}) (rules (start { (place "Pawn1" (expand (sites Bottom))) (place "Pawn2" (expand (sites Top)))}) (play (forEach Piece)) (end ("ReachWin" (sites Mover) Mover)))) END |
Modify the Ludii game according to the following option changes:
The game has 3 players. -> The game has 4 players.
(define "MadeACompleteCircuit" (if (= 1 (value Player Mover)) (is In (value Piece at:(where "Marker" Mover)) (sites Track "TrackCW" from:("NextSite" (last From) "TrackCW") to:(last To))) (is In (value Piece at:(where "Marker" Mover)) (sites Track "TrackCCW" from:("NextSite" (last From) "TrackCCW") to:(last To))))) (define "MoveOn" (if ("IsNotOffBoard" #1) (if (or (is In #1 (sites Empty)) ("IsEnemyAt" #1)) (move (from (from) level:(level)) (to #1 ("HittingCapture" (value Piece at:(to)))))) #2)) (define "RememberSelectedTrack" (then (if ("IsOffBoard" (value Player Mover)) #1))) (define "SelectCCW" (set Value Mover 2)) (define "SelectCW" (set Value Mover 1)) (define "SiteToMoveOnTrackCCW" ("NextSiteOnTrack" ("ThrowValue") "TrackCCW")) (define "SiteToMoveOnTrackCW" ("NextSiteOnTrack" ("ThrowValue") "TrackCW")) (define "NextSite" ("NextSiteOnTrack" 1 from:#1 #2)) (define "SiteToMoveOnSelectedTrack" (if (= (value Player Mover) 2) ("NextSiteOnTrack" ("ThrowValue") "TrackCCW") ("NextSiteOnTrack" ("ThrowValue") "TrackCW"))) (define "ThrowValue" (mapEntry "ThrowDiceValue" (count Pips))) (game "Patol" (players 3) (equipment { ("FortyStonesWithFourGapsBoard" { (track "TrackCW" {39 35 33 31 29 27 25 23 21 19 38 17 15 13 11 9 7 5 3 1 37 0 2 4 6 8 10 12 14 16 36 18 20 22 24 26 28 30 32 34} loop:True) (track "TrackCCW" {39 34 32 30 28 26 24 22 20 18 36 16 14 12 10 8 6 4 2 0 37 1 3 5 7 9 11 13 15 17 38 19 21 23 25 27 29 31 33 35} loop:True)}) (regions "Gates" (sites {36..39})) (piece "Marker" Each (if ("IsOffBoard" (value Player Mover)) (or ("MoveOn" ("SiteToMoveOnTrackCW") ("RememberSelectedTrack" ("SelectCW"))) ("MoveOn" ("SiteToMoveOnTrackCCW") ("RememberSelectedTrack" ("SelectCCW")))) ("MoveOn" "SiteToMoveOnSelectedTrack"))) ("StickDice" 3) (map "ThrowDiceValue" {(pair 0 5) (pair 1 3) (pair 2 2) (pair 3 10)}) (hand Each)}) (rules (start (place "Marker" "Hand")) phases:{ (phase "Placement" (play (move (from (handSite Mover)) (to (sites "Gates")) (then (set Value at:(last To) (last To))))) (nextPhase Mover "Playing")) (phase "Playing" (play ("RollMove" (forEach Piece))) (end (if ("MadeACompleteCircuit") (result Mover Win))))}))
###
| (define "MadeACompleteCircuit" (if (= 1 (value Player Mover)) (is In (value Piece at:(where "Marker" Mover)) (sites Track "TrackCW" from:("NextSite" (last From) "TrackCW") to:(last To))) (is In (value Piece at:(where "Marker" Mover)) (sites Track "TrackCCW" from:("NextSite" (last From) "TrackCCW") to:(last To))))) (define "MoveOn" (if ("IsNotOffBoard" #1) (if (or (is In #1 (sites Empty)) ("IsEnemyAt" #1)) (move (from (from) level:(level)) (to #1 ("HittingCapture" (value Piece at:(to)))))) #2)) (define "RememberSelectedTrack" (then (if ("IsOffBoard" (value Player Mover)) #1))) (define "SelectCCW" (set Value Mover 2)) (define "SelectCW" (set Value Mover 1)) (define "SiteToMoveOnTrackCCW" ("NextSiteOnTrack" ("ThrowValue") "TrackCCW")) (define "SiteToMoveOnTrackCW" ("NextSiteOnTrack" ("ThrowValue") "TrackCW")) (define "NextSite" ("NextSiteOnTrack" 1 from:#1 #2)) (define "SiteToMoveOnSelectedTrack" (if (= (value Player Mover) 2) ("NextSiteOnTrack" ("ThrowValue") "TrackCCW") ("NextSiteOnTrack" ("ThrowValue") "TrackCW"))) (define "ThrowValue" (mapEntry "ThrowDiceValue" (count Pips))) (game "Patol" (players 4) (equipment { ("FortyStonesWithFourGapsBoard" { (track "TrackCW" {39 35 33 31 29 27 25 23 21 19 38 17 15 13 11 9 7 5 3 1 37 0 2 4 6 8 10 12 14 16 36 18 20 22 24 26 28 30 32 34} loop:True) (track "TrackCCW" {39 34 32 30 28 26 24 22 20 18 36 16 14 12 10 8 6 4 2 0 37 1 3 5 7 9 11 13 15 17 38 19 21 23 25 27 29 31 33 35} loop:True)}) (regions "Gates" (sites {36..39})) (piece "Marker" Each (if ("IsOffBoard" (value Player Mover)) (or ("MoveOn" ("SiteToMoveOnTrackCW") ("RememberSelectedTrack" ("SelectCW"))) ("MoveOn" ("SiteToMoveOnTrackCCW") ("RememberSelectedTrack" ("SelectCCW")))) ("MoveOn" "SiteToMoveOnSelectedTrack"))) ("StickDice" 3) (map "ThrowDiceValue" {(pair 0 5) (pair 1 3) (pair 2 2) (pair 3 10)}) (hand Each)}) (rules (start (place "Marker" "Hand")) phases:{ (phase "Placement" (play (move (from (handSite Mover)) (to (sites "Gates")) (then (set Value at:(last To) (last To))))) (nextPhase Mover "Playing")) (phase "Playing" (play ("RollMove" (forEach Piece))) (end (if ("MadeACompleteCircuit") (result Mover Win))))})) END |
Construct a Ludii game based on the following description
Goal: Player with the largest, most complex 'warren' wins.
A warren is the entire networks of friendly stones, that separate areas of the board (enclosures) from each other and from external areas in contact with the board edges.
-- Each distinct enclosure may contain any mixture of empty and enemy occupied sites.
-- The sites of an enclosure cannot reach any additional site or reach an edge of the board, except by crossing friendly stones or the connections between them.
The score is the product of warren complexity and free-space. The actual calculation depends on the board grid: see 'Options', below.
Play:
The player of the light stones starts by moving a single stone.
Thereafter play alternates with each play performing two stone-moves on his turn.
Each stone move is in one of the 6 grid directions, either
-- to an empty cell surrounded by more friendly stones than before, or
-- alternatively, to an empty cell surrounded by the same number of friendly stones, but fewer other neighbors.
The moving stone may travel any distance, and pass over any number of stones of either player when moving.
A player may pass part or all of his turn.
When both players successively pass their entire turns, the game ends and is scored.
The player with the higher score wins.
If the scores are the same, the last player to move, loses. Rabbit Warrens (hex 6,8). Scoring: Product of the number of distinct enclosures, times the total number of empty sites within the enclosures.
###
| (define "ColourBackground" (colour 245 245 245)) (define "RabbitMove" (forEach Piece (do (set Var "SitesMoverAroundFrom" (count Sites in:(sites Around (from) Orthogonal if:(is Mover (who at:(to)))))) next:(move Hop Adjacent (between (range 0 Infinity) if:True) (to (sites Empty) if:(is Empty (to)))) ifAfterwards:(or (< (var "SitesMoverAroundFrom") (count Sites in:(sites Around (last To) Orthogonal if:(is Mover (who at:(to)))))) (and (= (var "SitesMoverAroundFrom") (count Sites in:(sites Around (last To) Orthogonal if:(is Mover (who at:(to)))))) (> (count Sites in:(sites Around (last From) Orthogonal if:(is Next (who at:(to))))) (count Sites in:(sites Around (last To) Orthogonal if:(is Next (who at:(to)))))))) (then (and { ("GetTerritorySitesAndScore" Mover) ("GetTerritorySitesAndScore" Next) (if (is Prev Next) (moveAgain))}))))) (define "GetTerritorySitesAndScore" (and { (set Value at:(handSite #1 0) ("TC" #1)) (set Value at:(handSite #1 1) ("RCHX" #1)) (set Score #1 (* ("TC" #1) ("RCHX" #1)))})) (define "RCHX" (size Array (array (forEach (difference (sites Inner) (sites Occupied by:#1)) if:(and ("Included" #1) (= Infinity (count Steps (step Orthogonal (to if:(not (= (id #1) (who at:(to)))))) (site) (sites (results from:(site) to:(forEach (sites Inner) if:(< (from) (site))) (to)))))))))) (define "RCSQ" (+ (results from:(forEach (difference (sites Inner) (sites Occupied by:(player (id #1)))) if:(and ("Included" #1) ("IsLowestReachableSite" #1))) to:(from) (+ 1 (max (- (max ("Coordinates" #1 (column of:(to)))) (min ("Coordinates" #1 (column of:(to))))) (- (max ("Coordinates" #1 (row of:(to)))) (min ("Coordinates" #1 (row of:(to)))))))))) (define "IsLowestReachableSite" (= Infinity (count Steps (step Orthogonal (to if:(not (= (id #1) (who at:(to)))))) (site) (sites (results from:(site) to:(forEach (sites Board) if:(< (from) (site))) (to)))))) (define "Coordinates" (results from:(to) to:(forEach (sites Board) if:("IsSiteInSameTerritory" #1)) #2)) (define "IsSiteInSameTerritory" (!= Infinity (count Steps (step Orthogonal (to if:(not (= (id #1) (who at:(to)))))) (from) (site)))) (define "TC" (size Array (array (forEach (difference (sites Inner) (sites Occupied by:#1)) if:(and ("Included" #1) (is Empty (site))))))) (define "RawTerritoryOf" (forEach (difference (sites Inner) (sites Occupied by:(player (id #1)))) if:("Included" #1))) (define "Included" (= Infinity (count Steps (step Orthogonal (to if:(not (= (id #1) (who at:(to)))))) (site) (difference (sites Outer) (sites Inner))))) (game "Rabbit Warrens" (players 2) (equipment { (board (hex Hexagon 6 8) use:Cell) (hand P1 size:2) (hand P2 size:2) (piece "Ball" Each) (piece "Hex" Each) (piece "Hex" Neutral)}) (rules (start { (place "Ball1" {2 6 9 13 17 21 25 29 33 37 38 42 46 53 57 61 64 68 72 77 81 85 89 93 97 101 108 112 113 117 121 125}) (place "Ball2" {1 5 11 15 18 22 26 27 31 35 41 45 49 51 55 59 65 69 73 75 79 83 88 92 99 103 105 109 115 119 120 124}) (place "Hex1" (handSite P1 0) value:0) (place "Hex2" (handSite P2 0) value:0) (place "Hex0" (handSite P1 1) value:0) (place "Hex0" (handSite P2 1) value:0)}) (play (or (move Pass) "RabbitMove")) (end { (if (and (= (score P1) (score P2)) (all Passed)) (byScore {(score Mover 0)})) (if (all Passed) (byScore))}))) END |
Construct a Ludii game based on the following description
4x8 board. Play begins with two counters in each hole. Opening moves: Players place all of the counters in the outer row into their rightmost hole. They then take one counter from each of the holes in the inner row and redistribute them into the outer row, one in each hole. Then, each player sows counters in an anti-clockwise direction beginning from the rightmost hole in the inner row, proceeding, picking up the contents of holes when the last counter falls into an occupied hole and continuing sowing. However, the final counter that would fall into the rightmost hole in the outer row (which should now contain 17 counters) is not placed there, but rather on the second to right hole in the inner row, which should now contain one counter. Initial phase: In the initial phase, the rightmost hole in the inner and outer row for each player are out of play. All sowing and capturing only occurs on the remaining holes. Sowing occurs in an anti-clockwise direction. When the final counter of a sowing lands in an empty hole, the turn ends. When it falls into an occupied hole in the player's inner row the contents of the opponent's opposite holes in the inner and outer row are captured. These are then sown in the player's holes beginning with the hole from where the previous sowing began. If the final counter of a sowing falls into an occupied hole that cannot make a capture, then the counters in this hole are picked up and sowing continues. Second phase: The initial phase ends when a player plays from the rightmost hole in the outer row. This can be by necessity or by choice. Once this happens, that player must play in all of their holes. The opponent may remain in the initial phase after this point until they play from their rightmost hole. The same sowing and capturing rules as before. Play continues until one player can no longer move.
###
| (define "InnerToOuter" (if (is Mover P1) (- #1 ("Columns")) (+ #1 ("Columns")))) (define "Columns" 8) (game "Isolo" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "TrackCCW1" "0,E,N1,W" loop:True P1) (track "TrackCCW2" "16,E,N1,W" loop:True P2)}) (regions "Home" P1 (sites Track "TrackCCW1")) (regions "Home" P2 (sites Track "TrackCCW2")) (regions "Inner" P1 (difference (sites Track "TrackCCW1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "TrackCCW2") (sites Top))) (regions "Outer" P1 (sites Bottom)) (regions "Outer" P2 (sites Top)) (piece "Seed" Shared) (hand Each) (map "RightmostOuter" {(pair P1 7) (pair P2 24)}) (map "RightmostInner" {(pair P1 15) (pair P2 16)}) (map "SecondRightmostInner" {(pair P1 14) (pair P2 17)})}) (rules (start (set Count 2 to:(union (sites P1 "Home") (sites P2 "Home")))) phases:{ (phase "Opening1" (play (forEach Site (difference (sites Mover "Outer") (mapEntry "RightmostOuter" Mover)) (if (is Occupied (site)) (move (from (site)) (to (mapEntry "RightmostOuter" Mover)) count:(count at:(site)))))) (nextPhase Mover (all Sites (difference (sites Mover "Outer") (mapEntry "RightmostOuter" Mover)) if:(is Empty (site))) "Opening2")) (phase "Opening2" (play (forEach Site (sites Mover "Inner") (if (= 2 (count at:(site))) (move (from (site)) (to ("InnerToOuter" (site))) count:1)))) (nextPhase Mover (all Sites (sites Mover "Inner") if:(= (count at:(site)) 1)) "Opening3")) (phase "Opening3" (play (move Select (from (if ("SameTurn") ("LastHoleSowed") (sites {(mapEntry "RightmostInner" Mover)}))) (then (sow "TrackCCW" owner:(mover) apply:(if (!= (to) (mapEntry "RightmostOuter" Mover)) (moveAgain) (fromTo (from (to)) (to (mapEntry "SecondRightmostInner" Mover)) count:1)))))) (nextPhase Mover (not (is Next Mover)) "InitialSowing")) (phase "InitialSowing" (play (move Select (from (if ("SameTurn") ("LastHoleSowed") (sites Mover "Home")) if:(is Occupied (from))) (then (sow "TrackCCW" owner:(mover) apply:(if (< 1 (count at:(to))) (if (is In (to) (sites Mover "Inner")) (if (or (is Occupied ("OppositePit" (to))) (is Occupied ("OppositeOuterPit" (to)))) (and { (if (is Occupied ("OppositePit" (to))) (fromTo (from ("OppositePit" (to))) (to (last From)) count:(count at:("OppositePit" (to))))) (if (is Occupied ("OppositeOuterPit" (to))) (fromTo (from ("OppositeOuterPit" (to))) (to (last From)) count:(count at:("OppositeOuterPit" (to))))) (sow (last From) count:(+ (count at:("OppositeOuterPit" (to))) (count at:("OppositePit" (to)))) "TrackCCW" owner:(mover) skipIf:(is In (to) (sites {(mapEntry "RightmostOuter" Mover) (mapEntry "RightmostInner" Mover)})))}) (moveAgain)) (moveAgain))) skipIf:(is In (to) (sites {(mapEntry "RightmostOuter" Mover) (mapEntry "RightmostInner" Mover)})))))) (nextPhase Mover (is In (last From) (sites {(mapEntry "RightmostOuter" Mover) (mapEntry "RightmostInner" Mover)})) "InitialSowing")) (phase "Sowing" (play (move Select (from (sites Mover "Home") if:(is Occupied (from))) (then (sow "TrackCCW" owner:(mover) apply:(if (< 1 (count at:(to))) (if (is In (to) (sites Mover "Inner")) (if (or (is Occupied ("OppositePit" (to))) (is Occupied ("OppositeOuterPit" (to)))) (and { (if (is Occupied ("OppositePit" (to))) (fromTo (from ("OppositePit" (to))) (to (last From)) count:(count at:("OppositePit" (to))))) (if (is Occupied ("OppositeOuterPit" (to))) (fromTo (from ("OppositeOuterPit" (to))) (to (last From)) count:(count at:("OppositeOuterPit" (to))))) (sow (last From) count:(+ (count at:("OppositeOuterPit" (to))) (count at:("OppositePit" (to)))) "TrackCCW" owner:(mover))}) (moveAgain)) (moveAgain))))))))} (end ("ForEachPlayerNoMovesLoss")))) END |
Construct a Ludii game based on the following description
Played on a square grid. The board begins empty. One player plays as Black, the other as White. Players alternate turns placing a piece of their colour on the board; Black plays first. Passing is not allowed. After a move, all opposing pieces without liberties are captured (a stone or group of stones has no liberties if all adjacent points to that stone are occupied). Stones cannot be placed to recreate a previous position. The game ends when one player captures a number of stones equal to a winning threshold agreed upon at the start of the game. Despite not having an explicit territorial goal, this variant produces final positions quite reminiscent of standard Go. The game is played on a 9x9 board 5 captures to win.
###
| (define "RemoveSurrounded" (forEach Site (sites Occupied by:Next) (if (= (count Liberties at:(site) Orthogonal) 0) (move Remove (site) (then (addScore Mover 1)))))) (game "BlooGo" (players 2) (equipment { (board (square 9) use:Vertex) (piece "Ball" Each)}) (rules (meta (no Repeat)) (play (move Add (to (sites Empty)) (then "RemoveSurrounded"))) (end { (if (>= (score Mover) 5) (result Mover Win))}))) END |
Construct a Ludii game based on the following description
The game starts with a tile of each color touching one another. Players take turns placing tiles which must touch at least two other tiles. A player wins by either completely surrounding one or more of the opponent's tiles, or by creating a straight line of five tiles. The game uses hexagonal tiles.
###
| (define "NumTiles" 24) (game "Andantino" (players 2) (equipment { (boardless Hexagonal) (tile "Hex" Each numSides:6)}) (rules (start { (place "Hex1" (centrePoint)) (place "Hex2" (ahead (centrePoint) E))}) (play (move Add (to (sites Playable) if:(<= 2 (count Sites in:(sites Around (to) NotEmpty)))))) (end { (if (or (is Loop surround:Next) (is Line 5)) (result Mover Win)) (if (= (count Moves) (* (count Players) "NumTiles")) (result Mover Draw))}))) END |
Modify the Ludii game according to the following option changes:
The game is played on a 6x6 board -> The game is played on a 7x7 board
(game "Cross" (players 2) (equipment { (board (hex 6)) (piece "Marker" Each)}) (rules (play (move Add (to (sites Empty)))) (end { (if (is Connected {(sites Side S) (sites Side NW) (sites Side NE)}) (result Mover Win)) (if (is Connected {(sites Side N) (sites Side SW) (sites Side SE)}) (result Mover Win)) (if (is Connected {(sites Side N) (sites Side S)}) (result Mover Loss)) (if (is Connected {(sites Side NW) (sites Side SE)}) (result Mover Loss)) (if (is Connected {(sites Side NE) (sites Side SW)}) (result Mover Loss))})))
###
| (game "Cross" (players 2) (equipment { (board (hex 7)) (piece "Marker" Each)}) (rules (play (move Add (to (sites Empty)))) (end { (if (is Connected {(sites Side S) (sites Side NW) (sites Side NE)}) (result Mover Win)) (if (is Connected {(sites Side N) (sites Side SW) (sites Side SE)}) (result Mover Win)) (if (is Connected {(sites Side N) (sites Side S)}) (result Mover Loss)) (if (is Connected {(sites Side NW) (sites Side SE)}) (result Mover Loss)) (if (is Connected {(sites Side NE) (sites Side SW)}) (result Mover Loss))}))) END |
Construct a Ludii game based on the following description
2x8 board. Four counters in each hole. Play begins with both players placing all of the counters in the rightmost three holes in their row into the rightmost hole. Counters are sown in an anti-clockwise fashion, but they can be sown clockwise only if it leads to a capture. Counters are captured when the final counter is sown into a hole opposite a hole containing one or three counters, and those are take. If the hole opposite the next hole also contains one or three, these are also taken, continuing until a hole with any other number of counters is reached. Instead of taking counters from one of their holes, a player may sow any or all of the counters they have captured, beginning from the leftmost hole. The same rules for sowing apply. The game ends when one player has no counters in their holes.
###
| (define "NoPiecesInPlayerSide" (all Sites (sites #1) if:(= 0 (count at:(site))))) (define "NextHoleFrom" ("NextSiteOnTrack" #3 from:#1 #2)) (define "Columns" 8) (game "Iyogh" (players 2) (equipment { (mancalaBoard 2 "Columns" store:None { (track "TrackCCW" "0,E,N,W" loop:True) (track "TrackCW" "7,W,N,E" loop:True)}) (piece "Seed" Shared) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (hand Each) (map "LeftMost" {(pair P1 0) (pair P2 15)}) (map "RightMost" {(pair P1 7) (pair P2 8)}) (regions "RightMost" P1 (sites {5 6})) (regions "RightMost" P2 (sites {9 10}))}) (rules (start (set Count 4 to:(sites Track))) phases:{ (phase "Opening" (play (move (from (sites Mover "RightMost") if:(is Occupied (from))) (to (mapEntry "RightMost" Mover)) count:(count at:(from)))) (nextPhase Mover (all Sites (sites Mover "RightMost") if:(is Empty (site))) "Sowing")) (phase "Sowing" (play (or { (if (is Occupied Cell (handSite Mover)) (forEach Value min:1 max:(count Cell at:(handSite Mover)) (do (set Var "NumToSow" (value)) next:(move (from Cell (handSite Mover)) (to (mapEntry "LeftMost" Mover)) count:(value) (then (and (sow count:(var "NumToSow") "TrackCCW" if:(or (= 1 (count at:("OppositePitTwoRows" (to)))) (= 3 (count at:("OppositePitTwoRows" (to))))) apply:(if (or (= 1 (count at:("OppositePitTwoRows" (to)))) (= 3 (count at:("OppositePitTwoRows" (to))))) (fromTo (from ("OppositePitTwoRows" (to))) (to (handSite Mover)) count:(count at:("OppositePitTwoRows" (to))))) forward:True) (set Var "NumToSow" 0))))))) (if (is Occupied Cell (handSite Mover)) (forEach Value min:1 max:(count Cell at:(handSite Mover)) (do (set Var "NumToSow" (value)) next:(move (from Cell (handSite Mover) if:(or (= 1 (count at:("OppositePitTwoRows" ("NextHoleFrom" (mapEntry "LeftMost" Mover) "TrackCW" (value))))) (= 3 (count at:("OppositePitTwoRows" ("NextHoleFrom" (mapEntry "LeftMost" Mover) "TrackCW" (value))))))) (to (mapEntry "LeftMost" Mover)) count:(value) (then (and (sow count:(var "NumToSow") "TrackCW" if:(or (= 1 (count at:("OppositePitTwoRows" (to)))) (= 3 (count at:("OppositePitTwoRows" (to))))) apply:(if (or (= 1 (count at:("OppositePitTwoRows" (to)))) (= 3 (count at:("OppositePitTwoRows" (to))))) (fromTo (from ("OppositePitTwoRows" (to))) (to (handSite Mover)) count:(count at:("OppositePitTwoRows" (to))))) forward:True) (set Var "NumToSow" 0))))))) (move Select (from (sites Mover) if:(< 0 (count at:(from)))) (then (sow "TrackCCW" if:(or (= 1 (count at:("OppositePitTwoRows" (to)))) (= 3 (count at:("OppositePitTwoRows" (to))))) apply:(if (or (= 1 (count at:("OppositePitTwoRows" (to)))) (= 3 (count at:("OppositePitTwoRows" (to))))) (fromTo (from ("OppositePitTwoRows" (to))) (to (handSite Mover)) count:(count at:("OppositePitTwoRows" (to))))) forward:True))) (move Select (from (sites Mover) if:(and (< 0 (count at:(from))) (or (= 1 (count at:("OppositePitTwoRows" ("NextHoleFrom" (from) "TrackCW" (count at:(from)))))) (= 3 (count at:("OppositePitTwoRows" ("NextHoleFrom" (from) "TrackCW" (count at:(from))))))))) (then (sow "TrackCW" if:(or (= 1 (count at:("OppositePitTwoRows" (to)))) (= 3 (count at:("OppositePitTwoRows" (to))))) apply:(if (or (= 1 (count at:("OppositePitTwoRows" (to)))) (= 3 (count at:("OppositePitTwoRows" (to))))) (fromTo (from ("OppositePitTwoRows" (to))) (to (handSite Mover)) count:(count at:("OppositePitTwoRows" (to))))) forward:True)))})))} (end (forEach Player if:("NoPiecesInPlayerSide" Player) (result Player Loss))))) END |
Describe the mechanics of the following Ludii game
(define "OpponentHas" (> (min (count Sites in:(if (< 0 (count Sites in:(intersection (sites Occupied by:Mover) (sites Direction from:(to) #1 stop:(= (mover) (who at:(to))) stopIncluded:True)))) (sites Direction from:(to) #1 stop:(= (mover) (who at:(to)))) (sites Board))) (count Sites in:(if (< 0 (count Sites in:(intersection (sites Occupied by:Mover) (sites Direction from:(to) #2 stop:(= (mover) (who at:(to))) stopIncluded:True)))) (sites Direction from:(to) #2 stop:(= (mover) (who at:(to)))) (sites Board)))) (min (count Sites in:(if (< 0 (count Sites in:(intersection (sites Occupied by:Next) (sites Direction from:(to) #1 stop:(= (next) (who at:(to))) stopIncluded:True)))) (sites Direction from:(to) #1 stop:(= (next) (who at:(to)))) (sites Board))) (count Sites in:(if (< 0 (count Sites in:(intersection (sites Occupied by:Next) (sites Direction from:(to) #2 stop:(= (next) (who at:(to))) stopIncluded:True)))) (sites Direction from:(to) #2 stop:(= (next) (who at:(to)))) (sites Board)))))) (define "Placeable" (not (or { (and ("OpponentHas" E W) ("OpponentHas" NNW SSE)) (and ("OpponentHas" E W) ("OpponentHas" NNE SSW)) (and ("OpponentHas" NNW SSE) ("OpponentHas" NNE SSW))}))) (game "Mity" (players 2) (equipment { (board (hex 5)) (piece "Disc" Each)}) (rules (meta (swap)) (play (move Add (to (sites Empty) if:("Placeable")))) (end ("BlockWin"))))
###
| Players place one token of their color each turn and the first player unable to do so has lost. You may place on any empty cell unless your opponent has a token closer to that cell than you have along at least 2 of the 3 lines (axes) the cell is on.
The game uses the pie rule: One player chooses the first move and the other player chooses whose move it is. A size 5 board is currently selected END |
Construct a Ludii game based on the following description
8x8 Draughts board. Twelve pieces per player, arranged on the three rows closest to the players. Players alternate turns moving a piece forward diagonally to an adjacent empty space. Pieces capture an opponent's piece by hopping over it to an empty space on the opposite side of it, in a forward direction only. Captures are mandatory, and the maximum number of captures is required. Kings are made when a piece reaches the opposite edge of the board from where it started. Kings may move one space diagonally in either direction, and capture rules are the same as for pieces, except when different capturing routes are available with the same number of captures, the one which takes the most kings must be taken. In addition, if a sequence of captures can be made by a king or a regular piece, it must be made with the king. Kings cannot be captured by regular pieces. When a piece does not capture the maximum number of captures and the opponent catches it, the opponent captures the opponent's piece. The first player to capture all of the opponent's pieces wins.
###
| (define "IsUnpromoted" ("IsPieceAt" "Counter" Mover (last To))) (game "Dama (Italy)" (players 2) ("DraughtsEquipment" (square 8)) (rules ("BlackCellsSetup" 3) (play (if "SameTurn" (if "IsUnpromoted" (max Moves ("HopOnlyCounters" (from (last To)) (directions {FR FL}) (then ("PromoteIfReach" (sites Next) "DoubleCounter" ("ReplayIfCanMove" ("HopOnlyCounters" (from (last To)) (directions {FR FL}))))))) (max Moves ("HopDiagonalSequenceCaptureAgain"))) (priority { (max Moves (priority { (forEach Piece "DoubleCounter" ("HopDiagonalSequenceCapture")) (forEach Piece "Counter" ("HopOnlyCounters" (from) (directions {FR FL}) (then ("PromoteIfReach" (sites Next) "DoubleCounter" ("ReplayIfCanMove" ("HopOnlyCounters" (from (last To)) (directions {FR FL})))))))})) (or (forEach Piece "Counter" ("StepToEmpty" (directions {FR FL})) (then ("PromoteIfReach" (sites Next) "DoubleCounter"))) (forEach Piece "DoubleCounter" "StepDiagonalToEmpty"))}))) (end ("BlockWin")))) END |
Modify the Ludii game according to the following option changes:
The game starts with 15 geese. -> The game starts with 17 geese.
(game "Fox and Geese" (players 2) (equipment { ("CrossBoard" 3 7 use:Vertex diagonals:Alternating) (hand P1) (piece "Fox" P1 (or ("HopCapture") "StepToEmpty")) (piece "Goose" P2 "StepToEmpty")}) (rules (start { (place "Goose2" (union {(expand (sites Bottom)) (sites Row 2) (sites {"A4" "G4"})})) (place "Fox1" (handSite P1))}) phases:{ (phase "Placement" P1 (play (move (from (handSite P1)) (to (sites Empty)))) (nextPhase ("HandEmpty" P1) "Movement")) (phase "Movement" (play (forEach Piece)))} (end ("NoMovesLossAndNoPiecesPlayerLoss" P2))))
###
| (game "Fox and Geese" (players 2) (equipment { ("CrossBoard" 3 7 use:Vertex diagonals:Alternating) (hand P1) (piece "Fox" P1 (or ("HopCapture") "StepToEmpty")) (piece "Goose" P2 "StepToEmpty")}) (rules (start { (place "Goose2" (union {(expand (sites Bottom)) (sites Row 2) (sites {"A4" "G4" "A5" "G5"})})) (place "Fox1" (handSite P1))}) phases:{ (phase "Placement" P1 (play (move (from (handSite P1)) (to (sites Empty)))) (nextPhase ("HandEmpty" P1) "Movement")) (phase "Movement" (play (forEach Piece)))} (end ("NoMovesLossAndNoPiecesPlayerLoss" P2)))) END |
Construct a Ludii game based on the following description
Five rows of five holes. Each player has twelve sticks; one player's sticks are longer than the other player's. Players alternate turns placing one of their sticks in an empty hole on the board. A player may, on their turn, move a stick to an empty adjacent hole in an orthogonal direction instead of placing a stick. Players do not have to place all of their sticks before moving, but if they wish to place a stick after they have already moved, the opponent must also place a stick on their following turn. A player captures an opponent's stick by hopping over it in an orthogonal direction to an empty hole immediately on the opposite side of the opponent's stick. The player who captures all of the opponent's pieces wins.
###
| (game "Choko" (players 2) (equipment { (board (square 5) use:Vertex) (piece "Stick" Each (or "StepOrthogonalToEmpty" "HopOrthogonalCapture")) (hand Each) (regions "AllSites" (sites Board))}) (rules (start (place "Stick" "Hand" count:12)) (play (if (is Pending) (move (from (handSite Mover)) (to (sites Empty))) (or (if ("HandOccupied" Mover) (move (from (handSite Mover)) (to (sites Empty)) (then (set Pending)))) (forEach Piece)))) (end ("CaptureAll" Next)))) END |
Construct a global Ludii definition which fulfills the following requirements.
Defines the most popular backgammon tracks in using the hands of the players.
###
| (define "BackgammonTracksWithHands" { (track "Track1" {26 12..7 5..0 13..18 20..25 #1} P1 directed:True) (track "Track2" {27 25..20 18..13 0..5 7..12 #1} P2 directed:True)}) END |
Modify the Ludii game according to the following option changes:
FairKalah board 2 -> FairKalah board 3
(define "PiecesOwnedBy" (+ (count at:(mapEntry #1)) (count in:(sites #1)))) (define "Columns" 6) (game "FairKalah" (players 2) (equipment { (mancalaBoard 2 "Columns" (track "Track" "0,ESE,E,ENE,WNW,N,W" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 LastSite) (pair P2 FirstSite)}) (piece "Seed" Shared)}) (rules (start { (set Count 4 at:1) (set Count 4 at:2) (set Count 5 at:3) (set Count 4 at:4) (set Count 4 at:5) (set Count 4 at:6) (set Count 0 at:13) (set Count 4 at:12) (set Count 3 at:11) (set Count 4 at:10) (set Count 4 at:9) (set Count 4 at:8) (set Count 4 at:7) (set Count 0 at:0)}) (play (move Select (from (sites Mover) if:(> (count at:(from)) 0)) (then (sow apply:(if (= (to) (mapEntry (mover))) (moveAgain) (if (and { (is In (to) (sites Mover)) (= (count at:(to)) 1) (>= (count at:("OppositePit" (to))) 0)}) (and (fromTo (from (to)) (to (mapEntry (mover))) count:(count at:(to))) (fromTo (from ("OppositePit" (to))) (to (mapEntry (mover))) count:(count at:("OppositePit" (to))))))) skipIf:(= (to) (mapEntry (next))))))) (end ("MancalaByScoreWhen" (or (= (count in:(sites Bottom)) 0) (= (count in:(sites Top)) 0))))))
###
| (define "PiecesOwnedBy" (+ (count at:(mapEntry #1)) (count in:(sites #1)))) (define "Columns" 6) (game "FairKalah" (players 2) (equipment { (mancalaBoard 2 "Columns" (track "Track" "0,ESE,E,ENE,WNW,N,W" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 LastSite) (pair P2 FirstSite)}) (piece "Seed" Shared)}) (rules (start { (set Count 4 at:1) (set Count 5 at:2) (set Count 4 at:3) (set Count 4 at:4) (set Count 4 at:5) (set Count 4 at:6) (set Count 0 at:13) (set Count 4 at:12) (set Count 4 at:11) (set Count 3 at:10) (set Count 4 at:9) (set Count 4 at:8) (set Count 4 at:7) (set Count 0 at:0)}) (play (move Select (from (sites Mover) if:(> (count at:(from)) 0)) (then (sow apply:(if (= (to) (mapEntry (mover))) (moveAgain) (if (and { (is In (to) (sites Mover)) (= (count at:(to)) 1) (>= (count at:("OppositePit" (to))) 0)}) (and (fromTo (from (to)) (to (mapEntry (mover))) count:(count at:(to))) (fromTo (from ("OppositePit" (to))) (to (mapEntry (mover))) count:(count at:("OppositePit" (to))))))) skipIf:(= (to) (mapEntry (next))))))) (end ("MancalaByScoreWhen" (or (= (count in:(sites Bottom)) 0) (= (count in:(sites Top)) 0)))))) END |
Construct a global Ludii definition which fulfills the following requirements.
Defines the original Lasca board.
###
| (define "LascaBoard" (board ("LascaGraph") use:Vertex)) END |
Construct a Ludii game based on the following description
4x22 board. 22 pieces per player, four kings and eighteen regular pieces. Kings have no difference in movement or power than regular pieces. Moves are determined by four two-sided sticks, black on one side and white on the other. The moves are determined by the number of white sides that land face up: 1= a move of 1. A throw of 1 is known as \
###
| (define "Move" (if (and { (if ("PieceActivated" (from)) True ("Tab")) #1}) (if (is In (from) (sites Mover "Home")) (if (not ("IsFriendAt" ("NextSiteOnTrack" ("ThrowValue") "Track"))) (move (from) (to ("NextSiteOnTrack" ("ThrowValue") "Track") "CaptureEnemyPiece") (then (if (and (not ("PieceActivated" (last To))) (= 1 ("ThrowValue"))) ("ActivatePiece" (last To)))))) (if (not ("IsFriendAt" ("NextSiteOnTrack" ("ThrowValue") "MiddleTrack"))) (move (from) (to ("NextSiteOnTrack" ("ThrowValue") "MiddleTrack") "CaptureEnemyPiece")))))) (define "CountOwnPiecesInHome" (count Pieces Mover in:(sites Mover "Home"))) (define "Tab" (= 1 ("ThrowValue"))) (define "PieceActivated" (!= 0 (state at:#1))) (define "ActivatePiece" (set State at:#1 1)) (define "CaptureEnemyPiece" (apply if:("IsEnemyAt" (to)) (remove (to)))) (define "SpecialThrows" (is In ("ThrowValue") (sites {1 4 6}))) (define "ThrowValue" (mapEntry "Throw" (count Pips))) (game "Kioz" (players 2) (equipment { (board (rectangle 4 22) { (track "Track1" "0,E,N1,W," P1 directed:True) (track "Track2" "87,W,S1,E" P2 directed:True) (track "MiddleTrack" "44,E,S1,W" loop:True)}) ("StickDice" 4) (piece "Marker" Each) (piece "King" Each) (map "Throw" {(pair 0 4) (pair 1 1) (pair 2 2) (pair 3 2) (pair 4 6)}) (regions "Home" P1 (sites Bottom)) (regions "Home" P2 (sites Top))}) (rules (start { (place "Marker1" (intersection (sites Bottom) (expand (sites Left) steps:17))) (place "King1" (intersection (sites Bottom) (expand (sites Right) steps:3))) (place "Marker2" (intersection (sites Top) (expand (sites Right) steps:17))) (place "King2" (intersection (sites Top) (expand (sites Left) steps:3)))}) (play ("RollMove" (if ("Tab") (priority { (forEach Piece ("Move" (not ("PieceActivated" (from))))) (forEach Piece ("Move"))}) (forEach Piece ("Move"))) (then (if ("SpecialThrows") (moveAgain))))) (end ("CaptureAll" Next)))) END |
Modify the Ludii game according to the following option changes:
The game is played on a 3x3 board -> The game is played on a 5x5 board
(define "MoveIn" (forEach Piece (move Select (from) (to (sites Around (from)) if:("EmptyWithEnemyIn" #1 #2)) (then (and "MoveThePiece" (directional (from #3) #4 "RemoveEnemyPiece")))) (then (if (can Move ("CaptureFromLast" (last To))) (moveAgain))))) (define "CaptureFromLast" (or ("MoveAgainIn" #1 (to) SameDirection (last To) ("LastDirection" Vertex)) ("MoveAgainIn" #1 (from) OppositeDirection (last From) (directions Vertex from:(last To) to:(last From))))) (define "MoveAgainIn" (move Select (from #1) (to (sites Around #1) if:("EmptyButNotVisitedWithEnemyIn" #2 #3)) (then (and { "MoveThePiece" (directional (from #4) #5 "RemoveEnemyPiece") (if (can Move (or ("CaptureAgainIn" #1 (to) SameDirection) ("CaptureAgainIn" #1 (from) OppositeDirection))) (moveAgain))})))) (define "MoveThePiece" (fromTo (from (last From)) (to (last To)))) (define "RemoveEnemyPiece" (to if:("IsEnemyAt" (to)) (apply (remove (to))))) (define "EmptyWithEnemyIn" (and (is Empty (to)) ("IsEnemyAt" (ahead #1 #2)))) (define "EmptyButNotVisitedWithEnemyIn" (and { (not (is Visited (to))) (is Empty (to)) ("IsEnemyAt" (ahead #1 #2))})) (define "CaptureAgainIn" (move Select (from #1) (to (sites Around #1) if:(and { (not (is Visited (to))) (is Empty (to)) ("IsEnemyAt" (ahead #2 #3))})))) (game "Fanorona" (players 2) (equipment { ("AlquerqueBoard" 3 3) (piece "Marker" Each)}) (rules (start { (place "Marker1" (union { (union (sites Bottom) (sites {"C2"}))})) (place "Marker2" (union { (union (sites {"A2"}) (sites Top))}))}) (play (if "SameTurn" (or (if (is Occupied (last To)) ("CaptureFromLast" (last To)) ("CaptureFromLast" (last From))) (move Pass)) (priority { (or ("MoveIn" (to) SameDirection (last To) ("LastDirection" Vertex)) ("MoveIn" (from) OppositeDirection (last From) (directions Vertex from:(last To) to:(last From)))) (forEach Piece "StepToEmpty")}))) (end (if (no Pieces Mover) (result Next Win)))))
###
| (define "MoveIn" (forEach Piece (move Select (from) (to (sites Around (from)) if:("EmptyWithEnemyIn" #1 #2)) (then (and "MoveThePiece" (directional (from #3) #4 "RemoveEnemyPiece")))) (then (if (can Move ("CaptureFromLast" (last To))) (moveAgain))))) (define "CaptureFromLast" (or ("MoveAgainIn" #1 (to) SameDirection (last To) ("LastDirection" Vertex)) ("MoveAgainIn" #1 (from) OppositeDirection (last From) (directions Vertex from:(last To) to:(last From))))) (define "MoveAgainIn" (move Select (from #1) (to (sites Around #1) if:("EmptyButNotVisitedWithEnemyIn" #2 #3)) (then (and { "MoveThePiece" (directional (from #4) #5 "RemoveEnemyPiece") (if (can Move (or ("CaptureAgainIn" #1 (to) SameDirection) ("CaptureAgainIn" #1 (from) OppositeDirection))) (moveAgain))})))) (define "MoveThePiece" (fromTo (from (last From)) (to (last To)))) (define "RemoveEnemyPiece" (to if:("IsEnemyAt" (to)) (apply (remove (to))))) (define "EmptyWithEnemyIn" (and (is Empty (to)) ("IsEnemyAt" (ahead #1 #2)))) (define "EmptyButNotVisitedWithEnemyIn" (and { (not (is Visited (to))) (is Empty (to)) ("IsEnemyAt" (ahead #1 #2))})) (define "CaptureAgainIn" (move Select (from #1) (to (sites Around #1) if:(and { (not (is Visited (to))) (is Empty (to)) ("IsEnemyAt" (ahead #2 #3))})))) (game "Fanorona" (players 2) (equipment { ("AlquerqueBoard" 5 5) (piece "Marker" Each)}) (rules (start { (place "Marker1" (union { (union (expand (sites Bottom)) (sites {"A3" "D3"}))})) (place "Marker2" (union { (union (sites {"B3" "E3"}) (expand (sites Top)))}))}) (play (if "SameTurn" (or (if (is Occupied (last To)) ("CaptureFromLast" (last To)) ("CaptureFromLast" (last From))) (move Pass)) (priority { (or ("MoveIn" (to) SameDirection (last To) ("LastDirection" Vertex)) ("MoveIn" (from) OppositeDirection (last From) (directions Vertex from:(last To) to:(last From)))) (forEach Piece "StepToEmpty")}))) (end (if (no Pieces Mover) (result Next Win))))) END |
Construct a Ludii game based on the following description
Starting with white, each player places a marble on an empty space or platform (2x2 arrangement of marbles). The first player making a full line of his color on any layer wins. Lines may be diagonal. This is, for a 4x4 set, a 4-in-a-row on the first layer, or a 3-in-a-row on the 2nd layer, or a 2-in-a-row on the 3rd layer. The game is played with two players. The game is played on a 4x4 board.
###
| (game "Spline" (players 2) (equipment { (board (square 4 pyramidal:True) use:Vertex) (piece "Ball" Each)}) (rules (play (move Add (to (sites Empty) if:(is Flat)))) (end (if (is Line (- (count Rows) (layer of:(last To))) SameLayer) (result Mover Win))))) END |
Construct a Ludii game based on the following description
Each player has 6 Chess queens. It is played on a 5x5 board. The starting position has the queens arranged on opposite sides, alternating white-black-white-black in each space. The pieces move as queens in Chess. The first player to line up four queens in a row wins.
###
| (game "All Queens Chess" (players 2) (equipment { (board (square 5)) (piece "Queen" Each (move Slide))}) (rules (start { (place "Queen1" (union { (difference (sites Bottom) (sites Phase 1)) (intersection (sites Left) (sites Row (/ (count Rows) 2))) (difference (sites Top) (sites Phase 0))})) (place "Queen2" (union { (difference (sites Bottom) (sites Phase 0)) (intersection (sites Right) (sites Row (/ (count Rows) 2))) (difference (sites Top) (sites Phase 1))}))}) (play (forEach Piece)) (end (if (is Line 4) (result Mover Win))))) END |
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 6 points, they may start removing pieces from the board. They can do so by rolling a 6 to move from the 6th point, and so on down to 1. Players must use all available moves presented by the dice. The first player to remove all of their pieces wins. The winner gains one point, or two points if the opponent has pieces in their starting quadrant.
###
| (define "HaveAPieceAndCanEscape" (and ("IsFriendAt" (site)) (< (trackSite Move from:(site) steps:(pips)) 0))) (define "SetScoreOf" (score #1 (if (is Mover #1) (if (= ("NumPiece" #2) 15) 2 1) 0))) (define "NotEmptyAndNotOffTheBoard" (and (is Occupied (site)) ("IsNotOffBoard" ("NextSiteFrom" (site))))) (define "CanEscape" ("IsEndTrack" ("NextSiteFrom" (site)))) (define "NumPiece" (size Stack in:(sites Occupied by:#1))) (define "AllPieceEscaped" (no Pieces Mover)) (define "MoveAPieceIf" (forEach Die replayDouble:True if:#1 ("MoveAPiece" #2))) (define "MoveAPiece" (move (from #1) (to ("NextSiteFrom" #1) if:("NoEnemyOrOnlyOne" (to)) ("HittingCapture" (mapEntry Next))))) (define "DieNotUsedAndNoEscapeAndNotOffTheTrack" (and { ("DieNotUsed") ("IsNotOffBoard" ("NextSiteFrom" (from))) ("IsNotEndTrack" ("NextSiteFrom" (from)))})) (define "RemoveAPiece" (move Remove (site))) (define "AllPieceInHome" ("AllOwnedPiecesIn" (sites Mover))) (define "Bar" (mapEntry (mover))) (define "NextSiteFrom" ("NextSiteOnTrack" (pips) from:#1)) (define "BarEmpty" (is Empty "Bar")) (game "Portes" (players 2) (equipment { ("BackgammonBoard" ("BackgammonTracksWithBar" End)) (dice num:2) (regions P1 { 20..25}) (regions P2 { 7..12}) (map {(pair 1 6) (pair 2 19)}) (piece "Disc" Each ("MoveAPieceIf" "DieNotUsedAndNoEscapeAndNotOffTheTrack" (from)))}) (rules (start { (place Stack "Disc1" 0 count:5) (place Stack "Disc1" 12 count:2) (place Stack "Disc1" 17 count:3) (place Stack "Disc1" 20 count:5) (place Stack "Disc2" 4 count:3) (place Stack "Disc2" 7 count:5) (place Stack "Disc2" 13 count:5) (place Stack "Disc2" 25 count:2)}) (play ("RollEachNewTurnMove" (if "AllPieceInHome" (forEach Die replayDouble:True if:("DieNotUsed") (forEach Site (sites Occupied by:Mover) (if ("NotEmptyAndNotOffTheBoard") (if ("CanEscape") ("RemoveAPiece") ("MoveAPiece" (site)))) noMoveYet:(firstMoveOnTrack "Track" Mover (if "HaveAPieceAndCanEscape" "RemoveAPiece")) (then ("ReplayNotAllDiceUsed")))) (max Distance "Track" Mover (if "BarEmpty" (forEach Piece top:True) ("MoveAPieceIf" ("DieNotUsed") ("Bar")) (then (if (not (all DiceUsed)) (if (can Move (if "BarEmpty" (forEach Piece top:True) ("MoveAPieceIf" ("DieNotUsed") ("Bar")))) (moveAgain))))))))) (end (if ("AllPieceEscaped") (byScore { ("SetScoreOf" P1 P2) ("SetScoreOf" P2 P1)}))))) END |
Describe the mechanics of the following Ludii game
(game "Dodo" ("TwoPlayersNorthSouth") (equipment { (board (rotate 30 (hex 4))) (piece "Disc" Each ("StepToEmpty" Forwards))}) (rules (start { (place "Disc1" {0 1 2 3 4 5 6 7 9 10 11 15 16}) (place "Disc2" {20 21 25 26 27 29 30 31 32 33 34 35 36})}) (play (forEach Piece)) (end ("MisereBlockWin"))))
###
| On your turn you move one of your pieces one step onto an empty cell in one of the three forwards directions. Black's pieces move towards the bottom of the board, while White's pieces move towards the top. If, at the beginning of your turn, none of your pieces can move, you win. END |
Construct a global Ludii definition which fulfills the following requirements.
Defines starting rules placing one piece on each site before and after the centre (e.g. Starting rules of Zamma).
###
| (define "BeforeAfterCentreSetup" (start { (place #1 (forEach (sites Board) if:(< (site) (centrePoint)))) (place #2 (forEach (sites Board) if:(> (site) (centrePoint))))})) END |
Construct a Ludii game based on the following description
2x4 board. Six counters per hole. Sowing occurs in a clockwise direction from the left half of a player's row, and anti-clockwise when played from the player's right half of the row. The first seed of sowing is placed in the hole from which the sowing began. When the final counter of a sowing falls into an occupied hole, and it now contains an even number of counters, these are captured, provided the contents of that hole have already been moved. Should the following hole also contain an even number of counters, these are also captured, as well as the next one, until there is a hole with an odd number of counters. If a player cannot move, they must pass until the opponent plays in such a way that they may play. If neither player is able to move, they both capture the counters in their rows. Players then count their counters by placing them six per hole. The player who has more counters than necessary to fill their holes places them aside for use in successive rounds. The player who is unable to fill a hole with six counters leaves it empty, also placing the extra counters aside for later use. This hole is not to be sown into. The player chooses which hole to leave empty. Subsequent rounds continue until one player cannot fill a hole with six counters. The board has 4 columns.
###
| (define "Move" (or { (move Select (from (sites Mover "LeftSide") if:(> (count at:(from)) 1)) (then (and (remember Value "HolesSowed" (last To)) (sow "TrackCW" apply:(if (and (is In (to) (values Remembered "HolesSowed")) (is Even (count at:(to)))) ("CaptureMove" "TrackCW")) origin:True)))) (move Select (from (sites Mover "RightSide") if:(> (count at:(from)) 1)) (then (and (remember Value "HolesSowed" (last To)) (sow "TrackCCW" apply:(if (and (is In (to) (values Remembered "HolesSowed")) (is Even (count at:(to)))) ("CaptureMove" "TrackCCW")) origin:True))))})) (define "CaptureMove" (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to)) (then (if (is Even (count at:("NextHole" (last From) #1 1))) (and (fromTo (from ("NextHole" (last From) #1 1)) (to (handSite Mover)) count:(count at:("NextHole" (last From) #1 1))) (if (is Even (count at:("NextHole" (last From) #1 2))) (and (fromTo (from ("NextHole" (last From) #1 2)) (to (handSite Mover)) count:(count at:("NextHole" (last From) #1 2))) (if (is Even (count at:("NextHole" (last From) #1 3))) (and (fromTo (from ("NextHole" (last From) #1 3)) (to (handSite Mover)) count:(count at:("NextHole" (last From) #1 3))) (if (is Even (count at:("NextHole" (last From) #1 4))) (and (fromTo (from ("NextHole" (last From) #1 4)) (to (handSite Mover)) count:(count at:("NextHole" (last From) #1 4))) (if (is Even (count at:("NextHole" (last From) #1 5))) (and (fromTo (from ("NextHole" (last From) #1 5)) (to (handSite Mover)) count:(count at:("NextHole" (last From) #1 5))) (if (is Even (count at:("NextHole" (last From) #1 6))) (fromTo (from ("NextHole" (last From) #1 6)) (to (handSite Mover)) count:(count at:("NextHole" (last From) #1 6))))))))))))))))) (define "PiecesOwnedBy" (+ (count Cell at:(handSite #1)) (count in:(sites #1 "Home")))) (define "NextHole" ("NextSiteOnTrack" #3 from:#1 #2)) (define "Column" 4) (game "Bechi" (players 2) (equipment { (mancalaBoard 2 ("Column") store:None { (track "TrackCW" "3,W,N,E" loop:True) (track "TrackCCW" "0,E,N,W" loop:True)}) (regions "Home" P1 (sites Bottom)) (regions "Home" P2 (sites Top)) (regions "LeftSide" P1 (intersection (expand (sites Left) steps:1) (sites Bottom))) (regions "LeftSide" P2 (intersection (expand (sites Right) steps:1) (sites Top))) (regions "RightSide" P1 (intersection (expand (sites Right) steps:1) (sites Bottom))) (regions "RightSide" P2 (intersection (expand (sites Left) steps:1) (sites Top))) (piece "Seed" Shared) (hand Each)}) (rules (start (set Count 6 to:(sites Track))) phases:{ (phase "Sowing" (play (if (can Move ("Move")) ("Move") (move Pass (then (if (all Passed) (and { (forEach Site (sites P1 "Home") (if (is Occupied (site)) (fromTo (from (site)) (to (handSite P1)) count:(count at:(site))))) (forEach Site (sites P2 "Home") (if (is Occupied (site)) (fromTo (from (site)) (to (handSite P2)) count:(count at:(site))))) (forget Value "HolesSowed" All)})))))) (end (if (all Passed) { (if (> 6 (count Cell at:(handSite P1))) (result P2 Win)) (if (> 6 (count Cell at:(handSite P2))) (result P1 Win))})) (nextPhase (all Passed) "BetweenRounds")) (phase "BetweenRounds" (play (if (<= 6 (count Cell at:(handSite Mover))) (move (from (handSite Mover)) (to (intersection (sites Empty) (sites Mover "Home"))) count:6))) (nextPhase (all Passed) "Sowing"))})) END |
Construct a Ludii game based on the following description
One player has three dwarfs and the other has one giant.
Firstly, the giant is placed on one of the top sites. After this first move of the giant, it is the dwarfs' move.
Each piece can move between the different sites only if they are connected by an edge. The dwarfs can move only forwards or sideways, the giant can move in all the directions.
The goal of the dwarfs is to block the giant on the top site. The giant has to break through the line of dwarfs to get 2 points and win. In case of a repetition of moves, the giant is winning with one point.
###
| (game "Game of Dwarfs" (players {(player S) (player N)}) (equipment { (board (add (remove (rotate 90 ("ThreeMensMorrisGraphWithLeftAndRightTriangles")) vertices:{3 7 1}) edges:{{0 1} {4 5} {2 7} {0 4}}) use:Vertex) (piece "Foot" P1 (move Step Adjacent (to if:(and (if (= 1 (count Turns)) (!= (centrePoint) (to)) True) (is Empty (to)))))) (piece "Gnome" P2 ("StepToEmpty" (directions {Forwards Rightward Leftward}))) (hand P1) (regions "Home" P2 (intersection (sites Outer) (expand (sites Bottom)))) (regions "Home" P1 (sites Top))}) (rules (start { (place "Gnome2" (intersection (sites Outer) (expand (sites Bottom)))) (place "Foot1" (handSite P1))}) phases:{ (phase "Opening" P1 (play (move (from (handSite Mover)) (to (expand (sites Top))))) (nextPhase P1 "MainP1")) (phase "MainP1" P1 (play (forEach Piece (then (if (is In (where "Foot" P1) (sites P2)) (set Score P1 2) (if (is Cycle) (set Score P1 1))))))) (phase "MainP2" P2 (play (forEach Piece (then (if (no Moves Next) (set Score P2 1) (if (is Cycle) (set Score P1 1)))))))} (end (forEach Player if:(!= 0 (score Player)) (result Player Win))))) END |
Construct a Ludii game based on the following description
2x3 board. Eight counters in each pile. A player takes the counters from any of the piles and sows them anti-clockwise, beginning with the pile from which the counters were taken. Any piles that now contain 2, 4, or 6 counters are captured. The player who captures the most counters wins.
###
| (define "PiecesOwnedBy" (count Cell at:(handSite #1))) (game "Kapana Bona" (players 2) (equipment { (mancalaBoard 2 3 store:None (track "Track" "0,E,N,W" loop:True)) (piece "Seed" Shared) (hand Each)}) (rules (start (set Count 8 to:(sites Track))) (play (move Select (from (sites Board) if:(> (count at:(from)) 0)) (then (sow origin:True (then (forEach Site (sites Board) (if (or { (= (count at:(site)) 2) (= (count at:(site)) 4) (= (count at:(site)) 6)}) (fromTo (from (site)) (to (handSite Mover)) count:(count at:(site)))))))))) (end ("MancalaByScoreWhen" (= 0 (count Sites in:(forEach (sites Board) if:(< 1 (count at:(site)))))))))) END |
Construct a Ludii game based on the following description
5x5 intersecting lines, with diagonals drawn in the four quadrants of the board. Two triangles, their apices intersecting the main board at opposite midpoints. The base of the triangle is bisected by a line drawn from the apex, and this line is bisected and intersects with the other two sides of the triangle. One player plays as the Rimoe (king), which starts on the central point. The other player has 24 pieces, eight of which start on the board, on the points immediately adjacent to the Rimoe. The Rimoe plays first, and takes one of the opponent's pieces by hopping over it to an empty spot immediately behind it in a straight line. The Rimoe captures in this way any uninterrupted line of pieces with an odd number. The Rimoe cannot capture a line of pieces with an even number. When the Rimoe cannot capture, it moves one to an empty adjacent space along the lines of the board. The other player places on of their remaining pieces on the board on their turn. When there are no more pieces left to place, the player moves one of the pieces to an empty adjacent spot along the lines. The Rimoe wins by capturing all of the opponent's pieces; the opponent wins by blocking the Rimoe from being able to move. The game is played with one Rimoe able to hop an odd number of enemy pieces.
###
| (define "Hop" (move Hop (between (range 1 9) if:("IsEnemyAt" (between)) (apply (remove (between)))) (to if:(and (is Empty (to)) ("NumCapturedPiecesIsOdd"))))) (define "NumCapturedPiecesIsOdd" (is Even (count Steps (from) (to)))) (game "Rimoe" (players 2) (equipment { ("AlquerqueBoardWithBottomAndTopTriangles") (piece "King" P1 (priority { ("Hop") ("StepToEmpty")})) (piece "Marker" P2 ("StepToEmpty")) (hand Each)}) (rules (start { (place "King1" (centrePoint) count:1) (place "Marker2" (handSite P2) count:16) (place "Marker2" (difference (expand (sites Centre)) (centrePoint)))}) phases:{ (phase "Placement" P2 (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) ("PhaseMovePiece" "Movement")} (end ("NoMovesP1NoPiecesP2")))) END |
Construct a Ludii game based on the following description
4x12 board. Twelve pieces per player, one playing as sticks and the other as stones. Pieces begin on the board, one each in every space of the outer rows. Six sticks, with one black side and one white side, used as dice. Players choose who will play as black and who will play as white, and the throws are as follows: six black or white up = 6, five black or white up (called sir)= 5 plus another throw; four black or white up = 0, three black and three white up = 3. A player must throw sir in their colour to unlock a piece before moving it. Pieces move from left to right in their home row, right to left in the next row, left to right in the row following that, and then return to the second row. When a player's piece lands on a spot occupied by an opponent's piece, the opponent's piece is captured. The player who captures all of the opponent's pieces wins.
###
| (define "PieceMove" (if (or ("ActivatedPiece") (and (= (count Pips) (mapEntry "Sir" (mover))) ("InactivePiece"))) (if ("IsNotOffBoard" "SiteToMoveOnTrack") (if (or (is In "SiteToMoveOnTrack" (sites Empty)) ("IsEnemyAt" "SiteToMoveOnTrack")) (move (from) (to "SiteToMoveOnTrack" "CaptureEnemyPiece"))) (then ("ActivatePiece"))))) (define "CaptureEnemyPiece" (apply if:("IsEnemyAt" (to)) (remove (to)))) (define "InactivePiece" (= (state at:(from)) 1)) (define "ActivatedPiece" (= (state at:(from)) 0)) (define "ActivatePiece" (if (= (state at:(last To)) 1) (set State at:(last To) 0))) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" ("ThrowValue"))) (define "ThrowValue" (mapEntry "ThrowDiceValue" (count Pips))) (game "Siryu (War)" (players 2) (equipment { (board (rectangle 4 12) { (track "Track1" "0,E,N1,W,N1,E,23,E,W,N1,E,23,W,N1,E,23,W,N1,E,23,W,N1,E,23,W,N1,E,23,W,N1,E,23" loop:True P1) (track "Track2" "47,W,S1,E,S1,W,24,E,N1,W,24,E,N1,W,24,E,N1,W,24,E,N1,W,24,E,N1,W,24,E,N1,W,24" loop:True P2)} use:Vertex) (piece "Stick" P1 ("PieceMove")) (piece "Marker" P2 ("PieceMove")) (regions "AllSites" (sites Board)) ("StickDice" 6) (map "ThrowDiceValue" {(pair 0 6) (pair 1 5) (pair 2 0) (pair 3 3) (pair 4 0) (pair 5 5) (pair 6 6)}) (map "Sir" {(pair 1 1) (pair 2 5)})}) (rules (start { (place "Stick1" (sites Bottom) state:1) (place "Marker2" (sites Top) state:1)}) (play ("RollMove" (if (can Move (forEach Piece)) (forEach Piece (then (if (= ("ThrowValue") 5) (moveAgain)))) (move Pass (then (if (= ("ThrowValue") 5) (moveAgain))))))) (end ("CaptureAll" Next)))) END |
Construct a Ludii game based on the following description
Spiral board of any number of spaces, rendered as holes in the sand. The first space is a mound. Any number of players. One piece per player, and one piece, the \ The game has 4 players.
###
| (define "MoveBankor" (move (from ("WhereBankor") level:("LevelBankor")) (to ("BankorOnTrack" "Track" ("ThrowValue"))) (then (and (if (!= (mover) "StateBankor") (set State at:("WhereBankor") level:("LevelBankor") (mover))) (if (= (last To) ("Center")) (forEach Site (sites Track "Track" from:(last From) to:(last To)) (if (!= (site) (last To)) (forEach Level (site) FromTop (remove (site) level:(level))))) (forEach Site (sites Track "Track" from:(last From) to:(last To)) (if (!= (site) (last To)) (forEach Level (site) FromTop (fromTo (from (site) level:(level)) (to (last To))))))))))) (define "Center" 0) (define "StateBankor" (state at:("WhereBankor") level:("LevelBankor"))) (define "LevelBankor" (where Level "Bankor" Neutral at:("WhereBankor"))) (define "WhereBankor" (where "Bankor" Neutral)) (define "BankorPhaseDone" (or (= ("WhereBankor") ("Center")) (and (is Occupied ("Center")) (>= 1 (count Sites in:(difference (sites Occupied by:All) ("WhereBankor"))))))) (define "BankorOnTrack" ("NextSiteOnTrack" #2 from:("WhereBankor") #1)) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" #2 #1)) (define "Throw1" (= ("ThrowValue") 1)) (define "ThrowValue" (mapEntry "Throw" (count Pips))) (game "Sik" (players 4) (equipment { (board (spiral turns:5 sites:86) { (track "Track" {85..0} directed:True)} use:Vertex) ("StickDice" 4) (map "Throw" {(pair 0 4) (pair 1 3) (pair 2 0) (pair 3 1) (pair 4 6)}) (piece "Stick" Each (move (from (from) level:(level) if:(or (= 1 (state at:(from) level:(level))) ("Throw1"))) (to ("SiteToMoveOnTrack" "Track" ("ThrowValue")) if:True) (then (if (!= 1 (state at:(last To) level:(last LevelTo))) (set State at:(last To) level:(last LevelTo) 1))))) (piece "Bankor" Neutral)}) (rules (start { (place Stack items:{"Stick4" "Stick3" "Stick2" "Stick1"} 85) (place Stack "Bankor0" 85)}) (play ("RollMove" (if (= ("Center") (where "Stick" Mover)) (if (< (value Player Mover) 2) (move Pass (then (set Value Mover (+ 1 (value Player Mover))))) (if (or (= (mover) ("StateBankor")) (= 0 ("StateBankor"))) (if (!= 0 ("ThrowValue")) ("MoveBankor")))) (if (!= 0 ("ThrowValue")) (forEach Piece))))) (end { (forEach Player if:(no Pieces Player) (result Player Loss)) (forEach Player if:("BankorPhaseDone") (result Player Win))}))) END |
Describe the mechanics of the following Ludii game
(define "IsSpecialThrow" (is In ("ThrowValue") (sites {10 25 30}))) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" #2 #1)) (define "ThrowValue" (mapEntry "Throw" (count Pips))) (game "Pachesi" (players 4) (equipment { ("PachisiBoard" { (track "Track1" "96,9,S,W,N,7,W,N,E,51,N,E,S,43,E,S,W,10,S,W1,N7,End" P1 directed:True) (track "Track2" "96,26,W,N,E,51,N,E,S,43,E,S,W,10,S,W,N,7,W,N1,W7,End" P2 directed:True) (track "Track3" "96,52,N,E,S,43,E,S,W,10,S,W,N,7,W,N,E,51,N,E1,S7,End" P3 directed:True) (track "Track4" "96,27,E,S,W,10,S,W,N,7,W,N,E,51,N,E,S,43,E,S1,W7,End" P4 directed:True)}) ("StickDice" 7) (piece "Pawn" Each (if ("IsEndTrack" ("SiteToMoveOnTrack" from:(from) ("ThrowValue"))) (move Remove (from) level:(level)) (if (and ("IsEndTrack" ("SiteToMoveOnTrack" from:(from) 1)) ("IsSpecialThrow")) (move Remove (from) level:(level)) (move (from (from) level:(level)) (to ("SiteToMoveOnTrack" from:(from) ("ThrowValue")) if:(not (and (is In (to) (sites "SafeSites")) ("IsEnemyAt" (to)))) ("HittingStackCapture" (centrePoint))))))) (hand Each) (regions "SafeSites" (sites {55 63 65 34 15 47 94 84 86 19 38 3})) (map "Throw" {(pair 0 7) (pair 1 10) (pair 2 2) (pair 3 3) (pair 4 4) (pair 5 25) (pair 6 30) (pair 7 12)})}) (rules (start { (place Stack "Pawn1" (handSite P1) count:4) (place Stack "Pawn2" (handSite P2) count:4) (place Stack "Pawn3" (handSite P3) count:4) (place Stack "Pawn4" (handSite P4) count:4)}) (play ("RollMove" (or (if (and (is Occupied (handSite Mover)) ("IsSpecialThrow")) (move (from (handSite Mover)) (to (centrePoint)))) (forEach Piece)))) (end ("EscapeWin"))))
###
| Four 3x8 rectangles, arranged in a cross. The counting from the bottom of each arm, the spaces marked are the fourth square in the outer rows and the first in the central row. Four pieces per player. Seven cowrie shells, used as dice. The throws are as follows: one mouth up = 10; two mouths up = 2; three mouth up = 3; four mouths up = 4; five mouths up. = 25; six mouths up = 30, seven mouths up = 12, zero mouths up = 7. Pieces begin in the large central space of the board, and then proceed down the central row of their arm, then clockwise around the board, back to the central row, and then to the central space again. Pieces may enter the board on throws of 10, 25, or 30. When a player's piece lands on a space that is occupied by an opponent's piece, the opponent's piece is sent back to start. Pieces are safe from being sent to start when they rest on a marked space. To move off the board, a player must make an exact throw to arrive in the central square. When resting on the final square before the central one, a throw of 10, 25, or 30 is required. The first player to place all of their pieces in the central square wins. END |
Describe the mechanics of the following Ludii game
(define "PiecesOwnedBy" (+ (count Cell at:(handSite #1)) (count in:(sites #1 "Home")))) (define "Columns" 16) (game "Chiana wa Bwalo" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "Track1" "0,E,N1,W" loop:True P1) (track "Track2" "32,E,N1,W" loop:True P2)}) (regions "Home" P1 (sites Track "Track1")) (regions "Home" P2 (sites Track "Track2")) (regions "Inner" P1 (difference (sites Track "Track1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "Track2") (sites Top))) (piece "Seed" Shared) (hand Each)}) (rules (start (set Count 4 to:(union (sites Top) (sites Bottom)))) (play (move Select (from (sites Mover "Home") if:(> (count at:(from)) 0)) (then (sow "Track" owner:(mover) apply:(if (and (= (count at:(to)) 1) (> (count at:("OppositePit" (to))) 0)) (fromTo (from ("OppositePit" (to))) (to (handSite Mover)) count:(count at:("OppositePit" (to))))))))) (end ("MancalaByScoreWhen" (no Moves Next)))))
###
| 4 row board, of any number of holes. Four counters in each player's outer row. Sowing occurs from the player's rearmost hole and in an anti-clockwise direction. When the final counter lands in an empty hole in the inner row, any counters in the opposite hole in the opponent's inner row are captured. The player who captures all of the opponent's counters wins. Each player has 16 holes per row. END |
Construct a Ludii game based on the following description
2x6 board, with a storage hole on either end. The game starts with four counters in each hole. A player picks up all of the counters in one of the holes in their row and sows them one-by-one in a counterclockwise direction in consecutive holes from the hole the pieces originated. The starting hole is always left empty, even if a player sows in a complete circuit of the board, the original house is skipped and sowing continues in the next hole after it. Players capture counters when the final counter is sown in the player's own row and the hole containing it has two or three counters (counting the counter just dropped into it). If the hole before it also has two or three counters, these are also captured and so on until reaching a hole without two or three counters or one not belonging to the player. If an opponent's holes are all empty, the other player must make a move placing counters in the opponent's row. If not possible, the player captures all the counters in their row. The player who has captured the most counters wins. If the game continues in a repeating loop, the players can agree to end the game and capture the counters remaining in their row.
###
| (define "PiecesOwnedBy" (+ (count at:(mapEntry #1)) (count in:(sites #1)))) (game "Fondji" (players 2) (equipment { (mancalaBoard 2 6 (track "Track" "1,E,N,W" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 FirstSite) (pair P2 LastSite)}) (piece "Seed" Shared)}) (rules (start (set Count 4 to:(sites Track))) (play (if (is Proposed "End") (or (move Vote "End") (move Vote "No")) (or (if (is Cycle) (move Propose "End")) (do (move Select (from (sites Mover) if:(< 0 (count at:(from)))) (then (sow if:(and (is In (to) (sites Next)) (or (= (count at:(to)) 2) (= (count at:(to)) 3))) apply:(fromTo (from (to)) (to (mapEntry (mover))) count:(count at:(to))) includeSelf:False backtracking:True))) ifAfterwards:(< 0 (count in:(sites Next))))))) (end ("MancalaByScoreWhen" (or (no Moves Mover) (is Decided "End")))))) END |
Construct a Ludii game based on the following description
2x6 board with store holes at either end. The game begins with six counters in each hole. Each player owns one row of holes. At the beginning of the turn, a player picks up all of the counters from their side of the board and sows them, one each, into consecutive holes in a counterclockwise pattern. If the last counter lands in a hole that contains 2, 4, or 6 (after sowing), then the player captures the counters in that hole. If the player captures counters in a hole, then they may also capture counters in the previous hole, if it also has 2,4, or 6, continuing until reaching a hole without 2, 4, or 6. Play continues until one player cannot play on their turn, at which point the other player receives all of the remaining counters. The player with the most captured counters wins.
###
| (define "PiecesOwnedBy" (+ (count at:(mapEntry #1)) (count in:(sites #1)))) (game "Das Bohnenspiel" (players 2) (equipment { (mancalaBoard 2 6 (track "Track" "1,E,N,W" loop:True)) (regions "Home" P1 (sites Bottom)) (regions "Home" P2 (sites Top)) (map {(pair P1 FirstSite) (pair P2 LastSite)}) (piece "Seed" Shared)}) (rules (start (set Count 6 to:(sites Track))) (play (move Select (from (sites Mover) if:(> (count at:(from)) 0)) (then (sow if:(is In (count at:(to)) (sites {2 4 6})) apply:(fromTo (from (to)) (to (mapEntry (mover))) count:(count at:(to))) backtracking:True)))) (end ("MancalaByScoreWhen" (no Moves Mover))))) END |
Describe the mechanics of the following Ludii game
(game "Geister" (players 2) (equipment { (board (square 6)) (hand Each size:2) (piece "GhostGood" Each) (piece "GhostEvil" Each) (regions "HomeP1" P1 (difference (expand (sites Bottom) steps:1) (union (sites Side E) (sites Side W)))) (regions "HomeP2" P2 (difference (expand (sites Top) steps:1) (union (sites Side E) (sites Side W)))) (regions "EscapeP1" P1 {30 35}) (regions "EscapeP2" P2 {0 5}) (map "Where" { (pair (id "GhostGood" P1) (handSite P1)) (pair (id "GhostEvil" P1) (handSite P1 1)) (pair (id "GhostGood" P2) (handSite P2)) (pair (id "GhostEvil" P2) (handSite P2 1))})}) (rules (start { (place "GhostGood1" 36 count:4) (place "GhostEvil1" 37 count:4) (set Hidden (sites Hand P1) to:P2) (place "GhostGood2" 38 count:4) (place "GhostEvil2" 39 count:4) (set Hidden (sites Hand P2) to:P1)}) phases:{ (phase "Placement" (play (move (from (sites Occupied by:Mover container:(mover))) (to (forEach (sites Mover "Home") if:(is Empty (site)))) (then (if ("HandEmpty" P2) (and { (set Hidden (sites P2 "Home") False to:P1) (set Hidden (sites P1 "Home") False to:P2) (set Hidden What (sites P2 "Home") to:P1) (set Hidden What (sites P1 "Home") to:P2)}))))) (nextPhase ("HandEmpty" P2) "Movement")) (phase "Movement" (play (forEach Piece {"GhostGood" "GhostEvil"} (or (move Step Orthogonal (to if:(not ("IsFriendAt" (to))) (apply (if ("IsEnemyAt" (to)) (add (piece (what at:(to))) (to (mapEntry "Where" (what at:(to))))))))) (move Select (from (intersection (sites Occupied by:Mover component:"GhostGood") (sites Mover "Escape"))) (then (trigger "Escaped" (mover))))))) (end { (if (or { (no Pieces Mover "GhostEvil" in:(sites Board)) (no Pieces Next "GhostGood" in:(sites Board)) (is Triggered "Escaped" Mover)}) (result Mover Win)) (if (or (no Pieces Next "GhostEvil" in:(sites Board)) (no Pieces Mover "GhostGood" in:(sites Board))) (result Mover Loss))}))}))
###
| Geister is a two-player board game on a 6×6 game board.
Each player has four good ghosts and four evil ghosts, whose
type is not revealed to the opponent player. In each turn
a player can move one of his ghosts one step vertically or
horizontally. Moving into a square containing an opponent's
ghost will capture the opponent's ghost and move it off from
the board. Moving into a square containing an ally ghost
is not allowed. A player can also move off one of his good
ghosts from one of the opponent's corner squares. A player
wins when one of the three conditions is satisfied:
• All the player's evil ghosts are captured.
• All the opponent's good ghosts are captured.
• One of the player's good ghosts is moved off the board
from one of the opponent's corner squares. END |
Construct a Ludii game based on the following description
Each box should contain a zero or a one. No more than two similar numbers next to or below each other are allowed. Each row and each column should contain an equal number of zeros and ones. Each row is unique and each column is unique.
###
| (game "Takuzu" (players 1) (equipment { (board (square 10) (values Cell (range 0 1))) (regions {Columns Rows})}) (rules (start (set { {0 1} {1 1} {4 1} {11 1} {18 1} {25 0} {26 0} {29 0} {34 1} {37 0} {51 1} {52 0} {59 1} {65 1} {67 1} {71 1} {86 0} {87 0} {92 0} {96 0}})) (play (satisfy { (not (is Line 3 Orthogonal)) (is Unique) (is Sum (/ (count Rows) 2))})) (end (if (is Solved) (result P1 Win))))) END |
Construct a Ludii game based on the following description
The aim of Abak is to be the first player to connect one of the orange squares in the centre of the board to any one orange squares in the corners by forming a continuous row of counters of one colour.
In the first phase, each player places one counter on one of the orange squares in the centre of the board.
They continue to take turns to place their counters on a free adjacent square (squares are adjacent if they touch on the sides or diagonally by the points).
The counter may be placed beside counters of any colour. Once placed, a counter may not be moved.
During the game, if a counter is surrounded by more than 4 occupied squares, that counter is removed.
Moreover, if then a counter becomes isolated, it is also removed from the board. The game is played on a 11x11 board. Two players.
###
| (define "AlternateRegions" (regions "Centre" (sites Centre)) (regions "CentreRing" (difference (expand (sites Centre)) (sites Centre))) (regions "CornerSites" (sites {"B2" "J2" "R2" "B10" "R10" "B18" "J18" "R18"})) (regions "DotSites" (sites {"F6" "J6" "N6" "N10" "F10" "F14" "J14" "N14"})) (regions "OuterGoals" (difference (expand (sites "CornerSites")) (sites "CornerSites")))) (define "RegularRegions" (regions "Centre" (sites Centre)) (regions "CentreRing" (difference (expand (sites Centre)) (sites Centre))) (regions "OuterGoals" (expand (sites Corners)))) (define "Nbors" (count Sites in:(intersection (sites Around #1) (sites Occupied by:All)))) (game "Abak" (players 2) (equipment { (board (square 11)) (piece "Disc" Each) "RegularRegions"}) (rules phases: { (phase "Placement" (play (move Add (to (intersection (sites "CentreRing") (sites Empty))))) (nextPhase (= (count Pieces All) 2) "Movement")) (phase "Movement" (play (move Add (to (difference (sites Playable) (sites Centre))) (then (forEach Site (sites Occupied by:All) (if (<= 4 ("Nbors" (to))) (remove (to))) (then (forEach Site (sites Occupied by:All) (if (= 0 ("Nbors" (to))) (remove (to))))))))))} (end (if (is Connected {(sites "CentreRing") (sites "OuterGoals")}) (result Mover Win))))) END |