prompt
stringlengths 71
4.65k
| completion
stringlengths 34
5.1k
|
---|---|
Describe the mechanics of the following Ludii game
(game "Kharebga (7x7)" (players 2) (equipment { (board (square 7)) (piece "Marker" Each (move Slide Orthogonal (then ("CustodialCapture" Orthogonal (max 1))))) (hand Each)}) (rules (start (place "Marker" "Hand" count:24)) phases:{ (phase "Placement" (play (move (from (handSite Mover)) (to (difference (sites Board) (centrePoint)) if:(is Empty (to))) (then (if ("NewTurn") (moveAgain))))) (nextPhase Mover (is Empty (handSite Mover)) "Capture")) ("PhaseMovePiece" "Capture")} (end ("CaptureAll" Next))))
###
| 7x7 board. 24 pieces per player. Players alternate turns placing two pieces on an empty space on the board, except in the central space. Captures cannot be made during the placement phase. When all of the pieces have been placed, players alternate turns moving a piece orthogonally any distance. When an opponent's piece is between two of a player's pieces, it is captured. If a player is unable to make a move, they pass their turn and the opponent plays again. The player who captures all of the opponent's pieces wins.
END |
Construct a Ludii game based on the following description
2x12 board, divided in half. Spaces on each side take the form of semi-circular sockets, into which the pieces fit. Fifteen pieces per player. Two or three six-sided dice. Players move according to the number on each die by moving one piece the value on one die then another piece the value on the other die, or by moving one piece the value of one die and then the value of the other. One player begins with all of their pieces on the space furthest to the left on their side, the other with their pieces on the point directly opposite it. Pieces move in opposite directions around the board, only on the half of the board where the pieces begin, toward the point where the opponent's pieces begin, and bearing off the board from there. When a piece lands on the same space as an opponent's piece, the opponent's piece is sent back to where it began. The first person to bear off all their pieces wins. If players move their pieces such that they fill up all the points in a quadrant, and the other fills up all of the points in an adjacent quadrant such that neither player can move, the game is a draw.
The game involves 2 dice
###
| (define "RemoveAPiece" (move Remove (from))) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" (pips))) (game "Medio Emperador" (players 2) (equipment { ("TableBoard" "TableTracksOppositeWithHands") (dice d:6 num:2) (hand Each) (piece "Disc" Each (forEach Die if:("DieNotUsed") (if ("IsOffBoard" "SiteToMoveOnTrack") "RemoveAPiece" (if ("NoEnemyOrOnlyOne" "SiteToMoveOnTrack") (move (from) (to "SiteToMoveOnTrack" ("HittingCapture" (handSite Next))))))))}) (rules (start { (place Stack "Disc1" 0 count:15) (place Stack "Disc2" 12 count:15)}) (play ("RollEachNewTurnMove" (or (forEach Piece top:True) (forEach Piece container:(mover) top:True) (then ("ReplayNotAllDiceUsed"))))) (end { ("EscapeWin") (if (and (no Moves P1) (no Moves P2)) (result Mover Draw))}))) END |
Modify the Ludii game according to the following option changes:
The game is played according to the rules described in Wikipedia in stepping to any sites. -> The game is played according to the rules described in Wikipedia in stepping to any sites except the middle.
(game "Achi" (players 2) (equipment { ("AlquerqueBoard" 3 3) (hand Each) (piece "Marker" Each "StepToEmpty")}) (rules (start (place "Marker" "Hand" count:3)) phases:{ (phase "Placement" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase (>= (count Moves) 6) "Movement")) ("PhaseMovePiece" "Movement")} (end ("Line3Win"))))
###
| (game "Achi" (players 2) (equipment { ("AlquerqueBoard" 3 3) (hand Each) (piece "Marker" Each (move Step (to if:(is In (to) (difference (sites Empty) (sites Centre))))))}) (rules (start (place "Marker" "Hand" count:3)) phases:{ (phase "Placement" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase (>= (count Moves) 6) "Movement")) ("PhaseMovePiece" "Movement")} (end ("Line3Win")))) END |
Construct a Ludii game based on the following description
2x6 board. Four counters in each hole. Sowing occurs in an anti-clockwise direction. The hole from which sowing begins must remain empty throughout the player's turn. Captures are made when the last counter of a sowing fall into the opponent's row in a hole containing one or two counters (thus making two or three), capturing all of the counters in that hole. A continuous series of holes holding two or three counters behind it are also captured, provided the player's sowing caused them to contain this number. If a player has no counters in their holes, the opponent must play to place seeds in their row, if possible. The game ends when players have holes with only empty and single counters. The player who captured the most counters wins.
###
| (define "PiecesOwnedBy" (count Cell at:(handSite #1))) (game "Awari" (players 2) (equipment { (mancalaBoard 2 6 store:None (track "Track" "0,E,N,W" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece "Seed" Shared) (hand Each)}) (rules (start (set Count 4 to:(sites Track))) (play (do (move Select (from (sites Mover) if:(< 0 (count at:(from)))) (then (sow if:(and (is In (to) (sites Next)) (or (= (count at:(to)) 2) (= (count at:(to)) 3))) apply:(fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))) includeSelf:False backtracking:True))) ifAfterwards:(< 0 (count in:(sites Next))))) (end ("MancalaByScoreWhen" (all Sites (sites Track) if:(<= (count at:(site)) 1)))))) END |
Construct a Ludii game based on the following description
5x5 intersecting lines, with diagonals drawn in the four quadrants of the board. Two triangles, their apices intersecting the main board at opposite midpoints. The bast of the triangle is bisected by a line drawn from the apex, and this line is bisected and intersects with the other two sides of the triangle. One player plays as two tigers, which can be placed anywhere on the board, and the other player plays as 32 goats, which begin on the four central points of the quadrants of the square board, eight per stack. Players alternate turns moving a piece to an empty adjacent spot along the lines. The goats move one at a time from their stacks, and cannot be restacked once they have been moved. The tiger may capture a goat by hopping over it to an empty spot immediately on the opposite side of an adjacent goat. Multiple captures in one turn are allowed, but a tiger cannot hop over a stack of goats and hop over it again in the opposite direction. When tigers hop over a stack of goats, only one goat is captured. The goats win by blocking the tigers from being able to move; the tigers win by capturing all the goats.
###
| (define "CaptureAgain" (then (if (can Move ("HopCapture" (from (last To)) (difference Orthogonal OppositeDirection))) (moveAgain)))) (game "Bagh Bandi" (players 2) (equipment { ("AlquerqueBoardWithBottomAndTopTriangles") (piece "Goat" P2 "StepToEmpty") (piece "Tiger" P1 (or ("StepToEmpty") ("HopCapture" ~ ~ ("CaptureAgain")))) (regions "CentralSites" (sites {6 8 16 18})) (hand P1)}) (rules (start { (place Stack "Tiger1" (handSite P1) count:2) (place Stack "Goat2" 6 count:8) (place Stack "Goat2" 8 count:8) (place Stack "Goat2" 16 count:8) (place Stack "Goat2" 18 count:8)}) phases:{ (phase "Placement" P1 (play (move (from (handSite P1)) (to (sites Empty)) (then (if ("HandOccupied" Mover) (moveAgain))))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) (phase "Movement" (play (if ("SameTurn") (or ("HopCapture" (from (last To)) (difference Orthogonal OppositeDirection) ("CaptureAgain")) (move Pass)) (forEach Piece top:True))))} (end ("NoMovesP1NoPiecesP2")))) END |
Construct a Ludii game based on the following description
Place a piece of your colour each turn. Win with 4 in a row of your colour.
###
| (game "Score Four" (players 2) (equipment { (board (skew .5 (scale 1 .5 (square 4)))) (piece "discFlat" Each)}) (rules (play (move Add (to (forEach (sites Board) if:(< (size Stack at:(site)) 4))) stack:True)) (end (if (is Line 4 byLevel:True) (result Mover Win))))) END |
Construct a Ludii game based on the following description
Three-row board, outer rows with sixteen holes and the central with seventeen. Sixteen pieces per player, which start the board in each of the holes in the outer row belonging to a player. Two four-sided dice. Players move their pieces according to the throws of the dice, moving one piece the value of one of the dice and another the value of the other die, or one piece the value of both dice. Players move from their row into the central row, and when reaching the end of the central row, proceed into the opponent's row. Opponent's pieces are taken when a player's piece lands in the same spot as the opponent's piece. Players may not move one of their pieces past one of their other pieces.
###
| (define "MoveAPiece" (if (or (= (state at:(from)) 1) (and (= (state at:(from)) 0) (= 1 (pips)))) (move Slide #1 (between (exact (pips)) if:(is Empty (between))) (to if:("IsEnemyAt" (to)) (apply if:(not ("IsFriendAt" (to))) (remove (to)))) (then (if (= (state at:(last To)) 0) (set State at:(last To) 1)))))) (game "Daldos" (players 2) (equipment { (board (merge { (rectangle 1 16) (shift -1 1 (rectangle 1 17)) (shift 0 2 (rectangle 1 16))}) { (track "Track1" {0..15 32..16 33..48 32..16} loop:True P1) (track "Track2" {33..48 32..16 0..15 32..16} loop:True P2)} use:Vertex) (regions "AllSites" (sites Board)) (dice d:4 num:2) (piece "Minus" P1 ("MoveAPiece" "Track1")) (piece "Minus" P2 ("MoveAPiece" "Track2"))}) (rules (start { (place "Minus1" (sites Bottom)) (place "Minus2" (sites Top))}) (play ("RollEachNewTurnMove" (forEach Die replayDouble:(and (= (face 36) 1) (= (face 37) 1)) (forEach Piece (then (if (not (all DiceUsed)) ("ReplayIfCanMove" (forEach Die (forEach Piece))))))))) (end ("CaptureAll" Next)))) END |
Construct a Ludii game based on the following description
5x5 board. Twelve pieces per player. Players alternate turns placing two pieces on an empty space on the board, except in the central space. Captures cannot be made during the placement phase. When all of the pieces have been placed, players alternate turns moving a piece orthogonally any distance. When an opponent's piece is between two of a player's pieces, it is captured. If a player is unable to make a move, they pass their turn and the opponent plays again. The player who captures all of the opponent's pieces wins.
###
| (game "Kharebga (5x5)" (players 2) (equipment { (board (square 5)) (piece "Marker" Each (move Slide Orthogonal (then ("CustodialCapture" Orthogonal (max 1))))) (hand Each)}) (rules (start (place "Marker" "Hand" count:12)) phases:{ (phase "Placement" (play (move (from (handSite Mover)) (to (difference (sites Board) (centrePoint)) if:(is Empty (to))) (then (if ("NewTurn") (moveAgain))))) (nextPhase Mover (is Empty (handSite Mover)) "Capture")) ("PhaseMovePiece" "Capture")} (end ("CaptureAll" Next)))) END |
Describe the mechanics of the following Ludii game
(game "Cross" (players 2) (equipment { (board (hex 5)) (piece "Marker" Each)}) (rules (play (move Add (to (sites Empty)))) (end { (if (is Connected {(sites Side S) (sites Side NW) (sites Side NE)}) (result Mover Win)) (if (is Connected {(sites Side N) (sites Side SW) (sites Side SE)}) (result Mover Win)) (if (is Connected {(sites Side N) (sites Side S)}) (result Mover Loss)) (if (is Connected {(sites Side NW) (sites Side SE)}) (result Mover Loss)) (if (is Connected {(sites Side NE) (sites Side SW)}) (result Mover Loss))})))
###
| A player wins by connecting three non-adjacent board sides with a chain of their pieces. A player loses by connecting two opposite board sides with a chain of their pieces (without also connecting three non-adjacent sides). The game is played on a 5x5 board END |
Modify the Ludii game according to the following option changes:
Each player has 3 holes. -> Each player has 4 holes.
(define "NoPieceOnBoard" (all Sites (union (sites Top) (sites Bottom)) if:(= 0 (count at:(site))))) (define "PlayableSites" (sites (values Remembered "Playable"))) (game "Khrour" (players 2) (equipment { (mancalaBoard 2 3 store:None (track "Track" "0,E,N,W" loop:True)) (piece "Seed" Shared) (hand Each) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start { (set Count 6 to:(sites Track)) (set RememberValue "Playable" (union (sites Top) (sites Bottom)))}) phases:{ (phase "Sowing" (play (or { (move Select (from (sites Mover) if:(and (is Occupied (from)) (is In (from) ("PlayableSites")))) (then (sow apply:(if (and (or { (= 2 (count at:(to))) (= 4 (count at:(to))) (= 6 (count at:(to))) (= 8 (count at:(to)))}) (is In (to) ("PlayableSites"))) (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to)))))))} (then (if ("NoPieceOnBoard") (forget Value "Playable" All) (forEach Site (difference (sites Board) ("PlayableSites")) (if (<= 6 (count at:(site))) (remember Value "Playable" (site)))))))) (end (if ("NoPieceOnBoard") { (if (= 0 (count Cell at:(handSite P1))) (result P2 Win)) (if (= 0 (count Cell at:(handSite P2))) (result P1 Win))})) (nextPhase ("NoPieceOnBoard") "BetweenRounds")) (phase "BetweenRounds" (play (if (not (all Sites (sites Mover) if:(is Occupied (site)))) (if (<= 6 (count Cell at:(handSite Mover))) (move (from (handSite Mover)) (to (sites Mover) if:(is Empty (to))) count:6 (then (remember Value "Playable" (last To)))) (move (from (handSite Mover)) (to (sites Mover) if:(is Empty (to))) count:(count Cell at:(handSite Mover)))))) (nextPhase (all Passed) "Sowing"))}))
###
| (define "NoPieceOnBoard" (all Sites (union (sites Top) (sites Bottom)) if:(= 0 (count at:(site))))) (define "PlayableSites" (sites (values Remembered "Playable"))) (game "Khrour" (players 2) (equipment { (mancalaBoard 2 4 store:None (track "Track" "0,E,N,W" loop:True)) (piece "Seed" Shared) (hand Each) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start { (set Count 8 to:(sites Track)) (set RememberValue "Playable" (union (sites Top) (sites Bottom)))}) phases:{ (phase "Sowing" (play (or { (move Select (from (sites Mover) if:(and (is Occupied (from)) (is In (from) ("PlayableSites")))) (then (sow apply:(if (and (or { (= 2 (count at:(to))) (= 4 (count at:(to))) (= 6 (count at:(to))) (= 8 (count at:(to)))}) (is In (to) ("PlayableSites"))) (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to)))))))} (then (if ("NoPieceOnBoard") (forget Value "Playable" All) (forEach Site (difference (sites Board) ("PlayableSites")) (if (<= 8 (count at:(site))) (remember Value "Playable" (site)))))))) (end (if ("NoPieceOnBoard") { (if (= 0 (count Cell at:(handSite P1))) (result P2 Win)) (if (= 0 (count Cell at:(handSite P2))) (result P1 Win))})) (nextPhase ("NoPieceOnBoard") "BetweenRounds")) (phase "BetweenRounds" (play (if (not (all Sites (sites Mover) if:(is Occupied (site)))) (if (<= 8 (count Cell at:(handSite Mover))) (move (from (handSite Mover)) (to (sites Mover) if:(is Empty (to))) count:8 (then (remember Value "Playable" (last To)))) (move (from (handSite Mover)) (to (sites Mover) if:(is Empty (to))) count:(count Cell at:(handSite Mover)))))) (nextPhase (all Passed) "Sowing"))})) END |
Construct a Ludii game based on the following description
Play starts with two counters in each hole. The game starts with 3 counters.
###
| (define "KalahCount" (count at:(mapEntry #1))) (define "PiecesOwnedByP2" (+ {(count at:(mapEntry P2)) (count in:(sites P2)) (count in:(sites P1))})) (define "PiecesOwnedByP1" (+ {(count at:(mapEntry P1)) (count in:(sites P1)) (count in:(sites P2))})) (game "Aw-li On-nam Ot-tjin" (players 2) (equipment { (mancalaBoard 2 9 (track "Track" "1,E,N,W" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 FirstSite) (pair P2 LastSite)}) (piece "Seed" Shared)}) (rules (start (set Count 3 to:(sites Track))) (play (move Select (from (sites Mover) if:(> (count at:(from)) 1)) (then (sow if:(= (count at:(to)) 3) apply:(fromTo (from (to)) (to (mapEntry (mover))) count:(count at:(to))))))) (end (if (no Moves Mover) { ("DrawIfNoMoves" Next) (if (is Mover P1) (byScore { (score P1 ("KalahCount" P1)) (score P2 "PiecesOwnedByP1")})) (if (is Mover P2) (byScore { (score P1 "PiecesOwnedByP2") (score P2 ("KalahCount" P2))}))})))) END |
Construct a Ludii game based on the following description
Players decide which colors to play, and who starts first. The board is filled in the beginning with all the players pieces. The only point vacant on the board is the middle point. Each player's pieces are placed on their half of the board, and lined up on the right-hand side of the fifth rank (the middle horizontal line of the grid board). Players alternate turns. Pieces move forward only (straight forward or diagonally forward) one space per turn following the pattern on the board until they are crowned Mullah by reaching the last rank. A non-Mullah piece may capture an enemy piece by hopping over it. The capture can be in any direction. When a piece reaches the other player's rank, it is promoted to Mullah. The Mullah can move and capture in any direction. It can also move any number of spaces. The Mullah can also capture an enemy piece from any distance, and land anywhere behind the captured piece provided there are no other pieces (friendly or not) within the spaces of the leap. If a piece piece reaches the other player's rank as an intermediate step of a capturing sequence, the piece does not get promoted to Mullah. The player to capture all of the opponent's pieces wins.
###
| (game "Kharbaga" (players {(player S) (player N)}) (equipment { (board (square 5 diagonals:Solid) use:Vertex) (piece "Counter" Each (or ("StepForwardsToEmpty") ("HopCapture") (then ("PromoteIfReach" (sites Next) "DoubleCounter")))) (piece "DoubleCounter" Each (or ("HopCaptureDistance") (move Slide))) (regions P1 (sites Top)) (regions P2 (sites Bottom))}) (rules ("BeforeAfterCentreSetup" "Counter2" "Counter1") (play (forEach Piece)) (end (if (no Moves Mover) (result Next Win))))) END |
Construct a Ludii game based on the following description
2x12 board, divided in half. Spaces on each side take the form of semi-circular sockets, into which the pieces fit. Fifteen pieces per player. Pieces begin on one half of a player's side of the board (the half to the left of one player, and to the right of the other player), two per space, then two on the next space and one on the space following that one. Three six-sided dice. Players move according to the number on each die by moving one piece the value on one die then another piece the value on the other die, or by moving one piece the value of one die and then the value of the other. Pieces move in a track the long way around the board toward the portion where the opponent begins. No more than two pieces can occupy a space at a time. When a piece lands on a space occupied by a single piece of the opponent, the opponent's piece is removed from the board. The opponent must then reenter this piece on the board onto an open point according to the throw of the dice, from the original starting quadrant on the board. Players attempt to bear off their pieces by rolling the exact number of spaces left on the board, plus one. The first player to bear off all their pieces wins.
###
| (define "MoveAPieceIf" (forEach Die replayDouble:True if:#1 ("MoveAPiece" #2))) (define "MoveAPiece" (move (from #1) (to ("NextSiteFrom" #1) if:("NoEnemyOrOnlyOne" (to)) ("HittingCapture" (handSite Next))))) (define "NextSiteFrom" ("NextSiteOnTrack" (pips) from:#1)) (define "BarEmpty" (is Empty "Bar")) (define "Bar" (handSite Mover)) (define "RemoveAPiece" (move Remove (from))) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" (pips))) (game "Quinze Tablas" (players 2) (equipment { ("TableBoard" ("TableTracksOppositeWithHands" End)) (dice d:6 num:3) (hand Each) (piece "Disc" Each (forEach Die if:("DieNotUsed") (if ("IsEndTrack" "SiteToMoveOnTrack") "RemoveAPiece" (if ("IsNotOffBoard" "SiteToMoveOnTrack") (if ("IsEmptyOrSingletonStack" ("SiteToMoveOnTrack")) (move (from) (to "SiteToMoveOnTrack" ("HittingCapture" (handSite Next)))))))))}) (rules (start { (place Stack "Disc1" (sites {0..6}) count:2) (place Stack "Disc1" 7 count:1) (place Stack "Disc2" (sites {12..18}) count:2) (place Stack "Disc2" 19 count:1)}) (play ("RollEachNewTurnMove" (if ("BarEmpty") (forEach Piece top:True) ("MoveAPieceIf" ("DieNotUsed") ("Bar")) (then ("ReplayNotAllDiceUsed"))))) (end { (if (no Pieces P1) (result P1 Win)) (if (no Pieces P2) (result P2 Win))}))) END |
Construct a Ludii game based on the following description
2x6 board. Play begins with four counters in each hole. A player picks up the contents of any of their holes and sowing them in an anti-clockwise direction, picking up the contents of the last hole in which his counters fall, and continuing sowing. This continues until the last counter falls in an empty hole. Then it is the other player's turn. A hole is captured when the last ball is dropped into an opponent's hole containing three counters, making it four. A player cannot then take from one of these holes that they have captured. Therefore, the player cannot begin a turn from their own captured hole nor can they continue sowing from it if their last counter falls into it. If the last counter of a sowing falls into an opponent's captured hole, one of those counters are removed from the board and placed in the store, and the sowing continues with the contents of any of the player's holes. Ownership of a hole continues even if it becomes empty. When a player cannot move (i.e., there are no counters in their holes except any that are in captured holes), the opponent continues to move until the player is able to move. Play continues until all counters are either placed in the store or in captured holes and thus cannot be moved. Players then count their pieces by placing four in each hole, and the player who has more than their original number takes ownership of one of the opponent's holes for every four counters more than the original number that have been taken. If no player took four more than the original, the player with three extra gets the hole, if each player has two extra they draw lots to see who gets an extra hole. Play then begins again as before. The game ends when one player owns all of the counters, and thus all of the holes.
###
| (define "SitesMarkedBy" (forEach (sites Board) if:(= #1 (state at:(site))))) (define "RememberOwnedHolesRandom" (if (< 50 (value Random (range 1 100))) (remember Value "OwnedP1" #1) (remember Value "OwnedP2" #1))) (define "RightMostEmpty" (trackSite FirstSite "TrackCW" from:(mapEntry "RightMost" 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")))) (game "Qelat" (players 2) (equipment { (mancalaBoard 2 6 store:None { (track "TrackCCW" "0,E,N,W" loop:True) (track "TrackCW" "5,W,N,E" loop:True)}) (piece "Seed" Shared) (hand Each) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map "RightMost" {(pair P1 5) (pair P2 6)})}) (rules (start { (set RememberValue "OwnedP1" (sites Bottom)) (set RememberValue "OwnedP2" (sites Top)) (set Count 4 to:(sites Track))}) phases:{ (phase "Sowing" (play (or { (move Select (from (if (and ("SameTurn") (= 1 (var "ContinueSowing"))) (sites {(var "Replay")}) ("OwnedHoles")) if:(and (< 0 (count at:(from))) (= 0 (state at:(from))))) (then (sow "TrackCCW" 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)) (set Var "ContinueSowing" 1)}) (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))) (moveAgain) (set Var "ContinueSowing" 0)}))))))))} (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 (= 0 (count Cell at:(handSite P1))) (result P2 Win)) (if (= 0 (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 ("RightMostEmpty")) count:4 (then (and { ("RemmemberOwnedHoles" (last To)) (if (<= 4 (count Cell at:(handSite Mover))) (moveAgain) (if (= 3 (count Cell at:(handSite Mover))) (and { (fromTo (from (handSite Mover)) (to ("RightMostEmpty")) count:3) (fromTo (from (handSite Next)) (to ("RightMostEmpty")) count:1) ("RemmemberOwnedHoles" ("RightMostEmpty"))}) (if (= 2 (count Cell at:(handSite Mover))) (and { (fromTo (from (handSite Mover)) (to ("RightMostEmpty")) count:2) (fromTo (from (handSite Next)) (to ("RightMostEmpty")) count:2) ("RememberOwnedHolesRandom" ("RightMostEmpty"))}))))}))))) (nextPhase (and (is Empty (handSite P1)) (is Empty (handSite P2))) "Sowing"))})) END |
Construct a Ludii game based on the following description
9x9 intersecting lines, pieces are played on the intersections. 16 pieces per player, one player is black, the other white. Pieces begin placed on the edge of the board: Black on the top and right, white on the bottom and left. Sixteen others are held in reserve for each player. Pieces move any distance orthogonally along the lines. Opponent's pieces are captured when they are surrounded by two of a player's pieces. When this is done, the surrounded player's pieces are removed and replaced with the pieces of the player that surrounded them. If multiple opponent's pieces are in a line and the other player places their pieces at either end of the line, all the pieces in between are captured. When a player is reduced to one piece, it gains the ability to capture by jumping. The player that removes all of their opponent's pieces wins.
###
| (game "Gundru" (players 2) (equipment { (board (square 9) use:Vertex) (piece "Marker" Each (or (if (= 1 (+ (count Cell at:(handSite Mover)) (count Pieces Mover))) ("HopCapture")) (move Slide (then (custodial (from (last To)) (between (range 1 (count Rows)) if:("IsEnemyAt" (between)) (apply (and (remove (between)) (fromTo (from (handSite Mover)) (to (between)))))) (to if:("IsFriendAt" (to)))))))) (hand Each)}) (rules (start { (place "Marker" "Hand" count:16) (place "Marker1" (union (sites Top) (difference (sites Right) (sites Bottom)))) (place "Marker2" (union (sites Bottom) (difference (sites Left) (sites Top))))}) (play (forEach Piece)) (end ("BlockWin")))) END |
Construct a Ludii game based on the following description
Each small 3x3 Tic-Tac-Toe board is referred to as a local board, and the larger 3x3 board is referred to as the global board. The game starts with X playing wherever they want in any of the 81 empty spots. This move 'sends' their opponent to its relative location. For example, if X played in the top right square of their local board, then O needs to play next in the local board at the top right of the global board. O can then play in any one of the nine available spots in that local board, each move sending X to a different local board. If a move is played so that it is to win a local board by the rules of normal Tic-Tac-Toe, then the entire local board is marked as a victory for the player in the global board. Once a local board is won by a player or it is filled completely, no more moves may be played in that board. If a player is sent to such a board, then that player may play in any other board. Game play ends when either a player wins the global board or there are no legal moves remaining, in which case the game is a draw.
###
| (define "CheckLineRightSubGame" (if (is In (last To) (sites "SubGame0")) (is In (to) (sites "SubGame0")) (if (is In (last To) (sites "SubGame1")) (is In (to) (sites "SubGame1")) (if (is In (last To) (sites "SubGame2")) (is In (to) (sites "SubGame2")) (if (is In (last To) (sites "SubGame3")) (is In (to) (sites "SubGame3")) (if (is In (last To) (sites "SubGame4")) (is In (to) (sites "SubGame4")) (if (is In (last To) (sites "SubGame5")) (is In (to) (sites "SubGame5")) (if (is In (last To) (sites "SubGame6")) (is In (to) (sites "SubGame6")) (if (is In (last To) (sites "SubGame7")) (is In (to) (sites "SubGame7")) (is In (to) (sites "SubGame8"))))))))))) (game "Ultimate Tic-Tac-Toe" (players 2) (equipment { (board (union (square 9) (scale 3 (square 3))) use:Cell) (piece "Disc" P1) (piece "DiscLarge" P1) (piece "Cross" P2) (piece "CrossLarge" P2) (regions "SubGames" (sites { 0..80})) (regions "SubGame0" (sites { 0..2 9..11 18..20})) (regions "SubGame1" (sites { 3..5 12..14 21..23})) (regions "SubGame2" (sites { 6..8 15..17 24..26})) (regions "SubGame3" (sites {27..29 36..38 45..47})) (regions "SubGame4" (sites {30..32 39..41 48..50})) (regions "SubGame5" (sites {33..35 42..44 51..53})) (regions "SubGame6" (sites {54..56 63..65 72..74})) (regions "SubGame7" (sites {57..59 66..68 75..77})) (regions "SubGame8" (sites {60..62 69..71 78..80})) (regions "SuperGame" (sites {81..89})) (map "SubToSuper" {0..80} { 81 81 81 82 82 82 83 83 83 81 81 81 82 82 82 83 83 83 81 81 81 82 82 82 83 83 83 84 84 84 85 85 85 86 86 86 84 84 84 85 85 85 86 86 86 84 84 84 85 85 85 86 86 86 87 87 87 88 88 88 89 89 89 87 87 87 88 88 88 89 89 89 87 87 87 88 88 88 89 89 89}) (map "SubToSub" {0..80} { 0 1 2 0 1 2 0 1 2 3 4 5 3 4 5 3 4 5 6 7 8 6 7 8 6 7 8 0 1 2 0 1 2 0 1 2 3 4 5 3 4 5 3 4 5 6 7 8 6 7 8 6 7 8 0 1 2 0 1 2 0 1 2 3 4 5 3 4 5 3 4 5 6 7 8 6 7 8 6 7 8})}) (rules (play (priority { (move Add (piece (if (= (mover) P1) (id "Disc" P1) (id "Cross" P2))) (to (if (= 0 (mapEntry "SubToSub" (last To))) (sites "SubGame0") (if (= 1 (mapEntry "SubToSub" (last To))) (sites "SubGame1") (if (= 2 (mapEntry "SubToSub" (last To))) (sites "SubGame2") (if (= 3 (mapEntry "SubToSub" (last To))) (sites "SubGame3") (if (= 4 (mapEntry "SubToSub" (last To))) (sites "SubGame4") (if (= 5 (mapEntry "SubToSub" (last To))) (sites "SubGame5") (if (= 6 (mapEntry "SubToSub" (last To))) (sites "SubGame6") (if (= 7 (mapEntry "SubToSub" (last To))) (sites "SubGame7") (if (= 8 (mapEntry "SubToSub" (last To))) (sites "SubGame8")))))))))) if:(and (is Empty (to)) (is Empty (mapEntry "SubToSuper" (to)))))) (move Add (piece (if (= (mover) P1) (id "Disc1") (id "Cross2"))) (to (intersection (sites "SubGames") (sites Empty)) if:(and (is Empty (to)) (is Empty (mapEntry "SubToSuper" (to))))))} (then (if (is Line 3 if:("CheckLineRightSubGame")) (add (piece (if (= (mover) P1) (id "DiscLarge1") (id "CrossLarge2"))) (to (mapEntry "SubToSuper" (last To)))))))) (end (if (is Line 3 throughAny:(sites "SuperGame") Mover) (result Mover Win))))) END |
Construct a global Ludii definition which fulfills the following requirements.
If the mover has 3 pieces aligned, the mover is winning. This ludemeplex can be used only in an ending condition.
###
| (define "Line3Win" (if (is Line 3 #1) (result Mover Win))) END |
Describe the mechanics of the following Ludii game
(define "NotAllPieceInHome" (not (all Sites (sites Occupied by:Mover) if:(is In (site) (sites Mover))))) (game "Epelle" (players 2) (equipment { ("AlquerqueBoard" 3) (piece "Marker" Each "StepToEmpty") (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start { (place "Marker1" (sites P1)) (place "Marker2" (sites P2))}) (play (forEach Piece)) (end (if (and "NotAllPieceInHome" (is Line 3)) (result Mover Win)))))
###
| 3x3 intersecting lines with diagonals. Play occurs on the intersections of the lines. Players each have three pieces, initially placed on the sides closest to the player. Players move the pieces to an adjacent unoccupied intersection along the lines. The goal is to make three in a row which cannot be in the starting position. END |
Construct a Ludii game based on the following description
The black player has a normal set of chess pieces. The white player has a single piece which can move either as a queen or as a knight. Black's goal is to checkmate the white piece, White's goal is to checkmate the black king. There is no pawn promotion.
###
| (define "InLocationEnPassant" (and (is Pending) (= (to) (value Pending)))) (define "SetEnPassantLocation" (then (set Pending (ahead (last To) Backward)))) (define "BigCastling" ("DoCastle" "King" W 2 "KingNotCheckedAndToEmpty" (then (and ("PieceHasMoved") ("DoCastle" "RookLeft" E 3 True))))) (define "SmallCastling" ("DoCastle" "King" E 2 "KingNotCheckedAndToEmpty" (then (and ("PieceHasMoved") ("DoCastle" "RookRight" W 2 True))))) (define "DoCastle" (move Slide (from (mapEntry #1 (mover))) #2 (between (exact #3) if:#4) #5)) (define "KingNotCheckedAndToEmpty" (and (is Empty (to)) (not ("IsInCheck" "King" Mover at:(to))))) (define "CaptureToPieceAndResetCounter" (apply (if ("IsEnemyAt" (to)) (remove (to) (then (set Counter)))))) (define "RememberPieceHasMoved" (then (if (= (state at:(last To)) 1) "PieceHasMoved"))) (define "PieceHasMoved" (set State at:(last To) 0)) (define "HasNeverMoved" (= (state at:(mapEntry #1 (mover))) 1)) (define "KingInTheInitialPlace" (= (what at:(mapEntry "King" (mover))) (id "King" Mover))) (define "NextCanNotMoveToProtect" (not (can Move (do (forEach Piece Next) ifAfterwards:(not ("IsInCheck" #1 Next)))))) (game "Maharajah Chess" (players 2) (equipment { (board (square 8)) (piece "Pawn" P2 S (or { (if (is In (from) (sites Start (piece (what at:(from))))) ("DoubleStepForwardToEmpty")) "StepForwardToEmpty" ("StepToEnemy" (directions {FR FL}))} (then (set Counter)))) (piece "Rook" P2 ("SlideCapture" Orthogonal ~ (then (set Counter)) "RememberPieceHasMoved")) (piece "King" P2 (move Step (to if:(not ("IsFriendAt" (to))) "CaptureToPieceAndResetCounter") "RememberPieceHasMoved")) (piece "Bishop" P2 (move Slide Diagonal (to if:("IsEnemyAt" (to)) "CaptureToPieceAndResetCounter"))) (piece "Knight" P2 ("LeapCapture" "KnightWalk" (then (set Counter)))) (piece "Queen" P2 (move Slide (to if:("IsEnemyAt" (to)) "CaptureToPieceAndResetCounter"))) (piece "Amazon" P1 (or ("LeapCapture" "KnightWalk" (then (set Counter))) ("SlideCapture" ~ ~ (then (set Counter))))) (map "King" {(pair 1 "E1") (pair 2 "E8")}) (map "RookLeft" {(pair 1 "A1") (pair 2 "A8")}) (map "RookRight" {(pair 1 "H1") (pair 2 "H8")})}) (rules (start { (place "Pawn2" (sites Row 6)) (place "Amazon1" coord:"E1") (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 { (is Mover P2) "KingInTheInitialPlace" ("HasNeverMoved" "King") (not ("IsInCheck" "King" Mover))}) (or (if (and ("HasNeverMoved" "RookLeft") (can Move ("DoCastle" "RookLeft" E 3 (is Empty (to))))) "BigCastling") (if (and ("HasNeverMoved" "RookRight") (can Move ("DoCastle" "RookRight" W 2 (is Empty (to))))) "SmallCastling")))) ifAfterwards:(if (is Mover P1) (not ("IsInCheck" "Amazon" Mover)) (not ("IsInCheck" "King" Mover))))) (end { (if (if (is Mover P1) (and ("IsInCheck" "King" Next) ("NextCanNotMoveToProtect" "King")) (and ("IsInCheck" "Amazon" Next) ("NextCanNotMoveToProtect" "Amazon"))) (result Mover Win)) (if (or (no Moves Mover) (= (counter) 100)) (result Mover Draw))}))) END |
Modify the Ludii game according to the following option changes:
Order 3 board - about 5 moves each -> Order 4 board - about 11 moves each
Triangle-Square N-2 all directions connect paths to edge - Orthogonal only form groups, about 10% more moves -> Triangle-Square N-2 Orthogonal connections to edge - ALl direction form groups
Scoring Option: Score the size of your largest group, then score an additional point for every opponent's group on the board. -> Scoring Option: No bonus. Score a point only for each piece in your largest group
(define "ColourBackground" (colour 126 130 156)) (define "TriSquare" (board (tiling T33434 (- 3 2)) use:Vertex)) (define "HexCell" (board (hex Hexagon 3) use:Cell)) (define "Hex2Limp" (board (hex (- 3 1) (+ 3 1)) use:Cell)) (define "HexLimp" (board (hex Limping (- 3 1)) use:Cell)) (define "BoardUsed" "TriSquare") (define "ConnectionDirection" All) (define "ScoreConnectionDirection" Adjacent) (define "AllHave1Connection2Edge" (all Sites #1 if:(or (and (is Empty (site)) (is In (site) (sites Outer))) (!= Infinity (count Steps (step "ConnectionDirection" (to if:(is Empty (to)))) (site) (difference (sites Outer) (site))))))) (define "CascadeTiebreaker" (if (= (var "MoverScore") (var "NextScore")) (and (set Score Mover (* -1 ("CascadeScore" Mover Next))) (set Score Next (* -1 ("CascadeScore" Next Mover)))) ("NoTiebreaker"))) (define "NoTiebreaker" (and (set Score Mover (var "MoverScore")) (set Score Next (var "NextScore")))) (define "CascadeScore" (max 0 (max (difference (sizes Group "ScoreConnectionDirection" #1) (sizes Group "ScoreConnectionDirection" #2))))) (define "BonusOpponent" (set Var "MoverScore" (+ ("GroupCount" Mover) (count Groups "ScoreConnectionDirection" if:(= (who at:(to)) (next)))) (then (set Var "NextScore" (+ ("GroupCount" Next) (count Groups "ScoreConnectionDirection" if:(= (who at:(to)) (mover)))) (then ("CascadeTiebreaker")))))) (define "BonusMover" (set Var "MoverScore" (+ ("GroupCount" Mover) (count Groups "ScoreConnectionDirection" if:(= (who at:(to)) (mover)))) (then (set Var "NextScore" (+ ("GroupCount" Next) (count Groups "ScoreConnectionDirection" if:(= (who at:(to)) (next)))) (then ("CascadeTiebreaker")))))) (define "GroupScore" (set Var "MoverScore" ("GroupCount" Mover) (then (set Var "NextScore" ("GroupCount" Next) (then ("CascadeTiebreaker")))))) (define "GroupCount" (max 0 (max (sizes Group "ScoreConnectionDirection" #1)))) (game "Brain Coral" (players 2) (equipment { "BoardUsed" (piece "Ball" Each) (piece "Disc" Each)}) (rules (start (set Score Each 0)) (play (do (move Add (to (sites Empty))) ifAfterwards:("AllHave1Connection2Edge" (sites Around (last To) "ConnectionDirection" includeSelf:True)) (then "BonusOpponent"))) (end (if (no Moves Next) { (if (= (score Mover) (score Next)) (result Mover Win)) (if (!= (score Mover) (score Next)) (byScore))}))))
###
| (define "ColourBackground" (colour 126 130 156)) (define "TriSquare" (board (tiling T33434 (- 4 2)) use:Vertex)) (define "HexCell" (board (hex Hexagon 4) use:Cell)) (define "Hex2Limp" (board (hex (- 4 1) (+ 4 1)) use:Cell)) (define "HexLimp" (board (hex Limping (- 4 1)) use:Cell)) (define "BoardUsed" "TriSquare") (define "ConnectionDirection" Adjacent) (define "ScoreConnectionDirection" All) (define "AllHave1Connection2Edge" (all Sites #1 if:(or (and (is Empty (site)) (is In (site) (sites Outer))) (!= Infinity (count Steps (step "ConnectionDirection" (to if:(is Empty (to)))) (site) (difference (sites Outer) (site))))))) (define "CascadeTiebreaker" (if (= (var "MoverScore") (var "NextScore")) (and (set Score Mover (* -1 ("CascadeScore" Mover Next))) (set Score Next (* -1 ("CascadeScore" Next Mover)))) ("NoTiebreaker"))) (define "NoTiebreaker" (and (set Score Mover (var "MoverScore")) (set Score Next (var "NextScore")))) (define "CascadeScore" (max 0 (max (difference (sizes Group "ScoreConnectionDirection" #1) (sizes Group "ScoreConnectionDirection" #2))))) (define "BonusOpponent" (set Var "MoverScore" (+ ("GroupCount" Mover) (count Groups "ScoreConnectionDirection" if:(= (who at:(to)) (next)))) (then (set Var "NextScore" (+ ("GroupCount" Next) (count Groups "ScoreConnectionDirection" if:(= (who at:(to)) (mover)))) (then ("CascadeTiebreaker")))))) (define "BonusMover" (set Var "MoverScore" (+ ("GroupCount" Mover) (count Groups "ScoreConnectionDirection" if:(= (who at:(to)) (mover)))) (then (set Var "NextScore" (+ ("GroupCount" Next) (count Groups "ScoreConnectionDirection" if:(= (who at:(to)) (next)))) (then ("CascadeTiebreaker")))))) (define "GroupScore" (set Var "MoverScore" ("GroupCount" Mover) (then (set Var "NextScore" ("GroupCount" Next) (then ("CascadeTiebreaker")))))) (define "GroupCount" (max 0 (max (sizes Group "ScoreConnectionDirection" #1)))) (game "Brain Coral" (players 2) (equipment { "BoardUsed" (piece "Ball" Each) (piece "Disc" Each)}) (rules (start (set Score Each 0)) (play (do (move Add (to (sites Empty))) ifAfterwards:("AllHave1Connection2Edge" (sites Around (last To) "ConnectionDirection" includeSelf:True)) (then "GroupScore"))) (end (if (no Moves Next) { (if (= (score Mover) (score Next)) (result Mover Win)) (if (!= (score Mover) (score Next)) (byScore))})))) END |
Construct a Ludii game based on the following description
Six dots ('vertices') are drawn. Each dot is connected to every other dot by a line ('edge'). Two players take turns colouring any uncoloured lines. One player colours in one colour, and the other colours in another colour, with each player trying to avoid the creation of a triangle made solely of their colour (only triangles with the dots as corners count; intersections of lines are not relevant); the player who completes such a triangle loses immediately.
###
| (game "Sim" (players 2) (equipment { (board (complete (regular Star 6)) use:Edge)}) (rules (play (move Add (to Edge (sites Empty Edge)))) (end (if (is Path Edge Mover length:(exact 3) closed:True) (result Mover Loss))))) END |
Construct a Ludii game based on the following description
Play begins with the pieces arranged in the last row of squares on opposite sides of the board. Pieces move as rooks in Chess. An opponent's piece is captured by surrounding it on two opposite sides by a player's piece. Play continues until all but one player's pieces are captured.
###
| (define "SurroundCaptures" (surround (from (last To)) Orthogonal (between if:(and (is In (between) (sites Corners)) ("IsEnemyAt" (between))) (apply (remove (between)))) (to if:("IsFriendAt" (to))))) (game "Hasami Shogi" (players 2) (equipment { (board (square 9)) (piece "Fuhyo" P1 (move Slide Orthogonal (then (or ("CustodialCapture" Orthogonal (max 1)) "SurroundCaptures")))) (piece "Tokin" P2 (move Slide Orthogonal (then (or ("CustodialCapture" Orthogonal (max 1)) "SurroundCaptures"))))}) (rules (start { (place "Fuhyo1" (sites Bottom)) (place "Tokin2" (sites Top))}) (play (forEach Piece)) (end (if (= (count Pieces Next) 1) (result Mover Win))))) END |
Construct a Ludii game based on the following description
Square board, divided into eight equal triangles, with the central horizonal line extended past the square on either side and lines connecting the end point to the two nearby corners of the square One player plays as the hare, the other player as three hounds. Players take turns placing one of their pieces on the board. When a player has placed all their pieces, they move to an adjacent empty spot. When the hounds block the hare from being able to move, the hounds win.
The game has an ending condition only for P1.
###
| (game "Haretavl" (players 2) (equipment { ("ThreeMensMorrisBoardWithLeftAndRightTriangles") (hand Each) (piece "Dog" P1 "StepToEmpty") (piece "Hare" P2 "StepToEmpty")}) (rules (start { (place "Dog1" (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 |
Describe the mechanics of the following Ludii game
(define "PlayerPiece" (piece (if (is Mover P1) (id "Disc" P1) (id "Cross" P2)))) (game "Tic-Tac-Die" (players 2) (equipment { (board (square 3)) (piece "Disc" P1) (piece "Cross" P2) (dice d:9 from:0 num:1)}) (rules (play ("RollMove" (if (is Empty (count Pips)) (move Add ("PlayerPiece") (to (count Pips))) (move Pass (then (moveAgain)))))) (end { ("Line3Win") (if (is Full) (result Mover Draw))})))
###
| Play occurs on a 3x3 grid. One player places an X, the other places an O and players take turns placing their marks in the grid, attempting to get three in a row. The die is showing the cell index to place a piece. Players reroll until they roll an empty cell. END |
Construct a Ludii game based on the following description
Cage is a checkers variant for two players played on a square 10x10 board. In this implementation you also have the option of playing on smaller boards. In the initial position, 50 checkers of one color and 50 checkers of a different color fill up the board in a checkered pattern. The goal of the game is to capture all your opponent's checkers.
On your turn, if you can, you must choose one of two different kinds of moves to perform:
• a single step, or
• a sequence of jumps.
Note: A single jump is considered a jump sequence of length 1.
Universal restriction:
All moves are subject to the following restriction:
• At no time may a checker be orthogonally adjacent to a checker of the same color.
Stepping:
Stepping is moving one of your checkers to an orthogonally or diagonally adjacent empty square, and this kind of move is subject to the following two additional restrictions:
• A step my never bring the number of orthogonal enemy neighbors of the moved checker down to 0.
• The only condition under which a step may fail to bring the moved checker closer to the center of the line you are moving along is if it brings its number of orthogonal enemy neighbors up from 0.
(Some elaboration on this last restriction: In general, a step must decrease the moved checker's straight line distance to the board's central intersection. That's the same as bringing it closer to the center of the orthogonal or diagonal line you are moving along. (Note: The center of a diagonal line is an intersection if it is an even number of squares long, and a square otherwise. The center of an orthogonal line is an edge if it is an even number of squares long, and a square otherwise.) Here is a different way of putting it: Whatever diagonal or orthogonal line you are stepping along, the largest distance to an edge square on this line before the step must be bigger than the largest distance to an edge square on the same line after the step. The only exception to this rule, as explained in the last restriction, is if your checker has no orthogonal neighbors and can step into such a relationship – then you may step in any direction.)
Jumping sequences:
If a checker of your color is orthogonally adjacent to an enemy checker, and immediately on the opposite side of that enemy checker is either an empty square or the outside of the board, your checker may initiate a sequence of jumps. You do this by jumping your checker over to the opposite side of the enemy checker and immediately removing the jumped piece. If your checker lands outside the board, it too is removed from the board. Note: If your last checker is removed when you capture your opponent's last checker, you still win.
If the jumping checker lands in a position where it can jump again, your turn does not end, and the checker must make yet a jump. If there are several ways to continue the sequence, you may choose freely between these. The sequence of jumps only ends when the checker lands on a square where it can make no further jump. A 10x10 board is currently selected
###
| (define "Step" (move Step (from) (to if:(and { (is Empty (to)) (= 0 (count Sites in:(difference (sites Around (to) Own Orthogonal) (sites {(from)})))) (not (and (< 0 (count Sites in:(sites Around (from) Enemy Orthogonal))) (= 0 (count Sites in:(sites Around (to) Enemy Orthogonal))))) (or { (and (= 0 (count Sites in:(sites Around (from) Enemy Orthogonal))) (< 0 (count Sites in:(sites Around (to) Enemy Orthogonal)))) (or { (and (or (= (from) (+ (to) 12)) (= (from) (- (to) 12))) ("Inward" N S)) (and (or (= (from) (+ (to) 1)) (= (from) (- (to) 1))) ("Inward" E W)) (and (or (= (from) (+ (to) (+ 12 1))) (= (from) (- (to) (+ 12 1)))) ("Inward" SW NE)) (and (or (= (from) (+ (to) (- 12 1))) (= (from) (- (to) (- 12 1)))) ("Inward" SE NW))})})})))) (define "Hop" (move Hop (from #1) Orthogonal (between if:(is Occupied (between)) (apply (remove (between)))) (to if:(and { (is Empty (to)) (= 0 (count Sites in:(sites Around (to) Own Orthogonal)))})) (then (and { (remove (sites Outer)) (set Var 1) (if (can Move (move Hop (from (last To)) Orthogonal (between if:(is Occupied (between)) (apply (remove (between)))) (to if:(and { (is Empty (to)) (= 0 (count Sites in:(sites Around (to) Own Orthogonal)))})))) (moveAgain) (set Var 0))})))) (define "Inward" (> (max (count Sites in:(sites Direction from:(from) #1)) (count Sites in:(sites Direction from:(from) #2))) (max (count Sites in:(sites Direction from:(to) #1)) (count Sites in:(sites Direction from:(to) #2))))) (game "Cage" (players 2) (equipment { (board (square 12)) (piece "Disc" Each)}) (rules (start { (place "Disc1" (difference (sites Phase 0) (sites Outer))) (place "Disc2" (difference (sites Phase 1) (sites Outer)))}) (play (forEach Piece (if (!= 1 (var)) (or ("Hop" ~) ("Step")) ("Hop" if:(= (from) (last To)))))) (end (if (or (= 0 (count Sites in:(sites Occupied by:P1))) (= 0 (count Sites in:(sites Occupied by:P2)))) (result Mover Win))))) END |
Describe the mechanics of the following Ludii game
(define "Columns" 8) (game "Nsumbi" (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 P1 "Home") (sites P2 "Home")))) phases:{ (phase "Opening" (play (move Select (from (sites Mover)) (then (sow "Track" owner:(mover))))) (nextPhase Mover "Playing")) (phase "Playing" (play (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover)) if:(< 1 (count at:(from)))) (then (sow "Track" owner:(mover) apply:(if (and { (< 1 (count at:(to))) (is In (to) (sites Mover "Inner")) (> (count at:("OppositePit" (to))) 0) (> (count at:("OppositeOuterPit" (to))) 0)}) (and { (fromTo (from ("OppositePit" (to))) (to (last From)) count:(count at:("OppositePit" (to)))) (fromTo (from ("OppositeOuterPit" (to))) (to (last From)) count:(count at:("OppositeOuterPit" (to)))) (sow (last From) count:(+ (count at:("OppositePit" (to))) (count at:("OppositeOuterPit" (to)))) "Track" owner:(mover) origin:True)}) (if (< 1 (count at:(to))) (moveAgain))))))))} (end ("BlockWin"))))
###
| 4x8 board. Two counters in each hole. Players sow in an anti-clockwise direction from any of their holes. Singletons may not be sowed. Players capture when the sowing ends in a player's inner row and the opponent's inner and outer row holes opposite contain counters; these are captured and sown in the player's rows starting from the same hole that the previous sowing began. If the final counter lands in an occupied hole but capture is not possible, the counters in this hole are picked up and sowing continues. If the final counter ends in an empty hole, the turn ends. Captures cannot be made on each player's first turn. Play continues until one player has no holes with two or more counters, and the opponent wins. END |
Construct a Ludii game based on the following description
4x13, 19, 21, or 29 board. The number of pieces per player equals the number of spaces in a row, which begin the game arrayed in the outer rows of the board. Four sticks, each with a white side and a yellow side. Throws equal the number of white sides which fall up; when only yellow sides are up the throw equals 6. A throw of 1, 4, or 6 grants another throw to the player. Players perform all of their throws first, and then move pieces according to the values of the throws without subdividing the value of a single throw. Players cannot move their pieces until the throw a 1. Pieces cannot move past one another in the home row. Each piece in the home row must individually be unlocked with a throw of 1 before it can move. In the central rows, when two of a player's pieces land on the same spot, they become a king and can be moved as one piece. There is no limit to the number of pieces in the king. They may be uncoupled with a throw of 1, or another throw which removes that number of pieces from the king. When a player's piece lands in a space occupied by an opponent's piece, the opponent's piece is removed from the board. Play progresses from left to right in the player's home row, and then from right to left in the second row, left to right in the third row, and then right to left in the opponent's row. When a piece enters the opponent's row, it cannot move if there are other pieces which can be moved. The player to capture the most of the opponent's pieces wins. The board has 13 columns.
###
| (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 "CreateAKing" (move (from) (to ("NextSiteOnTrack" ("ThrowValue"))))) (define "UncoupledKing" ("Move" ("ThrowValue"))) (define "KingMove" ("Move" (count at:(from)))) (define "Move" (move (from) (to ("NextSiteOnTrack" ("ThrowValue")) "CaptureEnemyPiece") count:#1)) (define "ThrowEqualSizeKingMinusOne" (= (+ ("ThrowValue") 1) (count at:(from)))) (define "OpponentPieceAtHome" (= (count Sites in:(intersection (sites Occupied by:Next) (sites Next))) 0)) (define "InOpponentHome" (is In (from) (sites Next))) (define "InactivePiece" (= (state at:(from)) 1)) (define "ActivatedPiece" (= (state at:(from)) 0)) (define "ActivatePiece" (set State at:(last To) 0)) (define "CaptureEnemyPiece" (apply if:("IsEnemyAt" (to)) (remove (to) (then (addScore Mover 1))))) (define "ThrowValue" (mapEntry (count Pips))) (game "At-Tab wa-d-Dukk" (players 2) (equipment { (board (rectangle 4 13) { (track "Track1" "0,E,N1,W,N1,E,N1,W" P1 directed:True) (track "Track2" "51,W,S1,E,S1,W,S1,E" P2 directed:True)}) ("StickDice" 4) (map {(pair 0 6) (pair 1 1) (pair 2 2) (pair 3 3) (pair 4 4)}) (piece "Marker" Each (if (or ("ActivatedPiece") (and (= 1 ("ThrowValue")) ("InactivePiece"))) (if ("IsNotOffBoard" ("NextSiteOnTrack" ("ThrowValue"))) (if (or (not ("InOpponentHome")) (and ("InOpponentHome") ("OpponentPieceAtHome"))) (if (or (is In ("NextSiteOnTrack" ("ThrowValue")) (sites Empty)) ("IsEnemyAt" ("NextSiteOnTrack" ("ThrowValue")))) (or (if ("ThrowEqualSizeKingMinusOne") ("UncoupledKing")) ("KingMove")) (if (and (is In ("NextSiteOnTrack" ("ThrowValue")) (sites "CentralRows")) ("IsFriendAt" ("NextSiteOnTrack" ("ThrowValue")))) ("CreateAKing")))) (then ("ActivatePiece"))))) (regions "AnotherThrow" (sites {1 4 6})) (regions "CentralRows" (union (sites Row 1) (sites Row 2))) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start { (place "Marker1" (sites Bottom) state:1) (place "Marker2" (sites Top) state:1)}) (play ("RollMove" (if (can Move (forEach Piece)) (forEach Piece (then (if (is In ("ThrowValue") (sites "AnotherThrow")) (moveAgain)))) (move Pass (then (if (is In ("ThrowValue") (sites "AnotherThrow")) (moveAgain))))))) (end (if (or ("AllPieceInOpponentHome") (no Pieces Mover)) (byScore))))) END |
Construct a Ludii game based on the following description
Players take turns placing stones of their color on empty squares. If you place orthogonally adjacent to more than 2 stones, regardless of their color, you must place again. You continue until you place orthogonally adjacent to 2 or fewer stones. When the board is full, the player with the most stones on the board is the winner. A 7x7 playing area is currently selected
###
| (game "Flume" (players 2) (equipment { (board (square 9)) (piece "Disc" Each) (piece "Disc" Neutral)}) (rules (meta (swap)) (start (place "Disc0" (sites Outer))) (play (move Add (to (sites Empty)) (then (and (addScore Mover 1) (if (< 2 (count Sites in:(sites Around (last To) NotEmpty Orthogonal))) (moveAgain)))))) (end (if (is Full) (byScore))))) END |
Construct a Ludii game based on the following description
Rules are the same as Chess except pawns may move up to four squares on their first move and kings may only castle on their own half of the board. The player that checkmates one of the opposing kings wins.
###
| (define "EnPassant" (move Step (directions {FR FL}) (to if:"InLocationEnPassant") (then (remove ("LastPawnMoved"))))) (define "LastPawnMoved" (var)) (define "InLocationEnPassant" (is In (to) (sites Pending))) (define "InitialPawnMove" (forEach Value min:2 max:4 (move Slide Forward (between (exact (value)) if:(is Empty (between)) (apply (set Pending (between)))) (to if:(is Empty (to))) "SetEnPassantLocation"))) (define "SetEnPassantLocation" (then (set Var (last To)))) (define "BigRightCastling" ("DoCastle" "KingRight" W 2 "KingNotCheckedAndToEmpty" (then (and ("PieceHasMoved") ("DoCastle" "RookRightRight" E 3 True))))) (define "BigLeftCastling" ("DoCastle" "KingLeft" W 2 "KingNotCheckedAndToEmpty" (then (and ("PieceHasMoved") ("DoCastle" "RookLeftLeft" E 3 True))))) (define "SmallRightCastling" ("DoCastle" "KingRight" E 2 "KingNotCheckedAndToEmpty" (then (and ("PieceHasMoved") ("DoCastle" "RookRightRight" W 2 True))))) (define "SmallLeftCastling" ("DoCastle" "KingLeft" E 2 "KingNotCheckedAndToEmpty" (then (and ("PieceHasMoved") ("DoCastle" "RookLeftRight" W 2 True))))) (define "DoCastle" (move Slide (from (mapEntry #1 (mover))) #2 (between (exact #3) if:#4) #5)) (define "KingNotCheckedAndToEmpty" (and (is Empty (to)) (not ("IsInCheck" "King" Mover at:(to))))) (define "CaptureToPieceAndResetCounter" (apply (if ("IsEnemyAt" (to)) (remove (to) (then (set Counter)))))) (define "RememberPieceHasMoved" (then (if (= (state at:(last To)) 1) "PieceHasMoved"))) (define "PieceHasMoved" (set State at:(last To) 0)) (define "HasNeverMoved" (= (state at:(mapEntry #1 (mover))) 1)) (define "InTheInitialPlace" (= (what at:(mapEntry #1 (mover))) (id "King" Mover))) (define "NextCanNotMove" (not (can Move (do (forEach Piece Next) ifAfterwards:(not ("IsInCheck" "King" Next in:(sites Occupied by:Next component:"King"))))))) (game "Double Chess" ("TwoPlayersNorthSouth") (equipment { (board (rectangle 12 16)) (piece "Pawn" Each (or { (if (is In (from) (sites Start (piece (what at:(from))))) "InitialPawnMove") "StepForwardToEmpty" ("StepToEnemy" (directions {FR FL})) "EnPassant"} (then (and (if (is In (last To) (sites Mover "Promotion")) (moveAgain)) (set Counter))))) ("ChessRook" "Rook" (then (set Counter)) ("RememberPieceHasMoved")) ("ChessKing" "King" (then (set Counter)) ("RememberPieceHasMoved")) ("ChessBishop" "Bishop" (then (set Counter))) ("ChessKnight" "Knight" (then (set Counter))) ("ChessQueen" "Queen" (then (set Counter))) (map "KingLeft" {(pair 1 "E1") (pair 2 "E12")}) (map "RookLeftLeft" {(pair 1 "A1") (pair 2 "A12")}) (map "RookLeftRight" {(pair 1 "H1") (pair 2 "H12")}) (map "KingRight" {(pair 1 "M1") (pair 2 "M12")}) (map "RookRightLeft" {(pair 1 "I1") (pair 2 "I12")}) (map "RookRightRight" {(pair 1 "P1") (pair 2 "P12")}) (regions "Promotion" P1 (sites Top)) (regions "Promotion" P2 (sites Bottom))}) (rules (start { (place "Pawn1" (sites Row 1)) (place "Pawn2" (sites Row 10)) (place "Rook1" {"A1" "H1" "I1" "P1"} state:1) (place "Knight1" {"B1" "G1" "J1" "O1"}) (place "Bishop1" {"C1" "F1" "K1" "N1"}) (place "Queen1" {"D1" "L1"}) (place "King1" {"E1" "M1"} state:1) (place "Rook2" {"A12" "H12" "I12" "P12"} state:1) (place "Knight2" {"B12" "G12" "J12" "O12"}) (place "Bishop2" {"C12" "F12" "K12" "N12"}) (place "Queen2" {"D12" "L12"}) (place "King2" {"E12" "M12"} state:1)}) (play (if "SameTurn" (move Promote (last To) (piece {"Queen" "Knight" "Bishop" "Rook"}) Mover) (or (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King" Mover in:(sites Occupied by:Mover component:"King")))) (or (if (and { ("InTheInitialPlace" "KingLeft") ("HasNeverMoved" "KingLeft") (not ("IsInCheck" "King" Mover at:(mapEntry "KingLeft" (mover))))}) (or (if (and ("HasNeverMoved" "RookLeftLeft") (can Move ("DoCastle" "RookLeftLeft" E 3 (is Empty (to))))) "BigLeftCastling") (if (and ("HasNeverMoved" "RookLeftRight") (can Move ("DoCastle" "RookLeftRight" W 2 (is Empty (to))))) "SmallLeftCastling"))) (if (and { ("InTheInitialPlace" "KingRight") ("HasNeverMoved" "KingRight") (not ("IsInCheck" "King" Mover at:(mapEntry "KingRight" (mover))))}) (or (if (and ("HasNeverMoved" "RookRightLeft") (can Move ("DoCastle" "RookRightLeft" E 3 (is Empty (to))))) "BigRightCastling") (if (and ("HasNeverMoved" "RookRightRight") (can Move ("DoCastle" "RookRightRight" W 2 (is Empty (to))))) "SmallRightCastling"))))))) (end { (if (or (no Moves Mover) (= (counter) 100)) (result Mover Draw)) (if (and ("IsInCheck" "King" Next in:(sites Occupied by:Next component:"King")) ("NextCanNotMove")) (result Mover Win))}))) END |
Modify the Ludii game according to the following option changes:
The game is played on a 4x4 board. -> The game is played on a 5x5 board.
(define "Dim" 4) (define "HopSequence" ("Hop" #1 (then (if (can Move ("Hop" (last To))) (moveAgain))))) (define "Hop" (move Hop (from #1) (between if:(is Occupied (between))) (to if:(and ("IsEmptyAndNotVisited" (to)) (or (not ("FromIsOnTheRegionToFill" #1)) ("ToIsOnTheRegionToFill" (to))))) #2)) (define "ToIsOnTheRegionToFill" (is In #1 (sites (player (mapEntry (mover)))))) (define "FromIsOnTheRegionToFill" (is In #1 (sites (player (mapEntry (mover)))))) (game "Halma" (players 2) (equipment { (board (square ("Dim"))) (piece "Counter" Each) (regions "Home" P1 (difference (expand (intersection (sites Bottom) (sites Right)) steps:(+ 1 (/ ("Dim") 4)) Orthogonal) (sites { (ahead (coord row:0 column:(- ("Dim") 1)) steps:(+ 1 (/ ("Dim") 4)) N) (ahead (coord row:0 column:(- ("Dim") 1)) steps:(+ 1 (/ ("Dim") 4)) W)}))) (regions "Home" P2 (difference (expand (intersection (sites Top) (sites Left)) steps:(+ 1 (/ ("Dim") 4)) Orthogonal) (sites { (ahead (coord row:(- ("Dim") 1) column:0) steps:(+ 1 (/ ("Dim") 4)) E) (ahead (coord row:(- ("Dim") 1) column:0) steps:(+ 1 (/ ("Dim") 4)) S)}))) (map {(pair P1 P2) (pair P2 P1)})}) (rules (start { (place "Counter1" (sites P1)) (place "Counter2" (sites P2))}) phases:{ (phase "Movement" (play (forEach Piece (or ("HopSequence" (from)) (move Step (to if:(and (is Empty (to)) (or (not ("FromIsOnTheRegionToFill" (from))) ("ToIsOnTheRegionToFill" (to))))))))) (nextPhase (is Mover (next)) "MultiJump")) (phase "MultiJump" (play (or ("HopSequence" (last To)) (move Pass))) (nextPhase (not (is Mover (next))) "Movement"))} (end ("FillWin" (sites (player (mapEntry (mover))))))))
###
| (define "Dim" 5) (define "HopSequence" ("Hop" #1 (then (if (can Move ("Hop" (last To))) (moveAgain))))) (define "Hop" (move Hop (from #1) (between if:(is Occupied (between))) (to if:(and ("IsEmptyAndNotVisited" (to)) (or (not ("FromIsOnTheRegionToFill" #1)) ("ToIsOnTheRegionToFill" (to))))) #2)) (define "ToIsOnTheRegionToFill" (is In #1 (sites (player (mapEntry (mover)))))) (define "FromIsOnTheRegionToFill" (is In #1 (sites (player (mapEntry (mover)))))) (game "Halma" (players 2) (equipment { (board (square ("Dim"))) (piece "Counter" Each) (regions "Home" P1 (difference (expand (intersection (sites Bottom) (sites Right)) steps:(+ 1 (/ ("Dim") 4)) Orthogonal) (sites { (ahead (coord row:0 column:(- ("Dim") 1)) steps:(+ 1 (/ ("Dim") 4)) N) (ahead (coord row:0 column:(- ("Dim") 1)) steps:(+ 1 (/ ("Dim") 4)) W)}))) (regions "Home" P2 (difference (expand (intersection (sites Top) (sites Left)) steps:(+ 1 (/ ("Dim") 4)) Orthogonal) (sites { (ahead (coord row:(- ("Dim") 1) column:0) steps:(+ 1 (/ ("Dim") 4)) E) (ahead (coord row:(- ("Dim") 1) column:0) steps:(+ 1 (/ ("Dim") 4)) S)}))) (map {(pair P1 P2) (pair P2 P1)})}) (rules (start { (place "Counter1" (sites P1)) (place "Counter2" (sites P2))}) phases:{ (phase "Movement" (play (forEach Piece (or ("HopSequence" (from)) (move Step (to if:(and (is Empty (to)) (or (not ("FromIsOnTheRegionToFill" (from))) ("ToIsOnTheRegionToFill" (to))))))))) (nextPhase (is Mover (next)) "MultiJump")) (phase "MultiJump" (play (or ("HopSequence" (last To)) (move Pass))) (nextPhase (not (is Mover (next))) "Movement"))} (end ("FillWin" (sites (player (mapEntry (mover)))))))) END |
Construct a Ludii game based on the following description
8x8 board, with diagonals in every square. Pieces have special moves, as follows: Raja (king), moves one square in any direction, but on the first move, it may jump two squares or move as a knight, with the exception that it cannot jump two squares diagonally; Mantri (minister), moves orthogonally or diagonally any number of spaces; Gajah (x2); move diagonally any distance; Kuda (horse) x2, moves orthogonally one space then diagonal one space from there, jumping over any intervening pieces; Ter/Chemor (chariot) x2, moves orthogonally any distance; Bídaq (pawn) x8: moves one square forward or one square forward diagonally to capture. May move two spaces forward orthogonally if it is that piece's first move. Upon reaching the opposite edge of the board, the Bídaq moves in the opposite direction, reversing again if it reaches the opposite edge. The Mantri is placed to the right of the Raja at the beginning of play. Castling occurs in two moves, the rook moving to the king and then the king jumping over the rook. Pieces are captured by moving onto a space occupied by an opponent's piece. If the Raja can be captured on its next turn, it is in check. The Raja cannot be in check at the end of its turn. When this is unavoidable, it is checkmate and the opponent wins. A stalemate is considered a draw.
###
| (define "RememberKingMoved" (set State at:#1 1)) (define "KingMovedBefore" (= 1 (state at:#1))) (define "RookMovedBefore" (= 1 (state at:#1))) (define "RememberRookMoved" (set State at:#1 1)) (define "KingSites" (sites {"E8" "D1"})) (define "SitesNextToKing" (sites {"C1" "E1" "D8" "F8"})) (game "Main Chator (Batak)" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) (piece "King_noCross" (or ("StepToNotFriend") (if (not ("KingMovedBefore" (from))) (or { (move Hop Orthogonal (between (exact 2) if:True) (to if:(not ("IsFriendAt" (to))) (apply (if ("IsEnemyAt" (to)) (remove (to)))))) ("LeapCapture" "KnightWalk") (if (is In (from) ("KingSites")) (or (if (and { (is Empty (ahead (from) steps:2 W)) ("IsPieceAt" "Rook" Mover (ahead (from) W)) (not ("RookMovedBefore" (ahead (from) W)))}) (move (from) (to (ahead (from) steps:2 W)))) (if (and { (is Empty (ahead (from) steps:2 E)) ("IsPieceAt" "Rook" Mover (ahead (from) E)) (not ("RookMovedBefore" (ahead (from) E)))}) (move (from) (to (ahead (from) steps:2 E))))))} (then ("RememberKingMoved" (last To))))))) ("ChessRook" "Rook" ~ (then (if (and (not ("RookMovedBefore" (last To))) (not (is In (last To) ("SitesNextToKing")))) ("RememberRookMoved" (last To))))) ("ChessBishop" "Bishop_noCross") ("ChessKnight" "Knight") (piece "Pawn" (or { (if (and (= 0 (state at:(last To))) (is In (from) (sites Start (piece (what at:(from)))))) ("DoubleStepForwardToEmpty")) ("StepToEmpty" (if (= 1 (state at:(from))) Backward Forward)) ("StepToEnemy" (directions {FR FL}))} (then (if (is In (last To) (union (sites Bottom) (sites Top))) (if (= 0 (state at:(last To))) (set State at:(last To) 1) (set State at:(last To) 2)))))) ("ChessQueen" "Queen")}) (rules (start { (place "Pawn1" (sites Row 1)) (place "Pawn2" (sites Row 6)) (place "Rook1" {"A1" "H1"}) (place "Knight1" {"B1" "G1"}) (place "Bishop_noCross1" {"C1" "F1"}) (place "Queen1" coord:"E1") (place "King_noCross1" coord:"D1") (place "Rook2" {"A8" "H8"}) (place "Knight2" {"B8" "G8"}) (place "Bishop_noCross2" {"C8" "F8"}) (place "Queen2" coord:"D8") (place "King_noCross2" coord:"E8")}) (play (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King_noCross" Mover)))) (end { ("Checkmate" "King_noCross") ("DrawIfNoMoves" Next)}))) END |
Modify the Ludii game according to the following option changes:
Each row has 21 holes. -> Each row has 22 holes.
(define "PiecesOwnedBy" (count Sites in:(sites Occupied by:#1))) (define "AllPiecesInOpponentHome" (and (= 0 (count Sites in:(difference (sites Occupied by:Team1) (sites P2 "Home")))) (= 0 (count Sites in:(difference (sites Occupied by:Team2) (sites P1 "Home")))))) (define "Move" (move (from (site)) (to ("NextSiteOnTrack" "ThrowValue") if:(and (or (is Empty (to)) (and (not (is In (to) (sites Next "Home"))) ("IsEnemyAt" (to)))) ("NoFriendPieceInBetween" #1)) "CaptureEnemyPiece"))) (define "NoFriendPieceInBetween" (= 1 (count Sites in:(intersection (sites Occupied by:#1) (sites Track Mover "Track" from:(from) to:("NextSiteOnTrack" "ThrowValue")))))) (define "CaptureEnemyPiece" (apply if:("IsEnemyAt" (to)) (remove (to)))) (define "SpecialThrows" (is In ("ThrowValue") (sites {1 4}))) (define "ThrowValue" (mapEntry (count Pips))) (game "Sig (Western Sahara)" (players 4) (equipment { (board (rectangle 4 21) { (track "Track1" "0,E,N1,W,N1,E,N1,W" P1 directed:True) (track "Track2" "83,W,S1,E,S1,W,S1,E" P2 directed:True) (track "Track3" "0,E,N1,W,N1,E,N1,W" P3 directed:True) (track "Track4" "83,W,S1,E,S1,W,S1,E" P4 directed:True)} use:Vertex) (piece "Stick" Each) (regions "AllSites" (sites Board)) ("StickDice" 8) (map "Throw" {(pair 0 8) (pair 1 1) (pair 2 6) (pair 3 5) (pair 4 4) (pair 5 5) (pair 6 6) (pair 7 1) (pair 8 8)}) (regions "Home" P1 (sites Bottom)) (regions "Home" P2 (sites Top)) (regions "Home" P3 (sites Bottom)) (regions "Home" P4 (sites Top))}) (rules (start { (set Team 1 {P1 P3}) (set Team 2 {P2 P4}) (place "Stick1" (sites Bottom)) (place "Stick2" (sites Top))}) (play ("RollMove" (if (or (is Mover P1) (is Mover P3)) (forEach Site (sites Occupied by:Team1) ("Move" Team1)) (forEach Site (sites Occupied by:Team2) ("Move" Team2))) (then (if ("SpecialThrows") (moveAgain))))) (end (if ("AllPiecesInOpponentHome") { (if (= ("PiecesOwnedBy" Team1) ("PiecesOwnedBy" Team2)) (result Mover Draw)) (if (< ("PiecesOwnedBy" Team1) ("PiecesOwnedBy" Team2)) (result Team2 Win)) (if (> ("PiecesOwnedBy" Team1) ("PiecesOwnedBy" Team2)) (result Team1 Win))}))))
###
| (define "PiecesOwnedBy" (count Sites in:(sites Occupied by:#1))) (define "AllPiecesInOpponentHome" (and (= 0 (count Sites in:(difference (sites Occupied by:Team1) (sites P2 "Home")))) (= 0 (count Sites in:(difference (sites Occupied by:Team2) (sites P1 "Home")))))) (define "Move" (move (from (site)) (to ("NextSiteOnTrack" "ThrowValue") if:(and (or (is Empty (to)) (and (not (is In (to) (sites Next "Home"))) ("IsEnemyAt" (to)))) ("NoFriendPieceInBetween" #1)) "CaptureEnemyPiece"))) (define "NoFriendPieceInBetween" (= 1 (count Sites in:(intersection (sites Occupied by:#1) (sites Track Mover "Track" from:(from) to:("NextSiteOnTrack" "ThrowValue")))))) (define "CaptureEnemyPiece" (apply if:("IsEnemyAt" (to)) (remove (to)))) (define "SpecialThrows" (is In ("ThrowValue") (sites {1 4}))) (define "ThrowValue" (mapEntry (count Pips))) (game "Sig (Western Sahara)" (players 4) (equipment { (board (rectangle 4 22) { (track "Track1" "0,E,N1,W,N1,E,N1,W" P1 directed:True) (track "Track2" "87,W,S1,E,S1,W,S1,E" P2 directed:True) (track "Track3" "0,E,N1,W,N1,E,N1,W" P3 directed:True) (track "Track4" "87,W,S1,E,S1,W,S1,E" P4 directed:True)} use:Vertex) (piece "Stick" Each) (regions "AllSites" (sites Board)) ("StickDice" 8) (map "Throw" {(pair 0 8) (pair 1 1) (pair 2 6) (pair 3 5) (pair 4 4) (pair 5 5) (pair 6 6) (pair 7 1) (pair 8 8)}) (regions "Home" P1 (sites Bottom)) (regions "Home" P2 (sites Top)) (regions "Home" P3 (sites Bottom)) (regions "Home" P4 (sites Top))}) (rules (start { (set Team 1 {P1 P3}) (set Team 2 {P2 P4}) (place "Stick1" (sites Bottom)) (place "Stick2" (sites Top))}) (play ("RollMove" (if (or (is Mover P1) (is Mover P3)) (forEach Site (sites Occupied by:Team1) ("Move" Team1)) (forEach Site (sites Occupied by:Team2) ("Move" Team2))) (then (if ("SpecialThrows") (moveAgain))))) (end (if ("AllPiecesInOpponentHome") { (if (= ("PiecesOwnedBy" Team1) ("PiecesOwnedBy" Team2)) (result Mover Draw)) (if (< ("PiecesOwnedBy" Team1) ("PiecesOwnedBy" Team2)) (result Team2 Win)) (if (> ("PiecesOwnedBy" Team1) ("PiecesOwnedBy" Team2)) (result Team1 Win))})))) END |
Construct a Ludii game based on the following description
Twenty-three spaces are arranged in a line: the outer space on each side and the central space are a circular holes, the intervening spaces are vertically-oriented trenches. A stick is laid in each trench, and a stick is stuck into the ground in each end hole, one belonging to each player. They move their sticks toward the opposite end of the track and then go back to their starting point, according to the throw of four stick dice, with one flat and one convex side. The values of the throws are as follows: 4 convex sides up = 4, 3=0, 2=1, 1=0, 0=2. Players continue to throw and move until obtaining a result of 0. When the player passes the central hole, they remove the sticks from the trenches in which they land. If the player lands in the central hole, and throws a 0 on their next throw, they must then return to the space nearest to their home still containing a stick. If the player lands on the same place as the opponent, the opponent is sent back to the space nearest their home which still has a stick in it, thus eliminating this stick. The goal is to eliminate all of the sticks from the opponent's side of the board and then to land on the same space as the opponent's playing stick. If both players are in the end stage and trying to land on each other, and a player lands in the central space and then throws a 0, the game is a draw.
###
| (define "NearestHomeWithStick" (if (= #1 P1) (if (= (id "Stick" Neutral) (what at:1)) 1 (if (= (id "Stick" Neutral) (what at:2)) 2 (if (= (id "Stick" Neutral) (what at:3)) 3 (if (= (id "Stick" Neutral) (what at:4)) 4 (if (= (id "Stick" Neutral) (what at:5)) 5 (if (= (id "Stick" Neutral) (what at:6)) 6 (if (= (id "Stick" Neutral) (what at:7)) 7 (if (= (id "Stick" Neutral) (what at:8)) 8 (if (= (id "Stick" Neutral) (what at:9)) 9 (if (= (id "Stick" Neutral) (what at:10)) 10 (if (= (id "Stick" Neutral) (what at:11)) 11 Off))))))))))) (if (= (id "Stick" Neutral) (what at:22)) 22 (if (= (id "Stick" Neutral) (what at:21)) 21 (if (= (id "Stick" Neutral) (what at:20)) 20 (if (= (id "Stick" Neutral) (what at:19)) 19 (if (= (id "Stick" Neutral) (what at:18)) 18 (if (= (id "Stick" Neutral) (what at:17)) 17 (if (= (id "Stick" Neutral) (what at:16)) 16 (if (= (id "Stick" Neutral) (what at:15)) 15 (if (= (id "Stick" Neutral) (what at:14)) 14 (if (= (id "Stick" Neutral) (what at:13)) 13 (if (= (id "Stick" Neutral) (what at:12)) 12 Off))))))))))))) (define "Centre" 12) (define "NotThrow0" (!= 0 ("ThrowValue"))) (define "ThrowValue" (mapEntry "Throw" (count Pips))) (game "Chukaray" (players 2) (equipment { (board (rectangle 1 25) { (track "Track1" {0..23} loop:True P1) (track "Track2" {23..0} loop:True P2)} use:Edge) ("StickDice" 4) (piece "Stick" Each (move (from (from) level:(level)) (to ("NextSiteOnTrack" ("ThrowValue") from:(from)) if:True (apply (and (if ("IsEnemyAt" (to)) (if ("IsOffBoard" ("NearestHomeWithStick" (who at:(to)))) (remove (to)) (fromTo (from (to)) (to ("NearestHomeWithStick" (who at:(to))))))) (if (and { (is Occupied (to)) ("IsPieceAt" "Stick" Neutral (to) level:0) (is In (to) (sites Next "Side"))}) (remove (to) level:0))))))) (piece "Stick" Neutral) (map "Throw" {(pair 0 2) (pair 1 0) (pair 2 1) (pair 3 0) (pair 4 4)}) (regions "Side" P1 (sites {0..11})) (regions "Side" P2 (sites {13..23}))}) (rules (start { (place Stack "Stick1" 0) (place Stack "Stick2" 23) (place Stack "Stick0" (sites {1..11 13..22}))}) (play ("RollMove" (if ("NotThrow0") (forEach Piece) (if (= ("Centre") (where "Stick" Mover)) (if ("IsNotOffBoard" ("NearestHomeWithStick" (mover))) (move (from (where "Stick" Mover)) (to ("NearestHomeWithStick" (mover)))) (if (and ("IsOffBoard" ("NearestHomeWithStick" (mover))) ("IsOffBoard" ("NearestHomeWithStick" (next)))) (move Pass (then (trigger "Draw" Mover))))))) (then (if ("NotThrow0") (moveAgain))))) (end { ("CaptureAll" Next) (if (is Triggered "Draw" Mover) (result Mover Draw))}))) END |
Construct a global Ludii definition which fulfills the following requirements.
Checks if a die is not used when using the ludeme (forEach Die ...).
###
| (define "DieNotUsed" (!= (pips) 0)) END |
Construct a Ludii game based on the following description
4x6-7 board. Two counters in each hole; before beginning each player rearranges these as they wish, with the following rules: The leftmost hole in the outer row must have the most counters; holes in the inner row may only have one counter. Initial phase: In this phase, only holes with two or fewer counters may be used to sow. Sowing occurs in an anti-clockwise direction, and when a counter lands in an occupied hole the sowing continues. When the final counter lands in an empty hole, the turn ends. If the empty hole is in the player's inner row, counters in the opponent's inner row opposite are captured, and if there are also counters in the opponent's outer row hole opposite, these are also taken. The initial phase ends for a player when two of the player's counters have been taken. On the next turn they must play from the hole with the largest number of counters, and from that point they may move from any hole. The rules for play remain the same as in the initial phase otherwise. The player who captures all of the opponent's counters wins. Each player has 6 holes by row.
###
| (define "SitesWithMaxCounter" (forEach (sites Mover "Home") if:(= (max (results from:(sites Mover "Home") to:(sites Mover "Home") (count at:(to)))) (count at:(site))))) (define "OnlyOneInInner" (all Sites (sites Mover "Inner") if:(= 1 (count at:(site))))) (define "LeftMostCounters" (all Sites (difference (sites Mover "Home") (mapEntry "LeftMost" Mover)) if:(> (count at:(mapEntry Mover)) (count at:(site))))) (define "Columns" 6) (game "Quela" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "TrackCCW1" "0,E,N1,W" loop:True P1) (track "TrackCCW2" "12,E,N1,W" loop:True P2)}) (regions "Home" P1 (sites Track "TrackCCW1")) (regions "Home" P2 (sites Track "TrackCCW2")) (regions "Inner" P1 (difference (sites Track "TrackCCW1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "TrackCCW2") (sites Top))) (map "LeftMost" {(pair P1 0) (pair P2 23)}) (piece "Seed" Shared) (hand Each)}) (rules (start (set Count 2 to:(union (sites P1 "Home") (sites P2 "Home")))) phases:{ (phase "Rearrangement" (play (or (move (from (sites Mover "Home") if:(is Occupied (from))) (to (difference (sites Mover) (from)))) (if (and ("LeftMostCounters") ("OnlyOneInInner")) (move Pass)))) (nextPhase (all Passed) "InitialPhase")) (phase "InitialPhase" (play (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover "Home")) if:(or ("SameTurn") (and (> 3 (count at:(from))) (is Occupied (from))))) (then (sow "TrackCCW" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover "Inner")) (if (is Occupied ("OppositePit" (to))) (and (fromTo (from ("OppositePit" (to))) (to (handSite Mover)) count:(count at:("OppositePit" (to)))) (if (is Occupied ("OppositeOuterPit" (to))) (fromTo (from ("OppositeOuterPit" (to))) (to (handSite Mover)) count:(count at:("OppositeOuterPit" (to))))))))))))) { (nextPhase P1 (< 1 (count Cell at:(handSite P2))) "MiddlePhase") (nextPhase P2 (< 1 (count Cell at:(handSite P1))) "MiddlePhase")}) (phase "MiddlePhase" (play (move Select (from ("SitesWithMaxCounter")) (then (sow "TrackCCW" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover "Inner")) (if (is Occupied ("OppositePit" (to))) (and (fromTo (from ("OppositePit" (to))) (to (handSite Mover)) count:(count at:("OppositePit" (to)))) (if (is Occupied ("OppositeOuterPit" (to))) (fromTo (from ("OppositeOuterPit" (to))) (to (handSite Mover)) count:(count at:("OppositeOuterPit" (to))))))))))))) (nextPhase Mover "FinalPhase")) (phase "FinalPhase" (play (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover "Home")) if:(is Occupied (from))) (then (sow "TrackCCW" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover "Inner")) (if (is Occupied ("OppositePit" (to))) (and (fromTo (from ("OppositePit" (to))) (to (handSite Mover)) count:(count at:("OppositePit" (to)))) (if (is Occupied ("OppositeOuterPit" (to))) (fromTo (from ("OppositeOuterPit" (to))) (to (handSite Mover)) count:(count at:("OppositeOuterPit" (to))))))))))))) (end ("BlockWin")))})) END |
Construct a global Ludii definition which fulfills the following requirements.
Defines a leap move to empty or enemy sites. The enemy pieces are removed.
###
| (define "LeapCapture" (move Leap #1 (to if:(not ("IsFriendAt" (to))) (apply (if ("IsEnemyAt" (to)) (remove (to) #2)))) #3)) END |
Construct a Ludii game based on the following description
The same rules as Tic-Tac-Toe are used with four players in a 5x5 board. The third and fourth players play with \
###
| (game "Tic-Tac-Four" (players 4) (equipment { (board (square 5)) (piece "Disc" P1) (piece "Cross" P2) (piece "Y" P3) (piece "Z" P4)}) (rules (play (move Add (to (sites Empty)))) (end ("Line3Win")))) END |
Construct a Ludii game based on the following description
2x6 board with two stores. Four counters per hole. Sowing occurs in an anti-clockwise direction. In the first and second moves, players may choose to drop as many counters as they wish into the holes they are sowing into. From the third turn on, the players must sow one counter at a time. The hole from which a sowing began is skipped if the sowing goes all the way around the board. When the final counter lands in a hole containing one or two people, thus causing it to contain two or three, these are captured. Any previous holes, in an unbroken sequence, also containing two or three counters, are captured. A move of a single counter cannot capture. When a player's row is empty, the opponent must sow into their row if it is possible to do so. Play ends when one player's row is empty, and the opponent claims all of the remaining counters. The player with the most counters wins.
###
| (define "NextHole" ("NextSiteOnTrack" 1 from:(last To) "Track")) (define "PiecesOwnedBy" (+ (count at:(mapEntry #1)) (count in:(sites #1)))) (define "Columns" 6) (game "Ti" (players 2) (equipment { (mancalaBoard 2 "Columns" (track "Track" "1,E,N,W" loop:True)) (regions "Home" P1 (sites Bottom)) (regions "Home" P2 (sites Top)) (map {(pair P1 FirstSite) (pair P2 LastSite)}) (piece "Seed" Shared)}) (rules (start (set Count 4 to:(sites Track))) phases:{ (phase "TwoFirstTurn" (play (if ("SameTurn") (forEach Value min:1 max:(var "NumCounters") (move Add (piece (id "Seed" Shared)) (to ("NextHole") (apply (set Var "NumCounters" (- (var "NumCounters") (value))))) count:(value) (then (if (< 0 (var "NumCounters")) (moveAgain) (set Value Mover (+ 1 (value Player Mover))))))) (move Select (from (sites Mover "Home") if:(> (count at:(from)) 0)) (then (and { (moveAgain) (remove (last To) count:(count at:(last To))) (set Var "NumCounters" (count at:(last To)))}))))) (nextPhase Mover (= (value Player Mover) 1) "Sowing")) (phase "Sowing" (play (do (or (move Select (from (sites Mover "Home") if:(> (count at:(from)) 1)) (then (sow if:(or (= (count at:(to)) 2) (= (count at:(to)) 3)) apply:(fromTo (from (to)) (to (mapEntry (mover))) count:(count at:(to))) includeSelf:False backtracking:True))) (move Select (from (sites Mover "Home") if:(= (count at:(from)) 1)) (then (sow)))) ifAfterwards:(< 0 (count in:(sites Next "Home"))))))} (end ("MancalaByScoreWhen" (no Moves Mover))))) END |
Describe the mechanics of the following Ludii game
(define "PiecesOwnedBy" (+ (count Cell at:(handSite #1)) (count in:(forEach (sites Board) if:(= (id #1) (state at:(site))))))) (define "NoFreeSeed" (all Sites (forEach (sites Board) if:(= 0 (state at:(site)))) if:(= 0 (count at:(site))))) (define "Columns" 6) (game "Gamacha (Nobility)" (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)}) (rules (start (set Count 4 to:(sites Track))) (play (move Select (from (if ("SameTurn") ("LastHoleSowed") (sites Mover)) if:(and (< 0 (count at:(from))) (= 0 (state at:(from))))) (then (sow apply:(if (and (is In (to) (sites Mover)) (= 1 (count at:(to)))) (if (= 1 (count at:("OppositePit" (to)))) (fromTo (from ("OppositePit" (to))) (to (handSite Mover)) count:1)) (if (< 1 (count at:(to))) (and (moveAgain) (if (and {(is In (to) (sites Next)) (= 0 (state at:(to))) (= 4 (count at:(to)))}) (set State at:(to) (mover)))))))))) (end ("MancalaByScoreWhen" ("NoFreeSeed")))))
###
| 2x6 board. Four counters in each hole. Sowing occurs in an anti-clockwise direction. When the final counter of a sowing lands in an empty hole on the player's own row, the contents of the opponent's opposite hole are captured only if it contains one counter. If the final counter lands in an occupied hole, the contents of it are picked up and sowing continues. If the final counter lands in a hole in the opponent's row, causing it to contain four counters, the hole becomes a qasamo, and it can no longer be sown from. Play continues until all of the counters are captured or are in a qasamo. The player with the most counters captured and in all qasamo belonging to them wins. 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; Kings (1): can move one space orthogonally or diagonally. Castling, En Passant, and Pawn promotion allowed. Play begins by each player moving two of their pieces in the same turn, provided that neither enter the opponent's half of the board. 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.
###
| (define "CaptureForwardDiagonal" (move Step (directions {FR FL}) (to if:("IsEnemyAt" (to)) (apply (remove (to)))))) (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)) (define "NextCanNotMove" (not (can Move (do (forEach Piece Next) ifAfterwards:(not ("IsInCheck" "King" Next)))))) (game "Shakhmaty" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) (piece "Pawn" Each (or { (if (is In (from) (sites Start (piece (what at:(from))))) ("DoubleStepForwardToEmpty" "SetEnPassantLocation")) "StepForwardToEmpty" "CaptureForwardDiagonal" "EnPassant"} (then (if (is In (last To) (sites Mover "Promotion")) (moveAgain))))) (piece "Rook" Each (move Slide Orthogonal (to if:("IsEnemyAt" (to)) "CaptureToPiece") "RememberPieceHasMoved")) (piece "King" Each (move Step (to if:(not ("IsFriendAt" (to))) "CaptureToPiece") "RememberPieceHasMoved")) (piece "Bishop" Each (move Slide Diagonal (to if:("IsEnemyAt" (to)) "CaptureToPiece"))) (piece "Knight" Each (move Leap "KnightWalk" (to if:(not ("IsFriendAt" (to))) "CaptureToPiece"))) (piece "Queen" Each (move Slide (to if:("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)) (regions "Half" P1 (expand (sites Bottom) steps:3)) (regions "Half" P2 (expand (sites Top) steps:3))}) (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)}) phases:{ (phase "Opening" (play (do (forEach Piece) ifAfterwards:(and (is In (last To) (sites Mover "Half")) (not ("IsInCheck" "King" Mover))) (then (if ("NewTurn") (moveAgain))))) (nextPhase Mover ("SameTurn") "Playing")) (phase "Playing" (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 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 (if (and ("IsInCheck" "King" Next) ("NextCanNotMove")) (result Mover Win))))) END |
Construct a Ludii game based on the following description
4x5 or 8 board. One counter in each hole. Players alternate turns picking up the counters in one of their holes and sowing them in an anti-clockwise direction. When the final counter lands in a hole with counters, these counters are picked up and sowing continues. When the final counter lands in an empty hole in the inner row, any counters in the opponent's opposite inner row hole are captured, and if this capture was possible, any counters in the outer row hole are also captured. The player who captures all of the opponent's counters wins. Each player has 6 holes per row.
###
| (define "PiecesOwnedBy" (+ (count Cell at:(handSite #1)) (count in:(sites #1 "Home")))) (define "Columns" 5) (game "Nchayo" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "Track1" "0,E,N1,W" loop:True P1) (track "Track2" "10,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 1 to:(sites Board))) (play (move Select (from (if ("SameTurn") ("LastHoleSowed") (sites Mover "Home")) if:(is Occupied (from))) (then (sow "Track" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover "Inner")) (if (is Occupied ("OppositePit" (to))) (and (fromTo (from ("OppositePit" (to))) (to (handSite Mover)) count:(count at:("OppositePit" (to)))) (if (is Occupied ("OppositeOuterPit" (to))) (fromTo (from ("OppositeOuterPit" (to))) (to (handSite Mover)) count:(count at:("OppositeOuterPit" (to))))))))))))) (end ("MancalaByScoreWhen" (no Moves Next))))) END |
Construct a Ludii game based on the following description
Three concentric squares, with lines connecting the diagonals and the midpoints of the sides. Twelve pieces per player. Players alternate turns placing a piece on an empty spot on the board. When a player places three pieces in a row along one of the lines on the board, they remove one of the pieces belonging to the opponent. When all of the pieces have been placed, players alternate turns moving a piece to an empty adjacent spot along the lines. The first player to capture all of the opponent's pieces wins.
###
| (game "Tule Paid" (players 2) (equipment { (board (concentric Square rings:3 joinCorners:True) use:Vertex) (hand Each) (piece "Marker" Each ("StepToEmpty" ~ (then ("ReplayIfLine3"))))}) (rules (start (place "Marker" "Hand" count:12)) phases:{ (phase "Placement" (play (if "SameTurn" "RemoveAnyEnemyPiece" (move (from (handSite Mover)) (to (sites Empty)) (then ("ReplayIfLine3"))))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) (phase "Movement" (play (if "SameTurn" "RemoveAnyEnemyPiece" (forEach Piece))))} (end ("CaptureAll" Next)))) END |
Construct a Ludii game based on the following description
Three concentric squares, with lines connecting the diagonals and the midpoints of the sides. Twelve pieces per player. Players alternate turns placing one of their pieces on one of the empty intersections of the board. If a player places three of their stones in a straight line, the player may remove one of the opponent's pieces. When all of the pieces have been placed, the players alternate turns moving one of their pieces to an empty adjacent point along the lines of the board. When a player is reduced to three pieces, they may move one of their stone to any empty space on the board. The player who reduces their opponent to two pieces wins.
###
| (define "RemoveEnemyPiece" (if (can Move ("RemoveAnyEnemyPieceNotInLine3" Orthogonal)) ("RemoveAnyEnemyPieceNotInLine3" Orthogonal) ("RemoveAnyEnemyPiece"))) (game "Tsoro Yemutwelve" (players 2) (equipment { (board (concentric Square rings:3 joinCorners:True) use:Vertex) (hand Each) (piece "Marker" Each ("StepToEmpty" ~ (then ("ReplayIfLine3" Orthogonal exact:True))))}) (rules (start (place "Marker" "Hand" count:12)) phases:{ (phase "Placement" (play (if "SameTurn" "RemoveEnemyPiece" (move (from (handSite Mover)) (to (sites Empty)) (then ("ReplayIfLine3" Orthogonal exact:True))))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) (phase "Movement" (play (if "SameTurn" "RemoveEnemyPiece" (if (> (count Pieces Mover) 3) (forEach Piece) (move (from (sites Occupied by:Mover)) (to (sites Empty)))))))} (end ("HavingLessPiecesLoss" Next 2)))) END |
Construct a global Ludii definition which fulfills the following requirements.
Defines a circle board defined with 40 stones, with a gap after each 10 stones. The board is playable on the edges.
###
| (define "FortyStonesWithFourGapsBoard" (board (add (remove (concentric {44}) vertices:{43 21 0 22}) edges:{{20 18} {0 1} {19 21} {38 39}}) #1 use:Edge)) END |
Describe the mechanics of the following Ludii game
(game "Wari (Alignment)" (players 2) (equipment { (board (square 6)) (hand Each) (piece "Marker" Each (if (is Line 4 Orthogonal through:(from)) ("StepToEmpty" Orthogonal) ("StepToEmpty" Orthogonal (then ("ReplayIfLine3" Orthogonal exact:True)))))}) (rules (start (place "Marker" "Hand" count:12)) phases:{ (phase "Placement" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) (phase "Movement" (play (if "SameTurn" ("RemoveAnyEnemyPiece") (forEach Piece))))} (end ("CaptureAll" Next))))
###
| 6x6 board. Twelve pieces per player. Players alternate turns placing a piece on an empty space on the board. No captures may be made in the placement phase. When all of the pieces have been placed, players alternate turns moving a piece orthogonally to an empty adjacent space on the board. When a player places three of their pieces in an orthogonal row, they remove one of the opponent's pieces. Lines of four or more do not capture. Moving a piece out of a line of four or more, making it now a line of three, does not capture. Lines of three made during the placement phase also do not result in capture. The player who captures all of the opponent's pieces wins. END |
Construct a Ludii game based on the following description
2x12 board, with spaces as points, divided in two. Fifteen pieces per player, which start stacked, two on the players' first three points and three in the next three points. Two six-sided dice. Players unstack the pieces by moving pieces off of the stack, but remaining on the same point, according to the throws of the dice. The value of the throw indicates the number of the point which can be unstacked. For example, a throw of 1 and 4 allows the player to unstack the pieces on points 1 and 4. Doubles allow the player to unstack all pieces on that point. The player then bears off the pieces from this quadrant of the board. Players bear off the pieces in the same manner as they were unstacked. The first player to bear off all their pieces wins.
###
| (define "UnstackHalf" (forEach Level (last To) (set State at:(last To) level:(level) 1))) (define "UnstackFull" (forEach Level (last To) (set State at:(last To) level:(level) 2))) (define "PieceStacked" (or ("PieceFullStacked" #1) ("PieceHalfStacked" #1))) (define "PieceHalfStacked" (= (state at:#1) 1)) (define "PieceFullStacked" (= (state at:#1) 0)) (define "PieceUnstacked" (= (state at:#1) 2)) (define "RemoveAPiece" (move Remove (from))) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" (pips))) (define "SiteToSelect" ("NextSiteOnTrack" (- (pips) 1) from:(mapEntry "StartTrack" (mover)))) (game "Kiz Tavlasi" (players 2) (equipment { ("BackgammonBoard" { (track "Track1" {7..12} P1 directed:True) (track "Track2" {18..13} P2 directed:True)}) (dice d:6 num:2) (piece "Disc" Each (forEach Die if:("DieNotUsed") (if ("IsOffBoard" "SiteToMoveOnTrack") "RemoveAPiece" (move (from) (to "SiteToMoveOnTrack"))))) (map "StartTrack" {(pair P1 7) (pair P2 18)})}) (rules (start { (place Stack "Disc1" (sites {7..9}) count:2) (place Stack "Disc1" (sites {10..12}) count:3) (place Stack "Disc2" (sites {13..15}) count:3) (place Stack "Disc2" (sites {16..18}) count:2)}) phases:{ (phase "UnStacking" (play ("RollEachNewTurnMove" (forEach Die if:("DieNotUsed") (or (if ("PieceFullStacked" "SiteToSelect") (move Select (from ("SiteToSelect")) (then (and (if (= 3 (size Stack at:(last To))) ("UnstackHalf") ("UnstackFull")) ("ReplayNotAllDiceUsed"))))) (if ("PieceHalfStacked" "SiteToSelect") (move Select (from ("SiteToSelect")) (then (and ("UnstackFull") ("ReplayNotAllDiceUsed"))))))))) (nextPhase Mover (all Sites (sites Occupied by:Mover) if:(not ("PieceStacked" (site)))) "BearingOff")) (phase "BearingOff" (play (do (if (or (all DiceEqual) ("NewTurn")) (roll)) next:(forEach Piece top:True) (then (if (not (all DiceUsed)) (moveAgain))))) (end ("EscapeWin")))})) END |
What does the following global Ludii definition do?
(define "CrossGraph" (merge (shift 0 (/ (- #2 #1) 2) (rectangle #1 #2 #3)) (shift (/ (- #2 #1) 2) 0 (rectangle #2 #1 #3))))
###
| Defines a regular cross graph tilled by squares (example: Pachisi). END |
Construct a global Ludii definition which fulfills the following requirements.
Defines a custodial capture in all the directions specified (by default Adjacent) to capture a specific piece type owned by the next player. The piece is removed.
###
| (define "CustodialCapturePieceType" (custodial (from (last To)) #2 (between #3 if:("IsPieceAt" #1 Next (between)) (apply (remove (between)))) (to if:("IsFriendAt" (to))) #4)) 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 "Clobber" (players 2) (equipment { (board (rectangle 1 2)) (piece "Marker" Each ("StepToEnemy" Orthogonal))}) (rules (start { (place "Marker1" (sites Phase 1)) (place "Marker2" (sites Phase 0))}) (play (forEach Piece)) (end ("NoMoves" Loss))))
###
| (game "Clobber" (players 2) (equipment { (board (rectangle 2 3)) (piece "Marker" Each ("StepToEnemy" Orthogonal))}) (rules (start { (place "Marker1" (sites Phase 1)) (place "Marker2" (sites Phase 0))}) (play (forEach Piece)) (end ("NoMoves" Loss)))) END |
Construct a Ludii game based on the following description
5x5 intersecting lines, with the diagonals of every 2x2 square formed. On one side, a triangle, with the apex intersecting with the midpoint of that side. There is a line from the apex to the midpoint of the triangle's base, and another interior triangle, connecting the base of the larger triangle with the midpoints of the sides of the larger triangle. One player plays as the Taisho (\
###
| (game "Juroku Musashi" (players 2) (equipment { (board (add (merge (scale 2 (square 5 diagonals:Alternating)) (shift 2 -2 (wedge 3))) vertices:{ {3 -2} {5 -2}} edges:{{25 31} {25 29} {27 29} {27 32}}) use:Vertex) (piece "Marker" P1 "StepToEmpty") (piece "Marker" P2 (or ("HopCapture") ("StepToEmpty")))}) (rules (start { (place "Marker1" (difference (sites Outer) (expand (sites Bottom)))) (place "Marker2" (ahead (centrePoint) N))}) (play (forEach Piece)) (end ("NoMovesP2NoPiecesP1")))) END |
Construct a Ludii game based on the following description
5x5 intersecting lines, with diagonals in each quadrant. Six pieces per player. Players alternate turns placing one of their pieces on an empty spot on the board. When all of the pieces are placed, they alternate turns moving one of their pieces to an empty adjacent spot along the lines of the board. During either phase, when a player places three of their pieces in a row, they may remove one of the opponent's pieces from the board. Pieces which are in a three-in-a-row arrangement cannot be removed from the board. The player who captures all of the opponent's pieces wins.
###
| (game "Altan Xaraacaj" (players 2) (equipment { ("AlquerqueBoard" 5 5) (hand Each) (piece "Marker" Each ("StepToEmpty" ~ (then ("ReplayIfLine3" Orthogonal exact:True))))}) (rules (start (place "Marker" "Hand" count:6)) phases:{ (phase "Placement" (play (if "SameTurn" ("RemoveAnyEnemyPieceNotInLine3" Orthogonal) (move (from (handSite Mover)) (to (sites Empty)) (then ("ReplayIfLine3" Orthogonal exact:True))))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) (phase "Movement" (play (if "SameTurn" ("RemoveAnyEnemyPieceNotInLine3" Orthogonal) (forEach Piece))))} (end ("CaptureAll" Next)))) END |
Construct a global Ludii definition which fulfills the following requirements.
Defines a hop move in all the directions specified (by default Adjacent) over any occupied site to an empty site.
###
| (define "HopAllPiecesToEmpty" (move Hop #1 #2 (between #3 if:(is Occupied (between))) (to if:(is Empty (to))) #4)) END |
Construct a Ludii game based on the following description
A track of eleven squares, with marks in the two outer and central squares. Ten further squares extending from the central square, with markings in the fifth and final squares. Including this fifth square, a square track with eleven squares per side, with a marked square in each corner and middle square of each side. Five pieces per player. Seven cowries used as dice. The number of mouths up equals the value of the throw; when no mouths are up the player loses their turn. Players begin from opposite ends of the bottom track, and proceed up the vertical track, around the square, and then up the remainder of the vertical track. A player must throw a 1, 5, or 7 to enter the board. Throws of 1, 5, or 7 grant the player another throw. If a piece lands on a space occupied by a piece belonging to the opponent, the opponent's piece is removed from the board and must enter again. Pieces resting on a marked square are safe from being sent back. The player who moves all five of their pieces beyond the final space in the vertical row with an exact throw wins.
###
| (define "Move" (or { (forEach Piece) (forEach Piece container:(mover)) (if (and { ("SpecialThrow") ("HandOccupied" Mover) (or (is Empty "StartPoint") ("IsFriendAt" ("StartPoint")))}) (move (from (handSite (mover))) (to ("StartPoint"))))} (then (if ("SpecialThrow") (moveAgain))))) (define "StartPoint" (mapEntry (mover))) (define "SpecialThrow" (or { (= (count Pips) 1) (= (count Pips) 5) (= (count Pips) 7)})) (define "CaptureEnemyPiece" (apply if:("IsEnemyAt" (to)) (fromTo (from (to)) (to (handSite (who at:(to)))) count:(count at:(to))))) (define "RemoveAPiece" (move Remove (from))) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" (count Pips))) (game "Panchi" (players 2) (equipment { (board (merge { (rectangle 1 11) (shift 0 5 (rotate 90 (rectangle 1 11))) (shift 0 5 (rectangle 1 11)) (shift -5 10 (rotate 90 (rectangle 1 11))) (shift 5 10 (rotate 90 (rectangle 1 11))) (shift 0 15 (rectangle 1 11))}) { (track "Track1" "0,E5,N5,W,N,E,S,W5,N,End" P1 directed:True) (track "Track2" "10,W5,N5,E,N,W,S,E5,N,End" P2 directed:True)}) (piece "Pawn" Each (if ("IsEndTrack" "SiteToMoveOnTrack") "RemoveAPiece" (if ("IsNotOffBoard" "SiteToMoveOnTrack") (if (if (not ("IsEnemyAt" "SiteToMoveOnTrack")) True (not (is In "SiteToMoveOnTrack" (sites "Protect")))) (move (from (from) level:(level)) (to "SiteToMoveOnTrack" "CaptureEnemyPiece")))))) ("StickDice" 7) (hand Each) (regions "Protect" (sites {0 10 5 16 21 23 30 36 46 56 51 42})) (map {(pair P1 0) (pair P2 10)})}) (rules (start { (place Stack "Pawn1" (handSite P1) count:5) (place Stack "Pawn2" (handSite P2) count:5)}) (play ("RollMove" (if (can Move ("Move")) ("Move") (move Pass (then (if ("SpecialThrow") (moveAgain))))))) (end ("EscapeWin")))) END |
Construct a Ludii game based on the following description
2x6 board. Four counters in each hole. In the opening phase, the player takes all of the counters in their rightmost hole and places them in the opponent's opposite hole. The player then takes the contents of the next hole, placing all of them into the hole following it, until the entire board has alternating holes with eight and zero counters. When the final hole is made with eight counters, these are picked up and the player sows as normal in an anti-clockwise direction. When the final counter falls into an occupied hole, the counters are picked up and sowing continues. When the final counter falls into an empty hole, the player captures the counters in the opposite hole. If a player cannot play, they must pass their turn until there are counters available for them to play. Play continues until there is one piece or fewer on the board, the player to whom the row in which the single piece is located captures it. A second round is played, each player placing four counters into each hole starting from the rightmost hole in their row. The player with more counters gains a hole from their opponent for every four extra balls they've captured. If an opponent has three extra after counting in such a way, they also gain a hole, and if each player has two remaining counters ownership is determined by chance. Play continues in several rounds like this until one player takes all the counters.
###
| (define "RightMostEmpty" (trackSite FirstSite "TrackCW" from:(mapEntry "RightMost" Mover) if:(is Empty (to)))) (define "RememberOwnedHolesRandom" (if (< 50 (value Random (range 1 100))) (remember Value "OwnedP1" #1) (remember Value "OwnedP2" #1))) (define "RemmemberOwnedHoles" (if (is Mover P1) (remember Value "OwnedP1" #1) (remember Value "OwnedP2" #1))) (define "OwnedHoles" (if (is Mover P1) (sites (values Remembered "OwnedP1")) (sites (values Remembered "OwnedP2")))) (define "OneOrLessPieceOnBoard" (>= 1 (count Pieces All in:(sites Board)))) (define "NextHole" ("NextSiteOnTrack" #2 from:#1 "Track")) (define "Columns" 6) (game "Jimafesosh" (players 2) (equipment { (mancalaBoard 2 "Columns" store:None { (track "TrackCCW" "0,E,N,W" loop:True) (track "TrackCW" "5,W,N,E" loop:True)}) (piece "Seed" Shared) (hand Each) (map "RightMost" {(pair P1 5) (pair P2 6)}) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start { (set RememberValue "OwnedP1" (sites Bottom)) (set RememberValue "OwnedP2" (sites Top)) (set Count 4 to:(sites Track "TrackCCW"))}) phases:{ (phase "Opening1" (play (move Select (from (if ("SameTurn") (var "Replay") 5)) (then (sow numPerHole:4 "TrackCCW" apply:(and (moveAgain) (if (is Occupied ("NextHole" (to) 1)) (set Var "Replay" ("NextHole" (to) 1)) (set Var "Replay" Undefined))))))) (nextPhase (= Undefined (var "Replay")) "Opening2")) (phase "Opening2" (play (move Select (from (if (and ("SameTurn") (!= Undefined (var "Replay"))) (var "Replay") 4)) (then (sow "TrackCCW" apply:(if (< 1 (count at:(to))) (and (moveAgain) (set Var "Replay" (to))) (if (is Occupied ("OppositePitTwoRows" (to))) (fromTo (from ("OppositePitTwoRows" (to))) (to (handSite Mover)) count:(count at:("OppositePitTwoRows" (to)))))))))) (nextPhase (not (is Next Prev)) "Sowing")) (phase "Sowing" (play (or { (move Select (from (if ("SameTurn") (sites {(var "Replay")}) ("OwnedHoles")) if:(is Occupied (from))) (then (sow "TrackCCW" apply:(if (< 1 (count at:(to))) (and (moveAgain) (set Var "Replay" (to))) (if (is Occupied ("OppositePitTwoRows" (to))) (fromTo (from ("OppositePitTwoRows" (to))) (to (handSite Mover)) count:(count at:("OppositePitTwoRows" (to)))))))))} (then (if ("OneOrLessPieceOnBoard") (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 (= 0 (count Cell at:(handSite P1))) (result P2 Win)) (if (= 0 (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 ("RightMostEmpty")) count:4 (then (and { ("RemmemberOwnedHoles" (last To)) (if (= 3 (count Cell at:(handSite Mover))) (and { (fromTo (from (handSite Mover)) (to ("RightMostEmpty")) count:3) (fromTo (from (handSite Next)) (to ("RightMostEmpty")) count:1) ("RemmemberOwnedHoles" ("RightMostEmpty"))}) (if (= 2 (count Cell at:(handSite Mover))) (and { (fromTo (from (handSite Mover)) (to ("RightMostEmpty")) count:2) (fromTo (from (handSite Next)) (to ("RightMostEmpty")) count:2) ("RememberOwnedHolesRandom" ("RightMostEmpty"))})))}))))) (nextPhase (and (is Empty (handSite P1)) (is Empty (handSite P2))) "Sowing"))})) END |
Construct a Ludii game based on the following description
Play using the standard rules of chess.
###
| (define "InitialPawnMove" (if (is In (from) (sites Start (piece (what at:(from))))) ("DoubleStepForwardToEmpty" "SetEnPassantLocation"))) (define "EnPassant" (move Step (directions {FR FL}) (to if:"InLocationEnPassant") (then (remove (ahead (last To) Backward))))) (define "InLocationEnPassant" (and (is Pending) (= (to) (value Pending)))) (define "SetEnPassantLocation" (then (set Pending (ahead (last To) Backward)))) (define "Castling" (if (and { "KingInTheInitialPlace" ("HasNeverMoved" "King") (not ("KingCheck" Mover))}) (or (if (and ("HasNeverMoved" "RookLeft") (can Move ("DoCastle" "RookLeft" E 3 (is Empty (to))))) "BigCastling") (if (and ("HasNeverMoved" "RookRight") (can Move ("DoCastle" "RookRight" W 2 (is Empty (to))))) "SmallCastling")))) (define "BigCastling" ("DoCastle" "King" W 2 "KingNotCheckedAndToEmpty" (then (and ("PieceHasMoved") ("DoCastle" "RookLeft" E 3 True))))) (define "SmallCastling" ("DoCastle" "King" E 2 "KingNotCheckedAndToEmpty" (then (and ("PieceHasMoved") ("DoCastle" "RookRight" W 2 True))))) (define "DoCastle" (move Slide (from (mapEntry #1 (mover))) #2 (between (exact #3) if:#4) #5)) (define "KingNotCheckedAndToEmpty" (and (is Empty (to)) (not (is Threatened (id "King" Mover) at:(to))))) (define "RememberPieceHasMoved" (then (if (= (state at:(last To)) 1) "PieceHasMoved"))) (define "PieceHasMoved" (set State at:(last To) 0)) (define "ThatPieceNeverMoved" (= (state at:(mapEntry #1 (mover))) 1)) (define "HasNeverMoved" (= (state at:(mapEntry #1 (mover))) 1)) (define "KingInTheInitialPlace" (= (what at:(mapEntry "King" (mover))) (id "King" Mover))) (define "KingCheck" (is Threatened (id "King" #1) at:(where "King" #1))) (define "NextCanNotMove" (not (can Move (do (forEach Piece Next) ifAfterwards:(not ("KingCheck" Next)))))) (game "Chess Puzzle" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) ("ChessPawn" "Pawn" (or "InitialPawnMove" "EnPassant") (then (and ("ReplayInMovingOn" (sites Mover "Promotion")) (set Counter)))) ("ChessRook" "Rook" (then (set Counter)) ("RememberPieceHasMoved")) ("ChessKing" "King" (then (set Counter)) ("RememberPieceHasMoved")) ("ChessBishop" "Bishop" (then (set Counter))) ("ChessKnight" "Knight" (then (set Counter))) ("ChessQueen" "Queen" (then (set Counter))) (map "King" {(pair 1 "E1") (pair 2 "E8")}) (map "RookLeft" {(pair 1 "A1") (pair 2 "A8")}) (map "RookRight" {(pair 1 "H1") (pair 2 "H8")}) (regions "Promotion" P1 (sites Top)) (regions "Promotion" P2 (sites Bottom))}) (rules (start { (place "King1" 42) (place "Rook1" 12) (place "King2" 58)}) (play (if "SameTurn" (move Promote (last To) (piece {"Queen" "Knight" "Bishop" "Rook"}) Mover) (do (or (forEach Piece) ("Castling")) ifAfterwards:(not ("KingCheck" Mover))))) (end { (if (and { ("KingCheck" Next) "NextCanNotMove" (<= (count Turns) 1)}) (result P1 Win)) (if (or (no Moves Next) (and (= 1 (count Turns)) (not (is Mover Next)))) (result P1 Loss))}))) END |
Construct a Ludii game based on the following description
EDGES - Each player owns two opposite edges, say, the first player has top and bottom edges, while the second player has left and right edges.
DROP - Each player drops one of his stones on an empty cell.
- If at least one opponent stone is between that stone and another friendly stone (orthogonal or diagonal), then all opponent stones that were between those stones flip their colour.
- Stones cannot be dropped on the opponent's edges (including corners).
GOAL - Wins the first player who manages to do a path connecting his two opposite edges.
- Two tiles diagonally aside are not continuous in a path.
- The corners belong to both edges.
###
| (define "ConnectedEdges" (!= 0 (count Sites in:(forEach (sites Occupied by:#1) if:(is Connected at:(site) Orthogonal #1))))) (game "Troll" (players 2) (equipment { (board (square 8)) (piece "Ball" Each) (regions P1 {(sites Top) (sites Bottom)}) (regions P2 {(sites Left) (sites Right)})}) (rules (play (move Add (to (if (is Mover P1) (difference (sites Empty) (union (sites Left) (sites Right))) (difference (sites Empty) (union (sites Top) (sites Bottom))))) (then (custodial (from (last To)) (between if:("IsEnemyAt" (between)) (apply (and (remove (between)) (add (piece (id "Ball" Mover)) (to (between)))))) (to if:("IsFriendAt" (to))))))) (end { (if ("ConnectedEdges" P1) (result P1 Win)) (if ("ConnectedEdges" P2) (result P2 Win))}))) END |
Construct a Ludii game based on the following description
The game is played on a board with twelve points on either side. The points form a continuous track in a horseshoe shape; each player progresses in opposite directions (one from their bottom right to the top right, the other from their bottom left to their top left). Each player has 15 pieces. The starting position is as such, numbering the points from the origin of each player's track: Point six: five pieces. Point 8: three pieces. Point 13: five pieces. Point 24: two pieces. Players move according to the number on each die by moving one piece the number on one die and another the number on the other die, or by moving one piece twice (once for each die). 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 to the next die roll, counting the origin point as a move of one. They cannot reenter on a point with two or more pieces. No other pieces can move until all of the pieces belonging to that player are removed from the center. When all of a player's pieces are on their final 6 points, they may start removing pieces from the board. They can do so by rolling a 6 to move from the 6th point, and so on down to 1. Players must use all available moves presented by the dice. The first player to remove all of their pieces wins. The winner gains one point, or two points if the opponent has pieces in their starting quadrant.
###
| (define "AllPiecesInFinalQuadrant" ("AllOwnedPiecesIn" (sites Mover "FinalQuadrant"))) (define "EnterPieces" (if (is Occupied (mapEntry "Bar" Mover)) (forEach Die if:("DieNotUsed") (move (from (mapEntry "Bar" Mover)) (to ("NextSiteFrom" (mapEntry "Bar" Mover) (pips)) if:(< (size Stack at:(to)) 2) ("HittingCapture" (mapEntry "Bar" Next)))) (then ("ReplayNotAllDiceUsed"))))) (define "NextSiteFrom" ("NextSiteOnTrack" #2 from:#1)) (game "Nard" (players 2) (equipment { ("BackgammonBoard" ("BackgammonTracksWithBar" End)) (dice d:6 num:2) (map "Bar" {(pair P1 6) (pair P2 19)}) (regions "FinalQuadrant" P1 (sites {20..25})) (regions "FinalQuadrant" P2 (sites {7..12})) (piece "Disc" Each (forEach Die if:("DieNotUsed") (if ("IsEndTrack" ("NextSiteFrom" (from) (pips))) (if ("AllPiecesInFinalQuadrant") (move Remove (from))) (move (from (from)) (to ("NextSiteFrom" (from) (pips)) if:("NoEnemyOrOnlyOne" (to)) ("HittingCapture" (mapEntry "Bar" Next))))) (then ("ReplayNotAllDiceUsed"))))}) (rules (start { (place Stack "Disc1" 7 count:5) (place Stack "Disc1" 4 count:3) (place Stack "Disc1" 13 count:5) (place Stack "Disc1" 25 count:2) (place Stack "Disc2" 20 count:5) (place Stack "Disc2" 17 count:3) (place Stack "Disc2" 0 count:5) (place Stack "Disc2" 12 count:2)}) (play ("RollEachNewTurnMove" (priority { ("EnterPieces") (if (is Empty (mapEntry "Bar" Mover)) (max Distance (forEach Piece top:True)))}) (then (if (no Pieces Mover) (if (no Pieces Enemy in:(sites Mover "FinalQuadrant")) (addScore Mover 1) (addScore Mover 2)))))) (end ("EscapeWin")))) END |
Modify the Ludii game according to the following option changes:
If, at the end of your opponent’s turn, you have at least 4 of your stones and/or stacks in the same rank, or in the same file, you win. -> You win for having any of the following at the end of your opponent’s turn: 3 stones along the outermost files and ranks (a, i, 1, or 9); 4 stones along files b or h, or ranks 2 or 8; and 5 stones along the central files and ranks (c – g and 3 – 7).
(define "OpponentCount" (count Sites in:("OpponentSites" #1 #2))) (define "OpponentSites" (intersection (sites #1 #2) (sites Occupied by:Next container:"Board"))) (define "MoveSecondKnight" (move Add (to ("PossibleKnightSites" (var "CondemnedSite"))) stack:True (then (remove (var "CondemnedSite"))))) (define "MoveFirstKnight" (move Add (to ("PossibleKnightSites" (var "CondemnedSite"))) stack:True (then (do (set Pending) next:(moveAgain))))) (define "MoveCondemnPiece" (move Select (from if:(and ("IsTopLevel" (from)) (<= 2 (count Sites in:("PossibleKnightSites" (from)))))) (then (do (set Var "CondemnedSite" (last From)) next:(do (set State at:(var "CondemnedSite") ("CondemnedState")) next:(moveAgain)))))) (define "PossibleKnightSites" (sites To (move Leap (from #1) { { F F R F} { F F L F} { F R F F} { F L F F}} (to if:("CanPlaceKnight"))))) (define "CanPlaceKnight" (or (is Empty (to)) (and ("IsEnemyAt" (to)) ("IsEmptyOrSingletonStack" (to))))) (define "CondemnedState" 1) (game "Callanish" (players 2) (equipment { (board (square 7)) (piece "Disc" Each ("MoveCondemnPiece"))}) (rules phases: { (phase "Opening" (play (move Add (to (sites Empty)))) (nextPhase (>= (count Turns) 2) "Playing")) (phase "Playing" (play (if "SameTurn" (if (is Pending) ("MoveSecondKnight") ("MoveFirstKnight")) (forEach Piece))))} (end { (if (and (= (% (- (count Moves) 2) 3) 0) (or { (<= 4 ("OpponentCount" Row 0)) (<= 4 ("OpponentCount" Row 1)) (<= 4 ("OpponentCount" Row 2)) (<= 4 ("OpponentCount" Row 3)) (<= 4 ("OpponentCount" Row 4)) (<= 4 ("OpponentCount" Row 5)) (<= 4 ("OpponentCount" Row 6)) (<= 4 ("OpponentCount" Column 0)) (<= 4 ("OpponentCount" Column 1)) (<= 4 ("OpponentCount" Column 2)) (<= 4 ("OpponentCount" Column 3)) (<= 4 ("OpponentCount" Column 4)) (<= 4 ("OpponentCount" Column 5)) (<= 4 ("OpponentCount" Column 6))})) (result Mover Loss)) (if (no Moves Mover) (result Mover Loss))})))
###
| (define "OpponentCount" (count Sites in:("OpponentSites" #1 #2))) (define "OpponentSites" (intersection (sites #1 #2) (sites Occupied by:Next container:"Board"))) (define "MoveSecondKnight" (move Add (to ("PossibleKnightSites" (var "CondemnedSite"))) stack:True (then (remove (var "CondemnedSite"))))) (define "MoveFirstKnight" (move Add (to ("PossibleKnightSites" (var "CondemnedSite"))) stack:True (then (do (set Pending) next:(moveAgain))))) (define "MoveCondemnPiece" (move Select (from if:(and ("IsTopLevel" (from)) (<= 2 (count Sites in:("PossibleKnightSites" (from)))))) (then (do (set Var "CondemnedSite" (last From)) next:(do (set State at:(var "CondemnedSite") ("CondemnedState")) next:(moveAgain)))))) (define "PossibleKnightSites" (sites To (move Leap (from #1) { { F F R F} { F F L F} { F R F F} { F L F F}} (to if:("CanPlaceKnight"))))) (define "CanPlaceKnight" (or (is Empty (to)) (and ("IsEnemyAt" (to)) ("IsEmptyOrSingletonStack" (to))))) (define "CondemnedState" 1) (game "Callanish" (players 2) (equipment { (board (remove (square 9) cells:{0 1 7 8 9 17 63 71 72 73 79 80})) (piece "Disc" Each ("MoveCondemnPiece"))}) (rules phases: { (phase "Opening" (play (move Add (to (sites Empty)))) (nextPhase (>= (count Turns) 2) "Playing")) (phase "Playing" (play (if "SameTurn" (if (is Pending) ("MoveSecondKnight") ("MoveFirstKnight")) (forEach Piece))))} (end { (if (and (= (% (- (count Moves) 2) 3) 0) (or { (<= 3 ("OpponentCount" Row 0)) (<= 4 ("OpponentCount" Row 1)) (<= 5 ("OpponentCount" Row 2)) (<= 5 ("OpponentCount" Row 3)) (<= 5 ("OpponentCount" Row 4)) (<= 5 ("OpponentCount" Row 5)) (<= 5 ("OpponentCount" Row 6)) (<= 4 ("OpponentCount" Row 7)) (<= 3 ("OpponentCount" Row 8)) (<= 3 ("OpponentCount" Column 0)) (<= 4 ("OpponentCount" Column 1)) (<= 5 ("OpponentCount" Column 2)) (<= 5 ("OpponentCount" Column 3)) (<= 5 ("OpponentCount" Column 4)) (<= 5 ("OpponentCount" Column 5)) (<= 5 ("OpponentCount" Column 6)) (<= 4 ("OpponentCount" Column 7)) (<= 3 ("OpponentCount" Column 8))})) (result Mover Loss)) (if (no Moves Mover) (result Mover Loss))}))) END |
Construct a Ludii game based on the following description
Three concentric triangles, with lines connecting their midpoints and corners. Eight pieces per player. Players alternate turns placing a piece on an empty spot on the board. When all of the pieces are placed, players alternate turns moving a piece to an empty adjacent spot along the lines. When a player places three of their pieces in a row, they remove one of the opponent's pieces from the board. A piece that is in a three-in-a-row pattern cannot be removed. The player who removes all of the opponent's pieces wins.
###
| (game "Gurgaldaj" (players 2) (equipment { (board (concentric Triangle rings:3 joinCorners:True) use:Vertex) (hand Each) (piece "Marker" Each ("StepToEmpty" ~ (then ("ReplayIfLine3" Orthogonal))))}) (rules (start (place "Marker" "Hand" count:8)) phases:{ (phase "Placement" (play (if "SameTurn" ("RemoveAnyEnemyPieceNotInLine3" Orthogonal) (move (from (handSite Mover)) (to (sites Empty)) (then ("ReplayIfLine3" Orthogonal))))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) (phase "Movement" (play (if "SameTurn" ("RemoveAnyEnemyPieceNotInLine3" Orthogonal) (forEach Piece))))} (end ("CaptureAll" Next)))) END |
Construct a Ludii game based on the following description
The game is played on a board with twelve points on either side. The points form a continuous track in a horseshoe shape; each player progresses in opposite directions (one from their bottom right to the top right, the other from their bottom left to their top left). Each player has 15 pieces. The starting position is as such, numbering the points from the origin of each player's track: Point six: five pieces Point 8: three pieces Point 13: five pieces Point 24: two pieces. Players move according to the number on each die by moving one piece the number on one die and other the number on the other die, or by moving one piece the total number of both die. 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 "AllPiecesInFinalQuadrant" ("AllOwnedPiecesIn" (sites Mover "FinalQuadrant"))) (define "EnterPieces" (if (is Occupied (handSite Mover)) (forEach Die if:("DieNotUsed") (move (from (handSite Mover)) (to ("NextSiteFrom" (handSite Mover) (pips)) if:(< (size Stack at:(to)) 2) ("HittingCapture" (handSite Next)))) (then ("ReplayNotAllDiceUsed"))))) (define "NextSiteFrom" ("NextSiteOnTrack" #2 from:#1)) (game "Ssang-Ryouk" (players 2) (equipment { (board (add (remove (merge (rectangle 3 6) (shift 7 0 (rectangle 3 6))) vertices:{6 7 8 9 10 11 24 25 26 27 28 29}) edges:{{11 18} {5 12} {0 6} {1 7} {2 8} {3 9} {4 10} {5 11} {12 18} {13 19} {14 20} {15 21} {16 22} {17 23}}) { (track "Track1" "24,17,W,N,E,End" P1 directed:True) (track "Track2" "25,23,W,S,E,End" P2 directed:True)} use:Vertex) (dice d:6 num:2) (piece "Disc" Each (forEach Die if:("DieNotUsed") (if (= End ("NextSiteFrom" (from) (pips))) (if ("AllPiecesInFinalQuadrant") (move Remove (from))) (move (from (from)) (to ("NextSiteFrom" (from) (pips)) if:("NoEnemyOrOnlyOne" (to)) ("HittingCapture" (handSite Next))))) (then ("ReplayNotAllDiceUsed")))) (hand Each) (regions "FinalQuadrant" P1 (sites {18..23})) (regions "FinalQuadrant" P2 (sites {12..17}))}) (rules (start { (place Stack "Disc1" 6 count:5) (place Stack "Disc1" 4 count:3) (place Stack "Disc1" 12 count:5) (place Stack "Disc1" 23 count:2) (place Stack "Disc2" 18 count:5) (place Stack "Disc2" 10 count:3) (place Stack "Disc2" 0 count:5) (place Stack "Disc2" 17 count:2)}) (play ("RollEachNewTurnMove" (priority { ("EnterPieces") (if (is Empty (handSite Mover)) (max Distance (forEach Piece top:True)))}))) (end ("EscapeWin")))) END |
Describe the mechanics of the following Ludii game
(define "PiecesOwnedBy" (+ (count at:(mapEntry #1)) (count in:(sites #1)))) (game "Enindji" (players 2) (equipment { (mancalaBoard 2 6 (track "Track" "1,E,N,W" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 FirstSite) (pair P2 LastSite)}) (piece "Seed" Shared)}) (rules (start (set Count 4 to:(sites Track))) (play (if (is Proposed "End") (or (move Vote "End") (move Vote "No")) (or (if (is Cycle) (move Propose "End")) (do (move Select (from (sites Mover) if:(< 0 (count at:(from)))) (then (sow if:(= (count at:(to)) 4) apply:(fromTo (from (to)) (to (if (is In (to) (sites P1)) (mapEntry 1) (mapEntry 2))) count:(count at:(to))) includeSelf:False))) ifAfterwards:(< 0 (count in:(sites Next))))))) (end ("MancalaByScoreWhen" (and (no Moves Mover) (no Moves Next))))))
###
| 2x6 board, with a storage hole on either end. The game starts with four counters in each hole. A player picks up all of the counters in one of the holes in their row and sows them one-by-one in a counterclockwise direction in consecutive holes from the hole the pieces originated. The starting hole is always left empty, even if a player sows in a complete circuit of the board, the original house is skipped and sowing continues in the next hole after it. When the final counter of a sowing lands in a hole with three counters, the owner of that hole captures the counters. If an opponent's holes are all empty, the other player must make a move placing counters in the opponent's row. If not possible, the player captures all the counters in their row. The player who has captured the most counters wins. If the game continues in a repeating loop, the players can agree to end the game and capture the counters remaining in their row.
END |
Modify the Ludii game according to the following option changes:
Small Size -> Small Size
(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 (+ 14 0)(+ 18 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:6)}) (play "Move") (end (if (no Pieces All) (result P1 Win)))))
###
| (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 (+ 16 0)(+ 21 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:8)}) (play "Move") (end (if (no Pieces All) (result P1 Win))))) END |
Construct a Ludii game based on the following description
Nine concentric circles. Any number of players. Each player plays as one piece. Two nut shells, used as dice. The values are as follows: two round sides = 2; two hollow sides = 1; one of each side = 0. Players move their pieces from outside the circles into progressive rings until they reach Paradise at the center, at which point the piece goes back to the outside of the board. The first player to reach Paradise three times wins. The game involves 8 players.
###
| (define "SiteToMoveOnTrack" ("NextSiteOnTrack" #1)) (define "ThrowValue" (mapEntry "Throw" (count Pips))) (game "Paradis" (players 8) (equipment { (board (concentric {8 8 8 8 8 8 8 8 8 8}) { (track "Track1" {72 64 56 48 40 32 24 16 8 0 8 16 24 32 40 48 56 64 72 64 56 48 40 32 24 16 8 0 8 16 24 32 40 48 56 64 72 64 56 48 40 32 24 16 8 0 8 16 24 32 40 48 56 64} P1 directed:True) (track "Track2" {73 65 57 49 41 33 25 17 9 1 9 17 25 33 41 49 57 65 73 65 57 49 41 33 25 17 9 1 9 17 25 33 41 49 57 65 73 65 57 49 41 33 25 17 9 1 9 17 25 33 41 49 57 65} P2 directed:True) (track "Track3" {74 66 58 50 42 34 26 18 10 2 10 18 26 34 42 50 58 66 74 66 58 50 42 34 26 18 10 2 10 18 26 34 42 50 58 66 74 66 58 50 42 34 26 18 10 2 10 18 26 34 42 50 58 66} P3 directed:True) (track "Track4" {75 67 59 51 43 35 27 19 11 3 11 19 27 35 43 51 59 67 75 67 59 51 43 35 27 19 11 3 11 19 27 35 43 51 59 67 75 67 59 51 43 35 27 19 11 3 11 19 27 35 43 51 59 67} P4 directed:True) (track "Track5" {76 68 60 52 44 36 28 20 12 4 12 20 28 36 44 52 60 68 76 68 60 52 44 36 28 20 12 4 12 20 28 36 44 52 60 68 76 68 60 52 44 36 28 20 12 4 12 20 28 36 44 52 60 68} P5 directed:True) (track "Track6" {77 69 61 53 45 37 29 21 13 5 13 21 29 37 45 53 61 69 77 69 61 53 45 37 29 21 13 5 13 21 29 37 45 53 61 69 77 69 61 53 45 37 29 21 13 5 13 21 29 37 45 53 61 69} P6 directed:True) (track "Track7" {78 70 62 54 46 38 30 22 14 6 14 22 30 38 46 54 62 70 78 70 62 54 46 38 30 22 14 6 14 22 30 38 46 54 62 70 78 70 62 54 46 38 30 22 14 6 14 22 30 38 46 54 62 70} P7 directed:True) (track "Track8" {79 71 63 55 47 39 31 23 15 7 15 23 31 39 47 55 63 71 79 71 63 55 47 39 31 23 15 7 15 23 31 39 47 55 63 71 79 71 63 55 47 39 31 23 15 7 15 23 31 39 47 55 63 71} P8 directed:True)} use:Vertex) ("StickDice" 2) (piece "Marker" Each (move (from (from)) (to ("SiteToMoveOnTrack" ("ThrowValue")) (apply (if (or (and (= 1 ("ThrowValue")) (= (mapEntry "Center" Mover) (to))) (and (= 2 ("ThrowValue")) (or (= (mapEntry "Center" Mover) (to)) (= (mapEntry "Center" Mover) ("SiteToMoveOnTrack" 1))))) (addScore Mover 1)))))) (map "Throw" {(pair 0 2) (pair 1 0) (pair 2 1)}) (map "Center" {(pair P1 0) (pair P2 1) (pair P3 2) (pair P4 3) (pair P5 4) (pair P6 5) (pair P7 6) (pair P8 7)})}) (rules (start { (place "Marker1" 72) (place "Marker2" 73) (place "Marker3" 74) (place "Marker4" 75) (place "Marker5" 76) (place "Marker6" 77) (place "Marker7" 78) (place "Marker8" 79)}) (play ("RollMove" (if (!= ("ThrowValue") 0) (forEach Piece)))) (end (if (= (score Mover) 3) (result Mover Win))))) END |
Construct a Ludii game based on the following description
8x8 board, every other square marked with an X in a checkered pattern. Twelve pieces per player, positioned on the first three rows closest to the player on the marked squares. Players alternate turns moving a piece diagonally forward. A player may capture an opponent's piece by hopping over it to an empty spot on the opposite side of it along the lines. Multiple captures are allowed, if possible. When a player's piece reaches the opposite edge of the board from which it started, it becomes a king. It may move over any distance, diagonally, and may capture by leaping any distance over any number of opponent's pieces, capturing all of them in that line. The king cannot take in multiple directions in one turn. The first player to capture all of the opponent's pieces wins.
###
| (define "HopKing" (move Hop (from) Diagonal (between before:(count Rows) (range 1 9) after:(count Rows) if:(and (not (is In (between) (sites ToClear))) ("IsEnemyAt" (between))) (apply (remove (between)))) (to if:(is Empty (to))) (then ("ReplayIfCanMove" (hop (from (last To)) SameDirection (between before:(count Rows) (range 1 (count Rows)) after:(count Rows) if:(and (not (is In (between) (sites ToClear))) ("IsEnemyAt" (between))) (apply (remove (between)))) (to if:(is Empty (to)))))))) (define "HopKingAgain" (move Hop (from (last To)) SameDirection (between before:(count Rows) (range 1 9) after:(count Rows) if:(and (not (is In (between) (sites ToClear))) ("IsEnemyAt" (between))) (apply (remove (between)))) (to if:(is Empty (to))) (then ("ReplayIfCanMove" (hop (from (last To)) SameDirection (between before:(count Rows) (range 1 (count Rows)) after:(count Rows) if:(and (not (is In (between) (sites ToClear))) ("IsEnemyAt" (between))) (apply (remove (between)))) (to if:(is Empty (to)))))))) (define "JumpToPromotionZone" (is In (last To) (sites Next))) (define "IsUnpromoted" ("IsPieceAt" "Counter" Mover (last To))) (define "HopMan" (move Hop (from #1) Diagonal (between if:(and (not (is In (between) (sites ToClear))) ("IsEnemyAt" (between))) (apply (remove (between) at:EndOfTurn))) (to if:(is Empty (to))) #2)) (game "Moo" ("TwoPlayersNorthSouth") ("DraughtsEquipment" (square 8) ~ (regions "MarkedCell" (sites Phase 0))) (rules ("BlackCellsSetup" 3) (play (if "SameTurn" (or (if "IsUnpromoted" ("HopMan" (last To) (then ("ReplayIfCanMove" ("HopMan" (last To)) ("PromoteIfReach" (sites Next) "DoubleCounter")))) ("HopKingAgain")) (move Pass)) (or (forEach Piece "Counter" (or ("HopMan" (from) (then ("ReplayIfCanMove" ("HopMan" (last To)) ("PromoteIfReach" (sites Next) "DoubleCounter")))) ("StepToEmpty" (directions {FR FL})) (then ("PromoteIfReach" (sites Next) "DoubleCounter")))) (forEach Piece "DoubleCounter" (or ("HopKing") (move Slide Diagonal)))))) (end ("CaptureAll" Next)))) END |
Construct a Ludii game based on the following description
5x5 intersecting lines, with diagonals in each 3x3 quadrant of the board. On one end, a square with diagonals, with one corner as the midpoint of one of the sides of the main board. On the opposite side, a triangle, with a line bisecting the base and another bisecting this line and intersecting with the other two sides of the triangle. The triangle's apex is the midpoint of the opposite side as the square. One player plays with two larger pieces, the Bulls, which start at the points where the triangle and square intersect with the main board. The other player plays with 24 smaller pieces. Eight of these begin on the points surrounding the central point of the board, the rest are in the hand. Players alternate turns. The Bulls move to an empty adjacent spot, the other player places one of the pieces from their hand onto the board. When all of these pieces are on the board, the player may move one of the pieces to an empty adjacent spot. The Bull may captured one of the smaller pieces my hopping over it onto an empty space. The goal of the Bulls is to capture all of the smaller pieces. The goal of the player with the smaller pieces is to corner the bulls so they cannot move. Doing so in the triangle and the square is a better win than cornering the Bulls on the main board.
###
| (game "Bouge Shodra" (players 2) (equipment { (board (merge ("AlquerqueGraphWithBottomTriangle") (rotate 45 (shift 1.5 6.2 (square 2 diagonals:Solid)))) use:Vertex) (hand P1) (piece "Marker" P1 "StepToEmpty") (piece "Bull" P2 (or "StepToEmpty" "HopCapture"))}) (rules (start { (place "Bull2" (sites {"C3" "C7"})) (place "Marker1" (difference (expand (sites Centre)) (centrePoint))) (place "Marker1" (handSite P1) count:16)}) phases:{ (phase "Placement" P1 (play (move (from (handSite P1)) (to (sites Empty)))) (nextPhase Mover ("HandEmpty" P1) "Movement")) ("PhaseMovePiece" "Movement")} (end ("NoMovesP2NoPiecesP1")))) END |
Construct a Ludii game based on the following description
The two players take turns moving stacks of their own color (including singletons - stacks of height one), one stack per turn. Players will always have a move available and must make one.
OBJECT OF THE GAME: Kill the enemy queen, or deprive your opponent of moves.
The pie rule is used in Monkey Queen.
Each player will always have exactly one queen monkey on the board which is a stack of two or more checkers all of the player's own color. Additionally, each player may have one or more baby monkeys on the board which are singletons of his own color.
CAPTURING QUEEN MOVES - A monkey queen captures exactly like a Chess queen. Slide the entire stack in any direction (horizontally, vertically or diagonally) along a straight sequence of unoccupied squares terminated by an enemy occupied square, and capture the enemy queen or baby by replacement.
NOTE: A queen may not give birth to its own baby and kill an enemy baby in the same move.
NOTE: A queen of height two may not make a non-capturing move.
NON-CAPTURING QUEEN MOVES - When not capturing, a queen moves any distance in any one direction, exactly like a Chess queen, except it leaves its bottom checker behind on the originating square, reducing the stack height by one. The queen monkey has thus given birth to a baby monkey.
CAPTURING BABY MOVES - A monkey baby, like a monkey queen, captures exactly like a Chess queen. Slide the baby (singleton) in any direction along a straight sequence of unoccupied squares terminated by an enemy occupied square, and capture the enemy queen or baby by replacement.
NON-CAPTURING BABY MOVES - When not capturing, a baby must move toward the enemy queen in the following sense: The straight line distance between your baby and the enemy queen must be shortened by your move.
NOTE: There's no requirement to make a kill in Monkey Queen.
###
| (game "Monkey Queen" (players 2) (equipment { (board (square 12)) (piece "Marker" (or { (move Slide (to if:("IsEnemyAt" (to)) (apply if:("IsEnemyAt" (to)) (remove (to) count:(size Stack at:(to))))) stack:True (then (if (< 1 (size Stack at:(last To))) (set Value Mover (last To))))) (if (< 2 (size Stack at:(from))) (move Slide stack:True (then (and (fromTo (from (last To) level:0) (to (last From))) (set Value Mover (last To)))))) (if (= 1 (size Stack at:(from))) (move Slide (between if:(and (< (count Steps (to) (value Player Next)) (count Steps (from) (value Player Next))) (is Empty (between))))))}))}) (rules (meta (swap)) (start { (place Stack "Marker1" 6 count:20) (place Stack "Marker2" 137 count:20)}) (play (forEach Piece top:True)) (end (if (or (all Sites (sites Occupied by:Next) if:(= 1 (size Stack at:(site)))) (no Moves Next)) (result Mover Win))))) END |
Construct a Ludii game based on the following description
2x2, 3, 4, or 6 board. Each hole contains a number of counters equal to the total number of holes in the board. Sowing begins from any hole in the player's row, and proceeds anti-clockwise. Counters are captured when the final counter lands in an occupied hole, making it contain 2, 4, 6, or 8 counters. When all of the counters have been captured, a second game begins. Each player fills their holes with the same number of counters as the beginning of the previous game. The player who has extra counters holds these in reserve. The other player will have either empty holes or one without the requisite number to fill the hole. Sowing cannot begin and captures cannot be made from these holes until the contents of these holes reaches the required number of counters to fill them. The second player in the first game now becomes the first player. Play continues with subsequent games until one player captures all the counters.
Evidence Map Each player has 2 holes.
###
| (define "NoPieceOnBoard" (all Sites (union (sites Top) (sites Bottom)) if:(= 0 (count at:(site))))) (define "PlayableSites" (sites (values Remembered "Playable"))) (game "Khrour" (players 2) (equipment { (mancalaBoard 2 2 store:None (track "Track" "0,E,N,W" loop:True)) (piece "Seed" Shared) (hand Each) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start { (set Count 4 to:(sites Track)) (set RememberValue "Playable" (union (sites Top) (sites Bottom)))}) phases:{ (phase "Sowing" (play (or { (move Select (from (sites Mover) if:(and (is Occupied (from)) (is In (from) ("PlayableSites")))) (then (sow apply:(if (and (or { (= 2 (count at:(to))) (= 4 (count at:(to))) (= 6 (count at:(to))) (= 8 (count at:(to)))}) (is In (to) ("PlayableSites"))) (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to)))))))} (then (if ("NoPieceOnBoard") (forget Value "Playable" All) (forEach Site (difference (sites Board) ("PlayableSites")) (if (<= 4 (count at:(site))) (remember Value "Playable" (site)))))))) (end (if ("NoPieceOnBoard") { (if (= 0 (count Cell at:(handSite P1))) (result P2 Win)) (if (= 0 (count Cell at:(handSite P2))) (result P1 Win))})) (nextPhase ("NoPieceOnBoard") "BetweenRounds")) (phase "BetweenRounds" (play (if (not (all Sites (sites Mover) if:(is Occupied (site)))) (if (<= 4 (count Cell at:(handSite Mover))) (move (from (handSite Mover)) (to (sites Mover) if:(is Empty (to))) count:4 (then (remember Value "Playable" (last To)))) (move (from (handSite Mover)) (to (sites Mover) if:(is Empty (to))) count:(count Cell at:(handSite Mover)))))) (nextPhase (all Passed) "Sowing"))})) END |
Modify the Ludii game according to the following option changes:
The diamond board uses a square tiling. -> The board uses a hexagon tiling.
The game is played on a 3x3 board. -> The game is played on a 4x4 board.
(define "HalfBoardSize" (/ (count Cells) 2)) (define "CaptureTheCell" (claim (to Cell (site)) (then (and (addScore Mover 1) (moveAgain))))) (define "NoFreeEdge" ("NoSites" (intersection (sites Incident Edge of:Cell at:(site)) (sites Empty Edge)))) (define "CellOfLastEdge" (sites Incident Cell of:Edge at:(last To))) (game "Dots and Boxes" (players 2) (equipment {(board (square Diamond 3))}) (rules (play (move Add (to Edge (sites Empty Edge)) (then (forEach Site "CellOfLastEdge" (if "NoFreeEdge" "CaptureTheCell"))))) (end (if (> (score Mover) "HalfBoardSize") (result Mover Win)))))
###
| (define "HalfBoardSize" (/ (count Cells) 2)) (define "CaptureTheCell" (claim (to Cell (site)) (then (and (addScore Mover 1) (moveAgain))))) (define "NoFreeEdge" ("NoSites" (intersection (sites Incident Edge of:Cell at:(site)) (sites Empty Edge)))) (define "CellOfLastEdge" (sites Incident Cell of:Edge at:(last To))) (game "Dots and Boxes" (players 2) (equipment {(board (hex 4))}) (rules (play (move Add (to Edge (sites Empty Edge)) (then (forEach Site "CellOfLastEdge" (if "NoFreeEdge" "CaptureTheCell"))))) (end (if (> (score Mover) "HalfBoardSize") (result Mover Win))))) END |
Modify the Ludii game according to the following option changes:
Each player has 12 holes and sow clockwise. -> Each player has 15 holes and sow anti-clockwise.
(define "OnlyOneCounterInEachHole" (all Sites (sites Board) if:(<= (count at:(site)) 1))) (define "NoCounters" (all Sites (sites #1) if:(= 0 (count at:(site))))) (define "NextHole" ("NextSiteOnTrack" 1 from:#1 "Track")) (define "PlayFromLastHole" (last To afterConsequence:True)) (define "Columns" 12) (game "Andada" (players 2) (equipment { (mancalaBoard 2 "Columns" store:None (track "Track" "11,W,N,E" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece "Seed" Shared) (hand Each)}) (rules (start (set Count 2 to:(sites Track))) phases:{ (phase "Opening" (play (move Select (from (if ("SameTurn") (sites {("NextHole" ("PlayFromLastHole"))}) (sites Mover)) if:(> (count at:(from)) 0)) (then (sow (then (if (is Occupied ("NextHole" ("PlayFromLastHole"))) (moveAgain))))))) (nextPhase (is Mover P2) "Playing")) (phase "Playing" (play (move Select (from (if ("SameTurn") (sites {"PlayFromLastHole"}) (sites Mover)) if:(> (count at:(from)) 0)) (then (sow apply:(if (= 1 (count at:(to))) (if ("OnlyOneCounterInEachHole") (if (is In ("NextHole" (to)) (sites Next)) (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to)))) (if (and (is Occupied ("OppositePit" (to))) (is In (to) (sites Mover))) (fromTo (from ("OppositePit" (to))) (to (handSite Mover)) count:(count at:("OppositePit" (to)))))) (moveAgain)))))) (end (forEach Player if:("NoCounters" Player) (result Player Loss))))}))
###
| (define "OnlyOneCounterInEachHole" (all Sites (sites Board) if:(<= (count at:(site)) 1))) (define "NoCounters" (all Sites (sites #1) if:(= 0 (count at:(site))))) (define "NextHole" ("NextSiteOnTrack" 1 from:#1 "Track")) (define "PlayFromLastHole" (last To afterConsequence:True)) (define "Columns" 15) (game "Andada" (players 2) (equipment { (mancalaBoard 2 "Columns" store:None (track "Track" "0,E,N,W" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece "Seed" Shared) (hand Each)}) (rules (start (set Count 2 to:(sites Track))) phases:{ (phase "Opening" (play (move Select (from (if ("SameTurn") (sites {("NextHole" ("PlayFromLastHole"))}) (sites Mover)) if:(> (count at:(from)) 0)) (then (sow (then (if (is Occupied ("NextHole" ("PlayFromLastHole"))) (moveAgain))))))) (nextPhase (is Mover P2) "Playing")) (phase "Playing" (play (move Select (from (if ("SameTurn") (sites {"PlayFromLastHole"}) (sites Mover)) if:(> (count at:(from)) 0)) (then (sow apply:(if (= 1 (count at:(to))) (if ("OnlyOneCounterInEachHole") (if (is In ("NextHole" (to)) (sites Next)) (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to)))) (if (and (is Occupied ("OppositePit" (to))) (is In (to) (sites Mover))) (fromTo (from ("OppositePit" (to))) (to (handSite Mover)) count:(count at:("OppositePit" (to)))))) (moveAgain)))))) (end (forEach Player if:("NoCounters" Player) (result Player Loss))))})) END |
Construct a Ludii game based on the following description
Four players. Played with two six-sided dice. A throw of 5 is counted as 1, a throw of 6 is counted as 4.Throws move the pieces as follows: 1: Pawn or King, which move the same as in Shatranj; 2: Rook, which jumps to the second diagonal space; 3: Horse, which moves orthogonally one space and then diagonally another space, jumping over any intervening pieces; 4: Elephant, which moves orthogonally any distance. Kings may be captured. Pieces are assigned values, which award the players stakes at the end of the game: King=5, Elephant=4, Horse=3, Rook=2, Pawn=1. If a player captures all of the other Kings and is still in possession of their own King, the score awarded is 54. The player with the most points wins.
###
| (define "PlayAPiece" (forEach Die (if (= ("ThrowPipValue") 1) (or (forEach Piece "Pawn") (forEach Piece "King_noCross")) (if (= ("ThrowPipValue") 4) (forEach Piece "Elephant") (if (= ("ThrowPipValue") 3) (forEach Piece "Knight") (if (= ("ThrowPipValue") 2) (forEach Piece "Rook"))))))) (define "CaptureForwardDiagonal" (move Step (directions {FR FL}) (to if:("IsEnemyAt" (to)) ("CaptureToPieceAndAddScore")))) (define "CaptureToPieceAndAddScore" (apply (if (is Occupied (to)) (and { (if (is In (to) (sites {(where "King" P1) (where "King" P2) (where "King" P3) (where "King" P4)})) (set Value Mover (+ (value Player Mover) 1))) (if (and (!= Off (where "King" Mover)) (= (value Player Mover) 1)) (addScore Mover 54)) (addScore Mover (value Piece at:(to))) (remove (to))})))) (define "ThrowPipValue" (mapEntry "Throw" (pips))) (game "Four-Player Chaturanga (al-Biruni)" (players {(player N) (player W) (player S) (player E)}) (equipment { (board (square 8)) (dice d:6 from:1 num:2) (piece "Pawn" Each (or "StepForwardToEmpty" "CaptureForwardDiagonal")) (piece "Rook" Each (move Hop Diagonal (to if:(not ("IsFriendAt" (to))) "CaptureToPieceAndAddScore"))) (piece "Knight" Each (move Leap "KnightWalk" (to if:(not ("IsFriendAt" (to))) "CaptureToPieceAndAddScore"))) (piece "Elephant" Each (move Slide Orthogonal (between if:(is Empty (between))) (to if:("IsEnemyAt" (to)) "CaptureToPieceAndAddScore"))) (piece "King_noCross" Each (move Step (to if:(not ("IsFriendAt" (to))) "CaptureToPieceAndAddScore"))) (map "Throw" {(pair 1 1) (pair 2 2) (pair 3 3) (pair 4 4) (pair 5 1) (pair 6 4)})}) (rules (start { (place "Pawn1" {"A2" "B2" "C2" "D2"} value:1) (place "Pawn2" {"G1" "G2" "G3" "G4"} value:1) (place "Pawn3" {"H7" "G7" "E7" "F7"} value:1) (place "Pawn4" {"B5" "B6" "B7" "B8"} value:1) (place "Rook1" coord:"A1" value:2) (place "Rook2" coord:"H1" value:2) (place "Rook3" coord:"H8" value:2) (place "Rook4" coord:"A8" value:2) (place "Knight1" coord:"B1" value:3) (place "Knight2" coord:"H2" value:3) (place "Knight3" coord:"G8" value:3) (place "Knight4" coord:"A7" value:3) (place "Elephant1" coord:"C1" value:4) (place "Elephant2" coord:"H3" value:4) (place "Elephant3" coord:"F8" value:4) (place "Elephant4" coord:"A6" value:4) (place "King_noCross1" coord:"D1" value:5) (place "King_noCross2" coord:"H4" value:5) (place "King_noCross3" coord:"E8" value:5) (place "King_noCross4" coord:"A5" value:5)}) (play ("RollEachNewTurnMove" "PlayAPiece" (then (if (can Move "PlayAPiece") (moveAgain))))) (end (if (= (count Pieces Mover) (- (count Pieces All) 2)) (byScore))))) END |
Construct a Ludii game based on the following description
Four players. Circular board, with 24 semi-circular sockets along the circumference, divided into four sections of six. Twelve pieces per player; the player's colors are green, red, black, and white, the sections to which they enter are in that order anti-clockwise around the board. Three seven-sided dice. Play proceeds in an anti-clockwise fashion around the board, as is the order of player turns. Players enter their pieces on the board according to the throws of the dice. The player must enter all of their pieces, and then attempt to move all of their pieces in the section of the board belonging to the player sitting opposite them. Once the player achieves this, they begin bearing their pieces off the board. When a piece lands on a spot occupied by a single piece belonging to the opponent, the opponent's piece is returned to the place where it started. When a player bears off all their pieces, they win.
###
| (define "AllPiecesInLastQuadrant" (no Pieces Mover in:(union (sites Hand Mover) (difference (sites Board) (sites Mover "FinalQuadrant"))))) (define "NextSiteFrom" ("NextSiteOnTrack" (pips) from:#1)) (game "El Mundo" (players 4) (equipment { (board (concentric {24}) { (track "Track1" {24 0 2 4 6 8 10 12 14 16 18 20 22 23 21 19 17 15 13} P1 directed:True) (track "Track2" {25 12 14 16 18 20 22 23 21 19 17 15 13 11 9 7 5 3 1} P2 directed:True) (track "Track3" {26 23 21 19 17 15 13 11 9 7 5 3 1 0 2 4 6 8 10} P3 directed:True) (track "Track4" {27 11 9 7 5 3 1 0 2 4 6 8 10 12 14 16 18 20 22} P4 directed:True)} use:Vertex) (dice d:7 num:3) (regions "Mundo" P1 {23 21 19 17 15 13}) (regions "Mundo" P2 {11 9 7 5 3 1}) (regions "Mundo" P3 {0 2 4 6 8 10}) (regions "Mundo" P4 {12 14 16 18 20 22}) (piece "Marker" Each (forEach Die if:("DieNotUsed") (if (and ("AllPiecesInLastQuadrant") (= ("NextSiteFrom" (from)) Off)) (move Remove (from)) (move (from (from)) (to ("NextSiteFrom" (from)) if:("NoEnemyOrOnlyOne" (to)) ("HittingCapture" (handSite (who at:(to))))))) (then ("ReplayNotAllDiceUsed")))) (map "Entry" {(pair P1 0) (pair P2 6) (pair P3 12) (pair P4 18)}) (hand Each) (regions "FinalQuadrant" P1 (sites {13 15 17 19 21 23})) (regions "FinalQuadrant" P2 (sites {1 3 5 7 9 11})) (regions "FinalQuadrant" P3 (sites {10 8 6 4 2 0})) (regions "FinalQuadrant" P4 (sites {22 20 18 16 14 12}))}) (rules (start { (place Stack "Marker1" (handSite P1) count:12) (place Stack "Marker2" (handSite P2) count:12) (place Stack "Marker3" (handSite P3) count:12) (place Stack "Marker4" (handSite P4) count:12)}) (play ("RollEachNewTurnMove" (or (forEach Piece top:True) (forEach Piece container:(mover) top:True)))) (end ("EscapeWin")))) END |
Construct a Ludii game based on the following description
Players move their pieces to an adjacent empty point. The goal is to block the other player from being able to move.
###
| (game "Madelinette" (players 2) (equipment { (board (add (remove ("AlquerqueGraph" 3 3) vertices:{7 1}) edges:{{0 1}}) use:Vertex) (piece "Counter" Each ("StepToEmpty"))}) (rules (start { (place "Counter1" (sites {"A1" "C2" "A3"})) (place "Counter2" (sites {"C1" "A2" "C3"}))}) (play (forEach Piece)) (end ("NoMoves" Loss)))) END |
Construct a Ludii game based on the following description
Same as standard Chess except:
1. The board is initially empty and each player has the normal complement of 16 pieces in reserve.
2. During a turn, a player must do one of three things:
--- place a piece from in hand on an empty square on the board
--- move a previously placed piece to an empty square
--- move a previously placed piece onto a square occupied by an opposing piece, capturing it.
3. Pawns may be entered on the first, second, third or fourth rows only.
4. No en-passant, castling, or initial double-step pawn moves.
5. A player's King must be placed before being allowed to make any capturing moves. A piece that controls the square that the enemy King occupies does not check it until the friendly King is entered onto the board. That is called 'quasi-check'. A player is under no compulsion to move out of quasi-check, and may even move into quasi-check. A player may legally move into quasi-check. Original
###
| (define "PlacePawn" (do (move (from (sites Occupied by:#1 container:"Hand" component:"Pawn")) (to (intersection (sites Empty) (sites #1 "PawnPlacementRows")))) ifAfterwards:True)) (define "KingNotCheckedAndToEmpty" (and (is Empty (to)) (or (not ("IsInCheck" "King" Mover at:(to))) (no Pieces Next "King" in:(sites Board))))) (game "Unachess" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) ("ChessPawn" "Pawn" ~ (then (and ("ReplayInMovingOn" (sites Mover "Promotion")) (set Counter)))) ("ChessRook" "Rook" (then (set Counter))) ("ChessKing" "King" (then (set Counter))) ("ChessBishop" "Bishop" (then (set Counter))) ("ChessKnight" "Knight" (then (set Counter))) ("ChessQueen" "Queen" (then (set Counter))) (map "King" {(pair 1 "E1") (pair 2 "E8")}) (map "RookLeft" {(pair 1 "A1") (pair 2 "A8")}) (map "RookRight" {(pair 1 "H1") (pair 2 "H8")}) (regions "Promotion" P1 (sites Top)) (regions "Promotion" P2 (sites Bottom)) (regions "PawnPlacementRows" P1 (expand (sites Bottom) steps:3)) (regions "PawnPlacementRows" P2 (expand (sites Top) steps:3)) (hand Each size:6)}) (rules (start { (place "Pawn1" (handSite P1 0) count:8) (place "Pawn2" (handSite P2 0) count:8) (place "Rook1" (handSite P1 1) count:2 state:1) (place "Knight1" (handSite P1 2) count:2) (place "Bishop1" (handSite P1 3) count:2) (place "Queen1" (handSite P1 4)) (place "King1" (handSite P1 5) state:1) (place "Rook2" (handSite P2 1) count:2 state:1) (place "Knight2" (handSite P2 2) count:2) (place "Bishop2" (handSite P2 3) count:2) (place "Queen2" (handSite P2 4)) (place "King2" (handSite P2 5) state:1)}) (play (if "SameTurn" (move Promote (last To) (piece {"Queen" "Knight" "Bishop" "Rook"}) Mover) (do (or { (do (move (from (sites Occupied by:Mover container:"Hand" components:{"King" "Queen" "Rook" "Bishop" "Knight"})) (to (sites Empty))) ifAfterwards:True) ("PlacePawn" Mover) (forEach Piece)}) ifAfterwards:(or (not ("IsInCheck" "King" Mover)) (no Pieces Next "King" in:(sites Board)))))) (end { ("Checkmate" "King") (if (or (no Moves Mover) (= (counter) 99)) (result Mover Draw))}))) END |
Describe the mechanics of the following Ludii game
(game "Traffic Lights" (players 2) (equipment { (board (rectangle 3 4)) (piece "Square" Shared) (piece "Triangle" Shared) (piece "Disc" Shared)}) (rules (play (or { (move Add (piece "Square") (to (sites Empty))) (move Select (from (sites Occupied by:Shared component:"Square")) (then (promote (last To) (piece {"Triangle"}) Shared))) (move Select (from (sites Occupied by:Shared component:"Triangle")) (then (promote (last To) (piece {"Disc"}) Shared)))})) (end ("Line3Win"))))
###
| The object is to get a line of three of the same color.
On each turn, you may do ONE of the following:
(1) Put a red counter in an empty square.
(2) Replace a red counter with a yellow one.
(3) Replace a yellow counter with a green one. The game is played on a 3x4 board. END |
Construct a Ludii game based on the following description
This game has two versions: an addition and a deletion version. In the addition version, the graph is initially uncoloured. Players alternate turns, colouring an uncoloured edge in a common colour. However, in the deletion version, the game starts with all the edges coloured. At each turn, a player chooses to remove the colour of an edge. In both versions, the current player loses by turning the coloured graph into a regular graph.
The game is played on the Graph2. The players play on Addition version.
###
| (game "Windir" (players 2) (equipment { (board (complete (subdivide (regular Star 8))) use:Edge) (piece "Marker" Neutral)}) (rules (play (move Add (piece "Marker0") (to Edge (sites Empty Edge)))) (end (if (is RegularGraph Neutral) (result Mover Loss))))) END |
Construct a Ludii game based on the following description
Each player begins with 21 pieces, arranges on the 21 intersections of three consecutive radii. Players alternate turns moving to an empty adjacent spot. Captures are made by hopping over an opponent's piece. The player who captures all of the other player's pieces wins.
###
| (game "Gol Ekuish" (players 2) (equipment { (board (concentric {1 6 6 6 6 6 6 6}) use:Vertex) (piece "Counter" Each (or ("HopRotationalCapture") ("StepRotationalToEmpty")))}) (rules (start { (place "Counter1" (sites {2..4 8..10 14..16 20..22 26..28 32..34 38..40})) (place "Counter2" (sites {1 7 13 19 25 31 37 5 6 11 12 17 18 23 24 29 30 35 36 41 42}))}) (play (forEach Piece)) (end ("NoMoves" Loss)))) END |
Construct a Ludii game based on the following description
Numbers from 1 to n are placed in the squares. Each row and column must add up to the same number and numbers cannot repeat in the row, column, or square.
###
| (game "Magic Square" (players 1) (equipment { (board (square 3) (values Cell (range 1 9))) (regions {Columns Rows Diagonals})}) (rules (play (satisfy { (all Different (sites Board)) (is Sum 15)})) (end (if (is Solved) (result P1 Win))))) END |
Construct a Ludii game based on the following description
17x17 intersecting lines. 151 pieces per player. Each player begins with six larger pieces on the board, on the third line from the perimeter on all four sides, one piece on every fourth intersection, alternating between black and white. These pieces are never moved from the board. There is a star marking at each of these points. Players alternate turns placing one of their pieces on an empty intersection of the board. When a player encloses an area with their pieces, it becomes their territory, and any pieces of the opponent inside it are captured. The opponent cannot place one of their pieces inside a territory won on the previous turn. White plays first. When players can no longer play, the number of counters and each territory are counted to determine the winner.
###
| (define "RemovePreviousTerritoryTaken" (forEach Site (sites Empty) (if (!= 0 (state at:(site))) (set State at:(site) 0)))) (define "CaptureSurroundedPiece" (enclose (from (last To)) Orthogonal (between if:(or ("IsEnemyAt" (between)) (is Empty (between))) (apply (and (if ("IsEnemyAt" (between)) (remove (between))) (set State at:(between) (mover))))))) (game "Mig Mang" (players 2) (equipment { (board (square 17) use:Vertex) (piece "Ball" Each)}) (rules (start { (place "Ball1" (sites {"C7" "K15" "C15" "G3" "O11" "O3"}) state:1) (place "Ball2" (sites {"C3" "K3" "C11" "G15" "O15" "O7"}) state:1)}) (play (move Add (to (sites Empty) if:(= (state at:(to)) 0)) (then (and ("RemovePreviousTerritoryTaken") ("CaptureSurroundedPiece"))))) (end (if (and (no Moves P1) (no Moves P2)) (byScore { (score P1 (+ (count Pieces P1) (size Territory P1))) (score P2 (+ (count Pieces P2) (size Territory P2)))}))))) END |
Construct a Ludii game based on the following description
2x6 board. Play begins with four counters in each hole. Moves begin from any hole in the player's row and sowing proceeds in an anti-clockwise direction. If the final counter of a sowing lands in an occupied hole, these counters are lifted and sowing continues. If the final counter lands in an empty hole, any counters in the opposite hole are taken and the turn ends. Play continues until one player cannot move. When this happens, the other player captures the remaining counters and the game ends. The player with the most counters wins.
###
| (define "PiecesOwnedBy" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (define "Columns" 6) (game "French Wari" (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 4 to:(sites Track))) (play (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover)) if:(> (count at:(from)) 0)) (then (sow apply:(if (> (count at:(to)) 1) (moveAgain) (if (> (count at:("OppositePitTwoRows" (to))) 0) (fromTo (from ("OppositePitTwoRows" (to))) (to (handSite Mover)) count:(count at:("OppositePitTwoRows" (to)))))))))) (end ("MancalaByScoreWhen" (no Moves Mover))))) END |
Describe the mechanics of the following Ludii game
(game "Fettas" (players 2) (equipment { ("NineMensMorrisBoard") (hand Each) (piece "Marker" Each ("StepToEmpty" ~ (then ("ReplayIfLine3" Orthogonal exact:True))))}) (rules (start (place "Marker" "Hand" count:11)) 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 squares, with lines connecting the midpoints of the sides. Eleven pieces per player. Players alternate turns placing a piece on the board. When a player lines up three of their pieces in a row along one of the lines of the board, the player removes one of the opponent's pieces. When all of the pieces are placed, players move their pieces one spot along the lines of the board. The player who captures all of the opponent's pieces wins. END |
Modify the Ludii game according to the following option changes:
12 Holes per row. -> 15 Holes per row.
(define "NextHoleFrom" ("NextSiteOnTrack" 1 from:#1 #2)) (define "AHoleHasMoreThanOneCounter" (not (all Sites (forEach (sites Mover) if:(< 1 (count at:(site)))) if:(= 0 (count at:(site)))))) (define "NoPiece" (all Sites (sites Player "Home") if:(= 0 (count at:(site))))) (define "Columns" 12) (game "Tsoro (Reentered Captures)" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "Track1" "0,E,N1,W" loop:True P1) (track "Track2" "24,E,N1,W" loop:True P2)}) (regions "Home" P1 (sites Track "Track1")) (regions "Home" P2 (sites Track "Track2")) (regions "Inner" P1 (difference (sites Track "Track1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "Track2") (sites Top))) (piece "Seed" Shared)}) (rules (start (set Count 2 to:(union (sites 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)))))
###
| (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" 15) (game "Tsoro (Reentered Captures)" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "Track1" "0,E,N1,W" loop:True P1) (track "Track2" "30,E,N1,W" loop:True P2)}) (regions "Home" P1 (sites Track "Track1")) (regions "Home" P2 (sites Track "Track2")) (regions "Inner" P1 (difference (sites Track "Track1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "Track2") (sites Top))) (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 |
Describe the mechanics of the following Ludii game
(define "RemoveDeadPieces" (forEach Site (forEach (sites Occupied by:#1 container:"Board") if:(= (size Stack at:(site)) 2)) (and (remove (site)) (remove (site))))) (define "RemoveEnemyPiece" (move Remove (forEach (sites Occupied by:Next container:"Board") if:("IsSingletonStack" (site))))) (game "Dig Dig" (players 2) (equipment { (board (concentric Square rings:3 joinCorners:True) use:Vertex) (hand Each) (piece "Marker" Each ("StepToEmpty" ~ (then ("ReplayIfLine3" if:("IsSingletonStack" (to))))))}) (rules (start { (place Stack "Marker1" (handSite P1)) (place Stack "Marker2" (handSite P2))}) phases:{ (phase "Placement" (play (if "SameTurn" "RemoveEnemyPiece" (move (from (handSite Mover)) (to (union (forEach (sites Occupied by:Next container:"Board") if:(= 1 (size Stack at:(site)))) (sites Empty))) copy:True (then ("ReplayIfLine3" if:("IsSingletonStack" (to))))) (then (if (and (not (is Next Mover)) (is Full)) (and { ("RemoveDeadPieces" P1) ("RemoveDeadPieces" P2) (set Pending)}))))) (nextPhase (is Pending) "Movement")) (phase "Movement" (play (if "SameTurn" "RemoveEnemyPiece" (forEach Piece))) (end (if (all Sites (sites Occupied by:Next) if:(not (is In (site) (sites Board)))) (result Mover Win))))}))
###
| Three concentric squares, with lines connecting the corners and midpoints of the squares. Two players. Players alternate turns placing one of their pieces on one of the spots on the board. A player may place a piece on top of a piece belonging to their opponent during this phase of the game, and they are both canceled out. When three uncanceled pieces form a row along the lines on the board, the player may capture one of the opponent's pieces. Once all of the spots have been occupied, the canceled pieces are removed. Players alternate turns moving one of their pieces to an empty adjacent spot on the board.The player who captures all of the opponent's pieces wins. END |
Construct a Ludii game based on the following description
Fanorona-Tsivy is played on a board of 9x5 intersecting lines with diagonals. Each player has 22 pieces, starting on the intersections of the lines except in the centre position, placed on opposite rows of the board, but alternating in the central row.. Pieces move to an adjacent intersection along the lines. Players must capture pieces when possible. Capturing is accomplished by moving to an adjacent intersection to an opposing piece in the continuing direction of the capturing stones movement, or by moving away from an adjacent opposing pieces in such a direction. When an opponent's piece is captured, all other of the opponent's pieces in that line are also captured. Multiple captures can be made, but cannot be done by moving twice in the same direction. Multiple captures are optional. A player wins by capturing all of the other player's pieces. The game is played on a 5x9 board
###
| (define "MoveIn" (forEach Piece (move Select (from) (to (sites Around (from)) if:("EmptyWithEnemyIn" #1 #2)) (then (and "MoveThePiece" (directional (from #3) #4 "RemoveEnemyPiece")))) (then (if (can Move ("CaptureFromLast" (last To))) (moveAgain))))) (define "CaptureFromLast" (or ("MoveAgainIn" #1 (to) SameDirection (last To) ("LastDirection" Vertex)) ("MoveAgainIn" #1 (from) OppositeDirection (last From) (directions Vertex from:(last To) to:(last From))))) (define "MoveAgainIn" (move Select (from #1) (to (sites Around #1) if:("EmptyButNotVisitedWithEnemyIn" #2 #3)) (then (and { "MoveThePiece" (directional (from #4) #5 "RemoveEnemyPiece") (if (can Move (or ("CaptureAgainIn" #1 (to) SameDirection) ("CaptureAgainIn" #1 (from) OppositeDirection))) (moveAgain))})))) (define "MoveThePiece" (fromTo (from (last From)) (to (last To)))) (define "RemoveEnemyPiece" (to if:("IsEnemyAt" (to)) (apply (remove (to))))) (define "EmptyWithEnemyIn" (and (is Empty (to)) ("IsEnemyAt" (ahead #1 #2)))) (define "EmptyButNotVisitedWithEnemyIn" (and { (not (is Visited (to))) (is Empty (to)) ("IsEnemyAt" (ahead #1 #2))})) (define "CaptureAgainIn" (move Select (from #1) (to (sites Around #1) if:(and { (not (is Visited (to))) (is Empty (to)) ("IsEnemyAt" (ahead #2 #3))})))) (game "Fanorona" (players 2) (equipment { ("AlquerqueBoard" 5 9) (piece "Marker" Each)}) (rules (start { (place "Marker1" (union { (union (expand (sites Bottom)) (sites {"B3" "D3" "G3" "I3"}))})) (place "Marker2" (union { (union (sites {"A3" "C3" "F3" "H3"}) (expand (sites Top)))}))}) (play (if "SameTurn" (or (if (is Occupied (last To)) ("CaptureFromLast" (last To)) ("CaptureFromLast" (last From))) (move Pass)) (priority { (or ("MoveIn" (to) SameDirection (last To) ("LastDirection" Vertex)) ("MoveIn" (from) OppositeDirection (last From) (directions Vertex from:(last To) to:(last From)))) (forEach Piece "StepToEmpty")}))) (end (if (no Pieces Mover) (result Next Win))))) END |
Construct a Ludii game based on the following description
4x8 board, occasionally 4x9 or 10. Two counters in each hole, except the leftmost hole in the inner row, which has zero, and the hole to its right, which has one. Sowing occurs in an anti-clockwise direction. Players sow from any hole in their two rows. When the final counter lands in an occupied hole, these counters are picked up and sowing continues. When the final counter lands in an empty hole in the inner row, the counters in the opponent's opposite hole in their inner row are captured. If there are also counters in the opponent's opposite hole in the outer row, these are also captured, but only when a capture from the inner row was also made. Players cannot sow single counters, unless there are no holes with multiple counters left, in which case single counters may be sown into an empty hole. Play continues until one player has captured all of the opponent's counters, thus winning the game. Each row has 8 holes.
###
| (define "AllSitesNoMoreThanOne" (all Sites (sites Mover "Home") if:(>= 1 (count at:(site))))) (define "NextHole" ("NextSiteOnTrack" #2 from:#1 "Track")) (define "NoPiece" (all Sites (sites Player) if:(= 0 (count at:(site))))) (define "Columns" 8) (game "Njombwa (Two Counters)" (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:(difference (sites Board) (sites {8 (+ 1 8) (- (* 8 3) 1) (- (* 8 3) 2)}))) (set Count 1 to:(sites {(+ 8 1) (- (* 8 3) 2)}))}) (play (if ("AllSitesNoMoreThanOne") (move Select (from (sites Mover "Home") if:(and (is Occupied (from)) (is Empty ("NextHole" (from) 1)))) (then (sow "Track" owner:(mover)))) (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover "Home")) if:(> (count at:(from)) 1)) (then (sow "Track" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (and (is In (to) (sites Mover "Inner")) (is Occupied ("OppositePit" (to)))) (and (remove ("OppositePit" (to))) (if (is Occupied ("OppositeOuterPit" (to))) (remove ("OppositeOuterPit" (to)))))))))))) (end (forEach NonMover if:("NoPiece") (result Player Loss))))) END |
Modify the Ludii game according to the following option changes:
Each player has 6 holes per row. -> Each player has 8 holes per row.
(define "PiecesOwnedBy" (+ (count Cell at:(handSite #1)) (count in:(sites #1 "Home")))) (define "Columns" 6) (game "Chiana wa Bwalo" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "Track1" "0,E,N1,W" loop:True P1) (track "Track2" "12,E,N1,W" loop:True P2)}) (regions "Home" P1 (sites Track "Track1")) (regions "Home" P2 (sites Track "Track2")) (regions "Inner" P1 (difference (sites Track "Track1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "Track2") (sites Top))) (piece "Seed" Shared) (hand Each)}) (rules (start (set Count 4 to:(union (sites Top) (sites Bottom)))) (play (move Select (from (sites Mover "Home") if:(> (count at:(from)) 0)) (then (sow "Track" owner:(mover) apply:(if (and (= (count at:(to)) 1) (> (count at:("OppositePit" (to))) 0)) (fromTo (from ("OppositePit" (to))) (to (handSite Mover)) count:(count at:("OppositePit" (to))))))))) (end ("MancalaByScoreWhen" (no Moves Next)))))
###
| (define "PiecesOwnedBy" (+ (count Cell at:(handSite #1)) (count in:(sites #1 "Home")))) (define "Columns" 8) (game "Chiana wa Bwalo" (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) (hand Each)}) (rules (start (set Count 4 to:(union (sites Top) (sites Bottom)))) (play (move Select (from (sites Mover "Home") if:(> (count at:(from)) 0)) (then (sow "Track" owner:(mover) apply:(if (and (= (count at:(to)) 1) (> (count at:("OppositePit" (to))) 0)) (fromTo (from ("OppositePit" (to))) (to (handSite Mover)) count:(count at:("OppositePit" (to))))))))) (end ("MancalaByScoreWhen" (no Moves Next))))) END |
Construct a global Ludii definition which fulfills the following requirements.
Defines backgammon tracks following the same direction for each player in using the bar of the board.
###
| (define "BackgammonTracksSameDirectionWithBar" { (track "Track1" {6 0..5 7..12 25..20 18..13 #1} P1 directed:True) (track "Track2" {19 0..5 7..12 25..20 18..13 #1} P2 directed:True)}) END |
Construct a Ludii game based on the following description
Played with three \ Played on the normal board.
###
| (game "Demala Diviyan Keliya" (players 2) (equipment { (board (add (remove (merge (shift 0 2 (scale 8 2 (rectangle 3 2))) (scale 1 2 (wedge 5 4))) edges:{ {0 1} {2 3} {4 5}}) edges:{ {0 15} {18 1} {2 11} {14 3} {4 7} {10 5}}) use:Vertex) (hand P2) (piece "Tiger" P1 (or "HopCapture" "StepToEmpty")) (piece "Dog" P2 "StepToEmpty")}) (rules (start { (place "Tiger1" {"H5" "G4" "I4"}) (place "Dog2" (handSite P2) count:15)}) phases:{ (phase "Placement" P2 (play (move (from (handSite P2)) (to (sites Empty)))) (nextPhase ("HandEmpty" P2) "Movement")) ("PhaseMovePiece" "Movement" (end ("NoMovesLossAndLessNumPiecesPlayerLoss" P2 7)))})) END |
Construct a Ludii game based on the following description
At the first round of the game, players can only pick a blank face cube.
Next round players can play the same cube at the previously.
A player cannot return a cube that he/she has played to place on where he/she took it from.
A player who creates the line of opponent’s symbol is the person who loses the game, even if he/she has created a line of his/her own symbol at the same time.
###
| (define "Push" (move Select #1 (then (and { (push (from (last To)) #2) "CompleteLineWithPieceTaken"})))) (define "From" (from (difference (intersection (sites #1) #2) (sites {(last To)})))) (define "LastColumn" (sites Column (column of:(last To)))) (define "LastRow" (sites Row (row of:(last To)))) (define "TakeAPieceInOuterSites" (move Select (from (sites Outer)) (then (and (fromTo (from (last To)) (to (handSite (mover)))) (moveAgain))))) (define "CompleteLineWithPieceTaken" (if (or (= (what at:(handSite (mover))) (id "Square0")) (= (what at:(handSite (mover))) (mover))) (add (piece (mover)) (to (last To))) (add (piece (next)) (to (last To)))) (remove (handSite (mover)))) (game "Pushing Me XO" (players 2) (equipment { (board (square 5)) (piece "Disc" P1) (piece "Cross" P2) (piece "Square" Neutral) (hand Each)}) (rules (start (place "Square0" (sites Board))) (play (if "SameTurn" (or { ("Push" ("From" Left "LastRow") E) ("Push" ("From" Right "LastRow") W) ("Push" ("From" Bottom "LastColumn") N) ("Push" ("From" Top "LastColumn") S)}) "TakeAPieceInOuterSites")) (end { (if (is Line 5 throughAny:(sites LastTo) what:(next)) (result Next Win)) (if (is Line 5 throughAny:(sites LastTo) what:(mover)) (result Mover Win))}))) END |
Construct a global Ludii definition which fulfills the following requirements.
Checks if all pieces on the board owned by the mover are in a region.
###
| (define "AllOwnedPiecesIn" (all Sites (sites Occupied by:Mover) if:(is In (site) #1))) END |
Describe the mechanics of the following Ludii game
(define "PieceIsOnTheBoard" ("IsNotOffBoard" (where "Square" Mover state:(count Pips)))) (define "MoveAPieceOf" (forEach Piece (if #1 ("MoveForwards")))) (define "ValueNextLower" (if ("IsNotOffBoard" (where "Square" Mover state:(- (count Pips) 1))) (= (state at:(from)) (- (count Pips) 1)) (if ("IsNotOffBoard" (where "Square" Mover state:(- (count Pips) 2))) (= (state at:(from)) (- (count Pips) 2)) (if ("IsNotOffBoard" (where "Square" Mover state:(- (count Pips) 3))) (= (state at:(from)) (- (count Pips) 3)) (if ("IsNotOffBoard" (where "Square" Mover state:(- (count Pips) 4))) (= (state at:(from)) (- (count Pips) 4)) (= (state at:(from)) (- (count Pips) 5))))))) (define "ValueNextHigher" (if ("IsNotOffBoard" (where "Square" Mover state:(+ (count Pips) 1))) (= (state at:(from)) (+ (count Pips) 1)) (if ("IsNotOffBoard" (where "Square" Mover state:(+ (count Pips) 2))) (= (state at:(from)) (+ (count Pips) 2)) (if ("IsNotOffBoard" (where "Square" Mover state:(+ (count Pips) 3))) (= (state at:(from)) (+ (count Pips) 3)) (if ("IsNotOffBoard" (where "Square" Mover state:(+ (count Pips) 4))) (= (state at:(from)) (+ (count Pips) 4)) (= (state at:(from)) (+ (count Pips) 5))))))) (define "SameValue" (= (state at:(from)) (count Pips))) (define "MoveForwards" (move Step Forwards (to if:True "CaptureToPiece"))) (define "GoalReached" (all Sites (sites Mover "Goal") if:(is In (site) (sites Occupied by:Mover)))) (define "CubeInHand" (sites Occupied by:Mover container:(mover))) (define "EmptySitesInHome" (forEach (sites Mover "Home") if:(is Empty (site)))) (define "CaptureToPiece" (apply (if (is Occupied (to)) (remove (to))))) (game "EinStein Wurfelt Nicht" (players {(player SE) (player NW)}) (equipment { (board (square 5)) (piece "Square" Each) (hand Each size:6) (dice num:1) (regions "Home" P1 (expand (intersection (sites Top) (sites Left)) steps:2 Orthogonal)) (regions "Home" P2 (expand (intersection (sites Bottom) (sites Right)) steps:2 Orthogonal)) (regions "Goal" P1 (intersection (sites Bottom) (sites Right))) (regions "Goal" P2 (intersection (sites Top) (sites Left)))}) (rules (start { (place "Square1" (handSite P1) state:1) (place "Square1" (handSite P1 1) state:2) (place "Square1" (handSite P1 2) state:3) (place "Square1" (handSite P1 3) state:4) (place "Square1" (handSite P1 4) state:5) (place "Square1" (handSite P1 5) state:6) (place "Square2" (handSite P2) state:1) (place "Square2" (handSite P2 1) state:2) (place "Square2" (handSite P2 2) state:3) (place "Square2" (handSite P2 3) state:4) (place "Square2" (handSite P2 4) state:5) (place "Square2" (handSite P2 5) state:6)}) phases:{ (phase "Placement" (play (move (from ("CubeInHand")) (to ("EmptySitesInHome")))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) (phase "Movement" (play ("RollMove" (if ("PieceIsOnTheBoard") ("MoveAPieceOf" ("SameValue")) (or ("MoveAPieceOf" ("ValueNextHigher")) ("MoveAPieceOf" ("ValueNextLower")))))))} (end (if (or (no Pieces Next) ("GoalReached")) (result Mover Win)))))
###
| The game is played on a square board with a 5×5 grid. Each player has six cubes, numbered one to six. During setup, each player can arrange the cubes as he or she sees fit within the triangular area of their own color.
The players take turns rolling a six-sided die and then moving the matching cube. If the matching cube is no longer on the board, the player moves a remaining cube whose number is next-higher or next-lower to the rolled number. The player starting in the top-left may move that cube one square to the right, down, or on the diagonal down and to the right; the player starting in the bottom-right may move that cube one square to the left, up, or on the diagonal up and to the left. Any cube which already lies in the target square is removed from the board.
The objective of the game is for a player to either get one of their cubes to the far corner square in the grid (where their opponent started) or to remove all of their opponent's cubes from the board. The version of the game played on 5x5 board. END |
Modify the Ludii game according to the following option changes:
Order 4 Hexagon -> Order 4 Hexagon
(define "DiagonalVector" (sites Around (from) Diagonal)) (define "UnconfinedStiesOf" (forEach (sites Board) if:(!= Infinity (count Steps Adjacent (step Adjacent (to if:(or (is Empty (to)) (is #1 (who at:(to)))))) (site) (sites Outer))))) (define "SetScoreOf" (set Score #1 (- 0 (count Sites in:(difference (sites Occupied by:#1) ("UnconfinedStiesOf" #1)))))) (define "MakeSwap" (if (is Empty ("SwapSite" 1)) (fromTo (from ("SwapSite" 0)) (to ("SwapSite" 1))) (if (is Empty ("SwapSite" 0)) (fromTo (from ("SwapSite" 1)) (to ("SwapSite" 0))) (set Var "Piece1" ("SwapPiece" 1) (then (add (piece ("SwapPiece" 0)) (to ("SwapSite" 1) (apply (remove (to)))) (then (add (piece (var "Piece1")) (to ("SwapSite" 0) (apply (remove (to)))))))))) (then (and { ("SetScoreOf" Mover) ("SetScoreOf" Next) (forget Value All)})))) (define "SwapPiece" (what at:("SwapSite" #1) level:(topLevel at:("SwapSite" #1)))) (define "SwapSite" (arrayValue (values Remembered) index:#1)) (define "Placement" (move Select (from #1 if:(> 2 (count Stack at:(from)))) (to "DiagonalVector" if:(and { (is In (to) (sites Occupied by:Mover top:True)) (= 2 (count Sites in:("SwapSites" (to) (from)))) (or (= 1 (count Sites in:(intersection ("SwapSites" (to) (from)) (sites Occupied by:Mover top:True)))) (= 1 (count Sites in:(intersection ("SwapSites" (to) (from)) (sites Occupied by:Next top:True)))))})) (then (and { (add (piece (id "Disc" Mover)) (to (last From)) stack:True) (forEach Site ("SwapSites" (last To) (last From)) (remember Value (site)))})))) (define "SwapSites" (intersection (sites Around #1 Adjacent) (sites Around #2 Adjacent))) (game "Veloop (Hex)" (players 2) (equipment { (board (renumber (rotate 90 (hex Hexagon 3))) use:Cell) (piece "Disc" Each)}) (rules (start { (place "Disc1" 7) (place "Disc2" 12)}) (play (priority ("Placement" (sites Empty)) ("Placement" (sites Occupied by:Next)) (then ("MakeSwap")))) (end (if (!= 0 (+ (score P1) (score P2))) (byScore)))))
###
| (define "DiagonalVector" (sites Around (from) Diagonal)) (define "UnconfinedStiesOf" (forEach (sites Board) if:(!= Infinity (count Steps Adjacent (step Adjacent (to if:(or (is Empty (to)) (is #1 (who at:(to)))))) (site) (sites Outer))))) (define "SetScoreOf" (set Score #1 (- 0 (count Sites in:(difference (sites Occupied by:#1) ("UnconfinedStiesOf" #1)))))) (define "MakeSwap" (if (is Empty ("SwapSite" 1)) (fromTo (from ("SwapSite" 0)) (to ("SwapSite" 1))) (if (is Empty ("SwapSite" 0)) (fromTo (from ("SwapSite" 1)) (to ("SwapSite" 0))) (set Var "Piece1" ("SwapPiece" 1) (then (add (piece ("SwapPiece" 0)) (to ("SwapSite" 1) (apply (remove (to)))) (then (add (piece (var "Piece1")) (to ("SwapSite" 0) (apply (remove (to)))))))))) (then (and { ("SetScoreOf" Mover) ("SetScoreOf" Next) (forget Value All)})))) (define "SwapPiece" (what at:("SwapSite" #1) level:(topLevel at:("SwapSite" #1)))) (define "SwapSite" (arrayValue (values Remembered) index:#1)) (define "Placement" (move Select (from #1 if:(> 2 (count Stack at:(from)))) (to "DiagonalVector" if:(and { (is In (to) (sites Occupied by:Mover top:True)) (= 2 (count Sites in:("SwapSites" (to) (from)))) (or (= 1 (count Sites in:(intersection ("SwapSites" (to) (from)) (sites Occupied by:Mover top:True)))) (= 1 (count Sites in:(intersection ("SwapSites" (to) (from)) (sites Occupied by:Next top:True)))))})) (then (and { (add (piece (id "Disc" Mover)) (to (last From)) stack:True) (forEach Site ("SwapSites" (last To) (last From)) (remember Value (site)))})))) (define "SwapSites" (intersection (sites Around #1 Adjacent) (sites Around #2 Adjacent))) (game "Veloop (Hex)" (players 2) (equipment { (board (renumber (rotate 90 (hex Hexagon 4))) use:Cell) (piece "Disc" Each)}) (rules (start { (place "Disc1" 15) (place "Disc2" 22)}) (play (priority ("Placement" (sites Empty)) ("Placement" (sites Occupied by:Next)) (then ("MakeSwap")))) (end (if (!= 0 (+ (score P1) (score P2))) (byScore))))) END |
Construct a Ludii game based on the following description
Half Chess is played with the same rules as chess.
###
| (game "Half Chess" (players 2) (equipment { (board (rectangle 4 8)) ("ChessRook" "Rook" (then (set Counter))) ("ChessKing" "King" (then (set Counter))) ("ChessBishop" "Bishop" (then (set Counter))) ("ChessKnight" "Knight" (then (set Counter))) ("ChessQueen" "Queen" (then (set Counter)))}) (rules (start { (place "Rook1" {"H1" "H4"}) (place "Knight1" {"G1" "G4"}) (place "Bishop1" {"G2" "G3"}) (place "Queen1" coord:"H3") (place "King1" coord:"H2") (place "Rook2" {"A1" "A4"}) (place "Knight2" {"B1" "B4"}) (place "Bishop2" {"B2" "B3"}) (place "Queen2" coord:"A3") (place "King2" coord:"A2")}) (play (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King" Mover)))) (end { ("Checkmate" "King") (if (or (no Moves Mover) (= (counter) 100)) (result Mover Draw))}))) END |
Construct a Ludii game based on the following description
Played on a five-pointed star shaped board. One player plays with one piece, the \ The game starts with 7 discs for the second player.
###
| (game "Kaooa" (players 2) (equipment { ("StarBoard" 5) (hand Each) (piece "Marker" P1 (or ("HopSequenceCapture") "StepToEmpty")) (piece "Marker" P2 "StepToEmpty")}) (rules (start { (place "Marker1" (handSite P1) count:1) (place "Marker2" (handSite P2) count:7)}) phases:{ (phase "Placement" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) ("PhaseMovePiece" "Movement" (end ("NoMoves" Loss)))})) END |
Construct a Ludii game based on the following description
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. Eighteen pieces per player, each side arranged on one side of the board, with the central point empty and the player's pieces on the points to the right of it. Players alternate turns moving one of their pieces to an empty point. A piece may jump an opponent's piece to capture it. Multiple captures are allowed. The player who captures all of the opponent's pieces wins.
###
| (game "Lam Pusri" (players 2) (equipment { ("AlquerqueBoardWithBottomAndTopTriangles") (piece "Marker" Each (or ("HopSequenceCapture") ("StepToEmpty")))}) (rules (start { (place "Marker1" (union {(sites Row 0) (sites Row 1) (sites Row 2) (sites Row 3) (expand (sites {"E5"}) W)})) (place "Marker2" (union {(sites Row 5) (sites Row 6) (sites Row 7) (sites Row 8) (expand (sites {"A5"}) E)}))}) (play (if "SameTurn" (or ("HopSequenceCaptureAgain") (move Pass)) (forEach Piece))) (end ("CaptureAll" Next)))) END |
Modify the Ludii game according to the following option changes:
The game involves 3 players. -> The game involves 4 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 3) (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) (track "Track3" "3,E,N,W,S,E2,NW1,N4,E4,S4,W3,N3,E2,S2,W1,N1" P3 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) (place Stack "Paddle3" (handSite P3) 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"))))
###
| (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 4) (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) (track "Track3" "3,E,N,W,S,E2,NW1,N4,E4,S4,W3,N3,E2,S2,W1,N1" P3 directed:True) (track "Track4" "45,W,S,E,N,W2,SE1,S4,W4,N4,E3,S3,W2,N2,E1,S1" P4 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) (place Stack "Paddle3" (handSite P3) count:4) (place Stack "Paddle4" (handSite P4) 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 |
Construct a global Ludii definition which fulfills the following requirements.
Checks if a region has no sites.
###
| (define "NoSites" (= (count Sites in:#1) 0)) END |
Describe the mechanics of the following Ludii game
(define "PiecesOwnedBy" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (define "PlayFromLastHole" (last To afterConsequence:True)) (define "Columns" 12) (game "Intotoi" (players 2) (equipment { (mancalaBoard 2 "Columns" store:None (track "Track" "0,E,N,W" loop:True)) (piece "Seed" Shared) (hand Each) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start (set Count 3 to:(sites {1 2 4 5 7 8 10 11 22 21 19 18 16 15 13 12}))) phases:{ (phase "Opening1" (play (move Select (from 10) (then (sow count:2)))) (nextPhase "Opening2")) (phase "Opening2" (play (if ("SameTurn") (move Select (from (sites {"PlayFromLastHole"}) if:(> (count at:(from)) 0)) (then (sow apply:(if (!= 1 (count at:(to))) (moveAgain))))) (move Select (from (sites {13 15}) if:(> (count at:(from)) 0)) (then (sow count:2 apply:(if (!= 1 (count at:(to))) (moveAgain))))))) (nextPhase (not (is Next Mover)) "Play")) (phase "Play" (play (move Select (from (sites From (do (move Select (from (sites Mover) if:(> (count at:(from)) 0)) (then (sow))) ifAfterwards:(or (and (= 1 (count at:("PlayFromLastHole"))) (is In ("PlayFromLastHole") (sites Mover))) (is In ("PlayFromLastHole") (sites Next))))) if:(> (count at:(from)) 0)) (then (sow apply:(if (= 1 (count at:(to))) (if (and (is Occupied ("OppositePit" (to))) (is In (to) (sites Mover))) (fromTo (from ("OppositePit" (to))) (to (handSite Mover)) count:(count at:("OppositePit" (to))))) (moveAgain)))))) (nextPhase Mover (is Next Mover) "Replay")) (phase "Replay" (play (move Select (from (sites {"PlayFromLastHole"}) if:(> (count at:(from)) 0)) (then (sow apply:(if (= 1 (count at:(to))) (if (and (is Occupied ("OppositePit" (to))) (is In (to) (sites Mover))) (fromTo (from ("OppositePit" (to))) (to (handSite Mover)) count:(count at:("OppositePit" (to))))) (moveAgain)))))) (nextPhase Mover (not (is Next Mover)) "Play"))} (end ("MancalaByScoreWhen" (no Moves Mover)))))
###
| 2x12 board. Starting position, from the left hand hole, for each player: 0-3-3-0-3-3-0-3-3-0-3-3 In the opening play, one player must sow two counters from the second hole from their right. The opponent then makes the same play from their row, or from the fourth hole from their right. When the final counter lands in an occupied hole, these are picked up and sowing continues. A player's turn ends when the final counter falls into an empty hole. Players may now begin their move from any hole in their row, but only if it ends in an empty hole in their row or if it enters the opponent's row. If the final counter lands in an occupied hole in the opponent's row, these are picked up and sowing continues. If the final counter lands in an occupied hole in the player's row, the contents of the hole in the opponent's hole opposite it are captured. Sowing ends when a capture is made or when a counter falls into an empty hole. END |
Modify the Ludii game according to the following option changes:
Played on a size 5 board. -> Played on a size 6 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 5) 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))})))
###
| (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 6) 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 |
Construct a Ludii game based on the following description
3x3 board with diagonals. Three pieces per player. Players take turns placing their pieces. Once all pieces have been placed, they may move a piece to any unoccupied spot. The first player to align their three pieces in a row along one of lines on the board is the winner. The board is 3x3 and the winning conditions is a 3 in a row.
###
| (game "Les Pendus" (players 2) (equipment { (board (square 3 diagonals:Alternating) 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 Mover ("HandEmpty" Mover) "Movement")) ("PhaseMovePiece" "Movement")} (end (if (is Line 3) (result Mover Win))))) END |
Construct a Ludii game based on the following description
A circle with eight radii. Three pieces per player. Each player has three pieces, which must start on the outer ring adjacent to each other. Players alternate turns moving a piece to an empty point along the lines of the board. The player who makes a line of three through the center of the circle wins.
###
| (game "Ring" (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 (difference (sites Empty) (sites Centre))))) (nextPhase Mover "PlacementAdjacent")) (phase "PlacementAdjacent" (play (move (from (handSite Mover)) (to (difference (sites Empty) (sites Centre)) if:(is In (to) (sites Around (sites Occupied by:Mover)))))) (nextPhase ("HandEmpty" P2) "Movement")) ("PhaseMovePiece" "Movement")} (end (if (is Line 3 through:(centrePoint) what:(mover)) (result Mover Win))))) END |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.