prompt
stringlengths 71
4.65k
| completion
stringlengths 34
5.1k
|
---|---|
Construct a global Ludii definition which fulfills the following requirements.
Defines a forward slide move to empty sites at distance 2.
###
| (define "DoubleStepForwardToEmpty" (move Slide Forward (between (exact 2) if:(is Empty (between))) (to if:(is Empty (to))) #1)) END |
Construct a Ludii game based on the following description
Played on a 5x5 board. There are 3 'Musketeer' pieces and 22 'Enemy' pieces. Musketeers can only move by capturing enemies on any adjacent space. Enemies can only move to empty adjacent spaces. Enemies win if all three musketeers are ever on the same line or column. Musketeers win as soon as they run out of legal moves.
###
| (game "Three Musketeers" (players 2) (equipment { (board (square 5)) (piece "Musketeer" P1 (move Step Orthogonal (to if:("IsEnemyAt" (to)) (apply (remove (to)))))) (piece "Enemy" P2 ("StepOrthogonalToEmpty"))}) (rules (start { (place "Musketeer1" {"A1" "C3" "E5"}) (place "Enemy2" (difference (sites Board) (sites {"A1" "C3" "E5"})))}) (play (forEach Piece)) (end { (if (no Moves P1) (result P1 Win)) (if (and (is Mover P1) (is Line 3 Orthogonal contiguous:False)) (result P2 Win))}))) END |
Construct a Ludii game based on the following description
2x6 board. Five counters in each hole. Play begins from any hole in a player's row and sown anti-clockwise. When the final counter falls into an occupied hole, the counters in that hole are picked up and sowing continues. If the final counter falls into an empty hole, the turn ends; if this hole is in the player's own row, the contents of the opponent's hole are captured if they contain one, two, four, or more counters. If it contains three counters, one of the opponent's counters is taken and placed into the hole where sowing ended, so that each now has two counters. These holes cannot be sown from for the rest of the game and are owned by the player whose turn created them. Players cannot change their move mid-turn and counting of counters is forbidden. Play ends when one player can no longer play. The opponent then takes all of the counters in their own row, and each player takes the counters that have accumulated in their captured holes. A new game begins. The player with the fewest counters arranges them in their holes, distributing them as equally as possible. The opponent then mirrors this arrangement in their holes, placing aside any extras for use in subsequent games. If the player is reduced to four counters or less, these are arranged one to a hole and any empty holes are not used for the game (by either player). The player who captures all the counters wins.
###
| (define "CapturedPiece" (+ { (count Cell at:(handSite #1)) (count in:(forEach (sites Board) if:(= (state at:(site)) #1))) (count in:(forEach (sites #1) if:(= (state at:(site)) 0)))})) (define "APlayerCanNotMove" (and (not (is Next Mover)) (or (all Sites (sites P1) if:(or (not (is In (site) ("PlayableSites"))) (or (!= 0 (state at:(site))) (is Empty (site))))) (all Sites (sites P2) if:(or (not (is In (site) ("PlayableSites"))) (or (!= 0 (state at:(site))) (is Empty (site)))))))) (define "PlayableSites" (sites (values Remembered "Playable"))) (define "Columns" 6) (game "Leyla Gobale (Gabradarre)" (players 2) (equipment { (mancalaBoard 2 6 store:None (track "TrackCCW" "0,E,N,W" loop:True)) (piece "Seed" Shared) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (hand Each) (map "CorrespondingHoles" { (pair 0 11) (pair 1 10) (pair 2 9) (pair 3 8) (pair 4 7) (pair 5 6) (pair 6 5) (pair 7 4) (pair 8 3) (pair 9 2) (pair 10 1) (pair 11 0)})}) (rules (start { (set RememberValue "Playable" (union (sites Top) (sites Bottom))) (set Count 5 to:(sites Track))}) phases:{ (phase "Sowing" (play (or { (move Select (from (if ("SameTurn") (sites {(var "Replay")}) (sites Mover)) if:(and { (is Occupied (from)) (= 0 (state at:(from))) (is In (from) ("PlayableSites"))})) (then (sow apply:(if (< 1 (count at:(to))) (if (= 0 (state at:(to))) (and (moveAgain) (set Var "Replay" (to)))) (if (is In (to) (sites Mover)) (if (!= 3 (count at:("OppositePitTwoRows" (to)))) (if (!= 0 (count at:("OppositePitTwoRows" (to)))) (fromTo (from ("OppositePitTwoRows" (to))) (to (handSite Mover)) count:(count at:("OppositePitTwoRows" (to))))) (and { (fromTo (from ("OppositePitTwoRows" (to))) (to (to)) count:1) (set State at:(to) (mover)) (set State at:("OppositePitTwoRows" (to)) (mover))})))))))} (then (if ("APlayerCanNotMove") (and { (forEach Site (sites P1) (if (= 0 (state at:(site))) (fromTo (from (site)) (to (handSite P1)) count:(count at:(site))))) (forEach Site (sites P2) (if (= 0 (state at:(site))) (fromTo (from (site)) (to (handSite P2)) count:(count at:(site))))) (forEach Site (sites Board) (if (= (state at:(site)) P1) (fromTo (from (site)) (to (handSite P1)) count:(count at:(site))) (if (= (state at:(site)) P2) (fromTo (from (site)) (to (handSite P2)) count:(count at:(site)))))) (if (< ("CapturedPiece" P1) ("CapturedPiece" P2)) (set NextPlayer (player 1)) (set NextPlayer (player 2))) (forget Value "Playable" 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 (move (from (handSite Mover)) (to (forEach (sites Mover) if:(= (count at:(site)) (min (results from:(sites Mover) to:(sites Mover) (count at:(to))))))) count:1 (then (and (remember Value "Playable" (last To) unique:True) (if (< 0 (count Cell at:(handSite Mover))) (moveAgain) (forEach Site (sites Mover) (if (is Occupied (site)) (fromTo (from (handSite Next)) (to (mapEntry "CorrespondingHoles" (site))) count:(count at:(site)))))))))) (nextPhase (or (is Empty (handSite P1)) (is Empty (handSite P2))) "Sowing"))})) END |
Construct a Ludii game based on the following description
2x6 board. Three counters in each hole. Play begins with a stylized move. One player takes all of the counters from their leftmost hole, and proceeding in an anti-clockwise direction, takes all of the counters from the holes in their row. They then begin sowing these counters into the opponent's row, proceeding around the board in an anti-clockwise direction. 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, the turn ends. The main phase of the game begins, in which sowing continues in the same manner, but the player may begin their turn from any hole in their row. At the end of sowing, any holes containing four counters are captured by the owner of the row in which the hole is located, unless it is the hole in which the final counter fell, in which case the player captures them and the turn ends. If at the end of the game there are not sufficient counters to cause a hole to contain four, the players decide how the counters are allocated, and a new round begins. The players fill as many of their holes with four counters as they are able. The player with more counters will capture as many holes from the opponent in which they can place three or counters. If the player has two remaining counters after holes are filled with three, the opponent would cede their one remaining counter to the player to make three and the player captures one further hole. The player who played second in the previous round begins the new round with the same stylized move, and play continues as before after that. Play continues until one player owns no holes; the opponent wins.
###
| (define "NumPiecesOnBoard" (count in:(sites Board))) (define "RememberOwnedHolesRandom" (if (< 50 (value Random (range 1 100))) (remember Value "OwnedP1" #1) (remember Value "OwnedP2" #1))) (define "LeftMostEmpty" (trackSite FirstSite "Track" from:(mapEntry "LeftMost" Mover) if:(is Empty (to)))) (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 "Gabata (Wuqro)" (players 2) (equipment { (mancalaBoard 2 6 store:None (track "Track" "0,E,N,W" loop:True)) (piece "Seed" Shared) (hand Each) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map "LeftMost" {(pair P1 0) (pair P2 11)})}) (rules (start { (set RememberValue "OwnedP1" (sites Bottom)) (set RememberValue "OwnedP2" (sites Top)) (set Count 3 to:(sites Track))}) phases:{ (phase "Opening" (play (if ("SameTurn") (move Select (from (var "Replay")) (then (sow apply:(if (< 1 (count at:(to))) (and (moveAgain) (set Var "Replay" (to))) (set Var "Round" (+ 1 (var "Round"))))))) (move (from 0) (to 11) count:(count at:(to)) (then (and { (forEach Site (sites Mover) (if (is Occupied (site)) (fromTo (from (site)) (to 11) count:(count at:(site))))) (moveAgain) (set Var "Replay" 11)}))))) (nextPhase (not (is Next Mover)) "Sowing")) (phase "Sowing" (play (or { (move Select (from (if ("SameTurn") (sites {(var "Replay")}) ("OwnedHoles")) if:(is Occupied (from))) (then (do (set Var "NumSowed" (count at:(last To))) next:(sow apply:(if (< 1 (count at:(to))) (if (= 4 (count at:(to))) (fromTo (from (to)) (to (handSite Mover)) count:4) (and (moveAgain) (set Var "Replay" (to)))))) (then (and (forEach Site (sites Track from:(last From) to:(trackSite Move from:(last From) "Track" steps:(- (var "NumSowed") 1))) (if (= 4 (count at:(site))) (fromTo (from (site)) (to (handSite Mover)) count:4))) (set Var "NumSowed" 0))))))} (then (if (= 4 ("NumPiecesOnBoard")) (and { (forEach Site (sites Board) (fromTo (from (site)) (to (handSite Mover)) count:(count at:(site)))) (forget Value "OwnedP1" All) (forget Value "OwnedP2" All) (set Var "Round" (+ 1 (var "Round")))}) (if ("NoPieceOnBoard") (and { (forget Value "OwnedP1" All) (forget Value "OwnedP2" All) (set Var "Round" (+ 1 (var "Round")))})))))) (end (if ("NoPieceOnBoard") { (if (> 2 (count Cell at:(handSite P1))) (result P2 Win)) (if (> 2 (count Cell at:(handSite P2))) (result P1 Win))})) (nextPhase ("NoPieceOnBoard") "BetweenRounds")) (phase "BetweenRounds" (play (if (<= 3 (count Cell at:(handSite Mover))) (move (from (handSite Mover)) (to ("LeftMostEmpty")) count:3 (then (and { ("RemmemberOwnedHoles" (last To)) (if (<= 3 (count Cell at:(handSite Mover))) (moveAgain) (if (= 2 (count Cell at:(handSite Mover))) (and { (fromTo (from (handSite Mover)) (to ("LeftMostEmpty")) count:2) (fromTo (from (handSite Next)) (to ("LeftMostEmpty")) count:1) ("RemmemberOwnedHoles" ("LeftMostEmpty"))})))}))) (then (if (and (is Empty (handSite P1)) (is Empty (handSite P2))) (and (if (is Even (var "Round")) (set NextPlayer (player 2)) (set NextPlayer (player 1))) (set Pending)))))) (nextPhase (and (is Empty (handSite P1)) (is Empty (handSite P2))) "Opening"))})) 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 "ReachesRegion" (> Infinity (count Steps Orthogonal (step (to if:(or (is Empty (to)) (is In (to) #2)))) #1 #2))) (define "CaptureSurroundedGroup" (enclose (from (last To)) Orthogonal (between if:(is #1 (who at:(between))) (apply (remove (between)))) #2)) (game "Cavity" (players 2) (equipment { (board (square 4) use:Vertex) (piece "Marker" Each)}) (rules (meta (swap)) phases:{ (phase "Opening" (play (move Add (to (sites Empty)))) (nextPhase (and (= 1 (count Sites in:(sites Occupied by:P1))) (= 1 (count Sites in:(sites Occupied by:P2)))) "Play")) (phase "Play" (play (move Add (to (sites Empty) if:("ReachesRegion" (to) (sites Occupied by:Mover))) (then (if (can Move ("CaptureSurroundedGroup" Enemy)) ("CaptureSurroundedGroup" Enemy) ("CaptureSurroundedGroup" Mover))))))} (end (forEach Player if:(and (< 2 (count Moves)) (no Pieces Player)) (result Player Loss)))))
###
| (define "ReachesRegion" (> Infinity (count Steps Orthogonal (step (to if:(or (is Empty (to)) (is In (to) #2)))) #1 #2))) (define "CaptureSurroundedGroup" (enclose (from (last To)) Orthogonal (between if:(is #1 (who at:(between))) (apply (remove (between)))) #2)) (game "Cavity" (players 2) (equipment { (board (square 5) use:Vertex) (piece "Marker" Each)}) (rules (meta (swap)) phases:{ (phase "Opening" (play (move Add (to (sites Empty)))) (nextPhase (and (= 1 (count Sites in:(sites Occupied by:P1))) (= 1 (count Sites in:(sites Occupied by:P2)))) "Play")) (phase "Play" (play (move Add (to (sites Empty) if:("ReachesRegion" (to) (sites Occupied by:Mover))) (then (if (can Move ("CaptureSurroundedGroup" Enemy)) ("CaptureSurroundedGroup" Enemy) ("CaptureSurroundedGroup" Mover))))))} (end (forEach Player if:(and (< 2 (count Moves)) (no Pieces Player)) (result Player Loss))))) END |
Construct a global Ludii definition which fulfills the following requirements.
Checks if a piece #1 owned by #2 is at a site #3.
###
| (define "IsPieceAt" (= (what at:#3 #4) (id #1 #2))) END |
Construct a Ludii game based on the following description
10x10 board. The black player starts by removing one black piece either from one of the central four spaces of the board or from one of the four corners. The white player then must remove a white piece that is orthogonally adjacent to the empty space. Play proceeds by orthogonally jumping an opposing piece and capturing it. All moves must be capturing moves. Multiple captures can be made only by continuing in the same direction. The first player unable to move loses. The game is played on a 10x10 board.
###
| (define "HopSequence" ("HopCapture" (from #1) #2 (then ("ReplayIfCanMove" ("HopCapture" (from (last To)) SameDirection))))) (game "Konane" (players 2) (equipment { (board (square 10)) (piece "Marker" Each)}) (rules (start { (place "Marker1" (sites Phase 1)) (place "Marker2" (sites Phase 0))}) phases:{ (phase "OpeningP1" P1 (play (move Remove (intersection (union (sites Corners) (sites Centre)) (sites Phase 1)))) (nextPhase Mover "Movement")) (phase "OpeningP2" P2 (play (move Remove (sites Around (last To) Own))) (nextPhase Mover "Movement")) (phase "Movement" (play (if "SameTurn" (or ("HopSequence" (last To) SameDirection) (move Pass)) (forEach Piece "Marker" ("HopSequence" (from) Orthogonal)))))} (end ("NoMoves" Loss)))) END |
Construct a Ludii game based on the following description
Two rows of six holes with two stores. Each player owns the store to their right. Four counters in each hole. Sowing occurs from any hole in the player's row in an anti-clockwise direction. Sowing includes the player's store but not the opponent's. When the final counter lands into the player's store, they play again. When a player has no more counters in their row, they win, even if it is now the opponent's turn and they could place counters in the player's row.
###
| (define "PiecesOwnedBy" (+ (count at:(mapEntry #1)) (count in:(sites #1)))) (game "Waurie" (players 2) (equipment { (mancalaBoard 2 6 (track "Track" "0,ESE,E,ENE,WNW,W" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 LastSite) (pair P2 FirstSite)}) (piece "Seed" Shared)}) (rules (start (set Count 4 to:(union (sites P1) (sites P2)))) (play (move Select (from (sites Mover) if:(> (count at:(from)) 0)) (then (sow apply:(if (= (to) (mapEntry Mover)) (moveAgain)) skipIf:(= (to) (mapEntry Next)))))) (end (if (all Sites (sites Mover) if:(= 0 (count at:(site)))) (result Mover Win))))) END |
Construct a Ludii game based on the following description
The rules are the same as in Chess, without checkmate. The game is won either after 100 turns or when one player can no longer move, by the player with the most pieces.
###
| (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")}) (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 (is Empty (to)) (then (and ("PieceHasMoved") ("DoCastle" "RookLeft" E 3 True))))) (define "SmallCastling" ("DoCastle" "King" E 2 (is Empty (to)) (then (and ("PieceHasMoved") ("DoCastle" "RookRight" W 2 True))))) (define "DoCastle" (move Slide (from (mapEntry #1 (mover))) #2 (between (exact #3) if:#4) #5)) (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" ("IsPieceAt" "King" Mover (mapEntry "King" (mover)))) (game "Skirmish (GDL)" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) ("ChessPawn" "Pawn" (or "InitialPawnMove" "EnPassant") (then ("ReplayInMovingOn" (sites Mover "Promotion")))) ("ChessRook" "Rook" ~ ("RememberPieceHasMoved")) ("ChessKing" "King" ~ ("RememberPieceHasMoved")) ("ChessBishop" "Bishop") ("ChessKnight" "Knight") ("ChessQueen" "Queen") (map "King" {(pair 1 "E1") (pair 2 "E8")}) (map "RookLeft" {(pair 1 "A1") (pair 2 "A8")}) (map "RookRight" {(pair 1 "H1") (pair 2 "H8")}) (regions "Promotion" P1 (sites Top)) (regions "Promotion" P2 (sites Bottom))}) (rules (start { (place "Pawn1" (sites Row 1)) (place "Pawn2" (sites Row 6)) (place "Rook1" {"A1" "H1"} state:1) (place "Knight1" {"B1" "G1"}) (place "Bishop1" {"C1" "F1"}) (place "Queen1" coord:"D1") (place "King1" coord:"E1" state:1) (place "Rook2" {"A8" "H8"} state:1) (place "Knight2" {"B8" "G8"}) (place "Bishop2" {"C8" "F8"}) (place "Queen2" coord:"D8") (place "King2" coord:"E8" state:1)}) (play (if "SameTurn" (move Promote (last To) (piece {"Queen" "Knight" "Bishop" "Rook"}) Mover) (or (forEach Piece) ("Castling")))) (end (if (or (no Moves Next) (= (count Moves) 100)) (byScore { (score P1 (count Pieces P1)) (score P2 (count Pieces P2))}))))) END |
Construct a Ludii game based on the following description
2x5 board. Five pieces per player. Pieces played on the end of the lines. Two dice. Central line marked. Pieces move from the \ No capture.
###
| (define "SacredLine" 10) (define "EnterToBoard" ("NextSiteOnTrack" (- (count Pips) 1) from:(handSite Mover))) (define "SiteToMoveOnTrack" (trackSite Move steps:(count Pips))) (game "Pente Grammai" (players 2) (equipment { (board (add (scale 1.5 (merge { (shift 2 0 (rectangle 2 1)) (shift 1.5 0 (rectangle 2 1)) (shift 1 0 (rectangle 2 1)) (shift 0.5 0 (rectangle 2 1)) (rectangle 2 1)})) vertices:{{1.5 0.75}}) { (track "Track1" "8,6,4,2,0,1,3,5,7,9" loop:True P1) (track "Track2" "1,3,5,7,9,8,6,4,2,0" loop:True P2)} use:Vertex) (piece "Marker" Each (if (and (!= (from) "SacredLine") (is Empty "SiteToMoveOnTrack")) (move (from) (to "SiteToMoveOnTrack")))) (hand Each) (dice d:6 num:1) (map "Goal" {(pair P1 5) (pair P2 4)})}) (rules (start { (place Stack "Marker1" (handSite P1) count:5) (place Stack "Marker2" (handSite P2) count:5)}) (play ("RollMove" (priority { (if (and ("HandOccupied" Mover) (is Empty ("EnterToBoard"))) (move (from (handSite Mover)) (to ("EnterToBoard")))) (forEach Piece)} (then (if (= (mapEntry "Goal" Mover) (last To)) (fromTo (from (last To)) (to "SacredLine"))))))) (end (if (all Sites (sites Occupied by:Mover) if:(= (site) "SacredLine")) (result Mover Win))))) END |
Construct a Ludii game based on the following description
This game is a variant of classic Chess, which adds a random factor to the strategy. The following list describes all differences of the rules:
There is no check or checkmate, it is allowed to move the king to a square attacked by opponent's piece. The goal is to capture opponent's king.
A die is rolled for every move. The number determines which piece can be used to make the move. 1 - pawn, 2 - knight, 3 - bishop, 4 - rook, 5 - queen, 6 - king.
If a pawn is to be promoted (would advance to the last row), the player can move it even if the die does not show 1. However, he can only promote it to the piece chosen by the die roll - for example, if 3 is rolled, the pawn can be promoted to a bishop only. If 1 is rolled, the pawn can be promoted to any piece. The game is played on a 8x8 board.
###
| (define "NoEnemyKings" (no Pieces Next "King_noCross")) (define "PlayAPiece" (or (forEach Die (if (= (pips) 6) (forEach Piece "King_noCross") (if (= (pips) 5) (forEach Piece "Queen") (if (= (pips) 4) (forEach Piece "Rook") (if (= (pips) 2) (forEach Piece "Knight") (if (= (pips) 3) (forEach Piece "Bishop") (if (= (pips) 1) (forEach Piece "Pawn")))))))) (forEach Site (sites Direction from:(sites Mover) (if (is Mover P1) S N) distance:1) (if (= (what at:(site)) (id "Pawn" Mover)) (or (if (can Move ("CaptureForwardDiagonal" (from (site)))) ("CaptureForwardDiagonal" (from (site)))) (if (can Move ("StepForwardToEmpty" (from (site)))) ("StepForwardToEmpty" (from (site)))) (then (if (is In (last To) (sites Mover "Promotion")) (moveAgain)))))))) (define "StepForwardToEmpty" (move Step #1 Forward (to if:(is Empty (to))))) (define "PromoteTo" (move Promote (last To) (piece #1) Mover)) (define "CaptureForwardDiagonal" (move Step #1 (directions {FR FL}) (to if:("IsEnemyAt" (to)) (apply (remove (to)))))) (game "Dice Chess" (players {(player N) (player S)}) (equipment { (board (square 8)) (dice d:6 from:1 num:1) (piece "Pawn" Each (or { (if (is In (from) (sites Start (piece (what at:(from))))) ("DoubleStepForwardToEmpty")) ("StepForwardToEmpty") ("CaptureForwardDiagonal")} (then ("ReplayInMovingOn" (sites Mover "Promotion"))))) ("ChessBishop" "Bishop") ("ChessKnight" "Knight") ("ChessRook" "Rook") ("ChessQueen" "Queen") ("ChessKing" "King_noCross") (regions "Promotion" P1 (sites Top)) (regions "Promotion" P2 (sites Bottom))}) (rules (start { (place "Pawn1" {"A2" "B2" "C2" "D2" "E2" "F2" "G2" "H2"}) (place "Pawn2" {"H7" "G7" "E7" "F7" "D7" "C7" "B7" "A7"}) (place "Bishop1" {"C1" "F1"}) (place "Bishop2" {"C8" "F8"}) (place "Knight1" {"B1" "G1"}) (place "Knight2" {"G8" "B8"}) (place "Rook1" {"A1" "H1"}) (place "Rook2" {"H8" "A8"}) (place "Queen1" coord:"D1") (place "Queen2" coord:"D8") (place "King_noCross1" coord:"E1") (place "King_noCross2" coord:"E8")}) (play (do (if ("NewTurn") (roll)) next:(if ("SameTurn") (if (= (count Pips) 1) (or { ("PromoteTo" "Bishop") ("PromoteTo" "Knight") ("PromoteTo" "Rook") ("PromoteTo" "Queen") ("PromoteTo" "King_noCross")}) (if (= (count Pips) 2) ("PromoteTo" "Knight") (if (= (count Pips) 3) ("PromoteTo" "Bishop") (if (= (count Pips) 4) ("PromoteTo" "Rook") (if (= (count Pips) 5) ("PromoteTo" "Queen") ("PromoteTo" "King_noCross")))))) "PlayAPiece"))) (end (if "NoEnemyKings" (result Next Loss))))) END |
Modify the Ludii game according to the following option changes:
Keep-a-riding -> Conflagration, Firestorm Variant (longer)
Order 5 board -> Order 6 board
(define "ColourBackground" (colour 245 245 245)) (define "Last2MoveEnd" ("BlockWin")) (define "AMSEnd" (if (no Moves Next) (result Mover Loss))) (define "StandardEnd" (if (or { (no Moves Next) ("IsSingleGroupOf" Mover) ("IsSingleGroupOf" Next)}) { (if ("IsSingleGroupOf" Mover) (result Mover Win)) (if ("IsSingleGroupOf" Next) (result Next Win)) ("Last2MoveEnd")})) (define "IsSingleGroupOf" (= 1 (count Groups Cell Orthogonal if:(is #1 (who at:(to)))))) (define "Shakattrition" (do (set Var "OriginGroupSize" (size Group at:(from)) (then (set Var "From" (from)))) next:(move (from (from)) (to (intersection (sites Board) (sites Around (from) if:(is Empty (to)))) if:(<= (var "OriginGroupSize") ("DestinationGroupSize")))))) (define "PriorityCaptureOverMoveByPiece" (forEach Piece (priority (move (from) (to (sites LineOfSight Piece at:(from)) if:(is Next (who at:(to))) (apply (remove (to))))) ("Shakattrition")))) (define "PriorityMoveOverCaptureByPiece" (forEach Piece (priority ("Shakattrition") (move (from) (to (sites LineOfSight Piece at:(from)) if:(is Next (who at:(to))) (apply (remove (to)))))))) (define "MoveOrLOSCapture" (forEach Piece (or (move (from) (to (sites LineOfSight Piece at:(from)) if:(is Next (who at:(to))) (apply (remove (to))))) ("Shakattrition")))) (define "FirstFriend" (sites To (move Hop #1 (between (min 0) if:(or { (= (from) (between)) (is Next (who at:(between))) (is Empty (between))})) (to (sites Board) if:(is Mover (who at:(to))))))) (define "ValueAtFrom" (set Var "MaxSizeFrom" (max 1 (max (results from:(from) to:("FirstFriend" Orthogonal) (size Group at:(to) Orthogonal if:(= (mover) (who at:(to))))))))) (define "ValueAtTo" (max 1 (max (results from:(last To) to:("FirstFriend" Orthogonal) (size Group at:(to) Orthogonal if:(= (mover) (who at:(to)))))))) (define "MoveToSiteWithFriendVisible" (< 1 (count Pieces Mover in:(sites LineOfSight Piece at:(to) Orthogonal)))) (define "MoveTowardFriendInSameLine" (< 0 (count Pieces Mover in:("FurtherAlongLine" #1)))) (define "FurtherAlongLine" (sites Distance (step #1 (to if:True)) from:(to) (min 1))) (define "AlongLine" (sites Distance (step #1 (to if:True)) from:(from) (min 1))) (define "IsPlayableSiteType" (is In (to) ("PlayableSite"))) (define "PlayableSite" (difference (sites Board) (sites Occupied by:Mover))) (define "DestinationGroupSize" (count Sites in:(sites Distance Orthogonal (step (to if:(and (!= (var "From") (to)) (is Mover (who at:(to)))))) from:(to) (min 0)))) (game "Conflagration and Keep-a-riding" (players 2) (equipment { (board (hex Hexagon 5) use:Cell) (piece "Disc" Each)}) (rules (start {(place "Disc1" {0 3 7 10 12 15 18 21 24 28 31 34 35 38 41 44 47 52 55 56 59}) (place "Disc2" {1 4 5 8 13 16 19 22 25 26 29 32 36 39 42 45 48 50 53 57 60})}) (play "PriorityMoveOverCaptureByPiece") (end "Last2MoveEnd")))
###
| (define "ColourBackground" (colour 245 245 245)) (define "Last2MoveEnd" ("BlockWin")) (define "AMSEnd" (if (no Moves Next) (result Mover Loss))) (define "StandardEnd" (if (or { (no Moves Next) ("IsSingleGroupOf" Mover) ("IsSingleGroupOf" Next)}) { (if ("IsSingleGroupOf" Mover) (result Mover Win)) (if ("IsSingleGroupOf" Next) (result Next Win)) ("Last2MoveEnd")})) (define "IsSingleGroupOf" (= 1 (count Groups Cell Orthogonal if:(is #1 (who at:(to)))))) (define "Shakattrition" (do (set Var "OriginGroupSize" (size Group at:(from)) (then (set Var "From" (from)))) next:(move (from (from)) (to (intersection (sites Board) (sites Around (from) if:(is Empty (to)))) if:(<= (var "OriginGroupSize") ("DestinationGroupSize")))))) (define "PriorityCaptureOverMoveByPiece" (forEach Piece (priority (move (from) (to (sites LineOfSight Piece at:(from)) if:(is Next (who at:(to))) (apply (remove (to))))) ("Shakattrition")))) (define "PriorityMoveOverCaptureByPiece" (forEach Piece (priority ("Shakattrition") (move (from) (to (sites LineOfSight Piece at:(from)) if:(is Next (who at:(to))) (apply (remove (to)))))))) (define "MoveOrLOSCapture" (forEach Piece (or (move (from) (to (sites LineOfSight Piece at:(from)) if:(is Next (who at:(to))) (apply (remove (to))))) ("Shakattrition")))) (define "FirstFriend" (sites To (move Hop #1 (between (min 0) if:(or { (= (from) (between)) (is Next (who at:(between))) (is Empty (between))})) (to (sites Board) if:(is Mover (who at:(to))))))) (define "ValueAtFrom" (set Var "MaxSizeFrom" (max 1 (max (results from:(from) to:("FirstFriend" Orthogonal) (size Group at:(to) Orthogonal if:(= (mover) (who at:(to))))))))) (define "ValueAtTo" (max 1 (max (results from:(last To) to:("FirstFriend" Orthogonal) (size Group at:(to) Orthogonal if:(= (mover) (who at:(to)))))))) (define "MoveToSiteWithFriendVisible" (< 1 (count Pieces Mover in:(sites LineOfSight Piece at:(to) Orthogonal)))) (define "MoveTowardFriendInSameLine" (< 0 (count Pieces Mover in:("FurtherAlongLine" #1)))) (define "FurtherAlongLine" (sites Distance (step #1 (to if:True)) from:(to) (min 1))) (define "AlongLine" (sites Distance (step #1 (to if:True)) from:(from) (min 1))) (define "IsPlayableSiteType" (is In (to) ("PlayableSite"))) (define "PlayableSite" (difference (sites Board) (sites Occupied by:Mover))) (define "DestinationGroupSize" (count Sites in:(sites Distance Orthogonal (step (to if:(and (!= (var "From") (to)) (is Mover (who at:(to)))))) from:(to) (min 0)))) (game "Conflagration and Keep-a-riding" (players 2) (equipment { (board (hex Hexagon 6) use:Cell) (piece "Disc" Each)}) (rules (start {(place "Disc1" {0 3 8 11 14 17 20 21 24 27 32 35 38 41 44 47 50 53 56 59 61 64 67 71 74 77 80 83 85 88}) (place "Disc2" {2 5 7 10 13 16 19 23 26 29 31 34 37 40 43 46 49 52 55 58 63 66 69 70 73 76 79 82 87 90})}) (play "PriorityMoveOverCaptureByPiece") (end "AMSEnd"))) END |
Modify the Ludii game according to the following option changes:
The game involves 2 players. -> The game involves 3 players.
(define "Goal" 12) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" ("ThrowValue"))) (define "ThrowValue" (mapEntry "ThrowDiceValue" (count Pips))) (game "Main Pacheh" (players 2) (equipment { (board (square 5) { (track "Track1" "2,E,N,W,S,E1,N3,E2,S2,W1,12" P1 directed:True) (track "Track2" "22,W,S,E,N,W1,S3,W2,N2,E1,12" P2 directed:True)}) (piece "Marker" Each (if ("IsNotOffBoard" "SiteToMoveOnTrack") (if (or (is Empty "SiteToMoveOnTrack") ("IsEnemyAt" "SiteToMoveOnTrack")) (move (from (from) level:(level)) (to "SiteToMoveOnTrack" ("HittingCapture" (mapEntry "StartingPoint" (who at:(to))))))) (then (if (= "Goal" (last To)) (remove (last To)))))) (map "ThrowDiceValue" {(pair 0 8) (pair 1 1) (pair 2 2) (pair 3 3) (pair 4 4)}) (map "StartingPoint" {(pair 1 2) (pair 2 22) (pair 3 14) (pair 4 10)}) ("StickDice" 4)}) (rules (start { (place Stack "Marker1" 2 count:4) (place Stack "Marker2" 22 count:4)}) (play ("RollMove" (if (can Move (forEach Piece)) (forEach Piece (then (if (= ("ThrowValue") 8) (moveAgain)))) (move Pass (then (if (= ("ThrowValue") 8) (moveAgain))))))) (end ("EscapeWin"))))
###
| (define "Goal" 12) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" ("ThrowValue"))) (define "ThrowValue" (mapEntry "ThrowDiceValue" (count Pips))) (game "Main Pacheh" (players 3) (equipment { (board (square 5) { (track "Track1" "2,E,N,W,S,E1,N3,E2,S2,W1,12" P1 directed:True) (track "Track2" "22,W,S,E,N,W1,S3,W2,N2,E1,12" P2 directed:True) (track "Track3" "14,N,W,S,E,N1,W3,N2,E2,S1,12" P3 directed:True)}) (piece "Marker" Each (if ("IsNotOffBoard" "SiteToMoveOnTrack") (if (or (is Empty "SiteToMoveOnTrack") ("IsEnemyAt" "SiteToMoveOnTrack")) (move (from (from) level:(level)) (to "SiteToMoveOnTrack" ("HittingCapture" (mapEntry "StartingPoint" (who at:(to))))))) (then (if (= "Goal" (last To)) (remove (last To)))))) (map "ThrowDiceValue" {(pair 0 8) (pair 1 1) (pair 2 2) (pair 3 3) (pair 4 4)}) (map "StartingPoint" {(pair 1 2) (pair 2 22) (pair 3 14) (pair 4 10)}) ("StickDice" 4)}) (rules (start { (place Stack "Marker1" 2 count:4) (place Stack "Marker2" 22 count:4) (place Stack "Marker3" 14 count:4)}) (play ("RollMove" (if (can Move (forEach Piece)) (forEach Piece (then (if (= ("ThrowValue") 8) (moveAgain)))) (move Pass (then (if (= ("ThrowValue") 8) (moveAgain))))))) (end ("EscapeWin")))) END |
Construct a Ludii game based on the following description
Square board, divided into eight equal triangles, and a circle around the square, touching it at the corners, 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 First player moves only when all the pieces are placed.
###
| (game "Hyvn aetter Hare" (players 2) (equipment { (board (splitCrossings (merge (shift .5 .5 (scale 0.707 (concentric {1 8}))) (square 2))) use:Vertex) (piece "Hare" P1 "StepToEmpty") (piece "Dog" P2 "StepToEmpty") (hand Each)}) (rules (start { (place "Hare1" (handSite P1) count:1) (place "Dog2" (handSite P2) count:3)}) phases:{ (phase "Placement" (play (if ("HandOccupied" Mover) (move (from (handSite Mover)) (to (sites Empty))))) (nextPhase ("HandEmpty" P2) "Movement")) ("PhaseMovePiece" "Movement" (end ("NoMoves" Loss)))})) END |
Construct a Ludii game based on the following description
Two rows of six holes with two stores. Four counters in each hole. Players sow in an anti-clockwise direction from a hole in their row. Sowing ends when the last counter falls into a hole, making it contain four counters, which are taken. Sowing also ends when the last counter falls into an empty hole. Sowing continues in any other scenario by picking up the contents of the hole where the last counter was dropped and continuing to sow. The game ends when one player can no longer move. The remaining counters are taken by the last player that was able to move and put into the store. A new round begins: The winner of the previous round now owns seven holes - the six in his row and the next hole in the opponent's row. Player takes fours from the extra hole.
###
| (define "PiecesOwnedBy" (+ (count at:(mapEntry #1)) (count in:(sites #1)))) (game "Whyo" (players 2) (equipment { (mancalaBoard 2 6 (track "TrackCCW" "1,E,N,W" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece "Seed" Shared) (map {(pair P1 FirstSite) (pair P2 LastSite)})}) (rules (start (set Count 4 to:(sites Track))) (play (move Select (from (if ("SameTurn") "LastHoleSowed" (if (= (score P1) 1) (if (is Mover P1) (union (sites Mover) (sites {12})) (difference (sites Mover) (sites {12}))) (if (= (score P2) 1) (if (is Mover P2) (union (sites Mover) (sites {1})) (difference (sites Mover) (sites {1}))) (sites Mover)))) if:(> (count at:(from)) 0)) (then (sow apply:(if (= (count at:(to)) 4) (fromTo (from (to)) (to (mapEntry Mover)) count:(count at:(to))) (if (< (count at:(to)) 1) (moveAgain))) (then (if (no Moves Next) (and (forEach Site (union (sites P1) (sites P2)) (if (> (count at:(site)) 0) (fromTo (from (site)) (to (mapEntry Mover)) count:(count at:(site)))) (then (and { (if (< ("PiecesOwnedBy" P1) ("PiecesOwnedBy" P2)) (addScore P2 1)) (if (< ("PiecesOwnedBy" P2) ("PiecesOwnedBy" P1)) (addScore P1 1)) (if (< (var) 0) (and { (forEach Site (sites Board) (if (> (count at:(site)) 0) (remove (site)))) (forEach Site (union (sites P1) (sites P2)) (add (piece (id "Seed" Shared)) (to (site)) count:4))}))}))) (set Var (+ (var) 1))))))))) (end (if (= (var) 1) (byScore))))) END |
Construct a Ludii game based on the following description
Played by two to five players. Each player has three heaps of counters, with twelve counters per heap. Sowing occurs in an anti-clockwise direction. When a player creates a heap containing three counters in an opponent's heap, a circle is drawn around the heap and the player captures the counters in it and every counter sown into it for the rest of the game. When there are no heaps left, the player with the most counters wins. Each hole contains initially 12 seeds. The game is played with 5 players.
###
| (define "PiecesOwnedBy" (count Cell at:(handSite #1))) (define "NumPlayers" 5) (game "Pic" (players "NumPlayers") (equipment { (board (concentric {(* 3 "NumPlayers")}) (track "Track" {0 1 3 5 7 9 11 13 14 12 10 8 6 4 2} loop:True) use:Vertex) (piece "Seed" Shared) (hand Each) (regions P1 (sites {0 1 3})) (regions P2 (sites {5 7 9})) (regions P3 (sites {11 13 14})) (regions P4 (sites {12 10 8})) (regions P5 (sites {6 4 2}))}) (rules (start (set Count 12 to:(sites Track))) (play (or { (move Select (from (sites Mover) if:(is Occupied (from))) (then (sow apply:(if (and (not (is In (to) (sites Mover))) (= 3 (count at:(to)))) (and (fromTo (from (to)) (to (handSite Mover)) count:3) (set State at:(to) (mover)))))))} (then (forEach Site (sites Board) (if (and (is Occupied (site)) (!= 0 (state at:(site)))) (and (fromTo (from (site)) (to (handSite (state at:(site)))) count:(count at:(site))) (set State at:(site) (state at:(site))))))))) (end (if ("NoPieceOnBoard") (byScore { (score P1 ("PiecesOwnedBy" P1)) (score P2 ("PiecesOwnedBy" P2)) (score P3 ("PiecesOwnedBy" P3)) (score P4 ("PiecesOwnedBy" P4)) (score P5 ("PiecesOwnedBy" P5))}))))) END |
Construct a global Ludii definition which fulfills the following requirements.
Defines two opposite table tracks.
###
| (define "TableTracksOpposite" { (track "Track1" {0..11 23..12 #1} P1 directed:True) (track "Track2" {12..23 11..0 #1} P2 directed:True)}) END |
Describe the mechanics of the following Ludii game
(game "Yaguarete Kora" (players 2) (equipment { (board (rotate 180 ("AlquerqueGraphWithBottomTriangle")) use:Vertex) (piece "Jaguar" P1 (or ("StepToEmpty") ("HopCapture"))) (piece "Dog" P2 ("StepToEmpty"))}) (rules (start { (place "Jaguar1" coord:"C6") (place "Dog2" (expand (sites Bottom) steps:2))}) (play (forEach Piece)) (end { (if (no Moves P1) (result P1 Loss)) (if (<= (count Pieces P2) 6) (result P1 Win))})))
###
| 5x5 intersecting lines with diagonals in each quadrant. A triangle, the apex intersecting with the apex of one of the sides. A line is drawn from the apex to the midpoint of the base of the triangle. A line bisects this line, connecting the midpoints of the sides of the triangle, One player plays as one jaguar, which begins on the center of the base of the large triangle's base. The other player plays as fifteen dogs, which begin on the points of the three ranks of the bottom half of the square portion of the board. The jaguar moves first. Pieces move to an empty adjacent space along the lines of the board. The jaguar may hop over an adjacent dog to an empty space immediately on the opposite side of it, capturing the dog. Dogs cannot capture. The dogs win by blocking the jaguar so it cannot move; the jaguar wins when only six dogs remain. END |
Construct a Ludii game based on the following description
2x6 board. Four counters in each hole. Sowing occurs in a clockwise direction. When the final counter of a sowing lands in an occupied hole, the contents of the hole are picked up and sowing continues. If this occupied hole is in the opponent's row and is made to contain four with the final counter, this hole and the one opposite it are captured, the counters remaining in the holes. Players may not sow from these holes. If on a subsequent turn the final counter of a sowing falls into an opponent's captured hole, one counter from the hole is captured, as well as the final counter of the sowing, and the turn ends. When the final counter of a sowing lands in an empty hole, the turn ends. Play continues until one of the players can no longer move, the opponent taking any remaining counters in free holes on their side of the board and each player taking the counters in their captured holes. A new round begins. Players attempt to fill their holes with four counters each. If a player has two extra counters, they may loan them to the other player, to be repaid when they can in a subsequent round. If a player has one extra counter, it is surrendered to the opponent. The player with more counter would only fill as many hole as the opponent is able to fill, retaining their extra counters for future rounds. Play continues until one player cannot fill any holes.
###
| (define "NoPieceOnBoard" (no Pieces All in:(sites Board))) (define "APlayerCanNotMove" (and (not (is Next Mover)) (or (all Sites (sites P1) if:(or (!= 0 (state at:(site))) (is Empty (site)))) (all Sites (sites P2) if:(or (!= 0 (state at:(site))) (is Empty (site))))))) (define "Columns" 6) (game "Leyla" (players 2) (equipment { (mancalaBoard 2 "Columns" store:None (track "Track" "5,W,N,E" loop:True)) (piece "Seed" Shared) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (hand Each)}) (rules (start (set Count 4 to:(sites Track))) phases:{ (phase "Sowing" (play (or { (move Select (from (if ("SameTurn") (sites {(var "Replay")}) (sites Mover)) if:(and (is Occupied (from)) (= 0 (state at:(from))))) (then (sow apply:(if (!= 0 (state at:(to))) (if (= (next) (state at:(to))) (and (fromTo (from (to)) (to (handSite Mover)) count:(min 2 (count at:(to)))) (set State at:(to) (next)))) (if (and (is In (to) (sites Next)) (= 4 (count at:(to)))) (and (set State at:(to) (mover)) (set State at:("OppositePitTwoRows" (to)) (mover))) (if (< 1 (count at:(to))) (and (moveAgain) (set Var "Replay" (to)))))))))} (then (if ("APlayerCanNotMove") (and { (forEach Site (sites P1) (if (= 0 (state at:(site))) (fromTo (from (site)) (to (handSite P1)) count:(count at:(site))))) (forEach Site (sites P2) (if (= 0 (state at:(site))) (fromTo (from (site)) (to (handSite P2)) count:(count at:(site))))) (forEach Site (sites Board) (if (= (state at:(site)) P1) (and (fromTo (from (site)) (to (handSite P1)) count:(count at:(site))) (set State at:(site) 0)) (if (= (state at:(site)) P2) (and (fromTo (from (site)) (to (handSite P2)) count:(count at:(site))) (set State at:(site) 0)))))}))))) (end (if ("NoPieceOnBoard") { (if (> 3 (count Cell at:(handSite P1))) (result P2 Win)) (if (> 3 (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 (sites Mover) if:(is Empty (to))) count:4 (then (if (= 1 (count Cell at:(handSite Mover))) (fromTo (from (handSite Mover)) (to (handSite Next)) count:1) (if (= 2 (count Cell at:(handSite Mover))) (fromTo (from (handSite Next)) (to (handSite Mover)) count:2) (if (= 3 (count Cell at:(handSite Mover))) (fromTo (from (handSite Next)) (to (handSite Mover)) count:1)))))))) (nextPhase (and (= (count Sites in:(forEach (sites P1) if:(is Occupied (site)))) (count Sites in:(forEach (sites P2) if:(is Occupied (site))))) (or (is Empty (handSite P1)) (is Empty (handSite P2)))) "Sowing"))})) END |
Construct a Ludii game based on the following description
2x6 board. Four counters in each hole. The first player takes three counters from each of their holes, and sows them beginning in the opponent's first hole. Sowing proceeds in an anti-clockwise direction, and when the final counter lands in an occupied hole, these are picked up and sowing continues. While sowing, if a hole is made to contain four counters, these are captured by the player. When the final counter falls into an empty hole, the turn ends, unless the player was able to make a capture during the sowing, in which case they may play again. A player with no counters on their side must pass, and may continue playing when there are counters in their holes again. Play continues until all the counters are captured, and the player with the most counters wins. 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, but not if there are one or two extra. Play continues in several rounds like this until one player captures all the holes.
###
| (define "RemmemberOwnedHoles" (if (is Mover P1) (remember Value "OwnedP1" #1) (remember Value "OwnedP2" #1))) (define "RightMostEmpty" (trackSite FirstSite "TrackCW" from:(mapEntry "RightMost" Mover) if:(is Empty (to)))) (define "OwnedHoles" (if (is Mover P1) (sites (values Remembered "OwnedP1")) (sites (values Remembered "OwnedP2")))) (game "Lam Waladach" (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 Count 4 to:(sites Track)) (set RememberValue "OwnedP1" (sites Bottom)) (set RememberValue "OwnedP2" (sites Top))}) phases:{ (phase "Opening" (play (move Select (from 11) (then (and (forEach Site (sites Mover) (fromTo (from (site)) (to 11) count:3)) (sow count:18 "TrackCCW" apply:(if (< 1 (count at:(to))) (and (moveAgain) (set Var "Replay" (to)))) origin:True))))) (nextPhase "Sowing")) (phase "Sowing" (play (or { (move Select (from (if (and (not (is Pending)) ("SameTurn")) (sites {(var "Replay")}) ("OwnedHoles")) if:(> (count at:(from)) 0)) (then (do (set Var "NumSowed" (count at:(last To))) next:(sow "TrackCCW" apply:(if (< 1 (count at:(to))) (and (moveAgain) (set Var "Replay" (to))))) (then (and (forEach Site (sites Track from:(last From) to:(trackSite Move from:(last From) "Track" steps:(var "NumSowed"))) (if (= 4 (count at:(site))) (and (fromTo (from (site)) (to (handSite Mover)) count:4) (and (moveAgain) (set Pending))))) (set Var "NumSowed" 0))))))} (then (if ("NoPieceOnBoard") (and (forget Value "OwnedP1" All) (forget Value "OwnedP2" All)))))) (end (if ("NoPieceOnBoard") { (if (> 3 (count Cell at:(handSite P1))) (result P2 Win)) (if (> 3 (count Cell at:(handSite P2))) (result P1 Win))})) (nextPhase ("NoPieceOnBoard") "BetweenRounds")) (phase "BetweenRounds" (play (if (<= 3 (count Cell at:(handSite Mover))) (move (from (handSite Mover)) (to ("RightMostEmpty")) count:(if (>= (count Cell at:(handSite Mover)) 4) 4 3) (then ("RemmemberOwnedHoles" (last To)))))) (nextPhase (all Passed) "Sowing"))})) END |
Construct a Ludii game based on the following description
Viking Chess is played on a board with 12 files and 7 ranks. The pieces are set up with both sides starting on the same side of board. Both sides' Pawns move in the same direction, and all Pawns promote normally upon reaching the (same) 7th rank. There is no Pawn double-move or en passant capture. There is no castling.
###
| (game "Viking Chess" (players {(player N) (player N)}) (equipment { (board (rectangle 7 12)) ("ChessPawn" "Pawn" ~ (then (and ("ReplayInMovingOn" (sites Mover "Promotion")) (set Counter)))) ("ChessRook" "Rook") ("ChessKing" "King") ("ChessBishop" "Bishop") ("ChessKnight" "Knight") ("ChessQueen" "Queen") (regions "Promotion" P1 (sites Top)) (regions "Promotion" P2 (sites Top))}) (rules (start { (place "Pawn1" {"B2" "B3" "C3" "D3" "E3" "E2" "F2" "F1"}) (place "Rook1" {"A1" "A2"}) (place "Knight1" {"C2" "D2"}) (place "Bishop1" {"B1" "E1"}) (place "Queen1" coord:"D1") (place "King1" coord:"C1") (place "Pawn2" {"G1" "G2" "H2" "H3" "I3" "J3" "K3" "K2"}) (place "Rook2" {"L1" "L2"}) (place "Knight2" {"J2" "I2"}) (place "Bishop2" {"K1" "H1"}) (place "Queen2" coord:"I1") (place "King2" coord:"J1")}) (play (if "SameTurn" (move Promote (last To) (piece {"Queen" "Knight" "Bishop" "Rook"}) Mover) (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King" Mover))))) (end { ("Checkmate" "King") (if (or (no Moves Mover) (= (counter) 100)) (result Mover Draw))}))) END |
Construct a global Ludii definition which fulfills the following requirements.
Checks if the next player has no legal moves and the next player loses and checks if a specific player has less or equal than a number of pieces to lose. This ludemeplex can be used only in an ending condition.
###
| (define "NoMovesLossAndLessNumPiecesPlayerLoss" { ("NoMoves" Loss) (if (<= (count Pieces #1) #2) (result #1 Loss))}) END |
Describe the mechanics of the following Ludii game
(define "SafeTeleportation" (fromTo (from (where (id "Human"))) (to (sites Random (difference (sites Empty) (sites Around (sites Occupied by:Shared))))) (then ("RobotThreat")))) (define "Teleportation" (fromTo (from (where (id "Human"))) (to (sites Random)) (then ("RobotThreat")))) (define "KillRobotsIfColliding" (forEach Site (sites Occupied by:Shared) (if (>= (count at:(site)) 2) (and (remove (site)) (add (piece "Rubble0") (to (site))))))) (define "RobotThreat" (forEach Site (sites Occupied by:Shared) ("GoCloser" NE ("GoCloser" NW ("GoCloser" SW ("GoCloser" SE ("GoCloser" E ("GoCloser" W ("GoCloser" N ("GoCloser" S)))))))))) (define "GoCloser" (if ("CloserToHuman" #1) ("MoveRobot" #1) #2)) (define "MoveRobot" (if ("IsPieceAt" "Rubble" Neutral (ahead (site) #1)) (remove (site)) (fromTo (from (site)) (to (ahead (site) #1) (apply (if ("IsPieceAt" "Human" P1 (to)) (remove (to)))))))) (define "CloserToHuman" (> (count Steps Orthogonal (site) (where (id "Human"))) (count Steps Orthogonal (ahead (site) #1) (where (id "Human"))))) (define "NumSafeTeleportation" 5) (define "NumRobots" 20) (game "Chase" (players 1) (equipment { (board (rectangle 10 20)) (piece "Human" P1 ("StepToEmpty" ~ (then ("RobotThreat")))) (piece "Robot" Shared) (piece "Rubble" Neutral)}) (rules (start { (place Random {"Human"}) (place Random {"Robot"} count:("NumRobots")) (set Score P1 ("NumSafeTeleportation"))}) (play (or { (forEach Piece) (move Pass (then ("Teleportation"))) (if (< 0 (score P1)) (move Select (from (where (id "Human"))) (then (and (set Score Mover (- (score P1) 1)) ("SafeTeleportation")))))} (then ("KillRobotsIfColliding")))) (end { (if (no Pieces Mover) (result Mover Loss)) (if (no Pieces "Robot") (result Mover Win))})))
###
| Chase is played on a two-dimensional rectangular grid. The objective of the game is to escape from a number of robots, which have been programmed to kill the player.
The game is turn-based. The player character and the robots start at randomly selected locations. Every time the player character moves a square in any direction (horizontally, vertically, or diagonally), each robot moves one square closer to their new location, in whichever direction is the shortest path. If the player character collides with a robot, they die and the game ends.
The player attempts to survive by causing the robots to kill themselves by colliding with other objects on the map. When two robots collide each other a pile of rubble is created.
The player can also teleport into a randomly selected location. Teleportation counts as a move, and the robots will respond by moving towards the new location. Because the location is randomly selected, it is possible that the player teleports right into the path of a robot. A safe teleport is also possible for the player but can be used only a limited number of times.
The game is won when all of the robots are destroyed.
In Ludii, the number of safe teleportations available is the score of the player. In clicking on the player a safe teleportation will be applied. To make a non safe teleportation, the button Pass has to be pressed. The board has 10 rows. The board has 20 columns. The player has 5 safe teleportations. 20 robots. END |
Modify the Ludii game according to the following option changes:
The game is played on a 13x13 board -> The game is played on a 15x15 board
1 capture to win. -> 2 captures to win.
(define "RemoveSurrounded" (forEach Site (sites Occupied by:Next) (if (= (count Liberties at:(site) Orthogonal) 0) (move Remove (site) (then (addScore Mover 1)))))) (game "BlooGo" (players 2) (equipment { (board (square 13) use:Vertex) (piece "Ball" Each)}) (rules (meta (no Repeat)) (play (move Add (to (sites Empty)) (then "RemoveSurrounded"))) (end { (if (>= (score Mover) 1) (result Mover Win))})))
###
| (define "RemoveSurrounded" (forEach Site (sites Occupied by:Next) (if (= (count Liberties at:(site) Orthogonal) 0) (move Remove (site) (then (addScore Mover 1)))))) (game "BlooGo" (players 2) (equipment { (board (square 15) use:Vertex) (piece "Ball" Each)}) (rules (meta (no Repeat)) (play (move Add (to (sites Empty)) (then "RemoveSurrounded"))) (end { (if (>= (score Mover) 2) (result Mover Win))}))) END |
Construct a Ludii game based on the following description
8x8 board. 8 Bhata (or Padati; move like Chess pawns but without being able to move two on the first turn); 2 Ashva (horses; move like Chess knights); 2 Gaja (elephants; two spaces in any orthogonal direction, jumping over the first square); 2 Ratha (chariots; moves like a rook in chess); 1 Mantri (counselor; moves one square diagonally in any direction); 1 Raja (king; moves one square in any direction). These are set up along one edge of the board: Gaja-Ratha-Ashva-Mantri-Raja-Ashva-Ratha-Gaja, with the eight Bhata lined up in the row in front of these. Players take turns moving. When one piece lands on the space occupied by another piece, it is captured. When a Raja can be captured by an opponent's piece on the next turn, it is in check. The Raja must not be in check at the end of the player's turn. When this is unavoidable, it is checkmate and the opponent wins. A Raja that is stalemated wins. A player who reduces their opponent to only the Raja wins.
###
| (game "Chaturanga (al-Adli)" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) (piece "King_noCross" ("StepToNotFriend")) ("ChessRook" "Rook") (piece "Elephant" (move Hop Orthogonal (between (exact 1) if:True) (to if:(not ("IsFriendAt" (to))) (apply (if ("IsEnemyAt" (to)) (remove (to))))))) ("ChessKnight" "Knight") ("ChessPawn" "Pawn") (piece "Queen" ("StepToNotFriend" Diagonal)) (regions "Promotion" P1 (sites Top)) (regions "Promotion" P2 (sites Bottom))}) (rules (start { (place "Pawn1" (sites Row 1)) (place "Pawn2" (sites Row 6)) (place "Elephant1" {"A1" "H1"}) (place "Rook1" {"B1" "G1"}) (place "Knight1" {"C1" "F1"}) (place "Queen1" coord:"D1") (place "King_noCross1" coord:"E1") (place "Elephant2" {"A8" "H8"}) (place "Rook2" {"B8" "G8"}) (place "Knight2" {"C8" "F8"}) (place "Queen2" coord:"E8") (place "King_noCross2" coord:"D8")}) (play (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King_noCross" Mover)))) (end { ("Checkmate" "King_noCross") (if (= (count Pieces Next) 1) (result Mover Loss))}))) END |
Construct a Ludii game based on the following description
Start on an empty board.
On a turn either enter a piece not in line of sight of your own pieces, or move a piece a number of independent single steps not to exceed the count of that piece's enemy neighbours.
If one player passes, to avoid ending the game with a 2nd pass, the opponent must place a piece if possible, or if unable to place, he may move in a way that enables his future placement. Otherwise, he must pass and the game ends.
The winner is the player with the most pieces in play. If equal, the last to pass loses. Order 5 board Hex N / N+1 Grid
###
| (define "BoardUsed" (hex Limping 5)) (define "StepIteration" (if (<= #2 (count Pieces Next in:(sites Around (from)))) (move (from (from)) (to (#1))))) (define "S5" (intersection (sites Empty) (sites Around ("S4")))) (define "S4" (intersection (sites Empty) (sites Around ("S3")))) (define "S3" (intersection (sites Empty) (sites Around ("S2")))) (define "S2" (intersection (sites Empty) (sites Around ("S1")))) (define "S1" (intersection (sites Empty) (sites Around (from)))) (define "StepMoves" (or { ("StepIteration" "S1" 1) ("StepIteration" "S2" 2) ("StepIteration" "S3" 3) ("StepIteration" "S4" 4) ("StepIteration" "S5" 5)})) (define "PlaceOutOfSight" (move Add (to (sites Empty) if:(not (is Within (id "Disc" Mover) in:(sites LineOfSight Piece at:(to))))) (then (addScore Mover 1)))) (game "Infuse" (players 2) (equipment { (board "BoardUsed" use:Cell) (piece "Disc" Each)}) (rules (start (set Score Each 0)) (play (if (was Pass) (or (move Pass) (priority ("PlaceOutOfSight") (forEach Piece (do ("StepMoves") ifAfterwards:(can Move (add (to (sites Empty) if:(not (is Within (id "Disc" Mover) in:(sites LineOfSight Piece at:(to))))))))))) (or { ("PlaceOutOfSight") (forEach Piece ("StepMoves")) (move Pass)}))) (end { (if (and (all Passed) (> (score Mover) (score Next))) (result Mover Win)) (if (and (all Passed) (<= (score Mover) (score Next))) (result Next Win))}))) END |
Modify the Ludii game according to the following option changes:
The game uses square tiles -> The game uses triangle tiles
(define "NumTiles" 24) (game "Bravalath" (players 2) (equipment { (boardless Square) (tile "Square" Each numSides:4)}) (rules (start { (place "Square1" (centrePoint)) (place "Square2" (ahead (centrePoint) E))}) (play (move Add (to (sites Playable) if:(<= 1 (count Sites in:(sites Around (to) NotEmpty)))))) (end { (if (is Line 4) (result Mover Win)) (if (is Line 3) (result Mover Loss))})))
###
| (define "NumTiles" 24) (game "Bravalath" (players 2) (equipment { (boardless Triangular) (tile "Triangle" Each numSides:3)}) (rules (start { (place "Triangle1" (centrePoint)) (place "Triangle2" (ahead (centrePoint) E))}) (play (move Add (to (sites Playable) if:(<= 1 (count Sites in:(sites Around (to) NotEmpty)))))) (end { (if (is Line 4) (result Mover Win)) (if (is Line 3) (result Mover Loss))}))) END |
Construct a Ludii game based on the following description
A series of three parallel lines are drawn, with diagonals connecting the outer lines at intervals, crossing each other at the central line. Eight in the outer rows, nine in the central. Pieces are moved along the intersections, and they are placed on the board on opposing sides, leaving the central spot empty. The first player moves to this spot along one of the lines, and the opponent jumps this pieces, thereby capturing it.
###
| (game "Awithlaknan Mosona" (players 2) (equipment { (board (merge { (repeat 1 1 step:{{0.5 0} {1 0}} (poly {{0.5 0} {0 0} {0 0.5}})) (repeat 1 1 step:{{0.5 0} {1 0}} (poly {{0.5 0} {0 0} {0 -0.5}})) (repeat 7 1 step:{{0.5 0} {1 0}} (poly {{0.5 0} {0 0.5} {1 0.5}})) (repeat 7 1 step:{{0.5 0} {1 0}} (poly {{0.5 0} {0 -0.5} {1 -0.5}})) (shift (- 7 1) 0 (repeat 1 1 step:{{0.5 0} {1 0}} (poly {{0.5 0} {1 0.5} {1 0}}))) (shift (- 7 1) 0 (repeat 1 1 step:{{0.5 0} {1 0}} (poly {{0.5 0} {1 0} {1 -0.5}}))) (shift 0.5 0 (rectangle 1 7))}) use:Vertex) (piece "Counter" Each (or ("HopCapture") ("StepToEmpty")))}) (rules (start { (place "Counter1" (union (sites Bottom) (sites Direction from:(centrePoint) W))) (place "Counter2" (union (sites Direction from:(centrePoint) E) (sites Top)))}) (play (forEach Piece)) (end ("NoMoves" Loss)))) END |
Construct a Ludii game based on the following description
Played on a 3x4 board with an extension of 8 in the middle row. Spaces are unmarked. Rules from Seleucid.
###
| (define "MoveTo" ("NextSiteOnTrack" ("CountPips"))) (define "RemoveAPiece" (move Remove (from))) (define "CountPips" (if (= 0 (face 23)) (face 22) (if (= 1 (face 22)) (+ (face 22) 5) (if (= 2 (face 22)) (+ (face 22) 6) (if (= 3 (face 22)) (+ (face 22) 7) (+ (face 22) 10)))))) (game "20 Squares" (players 2) (equipment { (board (merge (rectangle 3 4) (shift 0 1 (rectangle 1 12))) { (track "Track1" "20,3,W,N1,E,End" P1 directed:True) (track "Track2" "21,12,W,S1,E,End" P2 directed:True)}) (dice facesByDie:{{1 2 3 4} {0 1}} num:2) (hand Each) (regions "Replay" (sites {"A1" "A3" "D2" "H2" "L2"})) (piece "UrPiece" Each (if ("IsEndTrack" ("MoveTo")) "RemoveAPiece" (if ("IsNotOffBoard" ("MoveTo")) (if (or (is Empty ("MoveTo")) (and (not ("IsFriendAt" ("MoveTo"))) (not (is In ("MoveTo") (sites "Replay"))))) (move (from) (to ("MoveTo") ("HittingCapture" (handSite (who at:(to))))) (then ("ReplayInMovingOn" (sites "Replay"))))))))}) (rules (start { (place "UrPiece1" (handSite P1) count:7) (place "UrPiece2" (handSite P2) count:7)}) (play ("RollMove" (or (forEach Piece) (forEach Piece container:(mover))))) (end ("EscapeWin")))) END |
What does the following global Ludii definition do?
(define "HopCaptureDistanceNotAlreadyHopped" (move Hop #1 #2 (between before:(count Rows) after:(count Rows) if:(and (not (is In (between) (sites ToClear))) ("IsEnemyAt" (between))) (apply (remove (between)))) (to if:(is Empty (to))) #3))
###
| Defines a hop move in the specified directions over an enemy to an empty site at any distance. The enemy pieces are removed and you can not hop a piece you already hopped during your turn. END |
Describe the mechanics of the following Ludii game
(define "AllCountersInRumba" (= 8 (count at:"Rumba"))) (define "LastHole" (last To afterConsequence:True)) (define "AllSitesNotRumba" (difference (sites Board) "Rumba")) (define "Rumba" 0) (game "Chuka" (players 1) (equipment { (board (concentric {5}) (track "Track" {0 1 3 4 2} loop:True) use:Vertex) (piece "Seed" Shared)}) (rules (start (set Count 2 to:"AllSitesNotRumba")) (play (move Select (from (if (!= ("Rumba") (value Pending)) (sites {"LastHole"}) ("AllSitesNotRumba")) if:(!= 0 (count at:(from)))) (then (sow apply:(if (> (count at:(to)) 1) (set Pending (to))))))) (end { (if ("AllCountersInRumba") (result Mover Win)) (if (and (= 1 (count at:("LastHole"))) (!= ("LastHole") ("Rumba"))) (result Mover Loss))})))
###
| Five holes arranged in a circle. One hole is called the Rumba. Two counters in each hole, except the Rumba. The player sows the counters in one direction. When the final counter lands in an occupied hole, the counters in that hole are picked up and sowing continues. When the final counter lands in the Rumba, the player may pick up the counters from any one of the other holes and continue sowing. If the final counter lands in an empty hole that is not the Rumba, they lose. The goal of the player is to accumulate all of the counters into the Rumba. END |
Modify the Ludii game according to the following option changes:
The board has 19 columns. -> The board has 21 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 19) { (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)))))
###
| (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 21) { (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
Definitions:
1 A group is a stone along with all stones one can reach from it through a series of steps onto adjacent stones of the same color.
1.1 The size of a group is the number of stones in it.
2 A brood is a group along with all other groups of identical color, size and shape. Shapes are considered identical across rotational and mirror-symmetries.
2.1 The size of a brood is the number of groups in it.
2.2 The order of a brood is the size of the groups in it.
Play:
On the very first turn of the game, Black places one stone of their color on any hex.
After, that – starting with White – take turns doing one of the following:
• Pass.
• Place two stones of your color on empty hexes.
When the players pass consecutively, the winner is the player with the higher score.
Scoring:
For each of your odd-sized broods, you score 1 point if its order is odd and 2 points if its order is even. A board of size 5 is currently selected. Nothing is currently printed on the pieces.
###
| (define "PlaceHex" (do (forEach Site (sites Occupied by:Mover) (set State at:(site) 0)) next:(move Add (piece (id "Hex" Mover)) (to (sites Empty)) (then ("RecordShapeVectorsAsValues"))) (then ("ScorePlayer" (mover))))) (define "ScorePlayer" (forEach Group if:(= #1 (who at:(to))) (remember Value (regionSite (sites) index:0) unique:True) (then (and { ("CountShapesOf" #1) (set Score Mover 0 (then (forEach Piece (addScore Mover (state at:(from))))))})))) (define "CountShapesOf" (forEach Value (values Remembered) (and { (set Var "KeySite" (value) (then (forEach Group if:(= #1 (who at:(to))) ("IfShapessMatchDo" (remember Value "ShapeCount" (+ (if (> (var "KeySite") (regionSite (sites) index:0)) 0 1000) (var "KeySite"))) (var "KeySite")))))} (then ("RecordMultiplier"))) (then (forget Value All)))) (define "RecordMultiplier" (if (= 0 "BroodSize") (set State at:(var "KeySite") (* (% "ManifoldBroodSize" 2) (- 2 (% "GroupSize" 2)))) (set State at:(var "KeySite") 0))) (define "ManifoldBroodSize" (+ (count Value (var "KeySite") in:(values Remembered "ShapeCount")) (count Value (+ 1000 (var "KeySite")) in:(values Remembered "ShapeCount")))) (define "BroodSize" (count Value (var "KeySite") in:(values Remembered "ShapeCount"))) (define "GroupSize" (size Group at:(var "KeySite"))) (define "RecordShapeVectorsAsValues" (set Var "LastRow" (row of:(max (array (sites Group at:(last To))))) (then (set Var "LastCol" (max (results from:(sites Group at:(last To)) to:(from) (column of:(from)))) (then (forEach Site (sites Group at:(last To)) (set Value at:(site) (+ (* 32 (- (var "LastRow") (row of:(site)))) (- (var "LastCol") (column of:(site))))))))))) (define "IfShapessMatchDo" (if ("IsSameSizeAsShapeAtValue" #2) (priority { ("IfThisRotationDo" ("DRow") ("DCol") #1 #2) ("IfThisRotationDo" ("DRow") (- "DRow" "DCol") #1 #2) ("IfThisRotationDo" (- "DRow" "DCol") ("DRow") #1 #2) ("IfThisRotationDo" ("DCol") ("DRow") #1 #2) ("IfThisRotationDo" (- "DCol") (- "DRow" "DCol") #1 #2) ("IfThisRotationDo" (- "DCol" "DRow") ("DCol") #1 #2) ("IfThisRotationDo" (- "DRow") (- "DCol") #1 #2) ("IfThisRotationDo" (- "DRow") (- "DCol" "DRow") #1 #2) ("IfThisRotationDo" (- "DCol" "DRow") (- "DRow") #1 #2) ("IfThisRotationDo" (- "DCol") (- "DRow") #1 #2) ("IfThisRotationDo" ("DCol") (- "DCol" "DRow") #1 #2) ("IfThisRotationDo" (- "DRow" "DCol") (- "DCol") #1 #2)}))) (define "IsSameSizeAsShapeAtValue" (= (size Array (array (sites))) (size Array (array (sites Group at:#1))))) (define "DCol" (% (value Piece at:(from)) 32)) (define "DRow" (/ (value Piece at:(from)) 32)) (define "IfThisRotationDo" (if (= 0 (size Array (difference (results from:(sites Group at:#4) to:(from) (+ (+ (* 32 #1) (#2)) (+ (max (results from:(sites Group at:#4) to:(from) (- (* 32 #1)))) (max (results from:(sites Group at:#4) to:(from) (- (#2))))))) (results from:(sites) to:(from) (value Piece at:(from)))))) #3)) (game "Manifold" (players 2) (equipment { (board (hex Hexagon 5) use:Cell) (piece "Hex" Each maxState:7 maxValue:1023) (piece "Disc" Neutral)}) (rules (play (if (or (= 0 (count Moves)) (!= 0 (count MovesThisTurn))) ("PlaceHex") (or (move Pass) (and { ("PlaceHex")} (then (moveAgain)))) (then (forget Value All)))) (end (if (all Passed) (byScore))))) END |
Construct a Ludii game based on the following description
4x8 board, occasionally 4x9 or 10. 29 counters in each player's leftmost hole in their outer row, two in the hole to the right of it and one in the hole to the right of that one. Sowing occurs in an anti-clockwise direction in the player's two rows. Each player begins with a stylised move, by sowing the contents of the hole with two counters. Players alternate turns sowing only from their hole with two counters. When finally a single counter is sown into an inner-row hole that is opposite a hole with a single counter in the opponent's inner row, this counter is captured. The opponent then sows their two remaining counters, capturing two from the opponent. Then, the players sow from their hole with 29 counters, picking up the contents of a hole when the final counter lands in an occupied hole, ending the turn when the final counter lands in an empty hole. When both players have completed this phase, the main phase of the game begins. 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 "NoSiteWith2Seeds" (all Sites (sites Mover "Home") if:(!= 2 (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" (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 29 to:(sites {0 (- (* 4 8) 1)})) (set Count 2 to:(sites {1 (- (* 4 8) 2)})) (set Count 1 to:(sites {2 (- (* 4 8) 3)}))}) phases:{ (phase "Opening1" (play (move Select (from (forEach (sites Mover "Home") if:(= 2 (count at:(site))))) (then (sow "Track" owner:(mover) apply:(if (and (is In (to) (sites Mover "Inner")) (is Occupied ("OppositePit" (to)))) (remove ("OppositePit" (to)))))))) (nextPhase ("NoSiteWith2Seeds") "Opening2")) (phase "Opening2" (play (move Select (from (if ("SameTurn") "LastHoleSowed" (forEach (sites Mover "Home") if:(= 29 (count at:(site))))) if:(> (count at:(from)) 0)) (then (sow "Track" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain)))))) (nextPhase (not (is Next Mover)) "Sowing")) (phase "Sowing" (play (if ("AllSitesNoMoreThanOne") (move Select (from (sites Mover "Home") if:(and (is Occupied (from)) (is Empty ("NextHole" (from) 1)))) (then (sow "Track" owner:(mover)))) (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover "Home")) if:(> (count at:(from)) 1)) (then (sow "Track" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (and (is In (to) (sites Mover "Inner")) (is Occupied ("OppositePit" (to)))) (and (remove ("OppositePit" (to))) (if (is Occupied ("OppositeOuterPit" (to))) (remove ("OppositeOuterPit" (to)))))))))))))} (end (forEach NonMover if:("NoPiece") (result Player Loss))))) END |
Describe the mechanics of the following Ludii game
(define "NoPiece" (all Sites (sites Player "Home") if:(= 0 (count at:(site))))) (define "Columns" 7) (game "Namudilakunze" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "TrackCCW1" "0,E,N1,W" loop:True P1) (track "TrackCCW2" "14,E,N1,W" loop:True P2) (track "TrackCW1" "6,W,N1,E" loop:True P1) (track "TrackCW2" "20,W,N1,E" loop:True P2)}) (piece "Seed" Shared) (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))) (hand Each)}) (rules (start (set Count 1 to:(difference (sites Board) (sites { 0 (- (* ("Columns") 4) 1)})))) phases:{ (phase "FirstTurn" (play (move Select (from (if ("SameTurn") ("LastHoleSowed") (sites Mover "Home")) if:(is Occupied (from))) (then (sow "TrackCW" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover "Inner")) (if (is Occupied ("OppositePit" (to))) (remove ("OppositePit" (to))) (if (is Occupied ("OppositeOuterPit" (to))) (remove ("OppositeOuterPit" (to))))))))))) (nextPhase Mover (not (is Next Mover)) "Main")) (phase "Main" (play (or (if (or (>= 0 (value Player Mover)) (= (value Player Mover) 1)) (move Select (from (if ("SameTurn") ("LastHoleSowed") (sites Mover "Home")) if:(is Occupied (from))) (then (sow "TrackCCW" owner:(mover) apply:(and (if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover "Inner")) (if (is Empty ("OppositePit" (to))) (if (is Occupied ("OppositeOuterPit" (to))) (remove ("OppositeOuterPit" (to))))))) (if (!= 1 (value Player Mover)) (set Value Mover 1))))))) (if (or (>= 0 (value Player Mover)) (= (value Player Mover) 2)) (move Select (from (if ("SameTurn") ("LastHoleSowed") (sites Mover "Home")) if:(is Occupied (from))) (then (sow "TrackCW" owner:(mover) apply:(and (if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover "Inner")) (if (is Empty ("OppositePit" (to))) (if (is Occupied ("OppositeOuterPit" (to))) (remove ("OppositeOuterPit" (to))))))) (if (!= 2 (value Player Mover)) (set Value Mover 2))))))))))} (end (forEach NonMover if:("NoPiece") (result Player Loss)))))
###
| 4x7-10 board (seven most common). One counter in each hole, with the player's leftmost hole in the outer row empty. On the first turn, sowing occurs in a clockwise direction. On the second turn, the player may sow in either direction, but must continue in the chosen direction for the rest of the game. Captures are made when the final counter of a sowing lands in an empty hole in the inner row. Captures are only made from the opponent's opposite outer row hole, and only when their inner row hole is empty. If the final counter lands in an occupied hole, the player picks up these counters and continues sowing. The player who captures all of the opponent's counters wins. Each player has 7 holes. END |
Describe the mechanics of the following Ludii game
(define "CrossLine" (= (count Sites in:(sites Crossing at:(last To) All)) 1)) (game "Crossline" (players 2) (equipment { (board (graph vertices:{ {7 0.5} {12 2} {14.5 6} {14.5 10} {12 14} {7 15.5} {3 14} {0 10} {0 6} {3 2}} edges:{{0 1} {1 2} {2 3} {3 4} {4 5} {5 6} {6 7} {7 8} {8 9} {9 0} {0 2} {0 3} {0 4} {0 5} {0 6} {0 7} {0 8} {1 3} {1 4} {1 5} {1 6} {1 7} {1 8} {1 9} {2 4} {2 5} {2 6} {2 7} {2 8} {2 9} {3 5} {3 6} {3 7} {3 8} {3 9} {4 6} {4 7} {4 8} {4 9} {5 7} {5 8} {5 9} {6 8} {6 9} {7 9}}) use:Edge) (piece "Marker" Each) (piece "Disc" Shared)}) (rules (start (set Shared Edge (sites {0..9}))) phases:{ (phase "Init" P1 (play (move Add (to Edge (sites Empty Edge)))) (nextPhase "Cross")) (phase "Cross" P1 (play (do (move Add (to Edge (sites Empty Edge))) ifAfterwards:"CrossLine"))) (phase "Continue" P2 (play (do (move Add (to Edge (sites Empty Edge))) ifAfterwards:"CrossLine")))} (end ("BlockWin"))))
###
| Players begin by drawing a circle with ten dots evenly spaced around it (the spacing can be approximate). The first player starts by drawing a straight line connecting any two dots that are not adjacent. After that, each player in turns draws a straight line that connects any two dots and that crosses exactly one (and only one) previously drawn line. The player who draws the last legal line is the winner. END |
Construct a Ludii game based on the following description
Two players make one of three signs with their hands at the same time, with one hand sign bating another (Rock beats Scissors, Scissors beats Paper, Paper beats Rock).
###
| (game "Rock-Paper-Scissors" (players 2) (mode Simultaneous) (equipment { (board (union (square 1) (shift 0 2 (square 1)))) (hand Each size:3) (piece "Rock" Each) (piece "Paper" Each) (piece "Scissors" Each)}) (rules (start { (place "Rock1" (handSite P1)) (place "Rock2" (handSite P2)) (place "Paper1" (handSite P1 1)) (place "Paper2" (handSite P2 1)) (place "Scissors1" (handSite P1 2)) (place "Scissors2" (handSite P2 2))}) (play (or (move (from (sites Occupied by:P1)) (to 0) P1) (move (from (sites Occupied by:P2)) (to 1) P2))) (end { (if (or { (and (= (what at:0) (id "Rock1")) (= (what at:1) (id "Rock2"))) (and (= (what at:0) (id "Paper1")) (= (what at:1) (id "Paper2"))) (and (= (what at:0) (id "Scissors1")) (= (what at:1) (id "Scissors2")))}) (result Mover Draw)) (if (or { (and (= (what at:0) (id "Rock1")) (= (what at:1) (id "Scissors2"))) (and (= (what at:0) (id "Paper1")) (= (what at:1) (id "Rock2"))) (and (= (what at:0) (id "Scissors1")) (= (what at:1) (id "Paper2")))}) (result P1 Win)) (if (or { (and (= (what at:0) (id "Paper1")) (= (what at:1) (id "Scissors2"))) (and (= (what at:0) (id "Scissors1")) (= (what at:1) (id "Rock2"))) (and (= (what at:0) (id "Rock1")) (= (what at:1) (id "Paper2")))}) (result P2 Win))}))) END |
Construct a global Ludii definition which fulfills the following requirements.
Defines a hop move in diagonal over an enemy to an empty site. The enemy pieces are removed at the end of the turn and you can not hop a piece you already hopped during your turn.
###
| (define "HopInternationalDraughtsStyle" (move Hop #1 Diagonal (between if:(and (not (is In (between) (sites ToClear))) ("IsEnemyAt" (between))) (apply (remove (between) at:EndOfTurn))) (to if:(is Empty (to))) #2)) END |
Construct a Ludii game based on the following description
One-Eyed Go follows the same rules as go (e.g. Japanese Rules) with the exception that it is never allowed to place a stone such that your own group has no liberties, even when they would capture other stones. This renders the ko rule superfluous. The game is played on a 19x19 board
###
| (define "CaptureSurroundedPiece" (enclose (from (last To)) Orthogonal (between if:("IsEnemyAt" (between)) (apply (and (addScore Mover 1) (remove (between))))))) (game "One-Eyed Go" (players 2) (equipment { (board (square 19) use:Vertex) (piece "Marker" Each)}) (rules (play (or (do (move Add (to (sites Empty))) ifAfterwards:("HasFreedom" Orthogonal) (then "CaptureSurroundedPiece")) (move Pass))) (end (if (all Passed) (byScore { (score P1 (+ (score P1) (size Territory P1))) (score P2 (+ (score P2) (size Territory P2)))}))))) END |
Construct a Ludii game based on the following description
This game is played on an empty 8x8 square chess board. Use 6 checkers and 66 Go stones.
The Counterinsurgent (COIN) player places his checkers on black squares in the middle of the board. The Guerrilla player starts with no pieces on the board, but begins by placing one stone anywhere on the board, then a second stone orthogonally adjacent to the first.
The Guerrilla player does not move his pieces. Instead, he places two and only two stones per turn on the board, on the intersections of the squares.
The first stone must be orthogonally adjacent to any stone on the board; the second stone must be orthogonally adjacent to the first stone placed.
He may not place stones on the board edge points.
He captures an enemy checker by surrounding it.
COIN player moves one checker per turn, one square diagonally as a King in regular checkers, or makes captures by jumping over the point between two squares.
He is not forced to capture if he does not want to, but if he does he must take all possible captures. Captured stones are removed from the board.
GOAL - The player who clears the board of all enemy pieces at the end of his turn wins. The Guerrilla player loses if he runs out of stones
###
| (define "CaptureJumpAgain" ("CaptureJump" (then (if (can Move "CaptureJump") (moveAgain))))) (define "CaptureJump" (move (from Cell (last To)) (to Cell (forEach (sites Around Cell (from) Diagonal) if:(and (is Empty Cell (site)) ("HasAnEnemyToJump")))) (then (forEach Site ("VertexJumped" (last From) (last To)) (if ("IsEnemyAt" (site)) (remove (site) #1)))))) (define "HasAnEnemyToJump" (!= 0 (count Sites in:(forEach ("VertexJumped" (site) (from)) if:("IsEnemyAt" (site)))))) (define "RemoveHoppedEnemyOnVertex" (then (forEach Site ("VertexJumped" (last From) (last To)) (if ("IsEnemyAt" (site)) (remove (site) (then (if (can Move "CaptureJump") (moveAgain)))))))) (define "VertexJumped" (intersection (sites Incident Vertex of:Cell at:#1) (sites Incident Vertex of:Cell at:#2))) (define "NextToOwnPiece" (not ("NoSites" (sites Around (to) Own Orthogonal)))) (game "Guerrilla Checkers" (players 2) (equipment { (board (square 9) use:Vertex) (hand P1) (piece "Marker" P1) (piece "Counter" P2 (move Step (from Cell) Diagonal (to Cell if:(is Empty Cell (to))) ("RemoveHoppedEnemyOnVertex")))}) (rules (start { (place "Counter2" Cell {"E3" "D4" "C5" "D6" "E5" "F4"}) (place "Marker1" "Hand1" count:66)}) phases:{ (phase "InitGuerrilla" P1 (play (move (from (handSite Mover)) (to Vertex (difference (sites Empty Vertex) (sites Outer))) (then (moveAgain)))) (nextPhase (is Next Mover) "GuerrillaMove")) (phase "GuerrillaMove" P1 (play (if "SameTurn" (move (from (handSite Mover)) (to Vertex (difference (sites Around (last To) Orthogonal if:(is Empty (to))) (sites Outer))) (then (forEach Site (forEach (sites Occupied by:P2 on:Cell) if:(all Sites (sites Incident Vertex of:Cell at:(site)) if:(is Occupied Vertex (site)))) (remove Cell (site))))) (move (from (handSite Mover)) (to Vertex (difference (sites Empty Vertex) (sites Outer)) if:"NextToOwnPiece") (then (and (forEach Site (forEach (sites Occupied by:P2 on:Cell) if:(all Sites (sites Incident Vertex of:Cell at:(site)) if:(is Occupied Vertex (site)))) (remove Cell (site))) (moveAgain))))))) (phase "CoinMove" P2 (play (if "SameTurn" "CaptureJumpAgain" (forEach Piece))))} (end ("BlockWin")))) END |
Construct a Ludii game based on the following description
4x8 board. May have one or two stores per player. Stores are located to the right hand side of the player's two rows, centered with respect to the player's two rows. If each player has two stores, the second store is located between the fourth and fifth holes of the player's rows; i.e., in the center of the board. One counter in each hole except the stores. Opening play: Player sows from any one of their holes, thus making a pair. They then take the counter in the next hole and sow it, making another pair. This continues until the last pair is made. When the last pair is made, the player sows this pair normally. Main phase: Sowing occurs in an anti-clockwise direction. When the final counter falls into an occupied hole, these are picked up and sowing continues. The turn ends when the final counter falls into an empty hole. When this empty hole is in the inner row, the counters in the opponent's hole opposite are captured. If the opponent's inner row hole are occupied, then any contents in the outer row opposite are also captured. Several rules apply to the stores: They are not used during the opening play; They may only hold one counter at a time; The counter in the store cannot be captured; It is the player's choice whether to include the store in sowing; they are considered to be in the player's inner row of holes for the purposes of sowing. The game is played on a 4x8 board.
###
| (define "NextSite" (trackSite Move from:#1 #2 steps:#3)) (define "PiecesOwnedBy" (+ (count at:(mapEntry #1)) (count in:(sites #1 "Home")))) (define "OppositeOuterPit" (if (is Mover P1) (+ (to) (* "Rows" 2)) (- (to) (* "Rows" 2)))) (define "OppositePit" (if (is Mover P1) (+ (to) "Rows") (- (to) "Rows"))) (define "Rows" 4) (game "Tchela" (players 2) (equipment { (board (merge { (square 4) (shift 5 0 (square 4)) (shift 4 0.5 (square 1)) (shift 4 2.5 (square 1)) (shift -1 2.5 (square 1)) (shift 9 0.5 (square 1))}) { (track "TrackCCW1" {0..3 16..19 23..20 7..4} loop:True P1) (track "TrackCCW2" {8..11 24..27 31..28 15..12} loop:True P2) (track "TrackExtendedCCW1" {0..3 16..19 23..20 32 7..4} loop:True P1) (track "TrackExtendedCCW2" {8..11 33 24..27 31..28 15..12} loop:True P2)} use:Vertex) (piece "Seed" Shared) (regions "HomeNotExtented" P1 (sites Track "TrackCCW1")) (regions "HomeNotExtented" P2 (sites Track "TrackCCW2")) (regions "Home" P1 (sites Track "TrackExtendedCCW1")) (regions "Home" P2 (sites Track "TrackExtendedCCW2")) (regions "Inner" P1 (difference (sites Track "TrackCCW1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "TrackCCW2") (sites Top))) (map {(pair P1 34) (pair P2 35)}) (map "ExtraStore" {(pair P1 32) (pair P2 33)})}) (rules (start (set Count 1 to:(difference (sites Board) (sites {32..35})))) phases:{ (phase "Opening" (play (move Select (from (if (< (value Player Mover) 0) (sites Mover "HomeNotExtented") (sites {("NextSite" (value Player Mover) "TrackCCW" 2)}))) (then (and (sow "TrackCCW" owner:(mover)) (set Value Mover (last To)))))) (nextPhase Mover (= 0 (count at:("NextSite" (value Player Mover) "TrackCCW" 2))) "OpeningPair")) (phase "OpeningPair" (play (move Select (from (sites {("NextSite" (value Player Mover) "TrackCCW" 1)})) (then (sow "TrackCCW" owner:(mover))))) (nextPhase Mover "Playing")) (phase "Playing" (play (or (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover "HomeNotExtented")) if:(< 0 (count at:(from)))) (then (sow "TrackCCW" owner:(mover) apply:(if (> (count at:(to)) 1) (moveAgain) (if (and (is In (to) (sites Mover "Inner")) (> (count at:"OppositePit") 0)) (and (fromTo (from "OppositePit") (to (mapEntry Mover)) count:(count at:"OppositePit")) (if (> (count at:"OppositePit") 0) (fromTo (from ("OppositeOuterPit")) (to (mapEntry Mover)) count:(count at:("OppositeOuterPit")))))))))) (do (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover "Home")) if:(< 0 (count at:(from)))) (then (sow "TrackExtendedCCW" owner:(mover) apply:(if (!= (to) (mapEntry "ExtraStore" Mover)) (if (> (count at:(to)) 1) (moveAgain) (if (and (is In (to) (sites Mover "Inner")) (> (count at:"OppositePit") 0)) (and (fromTo (from "OppositePit") (to (mapEntry Mover)) count:(count at:"OppositePit")) (if (> (count at:"OppositePit") 0) (fromTo (from ("OppositeOuterPit")) (to (mapEntry Mover)) count:(count at:("OppositeOuterPit"))))))))))) ifAfterwards:(<= (count at:(mapEntry "ExtraStore" Mover)) 1)))))} (end ("MancalaByScoreWhen" (no Moves Mover))))) END |
Modify the Ludii game according to the following option changes:
Square 8 x 8, one row -> Square 8 x 8, two rows
(define "ThrowStonetoEnemy" (move Hop (from if:(and (is Mover (who at:(from))) (= (size Stack at:(from)) 3))) (difference All Backwards) (between (range 1 2) if:True) (to if: ("IsEnemyAt" (to))) (then (and (remove (last To)) (remove (last To)))))) (define "ThrowStonetoEmpty" (move Hop (from if:(and (is Mover (who at:(from))) (= (size Stack at:(from)) 3))) (difference All Backwards) (between (range 1 2) if:True) (to if: (and (not ("IsEnemyAt" (to))) (not (is Mover (who at:(to)))))))) (define "SacrificeCaptureCatapult" (move Step (from if:(and (is Mover (who at:(from))) (= (size Stack at:(from)) 2))) (to if:(and ("IsEnemyAt" (to)) (= (size Stack at:(to)) 3)) (apply (remove (to)))) stack:True (then (and { (fromTo (from (last To)) (to (last From))) (remove (last To)) (moveAgain)})))) (define "SacrificeCaptureWall" (move Step (from if:(and (is Mover (who at:(from))) (= (size Stack at:(from)) 2))) (to if:(and ("IsEnemyAt" (to)) ("IsSingletonStack" (to))) (apply (remove (to)))) stack:True (then (and (fromTo (from (last To)) (to (last From))) (remove (last To)))))) (define "MoveTower" (move Hop (from if:(and (is Mover (who at:(from))) (= (size Stack at:(from)) 2))) (between if:(or (is Empty (between)) (and (is Mover (who at:(between))) (< (size Stack at:(between)) 2))) (apply (fromTo (from) (to (between))))) (to if:(or (is Empty (to)) (and (is Mover (who at:(to))) (< (size Stack at:(to)) 2)))) stack:True)) (game "Murus Gallicus" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) (piece "Counter_isometric" Each) (regions "RomanGoal1" P1 (sites Top)) (regions "GaulGoal2" P2 (sites Bottom))}) (rules (start { (place Stack "Counter_isometric1" (sites {0..7}) count:2) (place Stack "Counter_isometric2" (sites {56..63}) count:2)}) (play (if ("SameTurn") (or (move (from (last From)) (to (last To)) stack:True (then (and (remove (last To)) (remove (last To))))) (move Pass)) (forEach Piece "Counter_isometric" (or { "MoveTower" "SacrificeCaptureWall" "SacrificeCaptureCatapult" "ThrowStonetoEmpty" "ThrowStonetoEnemy"}) top:True))) (end { ("BlockWin") (if (and { (is In (last To) (sites Mover)) (not ("IsEnemyAt" (last To))) (is Mover (who at:(last To)))}) (result Mover Win))})))
###
| (define "ThrowStonetoEnemy" (move Hop (from if:(and (is Mover (who at:(from))) (= (size Stack at:(from)) 3))) (difference All Backwards) (between (range 1 2) if:True) (to if: ("IsEnemyAt" (to))) (then (and (remove (last To)) (remove (last To)))))) (define "ThrowStonetoEmpty" (move Hop (from if:(and (is Mover (who at:(from))) (= (size Stack at:(from)) 3))) (difference All Backwards) (between (range 1 2) if:True) (to if: (and (not ("IsEnemyAt" (to))) (not (is Mover (who at:(to)))))))) (define "SacrificeCaptureCatapult" (move Step (from if:(and (is Mover (who at:(from))) (= (size Stack at:(from)) 2))) (to if:(and ("IsEnemyAt" (to)) (= (size Stack at:(to)) 3)) (apply (remove (to)))) stack:True (then (and { (fromTo (from (last To)) (to (last From))) (remove (last To)) (moveAgain)})))) (define "SacrificeCaptureWall" (move Step (from if:(and (is Mover (who at:(from))) (= (size Stack at:(from)) 2))) (to if:(and ("IsEnemyAt" (to)) ("IsSingletonStack" (to))) (apply (remove (to)))) stack:True (then (and (fromTo (from (last To)) (to (last From))) (remove (last To)))))) (define "MoveTower" (move Hop (from if:(and (is Mover (who at:(from))) (= (size Stack at:(from)) 2))) (between if:(or (is Empty (between)) (and (is Mover (who at:(between))) (< (size Stack at:(between)) 2))) (apply (fromTo (from) (to (between))))) (to if:(or (is Empty (to)) (and (is Mover (who at:(to))) (< (size Stack at:(to)) 2)))) stack:True)) (game "Murus Gallicus" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) (piece "Counter_isometric" Each) (regions "RomanGoal1" P1 (sites Top)) (regions "GaulGoal2" P2 (sites Bottom))}) (rules (start { (place Stack "Counter_isometric1" (sites {0..15}) count:2) (place Stack "Counter_isometric2" (sites {48..63}) count:2)}) (play (if ("SameTurn") (or (move (from (last From)) (to (last To)) stack:True (then (and (remove (last To)) (remove (last To))))) (move Pass)) (forEach Piece "Counter_isometric" (or { "MoveTower" "SacrificeCaptureWall" "SacrificeCaptureCatapult" "ThrowStonetoEmpty" "ThrowStonetoEnemy"}) top:True))) (end { ("BlockWin") (if (and { (is In (last To) (sites Mover)) (not ("IsEnemyAt" (last To))) (is Mover (who at:(last To)))}) (result Mover Win))}))) END |
Describe the mechanics of the following Ludii game
(game "Sumi Naga Game (Hunt)" (players 2) (equipment { ("AlquerqueBoard" 5 5) (piece "Goat" P1 "StepToEmpty") (piece "Tiger" P2 (or ("StepToEmpty") ("HopSequenceCapture"))) (hand P1)}) (rules (start { (place "Goat1" (handSite P1) count:20) (place "Tiger2" (sites Corners))}) phases:{ (phase "Placement" P1 (play (move (from (handSite P1)) (to (sites Empty)))) (nextPhase Mover ("HandEmpty" Mover) "Moving")) (phase "Moving" (play (forEach Piece)))} (end ("NoMovesP2NoPiecesP1"))))
###
| 5x5 intersecting lines, with diagonals drawn in each quadrant. One player plays as four tigers, which begin on the four corners of the board. The other player plays as twenty goats, which begin off the board. Play begins by placing one of the goats on an empty spot. The other player then moves the tiger to an empty adjacent spot along the lines on the board. The tiger may hop over an adjacent goat, to an empty space on the opposite adjacent side of the goat along the lines. Play continues like this until all of the goats are placed, after which the goats also move to one adjacent spot along the lines. The tigers win by capturing all of the goats; the goats win by blocking the tigers from being able to move. END |
Describe the mechanics of the following Ludii game
(define "CapturedPiecesFollowCapturingPiece" (forEach Level (last From) FromTop (if ("CapturedPiece" (state at:(last From) level:(level))) (fromTo (from (last From) level:(level)) (to (last To)))))) (define "RebirthCapturingPiece" (add (piece (id "Stick" Mover)) (to (handSite Mover)))) (define "RemoveCapturedPieces" (forEach Level (last From) FromTop (if ("CapturedPiece" (state at:(last From) level:(level))) (remove (last From) level:(level))))) (define "CaptureMove" (forEach Level (last To) FromTop (and (if ("IsEnemyAt" (last To) level:(level)) ("SetCapturePiece" at:(last To) level:(level))) (if ("IsFriendAt" (last To) level:(level)) ("SetCapturingPiece" at:(last To) level:(level)))))) (define "AtLeastAnEnemyPieceThere" (is In #1 (sites Occupied by:Enemy top:False))) (define "FreePiece" (= 0 #1)) (define "CapturedPiece" (= 2 #1)) (define "CapturingPiece" (= 1 #1)) (define "UnsetCapturingPieces" (forEach Level (last From) FromTop (if ("IsFriendAt" (last From) level:(level)) ("UnsetCapturingPiece" at:(last From) level:(level))))) (define "UnsetCapturingPiece" (set State #1 #2 0)) (define "SetCapturingPiece" (set State #1 #2 1)) (define "SetCapturePiece" (set State #1 #2 2)) (define "NoPieceOnBoard" (< (count Pieces Mover in:(sites Board)) 1)) (define "ThrowValue" (count Pips)) (game "Aj Sayil" (players 6) (equipment { (board (rectangle 1 20) { (track "Track1" {19 0..18} P1 directed:True) (track "Track2" {20 0..18} P2 directed:True) (track "Track3" {21 0..18} P3 directed:True) (track "Track4" {22 18..0} P4 directed:True) (track "Track5" {23 18..0} P5 directed:True) (track "Track6" {24 18..0} P6 directed:True) (track "CaptureTrack1" {18..0} P1 directed:True) (track "CaptureTrack2" {18..0} P2 directed:True) (track "CaptureTrack3" {18..0} P3 directed:True) (track "CaptureTrack4" {0..18} P4 directed:True) (track "CaptureTrack5" {0..18} P5 directed:True) (track "CaptureTrack6" {0..18} P6 directed:True)} use:Edge) (regions "AllSites" (sites Board Vertex)) (piece "Stick" Each (forEach Value (values Remembered "Throws") (or (if ("FreePiece" (state at:(from) level:(level))) (if ("IsOffBoard" ("NextSiteOnTrack" (value) from:(from) "Track")) (move (from (from) level:(level)) (to (handSite Mover) (apply (forget Value "Throws" (value))))) (move (from (from) level:(level) if:(if (is In (from) (sites Hand Mover)) ("NoPieceOnBoard") True)) (to ("NextSiteOnTrack" (value) from:(from) "Track") (apply (forget Value "Throws" (value)))) (then (if ("AtLeastAnEnemyPieceThere" (last To)) ("CaptureMove")))))) (if ("CapturingPiece" (state at:(from) level:(level))) (if ("IsOffBoard" ("NextSiteOnTrack" (value) from:(from) "CaptureTrack")) (do (forget Value "Throws" (value)) next:(move Remove (from) level:(level) (then (and { ("UnsetCapturingPieces") ("RemoveCapturedPieces") ("RebirthCapturingPiece")})))) (move (from (from) level:(level)) (to ("NextSiteOnTrack" (value) from:(from) "CaptureTrack") (apply (forget Value "Throws" (value)))) (then (and ("CapturedPiecesFollowCapturingPiece") ("UnsetCapturingPieces"))))))))) ("StickDice" 4) (hand Each)}) (rules (start { (set Team 1 {P1 P2 P3}) (set Team 2 {P4 P5 P6}) (place Stack "Stick1" (handSite P1) count:5) (place Stack "Stick2" (handSite P2) count:5) (place Stack "Stick3" (handSite P3) count:5) (place Stack "Stick4" (handSite P4) count:5) (place Stack "Stick5" (handSite P5) count:5) (place Stack "Stick6" (handSite P6) count:5)}) phases:{ (phase "ThrowPhase" (play ("RollMove" (move Pass (then (if (not (no Pieces Mover)) (and { (if (!= 0 ("ThrowValue")) (do (remember Value "Throws" ("ThrowValue")) ifAfterwards:(can Move (or (forEach Piece container:(mover)) (forEach Piece))))) (moveAgain) (if ("SameTurn") (set Pending))})))))) (nextPhase (is Pending) "MovePhase")) (phase "MovePhase" (play (or (forEach Piece) (forEach Piece container:(mover)) (then (if (< 0 (size Array (values Remembered "Throws"))) (moveAgain))))) (nextPhase (= 0 (size Array (values Remembered "Throws"))) "ThrowPhase"))} (end ("CaptureAllTeam"))))
###
| Six or more players, even number of players, played on two teams. The board consists of twenty kernels of corn, spaced evenly in a line. If there are ten to fourteen players, the board is expanded to 25 kernels. If there are more than sixteen players, it is expanded to 30. Sticks are used to play, (five per player), and are played in the spaces between corn kernels. Dice are also corn kernels, with one side marked with a black dot. Four dice are used, the value of a move determined by the number of black dots that land face up. Each player has two throws on their turn, and moves after the second throw. The throws both must be used, and can be used in any order. Each team's home is the side of the board to their left. Each team moves toward the opposite end of the track, and then back to home. All of the players on one team play in succession, and then the players on the other team play next. Players enter the men on their throws and move along the track. Each player may have only one piece on the board at a time. When a player reaches the team's home field, the piece may be re-entered. Reaching the home field does not require an exact throw, and if one throw brings a player home, they may use the second throw to enter it again. If a piece lands on that of an opponent, it is captured. The captures piece is placed on top of the piece that captured it, and the stack now moves toward the capturing player's home space. If the player successfully carries the captured piece to the team's home space, the piece is permanently captured and removed from play. If the opposing side lands on the same space as the stack, they are stacked with the opponent's piece, and the opponent begins carrying the stack to the opposing team's side. Any pieces captured belonging to the team which brings them back to their home are returned to their players. Pieces belonging to the same team may occupy the same space with no consequence for the game. When one team has no more counters left to enter, the winner is the team that captured most of the opposing team's pieces. The game has 6 players. END |
Construct a Ludii game based on the following description
5x5 board. Twelve pieces per player. Players alternate turns placing two pieces on the board, leaving the central space empty. Once all the pieces have been placed, players alternate turns moving one space orthogonally to an empty space. An opponent's piece may be captured by hopping over it to an empty space immediately on the opposite side of it in an orthogonal direction. Multiple captures are allowed, and a player is allowed to land on a space already landed on during the chain of captures. Captures are not compulsory. A player wins when they capture all of their opponent's pieces or the opponent cannot move.
###
| (define "HopCounter" ("HopCapture" (from #1) Orthogonal #2)) (game "Mraha wa Bwe" (players 2) (equipment { (board (square 5)) (piece "Counter" Each) (hand Each)}) (rules (start (place "Counter" "Hand" count:12)) phases:{ (phase "Placement" (play (move (from (handSite Mover)) (to (difference (sites Empty) (sites Centre))) (then (if ("NewTurn") (moveAgain))))) (nextPhase Mover (is Empty (handSite Mover)) "Play")) (phase "Play" (play (if "SameTurn" (or ("HopCounter" (last To) (then ("ReplayIfCanMove" ("HopCounter" (last To))))) (move Pass)) (or (forEach Piece "Counter" ("HopCounter" (from) (then ("ReplayIfCanMove" ("HopCounter" (last To)))))) (forEach Piece "Counter" ("StepOrthogonalToEmpty"))))))} (end (if (no Moves Mover) (result Mover Loss))))) END |
Construct a Ludii game based on the following description
2x7 board, with one store at either end. Each player owns the store to their left. Seven counters in each hole. The first turn is played simultaneously by both players; at the point which one player's sowing lasts longer than the others, the player whose turn was shorter plays next and turns alternate from this point. Players sow in a clockwise direction from one of the holes in their row, also sowing into their store, but not in their opponent's store. When the final counter lands in an empty hole or in the store, the turn ends. When the final counter falls into an occupied hole, the player picks up the contents of this hole and continues to sow. If this occupied hole is in the player's row, they have the option to instead place the final counter in the opposite hole in the opponent's row, and to place this last counter as well as the contents of that hole into the store. When all of the counters are in the stores, a new game begins. The players take the counters from their stores and place seven in each hole, beginning from their right. Any player which cannot fill a hole with seven counters places the remaining counters in their store. Any holes which are left empty are out of play for this game. Play continues as before. Multiple games are played like this until all of the holes on one side are left empty. This player loses.
###
| (define "NoPieceOnBoard" (all Sites (union (sites Top) (sites Bottom)) if:(is Empty (site)))) (define "PlayableSites" (sites (values Remembered "Playable"))) (define "RightMostEmpty" (trackSite FirstSite from:(mapEntry "RightMost" Mover) if:(is Empty (to)))) (define "Columns" 7) (game "Papan Dakon" (players 2) (equipment { (mancalaBoard 2 "Columns" { (track "Track1" "0,8,E,S,W" loop:True P1) (track "Track2" "15,7,W,N,E" loop:True P2)}) (piece "Seed" Shared) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 FirstSite) (pair P2 LastSite)}) (map "RightMost" {(pair P1 7) (pair P2 8)})}) (rules (start { (set Count 7 to:(union (sites P1) (sites P2))) (set RememberValue "Playable" (union (sites Top) (sites Bottom)))}) phases:{ (phase "Sowing" (play (or (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover)) if:(and (> (count at:(from)) 0) (is In (from) ("PlayableSites")))) (then (sow "Track" owner:(mover) apply:(if (and (!= (to) (mapEntry Mover)) (< 1 (count at:(to)))) (moveAgain)) skipIf:(if (!= (to) (mapEntry Mover)) (not (is In (to) ("PlayableSites"))))))) (if (and (is In (last To afterConsequence:True) (sites Mover)) ("SameTurn")) (if (is In (last To afterConsequence:True) ("PlayableSites")) (move (from (last To afterConsequence:True)) (to ("OppositePit" (last To afterConsequence:True))) count:1 (then (fromTo (from (last To)) (to (mapEntry Mover)) count:(count at:(last To))))))) (then (if ("NoPieceOnBoard") (forget Value "Playable" All))))) (end (if ("NoPieceOnBoard") { (if (> 7 (count at:(mapEntry P1))) (result P2 Win)) (if (> 7 (count at:(mapEntry P2))) (result P1 Win))})) (nextPhase ("NoPieceOnBoard") "BetweenRounds")) (phase "BetweenRounds" (play (if (not (all Sites (sites Mover) if:(is Occupied (site)))) (if (<= 7 (count at:(mapEntry Mover))) (move (from (mapEntry Mover)) (to "RightMostEmpty") count:7 (then (remember Value "Playable" (last To))))))) (nextPhase (all Passed) "Sowing"))})) END |
Construct a Ludii game based on the following description
4x12 board. Twelve pieces per player. Pieces begin in the outer rows of the board. Four sticks serve as dice, painted on one side and blank on the other. The throws are as follows: one blank side up = 2; two blank sides up = 0; three blank sides up = 0; four blank sides up = 8; four painted sides up = 12. Throws of 2, 8, and 12 give the player another throw. Players must use each throw to move a piece. They may only subdivide a throw in half to move two pieces, otherwise they must use one full throw to move a piece. The first move for each piece must be a throw of 2. This can be divided into two throws of 1 to move two pieces. Play moves from left to right in the player's home row, from right to left in the second row, left to right in the third row, and right to left in the opponent's home row. When a piece enters the opponent's home row, it can no longer move. When a player's piece lands on a space occupied by an opponent's piece, the opponent's piece is captured. A player may not land on the same space as another of the player's pieces. The player which fills up the most of the opponent's home row wins.
###
| (define "NumPieceNotInEnemyHome" (count Sites in:(forEach (sites Occupied by:#1) if:(not (is In (site) (sites #2 "Home")))))) (define "PiecesOwnedOnEnemyHomedBy" (count Sites in:(forEach (sites #1 "Home") if:(= (who at:(site)) #2)))) (define "PlayedHalfThrow" (= 1 (var))) (define "CaptureMove" (if ("IsEnemyAt" (to)) (remove (to)))) (define "ActivePiece" (set State at:#1 1)) (define "ActivatedPiece" (= (state at:#1) 1)) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" #1)) (define "ThrowToActivate" (= 2 ("ThrowValue"))) (define "IsSpecialThrow" (is In ("ThrowValue") (sites {2 8 12}))) (define "ThrowValue" (mapEntry "Throw" (count Pips))) (game "Tablan" (players 2) (equipment { (board (rectangle 4 12) { (track "Track1" "0,E,N1,W,N1,E,N1,W" P1 directed:True) (track "Track2" "47,W,S1,E,S1,W,S1,E" P2 directed:True)} use:Vertex) (piece "Stick" Each (if (and (not (is In (from) (sites Next "Home"))) (!= 0 ("ThrowValue"))) (or (if (not ("PlayedHalfThrow")) (move (from (from) if:(if ("ActivatedPiece" (from)) True ("ThrowToActivate"))) (to ("SiteToMoveOnTrack" ("ThrowValue")) if:(not ("IsFriendAt" (to))) (apply "CaptureMove")) (then (if (not ("ActivatedPiece" (last To))) ("ActivePiece" (last To)))))) (move (from (from) if:(if ("ActivatedPiece" (from)) True ("ThrowToActivate"))) (to ("SiteToMoveOnTrack" (/ ("ThrowValue") 2)) if:(not ("IsFriendAt" (to))) (apply "CaptureMove")) (then (and (if (not ("ActivatedPiece" (last To))) ("ActivePiece" (last To))) (if (not ("PlayedHalfThrow")) (and (set Var 1) (moveAgain)) (set Var 0)))))))) (regions "Home" P1 (sites Bottom)) (regions "Home" P2 (sites Top)) (map "Throw" {(pair 0 8) (pair 1 0) (pair 2 0) (pair 3 2) (pair 4 12)}) (dice d:2 from:0 num:4)}) (rules (start { (place "Stick1" (sites Bottom)) (place "Stick2" (sites Top))}) (play (do (if (not ("PlayedHalfThrow")) (roll)) next:(if (can Move (forEach Piece)) (forEach Piece) (move Pass (then (set Var 0)))) (then (if ("IsSpecialThrow") (moveAgain))))) (end (if (and (= 0 ("NumPieceNotInEnemyHome" P1 P2)) (= 0 ("NumPieceNotInEnemyHome" P2 P1))) (byScore { (score P1 ("PiecesOwnedOnEnemyHomedBy" P2 P1)) (score P2 ("PiecesOwnedOnEnemyHomedBy" P1 P2))}))))) END |
Construct a Ludii game based on the following description
Pieces move as knights in Chess. The goal is to be the first player to reach the opposite side of the board from the starting position.
###
| (game "Knightthrough" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) (piece "Knight" Each (move Leap "KnightWalk" forward:True (to if:(not ("IsFriendAt" (to))) (apply (remove (to)))))) (regions P1 (sites Top)) (regions P2 (sites Bottom))}) (rules (start { (place "Knight1" (expand (sites Bottom))) (place "Knight2" (expand (sites Top)))}) (play (forEach Piece)) (end ("ReachWin" (sites Mover) Mover)))) END |
Construct a global Ludii definition which fulfills the following requirements.
Defines a hop move in all the rotational directions over an enemy to an empty site. The enemy piece is removed.
###
| (define "HopRotationalCapture" (move Hop Rotational (between if:("IsEnemyAt" (between)) (apply (remove (between)))) (to if:(is Empty (to))))) END |
Construct a Ludii game based on the following description
Forty stones, arranged in a circle, with a larger gap after every tenth stone. The gaps between the stones are the playing spaces. Two to four players. One stick per player. Three sticks, each with one flat marked side and one round side, used as dice. The throws are as follows: one marked side up = 2; two marked sides up = 3; all marked sides up = 5; no marked sides up =10. Throws of 10 grant the player another throw. Each player starts at one of the larger gaps, and any players facing each other play on a team. Teams play in opposite directions: The player starting from the left or right space moves in a clockwise direction; the player(s) sitting at the top or bottom play anticlockwise). When a player's piece moves past or onto the space occupied by a piece belonging to the opposing team, the opposing team's piece is sent back to the starting space. The first team to circle the board three times wins. The game has 4 players.
###
| (define "Move" (move (from (from) level:(level)) (to ("SiteToMoveOnTrack" ("ThrowValue")) if:True ("HittingCapture" (mapEntry "Start" (who at:(to))))) (then (forEach Site (sites Track Mover "Track" from:("NextSite" (last From) "Track") to:(last To)) (if ("IsEnemyAt" (site)) (forEach Level (site) (move (from (site) level:(level)) (to (mapEntry "Start" (who at:(site) level:(level))))))))))) (define "MadeACompleteCircuit" (is In (mapEntry "Start" Mover) (sites Track Mover "Track" from:("NextSite" (last From) "Track") to:(last To)))) (define "NextSite" ("NextSiteOnTrack" 1 from:#1 #2)) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" #1)) (define "ThrowValue" (mapEntry "Throw" (count Pips))) (game "Set Dilth'" (players 4) (equipment { ("FortyStonesWithFourGapsBoard" { (track "Track1" {39 34 32 30 28 26 24 22 20 18 36 16 14 12 10 8 6 4 2 0 37 1 3 5 7 9 11 13 15 17 38 19 21 23 25 27 29 31 33 35} loop:True P1) (track "Track2" {39 35 33 31 29 27 25 23 21 19 38 17 15 13 11 9 7 5 3 1 37 0 2 4 6 8 10 12 14 16 36 18 20 22 24 26 28 30 32 34} loop:True P2) (track "Track3" {39 34 32 30 28 26 24 22 20 18 36 16 14 12 10 8 6 4 2 0 37 1 3 5 7 9 11 13 15 17 38 19 21 23 25 27 29 31 33 35} loop:True P3) (track "Track4" {39 35 33 31 29 27 25 23 21 19 38 17 15 13 11 9 7 5 3 1 37 0 2 4 6 8 10 12 14 16 36 18 20 22 24 26 28 30 32 34} loop:True P4)}) (regions "AllSites" (sites Board)) (map "Throw" {(pair 0 10) (pair 1 2) (pair 2 3) (pair 3 5)}) (map "Start" {(pair 1 37) (pair 2 38) (pair 3 39) (pair 4 36)}) (piece "Stick" Each ("Move")) ("StickDice" 3)}) (rules (start { (set Team 1 {P1 P3}) (set Team 2 {P2 P4}) (place Stack "Stick1" 37) (place Stack "Stick2" 38) (place Stack "Stick3" 39) (place Stack "Stick4" 36)}) (play ("RollMove" (forEach Piece) (then (do (if ("MadeACompleteCircuit") (addScore Mover 1) (then (if (= (score Mover) 3) (remove (last To))))) next:(if (and (!= 3 (score Mover)) (= 10 ("ThrowValue"))) (moveAgain)))))) (end (if (>= (score Mover) 4) (result Mover Win))))) END |
What does the following global Ludii definition do?
(define "EncloseCapture" (enclose (from (last To)) #1 (between if:("IsEnemyAt" (between)) (apply (remove (between)))) #2))
###
| Defines a enclose capture by all the directions specified (by default Adjacent). The enemy pieces are removed. END |
Construct a Ludii game based on the following description
3x3 intersecting lines with diagonals. Three pieces per player. Players alternate turns placing a piece on an empty spot on the board. When a player succeeds in making a line of three with their pieces, they win.
###
| (game "Ngre E E" (players 2) (equipment { ("AlquerqueBoard" 3 3) (hand Each) (piece "Marker" Each)}) (rules (start (place "Marker" "Hand" count:3)) (play (move (from (handSite Mover)) (to (sites Empty)))) (end ("Line3Win")))) END |
Modify the Ludii game according to the following option changes:
Each row has 5 holes. -> Each row has 6 holes.
(define "AllPieceInOpponentHome" (and (= (count Sites in:(difference (sites Occupied by:P1) (sites P2))) 0) (= (count Sites in:(difference (sites Occupied by:P2) (sites P1))) 0))) (define "CaptureEnemyPiece" (apply if:("IsEnemyAt" (to)) (remove (to)))) (define "InactivePiece" (= (state at:(from)) 1)) (define "ActivatedPiece" (= (state at:(from)) 0)) (define "ActivatePiece" (if (= (state at:(last To)) 1) (set State at:(last To) 0))) (define "ThrowValue" (mapEntry (count Pips))) (game "Sig (Mzab)" (players 2) (equipment { (board (rectangle 4 5) { (track "Track1" "0,E,N1,W,N1,E,N1,W" P1 directed:True) (track "Track2" "19,W,S1,E,S1,W,S1,E" P2 directed:True)} use:Vertex) (piece "Stick" Each (if (or ("ActivatedPiece") (and (or (= 1 ("ThrowValue")) (= 6 ("ThrowValue"))) ("InactivePiece"))) (if ("IsNotOffBoard" ("NextSiteOnTrack" (if ("InactivePiece") 1 ("ThrowValue")))) (if (or (is In ("NextSiteOnTrack" (if ("InactivePiece") 1 ("ThrowValue"))) (sites Empty)) ("IsEnemyAt" ("NextSiteOnTrack" (if ("InactivePiece") 1 ("ThrowValue"))))) (move (from) (to ("NextSiteOnTrack" (if ("InactivePiece") 1 ("ThrowValue"))) "CaptureEnemyPiece"))) (then ("ActivatePiece"))))) (regions "AllSites" (sites Board)) ("StickDice" 6) (map {(pair 0 6) (pair 1 0) (pair 2 2) (pair 3 1) (pair 4 1) (pair 5 0) (pair 6 6)}) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start { (place "Stick1" (sites Bottom) state:1) (place "Stick2" (sites Top) state:1)}) (play ("RollMove" (forEach Piece))) (end { ("CaptureAll" Next) (if ("AllPieceInOpponentHome") (result Mover Draw))})))
###
| (define "AllPieceInOpponentHome" (and (= (count Sites in:(difference (sites Occupied by:P1) (sites P2))) 0) (= (count Sites in:(difference (sites Occupied by:P2) (sites P1))) 0))) (define "CaptureEnemyPiece" (apply if:("IsEnemyAt" (to)) (remove (to)))) (define "InactivePiece" (= (state at:(from)) 1)) (define "ActivatedPiece" (= (state at:(from)) 0)) (define "ActivatePiece" (if (= (state at:(last To)) 1) (set State at:(last To) 0))) (define "ThrowValue" (mapEntry (count Pips))) (game "Sig (Mzab)" (players 2) (equipment { (board (rectangle 4 6) { (track "Track1" "0,E,N1,W,N1,E,N1,W" P1 directed:True) (track "Track2" "23,W,S1,E,S1,W,S1,E" P2 directed:True)} use:Vertex) (piece "Stick" Each (if (or ("ActivatedPiece") (and (or (= 1 ("ThrowValue")) (= 6 ("ThrowValue"))) ("InactivePiece"))) (if ("IsNotOffBoard" ("NextSiteOnTrack" (if ("InactivePiece") 1 ("ThrowValue")))) (if (or (is In ("NextSiteOnTrack" (if ("InactivePiece") 1 ("ThrowValue"))) (sites Empty)) ("IsEnemyAt" ("NextSiteOnTrack" (if ("InactivePiece") 1 ("ThrowValue"))))) (move (from) (to ("NextSiteOnTrack" (if ("InactivePiece") 1 ("ThrowValue"))) "CaptureEnemyPiece"))) (then ("ActivatePiece"))))) (regions "AllSites" (sites Board)) ("StickDice" 6) (map {(pair 0 6) (pair 1 0) (pair 2 2) (pair 3 1) (pair 4 1) (pair 5 0) (pair 6 6)}) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start { (place "Stick1" (sites Bottom) state:1) (place "Stick2" (sites Top) state:1)}) (play ("RollMove" (forEach Piece))) (end { ("CaptureAll" Next) (if ("AllPieceInOpponentHome") (result Mover Draw))}))) END |
Construct a Ludii game based on the following description
Reversi is played on an 8x8 board. Pieces are double-sided, with each side distinct in some way from the other. Each side designates ownership of that pieces to a certain player when face-up. Play begins with the players taking turns placing pieces into the central four squares until they are full. Then players may place their pieces next to an opponent's piece, a long as a straight line can be drawn between the new piece and an existing piece belonging to that player that goes through the opponent's piece. The opponent's pieces between the new piece and the old piece are then flipped and now belong to the player who just played. If a player cannot make a legal move, they pass. Play continues until the board is full or neither player cannot make a legal move. The player with the most pieces on the board wins. The pieces are placed on the board. The board is a square board of size 8x8.
###
| (define "ReverseBoundedPieces" (custodial (from (site)) (between if:(is Enemy (state at:(between))) (apply (allCombinations (add (piece "Disc0" state:(mover)) (to (site))) (flip (between))))) (to if:(is Friend (state at:(to)))))) (game "Reversi" (players 2) (equipment { (board (square 8)) (piece "Disc" Neutral (flips 1 2))}) (rules (start { (place "Disc0" (difference (sites Centre) (sites Phase 1)) state:1) (place "Disc0" (difference (sites Centre) (sites Phase 0)) state:2)}) phases:{ (phase "Playing" (play (forEach Site (sites Empty) (append "ReverseBoundedPieces" (then (and (set Score P1 (count Sites in:(sites State 1))) (set Score P2 (count Sites in:(sites State 2)))))))))} (end (if (all Passed) (byScore))))) END |
Construct a Ludii game based on the following description
2x7 board, with two stores. Seven counters per hole. The first player may choose the direction of sowing, which must be maintained throughout the game. Sowing includes the player's store, which is the store following the last hole in the player's row, according to the direction of sowing. When the final counter of a sowing falls into an occupied hole, the counters in that hole are picked up and sowing continues. When the final counter of a sowing falls into an empty hole, that counter is captured along with any counters in the hole in the row opposite it. When the final counter falls into the player's store, the turn ends. The player who first captures half of the counters wins.
Sowing occurs in CCW.
###
| (define "GoalNumCapturedCounters" (/ (* 7 (- (count Sites in:(sites Board)) 2)) 2)) (define "Columns" 7) (game "Chonka" (players 2) (equipment { (mancalaBoard 2 "Columns" { (track "Track1" "1,E,ENE,WNW,W" loop:True P1) (track "Track2" "1,E,N,W,WSW" loop:True P2)}) (piece "Seed" Shared) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 LastSite) (pair P2 FirstSite)})}) (rules (start (set Count 7 to:(union (sites P1) (sites P2)))) (play (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover)) if:(> (count at:(from)) 0)) (then (sow apply:(if (!= (to) (mapEntry Mover)) (if (> (count at:(to)) 1) (moveAgain) (and (fromTo (from ("OppositePitTwoRows" (to))) (to (mapEntry Mover)) count:(count at:("OppositePitTwoRows" (to)))) (fromTo (from (to)) (to (mapEntry Mover)) count:(count at:(to)))))))))) (end (if (<= ("GoalNumCapturedCounters") (count at:(mapEntry Mover))) (result Mover Win))))) END |
Construct a Ludii game based on the following description
Same rules as Chess, just a different setup.
###
| (define "InitialPawnMove" (if (is In (from) (sites Start (piece (what at:(from))))) ("DoubleStepForwardToEmpty" "SetEnPassantLocation"))) (define "EnPassant" (move Step (directions {FR FL}) (to if:"InLocationEnPassant") (then (remove (ahead (last To) Backward))))) (define "InLocationEnPassant" (and (is Pending) (= (to) (value Pending)))) (define "SetEnPassantLocation" (then (set Pending (ahead (last To) Backward)))) (define "BigCastling" ("DecideToCastle" "King" W 2 "KingNotCheckedAndToEmpty" (then ("CastleRook" "RookLeft" E 3 True)))) (define "SmallCastling" ("DecideToCastle" "King" E 2 "KingNotCheckedAndToEmpty" (then ("CastleRook" "RookRight" W 2 True)))) (define "CastleRook" (slide (from (mapEntry #1 (mover))) #2 (between (exact #3) if:#4) (to if:True (apply ("PieceHasMoved" (from)))))) (define "DecideToCastle" (move Slide (from (mapEntry #1 (mover))) #2 (between (exact #3) if:#4) (to if:True (apply ("PieceHasMoved" (from)))) #5)) (define "KingNotCheckedAndToEmpty" (and (is Empty (to)) (not ("IsInCheck" "King" Mover at:(to))))) (define "RememberPieceHasMoved" (then (if (= (state at:(last To)) 1) ("PieceHasMoved" (last To))))) (define "PieceHasMoved" (set State at:#1 0)) (define "HasNeverMoved" (= (state at:(mapEntry #1 (mover))) 1)) (game "Official Football Chess" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) ("ChessPawn" "Pawn" (or "InitialPawnMove" "EnPassant") (then (and ("ReplayInMovingOn" (sites Mover "Promotion")) (set Counter)))) ("ChessRook" "Rook" (then (set Counter)) ("RememberPieceHasMoved")) ("ChessKing" "King" (then (set Counter)) ("RememberPieceHasMoved")) ("ChessBishop" "Bishop" (then (set Counter))) ("ChessKnight" "Knight" (then (set Counter))) ("ChessQueen" "Queen" (then (set Counter))) (map "King" {(pair 1 "D1") (pair 2 "D8")}) (map "RookLeft" {(pair 1 "A1") (pair 2 "A8")}) (map "RookRight" {(pair 1 "H1") (pair 2 "H8")}) (regions "Promotion" P1 (sites Top)) (regions "Promotion" P2 (sites Bottom))}) (rules (start { (place "Pawn1" (sites {"B2" "C2" "E2" "F2"})) (place "Pawn2" (sites {"B7" "C7" "E7" "F7"})) (place "Rook1" {"A1" "H1"} state:1) (place "Knight1" {"D2"}) (place "Bishop1" {"A2" "H2"}) (place "Queen1" coord:"E1") (place "King1" coord:"D1" state:1) (place "Rook2" {"A8" "H8"} state:1) (place "Knight2" {"D7"}) (place "Bishop2" {"A7" "H7"}) (place "Queen2" coord:"E8") (place "King2" coord:"D8" state:1)}) (play (if "SameTurn" (move Promote (last To) (piece {"Queen" "Knight" "Bishop" "Rook"}) Mover) (do (or (forEach Piece) (if (and ("HasNeverMoved" "King") (not ("IsInCheck" "King" Mover))) (or (if (and ("HasNeverMoved" "RookLeft") (can Move ("CastleRook" "RookLeft" E 3 (is Empty (to))))) "BigCastling") (if (and ("HasNeverMoved" "RookRight") (can Move ("CastleRook" "RookRight" W 2 (is Empty (to))))) "SmallCastling")))) ifAfterwards:(not ("IsInCheck" "King" Mover))))) (end { ("Checkmate" "King") (if (or (no Moves Mover) (= (counter) 99)) (result Mover Draw))}))) END |
Describe the mechanics of the following Ludii game
(define "Custodial" (custodial (from (last To)) Orthogonal (between (max 1) if:(= (what at:(between)) (id #1)) (apply (remove (between)))) (to if:("FriendOrCentre")))) (define "JarlButNotTheExpandedCentre" (and (= (what at:(between)) (id "Jarl2")) (and (!= (between) ("Castle")) (not (is In (between) (sites "OrthogonalSitesCentre")))))) (define "JarlAndExpandedCentre" (and (= (what at:(between)) (id "Jarl2")) (or (= (between) ("Castle")) (is In (between) (sites "OrthogonalSitesCentre"))))) (define "FriendOrCentre" (or ("IsFriendAt" (to)) (= (to) ("Castle")))) (define "CaptureJarl" (apply (trigger "Surrounded" P2))) (define "JarlWasCaptured" (is Triggered "Surrounded" P2)) (define "Castle" (centrePoint)) (game "Tablut" (players 2) (equipment { (board (square 9)) (piece "Thrall" P1 (move Slide Orthogonal (between if:(and (!= (between) ("Castle")) (is Empty (between)))) (then (or { ("Custodial" "Thrall2") (surround (from (last To)) Orthogonal (between if:"JarlAndExpandedCentre" "CaptureJarl") (to if:"FriendOrCentre")) (custodial (from (last To)) Orthogonal (between (max 1) if:"JarlButNotTheExpandedCentre" "CaptureJarl") (to if:("IsFriendAt" (to))))})))) (piece "Thrall" P2 (move Slide Orthogonal (between if:(and (!= (between) ("Castle")) (is Empty (between)))) (then ("Custodial" "Thrall1")))) (piece "Jarl" P2 (move Slide Orthogonal (between if:(and (!= (between) ("Castle")) (is Empty (between)))) (then ("Custodial" "Thrall1")))) (regions "OrthogonalSitesCentre" (difference (expand origin:("Castle") Orthogonal) ("Castle")))}) (rules (start { (place "Thrall1" {"D1" "E1" "F1" "E2" "A4" "A5" "A6" "B5" "I4" "I5" "I6" "H5" "E8" "D9" "E9" "F9" "E8"}) (place "Thrall2" {"E3" "E4" "E6" "E7" "C5" "D5" "F5" "G5"}) (place "Jarl2" (centrePoint))}) (play (forEach Piece)) (end { ("PieceTypeReachWin" "Jarl2" (sites Outer) P2) (if "JarlWasCaptured" (result P1 Win))})))
###
| The central square is the castle, which cannot be entered by pieces or by the king once it has left. There are two sides: one with the king and 8 pieces, another with 16 undifferentiated pieces. The king begins on the castle space, and his associated pieces are arranged with two pieces on each orthogonal side of the king. The opposing side is arranged on the sides of the board, one piece on each of the three central squares on each of the four sides, and one further piece on the next row in on the central square of the row. Pieces move orthogonally any number of squares. Pieces cannot jump. If a piece is caught between two opposing pieces, it is removed from play. A piece may also be captured by trapping it between an enemy piece and the castle. The king, when in the castle, can only be captured when surrounded on four sides. If it is in a space adjacent to one of the sides, it can be captured when the opponent surrounds it on the remaining three sides. Otherwise, it is captured like any other piece. If the king moves to the edge of the board, the player controlling the king wins. If the opposing side captures the king, they win. The king is captured if the enemy flanks him, except on the castle where he should be surrounded. END |
Construct a Ludii game based on the following description
The king player receives one king piece and an army of 18. The mob player gets 26 pieces. Play is set on a star shape board. Captures are done by jumping adjacent enemy pieces and are compulsory but not multiple. Only the King can move to one of the star point cells (the blue cells). If no possible capture, a player moves a pawn to an adjacent empty cell.
The mob wins if the king is captured and the king player wins by getting the king piece to any of the points of the star.
###
| (game "Louis XVI" (players 2) (equipment { (board (remove (hex 7) cells:{ 0 1 2 4 5 6 7 8 9 12 13 14 15 16 22 23 57 45 70 34 58 82 46 71 69 81 56 44 68 92 55 80 120 121 122 124 125 126 112 113 114 117 118 119 103 104 110 111})) (piece "Pawn" Each) (piece "King" P2) (regions "GoalKing" (difference (sites Corners) (expand (sites Centre) steps:4)))}) (rules (start { (place "Pawn1" (difference (expand (sites Centre) steps:4) (expand (sites Centre) steps:3))) (place "Pawn2" (difference (expand (sites Centre) steps:2) (sites Centre))) (place "Pawn1" (difference (expand (sites Centre) steps:4) (expand (sites Centre) steps:3))) (place "King2" (sites Centre))}) (play (priority { (or (forEach Piece "Pawn" (move Hop (between if:("IsEnemyAt" (between))) (to if:(and (not (is In (to) (sites "GoalKing"))) (is Empty (to))) (apply (remove (between)))))) (forEach Piece "King" (move Hop (between if:("IsEnemyAt" (between))) (to if:(is Empty (to)))))) (or (forEach Piece "Pawn" (move Step (to if:(and (not (is In (to) (sites "GoalKing"))) (is Empty (to))) (apply (remove (between)))))) (forEach Piece "King" ("StepToEmpty")))})) (end { (if ("IsOffBoard" (where "King" P2)) (result P1 Win)) ("PieceTypeReachWin" "King2" (sites "GoalKing") P2)}))) 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. 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. Both players begin in the same quadrant of the board. One player's pieces are arranged as follows: Eight on the first point of the quadrant to their left, four on the fifth, and three on the sixth. The other player places five on the second, third, and fourth space of the same quadrant. The track proceeds in a clockwise direction around the board. When a player's piece lands on a space occupied by a single piece of the opponent, it is sent back to the beginning of the quadrant to the right of the starting quadrant. Pieces bear off from the quadrant diagonal from the starting quadrant. The first player to bear off all their pieces wins.
###
| (define "NextSiteFrom" ("NextSiteOnTrack" #2 from:#1)) (game "Seys Dos y As" (players 2) (equipment { ("TableBoard" { (track "Track1" {24 11..0 12..17} P1 directed:True) (track "Track2" {25 11..0 12..17} P2 directed:True)}) (dice d:6 num:3) (piece "Disc" Each (forEach Die if:("DieNotUsed") (if ("IsOffBoard" ("NextSiteFrom" (from) (pips))) (move Remove (from)) (move (from (from)) (to ("NextSiteFrom" (from) (pips)) if:("NoEnemyOrOnlyOne" (to)) ("HittingCapture" (handSite Next))))) (then ("ReplayNotAllDiceUsed")))) (hand Each)}) (rules (start { (place Stack "Disc1" 11 count:8) (place Stack "Disc1" 6 count:3) (place Stack "Disc1" 7 count:4) (place Stack "Disc2" (sites {10..8}) count:5)}) (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
The rules of TRAX are simple:
- Place tiles adjacent to those already in play such that the colours of the tracks match.
- The objective is to get a loop or line of your colour while attempting to stop your opponent in their colour.
- A line is a continuous path of track that connects opposite and outermost edges of the tiles in play, over at least 8 rows of tiles, across or down.
- What gives Trax its strategic depth is the forced play rule which allows (or even requires) multiple tiles to be played in a turn.
###
| (define "PlaceATileTo" (or (move "PositionOfTileX" (to #1 (rotations {N E})) copy:True) (move "PositionOfTileCurved" (to #1 (rotations Orthogonal)) copy:True))) (define "AnotherConnectedTile" (sites Around (sites Occupied by:All) Orthogonal if:(is Empty (to)))) (define "PositionOfTileCurved" (from (handSite Shared 1))) (define "PositionOfTileX" (from (handSite Shared))) (define "PathLength" (/ "NumTiles" 4)) (define "NumTiles" 32) (game "Trax" (players 2) (equipment { (boardless Square) (hand Shared size:2) (tile "TileX" numSides:4 { (path from:0 to:2 colour:1) (path from:1 to:3 colour:2)}) (tile "TileCurved" numSides:4 { (path from:0 to:1 colour:1) (path from:2 to:3 colour:2)})}) (rules (meta (automove)) (start { (place "TileX" (handSite Shared)) (place "TileCurved" (handSite Shared 1))}) phases:{ (phase "Opening" (play ("PlaceATileTo" (centrePoint))) (nextPhase "Connection")) (phase "Connection" (play (do ("PlaceATileTo" "AnotherConnectedTile") ifAfterwards:(is SidesMatch))) (end { (if (or (is Loop (mover) path:True) (<= "PathLength" (pathExtent (mover)))) (result Mover Win)) (if (or (is Loop (next) path:True) (<= "PathLength" (pathExtent (next)))) (result Next Win)) (if (>= (count Sites in:(sites Occupied by:All)) (* (count Players) "NumTiles")) (result Mover Draw))}))})) END |
Construct a Ludii game based on the following description
All the rules of Go apply, except that passing is not allowed. A player loses if he has no legal move. A player wins if they successfully connect two opposite sides of the board. The game is played on a 13x13 board
###
| (game "Gonnect" (players 2) (equipment { (board (square 13) use:Vertex) (piece "Marker" Each) (regions P1 {(sites Side N) (sites Side S)}) (regions P2 {(sites Side W) (sites Side E)})}) (rules (meta { (swap) (no Repeat)}) (play (do (move Add (to (sites Empty)) (then ("EncloseCapture" Orthogonal))) ifAfterwards:("HasFreedom" Orthogonal))) (end { (if (is Connected Mover) (result Mover Win)) ("BlockWin")}))) END |
Construct a Ludii game based on the following description
Played on an 8x8 board. One player plays as one Raja, the other with the following pieces: 8 Bhata (or Padati; move like Chess pawns but without being able to move two on the first turn); 2 Ashva (horses; move like Chess knights); 2 Gaja (elephants; two spaces in any orthogonal direction, jumping over the first square); 2 Ratha (chariots; moves like a rook in chess); 1 Mantri (counselor; moves one square diagonally in any direction); 1 Raja (king; moves one square in any direction). These are set up along one edge of the board: Ratha-Ashva-Gaja-Mantri-Raja-Gaja-Ashva-Ratha, with the eight Bhata lined up in the row in front of these, as in chess. The player with the full complement of pieces rolls a six-sided die to determine which piece to move: 6=Raja, 5= Mantri, 4=Gaja, 3 = Ashva, 2=Ratha, 1= Bhata. The player with the single Raja can move it according to the moves of any piece. Players take turns moving. When one piece lands on the space occupied by another piece, it is captured. The goal of the player with a full complement of pieces is to block the single Raja so that it cannot move. The Goal of the single Raja is to checkmate the opponent's Raja.
###
| (define "ElephantMove" (move Hop Orthogonal (between if:True) (to if:(not ("IsFriendAt" (to))) (apply (if ("IsEnemyAt" (to)) (remove (to))))))) (define "RookMove" ("SlideCapture" Orthogonal)) (define "QueenMove" ("StepToNotFriend" Diagonal)) (define "KnightMove" ("LeapCapture" "KnightWalk")) (define "KingMove" ("StepToNotFriend")) (define "NextCanNotMove" (not (can Move (do (forEach Piece Next) ifAfterwards:(not ("IsInCheck" "King_noCross" Next (forEach Piece))))))) (define "CaptureForwardDiagonal" ("StepToEnemy" (directions {FR FL}))) (game "Sarvatobhadra" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) (dice d:6 from:1 num:1) (piece "King_noCross" P1 ("KingMove")) (piece "Ferz_noCross" P1 ("QueenMove")) (piece "Knight" P1 ("KnightMove")) (piece "Elephant" P1 ("ElephantMove")) (piece "Rook" P1 ("RookMove")) (piece "Pawn" P1 (or "StepForwardToEmpty" "CaptureForwardDiagonal" (then ("PromoteIfReach" (sites Top) "Ferz_noCross")))) (piece "King_noCross" P2 (or { ("RookMove") ("KnightMove") ("ElephantMove") ("QueenMove") ("QueenMove") ("KingMove")}))}) (rules (start { (place "Pawn1" (sites Row 1)) (place "Rook1" {"A1" "H1"}) (place "Knight1" {"B1" "G1"}) (place "Elephant1" {"C1" "F1"}) (place "Ferz_noCross1" coord:"D1") (place "King_noCross1" coord:"E1") (place "King_noCross2" coord:"E8")}) (play (do (if (is Mover P1) (do (roll) next:(if (= (count Pips) 6) (forEach Piece "King_noCross") (if (= (count Pips) 5) (forEach Piece "Ferz_noCross") (if (= (count Pips) 4) (forEach Piece "Elephant") (if (= (count Pips) 3) (forEach Piece "Knight") (if (= (count Pips) 2) (forEach Piece "Rook") (forEach Piece "Pawn"))))))) (forEach Piece)) ifAfterwards:(not ("IsInCheck" "King_noCross" Mover (forEach Piece Next))))) (end { (if (and { (is Mover P2) ("IsInCheck" "King_noCross" Next) ("NextCanNotMove")}) (result P2 Win)) (if (and (is Mover P1) (no Moves P2)) (result P1 Win)) (if (and { (is Mover P1) ("IsInCheck" "King_noCross" P1) (no Moves P1)}) (result P2 Win))}))) END |
Construct a Ludii game based on the following description
The board is a rectilinear track with two rows, of any number. Six or seven players, seven are preferred. One piece per player. Two seashells, used as dice. The throws are as follows: two backs = 20; two hollow sides = 10, one of each = 0. The player to reach the end of the track wins. The game involves 7 players. Each row has 50 holes.
###
| (define "SiteToMove" (if (= (from) (handSite Mover)) ("SiteToMoveOnTrack" from:0 (- ("ThrowValue") 1)) ("SiteToMoveOnTrack" from:(from) ("ThrowValue")))) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" #2 #1)) (define "ThrowValue" (mapEntry (count Pips))) (game "Uturu Uturu Kaida" (players 7) (equipment { (board (rectangle 2 50) (track "Track" {0..49 99..50} directed:True) use:Vertex) (hand Each) (piece "Horse" Each (if ("IsOffBoard" ("SiteToMove")) (move Remove (from) level:(level)) (move (from (from) level:(level)) (to ("SiteToMove")) stack:True))) ("StickDice" 2) (map {(pair 0 10) (pair 1 0) (pair 2 20)})}) (rules (start (place "Horse" "Hand")) (play ("RollMove" (if (< 0 ("ThrowValue")) (or (forEach Piece) (forEach Piece container:(mover)))))) (end ("EscapeWin")))) END |
Construct a Ludii game based on the following description
Play begins with all holes filled except the central hole. The player moves a peg by orthogonally jumping an adjacent peg and removing it from the board. The goal is to remove all but one peg, leaving it in the central hole. The game is played on the English board.
###
| (game "Peg Solitaire" (players 1) (equipment { (board (merge (shift 0 2 (rectangle 3 7)) (shift 2 0 (rectangle 7 3))) use:Vertex) (piece "Marker" P1 ("HopFriendCapture" Orthogonal))}) (rules (start { (place "Marker" (difference (sites Board) (sites {"D4"})))}) (play (forEach Piece)) (end (if (and (is Friend (who at:(centrePoint))) (= 1 (count Pieces All))) (result P1 Win))))) END |
Modify the Ludii game according to the following option changes:
A 5x5 playing area is currently selected -> A 9x9 playing area is currently selected
(game "Flume" (players 2) (equipment { (board (square 7)) (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)))))
###
| (game "Flume" (players 2) (equipment { (board (square 11)) (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 |
What does the following global Ludii definition do?
(define "AlquerqueGraphWithBottomAndTopTriangles" (merge { (square 5 diagonals:Alternating) (shift 0 4 (rotate 180 (wedge 3))) (shift 0 -2 (wedge 3))}))
###
| Defines a rectangular graph with Alquerque-style alternating diagonals with a triangle extension at the bottom and another at the top. 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)) (add (piece (id "Marker" #1)) (to (site)))}))) (define "PlaceOnTop" (move (from (handSite Mover)) (to (forEach (sites Occupied by:Next container:"Board") if:(= (size Stack at:(site)) 1))))) (game "Sam K'i" (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) count:12) (place Stack "Marker2" (handSite P2) count:12)}) phases:{ (phase "Placement" (play (if "SameTurn" "PlaceOnTop" (if ("HandOccupied" Mover) (move (from (handSite Mover)) (to (sites Empty)) (then ("ReplayIfLine3" if:("IsSingletonStack" (to)))))) (then (if (and (not (is Next Mover)) (and ("HandEmpty" P1) ("HandEmpty" P2))) (and ("RemoveDeadPieces" P1) ("RemoveDeadPieces" P2)))))) (nextPhase (and (not (is Next Mover)) (and ("HandEmpty" P1) ("HandEmpty" P2))) "Movement")) (phase "Movement" (play (if "SameTurn" "RemoveAnyEnemyPiece" (if (> (count Pieces Mover) 3) (forEach Piece) (move (from (sites Occupied by:Mover)) (to (sites Empty)))))) (end ("BlockWin")))}))
###
| Three concentric squares, with lines connecting the corners and the midpoints of the sides. Twelve pieces per player. Players alternate turns placing a piece on the board. When a player places three pieces in a row along the lines of the board, the player places another of their pieces on top of one of the opponent's pieces; the opponent's piece is considered \ END |
Construct a Ludii game based on the following description
5x5 lines, intersecting to form a square. Diagonals are drawn in the four quadrants of the board. One triangle, its apex intersecting the main board at the midpoint of one side. The base of the triangle is bisected by a line drawn from the apex, and this line is bisected and intersects with the other two sides of the triangle. One player plays as the tiger, placed on the central point of the triangle, and the other plays as twelve goats, which begin on the first two rows of points opposite the triangle and on the outer two points in the third row. The tiger moves first. Pieces move to an empty adjacent spot along the lines on the board. The tiger alone may capture a goat by hopping over it to an empty spot immediately opposite a goat. The tiger wins by capturing all the goats; the goats win by blocking the tiger from being able to move.
###
| (game "Orissa Tiger Game (One Tiger)" (players 2) (equipment { (board (rotate 180 ("AlquerqueGraphWithBottomTriangle")) use:Vertex) (piece "Tiger" P1 (or ("StepToEmpty") ("HopCapture"))) (piece "Goat" P2 ("StepToEmpty"))}) (rules (start { (place "Tiger1" (sites {"C6"})) (place "Goat2" (union (expand (sites Bottom)) (sites {"A3" "E3"})))}) (play (forEach Piece)) (end ("NoMovesP1NoPiecesP2")))) END |
Construct a global Ludii definition which fulfills the following requirements.
Checks if all the enemies have no piece and makes the current team to win. This ludemeplex can be used only in an ending condition.
###
| (define "CaptureAllTeam" (if (no Pieces Enemy) (result TeamMover Win))) 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 (Zipline variant)" (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 White. Player 2 is now Black." to:All))) (note "Player 1 is now Black. Player 2 is now White." to:All) (then (do (set NextPlayer (player 1)) next:(set Var 1))))))))) (nextPhase ("IsPlayingPhase") "Playing")) (phase "Playing" (play (or (move Add (to (sites Empty) if:(= (id P1) (mover))) (then (if (= 0 (count MovesThisTurn)) (moveAgain)))) (move Add (to (sites Empty) if:(= (id P2) (mover)))))))} (end { (if (and (not ("IsPlayingPhase")) ("WhiteVC")) (result Mover Win)) (if (and {(= (id P1) (mover)) ("BlackVC")}) (result P1 Win)) (if (and {(= (id P2) (mover)) ("WhiteVC")}) (result P2 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 (Zipline variant)" (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 White. Player 2 is now Black." to:All))) (note "Player 1 is now Black. Player 2 is now White." to:All) (then (do (set NextPlayer (player 1)) next:(set Var 1))))))))) (nextPhase ("IsPlayingPhase") "Playing")) (phase "Playing" (play (or (move Add (to (sites Empty) if:(= (id P1) (mover))) (then (if (= 0 (count MovesThisTurn)) (moveAgain)))) (move Add (to (sites Empty) if:(= (id P2) (mover)))))))} (end { (if (and (not ("IsPlayingPhase")) ("WhiteVC")) (result Mover Win)) (if (and {(= (id P1) (mover)) ("BlackVC")}) (result P1 Win)) (if (and {(= (id P2) (mover)) ("WhiteVC")}) (result P2 Win))}))) END |
Modify the Ludii game according to the following option changes:
A size 4 board is currently selected -> A size 6 board is currently selected
(define "OpponentHas" (> (min (count Sites in:(if (< 0 (count Sites in:(intersection (sites Occupied by:Mover) (sites Direction from:(to) #1 stop:(= (mover) (who at:(to))) stopIncluded:True)))) (sites Direction from:(to) #1 stop:(= (mover) (who at:(to)))) (sites Board))) (count Sites in:(if (< 0 (count Sites in:(intersection (sites Occupied by:Mover) (sites Direction from:(to) #2 stop:(= (mover) (who at:(to))) stopIncluded:True)))) (sites Direction from:(to) #2 stop:(= (mover) (who at:(to)))) (sites Board)))) (min (count Sites in:(if (< 0 (count Sites in:(intersection (sites Occupied by:Next) (sites Direction from:(to) #1 stop:(= (next) (who at:(to))) stopIncluded:True)))) (sites Direction from:(to) #1 stop:(= (next) (who at:(to)))) (sites Board))) (count Sites in:(if (< 0 (count Sites in:(intersection (sites Occupied by:Next) (sites Direction from:(to) #2 stop:(= (next) (who at:(to))) stopIncluded:True)))) (sites Direction from:(to) #2 stop:(= (next) (who at:(to)))) (sites Board)))))) (define "Placeable" (not (or { (and ("OpponentHas" E W) ("OpponentHas" NNW SSE)) (and ("OpponentHas" E W) ("OpponentHas" NNE SSW)) (and ("OpponentHas" NNW SSE) ("OpponentHas" NNE SSW))}))) (game "Mity" (players 2) (equipment { (board (hex 4)) (piece "Disc" Each)}) (rules (meta (swap)) (play (move Add (to (sites Empty) if:("Placeable")))) (end ("BlockWin"))))
###
| (define "OpponentHas" (> (min (count Sites in:(if (< 0 (count Sites in:(intersection (sites Occupied by:Mover) (sites Direction from:(to) #1 stop:(= (mover) (who at:(to))) stopIncluded:True)))) (sites Direction from:(to) #1 stop:(= (mover) (who at:(to)))) (sites Board))) (count Sites in:(if (< 0 (count Sites in:(intersection (sites Occupied by:Mover) (sites Direction from:(to) #2 stop:(= (mover) (who at:(to))) stopIncluded:True)))) (sites Direction from:(to) #2 stop:(= (mover) (who at:(to)))) (sites Board)))) (min (count Sites in:(if (< 0 (count Sites in:(intersection (sites Occupied by:Next) (sites Direction from:(to) #1 stop:(= (next) (who at:(to))) stopIncluded:True)))) (sites Direction from:(to) #1 stop:(= (next) (who at:(to)))) (sites Board))) (count Sites in:(if (< 0 (count Sites in:(intersection (sites Occupied by:Next) (sites Direction from:(to) #2 stop:(= (next) (who at:(to))) stopIncluded:True)))) (sites Direction from:(to) #2 stop:(= (next) (who at:(to)))) (sites Board)))))) (define "Placeable" (not (or { (and ("OpponentHas" E W) ("OpponentHas" NNW SSE)) (and ("OpponentHas" E W) ("OpponentHas" NNE SSW)) (and ("OpponentHas" NNW SSE) ("OpponentHas" NNE SSW))}))) (game "Mity" (players 2) (equipment { (board (hex 6)) (piece "Disc" Each)}) (rules (meta (swap)) (play (move Add (to (sites Empty) if:("Placeable")))) (end ("BlockWin")))) END |
Construct a Ludii game based on the following description
9x9 board, with the central square of each side marked, as well as the central space of the board. Two to four players, each player with two pieces. Played with two four-sided dice, marked 1, 3, 4, 6. Throws may be divided as the players see fit between their pieces. Doubles allow another throw. Players start with their pieces on the marked square on their side of the board. Pieces move along a spiraling track, starting in an anti-clockwise direction around the outer edges of the board, then changing to a clockwise direction when reaching the 32nd space in the track, and continuing in this direction in a spiral pattern until reaching the central square. If a player lands on a space occupied by an opponent's piece, the opponent's piece is removed from the board, and the player must throw a double 1 to enter it again on their starting square. Pieces resting on a marked space are safe from being sent to the start. The goal is to reach the central square with both pieces, which must be reached by an exact throw. If a piece is 1, 3, or 4 spaces from the center, the player must throw doubles of that number to reach the goal.
The game is played with 4 players.
###
| (define "AllReachedCenter" (= 2 (count Pieces Mover in:(sites Centre)))) (define "Move" (or (if (and { (is Occupied (handSite Mover)) (all DiceEqual) (= 2 (value Player Mover))}) (move (from (handSite Mover)) (to (mapEntry "Entry" Mover)) (then (and (moveAgain) (set Var "Double" 1))))) (forEach Piece))) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" #2 #1)) (define "ThrowValue" (count Pips)) (game "Saturankam" (players 4) (equipment { (board (square 9) { (track "Track1" "81,4,E,N,W,S,E1,N7,E6,S6,W5,N5,E4,S4,W3,N3,E2,S2,W1,N1" P1 directed:True) (track "Track2" "83,36,S,E,N,W,S1,E7,S6,W6,N5,E5,S4,W4,N3,E3,S2,W2,N1,E1" P2 directed:True) (track "Track3" "83,76,W,S,E,N,W1,S7,W6,N6,E5,S5,W4,N4,E3,S3,W2,N2,E1,S1" P3 directed:True) (track "Track4" "84,44,N,W,S,E,N1,W7,N6,E6,S5,W5,N4,E4,S3,W3,N2,E2,S1,W1" P4 directed:True)}) (dice d:4 faces:{1 3 4 6} num:2) (piece "Marker" Each (if (and (or { (= ("SiteToMoveOnTrack" from:(from) 1) (centrePoint)) (= ("SiteToMoveOnTrack" from:(from) 3) (centrePoint)) (= ("SiteToMoveOnTrack" from:(from) 4) (centrePoint))}) (= (value Player Mover) ("ThrowValue"))) (if (and (all DiceEqual) (= ("SiteToMoveOnTrack" from:(from) (/ ("ThrowValue") 2)) (centrePoint))) (move (from (from)) (to (centrePoint)) (then (and (moveAgain) (set Var "Double" 1))))) (forEach Value min:1 max:(value Player Mover) (move (from (from) level:(level)) (to ("SiteToMoveOnTrack" from:(from) (value)) if:True (apply (and (if (and (not (is In (to) (sites "SafeSites"))) ("IsEnemyAt" (to))) (forEach Level (to) FromTop (fromTo (from (to) level:(level)) (to (handSite (who at:(to) level:(level))))))) (if (< 0 (- (value Player Mover) (value))) (and (moveAgain) (set Value Mover (- (value Player Mover) (value)))) (and (set Value Mover 0) (if (all DiceEqual) (and (moveAgain) (set Var "Double" 1)))))))))))) (hand Each) (regions "SafeSites" (sites {4 44 76 36 40})) (map "Entry" {(pair P1 4) (pair P2 36) (pair P3 76) (pair P4 44)})}) (rules (start { (place Stack "Marker1" 4 count:2) (place Stack "Marker2" 36 count:2) (place Stack "Marker3" 76 count:2) (place Stack "Marker4" 44 count:2)}) (play (if (or (= 1 (var "Double")) ("NewTurn")) ("RollMove" (move Pass (then (and { (set Value Mover ("ThrowValue")) (if (= 1 (var "Double")) (set Var "Double" 0)) (moveAgain)})))) (if (can Move ("Move")) ("Move") (move Pass (then (and (set Var "Double" 0) (set Value Mover 0))))))) (end (if ("AllReachedCenter") (result Mover Win))))) END |
Construct a Ludii game based on the following description
One player is the rabbit, and the other player plays with twelve other pieces. They may also play with either ten or eleven pieces instead of twelve. The pieces move along the lines. The goal is to corner the rabbit so that it cannot move. The rabbit may hop over the other pieces to capture them. The rabbit wins by reducing the opponent to nine pieces. Played on a Alquerque Board. The hare can jump to capture.
###
| (game "Cercar La Liebre" (players 2) (equipment { ("AlquerqueBoard" 5 5) (piece "Counter" P1 "StepToEmpty") (piece "Hare" P2 (or "HopCapture" (if "SameTurn" (move Pass) "StepToEmpty")))}) (rules (start { (place "Counter1" (union {(expand (sites Bottom)) (sites {"A3" "E3"})})) (place "Hare2" (centrePoint))}) (play (forEach Piece)) (end ("NoMovesLossAndLessNumPiecesPlayerLoss" P1 9)))) END |
Construct a Ludii game based on the following description
Played on an 8x8 board with 12 pieces per side. Pieces move one space diagonally. Capturing occurs when an opponent's piece is adjacent to a player's piece and there is an open space on the other side of the opponent and the player's piece jumps the opponent's. Capturing can happen either forwards or backwards. Capturing must happen if it is possible. Multiple jumps can be made in a turn, and the maximum number of jumps must be made. Pieces become kings when they reach the opposite side of the board from which they started at the end of its turn. Kings can move multiple spaces in one direction.
###
| (define "IsUnpromoted" ("IsPieceAt" "Counter" Mover (last To))) (game "Brazilian Draughts" (players 2) ("DraughtsEquipment" (square 8)) (rules ("BlackCellsSetup" 3) (play (if "SameTurn" (if "IsUnpromoted" (max Moves ("HopInternationalDraughtsStyle" (from (last To)) (then ("ReplayIfCanMove" ("HopInternationalDraughtsStyle" (from (last To))) ("PromoteIfReach" (sites Next) "DoubleCounter"))))) (max Moves ("HopDiagonalSequenceCaptureAgain" before:(count Rows) after:(count Rows) at:EndOfTurn))) (priority { (max Moves (or (forEach Piece "Counter" ("HopInternationalDraughtsStyle" (from) (then ("ReplayIfCanMove" ("HopInternationalDraughtsStyle" (from (last To))) ("PromoteIfReach" (sites Next) "DoubleCounter"))))) (forEach Piece "DoubleCounter" ("HopDiagonalSequenceCapture" before:(count Rows) after:(count Rows) at:EndOfTurn)))) (or (forEach Piece "Counter" ("StepToEmpty" (directions {FR FL})) (then ("PromoteIfReach" (sites Next) "DoubleCounter"))) (forEach Piece "DoubleCounter" (move Slide Diagonal)))}))) (end ("BlockWin")))) END |
Construct a Ludii game based on the following description
The tiles are each given a number from 1 to n-1. By sliding the tiles into the open space, the object is to placed the tiles in order based on their numbering.
###
| (game "N Puzzles" (players 1) (equipment { (board (square 3)) (piece "1" P1 "StepOrthogonalToEmpty") (piece "2" P1 "StepOrthogonalToEmpty") (piece "3" P1 "StepOrthogonalToEmpty") (piece "4" P1 "StepOrthogonalToEmpty") (piece "5" P1 "StepOrthogonalToEmpty") (piece "6" P1 "StepOrthogonalToEmpty") (piece "7" P1 "StepOrthogonalToEmpty") (piece "8" P1 "StepOrthogonalToEmpty")}) (rules (start (place Random {"1" "2" "3" "4" "5" "6" "7" "8"})) (play (forEach Piece)) (end (if (is Target {7 8 0 4 5 6 1 2 3}) (result P1 Win))))) END |
Construct a Ludii game based on the following description
Three concentric squares, the corners and midpoints of the squares connected with lines. Nine pieces per player. Players alternate turns placing a piece on an empty spot on the board. When all of the pieces are placed, the players alternate turns moving a piece to an empty adjacent spot along the lines. During either phase, when a player places three of their pieces in a row along the orthogonal lines (not along the diagonal lines), the player removes any one of the opponent's pieces. When a player is reduced to four pieces, they may move a piece to any open spot on the board. The player who reduces the opponent to two pieces wins.
###
| (define "IfLine3MoveAgain" (then (if (or { (is Line 3 N exact:True) (is Line 3 S exact:True) (is Line 3 E exact:True) (is Line 3 W exact:True)}) (moveAgain)))) (game "Marelle Triple" (players 2) (equipment { (board (concentric Square rings:3 joinCorners:True) use:Vertex) (hand Each) (piece "Marker" Each ("StepToEmpty" ~ "IfLine3MoveAgain"))}) (rules (start (place "Marker" "Hand" count:9)) phases:{ (phase "Placement" (play (if "SameTurn" ("RemoveAnyEnemyPiece") (move (from (handSite Mover)) (to (sites Empty)) "IfLine3MoveAgain"))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) (phase "Movement" (play (if "SameTurn" ("RemoveAnyEnemyPiece") (if (> (count Pieces Mover) 4) (forEach Piece) (move (from (sites Occupied by:Mover)) (to (sites Empty)))))))} (end ("HavingLessPiecesLoss" Next 2)))) END |
Construct a Ludii game based on the following description
Hoshi Sudoku consists of six large triangles. You must place the numbers 1-9 into the triangular cells of each large triangle. Every line, even an uncontinuous line, contains every number only once.
###
| (game "Hoshi" (players 1) (equipment { (board (union { (tri 3) (shift 1 0.87 (rotate 180 (tri 3))) (shift 0 3.47 (tri 3)) (shift -2 2.6 (rotate 180 (tri 3))) (shift -3 1.73 (tri 3)) (shift -2 -0.87 (rotate 180 (tri 3)))}) (values Cell (range 1 9))) (regions {0 3 1 4 2 5 7 6 8}) (regions {17 16 14 15 11 13 10 12 9}) (regions {18 19 20 21 22 23 24 25 26}) (regions {27 28 29 30 31 32 33 34 35}) (regions {36 37 38 39 40 41 42 43 44}) (regions {45 46 47 48 49 50 51 52 53}) (regions {36 39 41 43 44 33 31 28}) (regions {47 37 40 42 35 34 32 30 27}) (regions {51 49 46 38 18 21 23 25 26}) (regions {53 52 50 48 45 11 19 22 24}) (regions {0 3 5 7 8 15 13 10 20}) (regions {1 4 6 17 16 14 12 9}) (regions {53 52 51 49 47 37 39 41}) (regions {0 50 48 46 38 40 42 43 44}) (regions {1 3 5 45 35 34 33 31 29}) (regions {2 4 6 7 8 18 32 30 28}) (regions {17 16 15 13 11 19 21 23 27}) (regions {14 12 10 20 22 24 25 26}) (regions {2 4 1 3 0 50 52 51}) (regions {17 6 7 5 45 48 46 49 47}) (regions {14 16 15 8 38 40 37 39 36}) (regions {9 12 10 13 11 35 42 43 41}) (regions {20 22 19 21 18 32 34 33 44}) (regions {24 25 23 27 30 28 31 29})}) (rules (start (set { {53 5} {51 2} {48 3} {5 2} {1 3} {2 7} {17 5} {14 1} {9 7} {13 4} {21 3} {24 6} {26 8} {21 3} {32 6} {28 2} {29 8} {42 9} {41 6} {36 5} {42 9}})) (play (satisfy { (all Different)})) (end (if (is Solved) (result P1 Win))))) END |
Construct a Ludii game based on the following description
Phase Chess is a variant of Chess played on standard Chess board and Chess set, with same rules as Chess except the next player must move from a cell of the same colour just moved to if they can. It they can not, they can move any piece.
###
| (define "InitialPawnMove" (if (is In (from) (sites Start (piece (what at:(from))))) ("DoubleStepForwardToEmpty" "SetEnPassantLocation"))) (define "QueenMove" (move Slide (to if:("IsEnemyAt" (to)) "CaptureToPieceAndResetCounter"))) (define "KnightMove" (move Leap "KnightWalk" (to if:(not ("IsFriendAt" (to))) "CaptureToPieceAndResetCounter"))) (define "BishopMove" (move Slide Diagonal (to if:("IsEnemyAt" (to)) "CaptureToPieceAndResetCounter"))) (define "KingMove" (move Step (to if:(not ("IsFriendAt" (to))) "CaptureToPieceAndResetCounter") "RememberPieceHasMoved")) (define "RookMove" (move Slide Orthogonal (to if:("IsEnemyAt" (to)) "CaptureToPieceAndResetCounter") "RememberPieceHasMoved")) (define "PawnMove" (or { (if (is In (from) (sites Start (piece (what at:(from))))) ("DoubleStepForwardToEmpty" "SetEnPassantLocation")) "StepForwardToEmpty" "CaptureForwardDiagonal" "EnPassant"} (then (and (if (is In (last To) (sites Mover "Promotion")) (moveAgain)) (set Counter))))) (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" ("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" ("IsPieceAt" "King" Mover (mapEntry "King" (mover)))) (define "NextCanNotMove" (not (can Move (do (forEach Piece Next) ifAfterwards:(not ("IsInCheck" "King" Next (forEach Piece))))))) (game "Phase Chess" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) ("ChessPawn" "Pawn" (or "InitialPawnMove" "EnPassant") (then (and ("ReplayInMovingOn" (sites Mover "Promotion")) (set Counter)))) ("ChessRook" "Rook" (then (set Counter)) ("RememberPieceHasMoved")) ("ChessKing" "King" (then (set Counter)) ("RememberPieceHasMoved")) ("ChessBishop" "Bishop" (then (set Counter))) ("ChessKnight" "Knight" (then (set Counter))) ("ChessQueen" "Queen" (then (set Counter))) (map "King" {(pair 1 "E1") (pair 2 "E8")}) (map "RookLeft" {(pair 1 "A1") (pair 2 "A8")}) (map "RookRight" {(pair 1 "H1") (pair 2 "H8")}) (regions "Promotion" P1 (sites Top)) (regions "Promotion" P2 (sites Bottom))}) (rules (start { (place "Pawn1" (sites Row 1)) (place "Pawn2" (sites Row 6)) (place "Rook1" {"A1" "H1"} state:1) (place "Knight1" {"B1" "G1"}) (place "Bishop1" {"C1" "F1"}) (place "Queen1" coord:"D1") (place "King1" coord:"E1" state:1) (place "Rook2" {"A8" "H8"} state:1) (place "Knight2" {"B8" "G8"}) (place "Bishop2" {"C8" "F8"}) (place "Queen2" coord:"D8") (place "King2" coord:"E8" state:1)}) (play (if "SameTurn" (move Promote (last To) (piece {"Queen" "Knight" "Bishop" "Rook"}) Mover) (priority { (if (!= 0 (count Moves)) (do (or { (forEach Piece "Queen" (if (= (phase of:(from)) (phase of:(last To))) ("QueenMove"))) (forEach Piece "Knight" (if (= (phase of:(from)) (phase of:(last To))) ("KnightMove"))) (forEach Piece "Bishop" (if (= (phase of:(from)) (phase of:(last To))) ("BishopMove"))) (forEach Piece "King" (if (= (phase of:(from)) (phase of:(last To))) ("KingMove"))) (forEach Piece "Rook" (if (= (phase of:(from)) (phase of:(last To))) ("RookMove"))) (forEach Piece "Pawn" (if (= (phase of:(from)) (phase of:(last To))) ("PawnMove"))) (if ("IsPhaseZero" (last To)) (if (and { "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:(not ("IsInCheck" "King" Mover (forEach Piece))))) (do (or (forEach Piece) (if (and { "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:(not ("IsInCheck" "King" Mover)))}))) (end { (if (and ("IsInCheck" "King" Next) ("NextCanNotMove")) (result Mover Win)) (if (or (no Moves Mover) (= (counter) 100)) (result Mover Draw))}))) END |
Modify the Ludii game according to the following option changes:
The game is played on a 7x7 board. -> The game is played on a 9x9 board.
Look and feel: Black&White -> Look and feel: Garden
(define "DroppableFromDirection" (and ( (= 0 (count Pieces All in:(sites LineOfSight at:(site) #1))) (= 1 (count Pieces in:(sites Around (site) #2)))))) (game "Centripetal Force" (players 2) (equipment { (board (square 7)) (piece "Cross" P1) (piece "Disc" P2) (piece "Square" Neutral)}) (rules (start (place "Square0" coord:"D4")) (play (move Add (to (forEach (sites Empty) if: (and ( (< 0 (count Pieces in:(sites Around (site) Orthogonal))) (or { ("DroppableFromDirection" N S) ("DroppableFromDirection" S N) ("DroppableFromDirection" W E) ("DroppableFromDirection" E W)}))))))) (end { (if (is Line 5) (result Mover Win)) (if (no Moves Next) (result All Draw))})))
###
| (define "DroppableFromDirection" (and ( (= 0 (count Pieces All in:(sites LineOfSight at:(site) #1))) (= 1 (count Pieces in:(sites Around (site) #2)))))) (game "Centripetal Force" (players 2) (equipment { (board (square 9)) (piece "Cross" P1) (piece "Disc" P2) (piece "Square" Neutral)}) (rules (start (place "Square0" coord:"E5")) (play (move Add (to (forEach (sites Empty) if: (and ( (< 0 (count Pieces in:(sites Around (site) Orthogonal))) (or { ("DroppableFromDirection" N S) ("DroppableFromDirection" S N) ("DroppableFromDirection" W E) ("DroppableFromDirection" E W)}))))))) (end { (if (is Line 5) (result Mover Win)) (if (no Moves Next) (result All Draw))}))) END |
Construct a Ludii game based on the following description
2x12 board, divided in half, where the spaces are rendered as points. Fifteen pieces per player. Two six-sided dice. Play occurs only in two quadrants of the board, opposite one another, a player's pieces only leaving their quadrant to bear off. Two pieces are stacked each on the first three points, and three are stacked in the second three points. Players use throws to unstack pieces on their points, unstacking one piece per die which corresponds to that point. Doubles allow the player to unstack or bear off a number of pieces equal to the total number of the throw. When all of the pieces are unstacked, that player may begin bearing their pieces off. 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. Once a player has borne off all of their pieces, they must re-enter them onto the points and replicate the starting position. The first player to bear off all their pieces and then place them in the starting position again 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 "BearOff" (move (from #1) (to (handSite Mover)))) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" (pips))) (define "SiteToSelect" ("NextSiteOnTrack" (- (pips) 1) from:(mapEntry "StartTrack" (mover)))) (game "Tables Rabbatuees" (players 2) (equipment { ("BackgammonBoard" { (track "Track1" {0..5} P1 directed:True) (track "Track2" {13..18} P2 directed:True)}) (dice d:6 num:2) (piece "Disc" Each (forEach Die if:("DieNotUsed") (if ("IsOffBoard" "SiteToMoveOnTrack") ("BearOff" (from)) (move (from) (to "SiteToMoveOnTrack"))))) (hand Each) (map "StartTrack" {(pair P1 0) (pair P2 13)})}) (rules (start { (place Stack "Disc1" (sites {0..2}) count:2) (place Stack "Disc1" (sites {3..5}) count:3) (place Stack "Disc2" (sites {13..15}) count:2) (place Stack "Disc2" (sites {16..18}) count:3)}) phases:{ (phase "UnStacking" (play ("RollEachNewTurnMove" (if (or (< 0 (var "Double")) (all DiceEqual)) (do (if (>= 0 (var "Double")) (set Var "Double" (count Pips))) next:(forEach Site (sites Occupied by:Mover) (if ("PieceFullStacked" (site)) (move Select (from (site)) (then (if (= 3 (size Stack at:(last To))) ("UnstackHalf") ("UnstackFull")))) (if ("PieceHalfStacked" (site)) (move Select (from (site)) (then ("UnstackFull"))))) (then (and (if (< 1 (var "Double")) (moveAgain)) (set Var "Double" (- (var "Double") 1)))))) (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 ("RollEachNewTurnMove" (if (or (< 0 (var "Double")) (all DiceEqual)) (do (if (>= 0 (var "Double")) (set Var "Double" (count Pips))) next:(forEach Site (sites Occupied by:Mover) ("BearOff" (site)) (then (and (if (< 1 (var "Double")) (moveAgain)) (set Var "Double" (- (var "Double") 1)))))) (forEach Piece top:True)) (then ("ReplayNotAllDiceUsed")))) (nextPhase Mover (no Pieces Mover in:(sites Board)) "Placing")) (phase "Placing" (play ("RollEachNewTurnMove" (if (is Occupied (handSite Mover)) (forEach Die if:("DieNotUsed") (if (if (< (pips) 4) (< (size Stack at:"SiteToSelect") 2) (< (size Stack at:"SiteToSelect") 3)) (move (from (handSite Mover)) (to ("SiteToSelect")))) (then (and ("ReplayNotAllDiceUsed") (if (!= 0 (state at:(last To))) (set State at:(last To) 0)))))))) (end (if (is Empty (handSite Mover)) (result Mover Win))))})) END |
Construct a Ludii game based on the following description
Players take turns placing pieces of any colour. They can't create groups of more than five pieces which are adjacent to each other.
A group of 4 pieces is called a quart. A group of 5 pieces is called a quint.
Players win if they finish their turn with a friendly quint, but lose if they finish their turn with a friendly quart on the board.
Note: The winning and losing conditions for a player are checked after their move, only on their own turn.
An end condition (win or loss) is effective when it occurred first and cannot be averted.
###
| (game "Manalath" (players 2) (equipment { (board (rotate 90 (hex 5))) (piece "Marker" Each) (hand Shared size:2)}) (rules (start { (place "Marker1" (handSite Shared)) (place "Marker2" (handSite Shared 1))}) (play (do (move (from (sites Hand Shared)) (to (sites Empty)) copy:True) ifAfterwards:(< (size Group at:(last To)) 6) (then (forEach Site (sites Occupied by:Mover container:"Board") (if (= (size Group at:(site)) 5) (set Var "Group5" 1) (if (= (size Group at:(site)) 4) (set Var "Group4" 1))))))) (end { (if (= (var "Group4") 1) (result Mover Loss)) (if (= (var "Group5") 1) (result Mover Win))}))) END |
Modify the Ludii game according to the following option changes:
Played on a size 12 board. -> Played on a size 13 board.
(game "Unfair" (players 2) (equipment { (board (square 12) use:Vertex) (piece "Ball" Each)}) (rules (play (or (move Add (to (sites Empty) if:(= (id P1) (mover))) (then (if (= 0 (count MovesThisTurn)) (moveAgain)))) (move Add (to (sites Empty) if:(= (id P2) (mover))) (then (if (< (count MovesThisTurn) 3) (moveAgain)))))) (end { (if (and ((= (id P1) (mover)) (is Line 4 Orthogonal))) (result Mover Win)) (if (and ((= (id P2) (mover)) (is Line 7 Orthogonal))) (result Mover Win))})))
###
| (game "Unfair" (players 2) (equipment { (board (square 13) use:Vertex) (piece "Ball" Each)}) (rules (play (or (move Add (to (sites Empty) if:(= (id P1) (mover))) (then (if (= 0 (count MovesThisTurn)) (moveAgain)))) (move Add (to (sites Empty) if:(= (id P2) (mover))) (then (if (< (count MovesThisTurn) 3) (moveAgain)))))) (end { (if (and ((= (id P1) (mover)) (is Line 4 Orthogonal))) (result Mover Win)) (if (and ((= (id P2) (mover)) (is Line 7 Orthogonal))) (result Mover Win))}))) END |
Construct a Ludii game based on the following description
Players take turns moving a piece of their colour as follows:
1. A piece on a vertex can move either:
1a. To an adjacent empty vertex. The edge it travels over may be empty or occupied (if occupied by an enemy piece, that piece is captured and removed).
1b. To an empty cell that vertex is part of.
2. A piece on an edge can move either:
2a. To a connected empty edge. The vertex it travels over may be empty or occupied (if occupied by an enemy piece, that piece is captured and removed).
2b. To an empty cell that edge is part of.
3. A piece in a cell can move either:
3a. To a neighbouring empty cell which may be connected by an edge or a vertex. The connecting edge or vertex that the piece travels over may be empty or occupied (if occupied by an enemy piece, that piece is captured and removed).
3b. To step over one of its empty edges into an adjacent cell containing an enemy piece (which is captured), then step out over a different empty edge to another empty cell.
3c. To an empty vertex or edge belonging to that cell.
Aim: A player wins if their opponent is reduced to a single piece. An empty edge has no piece on its midpoint. An empty cell has no piece on its centroid.
Three Player Version:
In the three player version, any player reduced to a single piece is removed from the game (along with their piece). Last remaining player wins. The game is played with 2 players.
###
| (define "RemoveLastPiece" (and { ("RemovePlayerLastPiece" P1) ("RemovePlayerLastPiece" P2) ("RemovePlayerLastPiece" P3)})) (define "RemovePlayerLastPiece" (if (= 1 ("CountPiecesAllSiteTypes" #1)) (and { ("RemoveSiteTypeOccupiedPiece" #1 Vertex) ("RemoveSiteTypeOccupiedPiece" #1 Cell) ("RemoveSiteTypeOccupiedPiece" #1 Edge)}))) (define "CountPiecesAllSiteTypes" (+ { (count Pieces Vertex #1) (count Pieces Edge #1) (count Pieces Cell #1)})) (define "RemoveSiteTypeOccupiedPiece" (forEach Site (sites Occupied by:#1 container:"Board" on:#2) (remove #2 (site)))) (define "MoveCellToVertex" (move (from Cell) (to Vertex (intersection (sites Empty Vertex) (sites Incident Vertex of:Cell at:(from)))))) (define "MoveCellToEdge" (move (from Cell) (to Edge (intersection (sites Empty Edge) (sites Incident Edge of:Cell at:(from)))))) (define "MoveCellToEmptyCellOverVertex" (move (from Cell) (to Cell (forEach (sites Empty Cell) if:(= 1 (count Sites in:(intersection (sites Incident Vertex of:Cell at:(from)) (sites Incident Vertex of:Cell at:(site))))))) (then (forEach Site (intersection (sites Incident Vertex of:Cell at:(last From)) (sites Incident Vertex of:Cell at:(last To))) (if (is Enemy (who Vertex at:(site))) (remove Vertex (site))))))) (define "MoveCellToEnemyCellOverEmptyEdge" (move (from Cell) (to Cell (sites Incident Cell of:Cell at:(from)) if:(and (is Enemy (who Cell at:(to))) (= 1 (count Sites in:(intersection { (sites Empty Edge) (sites Incident Edge of:Cell at:(from)) (sites Incident Edge of:Cell at:(to))})))) (apply (remove Cell (to)))) (then (moveAgain)))) (define "MoveCellToEmptyCellOverEdge" (move (from Cell) (to Cell (intersection (sites Empty Cell) (sites Incident Cell of:Cell at:(from)))) (then (forEach Site (intersection (sites Incident Edge of:Cell at:(last From)) (sites Incident Edge of:Cell at:(last To))) (if (is Enemy (who Edge at:(site))) (remove Edge (site))))))) (define "MoveEdgetoCell" (move (from Edge) (to Cell (intersection (sites Empty Cell) (sites Incident Cell of:Edge at:(from)))))) (define "MoveEdgetoEdge" (move Step (from Edge) (to if:(is Empty Edge (to))) (then (forEach Site (intersection (sites Incident Vertex of:Edge at:(last From)) (sites Incident Vertex of:Edge at:(last To))) (if (is Enemy (who Vertex at:(site))) (remove Vertex (site))))))) (define "MoveLastCellToEmptyCellOverEmptyEdge" (move (from Cell (last To)) (to Cell (intersection (sites Empty Cell) (sites Incident Cell of:Cell at:(from))) if:(and (= 1 (count Sites in:(intersection { (sites Empty Edge) (sites Incident Edge of:Cell at:(from)) (sites Incident Edge of:Cell at:(to))}))) (!= (last From) (to)))))) (define "MoveVertexToCell" (move (from Vertex) (to Cell (intersection (sites Empty Cell) (sites Incident Cell of:Vertex at:(from)))))) (define "MoveVertexToVertex" (move Step (from Vertex) (to if:(is Empty Vertex (to))) (then (forEach Site (intersection (sites Incident Edge of:Vertex at:(last From)) (sites Incident Edge of:Vertex at:(last To))) (if (is Enemy (who Edge at:(site))) (remove Edge (site))))))) (game "Triple Tangle" (players 2) (equipment { (board (tiling T3464 1) use:Vertex) (piece "Disc" Each)}) (rules (start { (place "Disc1" (sites {4 5 0 1})) (place "Disc1" Cell 1) (place "Disc1" Edge (sites {0 3 4 9})) (place "Disc2" (sites {16 17 12 13})) (place "Disc2" Cell 11) (place "Disc2" Edge (sites {25 29 26 20}))}) (play (if ("SameTurn") ("MoveLastCellToEmptyCellOverEmptyEdge") (or { (forEach Piece on:Vertex (or ("MoveVertexToVertex") ("MoveVertexToCell"))) (forEach Piece on:Edge (or ("MoveEdgetoEdge") ("MoveEdgetoCell"))) (forEach Piece on:Cell (or { ("MoveCellToEmptyCellOverEdge") ("MoveCellToEnemyCellOverEmptyEdge") ("MoveCellToEmptyCellOverVertex") ("MoveCellToEdge") ("MoveCellToVertex")}))}))) (end (if (>= 1 ("CountPiecesAllSiteTypes" Next)) (result Mover Win))))) END |
Construct a global Ludii definition which fulfills the following requirements.
Defines a hop move in the specified directions (by default Adjacent) over an enemy counter to an empty site. The enemy counter is removed.
###
| (define "HopOnlyCounters" (move Hop #1 #2 (between if:("IsPieceAt" "Counter" Next (between)) (apply (remove (between)))) (to if:(is Empty (to))) #3)) END |
Construct a Ludii game based on the following description
Players take turns placing their pieces on a space on the board, with the goal of connecting all three sides of the triangle with their pieces. Corners count as belonging to both sides they touch.
###
| (game "Y (Hex)" (players 2) (equipment { (board (tri Hexagon 7) use:Vertex) (piece "Marker" Each) (regions "SSW" {(sites Side S) (sites Side SW)}) (regions "NNW" {(sites Side NW) (sites Side N)}) (regions "NESE" {(sites Side NE) (sites Side SE)})}) (rules (play (move Add (to (sites Empty)))) (end (if (is Connected { (sites "SSW") (sites "NNW") (sites "NESE")}) (result Mover Win))))) END |
Construct a Ludii game based on the following description
4x20-25 board. Player on two teams of two players. Each team has a number of pieces which are equal to the number of holes in one of the rows. Pieces baring in the outer rows of the board. Eight sticks used as dice, painted red on one side. The throws are as follows: All sides of one color = 8; seven of one color = 1; six of one color = 6; five of one color = 5; four of one color= 4. Throws of 4 and 1 allow the player another throw. Pieces are moved after the throws are made. Each throw must be used to move a piece; the value of a throw cannot be subdivided between pieces. Pieces move from left to right in the team's home row, the right to left in the second row, left to right in the third row, and then right to left in the opposing team's home row. Pieces may not move past other pieces belonging to the team, but may move past the opponent's pieces. Then a piece lands in a spot occupied by a piece belonging to the opposing team, the opposing team's piece is captured. Once a player places their pieces in the opponent's home row, they cannot be taken. The team continue until all of the pieces are in the opponents' home rows, and the team with the most remaining pieces wins. Each row has 20 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 20) { (track "Track1" "0,E,N1,W,N1,E,N1,W" P1 directed:True) (track "Track2" "79,W,S1,E,S1,W,S1,E" P2 directed:True) (track "Track3" "0,E,N1,W,N1,E,N1,W" P3 directed:True) (track "Track4" "79,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
5x5 board. Players begin by placing their pieces in prescribed spaces, and then alternating two-by-two in places as they see fit, except for the central space. Once all the spaces except the central one are filled, the first player moves a piece one space orthogonally to the empty space. Pieces are captured by surrounding them on either side by a player's own pieces. The player to capture all of the opponent's pieces wins. The game is played on a 5x5 board.
###
| (game "Seega" (players 2) (equipment { (board (square 5)) (hand Each) (piece "Marker" Each ("StepToEmpty" Orthogonal (then ("CustodialCapture" Orthogonal (max 1)))))}) (rules (start (place "Marker" "Hand" count:12)) phases:{ (phase "Placement" (play (move (from (handSite Mover)) (to (difference (sites Empty) (centrePoint))) (then (if ("NewTurn") (moveAgain))))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) ("PhaseMovePiece" "Movement")} (end ("CaptureAll" Next)))) END |
Construct a Ludii game based on the following description
Portes, Plakoto, and Fevga are played in succession. One point is awarded to the winner of each game, two points if the opponent hasn't moved pieces out of their starting quadrant. It is typically played to five or seven points.
###
| (games { (subgame "Portes" next:1 result:(score Mover)) (subgame "Plakoto" next:2 result:(score Mover)) (subgame "Fevga" next:0 result:(score Mover))}) 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.
(define "EatTopLeftCorner" (is In (last To) (intersection (sites Top) (sites Left)))) (define "EatChocolate" (move Remove (sites Occupied by:Shared) (then ("EatBottomRight")))) (define "EatBottomRight" (forEach Site (sites Occupied by:Shared) (if (and (>= (row of:(last To)) (row of:(site))) (<= (column of:(last To)) (column of:(site)))) (remove (site))))) (game "Chomp" (players 2) (equipment { (board (rectangle 1 2)) (piece "Chocolate" Shared)}) (rules (start (place "Chocolate" (sites Board))) (play ("EatChocolate")) (end (if ("EatTopLeftCorner") (result Mover Loss)))))
###
| (define "EatTopLeftCorner" (is In (last To) (intersection (sites Top) (sites Left)))) (define "EatChocolate" (move Remove (sites Occupied by:Shared) (then ("EatBottomRight")))) (define "EatBottomRight" (forEach Site (sites Occupied by:Shared) (if (and (>= (row of:(last To)) (row of:(site))) (<= (column of:(last To)) (column of:(site)))) (remove (site))))) (game "Chomp" (players 2) (equipment { (board (rectangle 2 3)) (piece "Chocolate" Shared)}) (rules (start (place "Chocolate" (sites Board))) (play ("EatChocolate")) (end (if ("EatTopLeftCorner") (result Mover Loss))))) END |
Construct a Ludii game based on the following description
4x5 board. Five counters per hole. Players can sow from any hole. Sowing occurs orthogonally in any direction, and a player can change direction orthogonally at any point in the move, but can never double back. When the last counter falls into a hole, sowing continues if there are counters in the following holes; these are picked up and sowing continues from there. The hole from which the sowing continues will always be the next one in the opposite direction from the penultimate hole in which a counter was dropped. Therefore, if the sowing ends when a sowing hits an edge or corner, sowing does not continue. When the hole after the end of a sowing is empty, the counters in the next hole following it are captured, but captures cannot be made when the final counter falls into a hole from which a new direction must be chosen. Captures cannot be made from the central two holes of the board. The player who captures the most counters wins.
###
| (define "SowAgainMove" (move Select (from (last To)) (to (difference (sites Around (last To)) ("SitesSowed"))) (then (and (add (piece (id "Seed" Shared)) (to (last To))) (if (< 1 (var "NumToSow")) (and { (set Var "NumToSow" (- (var "NumToSow") 1)) (moveAgain) (remember Value "SowedSites" (last From))}) (and { (forget Value "SowedSites" All) (set Var "NumToSow" 0) (if ("NextSiteExist" 1) (if (is Occupied ("NextSite" 1)) (moveAgain) (if ("NextSiteExist" 2) (if (is Occupied ("NextSite" 2)) (and (fromTo (from ("NextSite" 2)) (to (handSite Mover)) count:(count at:("NextSite" 2))) (if (and ("NextSiteExist" 3) ("NextSiteExist" 4)) (if (and (is Occupied ("NextSite" 4)) (is Empty ("NextSite" 3))) (fromTo (from ("NextSite" 4)) (to (handSite Mover)) count:(count at:("NextSite" 4))))))))))})))))) (define "NextSite" (ahead (last To) steps:#1 ("LastDirection" Vertex))) (define "NextSiteExist" (!= (last To) ("NextSite" #1))) (define "SitesSowed" (sites (values Remembered "SowedSites"))) (define "PiecesOwnedBy" (count Cell at:(handSite #1))) (define "Columns" 5) (game "Dongjintian (Four Players)" (players 4) (equipment { (mancalaBoard 4 "Columns" store:None) (piece "Seed" Shared) (hand Each) (regions "ProtectingHoles" (sites {7 12}))}) (rules (start (set Count 5 to:(sites Board))) (play (if (and ("SameTurn") (!= 0 (var "NumToSow"))) (if (can Move ("SowAgainMove")) ("SowAgainMove") (do (and { (add (piece (id "Seed" Shared)) (to (last To)) count:(var "NumToSow")) (forget Value "SowedSites" All) (set Var "NumToSow" 0)}) next:(move Pass))) (if ("SameTurn") (move (from ("NextSite" 1)) (to (sites Around (from))) (then (and { (if (is Occupied (last From)) (and { (moveAgain) (set Var "NumToSow" (count at:(last From))) (remember Value "SowedSites" (last From))}) (if ("NextSiteExist" 1) (if (is Occupied ("NextSite" 1)) (moveAgain) (if ("NextSiteExist" 2) (if (is Occupied ("NextSite" 2)) (and (fromTo (from ("NextSite" 2)) (to (handSite Mover)) count:(count at:("NextSite" 2))) (if (and ("NextSiteExist" 3) ("NextSiteExist" 4)) (if (and (is Occupied ("NextSite" 4)) (is Empty ("NextSite" 3))) (fromTo (from ("NextSite" 4)) (to (handSite Mover)) count:(count at:("NextSite" 4))))))))))) (remove (last From) count:(count at:(last From)))}))) (move (from (sites Board) if:(is Occupied (from))) (to (sites Around (from))) (then (and { (if (is Occupied (last From)) (and { (moveAgain) (set Var "NumToSow" (count at:(last From))) (remember Value "SowedSites" (last From))}) (if ("NextSiteExist" 1) (if (is Occupied ("NextSite" 1)) (moveAgain) (if ("NextSiteExist" 2) (if (is Occupied ("NextSite" 2)) (and (fromTo (from ("NextSite" 2)) (to (handSite Mover)) count:(count at:("NextSite" 2))) (if (and ("NextSiteExist" 3) ("NextSiteExist" 4)) (if (and (is Occupied ("NextSite" 4)) (is Empty ("NextSite" 3))) (fromTo (from ("NextSite" 4)) (to (handSite Mover)) count:(count at:("NextSite" 4))))))))))) (remove (last From) count:(count at:(last From)))})))))) (end (if (<= (count Pieces All in:(sites Board)) 1) (byScore { (score P1 ("PiecesOwnedBy" P1)) (score P2 ("PiecesOwnedBy" P2)) (score P3 ("PiecesOwnedBy" P3)) (score P4 ("PiecesOwnedBy" P4))}))))) END |
Construct a Ludii game based on the following description
Played on cross-shaped board, made of five squares, each divided into four squares and with the diagonals of the larger squares drawn. One player plays with one larger piece, the Oke-mow, placed on the central point, and the other player with thirteen pieces situated on every point of one arm of the cross and along the line immediately perpendicular to that arm. Pieces move along the lines to an adjacent empty spot. The Oke-mow may jump over an adjacent piece to capture it. Multiple captures are allowed. The Oke-mow wins if it can capture all the opponent's pieces, the other player wins by blocking the Oke-mow from moving.
###
| (game "Musinaykahwhanmetowaywin" (players 2) (equipment { ("CrossBoard" 3 7 use:Vertex diagonals:Alternating) (piece "Marker" P1 (or ("HopSequenceCapture") ("StepToEmpty"))) (piece "Disc" P2 ("StepToEmpty"))}) (rules (start { (place "Disc2" (union (expand (sites Bottom)) (sites Row 2))) (place "Marker1" (centrePoint))}) (play (if "SameTurn" (or ("HopSequenceCaptureAgain") (move Pass)) (forEach Piece))) (end ("NoMovesP1NoPiecesP2")))) END |
Construct a Ludii game based on the following description
3x3 intersecting lines, with diagonals. Three pieces per player. Players alternate turns placing pieces on the board. Once all of the pieces have been placed, the players alternate turns moving a piece to an empty adjacent spot on the board. The first player to place their pieces in a row along one of the lines wins.
###
| (game "Engijn Zirge" (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 ("HandEmpty" P2) "Movement")) ("PhaseMovePiece" "Movement")} (end ("Line3Win")))) END |
Describe the mechanics of the following Ludii game
(define "RemmemberOwnedHoles" (if (is Mover P1) (remember Value "OwnedP1" #1) (remember Value "OwnedP2" #1))) (define "LeftMostEmpty" (trackSite FirstSite from:(mapEntry "LeftMost" Mover) if:(is Empty (to)))) (define "NoPiecesInP1Side" (all Sites (sites P1) if:(= 0 (count at:(site))))) (define "NoOwnedHoles" (if (= #1 P1) (= 0 (size Array (values Remembered "OwnedP1"))) (= 0 (size Array (values Remembered "OwnedP2"))))) (define "ForgetValue" (if (is Mover P1) (forget Value "OwnedP1" #1) (forget Value "OwnedP2" #1))) (define "OneRowIsEmpty" (or (all Sites (sites P1) if:(= 0 (count at:(site)))) (all Sites (sites P2) if:(= 0 (count at:(site)))))) (define "OwnedHoles" (if (is Mover P1) (sites (values Remembered "OwnedP1")) (sites (values Remembered "OwnedP2")))) (define "PlayFromNextHole" (sites {("NextHoleFrom" (last To afterConsequence:True) 1)})) (define "NextHoleFrom" ("NextSiteOnTrack" #2 from:#1)) (game "Gabata (Adegrat)" (players 2) (equipment { (mancalaBoard 2 6 store:None (track "Track" "0,E,N,W" loop:True)) (piece "Seed" Shared) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (hand Each) (map "LeftMost" {(pair P1 0) (pair P2 11)})}) (rules (start { (set Count 3 to:(sites Track)) (set RememberValue "OwnedP1" (sites Bottom)) (set RememberValue "OwnedP2" (sites Top))}) phases:{ (phase "Sowing" (play (or { (move Select (from (if ("SameTurn") "PlayFromNextHole" ("OwnedHoles")) if:(> (count at:(from)) 0)) (then (sow apply:(if (> (count at:(to)) 1) (if (>= (count at:("NextHoleFrom" (to) 1)) 1) (moveAgain)) (if (>= (count at:("NextHoleFrom" (to) 1)) 1) (fromTo (from ("NextHoleFrom" (to) 1)) (to (handSite Mover)) count:(count at:("NextHoleFrom" (to) 1))))))))} (then (if ("OneRowIsEmpty") (and { (if ("NoPiecesInP1Side") (forEach Site (sites Board) (if (< 0 (count at:(site))) (fromTo (from (site)) (to (handSite P2)) count:(count at:(site))))) (forEach Site (sites Board) (if (< 0 (count at:(site))) (fromTo (from (site)) (to (handSite P1)) count:(count at:(site)))))) (forget Value "OwnedP1" All) (forget Value "OwnedP2" All)}))))) (end (if ("NoPieceOnBoard") { (if (> 3 (count Cell at:(handSite P1))) (result P2 Win)) (if (> 3 (count Cell at:(handSite P2))) (result P1 Win))})) (nextPhase ("NoPieceOnBoard") "BetweenRounds")) (phase "BetweenRounds" (play (if (<= 3 (count Cell at:(handSite Mover))) (move (from (handSite Mover)) (to ("LeftMostEmpty")) count:3 (then ("RemmemberOwnedHoles" (last To)))))) (nextPhase (all Passed) "Sowing"))}))
###
| 2x6 board. Three counters in each hole. Sowing occurs in an anti-clockwise direction. When the final counter falls into an occupied hole, the player picks up the counters in the next hole and continues sowing from it. If that next hole is empty, the turn ends. If the final counter falls into an empty hole, the contents of the following hole are captured. Play continues until one player can no longer play because there are no counters left on their side. The opponent then takes the remainder of the counters on the board. For the next round, each player counts out the counters they captured, placing three each of the holes in their row. For every three in excess of the amount required to fill all of the holes in a row, the player claims one hole from the opponent's row. Play continues in this fashion until one player captures all of the holes on the board. END |
Construct a Ludii game based on the following description
5x5 intersecting lines, forming a grid Diagonals in each quadrant. A triangular appendage, the apex being the midpoint of one of the sides of the grid. A line from the apex to the midpoint of the base, and a line bisecting this line and intersecting with the midpoints of the two sides of the triangle. There are fourteen \ The objective of the player 1 is to capture all the dogs.
###
| (game "Adugo" (players 2) (equipment { ("AlquerqueBoardWithBottomTriangle") (piece "Jaguar" P1 (or "HopCapture" "StepToEmpty")) (piece "Dog" P2 "StepToEmpty")}) (rules (start { (place "Dog2" (difference (expand (sites Top) steps:2) (sites {"C5"}))) (place "Jaguar1" coord:"C5")}) (play (forEach Piece)) (end ("NoMovesLossAndLessNumPiecesPlayerLoss" P2 0)))) END |
Construct a Ludii game based on the following description
2x6 board with two stores. Four counters in each hole. Sowing occurs in a clockwise direction. When the final counter of a sowing lands in an occupied hole, these are picked up and sowing continues. When the final counter lands in an empty hole in the player's own row, the contents of the hole opposite it in the opponent's row are captured. If the final counter lands in an empty hole in the opponent's row, the opponent captures the counters in the hole opposite it in the player's row. The player who captures the most counters wins.
###
| (define "PiecesOwnedBy" (+ (count at:(mapEntry #1)) (count in:(sites #1)))) (define "Columns" 6) (game "Yovodi" (players 2) (equipment { (mancalaBoard 2 "Columns" (track "Track" "6,W,N,E" 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 (move Select (from (if ("SameTurn") ("LastHoleSowed") (sites Mover)) if:(< 0 (count at:(from)))) (then (sow apply:(if (> (count at:(to)) 1) (moveAgain) (if (is In (to) (sites Mover)) (fromTo (from ("OppositePitTwoRows" (to))) (to (mapEntry (mover))) count:(count at:("OppositePitTwoRows" (to)))) (fromTo (from ("OppositePitTwoRows" (to))) (to (mapEntry (next))) count:(count at:("OppositePitTwoRows" (to)))))))))) (end ("MancalaByScoreWhen" (no Moves Mover))))) END |
Modify the Ludii game according to the following option changes:
Open anywhere. -> White's second move must be 3 points away from the centre.
(define "Custodial" (custodial (from (last To)) All (between if:(is Next (who at:(between))) (apply (remove (between)))) (to if:(and (= 3 (count Steps Vertex All (last To) (to))) (is Mover (who at:(to))))) (then (addScore Mover 1)))) (game "Pente" (players 2) (equipment { (board (square 19) use:Vertex) (piece "Ball" Each)}) (rules (start (set Score Each 0)) (play (move Add (to (sites Empty)))) (end { (if (is Line 5 All) (result Mover Win)) (if (> (score Mover) 9) (result Mover Win))})))
###
| (define "Custodial" (custodial (from (last To)) All (between if:(is Next (who at:(between))) (apply (remove (between)))) (to if:(and (= 3 (count Steps Vertex All (last To) (to))) (is Mover (who at:(to))))) (then (addScore Mover 1)))) (game "Pente" (players 2) (equipment { (board (square 19) use:Vertex) (piece "Ball" Each)}) (rules (start (set Score Each 0)) phases:{ (phase "First Move" (play (move Add (to (sites "J10")))) (nextPhase "Second Move")) (phase "Second Move" (play (move Add (to (sites Empty)))) (nextPhase "Third Move")) (phase "Third Move" (play (move Add (to (intersection (sites Empty) (sites Distance All from:(coord "J10") (range 3 15)))))) (nextPhase "General")) (phase "General" (play (move Add (to (sites Empty)))))} (end { (if (is Line 5 All) (result Mover Win)) (if (> (score Mover) 9) (result Mover Win))}))) END |
Construct a Ludii game based on the following description
The board graph is initially coloured with a neutral colour. Players take turns removing colour from a coloured edge. The game is won by the player who removes the last cycle from the coloured graph. The game is played on the Graph1.
###
| (game "Nedilmarth" (players 2) (equipment { (board (merge (scale 0.707 (concentric {1 8})) (shift -.5 -.5 (square 2))) use:Edge) (piece "Marker" Neutral)}) (rules (start { (set Neutral Edge (sites Board Edge))}) (play (move Remove (sites Occupied by:Neutral on:Edge))) (end (if (is Tree Neutral) (result Mover Win))))) END |
Construct a Ludii game based on the following description
Counters are placed in piles: two rows of four piles. Six counters in each pile. A player sows from any of the piles in the player's row in an anti-clockwise direction. Any pile which contains 2, 4, or 6 counters is captured. The player with the most counters captured wins.
###
| (define "PiecesOwnedBy" (count Cell at:(handSite #1))) (game "Wore" (players 2) (equipment { (mancalaBoard 2 4 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 6 to:(sites Track))) (play (move Select (from (sites Mover) if:(< 0 (count at:(from)))) (then (sow if:(or { (= (count at:(to)) 2) (= (count at:(to)) 4) (= (count at:(to)) 6)}) apply:(fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))))))) (end ("MancalaByScoreWhen" (no Moves Mover))))) END |
Construct a Ludii game based on the following description
Glinski Chess is played on a hexagonal board with each side having length 6, and each space oriented horizontally. The board has 91 spaces.
Piece Movement:
* Kings can move one space in any of the 12 directions from the current space. There is no castling.
* Rooks can slide in any of the six 'adjacent' directions from their current space---North, South, or 60 degrees off either of those.
* Bishops can slide in the six 'diagonal' directions: West, East, or 30 degrees off due North or 30 degrees off due South. Note that, given the 3-colour colouring of the board, each of the three Bishops remains on the same colour that it started the game on.
* Queens can make any move that would be available to a Rook or a Bishop on the current space.
* Knights can leap to any space that is two spaces away in an adjacent direction (North, South, or 60 degrees off either of those), plus one more space 60 degrees off of that direction. Note that a Knight always moves to a space of a different colour than the space it moved from.
* Pawns can advance one space forward without capturing. They capture by moving to one of the two adjacent spaces 60 degrees left or right of forward. A Pawn on a Pawn start space can advance two spaces forward without capturing, even if it has previously moved (by capturing) to a different Pawn start space than it started the game on. A Pawn can capture an opponent Pawn 'en passant' if the opponent Pawn just advanced two spaces on its previous turn, and the capture direction of the current player's Pawn lands it on the space that the opponent Pawn just skipped over. On reaching the farthest rank in a given file, Pawns are promoted to a Queen, Rook, Bishop, or Knight, as the player chooses.
The game ends on a checkmate or stalemate. By convention, the player that causes the stalemate is awarded 3/4 of a point, while the other player is awarded 1/4 of a point.
Variations: Shift the innermost 3 or 5 Pawns toward the edge of the board by one space, as proposed in A Player's Guide to Table Games, by John Jackson, Stackpole Books, 1975. Pawns in the starting position chosen by Władysław Gliński in 1936
###
| (define "PromoteTo" (move Promote (last To) #1 Mover)) (define "IsEnPassantCapture" (and (is Pending) (= (to) (value Pending)))) (define "EnPassant_Ortho" ("EnPassant_Base" ("Directions" {WNW ENE} {WSW ESE}))) (define "EnPassant_Base" (move Step #1 (to if:"IsEnPassantCapture") (then (remove (var))))) (define "PawnStep_To" ("StepToEnemy" #1)) (define "PawnStep_Double" ("PawnHop" Forward Backward)) (define "PawnCapture_Ortho" ("PawnStep_To" ("Directions" {WNW ENE} {WSW ESE}))) (define "PawnHop" (move Hop #1 (between if:(is In (between) (sites Empty))) (to if:"IsToEmpty") (then (and { (set Pending (ahead (last To) #2)) (set Var (last To))})))) (define "IsFromInStartCell" (is In (from) (sites Start (piece (what at:(from)))))) (define "KingCaptureStep" (move Step #1 (to if:"IsToEmptyOrEnemy" "CaptureToPieceAndResetCounter") #2)) (define "SlideCaptureMove" (move Slide #1 (to if:("IsEnemyAt" (to)) "CaptureToPieceAndResetCounter") #2)) (define "P12" (if (is Mover P1) #1 #2)) (define "IsToEmptyOrEnemy" (or "IsToEmpty" ("IsEnemyAt" (to)))) (define "IsToEmpty" (is In (to) (sites Empty))) (define "Directions" ("P12" (directions #1) (directions #2))) (define "CaptureToPieceAndResetCounter" (apply (if ("IsEnemyAt" (to)) (remove (to) (then (set Counter)))))) (game "Glinski Chess" ("TwoPlayersNorthSouth") (equipment { (board (rotate 90 (hex 6))) (piece "King" Each ("KingCaptureStep" All ~)) (piece "Queen" Each ("SlideCaptureMove" All ~)) (piece "Rook" Each ("SlideCaptureMove" Orthogonal ~)) (piece "Bishop" Each ("SlideCaptureMove" Diagonal ~)) (piece "Knight" Each (move Leap "KnightWalk" (to if:"IsToEmptyOrEnemy" "CaptureToPieceAndResetCounter"))) (piece "Pawn" Each (or { "StepForwardToEmpty" (if "IsFromInStartCell" "PawnStep_Double") "PawnCapture_Ortho" "EnPassant_Ortho"} (then (and (if (is In (last To) (sites Mover "PromotionZone")) (moveAgain)) (set Counter))))) (regions "PromotionZone" P1 (union (sites Side NW) (sites Side NE))) (regions "PromotionZone" P2 (union (sites Side SW) (sites Side SE))) (regions "Region-Dark" (sites Phase 0)) (regions "Region-Light" (sites Phase 2)) (regions "Region-Medium" (sites Phase 1))}) (rules (start { (place "King1" coord:"B1") (place "Queen1" coord:"A2") (place "Rook1" {"A4" "D1"}) (place "Bishop1" {"A1" "B2" "C3"}) (place "Knight1" {"A3" "C1"}) (place "King2" coord:"K10") (place "Queen2" coord:"J11") (place "Rook2" {"H11" "K8"}) (place "Bishop2" {"K11" "J10" "I9"}) (place "Knight2" {"I11" "K9"}) (place "Pawn1" {"A5" "B5" "C5" "D5" "E5" "E4" "E3" "E2" "E1"}) (place "Pawn2" {"G11" "G10" "G9" "G8" "G7" "H7" "I7" "J7" "K7"})}) phases:{ (phase "Movement" (play (if ("SameTurn") ("PromoteTo" (piece {"Queen" "Rook" "Bishop" "Knight"})) (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
8x8 checkered board. Pieces move according to specialized moves, as follows: Piyatha (x8): can move one space forward, and one space forward diagonally to capture. When they reach the final rank, they may be promoted to the piece belonging to that rank, as long as it has already been captured by the opponent; Rukh (castle), (x2): can move any number of spaces orthogonally; Fil (elephant), (x2): can move any number of spaces diagonally; Ghoda (horse), (2): moves in any direction, one space orthogonally with one space forward diagonally; Farthir (x1): can move any number of spaces orthogonally or diagonally; Shah (x1): can move one space orthogonally or diagonally, and can also move like the horse if it has not yet been checked. The pieces are arranged as in Chess. Players capture pieces by moving onto a space occupied by an opponent's piece. When a player can capture the opponent's Shah on the next turn, the Shah is in Check, the opponent's next move must free the Shah from Check. If the opponent cannot, it is Checkmate and the player wins. Stalemate is allowed.
###
| (define "PromotedPiece" (if (and (is In (last To) (sites Corners)) (< (count Sites in:(sites Occupied by:Mover component:"Castle")) 2)) (promote (last To) (piece (id "Castle" Mover))) (if (and (or (= (column of:(last To)) 1) (= (column of:(last To)) 6)) (< (count Sites in:(sites Occupied by:Mover component:"Horse")) 2)) (promote (last To) (piece (id "Horse" Mover))) (if (and (or (= (column of:(last To)) 2) (= (column of:(last To)) 5)) (< (count Sites in:(sites Occupied by:Mover component:"Elephant")) 2)) (promote (last To) (piece (id "Elephant" Mover))) (if (and (= (column of:(last To)) 3) (< (count Sites in:(sites Occupied by:Mover component:"Queen")) 1)) (promote (last To) (piece (id "Queen" Mover)))))))) (define "KingNotCheckedAndToEmpty" (and (is Empty (to)) (not ("IsInCheck" "King_noCross" Mover at:(to))))) (game "Shatren" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) ("ChessPawn" "Pawn" ~ (then (if (is In (last To) (sites Mover "Promotion")) ("PromotedPiece")))) ("ChessRook" "Castle") (piece "King_noCross" Each (or ("StepToNotFriend") (if (not ("IsInCheck" "King_noCross" Mover)) ("LeapCapture" "KnightWalk")))) ("ChessBishop" "Elephant") ("ChessKnight" "Horse") ("ChessQueen" "Queen") (regions "Promotion" P1 (sites Top)) (regions "Promotion" P2 (sites Bottom))}) (rules (start { (place "Pawn1" (sites Row 1)) (place "Pawn2" (sites Row 6)) (place "Castle1" {"A1" "H1"} state:1) (place "Horse1" {"B1" "G1"}) (place "Elephant1" {"C1" "F1"}) (place "Queen1" coord:"D1") (place "King_noCross1" coord:"E1" state:1) (place "Castle2" {"A8" "H8"} state:1) (place "Horse2" {"B8" "G8"}) (place "Elephant2" {"C8" "F8"}) (place "Queen2" coord:"D8") (place "King_noCross2" coord:"E8" state:1)}) (play (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King_noCross" Mover)))) (end ("Checkmate" "King_noCross")))) END |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.