prompt
stringlengths 71
4.65k
| completion
stringlengths 34
5.1k
|
---|---|
Modify the Ludii game according to the following option changes:
The rules of the game II. -> The rules of the game III.
(game "Ratio" (players {(player S) (player N)}) (equipment { (board (add (remove (merge { (rectangle 3 3 diagonals:Alternating) (shift 0 2 (wedge 2)) (shift 0 -1 (rotate 180 (wedge 2)))}) vertices:{3 5}) edges:{{0 4} {2 6}}) use:Vertex) (piece "Foot" P1 (move Step Adjacent (to if:(is Empty (to))))) (piece "Gnome" P2 (move Step (directions {Forwards Rightward Leftward}) (to if:(is Empty (to))))) (hand P1) (regions "Home" P2 (intersection (sites Outer) (expand (sites Bottom)))) (regions "Home" P1 (sites Top))}) (rules (start { (place "Gnome2" (intersection (sites Outer) (expand (sites Bottom)))) (place "Foot1" (handSite P1))}) phases:{ (phase "Opening" (play (move (from (handSite Mover)) (to (difference (sites Board) (intersection (sites Outer) (expand (sites Bottom))))) (then (moveAgain)))) (nextPhase "Main")) (phase "Main" (play (forEach Piece)))} (end { (if (no Moves P1) (result P2 Win)) (if (is In (where "Foot" P1) (sites P2)) (result P1 Win))})))
###
| (game "Ratio" (players {(player S) (player N)}) (equipment { (board (add (remove (merge { (rectangle 3 3 diagonals:Alternating) (shift 0 2 (wedge 2)) (shift 0 -1 (rotate 180 (wedge 2)))}) vertices:{1}) edges:{{0 1} {3 9}}) use:Vertex) (piece "Foot" P1 (move Step Adjacent (to if:(is Empty (to))))) (piece "Gnome" P2 (move Step (directions {Forwards Rightward Leftward}) (to if:(is Empty (to))))) (hand P1) (regions "Home" P2 (intersection (sites Outer) (expand (sites Bottom)))) (regions "Home" P1 (sites Top))}) (rules (start { (place "Gnome2" (intersection (sites Outer) (expand (sites Bottom)))) (place "Foot1" (handSite P1))}) phases:{ (phase "Opening" (play (move (from (handSite Mover)) (to (difference (sites Board) (intersection (sites Outer) (expand (sites Bottom))))) (then (moveAgain)))) (nextPhase "Main")) (phase "Main" (play (forEach Piece)))} (end { (if (no Moves P1) (result P2 Win)) (if (is In (where "Foot" P1) (sites P2)) (result P1 Win))}))) END |
Modify the Ludii game according to the following option changes:
Board: Muster order 2 board - 20 positions -> Board: Muster order 4 board - 80 positions
(define "Order6" (poly { { 1 8} { 2 7} { 14 1} { 15 2} { 21 14} { 20 15} { 8 21} { 7 20}})) (define "Order5" (poly { { 1 7} { 2 6} { 12 1} { 13 2} { 18 12} { 17 13} { 7 18} { 6 17}})) (define "Order4" (poly { { 1 6} { 2 5} { 10 1} { 11 2} { 15 10} { 14 11} { 6 15} { 5 14}})) (define "Order3" (poly { { 1 5} { 2 4} { 8 1} { 9 2} { 12 8} { 11 9} { 5 12} { 4 11}})) (define "Order2" (poly { { 1 4} { 2 3} { 6 1} { 7 2} { 9 6} { 8 7} { 4 9} { 3 8}})) (define "NoPlacementAvailable" (all Sites (sites Empty) if:(not (no Pieces Mover in:(sites Around (site) All))))) (game "Make Muster" (players 2) (equipment { (board (rotate (- 90 62) (square "Order2")) use:Cell) (piece "Disc" Each ("StepToEmpty"))}) (rules (play (priority (move Add (to (sites Empty) if:(no Pieces Mover in:(sites Around (to) Adjacent)))) (forEach Piece))) (end (if (or (and { ("IsSingleGroup" Mover All) (< 1 (count Pieces Mover))}) (< 1 (count Groups All if:(!= (mover) (who at:(to)))))) (result Mover Win)))))
###
| (define "Order6" (poly { { 1 8} { 2 7} { 14 1} { 15 2} { 21 14} { 20 15} { 8 21} { 7 20}})) (define "Order5" (poly { { 1 7} { 2 6} { 12 1} { 13 2} { 18 12} { 17 13} { 7 18} { 6 17}})) (define "Order4" (poly { { 1 6} { 2 5} { 10 1} { 11 2} { 15 10} { 14 11} { 6 15} { 5 14}})) (define "Order3" (poly { { 1 5} { 2 4} { 8 1} { 9 2} { 12 8} { 11 9} { 5 12} { 4 11}})) (define "Order2" (poly { { 1 4} { 2 3} { 6 1} { 7 2} { 9 6} { 8 7} { 4 9} { 3 8}})) (define "NoPlacementAvailable" (all Sites (sites Empty) if:(not (no Pieces Mover in:(sites Around (site) All))))) (game "Make Muster" (players 2) (equipment { (board (rotate (- 90 62) (square "Order4")) use:Cell) (piece "Disc" Each ("StepToEmpty"))}) (rules (play (priority (move Add (to (sites Empty) if:(no Pieces Mover in:(sites Around (to) Adjacent)))) (forEach Piece))) (end (if (or (and { ("IsSingleGroup" Mover All) (< 1 (count Pieces Mover))}) (< 1 (count Groups All if:(!= (mover) (who at:(to)))))) (result Mover Win))))) END |
Construct a Ludii game based on the following description
28 squares arranged in a cross-shaped board. Diagonals are drawn in each 2x2 square. Pieces are played on the lines of the board. One player plays as a single fox, placed on the center of the third line from the top of one arm of the cross. The other player plays as eighteen geese, placed on the points on the opposite arm of the cross and the first horizontal line of the horizontal arms of the cross. Players alternate turns moving a piece to an empty adjacent spot along the lines of the board. The geese may not move backward. The fox may capture a goose by hopping over it to an empty spot immediately on the opposite side of the goose along the lines of the board. The geese win by blocking the fox from being able to move. The fox wins by capturing all the geese.
###
| (game "Gasetavl (Gedved)" (players 2) (equipment { ("CrossBoard" 3 9 use:Vertex diagonals:Alternating) (piece "Fox" P1 (or ("HopCapture") ("StepToEmpty"))) (piece "Geese" P2 N ("StepToEmpty" (directions {Rightward Forwards Leftward})))}) (rules (start { (place "Fox1" coord:"E7") (place "Geese2" (sites {"D1" "E1" "F1" "D2" "E2" "F2" "D3" "E3" "F3" "A4" "B4" "C4" "D4" "E4" "F4" "G4" "H4" "I4"}))}) (play (forEach Piece)) (end ("NoMovesP1NoPiecesP2")))) END |
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))) (define "Columns" 6) (game "Mangala (Bedouin)" (players 2) (equipment { (mancalaBoard 2 "Columns" store:None (track "Track" "5,W,N,E" loop:True)) (piece "Seed" Shared) (hand Each) (hand Shared) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map "FourthHole" {(pair P1 3) (pair P2 8)})}) (rules (start (place "Seed" (handSite Shared) count:17)) phases:{ (phase "OpeningP1" (play (move (from (handSite Shared)) (to (sites Centre)) (then (if (is Occupied (handSite Shared)) (moveAgain))))) (nextPhase (is Empty (handSite Shared)) "OpeningP2")) (phase "OpeningP2" (play (or (move Pass) (if (is Mover P2) (move Pass (then (and { (remove (sites Centre)) (add (piece (id "Seed" Shared)) (to 9) count:(count at:2)) (add (piece (id "Seed" Shared)) (to 2) count:(count at:9)) (add (piece (id "Seed" Shared)) (to 8) count:(count at:3)) (add (piece (id "Seed" Shared)) (to 3) count:(count at:8))})))))) (nextPhase (all Passed) "SowingRestricted")) (phase "SowingRestricted" (play (move Select (from (mapEntry Mover) if:(is Occupied (from))) (then (sow)))) (nextPhase Mover "Sowing")) (phase "Sowing" (play (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover)) if:(> (count at:(from)) 0)) (then (sow apply:(if (< 10 (count at:(to))) (moveAgain) (if (is Even (count at:(to))) (if (is Even (count at:("OppositePit" (to)))) (and (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))) (fromTo (from ("OppositePit" (to))) (to (handSite Mover)) count:(count at:("OppositePit" (to))))) (moveAgain)))))))) (end ("MancalaByScoreWhen" ("OneRowIsEmpty"))))}))
###
| 2x6 board. Seventy counters. One player distributes the counters unevenly in the central four holes (central two holes of each row). The opponent then has the option to flip the board around if they are not satisfied with the distribution. Opponent begins play. The first move must be from the fourth hole in the row. Sowing occurs in a clockwise direction. Capturing cannot happen on the first move. If the last counter is dropped into a hole, creating an odd number of counters in it, play ends. If the number is now even and the hole in the other player's row also has an even number, the contents of both holes are captured. If the final hole is now even but the other player's row does not have an even number of counters, the counters are picked up and a new sowing begins. If the final hole has more than ten counters it cannot be captured and sowing must continue from this hole whether the number is even or odd. Play ends when a player has no more counters on their side of the board. The player who has captured the greatest number of counters wins. END |
Construct a Ludii game based on the following description
Like Go, Cavity is played on the points of a square grid, and groups (chains, more precisely) and liberties are defined the same way.
An empty region is a group (chain) of empty points, and it is said to be adjacent to a stone if any of its points are.
Setup:
Starting with Black, place one stone each on any empty point.
The setup is over as soon as the players have one stone each on the board.
Play:
On your turn, place a stone of your color on any point in an empty region that's adjacent to a stone of your color.
After placement, first remove all enemy groups that have no liberties, then remove all friendly groups that have no liberties.
In this phase, as soon as one player is the only one with stones on the board, the game is over and that player is the winner.
The game is balanced with the pie rule. The game is played on an 11x11 board
###
| (define "ReachesRegion" (> Infinity (count Steps Orthogonal (step (to if:(or (is Empty (to)) (is In (to) #2)))) #1 #2))) (define "CaptureSurroundedGroup" (enclose (from (last To)) Orthogonal (between if:(is #1 (who at:(between))) (apply (remove (between)))) #2)) (game "Cavity" (players 2) (equipment { (board (square 11) use:Vertex) (piece "Marker" Each)}) (rules (meta (swap)) phases:{ (phase "Opening" (play (move Add (to (sites Empty)))) (nextPhase (and (= 1 (count Sites in:(sites Occupied by:P1))) (= 1 (count Sites in:(sites Occupied by:P2)))) "Play")) (phase "Play" (play (move Add (to (sites Empty) if:("ReachesRegion" (to) (sites Occupied by:Mover))) (then (if (can Move ("CaptureSurroundedGroup" Enemy)) ("CaptureSurroundedGroup" Enemy) ("CaptureSurroundedGroup" Mover))))))} (end (forEach Player if:(and (< 2 (count Moves)) (no Pieces Player)) (result Player Loss))))) END |
Modify the Ludii game according to the following option changes:
A size 4 board is currently selected -> A size 6 board is currently selected
(define "Remove" (move Select (from (sites Occupied by:Enemy)) (then (forEach Site (sites Group at:(last From) Orthogonal) (remove (site)))))) (define "Place" (move Add (to (sites Around (sites Occupied by:Mover) Empty Orthogonal)))) (game "Gygoreg" (players 2) (equipment { (board (square Diamond 4)) (piece "Disc" Each)}) (rules (start { (place "Disc1" (forEach (sites Phase 0) if:(is Odd (site)))) (place "Disc2" (forEach (sites Phase 0) if:(is Even (site))))}) (play (or ("Place") ("Remove"))) (end { ("SingleGroupWin" P1 Orthogonal) ("SingleGroupWin" P2 Orthogonal)})))
###
| (define "Remove" (move Select (from (sites Occupied by:Enemy)) (then (forEach Site (sites Group at:(last From) Orthogonal) (remove (site)))))) (define "Place" (move Add (to (sites Around (sites Occupied by:Mover) Empty Orthogonal)))) (game "Gygoreg" (players 2) (equipment { (board (square Diamond 6)) (piece "Disc" Each)}) (rules (start { (place "Disc1" (forEach (sites Phase 0) if:(is Odd (site)))) (place "Disc2" (forEach (sites Phase 0) if:(is Even (site))))}) (play (or ("Place") ("Remove"))) (end { ("SingleGroupWin" P1 Orthogonal) ("SingleGroupWin" P2 Orthogonal)}))) END |
Describe the mechanics of the following Ludii game
(define "MoveOppositeDice" (forEach Value (values Remembered "Opposite") (if ("IsOffBoard" ("NextSiteFrom" (from) (value))) (move Remove (from)) (move (from (from)) (to ("NextSiteFrom" (from) (value)) if:("NoEnemyOrOnlyOne" (to)) (apply (and (if ("IsEnemyAt" (to)) (fromTo (from (to)) (to (handSite Next)))) (forget Value "Opposite" (value)))))) (then (if (!= 0 (size Array (values Remembered "Opposite"))) (moveAgain) (and { (set Var "PlayOpposite" 0) (set Pending) (moveAgain)})))))) (define "DoubleDieValue" (face 28)) (define "NextSiteFrom" ("NextSiteOnTrack" #2 from:#1)) (game "Lange Puff" (players 2) (equipment { ("BackgammonBoard" "BackgammonTracksSameDirectionWithHands") (dice d:6 num:2) (piece "Disc" Each (forEach Die replayDouble:(= 1 (value Player Mover)) if:("DieNotUsed") (if ("IsOffBoard" ("NextSiteFrom" (from) (pips))) (move Remove (from)) (move (from (from)) (to ("NextSiteFrom" (from) (pips)) if:("NoEnemyOrOnlyOne" (to)) ("HittingCapture" (handSite Next))))) (then (if (not (all DiceUsed)) (moveAgain) (if (= 1 (value Player Mover)) (if (and (all DiceEqual) (= 0 (size Array (values Remembered)))) (and (moveAgain) (set Var "PlayOpposite" 1))) (set Value Mover 1)))))) (hand Each)}) (rules (start { (place Stack "Disc1" (handSite P1) count:15) (place Stack "Disc2" (handSite P2) count:15)}) (play (do (if (or (is Pending) ("NewTurn")) (roll)) next:(if (= 1 (var "PlayOpposite")) (or { (forEach Piece ("MoveOppositeDice") top:True) (forEach Piece container:(mover) ("MoveOppositeDice") top:True) (move Pass (then (and { (forget Value "Opposite" All) (set Var "PlayOpposite" 0) (set Pending) (moveAgain)})))}) (do (if (and { (= 0 (count MovesThisTurn)) (all DiceEqual) (= 1 (value Player Mover))}) (and (remember Value "Opposite" (- 7 ("DoubleDieValue"))) (remember Value "Opposite" (- 7 ("DoubleDieValue"))))) next:(or (forEach Piece top:True) (forEach Piece container:(mover) top:True)))))) (end ("EscapeWin"))))
###
| 2x12 board, with spaces as points, divided in two. Fifteen pieces per player. Two six-sided die. Players move according to the number on each die by moving one piece the value on one die then another piece the value on the other die, or by moving one piece the value of one die and then the value of the other. The lowest value of the dice must be played; if it cannot, the player does not move. When a player throws doubles, they play the values on each die, as well as the values on the opposite side of the dice (I.e., double 6 if double 1 is thrown, 5 if 2, 3 if 4). However, the values on the bottom can only be played if all of the top values are played. The first double throw is only played once, but every subsequent double throw is played twice, and the top values must be played twice before using the bottom values. Bottom values do not have to be played, or only some of the bottom values may be played if the player wishes. In addition, an extra throw is granted for the second and subsequent throws of doubles. Players enter their pieces onto the same section of the board, and proceed around the board to the point opposite the starting point, and then off the board. A player may not land on a point with two or more of the opponent's pieces. A player's piece may land on a point with a single opponent's piece. The opponent's piece is removed from the board and must enter again. The first player to remove all of their pieces from the board wins. END |
Construct a Ludii game based on the following description
Four 3x8 rectangles, arranged in a cross. No marked squares. Four players, each with four pieces, which are black, yellow, green, and red. Yellow seated at the bottom, red to their right, black to the right of red, green to the right of black. Green and red play on a team against black and yellow. Three four-sided rectangular dice, each marked 1, 2, 5, and 6. Pieces begin on the board, with one each in the sixth and seventh space of the central row of the player's arm, (counting from the top of the row), and in the seventh and eighth spaces of the left row of the arm belonging to the player to the right. The latter two pieces must move as a pair, I.e., they must always be moved together, and can only do so when doubles are thrown. The other two pieces belonging to a player may move singly. Throws may be split up as a player sees fit, but the value of one die must be used it its entirety by a piece. Pieces move around the board in an anti-clockwise direction until they reach their central row, at which point they move up the central row to the central spot. They must enter the central space by an exact throw. When a player moves all of their pieces to the center, they continue to throw the dice, and use these throws to move their partner's pieces. When all of the team's pieces reach the center, that team wins.
###
| (define "Move" (if ("AllPiecesOnCentre" Mover) (if (is Mover P1) (forEach Piece ("PieceMove" "TrackNormal3" "TrackPaired3") P3) (if (is Mover P3) (forEach Piece ("PieceMove" "TrackNormal1" "TrackPaired1") P1) (if (is Mover P4) (forEach Piece ("PieceMove" "TrackNormal2" "TrackPaired2") P2) (forEach Piece ("PieceMove" "TrackNormal4" "TrackPaired4") P4)))) (forEach Piece))) (define "PieceMove" (forEach Die if:("DieNotUsed") (move (from (from) level:(level) if:(!= 0 (what at:(from) level:(level)))) (to (if (= 0 (state at:(from) level:(level))) ("TrackMove" from:(from) #1 (pips)) ("TrackMove" from:(from) #2 (pips))) if:(if (= 0 (state at:(from) level:(level))) (if (not ("MovedPair")) True (or "Triple" (= (pips) ("NotDoubleValue")))) (and { (not ("MovedPair")) ("HasDouble") (= (pips) ("DoubleValue")) (< (count MovesThisTurn) 2) (if (= (count MovesThisTurn) 0) True (or ("Triple") (!= ("PreviousPipsUsed") ("DoubleValue"))))})) (apply (and (if (= 1 (state at:(from))) (forEach Site (sites Occupied by:Mover top:False) (forEach Level (site) (if (and { (= 1 (state at:(site) level:(level))) (!= (from) (site)) (= (mover) (who at:(site) level:(level)))}) (fromTo (from (site) level:(level)) (to ("TrackMove" from:(site) #2 (pips)))))))) ("StorePreviousPipsUsed" (pips))))) (then (if (and (not ("MovedPair")) (if (= 1 (state at:(last To) level:(last LevelTo))) (< (count MovesThisTurn) 1) (< (count MovesThisTurn) 2))) (and (moveAgain) (if (= 1 (state at:(last To) level:(last LevelTo))) ("StoreMovePair" 1))) (and ("StoreMovePair" 0) ("StorePreviousPipsUsed" 0))))))) (define "MovedPair" (= 1 (var "MovePair"))) (define "StoreMovePair" (set Var "MovePair" #1)) (define "PreviousPipsUsed" (var "Pips")) (define "StorePreviousPipsUsed" (set Var "Pips" #1)) (define "TrackMove" ("NextSiteOnTrack" #3 #1 #2)) (define "AllPiecesOnCentre" (and (= 1 (count Sites in:(sites Occupied by:#1 top:False))) (is In (centrePoint) (sites Occupied by:#1 top:False)))) (define "NotDoubleValue" (if (= ("Die1") ("Die2")) ("Die3") (if (= ("Die2") ("Die3")) ("Die1") ("Die2")))) (define "DoubleValue" (if (= ("Die1") ("Die2")) ("Die1") (if (= ("Die2") ("Die3")) ("Die2") ("Die3")))) (define "HasDouble" (or { (= ("Die1") ("Die2")) (= ("Die1") ("Die3")) (= ("Die2") ("Die3"))})) (define "Die3" (face 99)) (define "Die2" (face 98)) (define "Die1" (face 97)) (define "Triple" (all DiceEqual)) (game "Chonpa" (players 4) (equipment { ("PachisiBoard" { (track "TrackNormal1" "64,S,E,N,11,E,N,W,53,N,W,S,42,W,S,E,8,54,E1,N8" P1 directed:True) (track "TrackPaired1" "57,S,E,N,11,E,N,W,53,N,W,S,42,W,S,E,8,54,E1,N8" P1 directed:True) (track "TrackNormal2" "22,W,S,E,8,S,E,N,11,E,N,W,53,N,W,S,42,W,S1,E8" P2 directed:True) (track "TrackPaired2" "36,W,S,E,8,S,E,N,11,E,N,W,53,N,W,S,42,W,S1,E8" P2 directed:True) (track "TrackNormal3" "85,N,W,S,42,W,S,E,8,S,E,N,11,E,N,W,53,N,W1,S8" P3 directed:True) (track "TrackPaired3" "92,N,W,S,42,W,S,E,8,S,E,N,11,E,N,W,53,N,W1,S8" P3 directed:True) (track "TrackNormal4" "31,E,N,W,53,N,W,S,42,W,S,E,8,S,E,N,11,E,N1,W8" P4 directed:True) (track "TrackPaired4" "17,E,N,W,53,N,W,S,42,W,S,E,8,S,E,N,11,E,N1,W8" P4 directed:True)}) (dice d:4 faces:{1 2 5 6} num:3) (piece "Pawn" Each ("PieceMove" "TrackNormal" "TrackPaired"))}) (rules (start { (set Team 1 {P1 P3}) (set Team 2 {P2 P4}) (place Stack "Pawn1" (sites {61 64})) (place Stack "Pawn2" (sites {21 22})) (place Stack "Pawn3" (sites {85 88})) (place Stack "Pawn4" (sites {31 32})) (place Stack "Pawn1" (sites {17 18}) state:1) (place Stack "Pawn2" (sites {54 57}) state:1) (place Stack "Pawn3" (sites {35 36}) state:1) (place Stack "Pawn4" (sites {92 95}) state:1)}) (play ("RollEachNewTurnMove" (if (can Move ("Move")) ("Move") (move Pass (then (and ("StoreMovePair" 0) ("StorePreviousPipsUsed" 0))))))) (end (if ("AllPiecesOnCentre" TeamMover) (result TeamMover Win))))) END |
Construct a global Ludii definition which fulfills the following requirements.
Defines a step move of a full stack to all the directions specified (adjacent by default) to an empty site.
###
| (define "StepStackToEmpty" (move Step #1 (to if:(and (is In (from) (sites Occupied by:Mover)) (is Empty (to)))) stack:True #2)) END |
Construct a Ludii game based on the following description
2x3-7 board. Four counters in each hole. Players sow counters from their side of the board in an anti-clockwise direction. When the final counter of a sowing lands in a hole containing one or two counters, making it now contain two or three, these are captured. Any adjacent holes with two or three counters are also captured. Single counters cannot be sown. When a player only has single counters in holes in their row, they pass. The player who captures the most counters wins. Each row has 3 holes.
###
| (define "PiecesOwnedBy" (count Cell at:(handSite #1))) (game "I" (players 2) (equipment { (mancalaBoard 2 3 store:None (track "Track" "0,E,N,W" loop:True)) (piece "Seed" Shared) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (hand Each)}) (rules (start (set Count 4 to:(sites Track))) (play (move Select (from (sites Mover) if:(> (count at:(from)) 1)) (then (sow apply:(if (or (= 2 (count at:(to))) (= 3 (count at:(to)))) (and { (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))) (if (!= (to) (ahead (to) E)) (if (or (= 2 (count at:(ahead (to) E))) (= 3 (count at:(ahead (to) E)))) (fromTo (from (ahead (to) E)) (to (handSite Mover)) count:(count at:(ahead (to) E))))) (if (!= (to) (ahead (to) W)) (if (or (= 2 (count at:(ahead (to) W))) (= 3 (count at:(ahead (to) W)))) (fromTo (from (ahead (to) W)) (to (handSite Mover)) count:(count at:(ahead (to) W)))))})))))) (end ("MancalaByScoreWhen" (and (no Moves P1) (no Moves P2)))))) END |
Construct a Ludii game based on the following description
Starting with Black, the two players take turns placing stones onto unoccupied points on the board, subject to restrictions, one stone per turn.
Passing is not allowed in Redstone. Players will always have a placement available and must make one.
GROUPS AND LIBERTIES:
A group is an orthogonally interconnected collection of one or more like-colored stones.
Only black groups and white groups will be discussed here, not red groups.
A liberty is an unoccupied point adjacent to a (black or white) group
CAPTURES:
A capturing placement results in one or more groups, of either or both colors, having no liberties.
Such a placement can only be made with a red stone.
Conversely, a red stone can only be placed if it bounds (completely deprives of liberties) one or more groups of either or both colors. Red stones are permanent. They cannot themselves be captured.
Self capture is allowed.
When multiple groups without liberties result from a placement, all such groups are removed immediately following said placement, regardless of the groups' colors. Unlike Go, if you unbound your own temporarily bounded group by removing a neighboring enemy group, you must still remove your own temporarily bounded group.
PIE RULE:
Since Redstone is a game of annihilation, not of point score, Go’s komi can’t be used.
Instead, Redstone uses the pie rule for balance.
OBJECT OF THE GAME:
You must annihilate your opponent, removing all of his stones from the board.
If your placement eliminates all black and white stones from the board, you win.
If your placement eliminates all of your own stones while enemy stones remain on the board, you lose. A size 13 board is currently selected
###
| (define "PlaceNonRed" (do (move Add (to (sites Empty))) ifAfterwards:(not (or ("SomeSite" (sites Around (last To) Enemy Orthogonal) (= 0 (count Liberties at:(site) Orthogonal if:(is Next (who at:(to)))))) ("SomeSite" (sites Around (last To) Own Orthogonal includeSelf:True) (= 0 (count Liberties at:(site) Orthogonal if:(is Mover (who at:(to)))))))))) (define "PlaceRed" (do (move Add (piece "Disc0") (to (sites Empty))) ifAfterwards:(or ("SomeSite" (sites Around (last To) Enemy Orthogonal) (= 0 (count Liberties at:(site) Orthogonal if:(is Next (who at:(to)))))) ("SomeSite" (sites Around (last To) Own Orthogonal) (= 0 (count Liberties at:(site) Orthogonal if:(is Mover (who at:(to))))))) (then (and (forEach Site (sites Around (last To) Enemy Orthogonal) (if (= 0 (count Liberties at:(site) Orthogonal if:(is Next (who at:(to))))) (remove (sites Group at:(site) Orthogonal if:(is Next (who at:(to))))))) (forEach Site (sites Around (last To) Own Orthogonal) (if (= 0 (count Liberties at:(site) Orthogonal if:(is Mover (who at:(to))))) (remove (sites Group at:(site) Orthogonal if:(is Mover (who at:(to))))))))))) (define "SomeSite" (not (all Sites #1 if:(not #2)))) (game "Redstone" (players 2) (equipment { (board (square 13) use:Vertex) (piece "Disc" Each) (piece "Disc" Neutral)}) (rules (meta (swap)) (play (or ("PlaceRed") ("PlaceNonRed"))) (end { (if (and (> (count Moves) 2) (no Pieces Next)) (result Next Loss)) (if (and {(> (count Moves) 2) (no Pieces Mover) (not (no Pieces Next))}) (result Mover Loss))}))) END |
Describe the mechanics of the following Ludii game
(game "Aqrad" (players 2) (equipment { (board (rectangle 7 6)) (hand Each) (piece "Marker" Each ("StepToEmpty" Orthogonal (then ("ReplayIfLine3" Orthogonal exact:True))))}) (rules (start (place "Marker" "Hand" count:18)) phases:{ (phase "Placement" (play (if "SameTurn" "RemoveAnyEnemyPiece" (move (from (handSite Mover)) (to (sites Empty)) (then ("ReplayIfLine3" Orthogonal exact:True))))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) (phase "Movement" (play (if "SameTurn" "RemoveAnyEnemyPiece" (forEach Piece))))} (end ("CaptureAll" Next))))
###
| 7x6 board. Eighteen pieces per player. Players alternate turns placing a piece on the board. When all of the pieces have been placed, players alternate turns moving a piece to an adjacent empty square in an orthogonal direction. When a player places three of their pieces in an orthogonal line, they capture one of the opponent's pieces. The player who captures all of the opponent's pieces wins. END |
Modify the Ludii game according to the following option changes:
A 6x6 board is currently selected -> A 10x10 board is currently selected
A running count of your number of groups is show as a heuristic. -> A running count of (the inverse of) the number of enemy groups is show as a heuristic.
(define "FlipGroupAndCalculateDifference" (do (add (to (sites Group at:(last From) Orthogonal) (apply (remove (to))))) next:(and (set Score P1 (- (count Groups Orthogonal if:(= (id P1) (who at:(to)))) (count Groups Orthogonal if:(= (id P2) (who at:(to)))))) (set Score P2 (- (count Groups Orthogonal if:(= (id P2) (who at:(to)))) (count Groups Orthogonal if:(= (id P1) (who at:(to))))))))) (define "FlipGroupAndCountEnemy" (do (add (to (sites Group at:(last From) Orthogonal) (apply (remove (to))))) next:(and (set Score P1 (* -1 (count Groups Orthogonal if:(= (id P2) (who at:(to)))))) (set Score P2 (* -1 (count Groups Orthogonal if:(= (id P1) (who at:(to))))))))) (define "FlipGroupAndCountFriendly" (do (add (to (sites Group at:(last From) Orthogonal) (apply (remove (to))))) next:(and (set Score P1 (count Groups Orthogonal if:(= (id P1) (who at:(to))))) (set Score P2 (count Groups Orthogonal if:(= (id P2) (who at:(to)))))))) (define "FlipGroup" (add (to (sites Group at:(last From) Orthogonal) (apply (remove (to)))))) (game "Paintbucket" (players 2) (equipment { (board (square 6)) (tile "Square" Each)}) (rules (start { (place "Square1" (sites Phase 0)) (place "Square2" (sites Phase 1)) (set Score P1 (count Sites in:(sites Occupied by:P1))) (set Score P2 (count Sites in:(sites Occupied by:P2)))}) (play (move Select (from (sites Occupied by:Next)) (then ("FlipGroupAndCountFriendly")))) (end ("CaptureAll" Next Loss))))
###
| (define "FlipGroupAndCalculateDifference" (do (add (to (sites Group at:(last From) Orthogonal) (apply (remove (to))))) next:(and (set Score P1 (- (count Groups Orthogonal if:(= (id P1) (who at:(to)))) (count Groups Orthogonal if:(= (id P2) (who at:(to)))))) (set Score P2 (- (count Groups Orthogonal if:(= (id P2) (who at:(to)))) (count Groups Orthogonal if:(= (id P1) (who at:(to))))))))) (define "FlipGroupAndCountEnemy" (do (add (to (sites Group at:(last From) Orthogonal) (apply (remove (to))))) next:(and (set Score P1 (* -1 (count Groups Orthogonal if:(= (id P2) (who at:(to)))))) (set Score P2 (* -1 (count Groups Orthogonal if:(= (id P1) (who at:(to))))))))) (define "FlipGroupAndCountFriendly" (do (add (to (sites Group at:(last From) Orthogonal) (apply (remove (to))))) next:(and (set Score P1 (count Groups Orthogonal if:(= (id P1) (who at:(to))))) (set Score P2 (count Groups Orthogonal if:(= (id P2) (who at:(to)))))))) (define "FlipGroup" (add (to (sites Group at:(last From) Orthogonal) (apply (remove (to)))))) (game "Paintbucket" (players 2) (equipment { (board (square 10)) (tile "Square" Each)}) (rules (start { (place "Square1" (sites Phase 0)) (place "Square2" (sites Phase 1)) (set Score P1 (* -1 (count Sites in:(sites Occupied by:P2)))) (set Score P2 (* -1 (count Sites in:(sites Occupied by:P1))))}) (play (move Select (from (sites Occupied by:Next)) (then ("FlipGroupAndCountEnemy")))) (end ("CaptureAll" Next Loss)))) END |
Construct a Ludii game based on the following description
4x10 board. Forty counters in total. Play begins with one counter in each hole. One player then rearranges these counters however they like, as long as they remain on their side of the board and they remain on the board. They can arrange it so that they capture counters from the opponent's side according to the capture rules. The other player then does the same. Play begins with a player picking up counters from one of the holes with more than one on their side. Counters are sown in an anti-clockwise direction. When the last counter lands in an occupied hole, these counters are picked up and sowing continues until the last counter falls in an empty hole. When the last counter falls into an empty hole, either the turn ends or the player captures. Captures are only made from the inner row; if the corresponding hole in the opponent's inner row holds counters, these are captured; if there are also counters in the corresponding hole in the opponent's outer row, these are also captured. Play continues until one player has nothing left or one player has only single counters in their holes. If the player has no counters left, they have lost. If only single counters remain in a player's holes, they may now move single counters, but only into empty holes. Captures are made in the same way as before.
###
| (define "OnlyHoleWithSingleCounters" (all Sites (sites Mover "Home") if:(>= 1 (count at:(site))))) (define "Columns" 10) (game "Makonn" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "Track1" "0,E,N1,W" loop:True P1) (track "Track2" "20,E,N1,W" loop:True P2)}) (regions "Home" P1 (sites Track "Track1")) (regions "Home" P2 (sites Track "Track2")) (regions "Inner" P1 (difference (sites Track "Track1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "Track2") (sites Top))) (piece "Seed" Shared)}) (rules (start (set Count 1 to:(union (sites P1 "Home") (sites P2 "Home")))) phases:{ (phase "Rearrangement" (play (or (move (from (sites Mover "Home") if:(is Occupied (from))) (to (sites Mover "Home") if:(!= (from) (to))) (then (and (if (and { (!= 1 (value Player Mover)) (is In (last To) (sites Mover "Inner")) (= 1 (count at:(last To)))}) (if (is Occupied ("OppositePit" (last To))) (and { (set Value Mover 1) (remove ("OppositePit" (last To))) (if (is Occupied ("OppositeOuterPit" (last To))) (remove ("OppositeOuterPit" (last To))))}))) (moveAgain)))) (move Pass))) (nextPhase Mover (was Pass) "Sowing")) (phase "Sowing" (play (move Select (from (if ("SameTurn") (sites {(var "Replay")}) (sites Mover "Home")) if:(if ("SameTurn") True (if ("OnlyHoleWithSingleCounters") (is Occupied (from)) (< 1 (count at:(from)))))) (then (sow "Track" owner:(mover) apply:(if (< 1 (count at:(to))) (and (set Var "Replay" (to)) (moveAgain)) (if (is Occupied ("OppositePit" (to))) (and (remove ("OppositePit" (to))) (if (is Occupied ("OppositeOuterPit" (to))) (remove ("OppositeOuterPit" (to))))))))))))} (end (if (all Sites (sites Next "Home") if:(= 0 (count at:(site)))) (result Next Loss))))) END |
Construct a global Ludii definition which fulfills the following requirements.
Makes a player losing when this player has no moves. This ludemeplex can be used only in an ending condition.
###
| (define "ForEachNonMoverNoMovesLoss" (forEach NonMover if:(no Moves Player) (result Player Loss))) END |
Construct a Ludii game based on the following description
5x5 board. Twelve pieces per player. Players alternate turns placing two pieces on the board. The first piece of each player must be placed on a spot adjacent to the central spot. The central spot cannot be filled. When both players have placed their pieces, they move their pieces orthogonally to an empty adjacent space. When an opponent's piece is surrounded on two opposite sides by pieces belonging to the player, the opponent's piece is captured. The player who made the capture may move the same piece they moved to make a capture another time if another capture is possible by doing so.
The player who captures all of their opponent's pieces, or which blocks the opponent from being able to move, wins.
In a case where the second player has created a blockade of their pieces containing one or more of only their own pieces which can move infinitely without possibility of being taken, the second player player may declare H'ajeb in order to regain the possibility of winning. The second player declares H'ajeb on their turn, and then the first player gains the ability to move any distance orthogonally or diagonally. The first player may also make multiple captures not just with the same piece, but with more than one. The second player may rescind the H'ajeb declaration at any time and the captures must stop. If the second player allows the first player to continue until the first player cannot capture, the second player captures any two of the first player's pieces, and the first player captures one of the second player's pieces that is able to move infinitely.
###
| (define "CanCaptureAgain" (can Move (step (from (last To)) Orthogonal (to if:("IsConfigurationToCustodialAgain"))))) (define "IsConfigurationToCustodialAgain" (and (is Empty (to)) (or { (and ("IsEnemyAt" (ahead (to) W)) ("IsFriendAt" (ahead (to) steps:2 W))) (and ("IsEnemyAt" (ahead (to) E)) ("IsFriendAt" (ahead (to) steps:2 E))) (and ("IsEnemyAt" (ahead (to) N)) ("IsFriendAt" (ahead (to) steps:2 N))) (and ("IsEnemyAt" (ahead (to) S)) ("IsFriendAt" (ahead (to) steps:2 S)))}))) (game "Sabou'iyya" (players 2) (equipment { (board (square 5)) (piece "Marker" Each ("StepToEmpty" Orthogonal (then ("CustodialCapture" Orthogonal (max 1) (then (if ("CanCaptureAgain") (moveAgain))))))) (hand Each)}) (rules (start (place "Marker" "Hand" count:12)) phases:{ (phase "Placement" (play (move (from (handSite Mover)) (to (if (= 0 (count Pieces Mover in:(sites Board))) (forEach (sites Around (centrePoint) Orthogonal) if:(is Empty (site))) (difference (sites Board) (centrePoint))) if:(is Empty (to))) (then (if ("NewTurn") (moveAgain))))) (nextPhase Mover (is Empty (handSite Mover)) "Capture")) (phase "Capture" (play (if ("SameTurn") (or (move Step (from (last To)) Orthogonal (to if:("IsConfigurationToCustodialAgain")) (then ("CustodialCapture" Orthogonal (max 1) (then (if ("CanCaptureAgain") (moveAgain)))))) (move Pass)) (forEach Piece))))} (end ("BlockWin")))) END |
Describe the mechanics of the following Ludii game
(game "Round Merels" (players 2) (equipment { (board (concentric {1 8}) use:Vertex) (hand Each) (piece "Marker" Each "StepToEmpty")}) (rules (start (place "Marker" "Hand" count:3)) phases:{ (phase "Placement" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase ("HandEmpty" P2) "Movement")) ("PhaseMovePiece" "Movement")} (end (if (is Line 3 through:(centrePoint) what:(mover)) (result Mover Win)))))
###
| Eight spots arranged in a circle around a central spot. Opposite spots are connected by a diameter through the central spot. The rules are describing with the Blumlein ruleset. END |
Modify the Ludii game according to the following option changes:
0 or 6 mouths correspond to 11. -> 0 or 6 mouths correspond to 12.
(define "RemovePiece" (apply (if ("IsEnemyAt" (to)) (remove (to))))) (define "CanMove" (= (value Player Mover) 1)) (define "AllowToBegin" (is In (count Pips) (sites {0 1 5 6}))) (game "Awangdu" (players 2) (equipment { (board (rectangle 5 12) { (track "Track1" "0,E,N1,W,N1,E,N1,W,N1,E" P1 directed:True) (track "Track2" "59,W,S1,E,S1,W,S1,E,S1,W" P2 directed:True)} use:Vertex) ("StickDice" 6) (piece "Disc" Each (if (not ("IsFriendAt" ("NextSiteOnTrack" (mapEntry (var))))) (move (from) (to ("NextSiteOnTrack" (mapEntry (var))) ("RemovePiece"))))) (map {(pair 0 11) (pair 1 1) (pair 2 2) (pair 3 3) (pair 4 4) (pair 5 1) (pair 6 11)})}) (rules (start { (place "Disc1" (sites Bottom)) (place "Disc2" (sites Top))}) (play ("RollMove" (if (or ("CanMove") ("AllowToBegin")) (do (set Var (count Pips)) next:(forEach Piece (then (if (not ("CanMove")) (set Value Mover 1)))))))) (end ("HavingLessPiecesLoss" Next 2))))
###
| (define "RemovePiece" (apply (if ("IsEnemyAt" (to)) (remove (to))))) (define "CanMove" (= (value Player Mover) 1)) (define "AllowToBegin" (is In (count Pips) (sites {0 1 5 6}))) (game "Awangdu" (players 2) (equipment { (board (rectangle 5 12) { (track "Track1" "0,E,N1,W,N1,E,N1,W,N1,E" P1 directed:True) (track "Track2" "59,W,S1,E,S1,W,S1,E,S1,W" P2 directed:True)} use:Vertex) ("StickDice" 6) (piece "Disc" Each (if (not ("IsFriendAt" ("NextSiteOnTrack" (mapEntry (var))))) (move (from) (to ("NextSiteOnTrack" (mapEntry (var))) ("RemovePiece"))))) (map {(pair 0 12) (pair 1 1) (pair 2 2) (pair 3 3) (pair 4 4) (pair 5 1) (pair 6 12)})}) (rules (start { (place "Disc1" (sites Bottom)) (place "Disc2" (sites Top))}) (play ("RollMove" (if (or ("CanMove") ("AllowToBegin")) (do (set Var (count Pips)) next:(forEach Piece (then (if (not ("CanMove")) (set Value Mover 1)))))))) (end ("HavingLessPiecesLoss" Next 2)))) END |
Construct a Ludii game based on the following description
3x3 intersecting lines, with triangles extending on opposite ends of the large square and the central line extending to the apices. One player plays as the notched stick, called the hare, and the other as three sharp sticks, known as the hounds. Players alternate turns placing a piece on the board. When a player has placed all of their pieces on the board, they move one of their pieces to an empty adjacent spot along the lines. When the hounds block the hare from being able to move, the hounds win. The game has an ending condition only for P1.
###
| (game "Janes Soppi" (players 2) (equipment { (board (merge { (rectangle 3 3) (shift 1.5 0.5 (rotate -90 (wedge 2))) (shift -1.5 0.5 (rotate 90 (wedge 2)))}) use:Vertex) (hand Each) (piece "Hound" P1 "StepToEmpty") (piece "Hare" P2 "StepToEmpty")}) (rules (start { (place "Hound1" (handSite P1) count:3) (place "Hare2" (handSite P2))}) phases:{ (phase "Placement" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) ("PhaseMovePiece" "Movement")} (end { (if (no Moves P2) (result P1 Win))}))) END |
Construct a Ludii game based on the following description
A player may remove one or more adjacent pieces from a row or column. The loser is the person who takes the last piece off the board.
###
| (game "TacTix" (players 2) (equipment { (board (square 4)) (piece "Ball" Shared)}) (rules (start (place "Ball" (sites Board))) (play (if ("SameTurn") (or (if (= 1 (count MovesThisTurn)) (move Select (from (last To)) (to (intersection (sites Around (last To) Orthogonal) (sites Occupied by:Shared))) (then (and (remove (last To)) (if (and (is Occupied (ahead (last To) ("LastDirection" Cell))) (!= (last To) (ahead (last To) ("LastDirection" Cell)))) (moveAgain))))) (move Select (from (last To)) (to (ahead (last To) ("LastDirection" Cell))) (then (and (remove (last To)) (if (and (is Occupied (ahead (last To) ("LastDirection" Cell))) (!= (last To) (ahead (last To) ("LastDirection" Cell)))) (moveAgain)))))) (move Pass)) (move Remove (sites Board) (then (if (not (all Sites (sites Around (last To) Orthogonal) if:(is Empty (site)))) (moveAgain)))))) (end ("NoMoves" Win)))) END |
Construct a Ludii game based on the following description
DROP - Each stone is dropped on an empty cell, next to and below a stone of the same color
MOVE - First player drops one stone at the first turn, then each player drops up to two stones (he may pass).
GOAL - Wins the player with more stones on the bottom row.
###
| (define "PlaceStone" (move Add (to (union (sites Around (sites Occupied by:Mover) SSW) (sites Around (sites Occupied by:Mover) SSE)) if:(is Empty (to))) #1)) (game "Cascades" (players 2) (equipment { (board (remove (hex Triangle 15) cells:{92..119} vertices:{223..285})) (piece "Ball" Each) (hand Each)}) (rules (start { (place "Ball1" (forEach (sites Top) if:(is Even (site)))) (place "Ball2" (forEach (sites Top) if:(is Odd (site))))}) phases:{ (phase "FirstMove" (play ("PlaceStone")) (nextPhase "Main")) (phase "Main" (play (or ("PlaceStone" (then (if ("NewTurn") (moveAgain)))) (if ("SameTurn") (move Pass)))))} (end (if (and (no Moves P1) (no Moves P2)) (byScore { (score P1 (count Sites in:(forEach (sites Bottom) if:(= (who at:(site)) P1)))) (score P2 (count Sites in:(forEach (sites Bottom) if:(= (who at:(site)) P2))))}))))) END |
Construct a Ludii game based on the following description
Two rows of six holes. Each player has 7 holes.
###
| (define "PiecesOwnedBy" (count Cell at:(handSite #1))) (game "Mangala (Turkey)" (players 2) (equipment { (mancalaBoard 2 7 store:None (track "Track" "0,E,N,W" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece "Seed" Shared) (hand Each)}) (rules (start (set Count 5 to:(sites Track))) (play (move Select (from (sites Mover) if:(> (count at:(from)) 0)) (then (sow if:(or (= (count at:(to)) 1) (= (count at:(to)) 3)) apply:(fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))) backtracking:True)))) (end ("MancalaByScoreWhen" (= (count in:(sites Track)) 0))))) END |
Construct a Ludii game based on the following description
Three concentric squares, with lines connecting the midpoints and diagonals of the squares. Twelve pieces per player. Players alternate turns placing one of their pieces on the board. When all of the pieces are placed, the pieces may be moved to an empty adjacent spot on the board. One player wins by placing three of their pieces in a row. The other player wins by blocking their opponent from being able to move. Player 1 wins by blocking.
###
| (game "Niranchy" (players 2) (equipment { (board (concentric Square rings:3 joinCorners:True) use:Vertex) (hand Each) (piece "Marker" Each ("StepToEmpty"))}) (rules (start (place "Marker" "Hand" count:12)) phases:{ (phase "Placement" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) ("PhaseMovePiece" "Movement")} (end { (if (no Moves P2) (result P1 Win)) (if (is Line 3 P2) (result P2 Win))}))) END |
Construct a Ludii game based on the following description
Claim Jumpers is a 2-player strategy game
It may be played:
-- on a hex grid
-- on a square grid
-- on a square plus diagonal grid
The goal is to maximize your pieces when the board is full.
A new piece is placed at the beginning of each turn. Followed, if possible, by a chain of forced jumps made by a different piece, that capture by 'flipping' the jumped opponent to your own color.
The board starts empty. Turns alternate starting with White.
Game ends when the board is full. No passing.
Maximum captures are not required, but the piece choen to capture must capture at least one, and maynot stop capturing as long as it is able to capture the next adjacent opponent's piece. Board & size: Equiversi Hexhex with edges alternating 3 and 5
###
| (define "Tri78Bug" (tri {7 8 7 10 6})) (define "Tri57Bug" (tri {5 7 5 8 5})) (define "Tri56Bug" (tri {5 6 5 7 5})) (define "Tri46Bug" (tri {4 6 4 7 4})) (define "EndCondition" (or {(no Moves Next) (all Passed)})) (define "Placement" (do (forget Value All) next:(move Add (piece (id "Disc" Mover)) (to (sites Empty)) (then (if (can Move ("OpponentHop" (from if:(!= (from) (last To))))) (moveAgain)))))) (define "ForcedHop" (if (= 0 (size Array (values Remembered))) ("OpponentHop" (from if:(!= (from) (last To)))) ("OpponentHop" (from if:(= (from) (last To)))))) (define "OpponentHop" (forEach Piece (move Hop #1 Orthogonal (between if:("IsAJumpableSite") (apply (set Pending (between)))) (to if:(is Empty (to))) (then (and { (remember Value (value Pending)) (remove (value Pending)) (add (piece (id "Disc" Mover)) (to (value Pending)))} (then (and { (set Pending) (if ("CanHop" (from (last To))) (moveAgain))}))))))) (define "CanHop" (can Move (forEach Piece (move Hop #1 Orthogonal (between if:("IsAJumpableSite")) (to if:(is Empty (to))))))) (define "IsAJumpableSite" (is In (between) (difference (sites Occupied by:Next) (sites (values Remembered))))) (define "SameTurn" (is Prev Mover)) (game "Claim Jumpers" (players 2) (equipment { (board (tri {3 5 3 5 3}) use:Vertex) (piece "Disc" Each)}) (rules (start (set Score Each 0)) (play (if ("SameTurn") ("ForcedHop") ("Placement") (then (and (set Score Mover (count Pieces Mover)) (set Score Next (count Pieces Next)))))) (end { (if (and "EndCondition" (= (score Mover) (score Next))) (result Mover Win)) (if (and "EndCondition" (!= (score Mover) (score Next))) (byScore))}))) END |
Construct a Ludii game based on the following description
Players take turns moving one of their pieces to an adjacent empty point, forwards or sideways. A piece can hop over an adjacent enemy piece to an empty point immeidately beyond it, forwards or sideways, and must do so if possible. Only one hope per turn is allowed. If a piece reaches the far point of the board, it is promoted to a king which can also move and hop backwards. Win by eliminating all enemy pieces. The game is drawn if both players are reduced to a single king.
###
| (define "MoveChoice" (or (forEach Piece "Counter" #1 (then ("PromoteIfReach" (sites Mover) "DoubleCounter"))) (forEach Piece "DoubleCounter" #2))) (define "StepToEmptyForwards" ("StepToEmpty" (directions {Forwards Rightward Leftward} bySite:True))) (define "HopCaptureForwards" ("HopCapture" ~ (directions {Forwards Rightward Leftward} bySite:True))) (game "Game of Solomon" ("TwoPlayersNorthSouth") (equipment { (board (renumber (splitCrossings (add (regular Star 6) edges:{{0 5} {1 4} {2 3}}))) use:Vertex) (piece "Counter" Each) (piece "DoubleCounter" Each) (regions "Palace1" P1 (sites {"E7"})) (regions "Palace2" P2 (sites {"E1"}))}) (rules (start { (place "Counter1" (sites {"E1" "A2" "D2" "E2" "F2" "I2"})) (place "Counter2" (sites {"E7" "A6" "D6" "E6" "F6" "I6"}))}) (play (priority { ("MoveChoice" "HopCaptureForwards" "HopCapture") ("MoveChoice" "StepToEmptyForwards" "StepToEmpty")})) (end { ("BlockWin") (if (and { (= 1 (count Pieces P1)) (= 1 (count Pieces P2)) (= 1 (count Pieces P1 "DoubleCounter")) (= 1 (count Pieces P2 "DoubleCounter"))}) (result Mover Draw))}))) END |
Construct a Ludii game based on the following description
2x12 board, with the spaces rendered as points, divided into half. Fifteen pieces per player, which begin on the rightmost point, with respect to the player, on the opposite side of the board from which they sit. Two six-sided dice. Pieces move according to the throws of the dice, the value of a die being used to move a piece the entire value of the die. A throw of double sixes makes the player play six twice, then five twice, then four twice, and so on down to one. A throw of double fives forces the player to play five twice and then six twice. A throw of double four, three, or two forces the player to play two of that number, down to one. A play of double ones forces the player to play one twice, then two twice, up to six. More than two pieces of the same player may not occupy a point on the starting side of the board. The player cannot move past the penultimate point on the opposite side of the board until five pieces have been moved from the starting point. A single opponent's piece may be removed from the board when a player's piece lands on it, and the opponent's piece must reenter the board. Pieces cannot move to a point occupied by two opponent's piece. A piece cannot reenter the board on a point occupied by another piece, whether belonging to the player or the opponent. When all of a player's pieces have reached the final quadrant of the board, the player may begin to remove them from the table. The player who bears off their pieces scores two points.
###
| (define "PlayMove" (if (>= 0 (value Player Mover)) ("RollEachNewTurnMove" (if (all DiceEqual) (or ("SpecialEnterPieces" ("DieValue")) (forEach Piece ("SpecialMove" ("DieValue")) top:True) (then (and { (moveAgain) (set Var "FirstPlay" 1) (set Value Mover ("DieValue")) (set Var "DoubleToPlay" ("DieValue"))}))) (or ("EnterPieces") (forEach Piece top:True)))) (or ("SpecialEnterPieces" (var "DoubleToPlay")) (forEach Piece ("SpecialMove" (var "DoubleToPlay")) top:True) (then (and { (if (or (= (value Player Mover) 1) (= (value Player Mover) 5)) (if (!= (var "FirstPlay") 1) (and (set Var "DoubleToPlay" (var "DoubleToPlay")) (moveAgain)) (if (!= 6 (var "DoubleToPlay")) (and (set Var "DoubleToPlay" (+ (var "DoubleToPlay") 1)) (moveAgain)) (and (set Var "DoubleToPlay" 0) (set Value Mover 0)))) (if (!= (var "FirstPlay") 1) (and (set Var "DoubleToPlay" (var "DoubleToPlay")) (moveAgain)) (if (!= 1 (var "DoubleToPlay")) (and (set Var "DoubleToPlay" (- (var "DoubleToPlay") 1)) (moveAgain)) (and (set Var "DoubleToPlay" 0) (set Value Mover 0))))) (if (!= (var "FirstPlay") 1) (set Var "FirstPlay" 1) (set Var "FirstPlay" 0))}))) (then (if (no Pieces Mover) (set Score Mover 2))))) (define "SpecialEnterPieces" (if (is Occupied (handSite Mover)) (move (from (handSite Mover)) (to ("NextSiteFrom" (mapEntry "Entry" Mover) (- #1 1)) if:(is Empty (to)))))) (define "SpecialMove" ("CommonMove" #1)) (define "Move" (forEach Die replayDouble:True if:("DieNotUsed") ("CommonMove" (pips)) (then ("ReplayNotAllDiceUsed")))) (define "CommonMove" (if ("IsEndTrack" ("NextSiteFrom" (from) #1)) (if ("AllPiecesInFinalQuadrant") (move Remove (from))) (move (from (from)) (to ("NextSiteFrom" (from) #1) if:(and { ("NoEnemyOrOnlyOne" (to)) (if (not (is In (to) (sites Mover "StartingSide"))) True (> 2 (size Stack at:(to)))) (if (not (is In (to) (sites Mover "AfterPenultimate"))) True (>= 10 (count Pieces in:(sites {(handSite Mover) (mapEntry "Entry" Mover)}))))}) ("HittingCapture" (handSite Next)))))) (define "EnterPieces" (if (is Occupied (handSite Mover)) (forEach Die replayDouble:True if:("DieNotUsed") (move (from (handSite Mover)) (to ("NextSiteFrom" (mapEntry "Entry" Mover) (- (pips) 1)) if:(is Empty (to)))) (then ("ReplayNotAllDiceUsed"))))) (define "AllPiecesInFinalQuadrant" ("AllOwnedPiecesIn" (sites Mover "FinalQuadrant"))) (define "DieValue" (face 28)) (define "NextSiteFrom" ("NextSiteOnTrack" #2 from:#1)) (game "Piprjall" (players 2) (equipment { ("BackgammonBoard" { (track "Track1" {25..20 18..13 0..5 7..12 End} P1 directed:True) (track "Track2" {0..5 7..12 25..20 18..13 End} P2 directed:True)}) (dice d:6 num:2) (piece "Disc" Each ("Move")) (hand Each) (regions "FinalQuadrant" P1 (sites {7..12})) (regions "FinalQuadrant" P2 (sites {13..18})) (regions "StartingSide" P1 (sites {25..20 18..13})) (regions "StartingSide" P2 (sites {0..5 7..12})) (regions "AfterPenultimate" P1 (sites {12})) (regions "AfterPenultimate" P2 (sites {13})) (map "Entry" {(pair P1 25) (pair P2 0)})}) (rules (start { (place Stack "Disc1" 25 count:15) (place Stack "Disc2" 0 count:15)}) (play (if (can Move ("PlayMove")) ("PlayMove") (move Pass (then (and { (set Value Mover 0) (set Var "FirstPlay" 0) (set Var "DoubleToPlay" 0)}))))) (end ("EscapeWin")))) END |
Modify the Ludii game according to the following option changes:
Order 13, Square Ortho-Grid -> Order 19, Square Ortho-Grid
(define "GridDirection" Orthogonal) (define "AddOrPass" (or { (move Add (piece (id "Disc" Mover)) (to (sites Empty) if:(> 3 (count Pieces Mover in:(sites Around (to) "GridDirection")))) (then (set Var "Added" 1))) (move Pass)})) (define "Score4" (do (forEach Site (sites Occupied by:#1) (if (> 3 (count Pieces #1 in:(sites Around (site) "GridDirection"))) (set State at:(site) 0) (set State at:(site) 1))) next:(do (and { (remember Value 0) (remember Value 0) (forEach Group "GridDirection" (if (no Pieces in:(intersection (sites) (sites State 1))) (remember Value (count Sites in:(sites)))))}) next:(set Var "TopValue" (max (values Remembered)) (then (forget Value (max (values Remembered)) (then (set Score #1 (* (var "TopValue") (max (values Remembered))) (then (forget Value All)))))))))) (define "GridDirection" Orthogonal) (game "Wrigglers Squared" (players 2) (equipment { (board (square 13) use:Vertex) (piece "Disc" Each)}) (rules (play (if (= 1 (var "Added")) (or { "AddOrPass" (forEach Piece (if (< 2 (count Pieces Mover in:(sites Around (from) "GridDirection"))) (move Remove (from) (then (set Var "Added" 0)))) Mover)}) "AddOrPass" (then ("Score4" Mover)))) (end (if (all Passed) { (if (>= (score Mover) (score Next)) (result Mover Win))} (result Next Win)))))
###
| (define "GridDirection" Orthogonal) (define "AddOrPass" (or { (move Add (piece (id "Disc" Mover)) (to (sites Empty) if:(> 3 (count Pieces Mover in:(sites Around (to) "GridDirection")))) (then (set Var "Added" 1))) (move Pass)})) (define "Score4" (do (forEach Site (sites Occupied by:#1) (if (> 3 (count Pieces #1 in:(sites Around (site) "GridDirection"))) (set State at:(site) 0) (set State at:(site) 1))) next:(do (and { (remember Value 0) (remember Value 0) (forEach Group "GridDirection" (if (no Pieces in:(intersection (sites) (sites State 1))) (remember Value (count Sites in:(sites)))))}) next:(set Var "TopValue" (max (values Remembered)) (then (forget Value (max (values Remembered)) (then (set Score #1 (* (var "TopValue") (max (values Remembered))) (then (forget Value All)))))))))) (define "GridDirection" Orthogonal) (game "Wrigglers Squared" (players 2) (equipment { (board (square 19) use:Vertex) (piece "Disc" Each)}) (rules (play (if (= 1 (var "Added")) (or { "AddOrPass" (forEach Piece (if (< 2 (count Pieces Mover in:(sites Around (from) "GridDirection"))) (move Remove (from) (then (set Var "Added" 0)))) Mover)}) "AddOrPass" (then ("Score4" Mover)))) (end (if (all Passed) { (if (>= (score Mover) (score Next)) (result Mover Win))} (result Next Win))))) END |
Modify the Ludii game according to the following option changes:
Each player has 14 holes. -> Each player has 16 holes.
(define "PiecesOwnedBy" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (define "MoveAgainAfterCapture" (is Pending)) (define "PlayFromNextHole" (sites {(value Pending)})) (define "NextHole" ("NextSiteOnTrack" 1 from:(to) "Track")) (define "Columns" 14) (game "Hus (Damara)" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "Track1" "0,E,N1,W" loop:True P1) (track "Track2" "28,E,N1,W" loop:True P2)}) (regions "Home" P1 (sites Track "Track1")) (regions "Home" P2 (sites Track "Track2")) (regions "Inner" P1 (difference (sites Track "Track1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "Track2") (sites Top))) (regions "Outer" P1 (sites Bottom)) (regions "Outer" P2 (sites Top)) (piece "Seed" Shared) (hand Each)}) (rules (start (set Count 2 to:(union { (expand (intersection (sites Row 1) (sites Right)) steps:3 W) (expand (intersection (sites Row 2) (sites Left)) steps:3 E) (sites P1 "Outer") (sites P2 "Outer")}))) (play (move Select (from (if ("SameTurn") (if "MoveAgainAfterCapture" "PlayFromNextHole" "LastHoleSowed") (sites Mover "Home")) if:(> (count at:(from)) 0)) (then (sow "Track" owner:(mover) apply:(if (> (count at:(to)) 1) (if (and { (is In (to) (sites Mover "Inner")) (> (count at:("OppositePit" (to))) 0) (> (count at:("OppositeOuterPit" (to))) 0)}) (and { (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))) (fromTo (from ("OppositePit" (to))) (to (handSite Mover)) count:(count at:("OppositePit" (to)))) (fromTo (from ("OppositeOuterPit" (to))) (to (handSite Mover)) count:(count at:("OppositeOuterPit" (to)))) (if (> (count at:"NextHole") 1) (and (set Pending "NextHole") (moveAgain)))}) (moveAgain))))))) (end ("MancalaByScoreWhen" (no Moves Mover)))))
###
| (define "PiecesOwnedBy" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (define "MoveAgainAfterCapture" (is Pending)) (define "PlayFromNextHole" (sites {(value Pending)})) (define "NextHole" ("NextSiteOnTrack" 1 from:(to) "Track")) (define "Columns" 16) (game "Hus (Damara)" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "Track1" "0,E,N1,W" loop:True P1) (track "Track2" "32,E,N1,W" loop:True P2)}) (regions "Home" P1 (sites Track "Track1")) (regions "Home" P2 (sites Track "Track2")) (regions "Inner" P1 (difference (sites Track "Track1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "Track2") (sites Top))) (regions "Outer" P1 (sites Bottom)) (regions "Outer" P2 (sites Top)) (piece "Seed" Shared) (hand Each)}) (rules (start (set Count 2 to:(union { (expand (intersection (sites Row 1) (sites Right)) steps:3 W) (expand (intersection (sites Row 2) (sites Left)) steps:3 E) (sites P1 "Outer") (sites P2 "Outer")}))) (play (move Select (from (if ("SameTurn") (if "MoveAgainAfterCapture" "PlayFromNextHole" "LastHoleSowed") (sites Mover "Home")) if:(> (count at:(from)) 0)) (then (sow "Track" owner:(mover) apply:(if (> (count at:(to)) 1) (if (and { (is In (to) (sites Mover "Inner")) (> (count at:("OppositePit" (to))) 0) (> (count at:("OppositeOuterPit" (to))) 0)}) (and { (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))) (fromTo (from ("OppositePit" (to))) (to (handSite Mover)) count:(count at:("OppositePit" (to)))) (fromTo (from ("OppositeOuterPit" (to))) (to (handSite Mover)) count:(count at:("OppositeOuterPit" (to)))) (if (> (count at:"NextHole") 1) (and (set Pending "NextHole") (moveAgain)))}) (moveAgain))))))) (end ("MancalaByScoreWhen" (no Moves Mover))))) END |
Modify the Ludii game according to the following option changes:
A triangular board is currently selected -> A diamond shaped board is currently selected
A size 3 board is currently selected -> A size 4 board is currently selected
The currently selected star cells are the perimeter cells cells -> The currently selected star cells are the corner cells
The 12* placement protocol is currently in force -> No balance rule is currently in force
(define "StarCells" (sites Outer)) (game "Omny" (players 2) (equipment { (board (hex Triangle 3)) (piece "Disc" Each)}) (rules (play (if (= 1 (var)) (or (move Swap Players P1 P2) (move Add (to (sites Empty)) (then (set Var 0)))) (move Add (to (sites Empty)) (then (if (= 1 (% (+ 1 (count Moves)) 2)) (moveAgain)))))) (end (if (>= (count Sites in:("StarCells")) (max (results from:(difference (sites Board) (sites Group at:(last To))) to:2 (* (to) (count Sites in:(intersection ("StarCells") (sites Group at:(from) if:(not (is In (to) (sites Group at:(last To))))))))))) (result Mover Win)))))
###
| (define "StarCells" (sites Corners)) (game "Omny" (players 2) (equipment { (board (hex Diamond 4)) (piece "Disc" Each)}) (rules (play (if (= 1 (var)) (or (move Swap Players P1 P2) (move Add (to (sites Empty)) (then (set Var 0)))) (move Add (to (sites Empty))))) (end (if (>= (count Sites in:("StarCells")) (max (results from:(difference (sites Board) (sites Group at:(last To))) to:2 (* (to) (count Sites in:(intersection ("StarCells") (sites Group at:(from) if:(not (is In (to) (sites Group at:(last To))))))))))) (result Mover Win))))) END |
Construct a Ludii game based on the following description
2x6 board. Four counters in each hole. Sowing proceeds in an anti-clockwise direction. When the final counter of a sowing lands in an occupied hole, the counters are picked up and sowing continues. When the final counter lands in an occupied hole in the player's own row causing it to contain four counters, these are captured and the turn ends. If the final counter falls into an empty hole, the turn ends. If at any point in the sowing a hole in the player's own row is made to contain four counters, they are taken. When there are only eight counters left on the board, the first player to make four counters in a hole captures all the remaining counters. At the end of the game, players place their captured counters four by four into the remaining holes. Players may thus capture holes from the opponent's row, one for every four counters placed in a hole. They may capture from these holes in the next round. Play continues until one player owns no holes.
###
| (define "EightPiecesOnBoard" (>= 8 (count Pieces All in:(sites Board)))) (define "RemmemberOwnedHoles" (if (is Mover P1) (remember Value "OwnedP1" #1) (remember Value "OwnedP2" #1))) (define "OwnedHoles" (if (is Mover P1) (sites (values Remembered "OwnedP1")) (sites (values Remembered "OwnedP2")))) (game "J'erin" (players 2) (equipment { (mancalaBoard 2 6 store:None (track "Track" "0,E,N,W" loop:True)) (piece "Seed" Shared) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (hand Each)}) (rules (start { (set Count 4 to:(sites Track)) (set RememberValue "OwnedP1" (sites Bottom)) (set RememberValue "OwnedP2" (sites Top))}) phases:{ (phase "Sowing" (play (or { (move Select (from (if ("SameTurn") ("LastHoleSowed") ("OwnedHoles")) if:(< 0 (count at:(from)))) (then (do (set Var "NumSowed" (count at:(last To))) next:(if (and ("EightPiecesOnBoard") (not (all Sites (sites Track from:("NextSiteOnTrack" 1 from:(last From) "Track") to:("NextSiteOnTrack" (var "NumSowed") from:(last From) "Track")) if:(!= 3 (count at:(site)))))) (forEach Site (sites Board) (if (is Occupied (site)) (fromTo (from (site)) (to Cell (handSite Mover)) count:(count at:(site))))) (sow apply:(if (if (= 4 (count at:(to))) (not (is In (to) ("OwnedHoles"))) (!= 0 (count at:(to)))) (moveAgain))) (then (and (forEach Site (intersection ("OwnedHoles") (sites Track from:(last From) to:(trackSite Move from:(last From) "Track" steps:(var "NumSowed")))) (if (= 4 (count at:(site))) (fromTo (from (site)) (to (handSite Mover)) count:4))) (set Var "NumSowed" 0)))))))} (then (if ("NoPieceOnBoard") (and (forget Value "OwnedP1" All) (forget Value "OwnedP2" All)))))) (end (if ("NoPieceOnBoard") { (if (> 4 (count Cell at:(handSite P1))) (result P2 Win)) (if (> 4 (count Cell at:(handSite P2))) (result P1 Win))})) (nextPhase ("NoPieceOnBoard") "BetweenRounds")) (phase "BetweenRounds" (play (if (<= 4 (count Cell at:(handSite Mover))) (if (not (all Sites (sites Mover) if:(is Occupied (site)))) (move (from (handSite Mover)) (to (sites Mover) if:(is Empty (to))) count:4 (then ("RemmemberOwnedHoles" (last To)))) (move (from (handSite Mover)) (to (sites Board) if:(is Empty (to))) count:4 (then ("RemmemberOwnedHoles" (last To))))))) (nextPhase (and (> 4 (count Cell at:(handSite P1))) (> 4 (count Cell at:(handSite P2)))) "Sowing"))})) END |
Modify the Ludii game according to the following option changes:
The game start with a special starting position. -> The game start with a special starting position.
(define "LastHole" (last To afterConsequence:True)) (define "NextHole" ("NextSiteOnTrack" 1 from:#1 "TrackCCW")) (define "InnerPitsWithPossibleCapture" (forEach (difference (sites Mover "Inner") (sites Empty)) if:(is Occupied ("OppositePit" (site))))) (define "InnerPit" (if (is Mover P1) (- #1 "Columns") (+ #1 "Columns"))) (define "EmptyOuterRow" (all Sites (sites #1 "Outer") if:(= 0 (count at:(site))))) (define "Columns" 7) (game "Kisolo" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "TrackCCW1" "0,E,N1,W" loop:True P1) (track "TrackCCW2" "14,E,N1,W" loop:True P2)}) (regions "Home" P1 (sites Track "TrackCCW1")) (regions "Home" P2 (sites Track "TrackCCW2")) (regions "Inner" P1 (difference (sites Track "TrackCCW1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "TrackCCW2") (sites Top))) (regions "Outer" P1 (difference (sites Track "TrackCCW1") (sites P1 "Inner"))) (regions "Outer" P2 (difference (sites Track "TrackCCW2") (sites P2 "Inner"))) (piece "Seed" Shared)}) (rules (start { (set Count 15 to:(sites {"G1" "A4"})) (set Count 1 to:(sites {"F2" "D2" "B2" "A1" "C1" "E1" "B3" "D3" "F3" "G4" "E4" "C4"}))}) (play (if (and (or (= 0 (count MovesThisTurn)) (is In 1 (sites Pending))) (!= 0 (count Sites in:(("InnerPitsWithPossibleCapture"))))) (move Select (from ("InnerPitsWithPossibleCapture")) (then (and { (fromTo (from ("OppositePit" (last To))) (to ("InnerPit" (last To)))) (if (is Occupied ("OppositeOuterPit" (last To))) (fromTo (from ("OppositeOuterPit" (last To))) (to ("InnerPit" (last To))))) (moveAgain)} (then (if (!= 0 (count Sites in:(("InnerPitsWithPossibleCapture")))) (set Pending 1)))))) (move Select (from (if (and (is In 2 (sites Pending)) ("SameTurn")) (sites {("NextHole" "LastHole")}) (sites Mover "Home")) if:(> (count at:(from)) 0)) (then (sow "TrackCCW" owner:(mover) apply:(if (is Occupied ("NextHole" (to))) (and { (if (and (is In ("NextHole" (to)) (sites Mover "Inner")) (is Occupied ("OppositePit" ("NextHole" (to))))) (and (fromTo (from ("OppositePit" ("NextHole" (to)))) (to ("InnerPit" ("NextHole" (to))))) (if (is Occupied ("OppositeOuterPit" ("NextHole" (to)))) (fromTo (from ("OppositeOuterPit" ("NextHole" (to)))) (to ("InnerPit" ("NextHole" (to)))))))) (moveAgain) (set Pending 2)}))))))) (end (forEach Player if:("EmptyOuterRow" Player) (result Player Loss)))))
###
| (define "LastHole" (last To afterConsequence:True)) (define "NextHole" ("NextSiteOnTrack" 1 from:#1 "TrackCCW")) (define "InnerPitsWithPossibleCapture" (forEach (difference (sites Mover "Inner") (sites Empty)) if:(is Occupied ("OppositePit" (site))))) (define "InnerPit" (if (is Mover P1) (- #1 "Columns") (+ #1 "Columns"))) (define "EmptyOuterRow" (all Sites (sites #1 "Outer") if:(= 0 (count at:(site))))) (define "Columns" 7) (game "Kisolo" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "TrackCCW1" "0,E,N1,W" loop:True P1) (track "TrackCCW2" "14,E,N1,W" loop:True P2)}) (regions "Home" P1 (sites Track "TrackCCW1")) (regions "Home" P2 (sites Track "TrackCCW2")) (regions "Inner" P1 (difference (sites Track "TrackCCW1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "TrackCCW2") (sites Top))) (regions "Outer" P1 (difference (sites Track "TrackCCW1") (sites P1 "Inner"))) (regions "Outer" P2 (difference (sites Track "TrackCCW2") (sites P2 "Inner"))) (piece "Seed" Shared)}) (rules (start { (set Count 9 to:(sites {"A1" "G4" "A4" "G1"})) (set Count 1 to:(sites {"F2" "D2" "B2" "B3" "D3" "F3"}))}) (play (if (and (or (= 0 (count MovesThisTurn)) (is In 1 (sites Pending))) (!= 0 (count Sites in:(("InnerPitsWithPossibleCapture"))))) (move Select (from ("InnerPitsWithPossibleCapture")) (then (and { (fromTo (from ("OppositePit" (last To))) (to ("InnerPit" (last To)))) (if (is Occupied ("OppositeOuterPit" (last To))) (fromTo (from ("OppositeOuterPit" (last To))) (to ("InnerPit" (last To))))) (moveAgain)} (then (if (!= 0 (count Sites in:(("InnerPitsWithPossibleCapture")))) (set Pending 1)))))) (move Select (from (if (and (is In 2 (sites Pending)) ("SameTurn")) (sites {("NextHole" "LastHole")}) (sites Mover "Home")) if:(> (count at:(from)) 0)) (then (sow "TrackCCW" owner:(mover) apply:(if (is Occupied ("NextHole" (to))) (and { (if (and (is In ("NextHole" (to)) (sites Mover "Inner")) (is Occupied ("OppositePit" ("NextHole" (to))))) (and (fromTo (from ("OppositePit" ("NextHole" (to)))) (to ("InnerPit" ("NextHole" (to))))) (if (is Occupied ("OppositeOuterPit" ("NextHole" (to)))) (fromTo (from ("OppositeOuterPit" ("NextHole" (to)))) (to ("InnerPit" ("NextHole" (to)))))))) (moveAgain) (set Pending 2)}))))))) (end (forEach Player if:("EmptyOuterRow" Player) (result Player Loss))))) END |
Construct a Ludii game based on the following description
MOVE - A stone can move up to N spaces in any combination of directions (it may even move over intervening stones), where N varies depending on the number of stones he has remaining:
- Six pieces: one space per turn
- Five pieces: two spaces per turn
- Four pieces: three spaces per turn
- Three pieces: four spaces per turn
- Two pieces: five spaces per turn
- One piece: six spaces per turn.
CAPTURE - A stone captures an opposing piece by moving onto it. If a stone makes a capture before it has used all of the spaces available to it that move, it may continue to make additional captures until it has moved its limit.
GOAL - Wins the player who captures all of his opponent's stones, or, if he reduces his opponent to a single stone without losing any of his own.
###
| (define "PieceMovement" (move Slide #1 (between (max ("RemainingMove")) if:(not ("IsEnemyAt" (between)))) (to if:("IsEnemyAt" (to)) (apply if:(not ("IsFriendAt" (to))) (if ("IsEnemyAt" (to)) (remove (to) (then (set Value Next (+ (value Player Next) 1))))))) (then (if (<= (- ("RemainingMove") (count Steps (last From) (last To))) 0) (set Value Mover (- 7 (count Pieces Mover))) (and (set Value Mover (- ("RemainingMove") (count Steps (last From) (last To)))) (moveAgain)))))) (define "RemainingMove" (if (= Undefined (value Player Mover)) 1 (value Player Mover))) (game "Annuvin" (players 2) (equipment { (board (rotate 30 (hex 4))) (piece "Ball" Each ("PieceMovement")) (hand Each)}) (rules (start { (place "Ball1" (difference (union {(sites Side NW) (sites Side NE) (expand (sites Side N))}) (union (sites Left) (sites Right)))) (place "Ball2" (difference (union {(sites Side SW) (sites Side SE) (expand (sites Side S))}) (union (sites Left) (sites Right))))}) (play (if ("SameTurn") ("PieceMovement" (from (last To))) (forEach Piece))) (end (if (or (and (= 1 (count Pieces Next)) (= 6 (count Pieces Mover))) (no Pieces Next)) (result Mover Win))))) END |
Construct a Ludii game based on the following description
2x6 board. Three counters in each hole. The players begin the game simultaneously sowing first from their rightmost hole, racing to be the first one to drop the last counter of a sowing into an empty hole. This player then begins the next phase where they alternate play. Sowing occurs in an anti-clockwise direction. When the final counter falls into an occupied hole, the contents of this hole are picked up and sowing continues. When the final counter lands into an empty hole in the row belonging to the player, the counters in the opposite hole belonging to the opponent are captured, and the counter that triggered the capture is moved to the following hole. This could trigger the further capture of more of the opponent's counters if the hole in which the counter is placed was empty and the opponent's opposite hole contains counters. If the hole is occupied, sowing continues. If the hole is empty and the opposite hole is unoccupied or it is one of the opponent's holes, sowing ends. When one player can no longer play because the holes on their side are empty, the opponent captures the remaining counters on the board. A new round begins. The losing player places three counters in each hole, beginning on the rightmost hole. If the player has remaining counters but cannot fill their holes with three, they must distribute the remainder to fill as many of the remaining holes as possible with at least one counter. The winning player from the previous round then matches this starting configuration, keeping any surplus for use in future rounds. Play continues until one player has one or zero counters, the opponent being the winner.
###
| (define "LeftMostEmpty" (trackSite FirstSite from:(mapEntry "LeftMost" Mover) if:(is Empty (to)))) (define "NoPiecesInP1Side" (all Sites (sites P1) if:(= 0 (count at:(site))))) (define "OneRowIsEmpty" (or (all Sites (sites P1) if:(= 0 (count at:(site)))) (all Sites (sites P2) if:(= 0 (count at:(site)))))) (define "NextHoleFrom" ("NextSiteOnTrack" #2 from:#1)) (define "Columns" 6) (game "Gabata (Ansaba)" (players 2) (equipment { (mancalaBoard 2 "Columns" store:None (track "Track" "0,E,N,W" loop:True)) (piece "Seed" Shared) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (hand Each) (map "LeftMost" {(pair P1 0) (pair P2 11)}) (map "CorrespondingHoles" {(pair 0 11) (pair 1 10) (pair 2 9) (pair 3 8) (pair 4 7) (pair 5 6) (pair 6 5) (pair 7 4) (pair 8 3) (pair 9 2) (pair 10 1) (pair 11 0)})}) (rules (start (set Count 3 to:(sites Track))) phases:{ (phase "Sowing" (play (or { (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover)) if:(> (count at:(from)) 0)) (then (sow apply:(if (> (count at:(to)) 1) (moveAgain) (if (is In (to) (sites Mover)) (if (!= 0 (count at:("OppositePit" (to)))) (and (fromTo (from ("OppositePit" (to))) (to (handSite Mover)) count:(count at:("OppositePit" (to)))) (moveAgain))))))))} (then (if ("OneRowIsEmpty") (if ("NoPiecesInP1Side") (and (forEach Site (sites Board) (if (< 0 (count at:(site))) (fromTo (from (site)) (to (handSite P2)) count:(count at:(site))))) (if (>= (count Cell at:(handSite P1)) (+ (count Cell at:(handSite P2)) (count in:(sites Board)))) (set NextPlayer (player 2)) (set NextPlayer (player 1)))) (and (forEach Site (sites Board) (if (< 0 (count at:(site))) (fromTo (from (site)) (to (handSite P1)) count:(count at:(site))))) (if (>= (count Cell at:(handSite P2)) (+ (count Cell at:(handSite P1)) (count in:(sites Board)))) (set NextPlayer (player 1)) (set NextPlayer (player 2))))))))) (end (if ("NoPieceOnBoard") { (if (> 2 (count Cell at:(handSite P1))) (result P2 Win)) (if (> 2 (count Cell at:(handSite P2))) (result P1 Win))})) (nextPhase ("NoPieceOnBoard") "BetweenRounds")) (phase "BetweenRounds" (play (if (<= 3 (count Cell at:(handSite Mover))) (move (from (handSite Mover)) (to ("LeftMostEmpty")) count:3) (move (from (handSite Mover)) (to ("LeftMostEmpty")) count:1) (then (if (!= 0 (count Cell at:(handSite Mover))) (moveAgain) (forEach Site (sites Mover) (if (is Occupied (site)) (fromTo (from (handSite Next)) (to (mapEntry "CorrespondingHoles" (site))) count:(count at:(site))))))))) (nextPhase (or (is Empty (handSite P1)) (is Empty (handSite P2))) "Sowing"))})) END |
Construct a Ludii game based on the following description
3x5 lines, intersecting one another and forming a square. Diagonals are drawn in the four quadrants of the board. Two triangles, their apices intersecting the main board at opposite midpoints. The base of the triangle is bisected by a line drawn from the apex, and this line is bisected and intersects with the other two sides of the triangle. Fourteen pieces per player, which begin on the points in the triangle and the first two rows of the square closest to each player. The central line remains empty. Players alternate turns moving to an empty adjacent point along the lines. A player may capture an opponent's piece by hopping over it to an empty space on the opposite side of the opponent's piece along the lines of the board. The player who captures all of the opponent's pieces wins.
###
| (game "Pam Pait" (players 2) (equipment { (board (add (remove ("AlquerqueGraphWithBottomAndTopTriangles") vertices:{1 11 21 23 13 3}) edges:{ {0 1} {1 2} {8 9} {9 10} {16 17} {17 18}}) use:Vertex) (piece "Marker" Each (or "HopCapture" "StepToEmpty"))}) (rules (start { (place "Marker1" (union (sites {"A4" "E4"}) (expand (sites Bottom) steps:3))) (place "Marker2" (union (sites {"A6" "E6"}) (expand (sites Top) steps:3)))}) (play (forEach Piece)) (end ("CaptureAll" Next)))) END |
Construct a Ludii game based on the following description
Your goal in Gobblet Junior is to place three of your pieces in a horizontal, vertical or diagonal row. Your pieces can stack on top of each other, and they start the game nested, off the board. On a turn, you either play one exposed piece from your three off-the-board piles or move one piece on the board to any other spot on the board where it fits. A larger piece can cover any smaller piece.
Your memory is tested as you try to remember which color one of your larger pieces is covering before you move it. As soon as a player has three like-colored pieces in a row, he wins.
###
| (game "Gobblet Gobblers" (players 2) (equipment { (board (square 3)) (piece "Disc1" Each) (piece "Disc2" Each) (piece "Disc3" Each) (hand Each size:3)}) (rules (start { (place Stack "Disc11" (handSite P1) count:3) (place Stack "Disc12" (handSite P2) count:3) (place Stack "Disc21" (handSite P1 1) count:3) (place Stack "Disc22" (handSite P2 1) count:3) (place Stack "Disc31" (handSite P1 2) count:3) (place Stack "Disc32" (handSite P2 2) count:3)}) (play (or ("MoveToEmptyOrOccupiedByLargerPiece" (sites Hand Mover) if:(is Occupied (from))) ("MoveToEmptyOrOccupiedByLargerPiece" (sites Occupied by:Mover top:True)))) (end (forEach Player if:(is Line 3 Player top:True) (result Player Win))))) END |
Construct a Ludii game based on the following description
Four rows of holes, of any number. Each player has as many pieces as are in one row. The pieces start in the outer row of the board for each player. Six sticks used as dice, with a green side and a white side. The throws are as follows: one white up = 0; two white up = 2; three white up = 1; four white up = 4; five white up = 0; zero white or six white up = 6. Each piece's first move must be with a throw of 1 or 6. This first throw moves the piece one space only. Play moves from left to right in the player's home row, from right to left in the second row, left to right in the third row, and right to left in the opponent's home row. When a player's piece lands on a space occupied by an opponent's piece, the opponent's piece is removed from the board. The player who captures all of the opponent's pieces wins. Each row has 20 holes.
###
| (define "AllPieceInOpponentHome" (and (= (count Sites in:(difference (sites Occupied by:P1) (sites P2))) 0) (= (count Sites in:(difference (sites Occupied by:P2) (sites P1))) 0))) (define "CaptureEnemyPiece" (apply if:("IsEnemyAt" (to)) (remove (to)))) (define "InactivePiece" (= (state at:(from)) 1)) (define "ActivatedPiece" (= (state at:(from)) 0)) (define "ActivatePiece" (if (= (state at:(last To)) 1) (set State at:(last To) 0))) (define "ThrowValue" (mapEntry (count Pips))) (game "Sig (Mzab)" (players 2) (equipment { (board (rectangle 4 20) { (track "Track1" "0,E,N1,W,N1,E,N1,W" P1 directed:True) (track "Track2" "79,W,S1,E,S1,W,S1,E" P2 directed:True)} use:Vertex) (piece "Stick" Each (if (or ("ActivatedPiece") (and (or (= 1 ("ThrowValue")) (= 6 ("ThrowValue"))) ("InactivePiece"))) (if ("IsNotOffBoard" ("NextSiteOnTrack" (if ("InactivePiece") 1 ("ThrowValue")))) (if (or (is In ("NextSiteOnTrack" (if ("InactivePiece") 1 ("ThrowValue"))) (sites Empty)) ("IsEnemyAt" ("NextSiteOnTrack" (if ("InactivePiece") 1 ("ThrowValue"))))) (move (from) (to ("NextSiteOnTrack" (if ("InactivePiece") 1 ("ThrowValue"))) "CaptureEnemyPiece"))) (then ("ActivatePiece"))))) (regions "AllSites" (sites Board)) ("StickDice" 6) (map {(pair 0 6) (pair 1 0) (pair 2 2) (pair 3 1) (pair 4 1) (pair 5 0) (pair 6 6)}) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start { (place "Stick1" (sites Bottom) state:1) (place "Stick2" (sites Top) state:1)}) (play ("RollMove" (forEach Piece))) (end { ("CaptureAll" Next) (if ("AllPieceInOpponentHome") (result Mover Draw))}))) END |
Construct a Ludii game based on the following description
Each player has an allocated colour. The game is played in turns. On his first move, the second player may elect to swap colours (swap option). This is to prevent overly strong opening moves.
Each turn the current player places one of their pegs on an empty hole, which may conquer one or more cells. A cell is conquered by the first player to occupy at least half of its surrounding holes. A blue rectangle is placed on cells conquered by Blue, and a red rectangle is placed on cells conquered by Red.
The central cell, which has five holes, is conquered by the player who has occupied any three of these holes.
The first player that completes a contiguous chain of connected cells of his colour between the 2 sides of his colour wins the game.
###
| (define "CaptureTheCell" (claim (piece (id "Rectangle" Mover)) (to Cell (site)))) (define "MajorityOfEmptyCell" (if (is In (site) (sites Centre)) (>= (+ ("NumOwnedHolesCells") (if (= (mover) (who Vertex at:(centrePoint Vertex))) 1 0)) 3) (>= ("NumOwnedHolesCells") (if (is Even ("NumHolesCells")) (/ ("NumHolesCells") 2) (+ (/ ("NumHolesCells") 2) 1))))) (define "NumOwnedHolesCells" (count Sites in:(intersection ("AllHolesOfCell") (sites Occupied by:Mover on:Vertex)))) (define "NumHolesCells" (count Sites in:("AllHolesOfCell"))) (define "AllHolesOfCell" (intersection (sites Incident Vertex of:Cell at:(site)) (sites "Holes"))) (define "CellOfLastVertex" (sites Incident Cell of:Vertex at:(last To))) (game "ConHex" (players 2) (equipment { (board (add (keep (splitCrossings (merge (rotate 45 (dual (square 12 diagonals:Concentric))) (shift 3 3 (scale 6 (square 1))))) (poly { {3 3} {3 9} {9 9} {9 3}})) vertices:{{6 6}})) (piece "Marker" Each) (piece "Rectangle" Each) (regions "Holes" (union (difference (sites Board Vertex) (sites Outer Vertex)) (sites Corners Vertex))) (regions P1 {(sites Side N) (sites Side S)}) (regions P2 {(sites Side W) (sites Side E)})}) (rules (meta (swap)) (play (move Add (to Vertex (sites Empty Vertex) if:(is In (to) (sites "Holes"))) (then (forEach Site "CellOfLastVertex" (if "MajorityOfEmptyCell" "CaptureTheCell") (then (forEach Site (forEach ("CellOfLastVertex") if:(is Mover (who Cell at:(site)))) (if (is Connected at:(site) Mover) (trigger "Connected" Mover)))))))) (end { (if (is Triggered "Connected" Mover) (result Mover Win)) (if (<= 52 (count Moves)) (result Mover Draw))}))) END |
Construct a global Ludii definition which fulfills the following requirements.
Defines two table tracks following the same directions and using hand sites.
###
| (define "TableTracksSameDirectionWithHands" { (track "Track1" {24 0..5 6..11 23..18 17..12 #1} P1 directed:True) (track "Track2" {25 0..5 6..11 23..18 17..12 #1} P2 directed:True)}) END |
Describe the mechanics of the following Ludii game
(game "Caturvimsatikosthakatmiki Krida" (players 2) (equipment { (board (rectangle 3 8)) (piece "Marker" Each (or { (move Hop Orthogonal (between if:(and ("IsEnemyAt" (between)) (not (is In (between) (union (sites Bottom) (sites Top))))) (apply (remove (between)))) (to if:(is Empty (to)))) ("StepOrthogonalToEmpty") (if (= 1 (state at:(from))) (move Slide Orthogonal (between (exact 2) if:(is Empty (between))) (then (set State at:(last To) 0))))}))}) (rules (start { (place "Marker1" (sites Bottom) state:1) (place "Marker2" (sites Top) state:1)}) (play (forEach Piece)) (end ("HavingLessPiecesLoss" Next 3))))
###
| 3x8 board. The second space from the left and from the right in the center row are marked with an X. Eight pieces per player, which begin in the row closest to the player. Players alternate turns moving a piece to an empty adjacent space in an orthogonal direction. On the first move of a piece, that piece may move two spaces in one direction. A player may capture an opponent's piece in the central row by hopping over it to an empty space on the opposite side of it. The player who reduces their opponent to fewer than four pieces wins. END |
Modify the Ludii game according to the following option changes:
The game is played on the Graph2. -> The game is played on the Graph3.
(game "Nein Ari" (players 1) (equipment { (board (graph vertices:{{0 0} {5 0} {10 0} {0 5} {5 5} {10 5} {0 10} {5 10} {10 10}} edges:{ {0 1} {0 2} {0 3} {0 4} {0 5} {0 6} {0 7} {1 2} {1 3} {1 4} {1 5} {1 6} {1 8} {2 3} {2 4} {2 5} {2 7} {2 8} {3 4} {3 6} {3 7} {3 8} {4 5} {4 6} {4 7} {4 8} {5 6} {5 8} {5 7} {6 7} {6 8} {7 8}}) use:Edge)}) (rules (start (set P1 Edge (sites Board Edge))) (play (move Remove (sites Occupied by:Mover on:Edge))) (end (if (is RegularGraph Mover) (result Mover Win)))))
###
| (game "Nein Ari" (players 1) (equipment { (board (graph vertices:{{0 0} {7 1} {0 4} {3 1} {6 5} {0 8} {10 5} {6 8} {10 11} {11 2} {10 10} {8 13} {13 14} {15 9}} edges:{ {0 1} {0 2} {0 3} {0 4} {0 5} {0 6} {0 7} {0 8} {0 9} {0 10} {0 11} {0 12} {0 13} {1 2} {1 3} {1 4} {1 5} {1 6} {1 7} {1 8} {1 9} {1 10} {1 11} {1 12} {1 13} {2 3} {2 4} {2 5} {2 6} {2 7} {2 8} {2 9} {2 10} {2 11} {2 12} {2 13} {3 4} {3 5} {3 6} {3 7} {3 8} {3 9} {3 10} {3 11} {3 12} {3 13} {4 5} {4 6} {4 7} {4 8} {4 9} {4 10} {4 11} {4 12} {4 13} {5 6} {5 7} {5 8} {5 9} {5 10} {5 11} {5 12} {5 13} {6 7} {6 8} {6 9} {6 10} {6 11} {6 12} {6 13} {7 8} {7 9} {7 10} {7 11} {7 12} {7 13} {8 9} {8 10} {8 11} {8 12} {8 13} {9 10} {9 11} {9 12} {9 13} {10 11} {10 12} {10 13} {11 12} {11 13} {12 13}}) use:Edge)}) (rules (start (set P1 Edge (sites Board Edge))) (play (move Remove (sites Occupied by:Mover on:Edge))) (end (if (is RegularGraph Mover) (result Mover Win))))) END |
Modify the Ludii game according to the following option changes:
Triangle-8 Board (36) -> Triangle-15 Board (120)
(define "EdgesOfSide" (intersection (sites Outer Edge) (forEach of:(difference #1 (sites Corners Vertex)) (sites Incident Edge of:Vertex at:(site))))) (define "BoardColour" (colour 215 203 170)) (define "P2Colour" (colour White)) (define "P1Colour" (colour DarkGreen)) (define "AddPieceOf" (move Add (piece #1) (to (sites Empty)) #2)) (define "Side3" (union (sites Side NW) (sites Side SW))) (define "Side2" (union (sites Side SE) (sites Side S))) (define "Side1" (union (sites Side NE) (sites Side N))) (game "Bipartisan Y" (players 2) (equipment { (board (tri 8) use:Vertex) (piece "Disc" Each) (piece "Counter" Neutral maxState:2)}) (rules (play (if ("SameTurn") ("AddPieceOf" (next) ~) ("AddPieceOf" (mover) (then (moveAgain))))) (end { (if (and (= 1 (who at:(last To))) (is Connected 3 {"Side1" "Side2" "Side3"})) (result P1 Win)) (if (and (= 2 (who at:(last To))) (is Connected 3 {"Side1" "Side2" "Side3"})) (result P2 Win))})))
###
| (define "EdgesOfSide" (intersection (sites Outer Edge) (forEach of:(difference #1 (sites Corners Vertex)) (sites Incident Edge of:Vertex at:(site))))) (define "BoardColour" (colour 215 203 170)) (define "P2Colour" (colour White)) (define "P1Colour" (colour DarkGreen)) (define "AddPieceOf" (move Add (piece #1) (to (sites Empty)) #2)) (define "Side3" (union (sites Side NW) (sites Side SW))) (define "Side2" (union (sites Side SE) (sites Side S))) (define "Side1" (union (sites Side NE) (sites Side N))) (game "Bipartisan Y" (players 2) (equipment { (board (tri 15) use:Vertex) (piece "Disc" Each) (piece "Counter" Neutral maxState:2)}) (rules (play (if ("SameTurn") ("AddPieceOf" (next) ~) ("AddPieceOf" (mover) (then (moveAgain))))) (end { (if (and (= 1 (who at:(last To))) (is Connected 3 {"Side1" "Side2" "Side3"})) (result P1 Win)) (if (and (= 2 (who at:(last To))) (is Connected 3 {"Side1" "Side2" "Side3"})) (result P2 Win))}))) END |
Construct a Ludii game based on the following description
7x7 board. The central square, as well as the central square on each edge of the board, is marked with an X. Two to four players. Four pieces per player. Four cowries used as dice, the values are equal to the number of mouths which land face up; when all mouths are down the value = 8 and a \ The game involves 2 players.
###
| (define "EntryPoint" (mapEntry #1)) (define "Goal" 24) (define "CaptureEnemyPiece" (apply if:(and (not (is In (to) (sites "ProtectedSites"))) ("IsEnemyAt" (to))) (and (fromTo (from (to)) (to (handSite (who at:(to))))) (moveAgain)))) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" ("ThrowValue"))) (define "Grace" (is In (count Pips) (array {0 4}))) (define "ThrowValue" (mapEntry "Throw" (count Pips))) (game "Ashta-kashte" (players 2) (equipment { (board (square 7) { (track "Track1" "27,N,W,S,E,N2,SW1,W4,N4,E4,S3,W3,N2,E2,S1,W1" P1 directed:True) (track "Track2" "21,S,E,N,W,S2,NE1,E4,S4,W4,N3,E3,S2,W2,N1,E1" P2 directed:True)}) (piece "Paddle" Each (if (and (is In (from) (sites Board)) ("IsNotOffBoard" "SiteToMoveOnTrack")) (move (from (from) level:(level)) (to "SiteToMoveOnTrack" "CaptureEnemyPiece")) (then (if (= "Goal" (last To)) (remove (last To)))))) (hand Each) ("StickDice" 4) (map {(pair 1 "G4") (pair 2 "A4") (pair 3 "D1") (pair 4 "D7")}) (map "Throw" {(pair 0 8)}) (regions "ProtectedSites" (sites {0 3 6 21 27 3 45 42 48 24}))}) (rules (start { (place Stack "Paddle1" (handSite P1) count:4) (place Stack "Paddle2" (handSite P2) count:4)}) (play ("RollMove" (or { (forEach Piece) (move Pass) (if (and ("Grace") (!= 0 (who at:(handSite Mover)))) (move (from (handSite Mover)) (to (mapEntry Mover))))}) (then (if ("Grace") (moveAgain))))) (end ("EscapeWin")))) END |
Describe the mechanics of the following Ludii game
(define "NoPiece" (all Sites (sites #1) if:(= 0 (count at:(site))))) (game "Mbelele" (players 2) (equipment { (board (merge { (rectangle 2 12) (shift -1 0.5 (square 1)) (shift -3 0 (square 2)) (shift -4 0.5 (square 1)) (shift 12 0.5 (square 1)) (shift 13 0 (square 2)) (shift 15 0.5 (square 1))}) { (track "TrackCCW1" "25,26,24,0,E,31,32,35" loop:True P1) (track "TrackCCW2" "34,33,30,23,W,28,27,29" loop:True P2) (track "TrackCW1" "35,32,31,11,W,24,26,25" loop:True P1) (track "TrackCW2" "29,27,28,12,E,30,33,34" loop:True P2)} use:Vertex) (piece "Seed" Shared) (map "Opposite" { (pair 29 35) (pair 35 29) (pair 24 30) (pair 30 24) (pair 25 27) (pair 26 28) (pair 0 12) (pair 1 13) (pair 2 14) (pair 3 15) (pair 4 16) (pair 5 17) (pair 6 18) (pair 7 19) (pair 8 20) (pair 9 21) (pair 10 22) (pair 11 23) (pair 31 33) (pair 32 34) (pair 27 25) (pair 28 26) (pair 12 0) (pair 13 1) (pair 14 2) (pair 15 3) (pair 16 4) (pair 17 5) (pair 18 6) (pair 19 7) (pair 20 8) (pair 21 9) (pair 22 10) (pair 23 11) (pair 33 31) (pair 34 32)}) (regions P1 (union (sites Bottom) (sites {24 35}))) (regions P2 (union (sites Top) (sites {29 30})))}) (rules (start (set Count 3 to:(sites Board))) (play (or (if (!= 2 (var "NumCapture")) (or (if (!= (var "Direction") 2) (move Select (from (if ("SameTurn") (sites {(var "Replay")}) (sites Mover)) if:(and (if ("SameTurn") True (= 1 (count at:(from)))) (is Occupied (from)))) (then (sow "TrackCCW" owner:(mover) apply:(if (= 1 (count at:(to))) (and { (if (is Occupied (mapEntry "Opposite" (to))) (remove (mapEntry "Opposite" (to)) count:1)) (set Var "Direction" 0) (set Var "NumCapture" 0)}) (and { (moveAgain) (set Var "Replay" (to)) (set Var "Direction" 1) (set Var "NumCapture" 1)})))))) (if (!= (var "Direction") 1) (move Select (from (if ("SameTurn") (sites {(var "Replay")}) (sites Mover)) if:(and (if ("SameTurn") True (= 1 (count at:(from)))) (is Occupied (from)))) (then (sow "TrackCW" owner:(mover) apply:(if (= 1 (count at:(to))) (and { (if (is Occupied (mapEntry "Opposite" (to))) (remove (mapEntry "Opposite" (to)) count:1)) (set Var "Direction" 0) (set Var "NumCapture" 0)}) (and { (moveAgain) (set Var "Replay" (to)) (set Var "Direction" 2) (set Var "NumCapture" 1)})))))))) (if (!= 1 (var "NumCapture")) (or (if (!= (var "Direction") 2) (move Select (from (if ("SameTurn") (sites {(var "Replay")}) (sites Mover)) if:(and (if ("SameTurn") True (< 1 (count at:(from)))) (is Occupied (from)))) (then (sow "TrackCCW" owner:(mover) apply:(if (= 1 (count at:(to))) (and { (if (is Occupied (mapEntry "Opposite" (to))) (remove (mapEntry "Opposite" (to)) count:(count at:(to)))) (set Var "Direction" 0) (set Var "NumCapture" 0)}) (and { (moveAgain) (set Var "Replay" (to)) (set Var "Direction" 1) (set Var "NumCapture" 2)})))))) (if (!= (var "Direction") 1) (move Select (from (if ("SameTurn") (sites {(var "Replay")}) (sites Mover)) if:(and (if ("SameTurn") True (< 1 (count at:(from)))) (is Occupied (from)))) (then (sow "TrackCW" owner:(mover) apply:(if (= 1 (count at:(to))) (and { (if (is Occupied (mapEntry "Opposite" (to))) (remove (mapEntry "Opposite" (to)) count:(count at:(to)))) (set Var "Direction" 0) (set Var "NumCapture" 1)}) (and { (moveAgain) (set Var "Replay" (to)) (set Var "Direction" 2) (set Var "NumCapture" 2)})))))))))) (end (forEach NonMover if:("NoPiece" Player) (result Player Loss)))))
###
| Two rows of twelve holes in the central part of the board, one hole on either end of this, two rows of two outside of these single holes on both sides of the board, and one final hole on either end of the board. Three counters in each hole. Sowing occurs only in the player's row; players use the inner single hole to their left; the outer single hole to the right. Sowing can occur in either direction. Captures are made when a counter falls into an empty hole. The counters in the opponent's opposite hole are captured. When the final counter of a sowing ends in a player's empty inner single holes, the counters in the opponent's inner single hole are captured. If it lands in a player's empty outer single hole, the counters in the opponent's outer single hole are captured. Single counters can be sown, but these cannot capture more than one of the opponent's counters. If the final counter falls into an occupied hole, the contents of this hole are picked up and sowing continues in the same direction. A player can sow such that they can make a capture from the hole in which the sowing began, but this cannot be done by sowing two or fewer counters. The player who has no counters remaining in their row loses. It is customary to play a series of round to determine the winner. END |
Construct a Ludii game based on the following description
2x6 board. Each player has 36 counters which they arrange however they like in their holes. Play begins from any hole in a player's row. Sowing occurs in an anti-clockwise direction. When the last counter falls makes an odd number of counters in the final hole of the sowing, these are picked up and sowing continues. If the last hole is made to be even, these are captured, as well as the contents of the opposite hole. If the previous hole is also even, those counters and those in the opposite hole are also taken, continuing until there is an odd or empty hole. If the final counter falls into an empty hole, play ends. The round ends when one player is unable to move. A new round begins. The player with the smaller number of counters distributes them as they like in their holes. The opponent then copies this arrangement, keeping the surplus of counters. Play continues as before. Rounds are played until one player has no remaining counters.
###
| (define "PiecesOwnedBy" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (define "Columns" 6) (game "Baqura" (players 2) (equipment { (mancalaBoard 2 6 store:None (track "Track" "0,E,N,W" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece "Seed" Shared) (hand Each)}) (rules (start { (set Count 36 at:(handSite P1)) (set Count 36 at:(handSite P2))}) phases:{ (phase "Placement" (play (move (from (handSite Mover)) (to (sites Mover)))) (nextPhase Mover ("HandEmpty" Mover) "Sowing")) (phase "Sowing" (play (if (not (all Sites (sites Mover) if:(= 0 (count at:(site))))) (move Select (from (if "SameTurn" "LastHoleSowed" (sites Mover)) if:(> (count at:(from)) 0)) (then (sow if:(> (count at:(to)) 1) apply:(if (and (> (count at:(to)) 1) (is Odd (count at:(to)))) (moveAgain) (and (if (> (count at:("OppositePitTwoRows" (to))) 0) (fromTo (from ("OppositePitTwoRows" (to))) (to (handSite Mover)) count:(count at:("OppositePitTwoRows" (to))))) (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))))) backtracking:(and {(is In (to) (sites Mover)) (> (count at:(to)) 1) (is Even (count at:(to)))})))) (move Pass (then (and (forEach Site (sites Next) (if (is Occupied (site)) (fromTo (from (site)) (to (handSite Next)) count:(count at:(site))))) (if (< ("PiecesOwnedBy" P1) ("PiecesOwnedBy" P2)) (set NextPlayer (player 1)) (set NextPlayer (player 2)))))))) (nextPhase (was Pass) "PlacementLosingPlayer")) (phase "PlacementLosingPlayer" (play (move (from (handSite Mover)) (to (sites Mover)) (then (if ("HandEmpty" Mover) (forEach Site (sites Mover) (if (is Occupied (site)) (fromTo (from Cell (handSite Next)) (to ("OppositePitTwoRows" (site))) count:(count at:(site))))) (moveAgain))))) (nextPhase ("HandEmpty" Mover) "Sowing"))} (end (forEach Player if:(= 0 ("PiecesOwnedBy" Player)) (result Player Loss))))) END |
Construct a global Ludii definition which fulfills the following requirements.
Defines a sequence of hop move in all the adjacent directions over an enemy to an empty site from the last ``to'' location of the previous move.
###
| (define "HopSequenceCaptureAgain" (move Hop (from (last To)) (between #1 #2 if:(and (not (is In (between) (sites ToClear))) ("IsEnemyAt" (between))) (apply (remove (between) #3))) (to if:(is Empty (to))) (then (if (can Move (hop (from (last To)) (between #1 #2 if:(and (not (is In (between) (sites ToClear))) ("IsEnemyAt" (between)))) (to if:(is Empty (to))))) (moveAgain))))) END |
Construct a global Ludii definition which fulfills the following requirements.
Defines a piece moving like a pawn in Chess (En Passant, Initial double step moves and promotion are not described in this ludemeplex).
###
| (define "ChessPawn" (piece #1 Each (or { "StepForwardToEmpty" ("StepToEnemy" (directions {FR FL})) #2} #3))) END |
Construct a Ludii game based on the following description
2x7 board. Four counters in each hole. Sowing occurs in an anti-clockwise direction and begins from one of the holes in the player's row. When the final counter lands in an occupied hole, these are picked up and sowing continues. If the occupied hole has three counters (four including the final counter from the sowing), these are captured. Then, the player picks up the counters in the next hole after the one from which the capture was made and continues sowing from there. When the final counter lands into an empty hole the turn ends. The game ends when one player no longer has any counters on their side of the board. The opponent then captures the remaining counters on the board. A new game begins, with each player filling holes with the counters they captured, four to each hole. The player now controls as many holes as they can fill with counters. Play begins with the player who played second in the previous game. Subsequent games are played until one player captures all of the holes, becoming the winner.
###
| (define "RemmemberOwnedHoles" (if (is Mover P1) (remember Value "OwnedP1" #1) (remember Value "OwnedP2" #1))) (define "OwnedHoles" (if (is Mover P1) (sites (values Remembered "OwnedP1")) (sites (values Remembered "OwnedP2")))) (define "OneRowIsEmpty" (or (all Sites (sites P1) if:(= 0 (count at:(site)))) (all Sites (sites P2) if:(= 0 (count at:(site)))))) (define "NextHoleFrom" ("NextSiteOnTrack" #2 from:#1)) (define "PiecesOwnedBy" (+ (count Cell at:(handSite #1)) (count in:(sites #1 "Home")))) (game "Motiq" (players 2) (equipment { (mancalaBoard 2 7 store:None (track "Track" "0,E,N,W" loop:True)) (regions "Home" P1 (sites Bottom)) (regions "Home" P2 (sites Top)) (piece "Seed" Shared) (hand Each)}) (rules (start { (set Count 4 to:(sites Track)) (set RememberValue "OwnedP1" (sites Bottom)) (set RememberValue "OwnedP2" (sites Top))}) phases:{ (phase "Sowing" (play (or { (move Select (from (if ("SameTurn") (sites {(var "Replay")}) ("OwnedHoles")) if:(is Occupied (from))) (then (sow apply:(if (= 4 (count at:(to))) (and (fromTo (from (to)) (to (handSite Mover)) count:4) (if (is Occupied ("NextHoleFrom" (to) 1)) (and (moveAgain) (set Var "Replay" ("NextHoleFrom" (to) 1))))) (if (< 1 (count at:(to))) (and (moveAgain) (set Var "Replay" (to))))))))} (then (if ("OneRowIsEmpty") (and { (forEach Site (sites P1) (fromTo (from (site)) (to (handSite P1)) count:(count at:(site)))) (forEach Site (sites P2) (fromTo (from (site)) (to (handSite P2)) count:(count at:(site)))) (forget Value "OwnedP1" All) (forget Value "OwnedP2" All)}))))) (end (if ("NoPieceOnBoard") { (if (> 4 (count Cell at:(handSite P1))) (result P2 Win)) (if (> 4 (count Cell at:(handSite P2))) (result P1 Win))})) (nextPhase ("NoPieceOnBoard") "BetweenRounds")) (phase "BetweenRounds" (play (if (<= 4 (count Cell at:(handSite Mover))) (move (from (handSite Mover)) (to (if (all Sites (sites Mover) if:(is Occupied (site))) (sites Board) (sites Mover)) if:(is Empty (to))) count:4 (then ("RemmemberOwnedHoles" (last To)))))) (nextPhase (all Passed) "Sowing"))})) END |
Modify the Ludii game according to the following option changes:
The game is played on a 9x9 board. -> The game is played on a 15x15 board.
Three players. -> Four 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 3) (equipment { (board (square 9)) (piece "Disc" Each) "RegularRegions"}) (rules phases: { (phase "Placement" (play (move Add (to (intersection (sites "CentreRing") (sites Empty))))) (nextPhase (= (count Pieces All) 3) "Movement")) (phase "Movement" (play (move Add (to (difference (sites Playable) (sites Centre))) (then (forEach Site (sites Occupied by:All) (if (<= 4 ("Nbors" (to))) (remove (to))) (then (forEach Site (sites Occupied by:All) (if (= 0 ("Nbors" (to))) (remove (to))))))))))} (end (if (is Connected {(sites "CentreRing") (sites "OuterGoals")}) (result Mover Win)))))
###
| (define "AlternateRegions" (regions "Centre" (sites Centre)) (regions "CentreRing" (difference (expand (sites Centre)) (sites Centre))) (regions "CornerSites" (sites {"B2" "J2" "R2" "B10" "R10" "B18" "J18" "R18"})) (regions "DotSites" (sites {"F6" "J6" "N6" "N10" "F10" "F14" "J14" "N14"})) (regions "OuterGoals" (difference (expand (sites "CornerSites")) (sites "CornerSites")))) (define "RegularRegions" (regions "Centre" (sites Centre)) (regions "CentreRing" (difference (expand (sites Centre)) (sites Centre))) (regions "OuterGoals" (expand (sites Corners)))) (define "Nbors" (count Sites in:(intersection (sites Around #1) (sites Occupied by:All)))) (game "Abak" (players 4) (equipment { (board (square 15)) (piece "Disc" Each) "RegularRegions"}) (rules phases: { (phase "Placement" (play (move Add (to (intersection (sites "CentreRing") (sites Empty))))) (nextPhase (= (count Pieces All) 4) "Movement")) (phase "Movement" (play (move Add (to (difference (sites Playable) (sites Centre))) (then (forEach Site (sites Occupied by:All) (if (<= 4 ("Nbors" (to))) (remove (to))) (then (forEach Site (sites Occupied by:All) (if (= 0 ("Nbors" (to))) (remove (to))))))))))} (end (if (is Connected {(sites "CentreRing") (sites "OuterGoals")}) (result Mover Win))))) END |
Modify the Ludii game according to the following option changes:
Each player has 13 holes. -> Each player has 14 holes.
(define "PiecesOwnedBy" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (define "MoveAgainAfterCapture" (is Pending)) (define "PlayFromNextHole" (sites {(value Pending)})) (define "NextHole" (if (is Mover P1) ("NextSiteOnTrack" 1 from:(to) "Track1") ("NextSiteOnTrack" 1 from:(to) "Track2"))) (define "Columns" 13) (game "Owela (Benguela)" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "Track1" "0,E,N1,W" loop:True P1) (track "Track2" "26,E,N1,W" loop:True P2)}) (regions "Home" P1 (sites Track "Track1")) (regions "Home" P2 (sites Track "Track2")) (regions "Inner" P1 (difference (sites Track "Track1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "Track2") (sites Top))) (regions "Outer" P1 (sites Bottom)) (regions "Outer" P2 (sites Top)) (regions "InnerInit" P1 (sites {21..25})) (regions "InnerInit" P2 (sites {26..30})) (piece "Seed" Shared) (hand Each)}) (rules (start (set Count 2 to:(union {(sites P1 "Outer") (sites P1 "InnerInit") (sites P2 "Outer") (sites P2 "InnerInit")}))) (play (move Select (from (if ("SameTurn") (if "MoveAgainAfterCapture" "PlayFromNextHole" "LastHoleSowed") (sites Mover "Home")) if:(> (count at:(from)) 1)) (then (sow "Track" owner:(mover) apply:(if (> (count at:(to)) 1) (if (and (is In (to) (sites Mover "Inner")) (> (count at:("OppositePit" (to))) 0)) (and { (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))) (fromTo (from ("OppositePit" (to))) (to (handSite Mover)) count:(count at:("OppositePit" (to)))) (if (> (count at:("OppositeOuterPit" (to))) 0) (fromTo (from ("OppositeOuterPit" (to))) (to (handSite Mover)) count:(count at:("OppositeOuterPit" (to))))) (if (> (count at:"NextHole") 1) (and (set Pending "NextHole") (moveAgain)))}) (moveAgain))))))) (end ("MancalaByScoreWhen" (no Moves Mover)))))
###
| (define "PiecesOwnedBy" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (define "MoveAgainAfterCapture" (is Pending)) (define "PlayFromNextHole" (sites {(value Pending)})) (define "NextHole" (if (is Mover P1) ("NextSiteOnTrack" 1 from:(to) "Track1") ("NextSiteOnTrack" 1 from:(to) "Track2"))) (define "Columns" 14) (game "Owela (Benguela)" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "Track1" "0,E,N1,W" loop:True P1) (track "Track2" "28,E,N1,W" loop:True P2)}) (regions "Home" P1 (sites Track "Track1")) (regions "Home" P2 (sites Track "Track2")) (regions "Inner" P1 (difference (sites Track "Track1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "Track2") (sites Top))) (regions "Outer" P1 (sites Bottom)) (regions "Outer" P2 (sites Top)) (regions "InnerInit" P1 (sites {24..27})) (regions "InnerInit" P2 (sites {28..31})) (piece "Seed" Shared) (hand Each)}) (rules (start (set Count 2 to:(union {(sites P1 "Outer") (sites P1 "InnerInit") (sites P2 "Outer") (sites P2 "InnerInit")}))) (play (move Select (from (if ("SameTurn") (if "MoveAgainAfterCapture" "PlayFromNextHole" "LastHoleSowed") (sites Mover "Home")) if:(> (count at:(from)) 1)) (then (sow "Track" owner:(mover) apply:(if (> (count at:(to)) 1) (if (and (is In (to) (sites Mover "Inner")) (> (count at:("OppositePit" (to))) 0)) (and { (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))) (fromTo (from ("OppositePit" (to))) (to (handSite Mover)) count:(count at:("OppositePit" (to)))) (if (> (count at:("OppositeOuterPit" (to))) 0) (fromTo (from ("OppositeOuterPit" (to))) (to (handSite Mover)) count:(count at:("OppositeOuterPit" (to))))) (if (> (count at:"NextHole") 1) (and (set Pending "NextHole") (moveAgain)))}) (moveAgain))))))) (end ("MancalaByScoreWhen" (no Moves Mover))))) END |
Construct a Ludii game based on the following description
8x8 board. Each player begins with sixteen pieces with special moves: Khoon (x1): moves orthogonally in any direction; Met (x1): placed to the right of the Khoon, moves one square orthogonally or diagonally forward, or one square diagonally backward, may move two squares orthogonally forward on the first move; Khon (x2): moves one square forward orthogonally or diagonally, may move backward diagonally but not to capture; Maa (x2): moves as a Chess knight; Rooa (x2): moves orthogonally any distance; Bea (x8): move forward one space, but capture diagonally. When they reach the opposite edge of the board, they are promoted to Met. They begin on the third row of the board with respect to each player. When the Khoon is threatened, it is in check and the player's next move must be to remove the check. If the player cannot, it is checkmate and the player loses. If there are no legal moves, the game is a draw. If one player has only a king left, the opponent must checkmate it within a set number of turns, based on the highest ranking piece left on the board, minus the total number of pieces on the board. The values are: two Rooa: eight; one Rooa, sixteen, two Khon, 22; one Khon, 44; two Maa, 33; one Maa, 66; Met and two Bea, 88; one each of Met, Rooa, Maa, Khon, sixteen. With only a Met, the game is a draw.
###
| (game "Mak Ruk" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) ("ChessPawn" "Pawn" ~ (then ("PromoteIfReach" (sites Mover "Promotion") "Ferz_noCross"))) ("ChessRook" "Rook") (piece "King_noCross" Each ("StepToNotFriend" Orthogonal)) (piece "Bishop_noCross" Each (or ("StepToNotFriend" (directions {FL FR Forward})) ("StepToEmpty" (directions {BL BR})))) ("ChessKnight" "Knight") (piece "Ferz_noCross" Each (or (if (= (state at:(from)) 1) (move (from) (to (ahead (ahead (from) N) N) if:(is Empty (to)))) (then (set State at:(last To) 0))) ("StepToNotFriend" (directions {BL BR FL FR Forward})))) (regions "Promotion" P1 (sites Top)) (regions "Promotion" P2 (sites Bottom))}) (rules (start { (place "Pawn1" (sites Row 2)) (place "Pawn2" (sites Row 5)) (place "Rook1" {"A1" "H1"}) (place "Knight1" {"B1" "G1"}) (place "Bishop_noCross1" {"C1" "F1"}) (place "Ferz_noCross1" coord:"E1" state:1) (place "King_noCross1" coord:"D1") (place "Rook2" {"A8" "H8"}) (place "Knight2" {"B8" "G8"}) (place "Bishop_noCross2" {"C8" "F8"}) (place "Ferz_noCross2" coord:"D8" state:1) (place "King_noCross2" coord:"E8")}) (play (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King_noCross" Mover)))) (end { ("Checkmate" "King_noCross") ("DrawIfNoMoves" Next) (if (and {(= (count Pieces Next) 1) (= (count Pieces Mover) 2) ("IsNotOffBoard" (where "Ferz_noCross" Mover))}) (result Mover Draw))}))) END |
Construct a Ludii game based on the following description
A vertical line, with seven lines perpendicularly crossing it at equal intervals. Six pieces, three of one color and three of another. The three of one color are placed on the top three intersections, the three of the other color on the bottom three intersections. In the first move, one piece is moved to the center line, from one of the two lines adjacent to it. Pieces may move to an empty adjacent point, or may jump over a piece of the other color to an empty point. The goal is to place the pieces on the spaces where the pieces of the opposite color started the game.
###
| (define "HopPiece" (move Hop (from) (between if:("IsFriendAt" (between))) (to if:(is Empty (to))))) (game "Mawryngkneng Solitaire Game" (players 1) (equipment { (board (add (rectangle 7 1) vertices:{ {0.0 -1.0} {-1.0 0.0} {1.0 0.0} {-1.0 1.0} {1.0 1.0} {-1.0 2.0} {1.0 2.0} {-1.0 3.0} {1.0 3.0} {-1.0 4.0} {1.0 4.0} {-1.0 5.0} {1.0 5.0} {-1.0 6.0} {1.0 6.0} {0.0 7.0}}) use:Vertex) (piece "Marker1" P1 (or ("StepToEmpty") ("HopPiece"))) (piece "Marker2" P1 (or ("StepToEmpty") ("HopPiece")))}) (rules (start { (place "Marker1" (expand (sites {0}) steps:2)) (place "Marker2" (expand (sites {6}) steps:2))}) phases:{ (phase "Opening" (play (forEach Piece ("StepToEmpty"))) (nextPhase "Solving")) (phase "Solving" (play (forEach Piece)))} (end (if (is Target {2 2 2 0 1 1 1} {0 1 2 3 4 5 6}) (result P1 Win))))) END |
Modify the Ludii game according to the following option changes:
The board has 1 row. -> The board has 2 rows.
The board has 2 columns. -> The board has 3 columns.
(game "Cram" (players 2) (equipment { (board (rectangle 1 2)) (tile "Tile" P1 {F} numSides:4) (tile "Tile" P2 {F} numSides:4)}) (rules (play (or (move Add (piece (mover) state:0) (to (sites Empty))) (move Add (piece (mover) state:1) (to (sites Empty))))) (end ("NoMoves" Loss))))
###
| (game "Cram" (players 2) (equipment { (board (rectangle 2 3)) (tile "Tile" P1 {F} numSides:4) (tile "Tile" P2 {F} numSides:4)}) (rules (play (or (move Add (piece (mover) state:0) (to (sites Empty))) (move Add (piece (mover) state:1) (to (sites Empty))))) (end ("NoMoves" Loss)))) END |
Construct a global Ludii definition which fulfills the following requirements.
Defines the capture of a stack with an enemy piece at the top returning to a site. This ludemeplex can be used only as an effect.
###
| (define "HittingStackCapture" (apply (if ("IsEnemyAt" (to)) (forEach Level (to) FromTop (fromTo (from (to) level:(level)) (to #1)))))) END |
Describe the mechanics of the following Ludii game
(define "EmptyOrNeutralPiece" (= (who at:(to)) 0)) (define "LevelBetweenGroundAndDestinationPlusOne" (<= (- (size Stack at:(to)) (topLevel at:(from))) 1)) (game "Santorini" (players 2) (equipment { (board (square 5)) (hand Each) (map {(pair 0 "SquareLarge0") (pair 1 "SquareSmall0") (pair 2 "Octagon0") (pair 3 "Marker0")}) (piece "Pawn3d" Each (move Step (to if:(and ("LevelBetweenGroundAndDestinationPlusOne") ("EmptyOrNeutralPiece"))) (then (moveAgain)))) (piece "SquareLarge" Neutral) (piece "SquareSmall" Neutral) (piece "Octagon" Neutral) (piece "Marker" Neutral)}) (rules (start { (place Stack "Pawn3d1" (handSite P1) count:2) (place Stack "Pawn3d2" (handSite P2) count:2)}) phases:{ (phase "Placement" (play (move (from (handSite Mover)) (to (sites Empty)) (then (if ("HandOccupied" Mover) (moveAgain))))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) (phase "Movement" (play (if ("SameTurn") (move Select (from (sites Around (last To) if:(and (< (size Stack at:(to)) 4) ("EmptyOrNeutralPiece")))) (then (add (piece (mapEntry (size Stack at:(last To)))) (to (last To)) stack:True))) (forEach Piece))))} (end { (if (and (= 3 (topLevel at:(last To))) ("IsPieceAt" "Pawn3d" Mover (last To) level:(topLevel at:(last To)))) (result Mover Win)) (if (no Moves P1) (result P2 Win)) (if (no Moves P2) (result P1 Win))})))
###
| The game is played on a 5x5 grid where each turn players build a town by placing building pieces up to four levels high. To win the game, players must move one of their two workers to the third level of the town.
Beginning turns :
The first player places his two workers on the board, then the second does the same.
Normal turns :
Each turn, the current player moves one of his two workers in an adjacent position (in horizontal, vertical or diagonal, i.e. king chess move) then he places a building tile adjacent to the moved worker (in a horizontal, vertical or diagonal adjacent position). The level of a position (i.e. a grid square) is the number of tiles.
Workers can move onto a position with zero, one, two, or three tiles (but not with four tiles) only if the level of the destination position is less than or equal to the level of departure destination plus one. There can be no more than 4 tiles per position.
The primary winning condition is to get one of his workers onto the third level (i.e. on a position with three tiles), though players may also win if their opponent is unable to make a move. END |
Describe the mechanics of the following Ludii game
(game "Morabaraba" (players 2) (equipment { (board (remove (add (concentric Square rings:3 joinCorners:True) vertices:{{0 0}} edges:{{11 24} {16 24} {7 24} {12 24}}) edges:{{3 6} {8 5} {17 20} {15 18}}) use:Vertex) (hand Each) (piece "Marker" Each (if (> (count Pieces Mover) 3) ("StepToEmpty") (move (from) (to (sites Empty))) (then ("ReplayIfLine3"))))}) (rules (start (place "Marker" "Hand" count:12)) phases:{ (phase "Placement" (play (if "SameTurn" ("RemoveAnyEnemyPieceNotInLine3") (move (from (handSite Mover)) (to (sites Empty)) (then ("ReplayIfLine3"))))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) (phase "Movement" (play (if "SameTurn" ("RemoveAnyEnemyPieceNotInLine3") (forEach Piece))))} (end ("HavingLessPiecesLoss" Next 2))))
###
| Three concentric squares, with lines connecting the midpoints of the squares with the center of the square and four lines connecting the corners of the outer two squares. Twelve pieces per player. In the first phase, players take turns placing pieces on an empty spot on the board. If they place three pieces so they are in a line, forming a \ END |
Construct a Ludii game based on the following description
The board is rectangular, with six points on either side, with each side divided in half by two short parallel lines, which are the \ Each team has 10 scoring sticks.
###
| (define "Move" (if ("IsEndTrack" ("SiteToMoveOnTrack" from:(from) ("ThrowValue"))) (move Remove (from) (then (if (is Occupied (handSite ("HandTeam"))) (fromTo (from (handSite ("HandTeam"))) (to (mapEntry "Start" ("HandTeam"))))))) (move (from (from)) (to ("SiteToMoveOnTrack" from:(from) ("ThrowValue")) if:True ("HittingCapture" (mapEntry "Start" (who at:(to))))) (then (if (= (last To) (mapEntry "Opposite" Mover)) (fromTo (from (last To)) (to (mapEntry "Start" Mover)))))))) (define "HandTeam" (if (or (is Mover P1) (is Mover P2)) 1 3)) (define "ReplayThrow" (or { (= ("ThrowValue") 6) (= ("ThrowValue") 10) (and (= 1 ("SaheValue")) (= ("ThrowValue") 1)) (and (= 1 ("SaheValue")) (= ("ThrowValue") 3))})) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" #2 #1)) (define "ThrowValue" (mapEntry "Throw" (count Pips))) (define "SaheValue" (face 57)) (game "Nebakuthana" (players 4) (equipment { (board (graph vertices:{ {0 0} {2 0} {3 0.33} {4 0.33} {5 0.33} {6 0} {7 0} {8 0.33} {9 0.33} {10 0.33} {11 0} {13 0} {0 2} {6 2} {7 2} {13 2} {0.33 3} {12.66 3} {0.33 4} {12.66 4} {0.33 5} {12.66 5} {0 6} {2 6} {11 6} {13 6} {0 7} {2 7} {11 7} {13 7} {0.33 8} {12.66 8} {0.33 9} {12.66 9} {0.33 10} {12.66 10} {0 11} {6 11} {7 11} {13 11} {0 13} {2 13} {3 12.66} {4 12.66} {5 12.66} {6 13} {7 13} {8 12.66} {9 12.66} {10 12.66} {11 13} {13 13}} edges:{ {0 1} {1 5} {5 13} {6 14} {5 6} {6 10} {10 11} {12 1} {0 12} {10 15} {15 11} {12 22} {22 26} {22 23} {26 27} {26 36} {36 40} {15 25} {25 29} {24 25} {28 29} {29 39} {39 51} {40 41} {36 41} {39 50} {50 51} {41 45} {45 46} {45 37} {46 38} {46 50}}) { (track "Track1" "6,7,8,9,10,15,17,19,21,25,29,31,33,35,39,50,49,48,47,46,45,44,43,42,41,36,34,32,30,26,22,20,18,16,12,1,2,3,4,End" P1 directed:True) (track "Track2" "6,7,8,9,10,15,17,19,21,25,29,31,33,35,39,50,49,48,47,46,45,44,43,42,41,36,34,32,30,26,22,20,18,16,12,1,2,3,4,End" P2 directed:True) (track "Track3" "5,4,3,2,1,12,16,18,20,22,26,30,32,34,36,41,42,43,44,45,46,47,48,49,50,39,35,33,31,29,25,21,19,17,15,10,9,8,7,End" P3 directed:True) (track "Track4" "5,4,3,2,1,12,16,18,20,22,26,30,32,34,36,41,42,43,44,45,46,47,48,49,50,39,35,33,31,29,25,21,19,17,15,10,9,8,7,End" P4 directed:True)} use:Vertex) (piece "Stick" P1 ("Move")) (piece "Stick" P3 ("Move")) ("StickDice" 4) (hand P1) (hand P3) (map "Throw" {(pair 0 10) (pair 1 1) (pair 2 2) (pair 3 3) (pair 4 6)}) (map "Start" {(pair P1 6) (pair P2 6) (pair P3 5) (pair P4 5)}) (map "Opposite" {(pair P1 46) (pair P2 46) (pair P3 45) (pair P4 45)})}) (rules (start { (set Team 1 {P1 P2}) (set Team 2 {P3 P4}) (place "Stick1" 6) (place "Stick3" 5) (place "Stick1" (handSite P1) count:10) (place "Stick3" (handSite P3) count:10)}) (play ("RollMove" (if (or (is Mover P1) (is Mover P2)) (forEach Piece P1) (forEach Piece P3)) (then (if ("ReplayThrow") (moveAgain))))) (end ("EscapeTeamWin")))) END |
Construct a Ludii game based on the following description
1) When castling king moves 3 squares towards either rook. 2) Both bishops of each player cannot run along squares of a same color. One of them must change in such a manner that it transits through squares of the other color. Being in its original square without having been moved before, it will take an orthogonal step towards any of the 3 surrounding squares that are of the other color, provided that these are empty. This special move is called conversion and it must be done as an ordinary move during the game.
###
| (define "InitialPawnMove" (if (is In (from) (sites Start (piece (what at:(from))))) ("DoubleStepForwardToEmpty" "SetEnPassantLocation"))) (define "EnPassant" (move Step (directions {FR FL}) (to if:"InLocationEnPassant") (then (remove (ahead (last To) Backward))))) (define "InLocationEnPassant" (and (is Pending) (= (to) (value Pending)))) (define "SetEnPassantLocation" (then (set Pending (ahead (last To) Backward)))) (define "BigCastling" ("DecideToCastle" "King" W 3 "KingNotCheckedAndToEmpty" (then ("CastleRook" "RookLeft" E 2 True)))) (define "SmallCastling" ("DecideToCastle" "King" E 3 "KingNotCheckedAndToEmpty" (then ("CastleRook" "RookRight" W 2 True)))) (define "CastleRook" (slide (from (mapEntry #1 (mover))) #2 (between (exact #3) if:#4) (to if:True (apply ("PieceHasMoved" (from)))))) (define "DecideToCastle" (move Slide (from (mapEntry #1 (mover))) #2 (between (exact #3) if:#4) (to if:True (apply ("PieceHasMoved" (from)))) #5)) (define "KingNotCheckedAndToEmpty" (and (is Empty (to)) (not ("IsInCheck" "King" Mover at:(to))))) (define "RememberPieceHasMoved" (then (if (= (state at:(last To)) 1) ("PieceHasMoved" (last To))))) (define "PieceHasMoved" (set State at:#1 0)) (define "HasNeverMoved" (= (state at:(mapEntry #1 (mover))) 1)) (game "Symmetric Chess" ("TwoPlayersNorthSouth") (equipment { (board (rectangle 8 9)) ("ChessPawn" "Pawn" (or "InitialPawnMove" "EnPassant") (then (and ("ReplayInMovingOn" (sites Mover "Promotion")) (set Counter)))) ("ChessRook" "Rook" (then (set Counter)) ("RememberPieceHasMoved")) ("ChessKing" "King" (then (set Counter)) ("RememberPieceHasMoved")) (piece "Bishop" Each (or { ("SlideCapture" (from if:(!= (state at:(from)) 2)) Diagonal (then (set Counter)) (then (and (forEach Site (sites Occupied by:Mover component:"Bishop") (set State at:(site) 2)) (set State at:(last To) 0)))) (move Step Orthogonal (to if:(and (not ("IsFriendAt" (to))) (!= (state at:(from)) 0)) (apply (if ("IsEnemyAt" (to)) (remove (to) (then (set Counter)))))) (then (forEach Site (sites Occupied by:Mover component:"Bishop") (set State at:(site) 0))))})) ("ChessKnight" "Knight" (then (set Counter))) ("ChessQueen" "Queen" (then (set Counter))) (map "King" {(pair 1 "E1") (pair 2 "E8")}) (map "RookLeft" {(pair 1 "A1") (pair 2 "A8")}) (map "RookRight" {(pair 1 "I1") (pair 2 "I8")}) (regions "Promotion" P1 (sites Top)) (regions "Promotion" P2 (sites Bottom))}) (rules (start { (place "Pawn1" (sites Row 1)) (place "Pawn2" (sites Row 6)) (place "Rook1" {"A1" "I1"} state:1) (place "Knight1" {"B1" "H1"}) (place "Bishop1" {"C1" "G1"} state:1) (place "Queen1" {"D1" "F1"}) (place "King1" coord:"E1" state:1) (place "Rook2" {"A8" "I8"} state:1) (place "Knight2" {"B8" "H8"}) (place "Bishop2" {"C8" "G8"} state:1) (place "Queen2" {"D8" "F8"}) (place "King2" coord:"E8" state:1)}) (play (if "SameTurn" (move Promote (last To) (piece {"Queen" "Knight" "Bishop" "Rook"}) Mover) (do (or (forEach Piece) (if (and ("HasNeverMoved" "King") (not ("IsInCheck" "King" Mover))) (or (if (and ("HasNeverMoved" "RookLeft") (can Move ("CastleRook" "RookLeft" E 2 (is Empty (to))))) "BigCastling") (if (and ("HasNeverMoved" "RookRight") (can Move ("CastleRook" "RookRight" W 2 (is Empty (to))))) "SmallCastling")))) ifAfterwards:(not ("IsInCheck" "King" Mover))))) (end { ("Checkmate" "King") (if (or (no Moves Mover) (= (counter) 99)) (result Mover Draw))}))) END |
Construct a Ludii game based on the following description
- BOARDS: The stones in each board are responsible for the moving possibilities of the stones in the next board (clockwise direction).
E.g., board NW position determines the moves for board NE.
- MOVE: Every stone allows the stones in the next board to move according to its position (using the red point as a reference point).
E.g., A stone on b3, allows that player to move any stone in the next board one step to the left. A stone on e5 allows any stone in the next board to move two steps diagonally to the top right.
A stone on a red point is useless for the moves in the next board .
- TURN: On his turn a player must do one of two actions:
Drop: The player drops a friendly stone on an empty cell. If there are no more offboard stones, he cannot choose this action.
Move: The player moves a stone according to the moving rules. To move a stone there must be a friendly stone in the previous board.
The move is only allowed if the moving stone stays in the same board.
Stones jump. So if a stone moves from a5 to c5 (only possible if there is a friendly stone on e3 at the previous board) the status of b5 is irrelevant.
The destination cell must be empty or occupied with an opponent stone, which is captured and removed from play.
- GOAL: A player with no legal moves loses.
###
| (define "HopMove" (move Hop #1 (between if:True) (to if:(and (not ("IsFriendAt" (to))) ("IsFriendAt" (ahead (coord #2) steps:2 #1))) (apply (if ("IsEnemyAt" (to)) (remove (to))))))) (define "StepMove" (move Step #1 (to if:(and (not ("IsFriendAt" (to))) ("IsFriendAt" (ahead (coord #2) #1))) (apply (if ("IsEnemyAt" (to)) (remove (to))))))) (game "4 Squared" (players 2) (equipment { (board (merge { (square 5) (shift 5 0 (square 5)) (shift 0 5 (square 5)) (shift 5 5 (square 5))}) use:Vertex) (piece "Ball" Each (if (is In (from) (sites "SW")) (or { ("StepMove" S "H3") ("StepMove" SE "H3") ("StepMove" SW "H3") ("StepMove" E "H3") ("StepMove" W "H3") ("StepMove" NE "H3") ("StepMove" NW "H3") ("StepMove" N "H3") ("HopMove" S "H3") ("HopMove" SE "H3") ("HopMove" SW "H3") ("HopMove" E "H3") ("HopMove" W "H3") ("HopMove" NE "H3") ("HopMove" NW "H3") ("HopMove" N "H3")}) (if (is In (from) (sites "NW")) (or { ("StepMove" S "C3") ("StepMove" SE "C3") ("StepMove" SW "C3") ("StepMove" E "C3") ("StepMove" W "C3") ("StepMove" NE "C3") ("StepMove" NW "C3") ("StepMove" N "C3") ("HopMove" S "C3") ("HopMove" SE "C3") ("HopMove" SW "C3") ("HopMove" E "C3") ("HopMove" W "C3") ("HopMove" NE "C3") ("HopMove" NW "C3") ("HopMove" N "C3")}) (if (is In (from) (sites "NE")) (or { ("StepMove" S "C8") ("StepMove" SE "C8") ("StepMove" SW "C8") ("StepMove" E "C8") ("StepMove" W "C8") ("StepMove" NE "C8") ("StepMove" NW "C8") ("StepMove" N "C8") ("HopMove" S "C8") ("HopMove" SE "C8") ("HopMove" SW "C8") ("HopMove" E "C8") ("HopMove" W "C8") ("HopMove" NE "C8") ("HopMove" NW "C8") ("HopMove" N "C8")}) (if (is In (from) (sites "SE")) (or { ("StepMove" S "H8") ("StepMove" SE "H8") ("StepMove" SW "H8") ("StepMove" E "H8") ("StepMove" W "H8") ("StepMove" NE "H8") ("StepMove" NW "H8") ("StepMove" N "H8") ("HopMove" S "H8") ("HopMove" SE "H8") ("HopMove" SW "H8") ("HopMove" E "H8") ("HopMove" W "H8") ("HopMove" NE "H8") ("HopMove" NW "H8") ("HopMove" N "H8")})))))) (hand Each) (regions "SW" (expand origin:(coord "C3") steps:2 All)) (regions "SE" (expand origin:(coord "H3") steps:2 All)) (regions "NW" (expand origin:(coord "C8") steps:2 All)) (regions "NE" (expand origin:(coord "H8") steps:2 All))}) (rules (start (place "Ball" "Hand" count:15)) (play (or (forEach Piece) (if (is Occupied (handSite Mover)) (move (from (handSite Mover)) (to (sites Empty)))))) (end ("BlockWin")))) END |
Construct a Ludii game based on the following description
5x5 board, played on intersections of the lines, with diagonals for each quadrant of the board. One player plays as four tigers, the other as twenty goats. The tigers begin, two on the top two corners of the board, and two in the centers of the two bottom quadrants. Four of the goats are placed on any available points. The tigers move first, to an empty adjacent spot along the lines on the board. The player playing as the goats places one of the remaining goats on any available point. The goats cannot move until all of the goats are placed. Once they are all placed, the goats move as the tigers do. The tigers alone may capture a goat by hopping over it to an empty spot immediately opposite a goat. The tigers win by capturing all the goats; the goats win by blocking the tigers from being able to move.
###
| (game "Orissa Tiger Game (Four Tigers)" (players 2) (equipment { ("AlquerqueBoard" 5 5) (piece "Goat" P1 ("StepToEmpty")) (piece "Tiger" P2 (or ("StepToEmpty") ("HopCapture"))) (hand P1)}) (rules (start { (place "Goat1" (handSite P1) count:20) (place "Tiger2" (sites {"A5" "E5" "B2" "D2"}))}) phases:{ (phase "Placement" P1 (play (move (from (handSite P1)) (to (sites Empty)) (then (if (< 16 (count Cell at:(handSite P1))) (moveAgain))))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) ("PhaseMovePiece" "Movement")} (end ("NoMovesP2NoPiecesP1")))) END |
Construct a Ludii game based on the following description
7x7 board. 24 pieces per player. Players alternate turns placing two pieces on the board. The first piece of each player must be placed on a spot adjacent to the central spot. The central spot cannot be filled. When both players have placed their pieces, they move their pieces orthogonally to an empty adjacent space. When an opponent's piece is surrounded on two opposite sides by pieces belonging to the player, the opponent's piece is captured. The player who made the capture may move the same piece they moved to make a capture another time if another capture is possible by doing so.
The player who captures all of their opponent's pieces, or which blocks the opponent from being able to move, wins.
In a case where the second player has created a blockade of their pieces containing one or more of only their own pieces which can move infinitely without possibility of being taken, the second player player may declare H'ajeb in order to regain the possibility of winning. The second player declares H'ajeb on their turn, and then the first player gains the ability to move any distance orthogonally or diagonally. The first player may also make multiple captures not just with the same piece, but with more than one. The second player may rescind the H'ajeb declaration at any time and the captures must stop. If the second player allows the first player to continue until the first player cannot capture, the second player captures any two of the first player's pieces, and the first player captures one of the second player's pieces that is able to move infinitely.
###
| (define "CanCaptureAgain" (can Move (step (from (last To)) Orthogonal (to if:("IsConfigurationToCustodialAgain"))))) (define "IsConfigurationToCustodialAgain" (and (is Empty (to)) (or { (and ("IsEnemyAt" (ahead (to) W)) ("IsFriendAt" (ahead (to) steps:2 W))) (and ("IsEnemyAt" (ahead (to) E)) ("IsFriendAt" (ahead (to) steps:2 E))) (and ("IsEnemyAt" (ahead (to) N)) ("IsFriendAt" (ahead (to) steps:2 N))) (and ("IsEnemyAt" (ahead (to) S)) ("IsFriendAt" (ahead (to) steps:2 S)))}))) (game "Khamousiyya" (players 2) (equipment { (board (square 7)) (piece "Marker" Each ("StepToEmpty" Orthogonal (then ("CustodialCapture" Orthogonal (max 1) (then (if ("CanCaptureAgain") (moveAgain))))))) (hand Each)}) (rules (start (place "Marker" "Hand" count:24)) phases:{ (phase "Placement" (play (move (from (handSite Mover)) (to (if (no Pieces Mover in:(sites Board)) (forEach (sites Around (centrePoint) Orthogonal) if:(is Empty (site))) (difference (sites Board) (centrePoint))) if:(is Empty (to))) (then (if ("NewTurn") (moveAgain))))) (nextPhase Mover (is Empty (handSite Mover)) "Capture")) (phase "Capture" (play (if ("SameTurn") (or (move Step (from (last To)) Orthogonal (to if:("IsConfigurationToCustodialAgain")) (then ("CustodialCapture" Orthogonal (max 1) (then (if ("CanCaptureAgain") (moveAgain)))))) (move Pass)) (forEach Piece))))} (end ("BlockWin")))) END |
Construct a Ludii game based on the following description
3x6 board. Three counters per hole. Each player owns the row closest to them and the right half of the central row. Sowing occurs in the following direction: from left to right in the player's full row, right to left in the player's half of the central row, proceeding to the opponent's full row and sowing right to left, then left to right in the opponent's part of the central row, then proceeding back to the player's full row and proceeding as before. Sowing always begins from a player's own holes. When the last counter falls into an empty hole, the turn ends. If the last counter falls into an occupied hole, the contents of that hole are picked up and sowing continues. A hole is captured by dropping the last counter of a sowing into an opponent's hole which contains three counters, making it have four counters, and becomes a wegue. Captures cannot be made until after the original three counters placed in the holes at the beginning of the game have been moved. Once a wegue is created, the player cannot sow from it. When the final counter of a sowing lands in a wegue owned by the opponent, the player captures two counters from it. Play continues until all of the counters are captured or all of the counters are accumulated in wegue. A new round begins. Players then collect the counters in their captured holes. They count their takings by filling their holes with three counters each as in the beginning, and the player would own every hole they could fill with three counters. If the player has two counters remaining, they also gain another hole and the opponent surrenders their extra counter. At the end of play, if a player captures the opponent's single remaining hole as a wegue, the player captured three counters from it, leaving one for the opponent to continue to play. Play continues until one player cannot fill any holes.
###
| (define "SitesMarkedBy" (forEach (sites Board) if:(= #1 (state at:(site))))) (define "LeftMostEmpty" (trackSite FirstSite from:(mapEntry "LeftMost" Mover) if:(is Empty (to)))) (define "OnlyPiecesInMarked" (all Sites (forEach (sites Board) if:(= 0 (state at:(site)))) if:(= 0 (count at:(site))))) (define "RemmemberOwnedHoles" (if (is Mover P1) (remember Value "OwnedP1" #1) (remember Value "OwnedP2" #1))) (define "OpponentOwnedHoles" (if (is Mover P1) (sites (values Remembered "OwnedP2")) (sites (values Remembered "OwnedP1")))) (define "OwnedHoles" (if (is Mover P1) (sites (values Remembered "OwnedP1")) (sites (values Remembered "OwnedP2")))) (define "Columns" 6) (game "Gabata (Adowa)" (players 2) (equipment { (mancalaBoard 3 "Columns" store:None (track "Track" "0,E,N1,W2,17,W,S1,E2" loop:True)) (piece "Seed" Shared) (hand Each) (regions P1 (union (sites Bottom) (intersection (sites Row 1) (expand (sites Right) steps:2)))) (regions P2 (union (sites Top) (intersection (sites Row 1) (expand (sites Left) steps:2)))) (map "LeftMost" {(pair P1 0) (pair P2 17)})}) (rules (start { (set Count 3 to:(sites Track)) (set RememberValue "OwnedP1" (union (sites Bottom) (intersection (sites Row 1) (expand (sites Right) steps:2)))) (set RememberValue "OwnedP2" (union (sites Top) (intersection (sites Row 1) (expand (sites Left) steps:2))))}) phases:{ (phase "Sowing" (play (or { (move Select (from (if ("SameTurn") (sites {(var "Replay")}) ("OwnedHoles")) if:(and (< 0 (count at:(from))) (= 0 (state at:(from))))) (then (sow apply:(if (and { (= 0 (state at:(to))) (= 4 (count at:(to))) (is In (to) ("OpponentOwnedHoles"))}) (set State at:(to) (mover)) (if (< 1 (count at:(to))) (if (= 0 (state at:(to))) (and { (moveAgain) (set Var "Replay" (to))}) (if (!= (mover) (state at:(to))) (and { (fromTo (from (to)) (to (handSite Mover)) count:(min 2 (count at:(to)))) (set State at:(to) (state at:(to)))}))))))))} (then (if ("OnlyPiecesInMarked") (and { (forEach Site ("SitesMarkedBy" 1) (fromTo (from (site)) (to (handSite P1)) count:(count at:(site)))) (forEach Site ("SitesMarkedBy" 2) (fromTo (from (site)) (to (handSite P2)) count:(count at:(site)))) (forget Value "OwnedP1" All) (forget Value "OwnedP2" All)}))))) (end (if ("NoPieceOnBoard") { (if (>= 1 (count Cell at:(handSite P1))) (result P2 Win)) (if (>= 1 (count Cell at:(handSite P2))) (result P1 Win))})) (nextPhase ("NoPieceOnBoard") "BetweenRounds")) (phase "BetweenRounds" (play (if (<= 3 (count Cell at:(handSite Mover))) (move (from (handSite Mover)) (to ("LeftMostEmpty")) count:3 (then (and { ("RemmemberOwnedHoles" (last To)) (if (<= 3 (count Cell at:(handSite Mover))) (moveAgain) (if (= 2 (count Cell at:(handSite Mover))) (and { (fromTo (from (handSite Mover)) (to ("LeftMostEmpty")) count:2) (fromTo (from (handSite Next)) (to ("LeftMostEmpty")) count:1) ("RemmemberOwnedHoles" ("LeftMostEmpty"))})))}))))) (nextPhase (and (is Empty (handSite P1)) (is Empty (handSite P2))) "Sowing"))})) END |
Construct a Ludii game based on the following description
Players take turns placing one of their stones on an empty square. It is not legal to place orthogonally adjacent to only enemy stones and it is not legal to place orthogonally adjacent to more than 1 friendly stone. All other placements onto empty squares are legal. Put differently: You may place adjacent to no stone or to exactly 1 friendly and any number of enemy stones.
The first player unable to place a stone has won the game. A 6x6 board is currently selected
###
| (game "Pathway" (players 2) (equipment { (board (square 6)) (piece "Disc" Each)}) (rules (play (move Add (to (sites Empty) if:(or (all Sites (sites Around (to) Orthogonal) if:(is Empty (site))) (= 1 (count Sites in:(sites Around (to) Own Orthogonal))))))) (end ("NoMoves" Win)))) END |
Construct a Ludii game based on the following description
White starts and, in turn, pieces are placed on any one of 5 spaces, including on other pieces. The object is to get 3 same color pieces in a row - horizontally, vertically or diagonally.
###
| (game "Agilidade" (players 2) (equipment { (board (skew .5 (scale 1 .5 (merge { (wedge 2 2) (shift 0 1 (rotate 180 (wedge 2 2)))}))) use:Vertex) (piece "discFlat" Each) (hand Each)}) (rules (start { (place Stack "discFlat1" (handSite P1) count:7) (place Stack "discFlat2" (handSite P2) count:7)}) (play (move (from (handSite Mover)) (to (sites Board)))) (end (if (is Line 3 byLevel:True) (result Mover Win))))) END |
Describe the mechanics of the following Ludii game
(game "Selbia" (players 2) (equipment { ("AlquerqueBoard" 3 3) (hand Each) (piece "Marker" Each)}) (rules (start (place "Marker" "Hand" count:3)) (play (move (from (handSite Mover)) (to (sites Empty)))) (end ("Line3Win"))))
###
| 3x3 intersecting lines with diagonals in the square. Three pieces per player. Players alternate turns placing a piece on the board. The player who places three pieces in a row along one of the lines of the board wins. END |
Construct a Ludii game based on the following description
This game is played on a hexagonal board made up of hexagonal cells, usually 7 cells per side, although bigger sizes may also be used. Initially the board is empty except for the six corner cells, upon which black stones are placed. Then the players take it in turns to place 1-3 black stones each turn until one decides to pass; that player then becomes Black, and the other becomes White. After that, players take it in turns to place one stone of their colour on the board on any empty hex. If Black forms a continuous loop composed of their pieces, they win; if the board fills up with no loop of Black pieces being formed, White wins.
During the initial chicken ballot phase, you may add stones by clicking on available spaces, or skip the rest of your placements (by choosing the Next Player action). Alternatively, you may Pass at the start of your turn to take Black. After that, you and your opponent will alternate playing one stone of your colour per turn, until the board is full or Black forms a loop. Played on a Hexagonal Board, pre-filled corners. The game is played on a board with 7 hexes per side.
###
| (define "IsPlayingPhase" (= 1 (var))) (define "LimpCorners" (start { (place "Disc2" { 0 (- (/ (+ (* {3 #1 #1}) #1) 2) 1) (- (* 3 (* #1 #1)) #1)}) (place "Disc2" { #1 (/ (- (* {3 #1 #1}) (* 3 #1)) 2) (- (* 3 (* #1 #1)) 1)})})) (define "Skip" (move Set NextPlayer (player (next)))) (define "HexCorners" (start { (place "Disc2" { 0 (- (/ (- (* {3 #1 #1}) #1) 2) 1) (+ 1 (- (* {3 #1 #1}) (* 4 #1)))}) (place "Disc2" {(- #1 1) (+ 1 (/ (- (* {3 #1 #1}) (* 5 #1)) 2)) (- (* {3 #1 #1}) (* 3 #1))})})) (define "BlackVC" (is Loop)) (define "WhiteVC" (is Full)) (define "NonAdjacent" (not (is Within (id "Disc" P2) in:(sites Around (to))))) (define "Size" 7) (game "Coil" (players 2) (equipment { (board (hex Hexagon 7)) (piece "Disc" Each)}) (rules ("HexCorners" "Size") phases: { (phase "Opening" (play (or (or (move Add (piece (id "Disc" P2)) (to (sites Empty) if:"NonAdjacent") (then (if (< (count MovesThisTurn) 2) (moveAgain)))) "Skip") (if (= (count MovesThisTurn) 0) (move Pass (then (if (is Mover P1) (swap Players P1 P2 (then (note "Player 1 is now Black. Player 2 is now White." to:All))) (note "Player 1 remains White. Player 2 remains Black." to:All) (then (do (set NextPlayer (player 1)) next:(set Var 1))))))))) (nextPhase ("IsPlayingPhase") "Playing")) (phase "Playing" (play (move Add (to (sites Empty)))))} (end (forEach Player if:(and {("IsPlayingPhase") (= (id Player) (mover)) ("BlackVC")}) (result Player Win))))) END |
Modify the Ludii game according to the following option changes:
The game has 8 players. -> The game has 10 players.
(define "CaptureMove" (forEach Level (to) FromTop (if ("IsEnemyAt" (to) level:(level)) (remove (to) level:(level))))) (define "NoPieceOnBoard" (< (count Pieces Mover in:(sites Board)) 1)) (define "ThrowValue" (count Pips)) (game "Aj T'iwil" (players 8) (equipment { (board (rectangle 1 20) { (track "Track1" {19 0..18} P1 directed:True) (track "Track2" {20 0..18} P2 directed:True) (track "Track3" {21 0..18} P3 directed:True) (track "Track4" {22 0..18} P4 directed:True) (track "Track5" {23 18..0} P5 directed:True) (track "Track6" {24 18..0} P6 directed:True) (track "Track7" {25 18..0} P7 directed:True) (track "Track8" {26 18..0} P8 directed:True)} use:Edge) (regions "AllSites" (sites Board Vertex)) (piece "Stick" Each (forEach Value (values Remembered "Throws") (if ("IsOffBoard" ("NextSiteOnTrack" (value) from:(from) "Track")) (move (from (from) level:(level)) (to (handSite Mover) (apply (forget Value "Throws" (value))))) (move (from (from) level:(level) if:(if (is In (from) (sites Hand Mover)) ("NoPieceOnBoard") True)) (to ("NextSiteOnTrack" (value) from:(from) "Track") (apply (and ("CaptureMove") (forget Value "Throws" (value))))))))) ("StickDice" 4) (hand Each)}) (rules (start { (set Team 1 {P1 P2 P3 P4}) (set Team 2 {P5 P6 P7 P8}) (place Stack "Stick1" (handSite P1) count:5) (place Stack "Stick2" (handSite P2) count:5) (place Stack "Stick3" (handSite P3) count:5) (place Stack "Stick4" (handSite P4) count:5) (place Stack "Stick5" (handSite P5) count:5) (place Stack "Stick6" (handSite P6) count:5) (place Stack "Stick7" (handSite P7) count:5) (place Stack "Stick8" (handSite P8) count:5)}) phases:{ (phase "ThrowPhase" (play ("RollMove" (move Pass (then (if (not (no Pieces Mover)) (and { (if (!= 0 ("ThrowValue")) (do (remember Value "Throws" ("ThrowValue")) ifAfterwards:(can Move (or (forEach Piece container:(mover)) (forEach Piece))))) (moveAgain) (if ("SameTurn") (set Pending))})))))) (nextPhase (is Pending) "MovePhase")) (phase "MovePhase" (play (or (forEach Piece) (forEach Piece container:(mover)) (then (if (< 0 (size Array (values Remembered "Throws"))) (moveAgain))))) (nextPhase (= 0 (size Array (values Remembered "Throws"))) "ThrowPhase"))} (end ("CaptureAllTeam"))))
###
| (define "CaptureMove" (forEach Level (to) FromTop (if ("IsEnemyAt" (to) level:(level)) (remove (to) level:(level))))) (define "NoPieceOnBoard" (< (count Pieces Mover in:(sites Board)) 1)) (define "ThrowValue" (count Pips)) (game "Aj T'iwil" (players 10) (equipment { (board (rectangle 1 25) { (track "Track1" {24 0..23} P1 directed:True) (track "Track2" {25 0..23} P2 directed:True) (track "Track3" {26 0..23} P3 directed:True) (track "Track4" {27 0..23} P4 directed:True) (track "Track5" {28 0..23} P5 directed:True) (track "Track6" {29 23..0} P6 directed:True) (track "Track7" {30 23..0} P7 directed:True) (track "Track8" {31 23..0} P8 directed:True) (track "Track9" {32 23..0} P9 directed:True) (track "Track10" {33 23..0} P10 directed:True)} use:Edge) (regions "AllSites" (sites Board Vertex)) (piece "Stick" Each (forEach Value (values Remembered "Throws") (if ("IsOffBoard" ("NextSiteOnTrack" (value) from:(from) "Track")) (move (from (from) level:(level)) (to (handSite Mover) (apply (forget Value "Throws" (value))))) (move (from (from) level:(level) if:(if (is In (from) (sites Hand Mover)) ("NoPieceOnBoard") True)) (to ("NextSiteOnTrack" (value) from:(from) "Track") (apply (and ("CaptureMove") (forget Value "Throws" (value))))))))) ("StickDice" 4) (hand Each)}) (rules (start { (set Team 1 {P1 P2 P3 P4 P5}) (set Team 2 {P6 P7 P8 P9 P10}) (place Stack "Stick1" (handSite P1) count:5) (place Stack "Stick2" (handSite P2) count:5) (place Stack "Stick3" (handSite P3) count:5) (place Stack "Stick4" (handSite P4) count:5) (place Stack "Stick5" (handSite P5) count:5) (place Stack "Stick6" (handSite P6) count:5) (place Stack "Stick7" (handSite P7) count:5) (place Stack "Stick8" (handSite P8) count:5) (place Stack "Stick9" (handSite P9) count:5) (place Stack "Stick10" (handSite P10) count:5)}) phases:{ (phase "ThrowPhase" (play ("RollMove" (move Pass (then (if (not (no Pieces Mover)) (and { (if (!= 0 ("ThrowValue")) (do (remember Value "Throws" ("ThrowValue")) ifAfterwards:(can Move (or (forEach Piece container:(mover)) (forEach Piece))))) (moveAgain) (if ("SameTurn") (set Pending))})))))) (nextPhase (is Pending) "MovePhase")) (phase "MovePhase" (play (or (forEach Piece) (forEach Piece container:(mover)) (then (if (< 0 (size Array (values Remembered "Throws"))) (moveAgain))))) (nextPhase (= 0 (size Array (values Remembered "Throws"))) "ThrowPhase"))} (end ("CaptureAllTeam")))) END |
Construct a Ludii game based on the following description
2x6 board. Six counters in each hole. Sowing occurs from any of the holes in the player's row, and continues in a clockwise direction. If the final counter lands in a hole in the player's row containing three counters, four with the addition of the final counter, these are captured. Play continues until one player cannot move or the board position repeats. When one player cannot move, the other player captures the remaining counters. The player with the most counters wins. The game ends if no moves or a repeating state is detected.
###
| (define "PiecesOwnedBy" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (game "Unnee Tugalluulax" (players 2) (equipment { (mancalaBoard 2 6 store:None (track "Track" "5,W,N,E" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece "Seed" Shared) (hand Each)}) (rules (start (set Count 6 to:(sites Track))) (play (move Select (from (sites Mover) if:(< 0 (count at:(from)))) (then (sow if:(= (count at:(to)) 4) apply:(fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))))))) (end ("MancalaByScoreWhen" (or (no Moves Mover) (is Cycle)))))) END |
Modify the Ludii game according to the following option changes:
Capturing is optional. -> Capturing is forced.
(game "Felli" (players 2) (equipment { (board (graph vertices:{ {0 0} {2 0} {4 0} {1 1} {2 1} {3 1} {2 2} {1 3} {2 3} {3 3} {0 4} {2 4} {4 4}} edges:{ {0 1} {0 3} {1 2} {1 4} {2 5} {3 4} {3 6} {4 5} {4 6} {5 6} {6 7} {6 8} {6 9} {7 8} {7 10} {8 9} {8 11} {9 12} {10 11} {11 12}}) use:Vertex) (piece "Counter" Each) (piece "DoubleCounter" Each) (regions P1 (intersection (sites Corners) (sites Bottom))) (regions P2 (intersection (sites Corners) (sites Top)))}) (rules (start { (place "Counter1" (expand (sites Bottom))) (place "Counter2" (expand (sites Top)))}) (play (or { (forEach Piece "Counter" ("HopCapture")) (forEach Piece "Counter" ("StepToEmpty"))})) (end ("NoMoves" Loss))))
###
| (game "Felli" (players 2) (equipment { (board (graph vertices:{ {0 0} {2 0} {4 0} {1 1} {2 1} {3 1} {2 2} {1 3} {2 3} {3 3} {0 4} {2 4} {4 4}} edges:{ {0 1} {0 3} {1 2} {1 4} {2 5} {3 4} {3 6} {4 5} {4 6} {5 6} {6 7} {6 8} {6 9} {7 8} {7 10} {8 9} {8 11} {9 12} {10 11} {11 12}}) use:Vertex) (piece "Counter" Each) (piece "DoubleCounter" Each) (regions P1 (intersection (sites Corners) (sites Bottom))) (regions P2 (intersection (sites Corners) (sites Top)))}) (rules (start { (place "Counter1" (expand (sites Bottom))) (place "Counter2" (expand (sites Top)))}) (play (if "SameTurn" ("HopSequenceCaptureAgain") (priority { (forEach Piece "Counter" ("HopSequenceCapture")) (forEach Piece "Counter" ("StepToEmpty"))}))) (end ("NoMoves" Loss)))) END |
Construct a Ludii game based on the following description
8x8 board. Eight pieces per player, which begin on alternating squares in the first two rows on opposing sides of the board. Players alternate turns moving one of their pieces to an adjacent space. Pieces move diagonally forward only. A piece may capture one of the opponent's adjacent pieces by hopping over it to an empty adjacent space immediately on the opposite side of the opponent's piece. Multiple captures are not allowed. When a piece arrives at the opposite edge of the board from where it began, it is promoted and may move diagonally forward or backward. The player who captures all of the opponent's pieces wins.
###
| (define "IsUnpromoted" ("IsPieceAt" "Counter" Mover (last To))) (game "Doov" ("TwoPlayersNorthSouth") ("DraughtsEquipment" (square 8)) (rules ("BlackCellsSetup" 2) (play (or (or (forEach Piece "Counter" ("HopCapture" (from) (directions {FR FL}) (then ("PromoteIfReach" (sites Next) "DoubleCounter")))) (forEach Piece "DoubleCounter" ("HopDiagonalCapture"))) (or (forEach Piece "Counter" ("StepToEmpty" (directions {FR FL})) (then ("PromoteIfReach" (sites Next) "DoubleCounter"))) (forEach Piece "DoubleCounter" "StepDiagonalToEmpty")))) (end ("BlockWin")))) END |
Construct a Ludii game based on the following description
Forty stones arranged in a circle, with a larger gap after every tenth stone, the spaces between the stones are the playing spaces. Four or six players, played on two teams, with two sticks per team, starting in one of the gaps. Three sticks, round on one side and flat on the other, used as dice. The throws are as follows: three round sides = 10; two round sides = 2; one round side = 3; three flat sides = 5. A throw of 10 grants the player another throw. Pieces move according to the throws in opposite directions around the board. The team to get their pieces to the starting gap wins. The game has 6 players.
###
| (define "Move" (move (from (sites Occupied by:#1)) (to ("NextSiteOnTrack" ("ThrowValue") #2) if:(not ("IsEnemyAt" (to)))))) (define "ThrowValue" (mapEntry "Throw" (count Pips))) (game "Setichch" (players 6) (equipment { ("FortyStonesWithFourGapsBoard" { (track "TrackCW" {39 35 33 31 29 27 25 23 21 19 38 17 15 13 11 9 7 5 3 1 37 0 2 4 6 8 10 12 14 16 36 18 20 22 24 26 28 30 32 34} loop:True) (track "TrackCCW" {39 34 32 30 28 26 24 22 20 18 36 16 14 12 10 8 6 4 2 0 37 1 3 5 7 9 11 13 15 17 38 19 21 23 25 27 29 31 33 35} loop:True)}) (regions "AllSites" (sites Board)) (piece "Stick" P1) (piece "Stick" P2) ("StickDice" 3) (hand Each) (map "Throw" {(pair 0 5) (pair 1 3) (pair 2 2) (pair 3 10)})}) (rules (start { (place Stack "Stick1" Edge 36 count:2) (place Stack "Stick2" Edge 38 count:2) (set Team 1 {P1 P3 P5}) (set Team 2 {P2 P4 P6})}) (play ("RollMove" (if (is In (mover) (players Team1)) ("Move" Team1 "TrackCW") ("Move" Team2 "TrackCCW")) (then (if (= 10 ("ThrowValue")) (moveAgain))))) (end { (if (and { (is In (mover) (players Team1)) (= 1 (count Sites in:(sites Occupied by:Team1))) (= 36 (where "Stick" Team1))}) (result Team1 Win)) (if (and { (is In (mover) (players Team2)) (= 1 (count Sites in:(sites Occupied by:Team2))) (= 38 (where "Stick" Team2))}) (result Team2 Win))}))) END |
Construct a Ludii game based on the following description
2x6 board. Three counters in each hole. Sowing occurs from one of the holes in the player's row. If the final counter lands in an occupied hole, these counters are picked up and sowing continues. If the final counter lands in an empty hole in the player's own row, any counters in the opposite row hole are captured. A player wins when the opponent's row is empty.
###
| (define "Columns" 6) (game "Altiev" (players 2) (equipment { (mancalaBoard 2 "Columns" store:None (track "Track" "0,E,N,W" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece "Seed" Shared) (hand Each)}) (rules (start (set Count 3 to:(sites Track))) (play (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover)) if:(> (count at:(from)) 0)) (then (sow apply:(if (> (count at:(to)) 1) (moveAgain) (if (is In (to) (sites Mover)) (fromTo (from ("OppositePitTwoRows" (to))) (to (handSite Mover)) count:(count at:("OppositePitTwoRows" (to)))))))))) (end { (if (all Sites (sites P1) if:(= 0 (count at:(site)))) (result P2 Win)) (if (all Sites (sites P2) if:(= 0 (count at:(site)))) (result P1 Win))}))) END |
Construct a Ludii game based on the following description
Every turn, the current player can choose to pass, or select a previously-unselected edge. If the selected edge is disjoint from any other friendly edge, then the player gets 1 point. If the graph is full (i.e., all edges have been selected) or both players are passed their turn, the game is over and the winner is selected by their score.
###
| (game "MaxMatch" (players 2) (equipment { (board (graph vertices:{ {0 1} {3 1} {6 1} {8 1} {10 1} {0 2} {2 2} {4 2} {6 2} {8 2} {0 3} {3 3} {5 3} {7 3} {8 3} {10 3} {2 5} {4 5} {0 5} {3 5} {7 5} {5 5} {10 5}} edges:{{0 6} {5 6} {6 10} {1 6} {6 11} {6 7} {7 8} {8 2} {8 12} {8 13} {12 13} {8 9} {9 3} {9 14} {9 4} {9 15} {4 15} {11 16} {11 17} {16 18} {16 19} {12 21} {12 20} {13 20} {14 22} {15 22}}) use:Vertex)}) (rules (play (or (move Add (to Edge (sites Empty Edge)) (then (if (is Path Edge Mover length:(exact 1)) (addScore Mover 1)))) (move Pass))) (end (if (all Passed) (byScore))))) END |
Construct a Ludii game based on the following description
8x8 board, twelve pieces per player. Pieces placed on the dark squares of the first three rows of each side, with the empty corner to the right of each player. Pieces move one space forward diagonally. They may capture pieces of the opponent by hopping over them. Captures may happen in any direction. Multiple captures are allowed in the same turn, but they may not hop over the same piece or a player's own piece. Captures are compulsory, but if more than one option exists the player may choose which capture to make. When a piece reaches the opposite edge of the board, it becomes a king, even if this is in the middle of a turn. Kings may move any number of spaces forward or backwards, and may capture by flying leap. Kings must take all possible pieces in a sequence. The player to capture all of the other player's pieces wins.
###
| (define "JumpToPromotionZone" (is In (last To) (sites Next))) (define "IsUnpromoted" ("IsPieceAt" "Counter" Mover (last To))) (game "Jekab" ("TwoPlayersNorthSouth") ("DraughtsEquipment" (square 8)) (rules ("BlackCellsSetup" 3) (play (if "SameTurn" (if "IsUnpromoted" ("HopInternationalDraughtsStyle" (from (last To)) (then (if "JumpToPromotionZone" (and ("ReplayIfCanMove" ("HopDiagonalSequenceCaptureAgain" before:(count Rows) after:(count Rows) at:EndOfTurn)) (promote (last To) (piece "DoubleCounter") Mover)) ("ReplayIfCanMove" ("HopInternationalDraughtsStyle" (from (last To))))))) (max Moves ("HopDiagonalSequenceCaptureAgain" before:(count Rows) after:(count Rows) at:EndOfTurn))) (priority { (or (forEach Piece "Counter" ("HopInternationalDraughtsStyle" (from) (then (if "JumpToPromotionZone" (and ("ReplayIfCanMove" ("HopDiagonalSequenceCaptureAgain" before:(count Rows) after:(count Rows) at:EndOfTurn)) (promote (last To) (piece "DoubleCounter") Mover)) ("ReplayIfCanMove" ("HopInternationalDraughtsStyle" (from (last To)))))))) (max Moves (forEach Piece "DoubleCounter" ("HopDiagonalSequenceCapture" before:(count Rows) after:(count Rows) at:EndOfTurn)))) (or (forEach Piece "Counter" ("StepToEmpty" (directions {FR FL})) (then ("PromoteIfReach" (sites Next) "DoubleCounter"))) (forEach Piece "DoubleCounter" (move Slide Diagonal)))}))) (end ("BlockWin")))) END |
Describe the mechanics of the following Ludii game
(game "Saxun" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) ("ChessPawn" "Pawn") ("ChessRook" "Rook") ("ChessKing" "King_noCross") ("ChessBishop" "Bishop_noCross") ("ChessKnight" "Knight") ("ChessQueen" "Queen")}) (rules (start { (place "Pawn1" {"F4" "G4" "H4" "B3" "C3" "D3" "E3" "A2"}) (place "Pawn2" {"H7" "H6" "G6" "F6" "E6" "A5" "B5" "C5"}) (place "Rook1" {"C2" "D1"}) (place "Knight1" {"B1" "H2"}) (place "Bishop_noCross1" {"E1" "F1"}) (place "Queen1" coord:"D2") (place "King_noCross1" coord:"C1") (place "Rook2" {"C7" "B8"}) (place "Knight2" {"A7" "H8"}) (place "Bishop_noCross2" {"F7" "G7"}) (place "Queen2" coord:"B7") (place "King_noCross2" coord:"C8")}) (play (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King_noCross" Mover)))) (end ("Checkmate" "King_noCross"))))
###
| 8x8 checkered board. The pieces move as follows: Álix' (\ END |
Describe the mechanics of the following Ludii game
(define "ThreeStones" (or { (= 3 (count Sites in: (forEach (sites Row (row of:(last To))) if:("IsFriendAt" (site))))) (= 3 (count Sites in: (forEach (sites Column (column of:(last To))) if:("IsFriendAt" (site))))) (= 3 (count Sites in: (forEach (union (sites Direction from:(last To) NE included:True) (sites Direction from:(last To) SW)) if:("IsFriendAt" (site))))) (= 3 (count Sites in: (forEach (union (sites Direction from:(last To) NW included:True) (sites Direction from:(last To) SE)) if:("IsFriendAt" (site)))))})) (game "Trianon" (players 2) (equipment { (board (square 5) use:Vertex) (piece "Ball" Each)}) (rules (play (move Add (to (sites Empty)))) (end (if ("ThreeStones") (result Mover Loss)))))
###
| TURN - On each turn, each player drops a stone on an empty cell
GOAL - A player loses if he has 3 friendly stones on an orthogonal or diagonal line (they don't need to be adjacent to each other). END |
Construct a Ludii game based on the following description
This game is played on a square grid board of any size, though 13x13 or 19x19 are recommended. Then the players take it in turns to place 1-3 black stones each turn until one decides to pass; that player then becomes Black, and the other becomes White. After that, players take it in turns to place one stone of their colour on the board on any empty point. If Black connects any two sides of the board with a single orthogonally-connected group, they win; White wins if they connect all four sides with a group connected either orthogonally or diagonally.
During the initial chicken ballot phase, you may add stones by clicking on available spaces, or skip the rest of your placements (by choosing the Next Player action). Alternatively, you may Pass at the start of your turn to take Black. After that, you and your opponent will alternate playing one stone of your colour per turn, until one player forms a connection (draws are impossible in Pippinzip). Played on a size 13 board.
###
| (define "Skip" (move Set NextPlayer (player (next)))) (define "IsPlayingPhase" (= 1 (var))) (define "BlackVC" (or (is Connected Orthogonal {(sites Side N) (sites Side S)}) (is Connected Orthogonal {(sites Side E) (sites Side W)}))) (define "WhiteVC" (is Connected All {(sites Side N) (sites Side S) (sites Side E) (sites Side W)})) (game "Pippinzip" (players 2) (equipment { (board (square 13) use:Vertex) (piece "Disc" Each)}) (rules phases:{ (phase "Opening" (play (or (or (move Add (piece (id "Disc" P2)) (to (sites Empty)) (then (if (< (count MovesThisTurn) 2) (moveAgain)))) "Skip") (if (= (count MovesThisTurn) 0) (move Pass (then (if (is Mover P1) (swap Players P1 P2 (then (note "Player 1 is now Black. Player 2 is now White." to:All))) (note "Player 1 remains White. Player 2 remains Black." to:All) (then (do (set NextPlayer (player 1)) next:(set Var 1))))))))) (nextPhase ("IsPlayingPhase") "Playing")) (phase "Playing" (play (move Add (to (sites Empty)))))} (end { (if (and (not ("IsPlayingPhase")) ("BlackVC")) (result Mover Win)) (if (and {(= (id P2) (mover)) ("BlackVC")}) (result P2 Win)) (if (and {(= (id P1) (mover)) ("WhiteVC")}) (result P1 Win))}))) END |
Modify the Ludii game according to the following option changes:
The game has 2 players. -> The game has 3 players.
(define "Move" (move (from (from) level:(level)) (to ("SiteToMoveOnTrack" ("ThrowValue")) if:True ("HittingCapture" (mapEntry "Start" (who at:(to))))) (then (forEach Site (sites Track Mover "Track" from:("NextSite" (last From) "Track") to:(last To)) (if ("IsEnemyAt" (site)) (forEach Level (site) (move (from (site) level:(level)) (to (mapEntry "Start" (who at:(site) level:(level))))))))))) (define "MadeACompleteCircuit" (is In (mapEntry "Start" Mover) (sites Track Mover "Track" from:("NextSite" (last From) "Track") to:(last To)))) (define "NextSite" ("NextSiteOnTrack" 1 from:#1 #2)) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" #1)) (define "ThrowValue" (mapEntry "Throw" (count Pips))) (game "Set Dilth'" (players 2) (equipment { ("FortyStonesWithFourGapsBoard" { (track "Track1" {39 34 32 30 28 26 24 22 20 18 36 16 14 12 10 8 6 4 2 0 37 1 3 5 7 9 11 13 15 17 38 19 21 23 25 27 29 31 33 35} loop:True P1) (track "Track2" {39 35 33 31 29 27 25 23 21 19 38 17 15 13 11 9 7 5 3 1 37 0 2 4 6 8 10 12 14 16 36 18 20 22 24 26 28 30 32 34} loop:True P2)}) (regions "AllSites" (sites Board)) (map "Throw" {(pair 0 10) (pair 1 2) (pair 2 3) (pair 3 5)}) (map "Start" {(pair 1 37) (pair 2 38) (pair 3 39) (pair 4 36)}) (piece "Stick" Each ("Move")) ("StickDice" 3)}) (rules (start { (set Team 1 {P1}) (set Team 2 {P2}) (place Stack "Stick1" 37) (place Stack "Stick2" 38)}) (play ("RollMove" (forEach Piece) (then (do (if ("MadeACompleteCircuit") (addScore Mover 1) (then (if (= (score Mover) 3) (remove (last To))))) next:(if (and (!= 3 (score Mover)) (= 10 ("ThrowValue"))) (moveAgain)))))) (end (if (>= (score Mover) 4) (result Mover Win)))))
###
| (define "Move" (move (from (from) level:(level)) (to ("SiteToMoveOnTrack" ("ThrowValue")) if:True ("HittingCapture" (mapEntry "Start" (who at:(to))))) (then (forEach Site (sites Track Mover "Track" from:("NextSite" (last From) "Track") to:(last To)) (if ("IsEnemyAt" (site)) (forEach Level (site) (move (from (site) level:(level)) (to (mapEntry "Start" (who at:(site) level:(level))))))))))) (define "MadeACompleteCircuit" (is In (mapEntry "Start" Mover) (sites Track Mover "Track" from:("NextSite" (last From) "Track") to:(last To)))) (define "NextSite" ("NextSiteOnTrack" 1 from:#1 #2)) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" #1)) (define "ThrowValue" (mapEntry "Throw" (count Pips))) (game "Set Dilth'" (players 3) (equipment { ("FortyStonesWithFourGapsBoard" { (track "Track1" {39 34 32 30 28 26 24 22 20 18 36 16 14 12 10 8 6 4 2 0 37 1 3 5 7 9 11 13 15 17 38 19 21 23 25 27 29 31 33 35} loop:True P1) (track "Track2" {39 35 33 31 29 27 25 23 21 19 38 17 15 13 11 9 7 5 3 1 37 0 2 4 6 8 10 12 14 16 36 18 20 22 24 26 28 30 32 34} loop:True P2) (track "Track3" {39 34 32 30 28 26 24 22 20 18 36 16 14 12 10 8 6 4 2 0 37 1 3 5 7 9 11 13 15 17 38 19 21 23 25 27 29 31 33 35} loop:True P3)}) (regions "AllSites" (sites Board)) (map "Throw" {(pair 0 10) (pair 1 2) (pair 2 3) (pair 3 5)}) (map "Start" {(pair 1 37) (pair 2 38) (pair 3 39) (pair 4 36)}) (piece "Stick" Each ("Move")) ("StickDice" 3)}) (rules (start { (set Team 1 {P1 P3}) (set Team 2 {P2}) (place Stack "Stick1" 37) (place Stack "Stick2" 38) (place Stack "Stick3" 39)}) (play ("RollMove" (forEach Piece) (then (do (if ("MadeACompleteCircuit") (addScore Mover 1) (then (if (= (score Mover) 3) (remove (last To))))) next:(if (and (!= 3 (score Mover)) (= 10 ("ThrowValue"))) (moveAgain)))))) (end (if (>= (score Mover) 4) (result Mover Win))))) END |
Construct a Ludii game based on the following description
4x10-20 holes, with even numbers. Two counters in each hole, except the rightmost hole in the inner row of each player, which has zero, and the hole to its left, which has one. Sowing occurs in an anti-clockwise direction. When the final counter lands in an occupied hole, these are picked up and sowing continues. When the final counter lands in an empty hole in the inner row, the counters in the opposite hole in the opponent's inner row are captured. If counters are captured from the inner row, and there are also counters in the outer row, the counters in the outer row are also captured. If counters in the inner and outer row are captured, the player may also capture counters from two other holes on the opponent's side of the board. Single counters cannot be sown until there are no holes with multiple counters on the player's side of the board, and then single counters may only be sown into empty holes. Play continues until one player captures all of their opponent's counters, thus winning the game. Each row has 10 holes.
###
| (define "NextHoleFrom" ("NextSiteOnTrack" 1 from:#1)) (define "HaveHolesWithMoreThanOneCounter" (not (all Sites (forEach (sites Mover "Home") if:(< 1 (count at:(site)))) if:(= 0 (count at:(site)))))) (define "NoPiece" (all Sites (sites Player "Home") if:(= 0 (count at:(site))))) (define "Columns" 10) (game "Msuwa" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "Track1" "0,E,N1,W" loop:True P1) (track "Track2" "20,E,N1,W" loop:True P2)}) (regions "Home" P1 (sites Track "Track1")) (regions "Home" P2 (sites Track "Track2")) (regions "Inner" P1 (difference (sites Track "Track1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "Track2") (sites Top))) (piece "Seed" Shared)}) (rules (start { (set Count 2 to:(difference (sites Board) (sites {18..21}))) (set Count 1 to:(sites {18 21}))}) (play (if (and ("SameTurn") (< 0 (var))) (move Remove (forEach (sites Next "Home") if:(< 0 (count at:(site)))) (then (and (if (> (var) 1) (moveAgain)) (set Var (- (var) 1))))) (if ("HaveHolesWithMoreThanOneCounter") (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover "Home")) if:(< 1 (count at:(from)))) (then (sow "Track" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover "Inner")) (if (< 0 (count at:("OppositePit" (to)))) (and (remove ("OppositePit" (to))) (if (< 0 (count at:("OppositeOuterPit" (to)))) (and { (remove ("OppositeOuterPit" (to))) (set Var 2) (moveAgain)}))))))))) (move Select (from (sites Mover "Home") if:(and (= 1 (count at:(from))) (= 0 (count at:("NextHoleFrom" (from)))))) (then (sow "Track" owner:(mover) apply: (if (is In (to) (sites Mover "Inner")) (if (< 0 (count at:("OppositePit" (to)))) (and (remove ("OppositePit" (to))) (if (< 0 (count at:("OppositeOuterPit" (to)))) (and { (remove ("OppositeOuterPit" (to))) (set Var 2) (moveAgain)}))))))))))) (end (forEach NonMover if:("NoPiece") (result Player Loss))))) END |
Construct a global Ludii definition which fulfills the following requirements.
Defines a move from a region to any empty sites or sites occupied by a larger pieces on the board. This ludemeplex involves stacks and the size of the piece are related to the indexes of the pieces (in the hypothesis that each player has the same number of pieces). Some graphic metadata will be needed to scale the pieces according to this.
###
| (define "MoveToEmptyOrOccupiedByLargerPiece" (move (from #1) (to (sites Board) if:(and (!= (from) (to)) (or (is Empty (to)) (< (- (what at:(from) level:(topLevel at:(from))) (who at:(from) level:(topLevel at:(from)))) (- (what at:(to) level:(topLevel at:(to))) (who at:(to) level:(topLevel at:(to)))))))))) END |
Construct a Ludii game based on the following description
Played on a board similar to Perali Kotuma, with the addition of triangular extensions on the four corners. Play begins with nine pieces for each player. Pieces move along the lines to the next open space. Opponent's pieces can be captured by hopping over them. Within the triangular extensions, pieces may move two places at a time, in a straight line. The player to capture all of the opponent's pieces wins.
###
| (define "WithinTrianglePieceCanMoveDistanceTwo" (move Slide (between (exact 2) if:(and (is Empty (between)) (not (is In (between) ("SitesNotInTriangle"))))))) (define "SitesNotInTriangle" (difference (expand (sites Centre) steps:2) (sites {"F6" "I6" "L6" "F9" "L9" "F12" "I12" "L12"}))) (game "Terhuchu" (players 2) (equipment { ("AlquerqueBoardWithEightTriangles") (piece "Marker" Each (or { ("HopCapture") ("StepToEmpty") (if (not (is In (from) "SitesNotInTriangle")) ("WithinTrianglePieceCanMoveDistanceTwo"))}))}) (rules (start { (place "Marker1" (sites {"H3" "F6" "G6" "H6" "I6" "J6" "L6" "H8" "I8" "J8"})) (place "Marker2" (sites {"H10" "I10" "J10" "F12" "H12" "I12" "J12" "L12" "J15"}))}) (play (forEach Piece)) (end ("NoMoves" Loss)))) END |
Construct a global Ludii definition which fulfills the following requirements.
Defines a table board (without the style).
###
| (define "TableBoard" (board (merge { (rectangle 1 6) (shift 7 0 (rectangle 1 6)) (shift 0 6 (rectangle 1 6)) (shift 7 6 (rectangle 1 6))}) #1 use:Vertex)) END |
Construct a Ludii game based on the following description
Players take turns placing pieces on the board. There are three winning conditions: 1. Connect any three edges (without corner points), or 2. Make a bridge connection between any two corners, or 3. loop around any site. The game is played on a 8x8 board The game does not use the swap rule.
###
| (game "Havannah" (players 2) (equipment { (board (hex 8)) (piece "Marker" Each)}) (rules (play (move Add (to (sites Empty)))) (end (if (or { (is Loop) (is Connected 3 SidesNoCorners) (is Connected 2 Corners)}) (result Mover Win))))) END |
Construct a global Ludii definition which fulfills the following requirements.
Defines a rectangular graph with Alquerque-style alternating diagonals with a triangle extension at the bottom.
###
| (define "AlquerqueGraphWithBottomTriangle" (merge (shift 0 2 (square 5 diagonals:Alternating)) (wedge 3))) END |
Construct a global Ludii definition which fulfills the following requirements.
Defines a step move to all the orthogonal directions to an empty site.
###
| (define "StepOrthogonalToEmpty" (move Step Orthogonal (to if:(is Empty (to))))) END |
Construct a Ludii game based on the following description
Four players, playing on teams of two. 1 x Shah (king): moves one space orthogonally or diagonally. 2 x Rukh (rook): Any number of spaces orthogonally. 2 x Pil (elephant): any distance diagonally; 2 x Asb (horse): Moves as a chess knight. 8 x Sarbaz (soldier): Moves one space forward orthogonally; one space forward diagonally to capture. The pieces of one team are arranged with Shahs on the two central squares of the outer rows, then the Pils, ASbs, and Rukhs, with the Sarbaz in the row in front of them. When a piece moves onto a space occupied by an opponent's piece, the opponent's piece is captured. When a Shah can be captured on the next turn, it is in check, and cannot remain in check at the end of that player's turn. When this is not possible, it is checkmate, and that player is out of the game. A team wins by checkmating both opposing Kings, or by capturing all of the opponents' pieces aside from the Kings. If all four Kings are the only remaining pieces, the game is a draw.
###
| (define "InitialPawnMove" (if (is In (from) (sites Start (piece (what at:(from))))) ("DoubleStepForwardToEmpty"))) (define "RemovePiecesIfCheckmate" (if (and (is Active #1) (not (is Mover #1))) (if (or (and ("IsInCheck" "King_noCross" #1) ("CanNotMove" #1 #2)) ("IsOffBoard" (where (id "King_noCross" #1)))) (forEach Site (sites Occupied by:#1) (remove (site)))))) (define "CanNotMove" (not (can Move (do (and (forEach Piece #1) (set NextPlayer (player #2))) ifAfterwards:(not ("IsInCheck" "King_noCross" #1)))))) (define "KingNotCheckedAndToEmpty" (and (is Empty (to)) (not ("IsInCheck" "King_noCross" Mover at:(to))))) (game "Chatrang" (players {(player N) (player S) (player N) (player S)}) (equipment { (board (square 8)) ("ChessPawn" "Pawn" "InitialPawnMove") ("ChessRook" "Rook") ("ChessKing" "King_noCross") ("ChessBishop" "Elephant") ("ChessKnight" "Knight")}) (rules (start { (place "Pawn1" (intersection (expand (sites Left) steps:3) (sites Row 1))) (place "Pawn2" (intersection (expand (sites Right) steps:3) (sites Row 6))) (place "Pawn3" (intersection (expand (sites Right) steps:3) (sites Row 1))) (place "Pawn4" (intersection (expand (sites Left) steps:3) (sites Row 6))) (place "Rook1" {"A1"}) (place "Knight1" {"B1"}) (place "Elephant1" {"C1"}) (place "King_noCross1" coord:"D1") (place "Rook3" {"H1"}) (place "Knight3" {"G1"}) (place "Elephant3" {"F1"}) (place "King_noCross3" coord:"E1") (place "Rook2" {"H8"}) (place "Knight2" {"G8"}) (place "Elephant2" {"F8"}) (place "King_noCross2" coord:"E8") (place "Rook4" {"A8"}) (place "Knight4" {"B8"}) (place "Elephant4" {"C8"}) (place "King_noCross4" coord:"D8") (set Team 1 {P1 P3}) (set Team 2 {P2 P4})}) (play (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King_noCross" Mover)) (then (and { ("RemovePiecesIfCheckmate" P1 1) ("RemovePiecesIfCheckmate" P2 2) ("RemovePiecesIfCheckmate" P3 3) ("RemovePiecesIfCheckmate" P4 4)})))) (end { (forEach NonMover if:("IsOffBoard" (where "King_noCross" Player)) (result Player Loss)) (if (and { (no Pieces Enemy "Pawn") (no Pieces Enemy "Knight") (no Pieces Enemy "Elephant") (no Pieces Enemy "Rook")}) (result TeamMover Win))}))) END |
Modify the Ludii game according to the following option changes:
The game is played on a size 5 board -> The game is played on a size 9 board
(define "RemoveGroups" (forEach Site (sites Around (sites Group at:(last To)) Enemy) (remove (sites Group at:(site))))) (define "Captures" (and (all Sites (sites Around (sites Group at:(last To)) Enemy) if:(> (size Group at:(last To)) (size Group at:(site)))) (< 0 (count Sites in:(sites Around (sites Group at:(last To)) Enemy))))) (define "FriendlyAdjacent" (< 0 (count Sites in:(sites Around (to) Own)))) (define "NoFriendlyAdjacent" (= 0 (count Sites in:(sites Around (to) Own)))) (game "Oust" (players 2) (equipment { (board (hex 5)) (piece "Disc" Each)}) (rules (play (or (move Add (to (sites Empty) if:"NoFriendlyAdjacent")) (do (move Add (to (sites Empty) if:"FriendlyAdjacent")) ifAfterwards:"Captures" (then (and ("RemoveGroups") (moveAgain)))))) (end (if (and (< 2 (count Moves)) (= 0 (count Sites in:(sites Occupied by:Enemy)))) (result Mover Win)))))
###
| (define "RemoveGroups" (forEach Site (sites Around (sites Group at:(last To)) Enemy) (remove (sites Group at:(site))))) (define "Captures" (and (all Sites (sites Around (sites Group at:(last To)) Enemy) if:(> (size Group at:(last To)) (size Group at:(site)))) (< 0 (count Sites in:(sites Around (sites Group at:(last To)) Enemy))))) (define "FriendlyAdjacent" (< 0 (count Sites in:(sites Around (to) Own)))) (define "NoFriendlyAdjacent" (= 0 (count Sites in:(sites Around (to) Own)))) (game "Oust" (players 2) (equipment { (board (hex 9)) (piece "Disc" Each)}) (rules (play (or (move Add (to (sites Empty) if:"NoFriendlyAdjacent")) (do (move Add (to (sites Empty) if:"FriendlyAdjacent")) ifAfterwards:"Captures" (then (and ("RemoveGroups") (moveAgain)))))) (end (if (and (< 2 (count Moves)) (= 0 (count Sites in:(sites Occupied by:Enemy)))) (result Mover Win))))) END |
Modify the Ludii game according to the following option changes:
The game has 2 players. -> The game has 3 players.
(define "MoveOn" (if ("IsNotOffBoard" #1) (move (from (from) level:(level)) (to #1 if:(is Empty #1))) #2)) (define "ReachEastDoor" (= (last To) "EastDoor")) (define "MadeACompleteCircuit" (if (= 1 (state at:(where "Stick" Mover))) (is In "EastDoor" (sites Track "TrackCW" from:("NextSite" (last From) "TrackCW") to:(last To))) (is In "EastDoor" (sites Track "TrackCCW" from:("NextSite" (last From) "TrackCCW") to:(last To))))) (define "NextSite" ("NextSiteOnTrack" 1 from:#1 #2)) (define "ThrowValue" (if (= (count Pips) 3) 5 (if (= (count Pips) 0) 10 (if (= (count Pips) 1) 2 (if (= (face 44) 1) 15 3))))) (define "SiteToMoveOnTrackCCW" ("NextSiteOnTrack" ("ThrowValue") "TrackCCW")) (define "SiteToMoveOnTrackCW" ("NextSiteOnTrack" ("ThrowValue") "TrackCW")) (define "SiteToMoveOnSelectedTrack" (if (= (state at:(from)) 1) ("NextSiteOnTrack" ("ThrowValue") "TrackCW") ("NextSiteOnTrack" ("ThrowValue") "TrackCCW"))) (define "EastDoor" 38) (game "Owasokotz" (players 2) (equipment { ("FortyStonesWithFourGapsBoard" { (track "TrackCW" {39 35 33 31 29 27 25 23 21 19 38 17 15 13 11 9 7 5 3 1 37 0 2 4 6 8 10 12 14 16 36 18 20 22 24 26 28 30 32 34} loop:True) (track "TrackCCW" {39 34 32 30 28 26 24 22 20 18 36 16 14 12 10 8 6 4 2 0 37 1 3 5 7 9 11 13 15 17 38 19 21 23 25 27 29 31 33 35} loop:True)}) (regions "AllSites" (sites Board)) (piece "Stick" Each (if (= (state at:(from)) 0) (or ("MoveOn" ("NextSiteOnTrack" ("ThrowValue") "TrackCCW") (then (set State at:(last To) 2))) ("MoveOn" ("NextSiteOnTrack" ("ThrowValue") "TrackCW") (then (set State at:(last To) 1)))) ("MoveOn" ("SiteToMoveOnSelectedTrack" ("ThrowValue"))))) ("StickDice" 3) (hand Each)}) (rules (start (place Stack items:{"Stick2" "Stick1"} Edge "EastDoor")) (play ("RollMove" (forEach Piece))) (end (if (and (not (was Pass)) ("MadeACompleteCircuit")) (result Mover Win)))))
###
| (define "MoveOn" (if ("IsNotOffBoard" #1) (move (from (from) level:(level)) (to #1 if:(is Empty #1))) #2)) (define "ReachEastDoor" (= (last To) "EastDoor")) (define "MadeACompleteCircuit" (if (= 1 (state at:(where "Stick" Mover))) (is In "EastDoor" (sites Track "TrackCW" from:("NextSite" (last From) "TrackCW") to:(last To))) (is In "EastDoor" (sites Track "TrackCCW" from:("NextSite" (last From) "TrackCCW") to:(last To))))) (define "NextSite" ("NextSiteOnTrack" 1 from:#1 #2)) (define "ThrowValue" (if (= (count Pips) 3) 5 (if (= (count Pips) 0) 10 (if (= (count Pips) 1) 2 (if (= (face 44) 1) 15 3))))) (define "SiteToMoveOnTrackCCW" ("NextSiteOnTrack" ("ThrowValue") "TrackCCW")) (define "SiteToMoveOnTrackCW" ("NextSiteOnTrack" ("ThrowValue") "TrackCW")) (define "SiteToMoveOnSelectedTrack" (if (= (state at:(from)) 1) ("NextSiteOnTrack" ("ThrowValue") "TrackCW") ("NextSiteOnTrack" ("ThrowValue") "TrackCCW"))) (define "EastDoor" 38) (game "Owasokotz" (players 3) (equipment { ("FortyStonesWithFourGapsBoard" { (track "TrackCW" {39 35 33 31 29 27 25 23 21 19 38 17 15 13 11 9 7 5 3 1 37 0 2 4 6 8 10 12 14 16 36 18 20 22 24 26 28 30 32 34} loop:True) (track "TrackCCW" {39 34 32 30 28 26 24 22 20 18 36 16 14 12 10 8 6 4 2 0 37 1 3 5 7 9 11 13 15 17 38 19 21 23 25 27 29 31 33 35} loop:True)}) (regions "AllSites" (sites Board)) (piece "Stick" Each (if (= (state at:(from)) 0) (or ("MoveOn" ("NextSiteOnTrack" ("ThrowValue") "TrackCCW") (then (set State at:(last To) 2))) ("MoveOn" ("NextSiteOnTrack" ("ThrowValue") "TrackCW") (then (set State at:(last To) 1)))) ("MoveOn" ("SiteToMoveOnSelectedTrack" ("ThrowValue"))))) ("StickDice" 3) (hand Each)}) (rules (start (place Stack items:{"Stick3" "Stick2" "Stick1"} Edge "EastDoor")) (play ("RollMove" (forEach Piece))) (end (if (and (not (was Pass)) ("MadeACompleteCircuit")) (result Mover Win))))) END |
Construct a Ludii game based on the following description
8x8 board. The pieces move as follows, with the number per player: 1 x Shah (king): moves one space orthogonally or diagonally. May move like an Asb if it is not in check and has never been in check. Place to a player's square right of center. 1 x Fers (counselor): Any distance orthogonally or diagonally; 2 x Rukh (rook): Any number of spaces orthogonally. 2 x Pil (elephant): Any distance diagonally. 2 x Asb (horse): Moves as a chess knight. 8 x Sarbaz (soldier): Moves one space forward orthogonally; one space forward diagonally to capture. Promoted to Fers when reaching the eighth rank. No en passant. No castling. An opponent's piece is captured by moving a player's own piece onto a space occupied by the opponent's piece. When a Shah can be captured on the next turn by an opponent's piece, it is in check. The Shah must not be in check at the end of the player's turn. If this is not possible, it is checkmate and the opponent wins. Stalemate results in a win for that player causing it. The game ends in a draw only when a player's final piece, being a Sarbaz, is lost, that player's Shah captures the opponent's only remaining piece, a Sarbaz.
###
| (game "Shatranj (Algeria)" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) ("ChessPawn" "Pawn" ~ (then ("PromoteIfReach" (sites Mover "Promotion") "Ferz_noCross"))) ("ChessRook" "Rook") (piece "King_noCross" Each (or ("StepToNotFriend") (if (!= (value Player Mover) (mover)) ("LeapToEmpty" "KnightWalk" (then (set Value Mover (mover))))))) ("ChessBishop" "Elephant") ("ChessKnight" "Knight") ("ChessQueen" "Ferz_noCross") (regions "Promotion" P1 (sites Top)) (regions "Promotion" P2 (sites Bottom))}) (rules (start { (place "Pawn1" (sites Row 1)) (place "Pawn2" (sites Row 6)) (place "Rook1" {"A1" "H1"}) (place "Knight1" {"B1" "G1"}) (place "Elephant1" {"C1" "F1"}) (place "Ferz_noCross1" coord:"D1") (place "King_noCross1" coord:"E1") (place "Rook2" {"A8" "H8"}) (place "Knight2" {"B8" "G8"}) (place "Elephant2" {"C8" "F8"}) (place "Ferz_noCross2" coord:"E8") (place "King_noCross2" coord:"D8")}) (play (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King_noCross" Mover)) (then (if (!= (next) (value Player Next)) (if ("IsInCheck" "King_noCross" Next) (set Value Next (next))))))) (end { ("Checkmate" "King_noCross") (if (= (count Pieces Next) 1) (result Mover Win)) ("BlockWin")}))) END |
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, number the points from the origin of each player's track: Point six: five pieces Point 8: three pieces Point 13: five pieces Point 24: two pieces Play begins by each player rolling one die; the player with the highest roll plays first and plays the numbers on this first roll. Players move according to the number on each die by moving one piece the value on one die then another piece the value on the other die, or by moving one piece the value of one die and then the value of the other. If doubles are rolled, the player must play the number on each die twice. Players cannot end their move on a point with multiple opposing pieces. If a player ends the turn on a point with one opposing piece, that piece is placed in the middle of the board (not on a point) and must reenter the board according the the next die roll, counting the origin point as a move of 1. They cannot reenter on a point with two or more pieces. No other pieces can move until all of the pieces belonging to that player are removed from the center. When all of a player's pieces are on their final 6 points, they may start removing pieces from the board. They can do so by rolling a 6 to move from the 6th point, and so on down to 1. Players must use all available moves presented by the dice. The first player to remove all of their pieces wins.
###
| (define "HaveAPieceAndCanEscape" (and ("IsFriendAt" (site)) (< ("NextSiteOnTrack" (pips) from:(site)) 0))) (define "SetScoreOf" (set Score #1 (if (is Mover #1) (if (= ("NumPiece" #2) 15) 2 1) 0))) (define "NotEmptyAndNotOffTheBoard" (and (is Occupied (site)) ("IsNotOffBoard" ("NextSiteFrom" (site))))) (define "CanEscape" ("IsEndTrack" ("NextSiteFrom" (site)))) (define "NumPiece" (size Stack in:(sites Occupied by:#1))) (define "AllPieceEscaped" (no Pieces Mover)) (define "MoveAPieceIf" (forEach Die replayDouble:True if:#1 ("MoveAPiece" #2))) (define "MoveAPiece" (move (from #1) (to ("NextSiteFrom" #1) if:("NoEnemyOrOnlyOne" (to)) ("IfEnemyBlotIt")))) (define "DieNotUsedAndNoEscapeAndNotOffTheTrack" (and { ("DieNotUsed") ("IsNotOffBoard" ("NextSiteFrom" (from))) (not ("IsEndTrack" ("NextSiteFrom" (from))))})) (define "RemoveAPiece" (move Remove (site))) (define "AllPieceInHome" ("AllOwnedPiecesIn" (sites Mover))) (define "Bar" (mapEntry (mover))) (define "NextSiteFrom" ("NextSiteOnTrack" (pips) from:#1)) (define "BarEmpty" (is Empty "Bar")) (define "IfEnemyBlotIt" ("HittingCapture" (mapEntry (next)))) (game "Backgammon" (players 2) (equipment { ("BackgammonBoard" ("BackgammonTracksWithBar" End)) (dice num:2) (regions P1 { 20..25}) (regions P2 { 7..12}) (map {(pair 1 6) (pair 2 19)}) (piece "Disc" Each ("MoveAPieceIf" "DieNotUsedAndNoEscapeAndNotOffTheTrack" (from)))}) (rules (start { (place Stack "Disc1" 0 count:5) (place Stack "Disc1" 12 count:2) (place Stack "Disc1" 17 count:3) (place Stack "Disc1" 20 count:5) (place Stack "Disc2" 4 count:3) (place Stack "Disc2" 7 count:5) (place Stack "Disc2" 13 count:5) (place Stack "Disc2" 25 count:2)}) (play ("RollEachNewTurnMove" (if "AllPieceInHome" (forEach Die replayDouble:True if:("DieNotUsed") (forEach Site (sites Occupied by:Mover) (if ("NotEmptyAndNotOffTheBoard") (if ("CanEscape") ("RemoveAPiece") ("MoveAPiece" (site)))) noMoveYet:(firstMoveOnTrack "Track" Mover (if "HaveAPieceAndCanEscape" "RemoveAPiece")) (then ("ReplayNotAllDiceUsed")))) (max Distance "Track" Mover (if "BarEmpty" (forEach Piece top:True) ("MoveAPieceIf" ("DieNotUsed") ("Bar")) (then (if (not (all DiceUsed)) (if (can Move (if "BarEmpty" (forEach Piece top:True) ("MoveAPieceIf" ("DieNotUsed") ("Bar")))) (moveAgain))))))))) (end (if ("AllPieceEscaped") (result Mover Win))))) END |
Construct a Ludii game based on the following description
Played on a grid of 4x4 squares, each square with both diagonals. Pieces are played on the intersections of the lines, moving to an empty point along one of the lines. Play begins with 20 pieces per player. Players take turns moving the pieces, and capture the opponent's pieces by hopping over them. When the back line on a player's side of the board is vacated, it is no longer in play. The player who captures the other player's pieces wins.
###
| (game "Tuknanavuhpi" (players 2) (equipment { (board (square 5 diagonals:Solid) use:Vertex) (piece "Counter" Each (or ("HopCapture") ("StepToEmpty")))}) (rules (start { (place "Counter1" (union (difference (expand (sites Bottom) steps:2) (sites {"E5" "G5" "I5"})) (sites {"B2" "B4" "D2" "D4" "F2" "F4" "H2" "H4"}))) (place "Counter2" (union (difference (expand (sites Top) steps:2) (sites {"E5" "A5" "C5"})) (sites {"B6" "B8" "D6" "D8" "F6" "F8" "H6" "H8"})))}) (play (forEach Piece)) (end ("NoMoves" Loss)))) END |
Construct a Ludii game based on the following description
MOVE - Each player inserts a stone onto the board from an edge. Black inserts from top and pushes from top to bottom, White inserts from left and pushes from left to right.
- Black starts with a stone on the top-left corner.
- Passing is not allowed
- If a stone, when pushed meets another stone, this too is pushed on the same direction, and so on...
EDGE - A stone pushed off the edge during a push is returned to the player (there are no captures). If it is an opponent stone, this row/column cannot be used on the next turn (friendly stones do not have such restriction).
GOAL - Wins the player which makes a path between the edges (top-bottom for Black, right-left for White). Stones may be connected orthogonal or diagonal.
###
| (define "ConnectedEdges" (!= 0 (count Sites in:(forEach (sites Occupied by:#1) if:(is Connected at:(site) All #1))))) (game "Tara" (players 2) (equipment { (board (square 5) use:Vertex) (piece "Ball" Each) (regions P1 {(sites Top) (sites Bottom)}) (regions P2 {(sites Left) (sites Right)})}) (rules phases:{ (phase "Opening" (play (move Add (to (intersection (sites Top) (sites Left))))) (nextPhase "Main")) (phase "Main" (play (if (is Mover P1) (move Select (from (sites Top) if:(not (is In (column of:(from)) (sites Pending)))) (then (and { (if (is Enemy (who at:(coord row:0 column:(column of:(last From))))) (set Pending (row of:(coord row:0 column:(column of:(last From)))))) (push (from (last To)) S) (add (piece (id "Ball" Mover)) (to (last To)))}))) (move Select (from (sites Left) if:(not (is In (row of:(from)) (sites Pending)))) (then (and { (if (is Enemy (who at:(coord row:(row of:(last From)) column:(- (count Columns) 1)))) (set Pending (column of:(coord row:(row of:(last From)) column:(- (count Columns) 1))))) (push (from (last To)) E) (add (piece (id "Ball" Mover)) (to (last To)))}))))))} (end { (if ("ConnectedEdges" P1) (result P1 Win)) (if ("ConnectedEdges" P2) (result P2 Win))}))) END |
Construct a global Ludii definition which fulfills the following requirements.
Defines a Three Men's Morris board with two triangle extensions at the left and right.
###
| (define "ThreeMensMorrisBoardWithLeftAndRightTriangles" (board ("ThreeMensMorrisGraphWithLeftAndRightTriangles") use:Vertex)) END |
Describe the mechanics of the following Ludii game
(game "Six-Penny Madell" (players 2) (equipment { (board (concentric Triangle rings:3 joinMidpoints:False joinCorners:True) use:Vertex) (hand Each) (piece "Marker" Each ("StepToEmpty" ~ (then ("ReplayIfLine3" Orthogonal exact:True))))}) (rules (start (place "Marker" "Hand" count:6)) phases:{ (phase "Placement" (play (if "SameTurn" ("RemoveAnyEnemyPiece") (move (from (handSite Mover)) (to (sites Empty)) (then ("ReplayIfLine3" Orthogonal exact:True))))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) (phase "Movement" (play (if "SameTurn" ("RemoveAnyEnemyPiece") (forEach Piece))))} (end ("CaptureAll" Next))))
###
| Three concentric triangles, with lines connecting their corners. Six pieces per player. Pieces can move or be placed where the lines intersect, or in the center of the sides of the triangles. Players alternate turns placing their pieces on an empty space on the board.When all the pieces have been placed, players alternate turns moving their pieces to an empty adjacent space along the lines. During either phase, when a player places three pieces in a row along one of the sides of one of the lines, they remove one of the pieces belonging to the other player. The player who removes all of the opponent's pieces wins. END |
Describe the mechanics of the following Ludii game
(define "IsUnpromoted" ("IsPieceAt" "Counter" Mover (last To))) (define "CounterMove" (or { ("StepToEmpty" (directions {FR FL}) (then ("PromoteIfReach" (sites Next) "DoubleCounter"))) ("DiagonalHopCaptureCounter" (from) ("CounterMoveAgainIfCanCaptureAgain")) ("OrthogonalHopCaptureCounter" (from) ("CounterMoveAgainIfCanCaptureAgain"))})) (define "CounterMoveAgainIfCanCaptureAgain" (then (and ("PromoteIfReach" (sites Next) "DoubleCounter") ("ReplayIfCanMove" (or ("DiagonalHopCaptureCounter" (from (last To))) ("OrthogonalHopCaptureCounter" (from (last To)))))))) (define "DoubleCounterMove" (or { (do (move Slide) ifAfterwards:(is In (last To) (sites Phase 0))) ("DiagonalHopCaptureDoubleCounter" (from) ("DoubleCounterMoveAgainIfCanCaptureAgain")) ("OrthogonalHopCaptureDoubleCounter" (from) ("DoubleCounterMoveAgainIfCanCaptureAgain"))})) (define "DoubleCounterMoveAgainIfCanCaptureAgain" (then ("ReplayIfCanMove" (or ("DiagonalHopCaptureDoubleCounter" (from (last To))) ("OrthogonalHopCaptureDoubleCounter" (from (last To))))))) (define "DiagonalHopCaptureCounter" (move Hop #1 Diagonal (between before:1 if:(and (= 2 (count Steps (from) (between))) ("IsEnemyAt" (between))) (apply (remove (between)))) (to if:(is Empty (to))) #2)) (define "OrthogonalHopCaptureCounter" (do (move Hop #1 Orthogonal (between before:3 after:1 if:(and (= 4 (count Steps (from) (between))) ("IsEnemyAt" (between))) (apply (remove (between)))) (to if:(is Empty (to)))) ifAfterwards:(is In (last To) (sites Phase 0)) #2)) (define "DiagonalHopCaptureDoubleCounter" (move Hop #1 Diagonal (between before:1 if:(and (= 2 (count Steps (from) (between))) ("IsEnemyAt" (between))) (apply (remove (between)))) (to if:(is Empty (to))) #2)) (define "OrthogonalHopCaptureDoubleCounter" (do (move Hop #1 Orthogonal (between before:3 after:1 if:(and (= 4 (count Steps (from) (between))) ("IsEnemyAt" (between))) (apply (remove (between)))) (to if:(is Empty (to)))) ifAfterwards:(is In (last To) (sites Phase 0)) #2)) (game "Maleys" ("TwoPlayersNorthSouth") ("DraughtsEquipment" (square 10)) (rules ("BlackCellsSetup" 4) (play (if ("SameTurn") (or (if ("IsUnpromoted") (or ("DiagonalHopCaptureCounter" (from (last To)) ("CounterMoveAgainIfCanCaptureAgain")) ("OrthogonalHopCaptureCounter" (from (last To)) ("CounterMoveAgainIfCanCaptureAgain"))) (or ("DiagonalHopCaptureDoubleCounter" (from (last To)) ("DoubleCounterMoveAgainIfCanCaptureAgain")) ("OrthogonalHopCaptureDoubleCounter" (from (last To)) ("DoubleCounterMoveAgainIfCanCaptureAgain")))) (move Pass)) (or (forEach Piece "Counter" "CounterMove") (forEach Piece "DoubleCounter" "DoubleCounterMove")))) (end ("CaptureAll" Next))))
###
| 10x10 board. Twenty pieces per player, which begin in the four rows closest to the players. Pieces move diagonally forward one space. Pieces capture orthogonally or diagonally, in any direction, when there is one empty space between the piece and the opponent's piece, and an empty space immediately on the opposite side of the opponent's piece. Pieces are promoted to Queen when they reach the edge of the board opposite from where they start. Queens may capture orthogonally or diagonally in any direction over any distance, as long as there are no other pieces intervening and there is an empty spot immediately after the piece to be captured, which is where the Queen lands to make the capture. Multiple captures are allowed for Queens and regular pieces. Queens move orthogonally or diagonally any distance. The player who captures all of the opponent's pieces wins. END |
Construct a Ludii game based on the following description
Manzhouqi is played on a Xiangqi board. The black player's pieces are set up as in Xiangqi, but the white player has the following pieces: Five soldiers: Move one space forward orthogonally. Two courtiers: Move one space diagonally and cannot leave the palace. One general: Moves on space orthogonally and cannot leave the palace. Two elephants: Move two spaces diagonally and cannot cross the river. One chariot: can move any distance orthogonally, taking either by jumping or by landing on the same space, and can also move like a knight in chess. The player that checkmates the other player's general wins.
###
| (define "ChariotMove" ("SlideCapture" Orthogonal)) (define "CanonMove" (or (move Slide Orthogonal) (move Hop Orthogonal (between before:(count Rows) after:(count Rows) if:(is Occupied (between))) (to if:(is Empty (to)) (apply if:("IsEnemyAt" (to)) (remove (to))))))) (define "HorseMove" (forEach Direction Orthogonal (to if:(is Empty (to)) (apply (forEach Direction (from (to)) (directions {FR FL} of:All) (if (not ("IsFriendAt" (to))) (move (from) (to (apply if:("IsEnemyAt" (to)) (remove (to))))))))))) (define "StepMoveOnThePalace" (move Step #1 (to if:(and (is In (to) (sites Mover "Palace")) (not ("IsFriendAt" (to)))) (apply (remove (to)))))) (define "JiangSameColumnWithNoPieceBetween" (if (= (column of:(where "Jiang" P1)) (column of:(where "Jiang" P2))) (not ("NoSites" (forEach (sites Direction from:(where "Jiang" P1) N stop:(= (to) (where "Jiang" P2))) if:(is Occupied (site))))) True)) (game "Manzhouqi" ("TwoPlayersNorthSouth") (equipment { (board (rectangle 10 9) use:Vertex) (piece "Jiang" Each ("StepMoveOnThePalace" Orthogonal)) (piece "Shi" Each ("StepMoveOnThePalace" Diagonal)) (piece "Xiang" Each ("SlideCapture" Diagonal (between (exact 2) if:(and { (is In (between) (sites Mover "Home")) (is Empty (between))})))) (piece "Ma" Each "HorseMove") (piece "Ju" Each (if (is Mover P2) "ChariotMove" (or { "ChariotMove" "HorseMove" "CanonMove"}))) (piece "Pao" Each "CanonMove") (piece "Zu" Each ("StepToNotFriend" (if (is In (from) (sites Mover "Home")) Forward (directions {Forward Rightward Leftward})))) (regions "PalaceP1" P1 { 3..5 12..14 21..23}) (regions "PalaceP2" P2 { 66..68 75..77 84..86}) (regions "Home" P1 (expand (sites Bottom) steps:4)) (regions "Home" P2 (expand (sites Top) steps:4))}) (rules (start { (place "Jiang1" coord:"E1") (place "Shi1" {"D1" "F1"}) (place "Xiang1" {"C1" "G1"}) (place "Ju1" coord:"A1") (place "Zu1" {"A4" "C4" "E4" "G4" "I4"}) (place "Jiang2" coord:"E10") (place "Shi2" {"D10" "F10"}) (place "Xiang2" {"C10" "G10"}) (place "Ma2" {"B10" "H10"}) (place "Ju2" {"A10" "I10"}) (place "Pao2" {"B8" "H8"}) (place "Zu2" {"A7" "C7" "E7" "G7" "I7"})}) (play (do (forEach Piece) ifAfterwards:(and ("JiangSameColumnWithNoPieceBetween") (not ("IsInCheck" "Jiang" Mover))))) (end { ("Checkmate" "Jiang") ("BlockWin")}))) END |
Construct a Ludii game based on the following description
Three vertical lines, and two horizontal lines intersecting them along their top end points and their midpoints. The ends of the lines which are not connected to one another are the calves' pens. Three pieces per player, one playing as calves (black), and the other as guardians (white), arranged on the intersections of opposite vertical lines. Players alternate turns moving one of their pieces to an adjacent spot. The guardians attempt to trap the calves into the three pens, the calves attempt to block the guardians from being able to move.
###
| (define "AllCowsInBottom" (all Sites (difference (sites Occupied by:P2) (sites Bottom)) if:(= 0 (count at:(site))))) (game "Gurvan Xudag" (players 2) (equipment { (board (remove (square 3) edges:{{0 1}{1 2}}) use:Vertex) (piece "Human" P1 "StepToEmpty") (piece "Cow" P2 "StepToEmpty")}) (rules (start { (place "Human1" (sites Left)) (place "Cow2" (sites Right))}) (play (forEach Piece)) (end { (if (no Moves P1) (result P2 Win)) (if (and ("AllCowsInBottom") (no Moves P2)) (result P1 Win))}))) END |
Construct a Ludii game based on the following description
The rules are the same of Sudoku except the diagonals of the square board also have to contain only different numbers.
###
| (game "Sudoku X" (players 1) (equipment { (board (square 9) (values Cell (range 1 9))) (regions {Columns Rows SubGrids}) (regions (sites Direction from:(intersection (sites Left) (sites Bottom)) NE included:True)) (regions (sites Direction from:(intersection (sites Right) (sites Bottom)) NW included:True))}) (rules (start (set { {0 9} {11 8} {12 6} {15 9} {19 4} {28 7} {29 3} {35 1} {38 1} {43 3} {45 2} {46 5} {50 7} {51 4} {52 8} {56 5} {66 9} {73 3} {75 8} {76 4}})) (play (satisfy (all Different))) (end (if (is Solved) (result P1 Win))))) END |
Construct a Ludii game based on the following description
Played on cross-shaped board, made of five squares, each divided into four squares and with the diagonals of the larger squares drawn. One player plays with thirteen pieces situated on every point of one arm of the cross and along the line immediately perpendicular to that arm. The other plays as the Punipeki, which is placed on any empty spot on the first turn. Pieces move along the lines to an adjacent empty spot. The Punipeki may jump over an adjacent piece to capture it. The Punipeki wins if it can capture all the opponent's pieces, the other player wins by blocking the Punipeki from moving.
###
| (game "Manu" (players 2) (equipment { ("CrossBoard" 3 7 use:Vertex diagonals:Alternating) (hand P1) (piece "Stick" P1 (or ("HopCapture") "StepToEmpty")) (piece "Marker" P2 "StepToEmpty")}) (rules (start { (place "Marker2" (union (expand (sites Bottom)) (sites Row 2))) (place "Stick1" (handSite P1))}) phases:{ (phase "Placement" P1 (play (move (from (handSite P1)) (to (sites Empty)))) (nextPhase ("HandEmpty" P1) "Movement")) ("PhaseMovePiece" "Movement")} (end ("NoMovesLossAndNoPiecesPlayerLoss" P2)))) END |
Construct a Ludii game based on the following description
Each player begins with their eleven pieces arrayed on the intersections of the lines in one of the triangles. Pieces move to an adjacent point along one of the lines connecting it to its present location. Captures are made by hopping over an opponent's piece. The player who captures all of the opponent's pieces wins.
###
| (game "Egara Guti" (players 2) (equipment { (board (graph vertices:{ {0 0} {2 0} {4 0} {6 0} {8 0} {2 2} {4 2} {6 2} {3 3} {4 3} {5 3} {4 4} {3 5} {4 5} {5 5} {2 6} {4 6} {6 6} {0 8} {2 8} {4 8} {6 8} {8 8}} edges:{ {0 1} {0 5} {1 2} {1 5} {2 3} {2 6} {3 4} {3 7} {4 7} {5 6} {5 8} {5 15} {6 7} {6 9} {7 10} {7 17} {8 9} {8 11} {9 10} {9 11} {10 11} {11 12} {11 13} {11 14} {12 13} {12 15} {13 14} {13 16} {14 17} {15 16} {15 18} {15 19} {16 17} {16 20} {17 21} {17 22} {18 19} {19 20} {20 21} {21 22}}) use:Vertex) (piece "Counter" Each (or ("HopCapture") ("StepToEmpty")))}) (rules (start { (place "Counter1" (union (expand (sites Bottom)) (sites Row 2))) (place "Counter2" (union (expand (sites Top)) (sites Row 4)))}) (play (forEach Piece)) (end ("NoMoves" Loss)))) END |
Describe the mechanics of the following Ludii game
(define "UpdateSurplusesToDisplayFor" (forEach Group Adjacent if:(is In (to) (sites Occupied by:#1)) (forEach Value (array (sites)) (set Value at:(value) ("SurplusGoodsChainAt" (value)))))) (define "SurplusGoodsChainAt" (- (size Array (array ("SuppliersAroundChainAt" #1))) (size Array (array ("WarehousesinChainAt" #1))))) (define "ScoreFor" (set Score #1 (size Array (array ("AllWarehousesOf" #1))))) (define "Score" (and ("ScoreFor" P1) ("ScoreFor" P2))) (define "AllWarehousesOf" (forEach (sites Occupied by:#1) if:("IsWarehouseAt" (site)))) (define "DoubleTurnProtocol" (set Var "MoveInTurn" (% (+ 3 (var "MoveInTurn")) 2) (then (if (= 1 (var "MoveInTurn")) (moveAgain))))) (define "DeficitWarehousesOf" (forEach (sites Occupied by:#1) if:(and ("IsWarehouseAt" (site)) ("IsDeficitInChainAt" (site))))) (define "Place" (do (move Add (to (sites Empty))) ifAfterwards:(not ("IsDeficitInChainAt" (last To))))) (define "WarehousesinChainAt" (forEach ("ChainAt" #1) if:("IsWarehouseAt" (site)))) (define "SuppliersAroundChainAt" (sites Around ("ChainAt" #1) Adjacent if:("IsSupplierAt" (to)))) (define "ChainAt" (sites Group at:#1 Adjacent)) (define "IsDeficitInChainAt" (< (size Array (array ("SuppliersAroundChainAt" #1))) (size Array (array ("WarehousesinChainAt" #1))))) (define "IsWarehouseAt" (< 2 (count Pieces of:(who at:#1) in:(sites Around #1 Adjacent)))) (define "IsSupplierAt" (and (not (is Empty #1)) (> 3 (count Pieces of:(who at:#1) in:(sites Around #1 Adjacent if:(not (is Empty (to)))))))) (game "SupplyChains" (players 2) (equipment { (board (hex 3 5) use:Cell) (piece "Disc" Each)}) (rules (play (priority { (move Remove ("DeficitWarehousesOf" Mover)) (or { ("Place")})} (then (and { ("UpdateSurplusesToDisplayFor" Mover) ("UpdateSurplusesToDisplayFor" Next) ("Score") (if (can Move (move Remove ("DeficitWarehousesOf" Mover))) (moveAgain) "DoubleTurnProtocol")})))) (end (if (or (all Passed) (no Moves Mover)) (byScore)))))
###
| Goal: Most 'Warehouses' when the board is full.
Definitions:
-- 'friendly': a player's piece. -- 'foreign': their opponent's piece.
-- A 'Supplier' is a piece with less than 3 friendly neighbors.
-- A 'Warehouse' is a piece with 3 or more friendly neighbors.
-- A 'Supply Chain' is any of a player's pieces, and all of the friendly pieces that can connect to it through series of adjacent connections with each other.
-- A supply chain 'deficit' is a condition that occurs when the number of Warehouses in a Supply Chain exceeds the number of foreign Suppliers next to that Chain.
-- A supply chain 'Surplus' is the number by which the number of foreign Suppliers next to a Friendly Supply Chain exceeds the Warehouses in that Chain, displayed for informational purposes.
Play:
After the first player takes a single turn, the players continue to play, each taking 2 turns in a row until no more placements can be made.
On a normal turn, the mover adds a piece to the board, taking care not to cause a supply chain deficit in the chain being extended.
However, if a player starts a turn with a supply chain deficit, the player must remove Warehouses from the deficit chains until no deficit remains. In this case, no placement is made for the turn.
In either case, all piece conversions are updated, and supply chain surpluses are shown for each chain. Hex 3,5 Grid of adjacent cells Self Removals, Forced placement Double moves END |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.