prompt
stringlengths 71
4.65k
| completion
stringlengths 34
5.1k
|
---|---|
Modify the Ludii game according to the following option changes:
Played on a size 3 board. -> Played on a size 4 board.
(game "Master Y" (players 2) (equipment { (board (hex Triangle 3)) (piece "Disc")}) (rules phases:{ (phase "Opening" P1 (play (move Add (to (sites Empty)))) (nextPhase "Playing")) (phase "Playing" (play (move Add (to (sites Empty)) (then (if (= 0 (count MovesThisTurn)) (moveAgain))))))} (end (if (is Connected 3 Sides) (result Mover Win)))))
###
| (game "Master Y" (players 2) (equipment { (board (hex Triangle 4)) (piece "Disc")}) (rules phases:{ (phase "Opening" P1 (play (move Add (to (sites Empty)))) (nextPhase "Playing")) (phase "Playing" (play (move Add (to (sites Empty)) (then (if (= 0 (count MovesThisTurn)) (moveAgain))))))} (end (if (is Connected 3 Sides) (result Mover Win))))) END |
Construct a global Ludii definition which fulfills the following requirements.
Checks if this is new turn, i.e. the current move is not the previous mover.
###
| (define "NewTurn" (not (is Prev Mover))) END |
Describe the mechanics of the following Ludii game
(game "Bamboo" (players 2) (equipment { (board (hex 5)) (piece "Disc" Each) (piece "Disc" Neutral)}) (rules (play (do (move Add (to (sites Empty))) ifAfterwards:(<= (max (results from:(sites Occupied by:Mover) to:1 (* 1 (size Group at:(from))))) (count Groups if:(= (who at:(to)) (mover)))))) (end ("NoMoves" Loss))))
###
| Each turn a player places a stone of their color on an empty hex. The placement is subject to the following restriction: After your placement you may not have a group containing more stones than the number of groups you have on the board. The first player unable to place a stone loses the game. A size 5 board is currently selected The standard goal is selected, which means that the first player unable to place loses. END |
Construct a Ludii game based on the following description
3x3 intersecting lines. Three pieces per player. Players alternate turns placing a piece on the board. When all of the pieces have been placed, the players alternate turns moving a piece to an empty adjacent spot. A piece which is surrounded on opposite sides by pieces belonging to the opponent cannot be moved. The player who places three of their stones in a row along one of the lines wins.
###
| (define "Surrounded" (or (if (and (!= (ahead (from) N) (from)) (!= (ahead (from) S) (from))) (and (= (next) (who at:(ahead (from) N))) (= (next) (who at:(ahead (from) S))))) (if (and (!= (ahead (from) E) (from)) (!= (ahead (from) W) (from))) (and (= (next) (who at:(ahead (from) E))) (= (next) (who at:(ahead (from) W))))))) (game "Triodi (Chios)" (players 2) (equipment { (board (square 3) use:Vertex) (hand Each) (piece "Marker" Each (if (not ("Surrounded")) ("StepToEmpty")))}) (rules (start (place "Marker" "Hand" count:3)) phases:{ (phase "Placement" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) ("PhaseMovePiece" "Movement")} (end ("Line3Win")))) END |
Describe the mechanics of the following Ludii game
(game "Bagh Batti" (players 2) (equipment { ("AlquerqueBoard" 5 5) (piece "Goat" P1 "StepToEmpty") (piece "Tiger" P2 (or ("StepToEmpty") ("HopSequenceCapture")))}) (rules (start { (place Stack "Goat1" (sites {"B2" "D2" "B4" "D4"}) counts:{5 5 5 5}) (place "Tiger2" (sites {"C1" "C5"}))}) (play (if ("SameTurn") (or (move Pass) ("HopSequenceCaptureAgain")) (forEach Piece top:True))) (end ("NoMovesP2NoPiecesP1"))))
###
| 5x5 board, played on intersections, with diagonals for each quadrant of the board. One player plays with two tiger pieces, placed on the midpoints of two opposite sides. The other player plays with twenty goats, divided into four stacks of five, placed in the center of each quadrant. The goats move first. Goats may move one at a time to any adjacent vacant spot. More than one goat can be placed on the goats' starting spots, but not elsewhere. The tiger moves in the same manner, but also may capture a piece by hopping over it. Multiple captures can be made on the same turn with subsequent hops, but only the top goat in a stack is captured when a tiger leaps over it. The goal of the goats is to surround the tigers so they cannot move; when one tiger is blocked the other must be blocked on the next turn. The goal of the tigers is to capture all the goats.
END |
Describe the mechanics of the following Ludii game
(game "Addi Kul" ("TwoPlayersNorthSouth") (equipment { (board (square 7)) (piece "Marker" Each (or ("StepToEmpty" (directions {Rightward Leftward Forwards})) ("HopCapture")))}) (rules (start { (place "Marker1" (expand (sites Bottom) steps:2)) (place "Marker2" (expand (sites Top) steps:2))}) (play (forEach Piece)) (end ("CaptureAll" Next))))
###
| 7x7 board. 21 pieces per player, which begin in the three rows closest to each player. The central row of the board remains empty. Players alternate turns moving one of their pieces forward, diagonally, or horizontally on the board. When a player's piece is next to an opponent's piece with an empty space immediately on the opposite side of it, the player's piece may hop over the opponent's piece to capture it. The player who captures all of the opponent's pieces wins. END |
Construct a Ludii game based on the following description
Six or more players (even number), played on two teams. The games Aj Sayil, Aj T'iwil, Aj Sina'anil, Aj Sakakil, and A K'aak'il are played in succession. The game has 6 players.
###
| (games { (subgame "Aj Sayil" next:1) (subgame "Aj T'iwil" next:2) (subgame "Aj Sina'anil" next:3) (subgame "Aj Sakakil" next:4) (subgame "A K'aak'il")}) END |
What does the following global Ludii definition do?
(define "PromoteIfReach" (if (is In (last To) #1) (promote (last To) (piece #2) Mover) #3))
###
| Promote the last piece moving if this piece reached a region. END |
Describe the mechanics of the following Ludii game
(define "JarlWasCaptured" (is Triggered "Surrounded" P2)) (define "JarlIsCaptured" (apply (trigger "Surrounded" P2))) (define "FriendOrCentreOrFortress" (or ("IsFriendAt" (to)) (is In (to) (union (sites Centre) (sites "Fortresses"))))) (define "EmptyButNotCentreOrFortress" (and (not (is In (between) (union (sites Centre) (sites "Fortresses")))) (is Empty (between)))) (define "Custodial" (custodial (from (last To)) Orthogonal (between (max 1) if:("IsPieceAt" #1 Next (between)) (apply (remove (between)))) (to if:"FriendOrCentreOrFortress"))) (game "Hnefatafl" (players 2) (equipment { (board (square 11)) (regions "Fortresses" (sites Corners)) (piece "Thrall" P1 (move Slide Orthogonal (between if:"EmptyButNotCentreOrFortress") (then (and { ("Custodial" "Thrall2") (surround (from (last To)) Orthogonal (between if:("IsPieceAt" "Jarl" P2 (between)) "JarlIsCaptured") (to if:"FriendOrCentreOrFortress"))})))) (piece "Thrall" P2 (move Slide Orthogonal (between if:"EmptyButNotCentreOrFortress") (then ("Custodial" "Thrall1")))) (piece "Jarl" P2 (move Slide Orthogonal (then ("Custodial" "Thrall1"))))}) (rules (start { (place "Thrall1" {"D1" "E1" "F1" "G1" "H1" "F2" "A4" "A5" "A6" "A7" "A8" "B6" "K4" "K5" "K6" "K7" "K8" "J6" "F10" "D11" "E11" "F11" "G11" "H11" "F10"}) (place "Thrall2" {"F4" "E5" "F5" "G5" "D6" "E6" "G6" "H6" "E7" "F7" "G7" "F8"}) (place "Jarl2" (centrePoint))}) (play (forEach Piece)) (end { ("PieceTypeReachWin" "Jarl2" (sites "Fortresses") P2) (if "JarlWasCaptured" (result P1 Win))})))
###
| Played on an 11x11 board. The defending side comprises twelve soldiers and a king, who start the game in a cross formation in the center of the board.
Their objective is for the king to escape by reaching any of the four corner squares.
The attackers comprise 24 soldiers positioned in four groups of 6 around the perimeter of the board.
The King piece is the only piece that can occupy the central and the four corner squares.
All pieces move orthogonally any number of spaces, and pieces are taken by custodial capture (surrounding an enemy piece on either side with two of a player's pieces). The king piece must be captured by surrounding it on all four sides. The game is played with the common rules. END |
Construct a Ludii game based on the following description
Pieces move to any adjacent empty square or jumping one of their pieces over an adjacent piece to the empty point immediately beyond. The game is won by the first player to move all six pieces into a single orthogonally connected group
###
| (game "Groups" (players 2) (equipment { (board (square 8)) (piece "Disc" Each (or ("StepToEmpty") ("HopAllPiecesToEmpty")))}) (rules (start { (place "Disc1" {"D3" "C4" "E4" "D5" "F5" "E6"}) (place "Disc2" {"E3" "D4" "F4" "C5" "E5" "D6"})}) (play (forEach Piece)) (end ("SingleGroupWin" Mover Orthogonal)))) END |
Construct a Ludii game based on the following description
The 32 pieces in Chex represent the 16 chess pieces on each side of a normal chess game. Each player shuffles his own 16 tiles and places them face down, then white draws his top tile and places it, with the piece oriented so it looks upright to him. Black then draws the top tile in his pile and places it so that it touches white's piece, either orthogonally or diagonally, and oriented so that it looks upright to him.
At that point, white can either add another piece or move his piece on the board. A move must be a legal chess move and may not separate any element of the board; all pieces much remain touching, even if just diagonally, when a move has ended. Thus you can \
###
| (define "NextCanNotMove" (not (can Move (do (forEach Piece Next) ifAfterwards:(not ("IsInCheck" "King" Next)))))) (game "Chex" ("TwoPlayersNorthSouth") (equipment { (boardless Square) (hand Each) (tile "Pawn" Each numSides:4 (or { "StepForwardToEmpty" ("StepToEnemy" (directions {FR FL}))})) (tile "Rook" Each numSides:4 ("SlideCapture" Orthogonal)) (tile "King" Each numSides:4 ("StepToNotFriend")) (tile "Bishop" Each numSides:4 ("SlideCapture" Diagonal)) (tile "Knight" Each numSides:4 ("LeapCapture" "KnightWalk")) (tile "Queen" Each numSides:4 ("SlideCapture"))}) (rules (start { (place Random { (count "Pawn1" 8) (count "Rook1" 2) (count "Knight1" 2) (count "Bishop1" 2) (count "Queen1" 1) (count "King1" 1)} (handSite 1)) (place Random { (count "Pawn2" 8) (count "Rook2" 2) (count "Knight2" 2) (count "Bishop2" 2) (count "Queen2" 1) (count "King2" 1)} (handSite 2)) (forEach Value min:0 max:(topLevel at:(handSite 1)) (set Hidden What at:(handSite 1) level:(value) to:P1)) (forEach Value min:0 max:(topLevel at:(handSite 1)) (set Hidden What at:(handSite 1) level:(value) to:P2)) (forEach Value min:0 max:(topLevel at:(handSite 2)) (set Hidden What at:(handSite 2) level:(value) to:P1)) (forEach Value min:0 max:(topLevel at:(handSite 2)) (set Hidden What at:(handSite 2) level:(value) to:P2))}) (play (if "SameTurn" (if (= (count Moves) 1) (move (from (handSite (mover))) (to (centrePoint))) (do (move (from (handSite (mover))) (to (sites Around (union (sites Occupied by:P1 container:"Board") (sites Occupied by:P2 container:"Board")) Empty))) ifAfterwards:(not ("IsInCheck" "King" Mover)))) (or (if (is Occupied (handSite (mover))) (move Select (from (handSite (mover))) (then (and { (moveAgain) (set Hidden What at:(last To) level:(topLevel at:(last To)) False to:P1) (set Hidden What at:(last To) level:(topLevel at:(last To)) False to:P2)})))) (do (forEach Piece) ifAfterwards:(and (= 1 (count Groups)) (not ("IsInCheck" "King" Mover))))))) (end { (if (and { (not (can Move (if (!= (what at:(handSite (mover))) 0) (move Select (from (handSite (mover))))))) ("IsNotOffBoard" (where "King" Next)) ("IsInCheck" "King" Next) (not (can Move (do (forEach Piece Next) ifAfterwards:(and (= 1 (count Groups)) (not ("IsInCheck" "King" Next))))))}) (result Mover Win)) (if (and { "SameTurn" ("IsInCheck" "King" Mover) (not (can Move (do (move (from (handSite (mover))) (to (sites Around (union (sites Occupied by:P1 container:"Board") (sites Occupied by:P2 container:"Board")) Empty))) ifAfterwards:(not ("IsInCheck" "King" Mover)))))}) (result Next Win)) ("DrawIfNoMoves" Mover)}))) END |
Construct a Ludii game based on the following description
2x6 board with two stores. Four counters in each hole. Players alternate turns sowing from one of the holes on their side of the board in an anticlockwise direction. When a counter lands in one of the opponent's holes, making it contain six counters, those counters are captured. The player who captures the most counters wins.
###
| (define "PiecesOwnedBy" (count at:(mapEntry #1))) (game "Wari" (players 2) (equipment { (mancalaBoard 2 6 { (track "Track" "1,E,N,W" loop:True)}) (piece "Seed" Shared) (hand Each) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 FirstSite) (pair P2 LastSite)})}) (rules (start (set Count 4 to:(sites Track))) (play (move Select (from (sites Mover) if:(> (count at:(from)) 0)) (then (sow apply:(if (= 6 (count at:(to))) (fromTo (from (to)) (to (mapEntry Mover)) count:6)))))) (end ("MancalaByScoreWhen" (no Moves Mover))))) END |
What does the following global Ludii definition do?
(define "BackgammonBoard" (board (rectangle 2 13) #1 use:Vertex))
###
| Defines a backgammon board (without the style). END |
Modify the Ludii game according to the following option changes:
Played on a Alquerque Board with less diagonal. -> Played on a Alquerque Board with no diagonal.
(game "Cercar La Liebre" (players 2) (equipment { (board (remove (rectangle 5 5 diagonals:Alternating) edges:{ { {2 0} {1 1}} { {0 2} {1 1}} { {0 2} {1 3}} { {1 3} {2 4}} { {2 0} {3 1}} { {3 1} {4 2}} { {4 2} {3 3}} { {3 3} {2 4}}}) use:Vertex) (piece "Counter" P1 "StepToEmpty") (piece "Hare" P2 (or "HopCapture" (if "SameTurn" (move Pass) "StepToEmpty")))}) (rules (start { (place "Counter1" (union {(expand (sites Bottom)) (sites {"A3" "E3"})})) (place "Hare2" (centrePoint))}) (play (forEach Piece)) (end ("NoMovesLossAndLessNumPiecesPlayerLoss" P1 9))))
###
| (game "Cercar La Liebre" (players 2) (equipment { (board (square 5) use:Vertex) (piece "Counter" P1 "StepToEmpty") (piece "Hare" P2 (or "HopCapture" (if "SameTurn" (move Pass) "StepToEmpty")))}) (rules (start { (place "Counter1" (union {(expand (sites Bottom)) (sites {"A3" "E3"})})) (place "Hare2" (centrePoint))}) (play (forEach Piece)) (end ("NoMovesLossAndLessNumPiecesPlayerLoss" P1 9)))) END |
Modify the Ludii game according to the following option changes:
A size 7 board is currently selected -> A size 8 board is currently selected
(game "King And Courtesan" ("TwoPlayersNorthSouth") (equipment { (board (rotate 45 (square 7))) (piece "Disc" Each (or { ("StepToEmpty" Forwards stack:True) (move Step (to if:("IsEnemyAt" (to)) (apply (and (if (= 2 (size Stack at:(to))) (set Var "NextLoss" 1)) (remove (to) count:(size Stack at:(to)))))) stack:True) (move Step (from if:(= 2 (size Stack at:(from)))) Forwards (to if:(is Mover (who at:(to)))))}))}) (rules (start { (place "Disc1" (expand (sites Bottom) steps:(- 7 2) Orthogonal)) (place "Disc2" (expand (sites Top) steps:(- 7 2) Orthogonal)) (place Stack "Disc1" (sites Bottom)) (place Stack "Disc2" (sites Top))}) (play (forEach Piece top:True)) (end { (if (= 1 (var "NextLoss")) (result Next Loss)) (if (or (and (= (id P1) (who at:(- (* 7 7) 1))) (= 2 (size Stack at:(- (* 7 7) 1)))) (and (= (id P2) (who at:0)) (= 2 (size Stack at:0)))) (result Mover Win))})))
###
| (game "King And Courtesan" ("TwoPlayersNorthSouth") (equipment { (board (rotate 45 (square 8))) (piece "Disc" Each (or { ("StepToEmpty" Forwards stack:True) (move Step (to if:("IsEnemyAt" (to)) (apply (and (if (= 2 (size Stack at:(to))) (set Var "NextLoss" 1)) (remove (to) count:(size Stack at:(to)))))) stack:True) (move Step (from if:(= 2 (size Stack at:(from)))) Forwards (to if:(is Mover (who at:(to)))))}))}) (rules (start { (place "Disc1" (expand (sites Bottom) steps:(- 8 2) Orthogonal)) (place "Disc2" (expand (sites Top) steps:(- 8 2) Orthogonal)) (place Stack "Disc1" (sites Bottom)) (place Stack "Disc2" (sites Top))}) (play (forEach Piece top:True)) (end { (if (= 1 (var "NextLoss")) (result Next Loss)) (if (or (and (= (id P1) (who at:(- (* 8 8) 1))) (= 2 (size Stack at:(- (* 8 8) 1)))) (and (= (id P2) (who at:0)) (= 2 (size Stack at:0)))) (result Mover Win))}))) END |
Construct a Ludii game based on the following description
Game starts with a cross made from dots.
During each turn, place a dot to form a straight line that is exactly five dots long and then draw a straight line. This line can not overlap a part of an existing line. For every line drown we get a point. The goal is to maximise the score.
###
| (define "DrawThreeInARowTwoBack" (and { (add (to Vertex (last From))) (add (to Edge (edge (last From) (last To)))) (add (to Edge (edge (last To) (ahead (last To) steps:1 (directions Vertex from:(last From) to:(last To)))))) (add (to Edge (edge (last From) (ahead (last From) steps:1 (directions Vertex from:(last To) to:(last From)))))) (add (to Edge (edge (ahead (last From) steps:1 (directions Vertex from:(last To) to:(last From))) (ahead (last From) steps:2 (directions Vertex from:(last To) to:(last From))))))})) (define "ThreeInARowAndTwoBackEmpty" (and { (is Occupied Vertex (ahead (to) steps:1 (directions Vertex from:(from) to:(to)))) (is Occupied Vertex (ahead (from) steps:1 (directions Vertex from:(to) to:(from)))) (is Occupied Vertex (ahead (from) steps:2 (directions Vertex from:(to) to:(from)))) (is Empty Edge (edge (from) (to))) (is Empty Edge (edge (to) (ahead (to) steps:1 (directions Vertex from:(from) to:(to))))) (is Empty Edge (edge (from) (ahead (from) steps:1 (directions Vertex from:(to) to:(from))))) (is Empty Edge (edge (ahead (from) steps:1 (directions Vertex from:(to) to:(from))) (ahead (from) steps:2 (directions Vertex from:(to) to:(from)))))})) (define "DrawFourInARowOneBack" (and { (add (to Vertex (last From))) (add (to Edge (edge (last From) (last To)))) (add (to Edge (edge (last To) (ahead (last To) steps:1 (directions Vertex from:(last From) to:(last To)))))) (add (to Edge (edge (ahead (last To) steps:1 (directions Vertex from:(last From) to:(last To))) (ahead (last To) steps:2 (directions Vertex from:(last From) to:(last To)))))) (add (to Edge (edge (last From) (ahead (last From) steps:1 (directions Vertex from:(last To) to:(last From))))))})) (define "FourInARowAndOneBackEmpty" (and { (is Occupied Vertex (ahead (to) steps:1 (directions Vertex from:(from) to:(to)))) (is Occupied Vertex (ahead (to) steps:2 (directions Vertex from:(from) to:(to)))) (is Occupied Vertex (ahead (from) steps:1 (directions Vertex from:(to) to:(from)))) (is Empty Edge (edge (from) (to))) (is Empty Edge (edge (to) (ahead (to) steps:1 (directions Vertex from:(from) to:(to))))) (is Empty Edge (edge (ahead (to) steps:1 (directions Vertex from:(from) to:(to))) (ahead (to) steps:2 (directions Vertex from:(from) to:(to))))) (is Empty Edge (edge (from) (ahead (from) steps:1 (directions Vertex from:(to) to:(from)))))})) (define "DrawFiveInARow" (and { (add (to Vertex (last From))) (add (to Edge (edge (last From) (last To)))) (add (to Edge (edge (last To) (ahead (last To) steps:1 (directions Vertex from:(last From) to:(last To)))))) (add (to Edge (edge (ahead (last To) steps:1 (directions Vertex from:(last From) to:(last To))) (ahead (last To) steps:2 (directions Vertex from:(last From) to:(last To)))))) (add (to Edge (edge (ahead (last To) steps:2 (directions Vertex from:(last From) to:(last To))) (ahead (last To) steps:3 (directions Vertex from:(last From) to:(last To))))))})) (define "FiveInARowEmpty" (and { (is Occupied Vertex (ahead (to) steps:1 (directions Vertex from:(from) to:(to)))) (is Occupied Vertex (ahead (to) steps:2 (directions Vertex from:(from) to:(to)))) (is Occupied Vertex (ahead (to) steps:3 (directions Vertex from:(from) to:(to)))) (is Empty Edge (edge (from) (to))) (is Empty Edge (edge (to) (ahead (to) steps:1 (directions Vertex from:(from) to:(to))))) (is Empty Edge (edge (ahead (to) steps:1 (directions Vertex from:(from) to:(to))) (ahead (to) steps:2 (directions Vertex from:(from) to:(to))))) (is Empty Edge (edge (ahead (to) steps:2 (directions Vertex from:(from) to:(to))) (ahead (to) steps:3 (directions Vertex from:(from) to:(to)))))})) (define "SelectVertices" (move Select (from Vertex (intersection (sites Around (sites Occupied by:P1)) (sites Empty Edge))) (to Vertex (intersection (sites Occupied by:P1) (sites Around (from))) if:#1) (then #2))) (game "Morpion Solitaire" (players 1) (equipment { (board (square 20 diagonals:SolidNoSplit) use:Vertex) (piece "Cross" P1)}) (rules (start { (place "Cross" (sites { 148 128 108..111 165..168 185 205 225..228 131 151 171..174 194 214 234..231 251 271 291..288 248 268}))}) (play (or { ("SelectVertices" "FiveInARowEmpty" "DrawFiveInARow") ("SelectVertices" "FourInARowAndOneBackEmpty" "DrawFourInARowOneBack") ("SelectVertices" "ThreeInARowAndTwoBackEmpty" "DrawThreeInARowTwoBack")} (then (addScore Mover 1)))) (end (if (no Moves Mover) (result P1 Win))))) END |
Construct a Ludii game based on the following description
5x5 board, with the central square on each side and the central square of the board marked with an X. Two to four players, each with four pieces, which start on one of the marked squares on the edge of the board. Four cowrie shells used as dice. The throws are as follows, with the value of the throws equaling the number of mouths which land up, all mouths down = 8, and grants the player another throw. Pieces moves in a spiral track around the board in an anti-clockwise direction until they reach the space before the starting point, at which point they proceed around the inner circles in a clockwise direction, and then to the central space. When a player lands on a space occupied by an opponent's piece, the opponent's piece is sent back to their starting position. When a player reaches the central square by an exact throw, it is removed from the board. The first player to remove all four of their pieces from the board wins. The game involves 4 players.
###
| (define "Goal" 12) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" ("ThrowValue"))) (define "ThrowValue" (mapEntry "ThrowDiceValue" (count Pips))) (game "Main Pacheh" (players 4) (equipment { (board (square 5) { (track "Track1" "2,E,N,W,S,E1,N3,E2,S2,W1,12" P1 directed:True) (track "Track2" "22,W,S,E,N,W1,S3,W2,N2,E1,12" P2 directed:True) (track "Track3" "14,N,W,S,E,N1,W3,N2,E2,S1,12" P3 directed:True) (track "Track4" "10,S,E,N,W,S1,E3,S2,W2,N1,12" P4 directed:True)}) (piece "Marker" Each (if ("IsNotOffBoard" "SiteToMoveOnTrack") (if (or (is Empty "SiteToMoveOnTrack") ("IsEnemyAt" "SiteToMoveOnTrack")) (move (from (from) level:(level)) (to "SiteToMoveOnTrack" ("HittingCapture" (mapEntry "StartingPoint" (who at:(to))))))) (then (if (= "Goal" (last To)) (remove (last To)))))) (map "ThrowDiceValue" {(pair 0 8) (pair 1 1) (pair 2 2) (pair 3 3) (pair 4 4)}) (map "StartingPoint" {(pair 1 2) (pair 2 22) (pair 3 14) (pair 4 10)}) ("StickDice" 4)}) (rules (start { (place Stack "Marker1" 2 count:4) (place Stack "Marker2" 22 count:4) (place Stack "Marker3" 14 count:4) (place Stack "Marker4" 10 count:4)}) (play ("RollMove" (if (can Move (forEach Piece)) (forEach Piece (then (if (= ("ThrowValue") 8) (moveAgain)))) (move Pass (then (if (= ("ThrowValue") 8) (moveAgain))))))) (end ("EscapeWin")))) END |
Modify the Ludii game according to the following option changes:
Each player has 9 holes by row. -> Each player has 12 holes by row.
(define "NextSite" ("NextSiteOnTrack" 1 #1)) (define "FirstSiteToSow" (if (is Mover P1) (intersection (sites Right) (sites Row 1)) (intersection (sites Left) (sites Row 2)))) (define "PiecesOwnedBy" (count in:(sites #1 "Home"))) (define "Columns" 9) (game "Nchuwa" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "TrackCCW1" "0,E,N1,W" loop:True P1) (track "TrackCCW2" "18,E,N1,W" loop:True P2)}) (regions "Home" P1 (sites Track "TrackCCW1")) (regions "Home" P2 (sites Track "TrackCCW2")) (regions "Inner" P1 (sites Row 1)) (regions "Inner" P2 (sites Row 2)) (regions "Outer" P1 (sites Row 0)) (regions "Outer" P2 (sites Row 3)) (piece "Seed" Shared)}) (rules (start (set Count 2 to:(union (sites P1 "Home") (sites P2 "Home")))) phases:{ (phase "Opening1" (play (move Select (from ("FirstSiteToSow")) (then (sow "TrackCCW" owner:(mover) apply:(set Value Mover ("NextSite" from:(to))))))) (nextPhase Mover "Opening2")) (phase "Opening2" (play (move Select (from (value Player Mover)) (then (sow "TrackCCW" owner:(mover) apply:(if (= (count at:("NextSite" from:(to))) 0) (set Value Mover Off) (set Value Mover ("NextSite" from:(to)))))))) (nextPhase Mover ("IsOffBoard" (value Player Mover)) "Opening3")) (phase "Opening3" (play (move (from (forEach (sites Mover "Inner") if:(!= 0 (count at:(site))))) (to (forEach (sites Mover "Outer") if:(= 0 (count at:(site))))) count:2)) (nextPhase Mover "Opening4")) (phase "Opening4" (play (move Remove (sites Next "Home"))) (nextPhase Mover "Opening5")) (phase "Opening5" (play (move Remove (sites Next "Home"))) (nextPhase Mover "Playing")) (phase "Playing" (play (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover "Home")) if:(> (count at:(from)) 0)) (then (sow "TrackCCW" owner:(mover) apply:(if (= (count at:(to)) 1) (if (is In (to) (sites Mover "Inner")) (if (> (count at:("OppositePit" (to))) 0) (and (remove ("OppositePit" (to))) (if (> (count at:("OppositeOuterPit" (to))) 0) (remove ("OppositeOuterPit" (to))))))) (moveAgain)))))))} (end (forEach Player if:(= 0 ("PiecesOwnedBy" Player)) (result Player Loss)))))
###
| (define "NextSite" ("NextSiteOnTrack" 1 #1)) (define "FirstSiteToSow" (if (is Mover P1) (intersection (sites Right) (sites Row 1)) (intersection (sites Left) (sites Row 2)))) (define "PiecesOwnedBy" (count in:(sites #1 "Home"))) (define "Columns" 12) (game "Nchuwa" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "TrackCCW1" "0,E,N1,W" loop:True P1) (track "TrackCCW2" "24,E,N1,W" loop:True P2)}) (regions "Home" P1 (sites Track "TrackCCW1")) (regions "Home" P2 (sites Track "TrackCCW2")) (regions "Inner" P1 (sites Row 1)) (regions "Inner" P2 (sites Row 2)) (regions "Outer" P1 (sites Row 0)) (regions "Outer" P2 (sites Row 3)) (piece "Seed" Shared)}) (rules (start (set Count 2 to:(union (sites P1 "Home") (sites P2 "Home")))) phases:{ (phase "Opening1" (play (move Select (from ("FirstSiteToSow")) (then (sow "TrackCCW" owner:(mover) apply:(set Value Mover ("NextSite" from:(to))))))) (nextPhase Mover "Opening2")) (phase "Opening2" (play (move Select (from (value Player Mover)) (then (sow "TrackCCW" owner:(mover) apply:(if (= (count at:("NextSite" from:(to))) 0) (set Value Mover Off) (set Value Mover ("NextSite" from:(to)))))))) (nextPhase Mover ("IsOffBoard" (value Player Mover)) "Opening3")) (phase "Opening3" (play (move (from (forEach (sites Mover "Inner") if:(!= 0 (count at:(site))))) (to (forEach (sites Mover "Outer") if:(= 0 (count at:(site))))) count:2)) (nextPhase Mover "Opening4")) (phase "Opening4" (play (move Remove (sites Next "Home"))) (nextPhase Mover "Opening5")) (phase "Opening5" (play (move Remove (sites Next "Home"))) (nextPhase Mover "Playing")) (phase "Playing" (play (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover "Home")) if:(> (count at:(from)) 0)) (then (sow "TrackCCW" owner:(mover) apply:(if (= (count at:(to)) 1) (if (is In (to) (sites Mover "Inner")) (if (> (count at:("OppositePit" (to))) 0) (and (remove ("OppositePit" (to))) (if (> (count at:("OppositeOuterPit" (to))) 0) (remove ("OppositeOuterPit" (to))))))) (moveAgain)))))))} (end (forEach Player if:(= 0 ("PiecesOwnedBy" Player)) (result Player Loss))))) END |
Describe the mechanics of the following Ludii game
(game "Nine Holes" (players 2) (equipment { (board (square 3) use:Vertex) (hand Each) (piece "Marker" Each (move (from) (to (sites Empty))))}) (rules (start (place "Marker" "Hand" count:3)) phases:{ (phase "Placement" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase ("HandEmpty" P2) "Movement")) ("PhaseMovePiece" "Movement")} (end ("Line3Win" Orthogonal))))
###
| 3x3 intersecting lines. Three pieces per player. Players alternate turns placing pieces on an empty spot on the board. When all pieces are placed, players alternate turns moving a piece to any empty spot on the board. The first player to place their pieces in an orthogonal row along the lines wins. END |
Construct a Ludii game based on the following description
The board is a double-headed eagle, with two lines of ten holes. One seven-sided die. One side has a special mark, one is blank, and the others are numbered 1-5. The special mark scores 10, the blank side scores -10. Players roll the die, and add up their scores as they go, placing a peg in a hole to mark ten points. The player who reaches 100 points first wins.
###
| (define "Column" (- (mover) 1)) (define "Row" (- (/ (score Mover) 10) 1)) (game "Pasa" (players 2) (equipment { (board (rectangle 10 2)) (piece "Disc" Each) (dice d:7 from:0 num:1) (map {(pair 0 -10) (pair 1 1) (pair 2 2) (pair 3 3) (pair 4 4) (pair 5 5) (pair 6 6) (pair 7 10)})}) (rules (play (do (roll (then (addScore Mover (mapEntry (count Pips))))) next:(move Pass (then (and (remove (sites Column "Column")) (if (>= (score Mover) 10) (add (piece (id "Disc" Mover)) (to (intersection (sites Column "Column") (sites Row "Row")))))))))) (end (if (>= (score Mover) 100) (result Mover Win))))) END |
Describe the mechanics of the following Ludii game
(define "NextSite" (if (= ("NextSiteOnTrack" 1 #1) (mapEntry Mover)) ("NextSiteOnTrack" 2 #1) ("NextSiteOnTrack" 1 #1))) (define "LastHoleSowed" (sites {("NextSite" from:(last To afterConsequence:True))})) (define "Columns" 5) (game "Sonka" (players 2) (equipment { (mancalaBoard 2 "Columns" { (track "Track1" "11,10,W,S,E" loop:True P1) (track "Track2" "0,1,E,N,W" loop:True P2)}) (piece "Seed" Shared) (regions "Home" P1 (sites Bottom)) (regions "Home" P2 (sites Top)) (map {(pair P1 LastSite) (pair P2 FirstSite)})}) (rules (start (set Count 6 to:(union (sites Bottom) (sites Top)))) phases:{ (phase "Sowing" (play (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover "Home")) if:(< 0 (count at:(from)))) (then (sow "Track" owner:(mover) apply:(if (!= 0 (count at:("NextSite" from:(to)))) (moveAgain) (if (is In (to) (sites Mover "Home")) (if (!= 0 (count at:("OppositePit" (to)))) (fromTo (from ("OppositePit" (to))) (to (mapEntry Mover)) count:(count at:("OppositePit" (to))))))))))) (end (if (all Passed) { (if (> 6 (count at:(mapEntry P1))) (result P2 Win)) (if (> 6 (count at:(mapEntry P2))) (result P1 Win))})) (nextPhase (all Passed) "BetweenRounds")) (phase "BetweenRounds" (play (if (<= 6 (count at:(mapEntry Mover))) (move (from (mapEntry Mover)) (to (intersection (sites Empty) (sites Mover "Home"))) count:6))) (nextPhase (all Passed) "Sowing"))}))
###
| 2x5 board with one store on either side. Six counters in each hole. Players play each turn simultaneously. Players sow from the holes in their row in an anti-clockwise direction, including their own store but not the opponent's store. When the final counter is sown, the contents of the next hole are picked up and sowing continues. If this hole is empty, the move ends and the player must wait for the other player to finish the move before they begin again. If the move ends in the player's own row, the player captures the counters in the opponent's row opposite to the one in which the last counter was dropped. Play continues until all of the counters are in the stores. The counters are then redistributed into the holes as at the beginning of the game. The player with extra counters places them in the store. END |
Construct a global Ludii definition which fulfills the following requirements.
Checks if all the sites in a specific hand are empty. This ludemeplex is working only for non stacking games.
###
| (define "HandEmpty" (all Sites (sites Hand #1) if:(= 0 (count Cell at:(site))))) END |
Modify the Ludii game according to the following option changes:
The game has 2 players. -> The game has 3 players.
(define "MoveBankor" (move (from ("WhereBankor") level:("LevelBankor")) (to ("BankorOnTrack" "Track" ("ThrowValue"))) (then (and (if (!= (mover) "StateBankor") (set State at:("WhereBankor") level:("LevelBankor") (mover))) (if (= (last To) ("Center")) (forEach Site (sites Track "Track" from:(last From) to:(last To)) (if (!= (site) (last To)) (forEach Level (site) FromTop (remove (site) level:(level))))) (forEach Site (sites Track "Track" from:(last From) to:(last To)) (if (!= (site) (last To)) (forEach Level (site) FromTop (fromTo (from (site) level:(level)) (to (last To))))))))))) (define "Center" 0) (define "StateBankor" (state at:("WhereBankor") level:("LevelBankor"))) (define "LevelBankor" (where Level "Bankor" Neutral at:("WhereBankor"))) (define "WhereBankor" (where "Bankor" Neutral)) (define "BankorPhaseDone" (or (= ("WhereBankor") ("Center")) (and (is Occupied ("Center")) (>= 1 (count Sites in:(difference (sites Occupied by:All) ("WhereBankor"))))))) (define "BankorOnTrack" ("NextSiteOnTrack" #2 from:("WhereBankor") #1)) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" #2 #1)) (define "Throw1" (= ("ThrowValue") 1)) (define "ThrowValue" (mapEntry "Throw" (count Pips))) (game "Sik" (players 2) (equipment { (board (spiral turns:5 sites:86) { (track "Track" {85..0} directed:True)} use:Vertex) ("StickDice" 4) (map "Throw" {(pair 0 4) (pair 1 3) (pair 2 0) (pair 3 1) (pair 4 6)}) (piece "Stick" Each (move (from (from) level:(level) if:(or (= 1 (state at:(from) level:(level))) ("Throw1"))) (to ("SiteToMoveOnTrack" "Track" ("ThrowValue")) if:True) (then (if (!= 1 (state at:(last To) level:(last LevelTo))) (set State at:(last To) level:(last LevelTo) 1))))) (piece "Bankor" Neutral)}) (rules (start { (place Stack items:{"Stick2" "Stick1"} 85) (place Stack "Bankor0" 85)}) (play ("RollMove" (if (= ("Center") (where "Stick" Mover)) (if (< (value Player Mover) 2) (move Pass (then (set Value Mover (+ 1 (value Player Mover))))) (if (or (= (mover) ("StateBankor")) (= 0 ("StateBankor"))) (if (!= 0 ("ThrowValue")) ("MoveBankor")))) (if (!= 0 ("ThrowValue")) (forEach Piece))))) (end { (forEach Player if:(no Pieces Player) (result Player Loss)) (forEach Player if:("BankorPhaseDone") (result Player Win))})))
###
| (define "MoveBankor" (move (from ("WhereBankor") level:("LevelBankor")) (to ("BankorOnTrack" "Track" ("ThrowValue"))) (then (and (if (!= (mover) "StateBankor") (set State at:("WhereBankor") level:("LevelBankor") (mover))) (if (= (last To) ("Center")) (forEach Site (sites Track "Track" from:(last From) to:(last To)) (if (!= (site) (last To)) (forEach Level (site) FromTop (remove (site) level:(level))))) (forEach Site (sites Track "Track" from:(last From) to:(last To)) (if (!= (site) (last To)) (forEach Level (site) FromTop (fromTo (from (site) level:(level)) (to (last To))))))))))) (define "Center" 0) (define "StateBankor" (state at:("WhereBankor") level:("LevelBankor"))) (define "LevelBankor" (where Level "Bankor" Neutral at:("WhereBankor"))) (define "WhereBankor" (where "Bankor" Neutral)) (define "BankorPhaseDone" (or (= ("WhereBankor") ("Center")) (and (is Occupied ("Center")) (>= 1 (count Sites in:(difference (sites Occupied by:All) ("WhereBankor"))))))) (define "BankorOnTrack" ("NextSiteOnTrack" #2 from:("WhereBankor") #1)) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" #2 #1)) (define "Throw1" (= ("ThrowValue") 1)) (define "ThrowValue" (mapEntry "Throw" (count Pips))) (game "Sik" (players 3) (equipment { (board (spiral turns:5 sites:86) { (track "Track" {85..0} directed:True)} use:Vertex) ("StickDice" 4) (map "Throw" {(pair 0 4) (pair 1 3) (pair 2 0) (pair 3 1) (pair 4 6)}) (piece "Stick" Each (move (from (from) level:(level) if:(or (= 1 (state at:(from) level:(level))) ("Throw1"))) (to ("SiteToMoveOnTrack" "Track" ("ThrowValue")) if:True) (then (if (!= 1 (state at:(last To) level:(last LevelTo))) (set State at:(last To) level:(last LevelTo) 1))))) (piece "Bankor" Neutral)}) (rules (start { (place Stack items:{"Stick3" "Stick2" "Stick1"} 85) (place Stack "Bankor0" 85)}) (play ("RollMove" (if (= ("Center") (where "Stick" Mover)) (if (< (value Player Mover) 2) (move Pass (then (set Value Mover (+ 1 (value Player Mover))))) (if (or (= (mover) ("StateBankor")) (= 0 ("StateBankor"))) (if (!= 0 ("ThrowValue")) ("MoveBankor")))) (if (!= 0 ("ThrowValue")) (forEach Piece))))) (end { (forEach Player if:(no Pieces Player) (result Player Loss)) (forEach Player if:("BankorPhaseDone") (result Player Win))}))) END |
Construct a Ludii game based on the following description
Goal: Connect all three edge colors with a single group of connected stones of your own color. (As in 'Y')
Turns alternate. The player seeking to connect with the darker color starts.
The turns consist of two parts: a conditional conversion of stones in the vicinity of the last placement, followed by one's own placement.
The conversion part requires one to examine the opponent's stones around (and including) the last placed stone. Then to convert into your own, any that are surrounded by more of their own color than of yours. This is done one-by-one in any desired order, until the condition no longer applies.
When no stone has more friendly neighbors than enemy neighbors, the current player places a new stone onto any empty location.
The first player to connect all 3 sides is the winner.
If the 122* turn protocol option is selected, the turn begins and ends with a placement, and the conversions occur in between. Hex 4-5 Board (48) Alternating
###
| (define "EdgesOfSide" (intersection (sites Outer Edge) (forEach of:(difference #1 (sites Corners Vertex)) (sites Incident Edge of:Vertex at:(site))))) (define "BoardColour" (colour 215 203 170)) (define "P2Colour" (colour White)) (define "P1Colour" (colour DarkGreen)) (define "IsConnectedPlayer" (is Connected 3 {"Side1" "Side2" "Side3"})) (define "DefectorMove" (priority (move Add (to (sites Occupied by:Next) if:(< "MoverLimit" (count Pieces Next in:(sites Around (to) Orthogonal))) (apply (remove (to)))) (then (moveAgain))) ("AddToEmpty" ~))) (define "AddToEmpty" (move Add (to (sites Empty)) #1)) (define "MoverLimit" (count Pieces Mover in:(sites Around (to) Orthogonal))) (define "Side3" (union (sites Side NW) (sites Side SW))) (define "Side2" (union (sites Side SE) (sites Side S))) (define "Side1" (union (sites Side NE) (sites Side N))) (game "Defector Y" (players 2) (equipment { (board (tri Limping 4) use:Vertex) (piece "Disc" Each) (piece "Counter" Neutral maxState:2)}) (rules (play (if True ("DefectorMove") (priority ("AddToEmpty" (then (moveAgain))) ("DefectorMove")))) (end { (if ("IsConnectedPlayer") (result Mover Win))}))) END |
Construct a Ludii game based on the following description
Start: The game starts with a piece in each cell, which defines the challenge to be solved.
Play: The player then makes a series of moves, each involving the removal of a pair of same-coloured pieces that occupy a box (rectangle) that includes no other pieces of any colour.
End: The player wins by removing all pieces from the board. Conversely, the player loses if there are no legal moves at any point while pieces remain on the board.
###
| (define "IsEmptyRectangle" ("IsEmptyLine" #1 #2 column Row row) ("IsEmptyLine" #1 #2 row Column column)) (define "IsEmptyLine" (if (> (#3 of:#1) (#3 of:#2)) ("NumNonEmptySitesBetween" #1 #2 #4 #5 (and (<= (#3 of:(site)) (#3 of:#1)) (>= (#3 of:(site)) (#3 of:#2)))) ("NumNonEmptySitesBetween" #1 #2 #4 #5 (and (<= (#3 of:(site)) (#3 of:#2)) (>= (#3 of:(site)) (#3 of:#1)))))) (define "NumNonEmptySitesBetween" (= 0 (count Sites in:(intersection (difference (sites Occupied by:All) (sites {#1 #2})) (forEach (union (sites #3 (#4 of:#1)) (sites #3 (#4 of:#2))) if:#5))))) (game "BoxOff" (players 1) (equipment { (board (rectangle 6 8)) (piece "Disc1" P1) (piece "Disc2" P1) (piece "Disc3" P1)}) (rules (start { (place Random {"Disc1"} count:16) (place Random {"Disc2"} count:16) (place Random {"Disc3"} count:16)}) (play (move Select (from (sites Occupied by:All)) (to (difference (sites Occupied by:All) (from)) if:(and { (= (what at:(from)) (what at:(to))) ("IsEmptyRectangle" (from) (to))})) (then (and (remove (last From)) (remove (last To)))))) (end { (if (no Pieces Mover) (result Mover Win)) (if (no Moves Mover) (result Mover Loss))}))) END |
Construct a global Ludii definition which fulfills the following requirements.
Checks if no enemy or only one in a stack game.
###
| (define "NoEnemyOrOnlyOne" (or (not ("IsEnemyAt" #1)) ("IsSingletonStack" #1))) END |
Construct a Ludii game based on the following description
Played on an 8x8 board with pieces with specialized moves: Pawns (8): can move one space orthogonally forward, or two steps orthogonally forward on their first move, capture one space diagonally forward; Rooks (2): can move any number of spaces orthogonally; Bishops (2): can move any number of spaces diagonally; Knight (2): moves in any direction, one space orthogonally with one space forward diagonally; Queens (1): can move any number of spaces orthogonally or diagonally, cannot capture another Queen; Kings (1): can move one space orthogonally or diagonally, but on the first turn may move two squares provided it is not currently in check. The King cannot capture with this move. Castling, En Passant, and Pawn promotion allowed. Pawns promote to Queens when reaching the last row on the board only if that player's Queen has already been captured. An opponent's piece is captured by moving a player's own piece onto a space occupied by the opponent's piece. When a King can be captured on the next turn by an opponent's piece, it is in check. The King must not be in check at the end of the player's turn. If this is not possible, it is checkmate and the opponent wins. If the opponent is reduced to only a king, it is considered a win. Stalemate is also a win for the player causing the stalemate.
###
| (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 2 "KingNotCheckedAndToEmpty" (then ("CastleRook" "RookLeft" E 3 True)))) (define "SmallCastling" ("DecideToCastle" "King" E 2 "KingNotCheckedAndToEmpty" (then ("CastleRook" "RookRight" W 2 True)))) (define "CastleRook" (slide (from (mapEntry #1 (mover))) #2 (between (exact #3) if:#4) (to if:True (apply ("PieceHasMoved" (from)))))) (define "DecideToCastle" (move Slide (from (mapEntry #1 (mover))) #2 (between (exact #3) if:#4) (to if:True (apply ("PieceHasMoved" (from)))) #5)) (define "KingNotCheckedAndToEmpty" (and (is Empty (to)) (not ("IsInCheck" "King" Mover at:(to))))) (define "CaptureToPiece" (apply (if ("IsEnemyAt" (to)) (remove (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 "Scachs" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) ("ChessPawn" "Pawn" (or "InitialPawnMove" "EnPassant") (then (if (and ("IsOffBoard" (where "Queen" Mover)) (is In (last To) (sites Mover "Promotion"))) (promote (last To) (piece {"Queen"}) Mover)))) ("ChessRook" "Rook" ~ ("RememberPieceHasMoved")) (piece "King" Each (or (if (and (not ("IsInCheck" "King" Mover)) ("HasNeverMoved" "King")) (move Slide (between (exact 2)) (to if:(is Empty (to))))) ("StepToNotFriend") "RememberPieceHasMoved")) ("ChessBishop" "Bishop") ("ChessKnight" "Knight") (piece "Queen" Each (move Slide (to if:(and (not ("IsPieceAt" "Queen" Next (to))) ("IsEnemyAt" (to))) "CaptureToPiece"))) (map "King" {(pair 1 "E1") (pair 2 "E8")}) (map "RookLeft" {(pair 1 "A1") (pair 2 "A8")}) (map "RookRight" {(pair 1 "H1") (pair 2 "H8")}) (regions "Promotion" P1 (sites Top)) (regions "Promotion" P2 (sites Bottom))}) (rules (start { (place "Pawn1" (sites Row 1)) (place "Pawn2" (sites Row 6)) (place "Rook1" {"A1" "H1"} state:1) (place "Knight1" {"B1" "G1"}) (place "Bishop1" {"C1" "F1"}) (place "Queen1" coord:"D1") (place "King1" coord:"E1" state:1) (place "Rook2" {"A8" "H8"} state:1) (place "Knight2" {"B8" "G8"}) (place "Bishop2" {"C8" "F8"}) (place "Queen2" coord:"D8") (place "King2" coord:"E8" state:1)}) (play (do (or (forEach Piece) (if (and ("HasNeverMoved" "King") (not ("IsInCheck" "King" Mover))) (or (if (and ("HasNeverMoved" "RookLeft") (can Move ("CastleRook" "RookLeft" E 3 (is Empty (to))))) "BigCastling") (if (and ("HasNeverMoved" "RookRight") (can Move ("CastleRook" "RookRight" W 2 (is Empty (to))))) "SmallCastling")))) ifAfterwards:(not ("IsInCheck" "King" Mover)))) (end { ("Checkmate" "King") (if (= 1 (count Pieces Next)) (result Mover Win)) ("BlockWin")}))) END |
Describe the mechanics of the following Ludii game
(define "NoEdgeBetweenCells" (not ("NoSites" (sites Around (to) Own Orthogonal if:("NoSites" (difference "EdgeInCommon" (sites Empty Edge))))))) (define "EdgeInCommon" (intersection (sites Incident Edge of:Cell at:(from)) (sites Incident Edge of:Cell at:(to)))) (define "NumContainmentByTurn" 4) (define "NumContagionByTurn" 3) (game "Contagion" (players 2) (equipment { (board (rectangle 8 8))}) (rules (start (set Score P2 (* (count Rows) (count Columns)))) phases:{ (phase "InitContagion" P1 (play (move Add (to Cell (sites Empty Cell)) (then (and (if (< (count MovesThisTurn) (- "NumContagionByTurn" 1)) (moveAgain)) (addScore {P1 P2} {1 -1}))))) (nextPhase (not (is Next Mover)) "ContagionGrowth")) (phase "ContagionGrowth" P1 (play (move Add (to Cell (sites Empty Cell) if:("NoEdgeBetweenCells")) (then (and (if (< (count MovesThisTurn) (- "NumContagionByTurn" 1)) (moveAgain)) (addScore {P1 P2} {1 -1})))))) (phase "Containment" P2 (play (move Add (to Edge (sites Empty Edge)) (then (if (< (count MovesThisTurn) (- "NumContainmentByTurn" 1)) (moveAgain))))))} (end { (if (> (score P1) (/ (* (count Rows) (count Columns)) 2)) (result P1 Win)) (if (no Moves P1) (result P2 Win))})))
###
| The face player places three faces each turn. The edge player places four edges each turn. The face player goes first and can specify any locations on the board on their first turn. On all subsequent turns the face player can only place a face next to another face (orthogonally), that does not pass through an edge. The edge player can place their four lines anywhere. The game is finished when the face player cannot add a piece or if they cover more than half the board. The game is played on a 8x8 board END |
What does the following global Ludii definition do?
(define "AlquerqueBoardWithBottomAndTopTriangles" (board ("AlquerqueGraphWithBottomAndTopTriangles") use:Vertex))
###
| Defines a rectangular board with Alquerque-style alternating diagonals with a triangle extension at the bottom and another at the top. END |
Construct a Ludii game based on the following description
Each row and column is assigned a number. The player then places a number from 1 to 9 in each square so that it adds up to the assigned number in each row and column. Numbers cannot be duplicated in any row or column.
###
| (game "Kakuro" (players 1) (equipment { (board (rectangle 14 12) (values Cell (range 1 9))) (hints { (hint {2 3} 16) (hint {5 6 7} 24) (hint {9 10} 13) (hint {14 15} 14) (hint {17 18 19} 20) (hint {21 22} 14) (hint {25 26} 3) (hint {28 29} 4) (hint {31 32} 17) (hint {34 35} 3) (hint {37 38} 4) (hint {40 41 42 43 44} 25) (hint {46 47} 16) (hint {49 50 51} 24) (hint {53 54 55} 6) (hint {57 58 59} 24) (hint {61 62 63 64 65} 35) (hint {67 68 69 70 71} 35) (hint {75 76} 17) (hint {80 81} 17) (hint {85 86 87 88 89} 27) (hint {91 92 93 94 95} 22) (hint {97 98 99} 6) (hint {101 102 103} 7) (hint {105 106 107} 7) (hint {109 110} 4) (hint {112 113 114 115 116} 32) (hint {118 119} 16) (hint {121 122} 12) (hint {124 125} 15) (hint {127 128} 14) (hint {130 131} 6) (hint {134 135} 4) (hint {137 138 139} 22) (hint {141 142} 7) (hint {146 147} 7) (hint {149 150 151} 15) (hint {153 154} 6) (hint {3 15} 17) (hint {6 18} 14) (hint {9 21} 16) (hint {28 40} 3) (hint {32 44} 16) (hint {42 54} 4) (hint {25 37 49 61} 19) (hint {2 14 26 38 50 62} 34) (hint {5 17 29 41 53 65} 31) (hint {7 19 31 43 55 67} 38) (hint {10 22 34 46 58 70} 37) (hint {35 47 59 71} 24) (hint {64 76 88} 24) (hint {68 80 92} 24) (hint {51 63 75 87 99} 31) (hint {57 69 81 93 105} 34) (hint {102 114} 4) (hint {85 97 109 121} 11) (hint {112 124} 12) (hint {116 128} 12) (hint {95 107 119 131} 14) (hint {86 98 110 122 134 146} 22) (hint {135 147} 3) (hint {89 101 113 125 137 149} 37) (hint {138 150} 16) (hint {91 103 115 127 139 151} 35) (hint {141 153} 4) (hint {94 106 118 130 142 154} 24)}) (regions HintRegions)}) (rules (play (satisfy { (is Sum (hint)) (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 as seventeen hens, which begin on the points on one of the arms of the cross and along the line immediately perpendicular to that arm, and on the two outermost points on the left and right arms. The other player plays as one fox, which starts on the central point of the board. Players alternate turns moving to an empty adjacent spot along the lines of the board. The hens, however, can only move in a forward or horizontal direction. The fox hops over an adjacent hen to an empty spot immediately on the opposite side of the hen along the lines of the board. At the beginning of the game, the players choose whether to allow the fox the ability to make multiple captures in one turn. If the fox is able to capture but does not, the opponent adds another hen on an empty point in the bottom row. If there is no empty spot on the bottom row, the player waits until there is one to place the new hen. The fox wins by capturing all of the hens or by moving to the furthest line on the hens' side of the board. The hens win by blocking the fox from being able to move.
The fox can capture one single piece.
###
| (define "BottomEmptySites" (intersection (sites Empty) (sites Bottom))) (define "HenAdded" (set Value Prev (- (value Player Prev) 1))) (define "DidNotCaptured" (> (value Player Prev) 0)) (define "HasNotCaptured" (if (< (value Player Mover) 0) (set Value Mover 1) (set Value Mover (+ 1 (value Player Mover))))) (define "HopCustomSequenceCapture" (move Hop #1 #2 (between if:("IsEnemyAt" (between)) (apply (remove (between) #3))) (to if:(is Empty (to))) (then (if (can Move (hop (from (last To)) #2 (between if:(and (not (is In (between) (sites ToClear))) ("IsEnemyAt" (between))) (apply (remove (between) #3))) (to if:(is Empty (to))))) (moveAgain))))) (define "ShouldCapturedButMoved" (and (is Pending) (not (is In (last To) ("SitesWithPossibleCaptureInPreviousTurn"))))) (define "SitesWithPossibleCaptureInPreviousTurn" (sites Pending)) (define "RememberSiteWithPossibleMultiCapture" (set Pending (sites To (if ("SameTurn") #1 (forEach Piece "Fox" #2))))) (define "RememberSiteWithPossibleCapture" (set Pending (sites To (forEach Piece "Fox" #1)))) (game "Renard et les Poules" (players 2) (equipment { ("CrossBoard" 3 7 use:Vertex diagonals:Alternating) (hand P1) (piece "Fox" P1 S (or ("HopCapture") ("StepToEmpty"))) (piece "Hen" P2 N ("StepToEmpty" (directions {Forwards Rightward Leftward})))}) (rules (start { (place "Fox1" (centrePoint)) (place "Hen2" (union {(expand (sites Bottom)) (sites Row 2) (sites {"A4" "G4" "A5" "G5"})}))}) phases:{ (phase "FoxPhase" P1 (play (do ("RememberSiteWithPossibleCapture" ("HopCapture")) next:(forEach Piece (then (if ("ShouldCapturedButMoved") ("HasNotCaptured"))))))) (phase "HenPhase" P2 (play (if (and ("DidNotCaptured") (!= 0 (count Sites in:("BottomEmptySites")))) (move Add (to ("BottomEmptySites")) (then (and ("HenAdded") (moveAgain)))) (forEach Piece))))} (end { (if (no Moves P1) (result P1 Loss)) (if (or (is In (where "Fox" P1) (sites Bottom)) (no Pieces P2)) (result P1 Win))}))) END |
Construct a Ludii game based on the following description
The game CrossGeo can be played on graphs with any number of edges in a geometric plane, where there are some edges crossing with other edges. The edge colours are related to the playing rules of each version. For the basic version, CrossGeo, all edges have the same colour; green. In each turn, a player selects an edge to remove it, and all its intersecting edges. The player who removes the last edge is the winner of the game. The second version is the Red-Blue version; CrossGeoR-B. There are two players, one red and one blue. Players can only select the edges of their own colours. In each turn, a player selects an edge to remove it, and all its intersecting lines (of any colour). The last version is CrossGeoR-G-B; there are sets of red, green, and blue edges, with some edges crossing. Players can select the edges of their own colours or of the green colour. Importantly, the green edges are used as shared edges between both players. At each turn, a player selects an edge to remove it and all its intersecting lines (of any colour). For all the versions of CrossGeo, if the current player has no move, then the opposing player wins. The players play on CrossGeo version.
###
| (game "CrossGeo" (players 2) (equipment { (board (graph vertices:{ {2 0} {3 0} {1 1} {1 2} {0 2} {0 4} {1 3} {1 5} {2 4} {2 2} {4 2} {3 3} {3 1} {5 1} {6 2} {6 1} {8 1} {7 3} {9 3} {9 1} {8 4} {8 2} {10 3} {11 2} {11 1} {13 1} {13 3} {14 2} {10 3} {10 5} {8 5} {9 6} {12 3} {11 4} {13 6} {12 4} {14 6} {11 6} {5 7} {11 7} {8 7} {8 6} {7 6} {7 8} {4 4} {5 3} {6 4} {5 5} {7 5} {6 6} {1 7} {3 7} {2 6} {4 6} {3 5} {13 4}} edges:{ {0 1} {0 2} {2 3} {1 3} {4 5} {5 8} {6 7} {9 10} {11 12} {12 13} {14 15} {15 16} {17 18} {18 19} {20 21} {21 22} {23 27} {24 25} {25 26} {28 29} {29 30} {31 32} {33 34} {35 36} {37 55} {42 43} {38 39} {40 41} {44 46} {46 49} {45 47} {47 48} {52 53} {50 51} {51 54}}) use:Edge) (piece "Disc" Each) (piece "Marker" Shared)}) (rules (start { (set Shared Edge (sites Board Edge))}) (play (move Remove (sites Occupied by:Shared) (then (forEach Site (sites Crossing at:(last To) All) (remove Edge (to)))))) (end (if (no Moves Mover) (result Next Win))))) END |
Construct a Ludii game based on the following description
The puzzle consists of a triangular grid of cells containing digits from 1 to 9. The objective is to fill a grid with digits so that each cell contains a digit and no digit is repeated in any column, row and diagonal in any direction. Also, no digit occurs twice in any of the three larger 3 x 3 square regions and any of the three larger triangular regions enclosed by thick borders.
###
| (game "Sujiken" (players 1) (equipment { (board (remove (square 9) cells:{ 73 74 75 76 77 78 79 80 65 66 67 68 69 70 71 57 58 59 60 61 62 49 50 51 52 53 41 42 43 44 33 34 35 25 26 17}) (values Cell (range 1 9))) (regions {Columns Rows}) (regions {39 43}) (regions {35 40}) (regions {30 36 41}) (regions {24 31 37}) (regions {17 25 32 38}) (regions {9 18 26 33}) (regions {0 10 19 27 34}) (regions {1 11 20 28}) (regions {2 12 21 29}) (regions {3 13 22}) (regions {4 14 23}) (regions {5 15}) (regions {6 16}) (regions {9 1}) (regions {17 10 2}) (regions {24 18 11 3}) (regions {30 25 19 12 4}) (regions {35 31 26 20 13 5}) (regions {39 36 32 27 21 14 6}) (regions {42 40 37 33 28 22 15 7}) (regions {44 43 41 38 34 29 23 16 8}) (regions {0 1 2 9 10 11 17 18 19}) (regions {3 4 5 12 13 14 20 21 22}) (regions {6 7 8 15 16 23}) (regions {24 25 26 30 31 32 35 36 37}) (regions {27 28 29 33 34 38}) (regions {39 40 41 42 43 44})}) (rules (start (set { {0 6} {1 9} {3 2} {5 8} {7 7} {9 2} {10 1} {12 5} {14 9} {16 3} {20 3} {24 9} {25 3} {26 1} {28 8} {33 9} {34 5} {35 4} {36 8} {42 3} {43 4}})) (play (satisfy (all Different))) (end (if (is Solved) (result P1 Win))))) END |
Describe the mechanics of the following Ludii game
(define "Move" (move (from (sites Occupied by:All)) (to (union (sites Around (sites Distance (step Orthogonal (to if:(is In (to) (sites Empty)))) from:(from) (range 1 (count Sites in:(sites Board)))) Orthogonal) (sites Around (from) Orthogonal)) if: (and (= (what at:(from)) (what at:(to))) (not (= (from) (to)))) (apply (and (remove (from)) (remove (to))))))) (game "Shisen-Sho" (players 1) (equipment { (board (rectangle (+ 12 0)(+ 14 0))) (piece "BambooOne" P1) (piece "BambooTwo" P1) (piece "BambooThree" P1) (piece "BambooFour" P1) (piece "BambooFive" P1) (piece "BambooSix" P1) (piece "BambooSeven" P1) (piece "BambooEight" P1) (piece "BambooNine" P1) (piece "CharacterOne" P1) (piece "CharacterTwo" P1) (piece "CharacterThree" P1) (piece "CharacterFour" P1) (piece "CharacterFive" P1) (piece "CharacterSix" P1) (piece "CharacterSeven" P1) (piece "CharacterEight" P1) (piece "CharacterNine" P1) (piece "CircleOne" P1) (piece "CircleTwo" P1) (piece "CircleThree" P1) (piece "CircleFour" P1) (piece "CircleFive" P1) (piece "CircleSix" P1) (piece "CircleSeven" P1) (piece "CircleEight" P1) (piece "CircleNine" P1) (piece "DragonGreen" P1) (piece "DragonRed" P1) (piece "DragonWhite" P1) (piece "FlowerBamboo" P1) (piece "FlowerChrysanthemum" P1) (piece "FlowerOrchid" P1) (piece "FlowerPlum" P1) (piece "SeasonSpring" P1) (piece "SeasonSummer" P1) (piece "SeasonAutumn" P1) (piece "SeasonWinter" P1) (piece "WindNorth" P1) (piece "WindEast" P1) (piece "WindWest" P1) (piece "WindSouth" P1) (regions "TilePlacementRegion" (sites Board))}) (rules (start { (place Random (sites "TilePlacementRegion") {"BambooOne" "BambooTwo" "BambooThree" "BambooFour" "BambooFive" "BambooSix" "BambooSeven" "BambooEight" "BambooNine" "CharacterOne" "CharacterTwo" "CharacterThree" "CharacterFour" "CharacterFive" "CharacterSix" "CharacterSeven" "CharacterEight" "CharacterNine" "CircleOne" "CircleTwo" "CircleThree" "CircleFour" "CircleFive" "CircleSix" "CircleSeven" "CircleEight" "CircleNine" "DragonGreen" "DragonRed" "DragonWhite" "FlowerBamboo" "FlowerChrysanthemum" "FlowerOrchid" "FlowerPlum" "SeasonSpring" "SeasonSummer" "SeasonAutumn" "SeasonWinter" "WindNorth" "WindEast" "WindWest" "WindSouth"} count:4)}) (play "Move") (end (if (no Pieces All) (result P1 Win)))))
###
| Player choose a pair of identical tiles to connect. If the requirements are met, two tiles will be eliminated. The player’s task is to eliminate all the tiles on the board. The game is over if future moves are not possible and tiles are left on the board, or the player successfully removes all the tiles. Small Size No outer ring of spaces END |
Construct a Ludii game based on the following description
Four 3x5 grids, arranged in four corners of a rectangular board. Three pieces per player. Five cowrie shells used as dice; the value of the throw equaling the number of the mouths which land face up. Players begin by entering their pieces onto the board from the square in the central row of the grid to their right. A single piece may be entered with a throw of 1, or all of the player's pieces may be entered with a throw of 5. Throws of 1 and 5 grant the player another throw, and pieces are moved only after all of the players throws are made. Play proceeds down the central row where the pieces entered, in an anti-clockwise direction until reaching the bottom right hand corner of the left grid, at which point the track continues on the opponent's side of the board from the top right corner of the left board (with respect to the current player), proceeding around the opponent's grids in an anti-clockwise direction until reaching the top left square of the opponent's right grid. At this point, the piece returns to the player's own right grid, on the bottom left corner, and proceeding in an anti-clockwise direction into the central row, and off the board once moving past the final space. When a player lands on a space occupied by an opponent's piece, the opponent's piece is removed from the board and must re-enter as before. Pieces are safe from being sent back when resting on the left two corners of each grid on the left and the right two corners of each grid on the right. The first player to remove all of their pieces from the board wins.
###
| (define "ThrowMove" (if ("HasToThrow") ("RollMove" (if ("IfMoveAgain") (do (set Value Mover (count Pips)) next:("Move")) (move Pass (then (set Value Mover (count Pips)))))) ("Move"))) (define "Move" (if (and (= "ThrowValue" 1) ("HandOccupied" Mover)) (move (from (handSite Mover)) (to (mapEntry "EntrySite" (mover))) (then ("ThrowAgainAndPlay"))) (if (and (= "ThrowValue" 5) ("HandOccupied" Mover)) (move (from (handSite Mover)) (to (mapEntry "EntrySite" (mover))) count:(count Cell at:(handSite Mover)) (then ("ThrowAgainAndPlay"))) (forEach Piece)) (then ("StopTurnIfNoMoveAgain")))) (define "IfMoveAgain" (= (value Player Mover) -2)) (define "ThrowAgainAndPlay" (and (moveAgain) (set Value Mover -2))) (define "StopTurnIfNoMoveAgain" (if (!= (value Player Mover) -2) (set Value Mover -1))) (define "HasToThrow" (< ("ThrowValue") 0)) (define "CaptureEnemyPiece" (apply if:("IsEnemyAt" (to)) (fromTo (from (to)) (to (handSite Next)) count:(count at:(to))))) (define "RemoveAPiece" (move Remove (from))) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" ("ThrowValue"))) (define "ThrowValue" (value Player Mover)) (game "Len Doat" (players 2) (equipment { (board (merge { (rectangle 3 5) (shift 7.5 0 (rectangle 3 5)) (shift 0 3.5 (rectangle 3 5)) (shift 7.5 3.5 (rectangle 3 5))}) { (track "Track1" "20,E,N,W,14,W,S,E,44,W,S,E,45,E,N,W,15,E,N1,W,End" P1 directed:True) (track "Track2" "39,W,S,E,45,E,N,W,15,E,N,W,14,W,S,E,44,W,S1,E,End" P2 directed:True)}) ("StickDice" 5) (hand Each) (piece "Marker" Each (if ("IsEndTrack" "SiteToMoveOnTrack") "RemoveAPiece" (if ("IsNotOffBoard" "SiteToMoveOnTrack") (if (if (not ("IsEnemyAt" "SiteToMoveOnTrack")) True (not (is In "SiteToMoveOnTrack" (sites "Protect")))) (move (from) (to "SiteToMoveOnTrack" "CaptureEnemyPiece") (then (if (or (= 1 (value Player Mover)) (= 5 (value Player Mover))) ("ThrowAgainAndPlay")))))))) (map "EntrySite" {(pair P1 (coord "F2")) (pair P2 (coord "E5"))}) (regions "Protect" (sites {"A1" "A3" "A4" "A6" "J1" "J3" "J4" "J6"}))}) (rules (start (place "Marker" "Hand" count:3)) (play (if (can Move ("ThrowMove")) ("ThrowMove") (move Pass (then (and (if (or (= 1 (value Player Mover)) (= 5 (value Player Mover))) ("ThrowAgainAndPlay")) ("StopTurnIfNoMoveAgain")))))) (end ("EscapeWin")))) END |
Construct a Ludii game based on the following description
Each player begins at the end of one of the \ Rules from Seleucid.
###
| (define "SiteAfterBridge" 10) (define "MoveOnTrack" (if ("IsEndTrack" ("SiteToMoveOnTrack" #1)) "RemoveAPiece" (if (and ("IsNotOffBoard" ("SiteToMoveOnTrack" #1)) (not ("IsFriendAt" ("SiteToMoveOnTrack" #1)))) (move (from) (to ("SiteToMoveOnTrack" #1) "CaptureEnemyPiece"))))) (define "CaptureEnemyPiece" ("HittingCapture" (handSite Next))) (define "RemoveAPiece" (move Remove (from))) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" ("ThrowValue") #1)) (define "ThrowValue" (if (= 2 (count Pips)) 1 (if (= 1 (count Pips)) 2 3))) (game "Knossos Game" (players 2) (equipment { (board (merge { (rectangle 1 4) (shift 1 1 (rectangle 1 2)) (shift 0 -2 (rectangle 3 1)) (shift 3 -2 (rectangle 3 1)) (shift 1.5 4 (scale 2 (rectangle 2 1))) (shift 0 5 (scale 3 (rectangle 1 2)))}) { (track "TrackBottom1" "14,6,7,0,1,4") (track "TrackBottom2" "15,8,9,3,2,5") (track "TrackOpposite1" "7,0,1,2,5") (track "TrackOpposite2" "9,3,2,1,4") (track "TrackCross1" "0,1,4,10,12,11") (track "TrackCross2" "3,2,5,10,13,11") (track "TrackTop1" "10,12,11,End") (track "TrackTop2" "10,13,11,End")} use:Vertex) ("StickDice" 2) (piece "RoundPawn" Each (or { ("MoveOnTrack" "TrackBottom1") ("MoveOnTrack" "TrackBottom2") ("MoveOnTrack" "TrackOpposite1") ("MoveOnTrack" "TrackOpposite2") (if (is Mover P1) ("MoveOnTrack" "TrackTop1") ("MoveOnTrack" "TrackTop2")) (if (and { (not ("IsFriendAt" ("SiteAfterBridge"))) (= 3 ("ThrowValue")) (not (is In (from) (sites "TopSites")))}) (if (or (can Move ("MoveOnTrack" "TrackCross1")) (can Move ("MoveOnTrack" "TrackCross2"))) (move (from) (to ("SiteAfterBridge") "CaptureEnemyPiece"))))})) (hand Each) (regions "TopSites" (sites {10..13}))}) (rules (start (place "RoundPawn" "Hand" count:2)) (play ("RollMove" (or (forEach Piece) (forEach Piece container:(mover))) (then (if (no Pieces Mover) (and (addScore Mover 1) (if (!= (score Mover) 2) (and { (forEach Site (sites Occupied by:All container:"Board") (remove (site))) (if (!= 0 (who at:(handSite P1))) (remove (handSite P1))) (if (!= 0 (who at:(handSite P2))) (remove (handSite P2))) (add (piece (id "RoundPawn" P1)) (to (handSite P1)) count:2) (add (piece (id "RoundPawn" P2)) (to (handSite P2)) count:2)}))) (if (= 3 ("ThrowValue")) (moveAgain)))))) (end (if (= (score Mover) 3) (result Mover Win))))) END |
Construct a Ludii game based on the following description
Structure of Play:
There is no passing.
Maroon chooses to remove up to two nodes of the board before passing to White.
Then White places an initial stone onto a remaining node on the board.
After this play alternates, two turns per player, until one player cannot complete both turns. That player loses
On each of the turns, the current player must either:
- - place a stone on an empty node that the opponent does not control, or
- - remove an opponent's stone that the current player controls.
A player controls a node and any stone on it when the count of his stones that are adjacent to the node, exceed those of his opponent by the node-control value chosen for the game, or more. (default is 3)
-- For example 4 is 3 greater than 1, so a node surrounded by 4 White and 1 Maroon is controlled by White if 3 was chosen as the game parameter (also if 1 or 2 were chosen).
There are options for the board size and type, and the number of surplus stones needed to control a node. Order 3 board Hex N/N+2 grid w/even nodes, no center Strategic. Control a site with a surplus of 3 on lines of sight.
###
| (define "ColourBackground" (colour 135 170 130)) (define "SquareDiagonal" (board (square 6) use:Vertex)) (define "SquareGrid" (board (square 6) use:Vertex)) (define "Hex2Limp" (board (dual (hex (/ 6 2) (+ 2 (/ 6 2)))) use:Vertex)) (define "BoardUsed" "Hex2Limp") (define "LoSDirection" Orthogonal) (define "MoveTwiceThenScore" (if (is Prev Next) (moveAgain) (and ("ScoreFor" Mover) ("ScoreFor" Next)))) (define "ScoreFor" (set Score #1 (+ (results from:(forEach (difference (difference (sites Board) (sites Occupied by:#1)) (sites Occupied by:Neutral)) if:("IsControlledBy" #1 (site))) to:(from) (if (is Empty (to)) 1 2))))) (define "IsControlledBy" (<= (+ 3 (count Pieces in:(sites Around (#2) "LoSDirection" if:(!= 0 (who at:(to)))))) (* 2 (count Pieces #1 in:(sites Around (#2) "LoSDirection"))))) (game "Dogtown Clans" (players 2) (equipment { "BoardUsed" (piece "Counter" P1) (piece "Counter" P2) (piece "X" Neutral) (piece "Counter" Neutral)}) (rules (meta (passEnd NoEnd)) (play (if (and (= -1 (var "DoubleTurnPhase")) (= 1 (mover))) (or (move Pass) (move Add (piece "X0") (to (sites Empty)) (then (if (> 2 (count Pieces in:(sites Occupied by:Neutral))) (moveAgain))))) (or { (move Add (to (sites Empty) if:(not ("IsControlledBy" Next (to)))) (then (if (= -1 (var "DoubleTurnPhase")) (set Var "DoubleTurnPhase" 1) ("MoveTwiceThenScore")))) (move Remove (forEach (sites Occupied by:Next) if:("IsControlledBy" Mover (site))) (then ("MoveTwiceThenScore")))}) (then (if (no Moves Next) (and ("ScoreFor" Mover) ("ScoreFor" Next)))))) (end (if (no Moves Mover) (result Mover Loss))))) END |
Describe the mechanics of the following Ludii game
(game "Diagonals (2002)" (players 2) (equipment { (board (rectangle 5 10) use:Vertex) (piece "Ball" Each) (piece "Ball" Neutral)}) (rules (start { (place "Ball1" (intersection (expand (sites Bottom)) (sites Right))) (place "Ball2" (intersection (expand (sites Top)) (sites Left)))}) (play (or (move Add (to (intersection (sites Direction from:(sites Occupied by:Mover) Diagonal stop:(is Occupied (to))) (sites Empty)))) (move Select (from (forEach (sites Occupied by:Next) if:(!= 0 (count Sites in:(intersection (sites LineOfSight at:(site) Diagonal) (sites Occupied by:Mover)))))) (then (and (remove (last To)) (add (piece (id "Ball" Neutral)) (to (last To)))))))) (end (if (and (no Moves P1) (no Moves P2)) (byScore { (score P1 (count Pieces P1)) (score P2 (count Pieces P2))})))))
###
| MOVE - On each turn, a player may do one of the following actions:
- Drop a friendly stone at an empty cell, which is in a diagonal line of sight with another friendly stone, i.e., both stones must be separated by a diagonal line of empty cells.
- Transform an enemy stone, at a diagonal line of sight of a friendly stone, into a wall (which is a neutral stone).
GOAL - When there are no valid moves, wins the player with more friendly stones. END |
Construct a Ludii game based on the following description
Play begins with two seeds in each hole. Each player owns the two rows closest to them. Play proceeds by taking the seeds from one hole and sowing them one by one in consecutive holes in an anti-clockwise direction. If the last seed falls in a hole in the inner row, and the opponent's hole opposite it is not empty, then the opponent's seeds in that hole are captured. Players can only play from holes with single counters when there is no other option, and they may not sow into another hole that already contains a counter. Play continues until one player no longer has any seeds.
###
| (define "PiecesOwnedBy" (+ (count Cell at:(handSite #1)) (count in:(sites #1 "Home")))) (define "Sow" (move Select (from (sites Mover "Home") if:#1) (then (sow "Track" owner:(mover) if:(and { (= (count at:(to)) 1) (is In (to) (sites Mover "Inner")) (> (count at:("OppositePit" (to))) 0)}) apply:(fromTo (from ("OppositePit" (to))) (to (handSite Mover)) count:(count at:("OppositePit" (to)))))))) (define "Columns" 7) (game "Hawalis" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "Track1" "0,E,N1,W" loop:True P1) (track "Track2" "14,E,N1,W" loop:True P2)}) (regions "Home" P1 (sites Track "Track1")) (regions "Home" P2 (sites Track "Track2")) (regions "Inner" P1 (difference (sites Track "Track1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "Track2") (sites Top))) (piece "Seed" Shared) (hand Each)}) (rules (start (set Count 2 to:(union (sites P1 "Home") (sites P2 "Home")))) (play (priority ("Sow" (> (count at:(from)) 1)) ("Sow" (= (count at:(from)) 1)))) (end ("MancalaByScoreWhen" (no Moves Mover))))) END |
Describe the mechanics of the following Ludii game
(define "Line3WithSingleOpponent" (if (is Line 2 Orthogonal) (or { ("Line3SingleDirection" N S) ("Line3SingleDirection" S N) ("Line3SingleDirection" E W) ("Line3SingleDirection" W E)}))) (define "Line3SingleDirection" (if (!= (ahead (last To) #1) (last To)) (if (= (mover) (who at:(ahead (last To) #1))) (or (if (!= (ahead (last To) steps:2 #1) (last To)) (if (= (next) (who at:(ahead (last To) steps:2 #1))) (if (!= (ahead (last To) steps:3 #1) (last To)) (if (is Empty (ahead (last To) steps:3 #1)) (remove (ahead (last To) steps:2 #1)))))) (if (!= (ahead (last To) #2) (last To)) (if (= (next) (who at:(ahead (last To) #2))) (if (!= (ahead (last To) steps:2 #2) (last To)) (if (is Empty (ahead (last To) steps:2 #2)) (remove (ahead (last To) #2)))))))))) (game "Six Insect Game" (players 2) (equipment { (board (square 4)) (piece "Marker" Each ("StepToEmpty" Orthogonal (then ("Line3WithSingleOpponent"))))}) (rules (start { (place "Marker1" (union (intersection (union (sites Right) (sites Left)) (sites Row 1)) (sites Bottom))) (place "Marker2" (union (intersection (union (sites Right) (sites Left)) (sites Row 2)) (sites Top)))}) (play (forEach Piece)) (end ("CaptureAll" Next))))
###
| 4x4 board. Six pieces per player, which begin on opposite rows of the board and in the two outer squares in the row in front of it. Players alternate turns moving a piece orthogonally to an adjacent space on the board. When a player moves a piece such that it creates three in a row: two of their own pieces (which must be adjacent to one another) and one of the opponent's pieces (which must have a vacant space on the opposite side of it), the opponent's piece is captured. However, when the opponent's piece moves in line with two of the player's piece on the opponent's turn, the player does not capture the opponent's piece. The player who captures all of the opponent's pieces wins.
END |
Construct a Ludii game based on the following description
4x6-21 board; 8 is most common, 12, 15, and 18 are also popular. Two counters in each hole in the players' outer rows. Sowing occurs in an anti-clockwise direction, only in the two rows belonging to the player. When the final counter lands in an occupied hole, these are picked up and sowing continues. When the final counter lands in an empty hole in the inner row, any counters in the opposite hole in the opponent's inner row are captured. If there also are counters in the opposite hole in the opponent's outer row, these are also captured, but only if there was first a capture from the inner row hole. Captured counters are then sown on the player's own side of the board, starting with the hole following the one from which the capture was triggered. Players cannot sow from a hole with a single counter unless there are no holes with multiple counters. Single counters can only be sown into an empty hole. Play continues until one player has captured all of the opponent's counters, thus winning the game.
8 Holes per row.
###
| (define "NextHoleFrom" ("NextSiteOnTrack" 1 from:#1 #2)) (define "AHoleHasMoreThanOneCounter" (not (all Sites (forEach (sites Mover) if:(< 1 (count at:(site)))) if:(= 0 (count at:(site)))))) (define "NoPiece" (all Sites (sites Player "Home") if:(= 0 (count at:(site))))) (define "Columns" 8) (game "Tsoro (Reentered Captures)" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "Track1" "0,E,N1,W" loop:True P1) (track "Track2" "16,E,N1,W" loop:True P2)}) (regions "Home" P1 (sites Track "Track1")) (regions "Home" P2 (sites Track "Track2")) (regions "Inner" P1 (difference (sites Track "Track1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "Track2") (sites Top))) (piece "Seed" Shared)}) (rules (start (set Count 2 to:(union (sites Top) (sites Bottom)))) (play (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover "Home")) if:(if "AHoleHasMoreThanOneCounter" (> (count at:(from)) 1) (and (= (count at:(from)) 1) (= 0 (count at:("NextHoleFrom" (from) Mover)))))) (then (sow "Track" owner:(mover) apply:(if (= (count at:(to)) 1) (if (is In (to) (sites Mover "Inner")) (if (> (count at:("OppositePit" (to))) 0) (and { (fromTo (from ("OppositePit" (to))) (to (to)) count:(count at:("OppositePit" (to)))) (if (> (count at:("OppositeOuterPit" (to))) 0) (fromTo (from ("OppositeOuterPit" (to))) (to (to)) count:(count at:("OppositeOuterPit" (to))))) (sow (to) count:(+ (count at:("OppositeOuterPit" (to))) (count at:("OppositePit" (to)))) "Track" owner:(mover))}))) (moveAgain)))))) (end (forEach NonMover if:("NoPiece") (result Player Loss))))) END |
Construct a Ludii game based on the following description
5x5 intersecting lines, with diagonals in each quadrant. Two triangles, the apexes of which intersect with the square at the midpoint of opposite sides. One line bisecting the base of the triangle, and another bisecting this line. One player plays as two tigers, the other as 23 people. One of the tigers begins on any spot on the board. Eight of the people begin on the spots surrounding the central point of the board. The tiger player, on their first turn, removes one of the people and then places the second tiger anywhere on the board. The people then play, placing one of the remaining people on an empty spot on the board. On the tiger's turn, the player may move one of the tigers to an empty adjacent spot along the lines of the board. The tiger may also capture a person by hopping over it to an empty adjacent spot immediately on the opposite side of it along the lines of the board. When all of the people are placed, they move to an empty adjacent spot along the lines of the board on their turn. The tigers win by capturing all the people; the people win by blocking both tigers from being able to move. The two tigers start in the hand.
###
| (game "Rimau-Rimau (Two Tigers)" (players 2) (equipment { ("AlquerqueBoardWithBottomAndTopTriangles") (hand Each) (piece "Tiger" P1 (or { ("StepToEmpty") ("HopCapture")})) (piece "human" P2 "StepToEmpty")}) (rules (start { (place "human2" (difference (expand (sites Centre)) (centrePoint))) (place "human2" (handSite P2) count:16) (place "Tiger1" (handSite P1) count:2)}) phases:{ (phase "PlacementFirstTiger" P1 (play (move (from (handSite P1)) (to (sites Empty)) (then (moveAgain)))) (nextPhase Mover "RemoveHuman")) (phase "RemoveHuman" P1 (play (move Remove (intersection (sites Board) (sites Occupied by:Next)) (then (moveAgain)))) (nextPhase Mover "PlacementSecondTiger")) (phase "PlacementSecondTiger" P1 (play (move (from (handSite P1)) (to (sites Empty)))) (nextPhase Mover "Movement")) (phase "PlacementHuman" P2 (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase ("HandEmpty" P2) "Movement")) ("PhaseMovePiece" "Movement" (end { (if (no Moves P1) (result P2 Win)) (if (no Pieces P2) (result P1 Win))}))})) END |
Subsets and Splits