prompt
stringlengths 71
4.65k
| completion
stringlengths 34
5.1k
|
---|---|
Modify the Ludii game according to the following option changes:
The game is played on a 2x2 board -> The game is played on a 3x3 board
(game "Three-Player Hex" (players 3) (equipment { (board (hex 2)) (piece "Marker" Each) (regions P1 {(sites Side N) (sites Side S)}) (regions P2 {(sites Side NW) (sites Side SE)}) (regions P3 {(sites Side SW) (sites Side NE)})}) (rules (play (move Add (to (sites Empty)))) (end { (forEach NonMover if:(is Blocked Player) (result Player Loss)) (if (is Connected Mover) (result Mover Win))})))
###
| (game "Three-Player Hex" (players 3) (equipment { (board (hex 3)) (piece "Marker" Each) (regions P1 {(sites Side N) (sites Side S)}) (regions P2 {(sites Side NW) (sites Side SE)}) (regions P3 {(sites Side SW) (sites Side NE)})}) (rules (play (move Add (to (sites Empty)))) (end { (forEach NonMover if:(is Blocked Player) (result Player Loss)) (if (is Connected Mover) (result Mover Win))}))) END |
Construct a Ludii game based on the following description
Three intersecting lines, with diagonals drawn in the square. Two players. Three pieces per player, one playing as red and the other as white. The red player plays first and places their piece in the central spot. Players alternate turns placing one of their pieces on an empty space on the board. When all of the pieces are placed, players alternate turns moving one of their pieces to an empty adjacent spot on the board along the lines. The first player to place three of their pieces in a row wins.
###
| (game "Katsela" (players 2) (equipment { ("AlquerqueBoard" 3 3) (hand Each) (piece "Marker" Each ("StepToEmpty"))}) (rules (start (place "Marker" "Hand" count:3)) phases:{ (phase "Opening" (play (move (from (handSite Mover)) (to (centrePoint)))) (nextPhase "Placing")) (phase "Placing" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover ("HandEmpty" Mover) "Moving")) (phase "Moving" (play (forEach Piece)))} (end ("Line3Win")))) END |
Describe the mechanics of the following Ludii game
(game "Fanorona Telo" (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"))))
###
| 3x3 intersecting lines with diagonals. Play occurs on the intersections of the lines. Each player has three pieces. Play begins with each player placing pieces on empty points. If they make three in a row along the lines, they win. Once all pieces are placed, players take turns moving pieces one spot to an adjacent point along the lines trying to make three in a row.
END |
Modify the Ludii game according to the following option changes:
A size 5 board is currently selected -> A size 6 board is currently selected
(define "PlaceNonRed" (do (move Add (to (sites Empty))) ifAfterwards:(not (or ("SomeSite" (sites Around (last To) Enemy Orthogonal) (= 0 (count Liberties at:(site) Orthogonal if:(is Next (who at:(to)))))) ("SomeSite" (sites Around (last To) Own Orthogonal includeSelf:True) (= 0 (count Liberties at:(site) Orthogonal if:(is Mover (who at:(to)))))))))) (define "PlaceRed" (do (move Add (piece "Disc0") (to (sites Empty))) ifAfterwards:(or ("SomeSite" (sites Around (last To) Enemy Orthogonal) (= 0 (count Liberties at:(site) Orthogonal if:(is Next (who at:(to)))))) ("SomeSite" (sites Around (last To) Own Orthogonal) (= 0 (count Liberties at:(site) Orthogonal if:(is Mover (who at:(to))))))) (then (and (forEach Site (sites Around (last To) Enemy Orthogonal) (if (= 0 (count Liberties at:(site) Orthogonal if:(is Next (who at:(to))))) (remove (sites Group at:(site) Orthogonal if:(is Next (who at:(to))))))) (forEach Site (sites Around (last To) Own Orthogonal) (if (= 0 (count Liberties at:(site) Orthogonal if:(is Mover (who at:(to))))) (remove (sites Group at:(site) Orthogonal if:(is Mover (who at:(to))))))))))) (define "SomeSite" (not (all Sites #1 if:(not #2)))) (game "Redstone" (players 2) (equipment { (board (square 5) use:Vertex) (piece "Disc" Each) (piece "Disc" Neutral)}) (rules (meta (swap)) (play (or ("PlaceRed") ("PlaceNonRed"))) (end { (if (and (> (count Moves) 2) (no Pieces Next)) (result Next Loss)) (if (and {(> (count Moves) 2) (no Pieces Mover) (not (no Pieces Next))}) (result Mover Loss))})))
###
| (define "PlaceNonRed" (do (move Add (to (sites Empty))) ifAfterwards:(not (or ("SomeSite" (sites Around (last To) Enemy Orthogonal) (= 0 (count Liberties at:(site) Orthogonal if:(is Next (who at:(to)))))) ("SomeSite" (sites Around (last To) Own Orthogonal includeSelf:True) (= 0 (count Liberties at:(site) Orthogonal if:(is Mover (who at:(to)))))))))) (define "PlaceRed" (do (move Add (piece "Disc0") (to (sites Empty))) ifAfterwards:(or ("SomeSite" (sites Around (last To) Enemy Orthogonal) (= 0 (count Liberties at:(site) Orthogonal if:(is Next (who at:(to)))))) ("SomeSite" (sites Around (last To) Own Orthogonal) (= 0 (count Liberties at:(site) Orthogonal if:(is Mover (who at:(to))))))) (then (and (forEach Site (sites Around (last To) Enemy Orthogonal) (if (= 0 (count Liberties at:(site) Orthogonal if:(is Next (who at:(to))))) (remove (sites Group at:(site) Orthogonal if:(is Next (who at:(to))))))) (forEach Site (sites Around (last To) Own Orthogonal) (if (= 0 (count Liberties at:(site) Orthogonal if:(is Mover (who at:(to))))) (remove (sites Group at:(site) Orthogonal if:(is Mover (who at:(to))))))))))) (define "SomeSite" (not (all Sites #1 if:(not #2)))) (game "Redstone" (players 2) (equipment { (board (square 6) use:Vertex) (piece "Disc" Each) (piece "Disc" Neutral)}) (rules (meta (swap)) (play (or ("PlaceRed") ("PlaceNonRed"))) (end { (if (and (> (count Moves) 2) (no Pieces Next)) (result Next Loss)) (if (and {(> (count Moves) 2) (no Pieces Mover) (not (no Pieces Next))}) (result Mover Loss))}))) END |
Construct a Ludii game based on the following description
Played on a board with twelve points on either side. The points form a continuous track in a horseshoe shape; each player progresses in opposite directions (one from their bottom right to the top right, the other from their bottom left to their top left. Each player has 15 pieces. Each player's pieces begin in three stacks of five on the first point of their track. Two 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. If a player places all of their pieces on all of the points on the final six points of their side of the board, with three on each of the final three points, they win two points. Otherwise, they move into the opposite side of the board. When an opponent's piece lands on a point occupied by one of the player's pieces on the opponent's side of the board, the piece is removed from the board and must enter again. A player's pieces cannot be hit on their own side of the board. Once a player has brought all of their pieces into the final six points of the board, they may begin to bear off. They can do so by rolling a 6 to move from the 6th point, and so on down to 1. Players must use all available moves presented by the dice. The first player to remove all of their pieces wins.
###
| (define "SpecialWin" (if (is Mover P1) (and { (= 15 (count Pieces Mover in:(sites {0..5}))) ("IsFriendAt" 3) ("IsFriendAt" 4) ("IsFriendAt" 5) (= 3 (size Stack at:0)) (= 3 (size Stack at:1)) (= 3 (size Stack at:2))}) (and { (= 15 (count Pieces Mover in:(sites {13..18}))) ("IsFriendAt" 16) ("IsFriendAt" 17) ("IsFriendAt" 18) (= 3 (size Stack at:13)) (= 3 (size Stack at:14)) (= 3 (size Stack at:15))}))) (define "AllPiecesInFinalQuadrant" ("AllOwnedPiecesIn" (sites Mover "FinalQuadrant"))) (define "NotEnemyOrOnlyOne" (or (and { ("IsEnemyAt" (to)) (not (is In (to) (sites Mover "OppositeSide"))) ("IsEmptyOrSingletonStack" (to))}) (not ("IsEnemyAt" (to))))) (define "NextSiteFrom" ("NextSiteOnTrack" #2 from:#1)) (game "Schuster" (players 2) (equipment { ("BackgammonBoard" ("BackgammonTracksWithBar" End)) (dice d:6 num:2) (piece "Disc" Each (forEach Die if:("DieNotUsed") (if ("IsEndTrack" ("NextSiteFrom" (from) (pips))) (if ("AllPiecesInFinalQuadrant") (move Remove (from))) (move (from (from)) (to ("NextSiteFrom" (from) (pips)) if:("NotEnemyOrOnlyOne") ("HittingCapture" (mapEntry "Bar" Next))))) (then (and ("ReplayNotAllDiceUsed") (if ("SpecialWin") (addScore Mover 2)))))) (regions "FinalQuadrant" P1 (sites {20..25})) (regions "FinalQuadrant" P2 (sites {7..12})) (regions "OppositeSide" P1 (sites {25..20 18..13})) (regions "OppositeSide" P2 (sites {0..5 7..12})) (map "Bar" {(pair P1 6) (pair P2 19)})}) (rules (start { (place Stack "Disc1" 12 count:15) (place Stack "Disc2" 25 count:15)}) (play ("RollEachNewTurnMove" (forEach Piece top:True))) (end { (if ("SpecialWin") (result Mover Win)) ("EscapeWin")}))) END |
Construct a Ludii game based on the following description
3x6 board. Four counters per hole. Each player controls one row of holes and the half of the central row to their right. Sowing occurs from left ro right in the player's full row, right to left in their holes in the central row, then right to left in the opponent's full row, then left to right in the opponent's holes in the central row, at that point continuing into the player's full row again. When the final counter is sown into an occupied hole, the counters are picked up and sowing continues. When the final counter falls into an empty hole, the turn ends. At any point while the player sows, if a hole is made to contain four counters, these are captured, regardless of who the hole belongs to. When the final counter causes a capture, the turn ends. Play continues until a player has no counters in their holes. The opponent then captures the remaining counters. Players then redistribute their counters, four in each hole, starting from the leftmost hole in their row in the direction of play. The player with fewer counters distributes all of their counters on the board, even if they cannot place four in the final hole of the counting. The player with more counters then places four counters in the same number of holes as the other player, taking any remaining as their winnings. Play continues in this fashion until one player captures all of the counters.
###
| (define "LeftMostEmpty" (trackSite FirstSite from:(mapEntry "LeftMost" Mover) if:(is Empty (to)))) (define "NumCapturedPieces" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (define "OneHomeEmpty" (or (all Sites (sites P1) if:(is Empty (site))) (all Sites (sites P2) if:(is Empty (site))))) (define "Columns" 6) (game "Rab'e" (players 2) (equipment { (mancalaBoard 3 "Columns" store:None (track "Track" "0,E,N1,W2,17,W,S1,E2" loop:True)) (piece "Seed" Shared) (regions P1 (union (sites Bottom) (difference (expand (sites Right) steps:2) (sites Top)))) (regions P2 (union (sites Top) (difference (expand (sites Left) steps:2) (sites Bottom)))) (hand Each) (map "LeftMost" {(pair P1 0) (pair P2 17)}) (map "CorrespondingHoles" { (pair 0 17) (pair 1 16) (pair 2 15) (pair 3 14) (pair 4 13) (pair 5 12) (pair 11 6) (pair 10 7) (pair 9 8) (pair 8 9) (pair 7 10) (pair 6 11) (pair 12 5) (pair 13 4) (pair 14 3) (pair 15 2) (pair 16 1) (pair 17 0)})}) (rules (start (set Count 4 to:(sites Track))) phases:{ (phase "Sowing" (play (or { (move Select (from (if ("SameTurn") ("LastHoleSowed") (sites Mover)) if:(< 0 (count at:(from)))) (then (do (set Var "NumSowed" (count at:(last To))) next:(sow apply:(if (and (!= 4 (count at:(to))) (< 1 (count at:(to)))) (moveAgain))) (then (and (forEach Site (sites Track from:(last From) to:(trackSite Move from:(last From) "Track" steps:(var "NumSowed"))) (if (= 4 (count at:(site))) (fromTo (from (site)) (to (handSite Mover)) count:4))) (set Var "NumSowed" 0))))))} (then (if ("OneHomeEmpty") (and { (forEach Site (sites P1) (fromTo (from (site)) (to (handSite P1)) count:(count at:(site)))) (forEach Site (sites P2) (fromTo (from (site)) (to (handSite P2)) count:(count at:(site)))) (if (<= ("NumCapturedPieces" P1) ("NumCapturedPieces" P2)) (set NextPlayer (player 1)) (set NextPlayer (player 2)))}))))) (end (if ("NoPieceOnBoard") { (if (= 0 (count Cell at:(handSite P1))) (result P2 Win)) (if (= 0 (count Cell at:(handSite P2))) (result P1 Win))})) (nextPhase ("NoPieceOnBoard") "BetweenRounds")) (phase "BetweenRounds" (play (if (<= 4 (count Cell at:(handSite Mover))) (move (from (handSite Mover)) (to ("LeftMostEmpty")) count:4 (then (if (<= 4 (count Cell at:(handSite Mover))) (moveAgain) (and (if (!= 0 (count Cell at:(handSite Mover))) (and (fromTo (from (handSite Mover)) (to ("LeftMostEmpty")) count:(count Cell at:(handSite Mover))) (fromTo (from (handSite Next)) (to (mapEntry "CorrespondingHoles" ("LeftMostEmpty"))) count:(count Cell at:(handSite Next))))) (forEach Site (sites Mover) (if (is Occupied (site)) (fromTo (from (handSite Next)) (to (mapEntry "CorrespondingHoles" (site))) count:(count at:(site))))))))))) (nextPhase (= 0 (count Cell at:(handSite Mover))) "Sowing"))})) END |
Construct a Ludii game based on the following description
To start the game, each of the squares on the checkerboard is occupied by a stone. White stones are placed on the white squares and black stones on the black squares. To move, the player must pick up one of his or her own stones and 'clobber' an opponent's stone on an adjacent square, either horizontally or vertically. Once the opponent's stone is clobbered, it must then be removed from the board and replaced by the stone that was moved. The player who, on their turn, is unable to move, loses the game. The board has 10 rows. The board has 10 columns. Pieces must step onto an enemy piece.
###
| (game "Clobber" (players 2) (equipment { (board (rectangle 10 10)) (piece "Marker" Each ("StepToEnemy" Orthogonal))}) (rules (start { (place "Marker1" (sites Phase 1)) (place "Marker2" (sites Phase 0))}) (play (forEach Piece)) (end ("NoMoves" Loss)))) END |
Construct a Ludii game based on the following description
86 spaces in a spiral track. Any number of players, each having one piece, which starts on the first space in the outer ring of the spiral. A lump of charcoal, the Ghoula, also is placed on this space. Four sticks, with one green side and one white side, used as dice. The throws are as follows: One white side up = 1, this throw is known as \ The game has 4 players.
###
| (define "MoveGhoula" (if ("IsSingletonStack" ("WhereGhoula")) (move (from ("WhereGhoula") level:(where Level "Ghoula" Neutral at:("WhereGhoula"))) (to ("GhoulaOnTrack" "GhoulaTrack" 1))) (move (from ("WhereGhoula") level:(where Level "Ghoula" Neutral at:("WhereGhoula"))) (to ("GhoulaOnTrack" "ReverseGhoulaTrack" 1)) (then (if (= (last From) ("KillingSite")) (forEach Level (last From) FromTop (remove (last From) level:(level))) (forEach Level (last From) FromTop (fromTo (from (last From) level:(level)) (to (last To))))))) (then (if ("GhoulaPhaseDone") (set Var 0) (and (if (> (var) 1) (moveAgain)) (set Var (- (var) 1))))))) (define "WhereGhoula" (if ("IsNotOffBoard" (where "Ghoula" Neutral)) (where "Ghoula" Neutral) (handSite P1))) (define "GhoulaPhaseDone" (and ("IsSingletonStack" ("WhereGhoula")) (= ("EndTrack") ("WhereGhoula")))) (define "IsSpecialThrow" (is In ("ThrowValue") (sites {1 6 4}))) (define "GhoulaOnTrack" ("NextSiteOnTrack" #2 from:("WhereGhoula") #1)) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" #2 #1)) (define "Sig" (= ("ThrowValue") 1)) (define "ThrowValue" (mapEntry "Throw" (count Pips))) (define "BeginningExtensionTrack" 4) (define "EndTrack" 5) (define "Central" 0) (define "KillingSite" 84) (define "ExternalSite" 86) (game "Sig wa Duqqan (Houmt Taourit)" (players 4) (equipment { (board (spiral turns:5 sites:86) { (track "Track" {85..5} directed:True) (track "ExtensionTrack" {4..0} directed:True) (track "GhoulaTrack" {86..5} directed:True) (track "ReverseGhoulaTrack" {5..85} directed:True)} use:Vertex) ("StickDice" 4) (map "Throw" {(pair 0 4) (pair 1 3) (pair 2 0) (pair 3 1) (pair 4 6)}) (piece "Stick" Each (if (= (from) ("EndTrack")) (if (= (state at:(from) level:(level)) 7) (move (from (from) level:(level)) (to ("BeginningExtensionTrack"))) (if ("Sig") (move Select (from (from) level:(level)) (then (set State at:(last To) level:(last LevelTo) (+ 1 (state at:(last To) level:(last LevelTo)))))))) (if (is In (from) (sites Track "Track")) (move (from (from) level:(level)) (to ("SiteToMoveOnTrack" "Track" ("ThrowValue")) if:True)) (if (is In (from) (sites Track "ExtensionTrack")) (or { (if (and (!= (from) ("Central")) ("Sig")) (move (from (from) level:(level)) (to ("SiteToMoveOnTrack" "ExtensionTrack" 1)))) (if (= (from) ("Central")) (move Pass (then (and (if (= 0 ("ThrowValue")) (set Var 6) (set Var ("ThrowValue"))) (moveAgain)))) (if (= 3 ("ThrowValue")) (move Pass (then (and (set Var 3) (moveAgain))))))})))) maxState:7) (piece "Ghoula" Neutral) (hand P1 size:1)}) (rules (start { (place Stack "Ghoula0" ("ExternalSite")) (place Stack items:{"Stick4" "Stick3" "Stick2" "Stick1"} 85)}) (play (do (if (<= (var) 0) (roll)) next:(if (> (var) 0) ("MoveGhoula") (if (!= 0 ("ThrowValue")) (forEach Piece))) (then (if ("IsSpecialThrow") (moveAgain))))) (end { (forEach Player if:(no Pieces Player) (result Player Loss)) (forEach Player if:("GhoulaPhaseDone") (result Player Win))}))) END |
Construct a Ludii game based on the following description
<a href=\ 1976 version
###
| (define "NextCanNotMove" (not (can Move (do (forEach Piece Next) ifAfterwards:(not ("IsInCheck" "King" Next)))))) (define "Move" (move (from (from)) (to (intersection (sites To (if (= 1 (value Piece at:(from))) (step Orthogonal (to if:(not ("IsFriendAt" (to))))) (forEach Site (sites To ("SlideStep" ~ (apply if:(is Empty (to))))) ("SlideStep" (site))))) (sites Distance Orthogonal from:(from) (exact (value Piece at:(from))))) if:(not ("IsFriendAt" (to))) (apply (set Value at:(from) (value Random (range 1 #1))))))) (define "SlideStep" (slide (from #1) Orthogonal (between (range 1 3) if:(is Empty (between))) (to if:("IsEnemyAt" (to)) #2))) (game "Shogun" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) (piece "Pawn" Each ("Move" 4)) (piece "King" Each ("Move" 2))}) (rules (start { (place "Pawn1" coord:"A1" value:(value Random (range 1 4))) (place "Pawn1" coord:"B1" value:(value Random (range 1 4))) (place "Pawn1" coord:"C1" value:(value Random (range 1 4))) (place "Pawn1" coord:"D1" value:(value Random (range 1 4))) (place "Pawn1" coord:"F1" value:(value Random (range 1 4))) (place "Pawn1" coord:"G1" value:(value Random (range 1 4))) (place "Pawn1" coord:"H1" value:(value Random (range 1 4))) (place "King1" coord:"E1" value:(value Random (range 1 2))) (place "Pawn2" coord:"A8" value:(value Random (range 1 4))) (place "Pawn2" coord:"B8" value:(value Random (range 1 4))) (place "Pawn2" coord:"C8" value:(value Random (range 1 4))) (place "Pawn2" coord:"E8" value:(value Random (range 1 4))) (place "Pawn2" coord:"F8" value:(value Random (range 1 4))) (place "Pawn2" coord:"G8" value:(value Random (range 1 4))) (place "Pawn2" coord:"H8" value:(value Random (range 1 4))) (place "King2" coord:"D8" value:(value Random (range 1 2)))}) (play (forEach Piece)) (end (if (or (no Pieces Next "King") (<= (count Pieces Next) 2)) (result Mover Win))))) END |
Describe the mechanics of the following Ludii game
(game "Fivalath" (players 2) (equipment { (board (square 10) use:Vertex) (piece "Ball" Each)}) (rules (play (move Add (to (sites Empty)))) (end { (if (is Line 5 All) (result Mover Win)) (if (is Line 4 All) (result Mover Loss))})))
###
| Played on a square grid (8x8 or larger) with two players. Players alternate placing one stone of their colour on the board on any empty point. If a player makes a line of five pieces, either orthogonally or diagonally, they win; but if they make a line of four pieces, they lose. Played on a size 10 board. END |
Construct a Ludii game based on the following description
MOVE - Players move in turn to place one stone of either color on an empty cell.
- However, the dropped stone must be adjacent, at least, to two other stones.
- A stone cannot be adjacent to another stone of the same color.
GOAL - Wins the player that makes a 4 in-a-row, with stones of his color at both ends (one player has Black and Blue, the other has White and Red).
###
| (define "IsLine4WithEndSameColour" (and (is Line 4 whats:{(id "Hex" P1) (id "Hex" P2) (id "SecondHex" P1) (id "SecondHex" P2)}) (or { ("CheckEndLine" W) ("CheckEndLine" E) ("CheckEndLine" NNW) ("CheckEndLine" SSW) ("CheckEndLine" SSE) ("CheckEndLine" NNE)}))) (define "CheckEndLine" (and { (is Occupied (ahead (last To) steps:1 #1)) (is Occupied (ahead (last To) steps:2 #1)) (= (what at:(last To)) (what at:(ahead (last To) steps:3 #1)))})) (game "Plotto" (players 2) (equipment { (boardless Hexagonal) (tile "Hex" Each numSides:6) (tile "SecondHex" Each numSides:6) (hand Each size:2)}) (rules (start { (place "Hex1" (centrePoint)) (place "Hex2" (ahead (centrePoint) E)) (place "Hex1" (handSite P1 0)) (place "Hex2" (handSite P2 0)) (place "SecondHex1" (handSite P1 1)) (place "SecondHex2" (handSite P2 1))}) (play (move (from (sites Hand Mover)) (to (sites Playable) if:(and (<= 2 (count Sites in:(sites Around (to) NotEmpty))) (not (is In (what at:(from)) (results from:(last From) to:(sites Around (to)) (what at:(to))))))) copy:True)) (end (if ("IsLine4WithEndSameColour") (result Mover Win))))) END |
Construct a Ludii game based on the following description
4x10-20 board, with even numbers. Two counters in each hole, except the rightmost hole in the inner row of each player, which has zero. Sowing occurs in an anti-clockwise direction. When the final counter lands in an occupied hole, these are picked up and sowing continues. When the final counter lands in an empty hole in the inner row, the counters in the opposite hole in the opponent's inner row are captured. If counters are captured from the inner row, and there are also counters in the outer row, the counters in the outer row are also captured. If counters in the inner and outer row are captured, the player may also capture counters from one other hole on the opponent's side of the board. Single counters cannot be sown until there are no holes with multiple counters on the player's side of the board, and then single counters may only be sown into empty holes. Play continues until one player captures all of their opponent's counters, thus winning the game. Each row has 10 holes.
###
| (define "AllSitesNoMoreThanOne" (all Sites (sites Mover "Home") if:(>= 1 (count at:(site))))) (define "NextHole" ("NextSiteOnTrack" #2 from:#1 "Track")) (define "NoPiece" (all Sites (sites Player "Home") if:(= 0 (count at:(site))))) (define "Columns" 10) (game "Nsolo" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "Track1" "0,E,N1,W" loop:True P1) (track "Track2" "20,E,N1,W" loop:True P2)}) (regions "Home" P1 (sites Track "Track1")) (regions "Home" P2 (sites Track "Track2")) (regions "Inner" P1 (difference (sites Track "Track1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "Track2") (sites Top))) (piece "Seed" Shared)}) (rules (start (set Count 2 to:(union { (sites Bottom) (sites Top) (difference (sites P1 "Inner") (sites Right)) (difference (sites P2 "Inner") (sites Left))}))) (play (if (and ("SameTurn") (= (var "Replay") Undefined)) (move Remove (sites Next "Home")) (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") (sites {(var "Replay")}) (sites Mover "Home")) if:(> (count at:(from)) 1)) (then (sow "Track" owner:(mover) apply:(if (< 1 (count at:(to))) (if (and (is In (to) (sites Mover "Inner")) (is Occupied ("OppositePit" (to)))) (and (remove ("OppositePit" (to))) (if (is Occupied ("OppositeOuterPit" (to))) (and { (moveAgain) (set Var "Replay" Undefined) (remove ("OppositeOuterPit" (to)))}))) (and (moveAgain) (set Var "Replay" (to))))))))))) (end (forEach NonMover if:("NoPiece") (result Player Loss))))) END |
Describe the mechanics of the following Ludii game
(game "Greatest Loss" (players 2) (equipment { (board (square 4)) (piece "Disc" Each)}) (rules (start { (place "Disc1" {"A1"} state:1) (place "Disc1" {"B1"} state:2) (place "Disc1" {"C1"} state:3) (place "Disc1" {"D1"} state:4) (place "Disc1" {"A2"} state:5) (place "Disc1" {"B2"} state:6) (place "Disc1" {"C2"} state:7) (place "Disc1" {"D2"} state:8) (place "Disc2" {"A4"} state:1) (place "Disc2" {"B4"} state:2) (place "Disc2" {"C4"} state:3) (place "Disc2" {"D4"} state:4) (place "Disc2" {"A3"} state:5) (place "Disc2" {"B3"} state:6) (place "Disc2" {"C3"} state:7) (place "Disc2" {"D3"} state:8)}) (play (move Select (from (sites Occupied by:Mover)) (then (remove (last To))))) (end (if (= 0 (count Sites in:(forEach (sites Occupied by:Mover) if:(= 8 (state at:(site)))))) (result Mover Loss)))))
###
| Players take turns removing a piece of their colour (the mover must remove a piece each turn). The player who removes their highest numbered piece loses the game. END |
Construct a global Ludii definition which fulfills the following requirements.
Defines table tracks following the same direction for each player but starting from opposite corners.
###
| (define "TableTracksSameDirectionOppositeCorners" { (track "Track1" {11..0 12..23 #1} P1 directed:True) (track "Track2" {12..23 11..0 #1} P2 directed:True)}) END |
Construct a Ludii game based on the following description
3x12-28 board. Players begin with soldiers, equal in number to the number of spaces in one row for each player, which begin in the spaces in the row closes to the player. Each player has one king piece, which begins in the rightmost space in the central row with respect to the player. Four six-sided dice with values from 1-6. A throw of 1 is called Chong. Pieces move in a boustrophedon path along the board, from left to right in their home row, right to left in the center row, and then left to right in their opponent's row.
A player must first throw a Chong to play. On this turn, when a player throws one Chong, the King exchanges places with the soldier behind it. If more than one Chong is thrown, the King exchanges places with the soldier that many spaces behind it. Any remaining values in the throw are moved by the soldier which took the king's space. Once this move has taken place, pieces move according to the throws of the dice, which can be subdivided between the pieces as the player sees fit. The King only moves with a Chong, and it exchanges the place of a piece that number of occupied squares away, i.e., only spaces occupied by the player's pieces are counted when moving the King. When the player has only one soldier and the King, the King may move normally (like a soldier does), but on throws of Chong. When only the King is left, the first Chong in a throw is ignored and only the second, third, or fourth Chongs are moved.
When a player's piece lands on a space occupied by an opponent's piece, the opponent's piece is captured. An opponent's King cannot be taken by a soldier until it has first moved backwards, and then it can only be taken by a Chong.
The game continues after the players' Kings have been taken.
When a player reaches the end of the opponent's home line, the player wins. The game is played on a 3x12 board.
###
| (define "CaptureEnemyPiece" (apply if:("IsEnemyAt" (to)) (remove (to)))) (define "NumDiceAtOne" (+ { (if (= 1 (face (+ 0 (count Sites in:(sites Board))))) 1 0) (if (= 1 (face (+ 1 (count Sites in:(sites Board))))) 1 0) (if (= 1 (face (+ 2 (count Sites in:(sites Board))))) 1 0) (if (= 1 (face (+ 3 (count Sites in:(sites Board))))) 1 0)})) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" #2 #1)) (define "SumPips" (count Pips)) (game "Chong (Sakhalin)" (players 2) (equipment { (board (rectangle 3 12) { (track "Track1" "0,E,N1,W,N1,E" P1 directed:True) (track "Track2" "35,W,S1,E,S1,W" P2 directed:True)}) (dice d:6 num:4) (piece "Marker" Each (move (from) (to ("SiteToMoveOnTrack" from:(from) (pips)) if:(or { (is Empty (to)) (and ("IsEnemyAt" (to)) (if (not ("IsPieceAt" "King" Next (to))) True (= 1 (abs (- (to) (from))))))}) ("CaptureEnemyPiece")))) (piece "King" Each (if (= 1 (pips)) (if (<= 2 (count Pieces Mover)) (if (and (!= 1 (value Player Mover)) (= 1 (count Pieces Mover))) (move (from (from)) (to (from)) (then (set Value Mover 1))) (move (from) (to ("SiteToMoveOnTrack" from:(from) (pips)) if:(or { (is Empty (to)) (and ("IsEnemyAt" (to)) (if (not ("IsPieceAt" "King" Next (to))) True (= 1 (abs (- (to) (from))))))}) ("CaptureEnemyPiece")))) (firstMoveOnTrack "Track" Mover (if (and (> (site) (from)) (is Mover (who at:(site)))) (move Swap Pieces (from) (site)))))))}) (rules (start { (place "Marker1" (sites Bottom)) (place "King1" 23) (place "Marker2" (sites Top)) (place "King2" 12)}) phases:{ (phase "Opening" (play ("RollMove" (if (!= 0 ("NumDiceAtOne")) (if (is Mover P1) (if (is Mover (who at:(- (where "King" Mover) (+ (- (count Sites in:(sites Bottom)) 1) ("NumDiceAtOne"))))) (move Swap Pieces (where "King" Mover) (- (where "King" Mover) (+ (- (count Sites in:(sites Bottom)) 1) ("NumDiceAtOne"))))) (if (is Mover (who at:(+ (where "King" Mover) (+ (- (count Sites in:(sites Bottom)) 1) ("NumDiceAtOne"))))) (move Swap Pieces (where "King" Mover) (+ (where "King" Mover) (+ (- (count Sites in:(sites Bottom)) 1) ("NumDiceAtOne"))))) (then (fromTo (from (last From)) (to ("SiteToMoveOnTrack" from:(last From) (- ("SumPips") ("NumDiceAtOne"))) ("CaptureEnemyPiece")))))))) (nextPhase Mover (not (was Pass)) "Playing")) (phase "Playing" (play ("RollEachNewTurnMove" (forEach Die if:("DieNotUsed") (forEach Piece) (then ("ReplayNotAllDiceUsed"))))))} (end { (if (= (who at:0) P2) (result P2 Win)) (if (= (who at:(- (count Sites in:(sites Board)) 1)) P1) (result P1 Win))}))) END |
Describe the mechanics of the following Ludii game
(game "Snort" (players 2) (equipment { (board (square 8)) (piece "Cat" P1) (piece "Dog" P2)}) (rules (play (move Add (to (difference (sites Empty) (sites Around (sites Occupied by:Next) Orthogonal))))) (end (if (no Moves Next) (result P1 Win)))))
###
| Two players, black and white, take turns dropping pieces onto empty squares (that are not orthogonally adjacent to another enemy's piece) until no more moves are available. The last player to make a move wins the game. END |
Construct a global Ludii definition which fulfills the following requirements.
Defines the original Lasca graph.
###
| (define "LascaGraph" (graph vertices:{ {0 0} {2 0} {4 0} {6 0} {1 1} {3 1} {5 1} {0 2} {2 2} {4 2} {6 2} {1 3} {3 3} {5 3} {0 4} {2 4} {4 4} {6 4} {1 5} {3 5} {5 5} {0 6} {2 6} {4 6} {6 6}} edges:{ {0 4} {1 4} {1 5} {2 5} {2 6} {3 6} {4 7} {4 8} {5 8} {5 9} {6 9} {6 10} {7 11} {8 11} {8 12} {9 12} {9 13} {10 13} {11 14} {11 15} {12 15} {12 16} {13 16} {13 17} {14 18} {15 18} {15 19} {16 19} {16 20} {17 20} {18 21} {18 22} {19 22} {19 23} {20 23} {20 24}})) END |
Construct a Ludii game based on the following description
In Seesaw Draughts, when a man reaches the rank farthest away in its stepping direction, its capture range is increased, and it changes the direction it steps in. It can thereby promote again if it reaches the opposite rank.
The mechanism is implemented like this: All men are stacks. Single pieces are stacks of size 1. Every time a man promotes a piece is added to it, so its stack size increases by 1. The following two-fold meaning of stack size is the key idea:
1) Odd stacks step forwards and even stacks step backwards.
2) A stack of size n can capture a piece up to n steps away in a straight line provided that there are no pieces between the capturing piece and its target, and that the square immediately behind the target in the capture direction is empty. The capturing piece must land there.
Thus, the men gradually acquire the capturing power of a king in Thai Checkers as they seesaw up and down the board.
There is no obligation to choose the capture sequence that maximizes the number of pieces captured. We deem this calculation a bit too demanding when a stack's range is a function of its size.
Other than this, the rules are as in Brazilian Draughts/Checkers, which is like International Draughts, but on 8x8.
###
| (define "Promote" (if ("Promotes" #1) (add (to #1) stack:True))) (define "Promotes" (or (and (is Odd (size Stack at:#1)) (is In #1 (sites (player (+ 1 (% (mover) 2)))))) (and (is Even (size Stack at:#1)) (is In #1 (sites (player (mover))))))) (define "ConditionalDirection" (if (is Odd (size Stack at:(from))) (directions {FL FR}) (directions {BL BR}))) (define "HoppedPiece" (+ (array (intersection (sites Occupied by:Enemy) (sites Between from:(from) to:(to)))))) (define "CanCaptureFrom" (can Move (move (from #1) (to (sites Direction from:(from) (difference Diagonal (directions Cell from:(last To) to:(last From))) distance:(+ 1 (size Stack at:(from)))) if:(and { (is Empty (to)) (= 1 (count Sites in:(intersection (sites Occupied by:Enemy) (sites Between from:(from) to:(to))))) (= 0 (count Sites in:(intersection (sites Occupied by:Mover) (sites Between from:(from) to:(to))))) (= 1 (count Steps (to) ("HoppedPiece"))) (not (is In ("HoppedPiece") (values Remembered)))}))))) (define "Capture" (move (from if:(= (* (from) (if (< 0 (count MovesThisTurn)) 1 0)) (* (last To) (if (< 0 (count MovesThisTurn)) 1 0)))) (to (sites Direction from:(from) Diagonal distance:(+ 1 (size Stack at:(from)))) if:(and { (is Empty (to)) (= 1 (count Sites in:(intersection (sites Occupied by:Enemy) (sites Between from:(from) to:(to))))) (= 0 (count Sites in:(intersection (sites Occupied by:Mover) (sites Between from:(from) to:(to))))) (= 1 (count Steps (to) ("HoppedPiece"))) (not (is In ("HoppedPiece") (values Remembered)))}) (apply (remember Value ("HoppedPiece")))) count:(size Stack at:(from)) stack:True (then (if ("CanCaptureFrom" (last To)) (moveAgain) (do (forEach Site (sites (values Remembered)) (remove (site) count:(size Stack at:(site)))) next:(and ("Promote" (last To)) (forget Value All))))))) (define "Step" (move Step (from) ("ConditionalDirection") (to if:(is Empty (to))) stack:True (then ("Promote" (last To))))) (game "Seesaw Draughts" (players 2) (equipment { (board (square 8)) (piece "Disc" P1 N) (piece "Disc" P2 S) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start { (place "Disc1" (difference (expand (sites Bottom) steps:2) (sites Phase 1))) (place "Disc2" (difference (expand (sites Top) steps:2) (sites Phase 1)))}) (play (priority (forEach Piece "Disc" ("Capture") top:True) (forEach Piece "Disc" ("Step") top:True))) (end ("NoMoves" Loss)))) END |
Modify the Ludii game according to the following option changes:
The First player moves only when all the pieces are placed. The game has an ending condition for each player. -> The First player can move after placing his piece.
(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) (if (or (>= (count Moves) (- (value MoveLimit) 10)) (>= (count Turns) (- (value TurnLimit) 5))) (result P1 Win))}))}))
###
| (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 (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) ("PhaseMovePiece" "Movement")} (end ("NoMoves" Loss)))) 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 "FromEdgeToEdge" (and ( ( (is In (site) (sites #1))) ( (= 0 (count Pieces All in:(sites LineOfSight at:(site) #2))))))) (define "DroppableFromDirection" (and ( (= 0 (count Pieces All in:(sites LineOfSight at:(site) #1))) (= 1 (count Pieces in:(sites Around (site) #2)))))) (game "Centrifugal Force" (players 2) (equipment { (board (square 7)) (piece "Cross" P1) (piece "Disc" P2) (piece "Square" Neutral)}) (rules (start { (place "Square0" coord:"A1") (place "Square0" coord:"G1") (place "Square0" coord:"G7") (place "Square0" coord:"A7")}) (play (move Add (to (forEach (sites Empty) if: (or ( (or { ("FromEdgeToEdge" Top S) ("FromEdgeToEdge" Bottom N) ("FromEdgeToEdge" Left E) ("FromEdgeToEdge" Right W)}) (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 "FromEdgeToEdge" (and ( ( (is In (site) (sites #1))) ( (= 0 (count Pieces All in:(sites LineOfSight at:(site) #2))))))) (define "DroppableFromDirection" (and ( (= 0 (count Pieces All in:(sites LineOfSight at:(site) #1))) (= 1 (count Pieces in:(sites Around (site) #2)))))) (game "Centrifugal Force" (players 2) (equipment { (board (square 9)) (piece "Cross" P1) (piece "Disc" P2) (piece "Square" Neutral)}) (rules (start { (place "Square0" coord:"A1") (place "Square0" coord:"I1") (place "Square0" coord:"I9") (place "Square0" coord:"A9")}) (play (move Add (to (forEach (sites Empty) if: (or ( (or { ("FromEdgeToEdge" Top S) ("FromEdgeToEdge" Bottom N) ("FromEdgeToEdge" Left E) ("FromEdgeToEdge" Right W)}) (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
Ultimate Chess is a variant of Chess played on a 9x9 Sudoku checkerboard as shown, with same rules as Chess except:
- Pawns can move 2 or 3 steps forward in their first move. The pawn can be captured by En Passant if they do a such move.
- Kings can make a large casting in either side.
- The next player must move from the sub-grid corresponding to the cell just moved to (if they have a legal move from there).
###
| (define "RightSection" (and { (<= (column of:(from)) ("MaxColumn")) (>= (column of:(from)) ("MinColumn")) (<= (row of:(from)) ("MaxRow")) (>= (row of:(from)) ("MinRow"))})) (define "MaxColumn" (+ ("MinColumn") 2)) (define "MinColumn" (* "ColumnSquareSection" 3)) (define "ColumnSquareSection" (% (column of:(last To)) 3)) (define "MaxRow" (+ ("MinRow") 2)) (define "MinRow" (* "RowSquareSection" 3)) (define "RowSquareSection" (% (row of:(last To)) 3)) (define "QueenMove" ("SlideCapture" ~ ~ (then (set Counter)))) (define "KnightMove" ("LeapCapture" "KnightWalk" (then (set Counter)))) (define "BishopMove" ("SlideCapture" ~ Diagonal (then (set Counter)))) (define "KingMove" (move Step (to if:(not ("IsFriendAt" (to))) (apply (if ("IsEnemyAt" (to)) (remove (to) (then (set Counter)))))) "RememberPieceHasMoved")) (define "RookMove" ("SlideCapture" ~ Orthogonal (then (set Counter)) "RememberPieceHasMoved")) (define "PawnMove" (or { (if (is In (from) (sites Start (piece (what at:(from))))) "InitialPawnMove") "StepForwardToEmpty" ("StepToEnemy" (directions {FR FL})) "EnPassant"} (then (and ("ReplayInMovingOn" (sites Mover "Promotion")) (set Counter))))) (define "EnPassant" (move Step (directions {FR FL}) (to if:"InLocationEnPassant") (then (remove ("LastPawnMoved"))))) (define "LastPawnMoved" (var)) (define "InLocationEnPassant" (is In (to) (sites Pending))) (define "InitialPawnMove" (forEach Value min:2 max:3 (move Slide Forward (between (exact (value)) if:(is Empty (between)) (apply (set Pending (between)))) (to if:(is Empty (to))) "SetEnPassantLocation"))) (define "SetEnPassantLocation" (then (set Var (last To)))) (define "LeftCastling" ("DoCastle" "King" W 2 "KingNotCheckedAndToEmpty" (then (and ("PieceHasMoved") ("DoCastle" "RookLeft" E 3 True))))) (define "RightCastling" ("DoCastle" "King" E 2 "KingNotCheckedAndToEmpty" (then (and ("PieceHasMoved") ("DoCastle" "RookRight" W 3 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 "RememberPieceHasMoved" (then (if (= (state at:(last To)) 1) "PieceHasMoved"))) (define "PieceHasMoved" (set State at:(last To) 0)) (define "HasNeverMoved" (= (state at:(mapEntry #1 (mover))) 1)) (define "KingInTheInitialPlace" (= (what at:(mapEntry "King" (mover))) (id "King" Mover))) (game "Ultimate Chess" ("TwoPlayersNorthSouth") (equipment { (board (square 9)) (piece "Pawn" Each ("PawnMove")) ("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 "E9")}) (map "RookLeft" {(pair 1 "A1") (pair 2 "A9")}) (map "RookRight" {(pair 1 "I1") (pair 2 "I9")}) (regions "Promotion" P1 (sites Top)) (regions "Promotion" P2 (sites Bottom))}) (rules (start { (place "Pawn1" (sites Row 1)) (place "Pawn2" (sites Row 7)) (place "Rook1" {"A1" "I1"} state:1) (place "Knight1" {"B1" "H1"}) (place "Bishop1" {"C1" "G1"}) (place "Queen1" {"D1" "F1"}) (place "King1" coord:"E1" state:1) (place "Rook2" {"A9" "I9"} state:1) (place "Knight2" {"B9" "H9"}) (place "Bishop2" {"C9" "G9"}) (place "Queen2" {"D9" "F9"}) (place "King2" coord:"E9" 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 ("RightSection") ("QueenMove"))) (forEach Piece "Knight" (if ("RightSection") ("KnightMove"))) (forEach Piece "Bishop" (if ("RightSection") ("BishopMove"))) (forEach Piece "King" (if ("RightSection") ("KingMove"))) (forEach Piece "Rook" (if ("RightSection") ("RookMove"))) (forEach Piece "Pawn" (if ("RightSection") ("PawnMove"))) (if (and (= "RowSquareSection" 0) (= "ColumnSquareSection" 1)) (if (and { "KingInTheInitialPlace" ("HasNeverMoved" "King") (not ("IsInCheck" "King" Mover))}) (or (if (and ("HasNeverMoved" "RookLeft") (can Move ("DoCastle" "RookLeft" E 3 (is Empty (to))))) "LeftCastling") (if (and ("HasNeverMoved" "RookRight") (can Move ("DoCastle" "RookRight" W 2 (is Empty (to))))) "RightCastling"))))}) 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))))) "LeftCastling") (if (and ("HasNeverMoved" "RookRight") (can Move ("DoCastle" "RookRight" W 3 (is Empty (to))))) "RightCastling")))) 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
The board is a single track: nine squares along the bottom row. From the central space, a track of 25 spaces, which makes turns every five spaces. It begins vertically, then to the right, then vertical, then diagonallyup and to the left, then diagonallydown and to the left. The squares just before the track turns are marked with an \
###
| (define "RemoveAPiece" (move Remove (from))) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" (count Pips))) (game "Pancha Keliya" (players 2) (equipment { (board (rotate 90 (merge { (shift 2.79 10.44 (rotate 135 (rectangle 5 1))) (shift 6.32 11.15 (rotate 45 (rectangle 5 1))) (shift 9 11 (graph vertices:{ { 0 0} { -0.75 0.55} { -0.04 1.24}{ 1 0}} edges:{ {0 1} {1 2} {2 3} {3 0}})) (shift 9 5 (rectangle 6 1)) (shift 5 5 (rectangle 1 5)) (rectangle 1 9) (shift 4 0 (rectangle 6 1))})) { (track "Track1" "23,N4,W,N,W,11,7,SW,SE,End" P1 directed:True) (track "Track2" "31,S4,W,N,W,11,7,SW,SE,End" P2 directed:True)}) (piece "Marker" Each (if ("IsEndTrack" "SiteToMoveOnTrack") "RemoveAPiece" (if ("IsNotOffBoard" "SiteToMoveOnTrack") (if (or (is Empty "SiteToMoveOnTrack") (and (not ("IsFriendAt" "SiteToMoveOnTrack")) (not (is In "SiteToMoveOnTrack" (sites "Protect"))))) (move (from) (to "SiteToMoveOnTrack" ("HittingCapture" (mapEntry "Entry" Next)))))))) ("StickDice" 6) (hand Each) (regions "Protect" (sites {27 19 12 10 1})) (regions "SpecialDiceValues" (sites {1 5 6})) (map "Entry" {(pair P1 23) (pair P2 31)})}) (rules (start (place "Marker" "Hand" count:3)) (play ("RollMove" (if (and (is In (count Pips) (sites "SpecialDiceValues")) ("HandOccupied" Mover)) (or (move (from (handSite Mover)) (to (mapEntry "Entry" Mover) if:(not ("IsEnemyAt" (to))))) (forEach Piece) (then (moveAgain))) (forEach Piece)))) (end ("EscapeWin")))) END |
Construct a Ludii game based on the following description
3x3 intersecting lines, with diagonals drawn in the large square. Three pieces per player. Players alternate turns placing a stone on an empty point on the board. When all of the pieces have been placed, players alternate turns moving one of their pieces to any empty point. The first player to place three of their pieces in a line wins.
###
| (game "Tsoro Yemutatu" (players 2) (equipment { ("AlquerqueBoard" 3 3) (hand Each) (piece "Marker" Each (move (from) (to (sites Empty))))}) (rules (start (place "Marker" "Hand" count:3)) phases:{ (phase "Placement" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase ("HandEmpty" P2) "Movement")) ("PhaseMovePiece" "Movement")} (end ("Line3Win")))) END |
Construct a global Ludii definition which fulfills the following requirements.
Defines a step move to all the forwards directions according to the facing direction
###
| (define "StepForwardsToEmpty" (move Step Forwards (to if:(is Empty (to))))) END |
Construct a global Ludii definition which fulfills the following requirements.
Checks if the team has no pieces and makes it win. This ludemeplex can be used only in an ending condition.
###
| (define "EscapeTeamWin" (if (no Pieces TeamMover) (result TeamMover Win))) END |
Construct a Ludii game based on the following description
The rules are the same as for
Chess with these differences: White wins by capturing all black pieces. Black wins by checkmating the white king. If no black piece can make a valid move, the game is a draw (stalemate). Black pawns can be promoted to a black queen, rook, bishop or knight if they reach the last row. Black pawns cannot move two spaces forward from any position except the second rank.
###
| (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 "RememberPieceHasMoved" (then (if (= (state at:(last To)) 1) "PieceHasMoved"))) (define "PieceHasMoved" (set State at:(last To) 0)) (define "HasNeverMoved" (= (state at:(mapEntry #1 (mover))) 1)) (define "KingInTheInitialPlace" (= (what at:(mapEntry "King" (mover))) (id "King" Mover))) (define "NextCanNotMove" (not (can Move (do (forEach Piece Next) ifAfterwards:(not ("IsInCheck" "King" Next)))))) (game "Horde Chess" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) ("ChessPawn" "Pawn" (or (if (and (= (who at:(from)) P1) (is In (from) (sites Start (piece (what at:(from)))))) ("DoubleStepForwardToEmpty" "SetEnPassantLocation")) "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" (union {(sites Row 5) (sites Row 6) (sites Row 4) (difference (sites Row 7) (sites {"D8" "E8"})) (difference (sites Row 3) (sites {"A4" "B4" "C4" "F4" "G4" "H4"}))})) (place "Rook1" {"A1" "H1"} state:1) (place "Knight1" {"B1" "G1"}) (place "Bishop1" {"C1" "F1"}) (place "Queen1" coord:"D1") (place "King1" coord:"E1" state:1)}) (play (if "SameTurn" (move Promote (last To) (piece {"Queen" "Knight" "Bishop" "Rook"}) Mover) (if (is Mover P1) (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))) (forEach Piece)))) (end { (if (and (is Mover P1) (no Pieces P2)) (result P1 Win)) (if (and { (is Mover P2) ("IsInCheck" "King" Next) (not (can Move (do (forEach Piece Next) ifAfterwards:(not ("IsInCheck" "King" Next)))))}) (result P2 Win)) (if (or (no Moves Mover) (= (counter) 100)) (result Mover Draw))}))) END |
Construct a Ludii game based on the following description
Circular board. Empty central circle, with four concentric rows of spaces, sixteen spaces per circle. Pieces are as follows: Rukh (x2), placed on two adjacent squares in the outer circle, move any number of spaces orthogonally; Asb (x2), placed in the two spaces adjacent to the Rukh in the next circle, move as Chess knights; Pil (x2): Placed in the two spaces adjacent to the Asb in the next circle in, move two spaces diagonally, jumping over the first space; Fres (x1): placed on the inner circle adjacent to the left Pil, moves one space diagonally; Shah (x1), placed to the right of the Fers, moves one space in any direction, Baidaq (x8), placed in each space flanking the other pieces, those on the left move clockwise, those on the right anti-clockwise, one space forward or one space diagonally forward to capture. No en passant, no promotion. When two Baidaq meet and neither can move, the opponent captures them. The opponent who can checkmate the opponent's Shah wins. Rules Murray.
###
| (game "Shatranj ar-Rumiya" (players 2) (equipment { (board (remove (concentric {0 0 0 16 16 16 16}) cells:{1})) (piece "Pawn" Each (or { ("StepToEmpty" (if (= (state at:(from)) 0) CW CCW)) (move (from) (to (sites Around (sites To (move Step (if (= (state at:(from)) 0) CW CCW) (to if:True))) Orthogonal) if:(and (is Related Diagonal (from) (to)) ("IsEnemyAt" (to)))))} (then (if (= (state at:(last To)) 0) (if ("IsPieceAt" "Pawn" Next (ahead (last To) CW)) (and (remove (last To)) (remove (ahead (last To) CW)))) (if ("IsPieceAt" "Pawn" Next (ahead (last To) CCW)) (and (remove (last To)) (remove (ahead (last To) CCW)))))))) (piece "Rook" Each ("SlideCapture" Rotational)) (piece "Knight" Each (forEach Direction Orthogonal (to if:True (apply (forEach Direction (from (to)) Diagonal (if (and (not ("IsFriendAt" (to))) (= 3 (count Steps Orthogonal (from) (to)))) (move (from) (to (apply if:("IsEnemyAt" (to)) (remove (to))))))))))) (piece "Elephant" Each (move (from) (to (sites Around (sites Around (from) Diagonal) Diagonal) if:(and (not ("IsFriendAt" (to))) (< 2 (count Steps Orthogonal (from) (to)))) (apply if:("IsEnemyAt" (to)) (remove (to)))))) (piece "Queen" Each ("StepToNotFriend" Diagonal)) ("ChessKing" "King_noCross")}) (rules (start { (place "Rook1" (sites {52 53})) (place "Rook2" (sites {61 60})) (place "Knight1" (sites {36 37})) (place "Knight2" (sites {44 45})) (place "Elephant1" (sites {20 21})) (place "Elephant2" (sites {28 29})) (place "Queen1" 4) (place "Queen2" 12) (place "King_noCross1" 5) (place "King_noCross2" 13) (place "Pawn1" (sites {3 19 35 51}) state:0) (place "Pawn1" (sites {54 38 22 6}) state:1) (place "Pawn2" (sites {11 27 43 59}) state:0) (place "Pawn2" (sites {14 30 46 62}) state:1)}) (play (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King_noCross" Mover)))) (end { ("Checkmate" "King_noCross")}))) END |
Construct a Ludii game based on the following description
10x10 board. 22 pieces per player. Pieces begin on the board in the following arrangement, and with the following movements: Outer row, from left corner: Rukh: moves orthogonally any distance; Ghora: moves orthogonally one space and then diagonally another space, jumping over the first space; Fil: moves diagonally any distance; Wazir: moves diagonally or orthogonally any distance; Shahzada: can move like the Wazir and like the Ghora; Padshah: moves one space in any direction; Kotwal: moves like the Shahzada; Fil, Ghora, Rukh. In the next row, the central two squares are occupied by the Urdabegini: move one space in the direction of the opponent's Padshah; the other spaces are occupied by Paidal: moves one square forward orthogonally or one diagonally to capture. The central two squares of the third row contain two more Ghora. Players alternate turns moving a piece to a space on the board. If one of the opponent's pieces is on the space to which a player moves their piece, the opponent's piece is captured. If the Padshah can be captured on the opponent's next turn, it is in check. The Padshah cannot remain in check at the end of the player's turn. If this is not possible, it is checkmate and the opponent wins.
###
| (game "Qatranj" ("TwoPlayersNorthSouth") (equipment { (board (square 10)) ("ChessRook" "Rook") ("ChessKnight" "Knight") ("ChessBishop" "Bishop_noCross") ("ChessQueen" "Queen") (piece "Commoner" Each (or ("SlideCapture") ("LeapCapture" "KnightWalk"))) ("ChessKing" "King_noCross") (piece "Mann" Each (or ("SlideCapture") ("LeapCapture" "KnightWalk"))) (piece "Wazir" Each (do ("StepToNotFriend") ifAfterwards:(> (count Steps (last From) (where "King_noCross" Next)) (count Steps (last To) (where "King_noCross" Next))))) (piece "Pawn" Each (or "StepForwardToEmpty" ("StepToEnemy" (directions {FR FL}))))}) (rules (start { (place "Rook1" (sites {"A1" "J1"})) (place "Rook2" (sites {"A10" "J10"})) (place "Knight1" (sites {"B1" "I1" "E3" "F3"})) (place "Knight2" (sites {"B10" "I10" "E8" "F8"})) (place "Bishop_noCross1" (sites {"C1" "H1"})) (place "Bishop_noCross2" (sites {"C10" "H10"})) (place "Queen1" coord:"D1") (place "Queen2" coord:"G10") (place "Commoner1" coord:"E1") (place "Commoner2" coord:"F10") (place "King_noCross1" coord:"F1") (place "King_noCross2" coord:"E10") (place "Mann1" coord:"G1") (place "Mann2" coord:"D10") (place "Wazir1" (sites {"E2" "F2"})) (place "Wazir2" (sites {"E9" "F9"})) (place "Pawn1" (difference (sites Row 1) (sites {"E2" "F2"}))) (place "Pawn2" (difference (sites Row 8) (sites {"E9" "F9"})))}) (play (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King_noCross" Mover)))) (end ("Checkmate" "King_noCross")))) END |
Construct a Ludii game based on the following description
5x6 board. Each player has twelve pieces. Players alternate placing their pieces until they are all placed on the board. The goal is to make a line of three, which allows the player to capture one of the opponent's pieces. Once the pieces are all on the board, they may be moved one space orthogonally. In the case that a move creates two lines of three, only one capture is made. The player who makes the last possible capture wins.
###
| (game "Tauru" (players 2) (equipment { (board (rectangle 5 6)) (hand Each) (piece "Marker" Each ("StepToEmpty" Orthogonal (then ("ReplayIfLine3"))))}) (rules (start (place "Marker" "Hand" count:12)) phases:{ (phase "Placement" (play (if "SameTurn" ("RemoveAnyEnemyPiece") (move (from (handSite Mover)) (to (sites Empty)) (then ("ReplayIfLine3"))))) (nextPhase ("HandEmpty" P2) "Movement")) (phase "Movement" (play (if "SameTurn" ("RemoveAnyEnemyPiece") (forEach Piece))))} (end ("HavingLessPiecesLoss" Next 2)))) END |
Construct a Ludii game based on the following description
9x9 board. Played with the full complement of Shogi pieces, placed in the first and second rows. All pieces move only one space orthogonally forward or laterally. Pieces capture by hopping over an opponent's piece. The player to capture all of the opponent's pieces wins.
###
| (define "PieceMove" (or ("StepToEmpty" (directions {Forward Rightward Leftward})) ("HopCapture" (directions {Forward Rightward Leftward})))) (game "Tobi Shogi" ("TwoPlayersNorthSouth") (equipment { (board (square 9)) (piece "Osho" Each "PieceMove") (piece "Kinsho" Each "PieceMove") (piece "Ginsho" Each "PieceMove") (piece "Keima" Each "PieceMove") (piece "Kyosha" Each "PieceMove") (piece "Fuhyo" Each "PieceMove")}) (rules (start { (place "Osho1" coord:"E1") (place "Kinsho1" {"D1" "F1"}) (place "Ginsho1" {"C1" "G1"}) (place "Keima1" {"B1" "H1"}) (place "Kyosha1" {"A1" "I1"}) (place "Fuhyo1" (sites Row 1)) (place "Osho2" coord:"E9") (place "Kinsho2" {"D9" "F9"}) (place "Ginsho2" {"C9" "G9"}) (place "Keima2" {"B9" "H9"}) (place "Kyosha2" {"A9" "I9"}) (place "Fuhyo2" (sites Row 7))}) (play (forEach Piece)) (end ("CaptureAll" Next)))) END |
Describe the mechanics of the following Ludii game
(define "NoRabbit" (if (and (not ("IsPieceAt" "Rabbit" #1 (handSite #2))) ("NoSites" (sites Occupied by:#1 component:"Rabbit"))) (result #2 #3))) (define "RabbitReachedGoal" (if (!= 0 (count Sites in:(forEach (sites Occupied by:#1 component:"Rabbit") if:(is In (site) (sites #1 "Goal"))))) (result #1 #2))) (define "FinishMyTurn" (move Pass (then (remember State)))) (define "PullAPiece" (move (from (sites Around (last From) Orthogonal if:(and ("IsEnemyAt" (to)) (if (and (is In (last To) (sites "Traps")) (is Pending)) (< (value Piece at:(to)) (value Pending)) (< (value Piece at:(to)) (value Piece at:(last To))))))) (to (last From)))) (define "PushThePiece" (move (from (handSite Mover)) (to (sites Around (last To) Orthogonal if:(and (!= (last From) (to)) (is Empty (to))))) (then (and "AllPieceInATrapAreRemoved" (if "NotMyLastMove" (moveAgain) (remember State)))))) (define "HasToPushAPiece" (is Occupied (handSite Mover))) (define "AllPieceInATrapAreRemoved" (forEach Site (sites "Traps") (if (or (and (= (who at:(to)) P1) ("NotProtectedBy" (site) P1)) (and (= (who at:(to)) P2) ("NotProtectedBy" (site) P2))) (do (set Pending (value Piece at:(to))) next:(remove (to)))))) (define "PieceMove" (move Step #1 (to if:(and (or "NotFrozen" (and ("Frozen") ("ProtectedBy" Mover))) (or (is Empty (to)) "WillPushAPiece")) (apply (fromTo (from (to)) (to (handSite Mover))))))) (define "WillPushAPiece" (and { "NotMyLastMove" (not ("NoSites" (sites Around (to) Orthogonal if:(is Empty (to))))) ("IsEnemyAt" (to)) (< (value Piece at:(to)) (value Piece at:(from)))})) (define "NotMyLastMove" (< (count MovesThisTurn) 3)) (define "ProtectedBy" (not ("NotProtectedBy" (from) #1))) (define "NotProtectedBy" ("NoSites" (sites Around #1 Orthogonal if:(= (who at:(to)) #2)))) (define "Frozen" (not "NotFrozen")) (define "NotFrozen" ("NoSites" (sites Around (from) Orthogonal if:(and ("IsEnemyAt" (to)) (> (value Piece at:(to)) (value Piece at:(from))))))) (game "Arimaa" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) (hand Each size:6) (piece "Rabbit" Each ("PieceMove" (directions {Forward Rightward Leftward}))) (piece "Cat" Each ("PieceMove" Orthogonal)) (piece "Dog" Each ("PieceMove" Orthogonal)) (piece "Horse" Each ("PieceMove" Orthogonal)) (piece "Camel" Each ("PieceMove" Orthogonal)) (piece "Elephant" Each ("PieceMove" Orthogonal)) (regions "Traps" (sites {"C3" "C6" "F3" "F6"})) (regions "Home" P1 (expand (sites Bottom))) (regions "Home" P2 (expand (sites Top))) (regions "Goal" P1 (sites Top)) (regions "Goal" P2 (sites Bottom))}) (rules (start { (place "Rabbit" "Hand" count:8 value:1) (place "Cat" "Hand" count:2 value:2) (place "Dog" "Hand" count:2 value:3) (place "Horse" "Hand" count:2 value:4) (place "Camel" "Hand" count:1 value:5) (place "Elephant" "Hand" count:1 value:6)}) phases:{ (phase "PlacementP1" (play (move (from (sites Occupied by:Mover container:(mover))) (to (forEach (sites Mover "Home") if:(is Empty (site)))) (then (if ("HandOccupied" P1) (moveAgain))))) (nextPhase ("HandEmpty" P1) "PlacementP2")) (phase "PlacementP2" (play (move (from (sites Occupied by:Mover container:(mover))) (to (forEach (sites Mover "Home") if:(is Empty (site)))) (then (if ("HandEmpty" P2) (remember State) (moveAgain))))) (nextPhase ("HandEmpty" P2) "Movement")) (phase "Movement" (play (avoidStoredState (if "HasToPushAPiece" "PushThePiece" (or (or (if (and "SameTurn" (is In (last From) (sites Board))) "PullAPiece") (forEach Piece) (then (and "AllPieceInATrapAreRemoved" (if "NotMyLastMove" (moveAgain) (remember State))))) "FinishMyTurn")))) (end (if (not (is Next Mover)) { ("RabbitReachedGoal" P1 Win) ("RabbitReachedGoal" P2 Win) ("NoRabbit" P1 P2 Win) ("NoRabbit" P2 P1 Win) ("NoMoves" Loss)})))}))
###
| Played on an 8x8 board with \ END |
Construct a global Ludii definition which fulfills the following requirements.
Returns the index of the opposite pit on a two rows mancala board. This ludemeplex is working only if the description is defining "Columns" as the number of holes of the board.
###
| (define "OppositePitTwoRows" (if (is In #1 (sites Bottom)) (+ #1 "Columns") (- #1 "Columns"))) END |
Construct a Ludii game based on the following description
7x7 board, with an extra square above the top left square of the grid. One piece per player. Four sticks, with one green side and one white side, used as dice. The throws are as follows: one white and three green = sîg, valued at 1; two white and two green = 0; three white and one green = 3; four white = 4; four green=6. Pieces begin off the board, moving onto the bottom right square, and proceed in a boustrophedon direction, moving upward in the rightmost column, then down the next to the left, until reaching the extra space in the top left of the board. A player must first throw sîg to begin moving. Players move according to the values of the throws. If a player lands on the top right square, they must throw sîg five times to escape it. If a player lands on the central square, they must throw sîg ten times to escape it. A player must also throw one sîg to escape each of the final three spaces. Once a player has escaped the final space, they control the Ghula. The Ghula has different values for the throws: one white = 2; two white = 5; three white = 0; four white = 4; four green =6. The ghula moves in the opposite direction of the pieces, and when it overcomes one of the opponent's pieces it drags them in the direction it moves, with the goal of dragging them to the start. The Ghula may move forward or backward on its turn along the track. The Ghula does not have to throw a sîg to escape any spaces. Play continues until all of the players escape the final space. The game has 4 players.
###
| (define "MoveGhoula" (if ("IsSingletonStack" (where "Ghoula" Neutral)) (or (move (from (where "Ghoula" Neutral) level:(where Level "Ghoula" Neutral at:(where "Ghoula" Neutral))) (to ("GhoulaOnTrack" "GhoulaTrack" "ThrowGhoulaValue"))) (move (from (where "Ghoula" Neutral) level:(where Level "Ghoula" Neutral at:(where "Ghoula" Neutral))) (to ("GhoulaOnTrack" "ReverseGhoulaTrack" "ThrowGhoulaValue")))) (move (from (where "Ghoula" Neutral) level:(where Level "Ghoula" Neutral at:(where "Ghoula" Neutral))) (to ("GhoulaOnTrack" "ReverseGhoulaTrack" "ThrowGhoulaValue")) (then (if (= (last From) ("KillingSite")) (forEach Level (last From) FromTop (remove (last From) level:(level))) (forEach Level (last From) FromTop (fromTo (from (last From) level:(level)) (to (last To))))))) (then (set Var 0)))) (define "GhoulaPhaseDone" (or (and ("IsSingletonStack" (where "Ghoula" Neutral)) (= ("BeforeFinalSite") (where "Ghoula" Neutral))) (and (all Sites (difference (sites Board) (sites {("ExternalSite") ("FinalSite")})) if:(or (is Empty (site)) (and ("IsSingletonStack" (site)) (= (site) (where "Ghoula" Neutral))))) (is Empty ("ExternalSite"))))) (define "ActivePiece" (set State at:#1 level:#2 1)) (define "ActivatedPiece" (<= 1 (state at:#1 level:#2))) (define "Sig" (= ("ThrowValue") 1)) (define "ThrowGhoulaValue" (mapEntry "ThrowGhoula" (count Pips))) (define "GhoulaOnTrack" ("NextSiteOnTrack" #2 from:(where "Ghoula" Neutral) #1)) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" #2 #1)) (define "NextCentralSquare" 32) (define "CentralSquare" 31) (define "BegginingFinalTrack" 45) (define "NextTopRightSquare" 48) (define "TopRightSquare" 49) (define "BeforeFinalSite" 12) (define "FinalSite" 14) (define "KillingSite" 19) (define "ThrowValue" (mapEntry "Throw" (count Pips))) (define "ExternalSite" 50) (game "Es-Sig" (players 4) (equipment { (board (merge { (rectangle 8 1) (square 7) (shift 8 0 (square 1))}) { (track "Track" "50,19,W,N1,E,N1,W,N1,E,N1,W,N1,E,N1,W4" directed:True) (track "ExtensionTrack" "45,W,N" directed:True) (track "GhoulaTrack" "19,W,N1,E,N1,W,N1,E,N1,W,N1,E,N1,W" directed:True) (track "ReverseGhoulaTrack" "50,12,E,S1,W,S1,E,S1,W,S1,E,S1,W,S1,E" directed:True)}) (piece "Ghoula" Neutral) (piece "Stick" Each (if (= (from) ("TopRightSquare")) (if (= (state at:(from) level:(level)) 6) (move (from (from) level:(level)) (to ("NextTopRightSquare")) (then (forEach Level (last To) (set State at:(last To) level:(level) 0)))) (if ("Sig") (move Select (from (from) level:(level)) (then (set State at:(last To) level:(last LevelTo) (+ 1 (state at:(last To) level:(last LevelTo)))))))) (if (= (from) ("CentralSquare")) (if (= (state at:(from) level:(level)) 11) (move (from (from) level:(level)) (to ("NextCentralSquare")) (then (forEach Level (last To) (set State at:(last To) level:(level) 0)))) (if ("Sig") (move Select (from (from) level:(level)) (then (set State at:(last To) level:(last LevelTo) (+ 1 (state at:(last To) level:(last LevelTo)))))))) (if (and (!= (from) ("BegginingFinalTrack")) (is In (from) (sites Track "Track"))) (move (from (from) level:(level) if:(if ("ActivatedPiece" (from) (level)) True ("Sig"))) (to ("SiteToMoveOnTrack" "Track" ("ThrowValue")) if:True) (then (if (not ("ActivatedPiece" (last To) (topLevel at:(last To)))) ("ActivePiece" (last To) (topLevel at:(last To)))))) (if (is In (from) (sites Track "ExtensionTrack")) (or { (if (and (!= (from) ("FinalSite")) ("Sig")) (move (from (from) level:(level)) (to ("SiteToMoveOnTrack" "ExtensionTrack" 1)))) (if (= (from) ("FinalSite")) (move Pass (then (if (!= 1 (count Pips)) (and (moveAgain) (set Var 1))))))})))) (then (if (and (= (last To) ("FinalSite")) (!= (last From) ("FinalSite"))) (if (!= Undefined (var "ScoreToGet")) (and (set Score Mover (- (var "ScoreToGet") 1)) (set Var "ScoreToGet" (- (var "ScoreToGet") 1))) (and (set Score Mover (count Players)) (set Var "ScoreToGet" (count Players))))))) maxState:12) ("StickDice" 4) (map "Throw" {(pair 0 4) (pair 1 3) (pair 2 0) (pair 3 1) (pair 4 6)}) (map "ThrowGhoula" {(pair 0 4) (pair 1 6) (pair 2 4) (pair 3 2) (pair 4 6)})}) (rules (start (place Stack items:{"Ghoula0""Stick4" "Stick3" "Stick2" "Stick1"} ("ExternalSite"))) (play ("RollMove" (if (> (var) 0) ("MoveGhoula") (if (or (= (where "Stick" Mover) ("FinalSite")) (!= 0 ("ThrowValue"))) (forEach Piece))))) (end { (forEach Player if:(no Pieces Player) (result Player Loss)) (if ("GhoulaPhaseDone") (byScore))}))) END |
Construct a Ludii game based on the following description
4x8 board. Two counters in each hole. Sowing proceeds in an anti-clockwise direction. The first move must begin from the second hole from the right in the player's outer row, and proceed as follows, and is played simultaneously by both players: sow the two counters from that first hole, capture the counters in the opponent's two opposite holes and sow them, starting in the rightmost hole in the outer row, capture from the opposite two holes on the opponent's side and sow them again from the same hole. When the final counter falls in an occupied hole, those counters are picked up and sowing continues. The opening move ends when the final counter falls in an empty hole. The main phase then begins. When the final counter falls into an occupied hole in the player's inner row and both of the opposite holes on the opponent's side of the board are occupied, the counters in the opposite holes are captured and sown beginning in the first hole that was sown into to begin the sowing that caused the capture. When the final counter falls into an occupied hole and a capture is not possible, the contents of the hole are picked up and sowing continues. When the final counter lands in an empty hole, the turn ends. Players cannot sow from a hole containing a single counter. The player who captures all of their opponent's counters wins.
###
| (define "NoPiece" (all Sites (sites Player "Home") if:(= 0 (count at:(site))))) (define "PiecesOwnedBy" (+ (count Cell at:(handSite #1)) (count in:(sites #1 "Home")))) (define "Columns" 8) (game "Ryakati" (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))) (map "RightMostOuter" {(pair P1 7) (pair P2 24)}) (map "SecondHoleRightOuter" {(pair P1 6) (pair P2 25)}) (piece "Seed" Shared) (hand Each)}) (rules (start (set Count 2 to:(sites Board))) phases:{ (phase "Opening1" (play (move Select (from (mapEntry "SecondHoleRightOuter" Mover)) (then (sow "Track" owner:(mover) apply:(and (fromTo (from ("OppositePit" (to))) (to (mapEntry "RightMostOuter" Mover)) count:2) (fromTo (from ("OppositeOuterPit" (to))) (to (mapEntry "RightMostOuter" Mover)) count:2)))))) (nextPhase Mover "Opening2")) (phase "Opening2" (play (move Select (from (mapEntry "RightMostOuter" Mover)) (then (sow count:4 "Track" owner:(mover) apply:(and (fromTo (from ("OppositePit" (to))) (to (mapEntry "RightMostOuter" Mover)) count:2) (fromTo (from ("OppositeOuterPit" (to))) (to (mapEntry "RightMostOuter" Mover)) count:2)) origin:True)))) (nextPhase Mover "Opening3")) (phase "Opening3" (play (move Select (from (if ("SameTurn") (var "Replay") (mapEntry "RightMostOuter" Mover))) (then (sow count:(if ("SameTurn") (count at:(last To)) 4) "Track" owner:(mover) apply:(if (< 1 (count at:(to))) (and (moveAgain) (set Var "Replay" (to)))) origin:("NewTurn"))))) (nextPhase Mover (not (is Next Mover)) "Sowing")) (phase "Sowing" (play (move Select (from (if ("SameTurn") (sites {(var "Replay")}) (sites Mover "Home")) if:(> (count at:(from)) 1)) (then (sow "Track" owner:(mover) apply:(if (< 1 (count at:(to))) (if (and { (is In (to) (sites Mover "Inner")) (is Occupied ("OppositePit" (to))) (is Occupied ("OppositeOuterPit" (to)))}) (and { (fromTo (from ("OppositePit" (to))) (to (last From)) count:(count at:("OppositePit" (to)))) (fromTo (from ("OppositeOuterPit" (to))) (to (last From)) count:(count at:("OppositeOuterPit" (to)))) (sow (last From) count:(+ (count at:("OppositeOuterPit" (to))) (count at:("OppositePit" (to)))) "Track" owner:(mover))}) (and (moveAgain) (set Var "Replay" (to))))))))))} (end (forEach NonMover if:("NoPiece") (result Player Loss))))) END |
Construct a global Ludii definition which fulfills the following requirements.
Defines a step move to all the directions specified (adjacent by default) to a site occupied by an enemy piece. The enemy piece is removed.
###
| (define "StepToEnemy" (move Step #1 (to if:("IsEnemyAt" (to)) (apply (remove (to)))) #2)) END |
Construct a global Ludii definition which fulfills the following requirements.
Move again if the last `to' position is on a specified region.
###
| (define "ReplayInMovingOn" (if (is In (last To) #1) (moveAgain))) END |
Construct a Ludii game based on the following description
3x3 intersecting lines. Three sticks per player, the sticks angled toward the player to indicate ownership. Players alternate turns placing sticks on the board. Once all of the sticks are placed, players alternate turns moving a stick to any empty spot on the board. The first player to place three sticks in an orthogonal row along the lines wins.
###
| (game "Akidada" (players 2) (equipment { (board (square 3) use:Vertex) (hand Each) (piece "Stick" Each (move (from) (to (sites Empty))))}) (rules (start (place "Stick" "Hand" count:3)) phases:{ (phase "Placement" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase ("HandEmpty" P2) "Movement")) ("PhaseMovePiece" "Movement")} (end (if (is Line 3 Orthogonal) (result Mover Win))))) END |
Describe the mechanics of the following Ludii game
(define "IsNotAnIsolatedPlacement" (< 0 (count Pieces Mover in:(sites Around (last To) Orthogonal)))) (define "SitesInOversizedGroups" (forEach of:(intersection (sites Board) (sites Occupied by:Mover)) (if (> (value Piece at:(site)) (value Piece at:(handSite Mover 0))) (sites Around (site) Orthogonal)))) (define "UpdateGroupSizeValue4PiecesConnected2Placement" (forEach Site (sites Group at:(last To) Orthogonal) (set Value at:(site) (count Sites in:(sites Group at:(last To) Orthogonal))))) (define "UpdateTotalMoverGroupCount" (set Value at:(handSite Mover 0) (size Array (sizes Group Orthogonal Mover)))) (define "EmptySitesOutsideEnemyTerritoryFor" (difference (sites Empty) (sites (values Remembered #1)))) (define "RecordTerritoryOfRevisedGroup" (forEach Site ("HexHullSites" (sites Group at:(last To) Orthogonal)) (if (= (mover) 1) (remember Value "P1" (site) unique:True) (remember Value "P2" (site) unique:True)))) (define "CaptureWithin" (forEach Group Orthogonal if:(is In (to) (intersection (sites Board) (sites Occupied by:Next))) (if (no Pieces Next in:(difference (sites) (sites (values Remembered #2)))) (and (forEach Site ("HexHullSites" (sites)) (forget Value #1 (site))) (remove (sites)))))) (define "Scoring" (and { (set Score P1 (count Sites in:(intersection (sites Empty) (sites (values Remembered "P1"))))) (set Score P2 (count Sites in:(intersection (sites Empty) (sites (values Remembered "P2"))))) (set Value at:(handSite P1 0) (size Array (sizes Group Orthogonal P1))) (set Value at:(handSite P2 0) (size Array (sizes Group Orthogonal P2)))})) (define "CommonTerritory" (intersection (union (sites (values Remembered "P2")) (difference (sites Occupied by:P2) (handSite P2 0))) (union (sites (values Remembered "P1")) (difference (sites Occupied by:P1) (handSite P1 0))))) (define "P2Territory" (difference (union (sites (values Remembered "P2")) (difference (sites Occupied by:P2) (handSite P2 0))) (sites (values Remembered "P1")))) (define "P1Territory" (difference (union (sites (values Remembered "P1")) (difference (sites Occupied by:P1) (handSite P1 0))) (sites (values Remembered "P2")))) (define "SquareHullSites" (union { ("Corner" #1 N E) ("Corner" #1 S E) ("Corner" #1 S W) ("Corner" #1 N W)})) (define "HexHullSites" (union { ("Corner" #1 NNW E) ("Corner" #1 NNE SSE) ("Corner" #1 E SSW) ("Corner" #1 SSE W) ("Corner" #1 SSW NNW) ("Corner" #1 W NNE)})) (define "Corner" (intersection (sites Direction from:#1 #2) (sites Direction from:#1 #3))) (game "OffShore" (players 2) (equipment { (board (hex Hexagon 4) use:Cell) (hand Each size:1) (piece "Disc" Each)}) (rules (start { (place "Disc1" (handSite P1 0) value:0) (place "Disc2" (handSite P2 0) value:0)}) (play (or (move Pass) (move Add (to (difference (union { (if (= 1 (mover)) ("EmptySitesOutsideEnemyTerritoryFor" "P2") ("EmptySitesOutsideEnemyTerritoryFor" "P1")) ((sites {}))}) ("SitesInOversizedGroups"))) (then (do ("UpdateGroupSizeValue4PiecesConnected2Placement") next:("UpdateTotalMoverGroupCount") (then (if ("IsNotAnIsolatedPlacement") ("RecordTerritoryOfRevisedGroup") (then (priority (if (= (mover) 1) ("CaptureWithin" "P2" "P1") ("CaptureWithin" "P1" "P2") (then ("Scoring"))) ("Scoring")))))))))) (end (if (all Passed) { (if (> (score Mover) (score Next)) (result Mover Win)) (if (< (score Mover) (score Next)) (result Mover Loss))} (result Mover Win)))))
###
| Definitions:
-- Each of a player's stones belongs to exactly one group.
-- The group it belongs to contains all the stones that connect to it by virtue of being next to one another (across an edge).
-- A player's territory is the union of all the cells that are within the convex grid-oriented hulls of the player's groups.
In simpler language:
Imagine a line of cells that goes through just one stone of a group and leaves the rest of that group to one side. Surround the group with six of these lines and they will exactly contain all the territory of the stones of that group. A player's territory is then the combined territory of every group, counting cells only once where any of the group territories overlap.
-- A player's score is the number of empty cells in their territory.
Play:
The mover places a stone onto an empty site, with the following two limitations:
1) No placing in the opponent's territory.
2) No placing next to a friendly group that has more stones than there are friendly groups.
(Note that the resulting size of a group is irrelevant.)
After the placement, every opponent's group that lies completely within the mover's territory is removed.
Passing is voluntary.
When both players pass consecutively, the higher score wins. In case of a tie, the last to play wins.
Various boards are optional.
Weak Territory, allowing placement next to a friendly group in enemy territory is optional. 4 Hexagon No placement within Enemy territory. END |
What does the following global Ludii definition do?
(define "BlockWin" (if (no Moves Next) (result Mover Win)))
###
| If the next player has no legal moves, the mover is winning. This ludemeplex can be used only in an ending condition. END |
Construct a Ludii game based on the following description
Players alternate making a move. White plays with the white stones and makes the first move, Black plays with the black stones. On his turn, a player may choose either a) to place a stone on the board without contact to other stones of his color in order to start a new group, or b) to grow all possible groups by one stone. When you grow your groups in this implementation, you place grey stones adjacent to your groups until each of your groups is adjacent to exactly one grey stone. At no point may a group of yours be adjacent to more than one grey stone. When your turn ends, all grey stones are replaced with stones of your color.
For balancing, there is an extra rule: Black is allowed to grow all his groups and place a single stone as long as neither player has not yet grown any groups.
The game ends when the board is filled in. The score is the number of stones each player has on the board minus 'P' times the number of groups he has, where 'P' is en even number of 4 or higher (the Ludii implementation also allows 0 and 2 as values of 'P'). With an even penalty and an odd boardsize, draws are not possible. A size 19 board is currently selected A group penalty of 10 points is currently selected
###
| (define "UpdateScore" (set Score Mover (- (count Sites in:(sites Occupied by:Mover)) (* 10 (count Groups Orthogonal if:(is Mover (who at:(to)))))))) (define "Grow" ("PlaceGrey" (then (if (can Move ("PlaceGrey" ~)) (moveAgain) (do ("ReplaceAllGrey") next:("UpdateScore")))))) (define "ReplaceAllGrey" (add (to (sites Occupied by:Neutral) (apply (remove (to)))) (then (if (!= 1 (var "HasGrown")) (and (set Var "HasGrown" 1) (if (= (id P2) (mover)) (and (set Var "MoveThatMustBePlant" (count Moves)) (moveAgain)))))))) (define "PlaceGrey" (do (move Add (piece "Marker0") (to (sites Empty) if:(< 0 (count Sites in:(sites Around (to) Own Orthogonal))))) ifAfterwards:(all Groups Orthogonal of:(is Mover (who at:(to))) if:(> 2 (count Sites in:(intersection (sites Around (sites) NotEmpty Orthogonal) (sites Occupied by:Neutral))))) #1)) (define "Plant" (move Add (to (sites Empty) if:(= 0 (count Sites in:(sites Around (to) Own Orthogonal)))) (then ("UpdateScore")))) (game "Symple" (players 2) (equipment { (board (square 19) use:Vertex) (piece "Marker" Each) (piece "Marker" Neutral)}) (rules (play (if (= (count Moves) (var "MoveThatMustBePlant")) ("Plant") (if (= 0 (count MovesThisTurn)) (or ("Plant") ("Grow")) ("Grow")))) (end (if (is Full) (byScore))))) END |
Construct a Ludii game based on the following description
HeXentafl can be played on a 4x4 or 5x5 hex grid.
For the 4x4 version:
The King sits on the central space, the throne, surrounded by three defenders. Six attackers sit on the outer corners of the grid.
The attackers must capture the King in order to win. The defenders must escort the King to any of the six corners of the board in order to win.
All pieces except the King move in a
straight line, as many spaces as they like to an unoccupied space (like a rook in Chess). Only one piece at a time can occupy a space. A piece cannot jump over another piece.
The King can move into any vacant adjacent space, moving one space at a time (similar to the king in Chess).
Pieces are captured by surrounding them on two sides. Except for the corners, the pieces can be captured by surrounding them with two pieces which are not adjacents. You cannot \ The game is played on a 4x4 hex board.
###
| (define "Throne" (centrePoint)) (define "JarlWasCaptured" ("IsOffBoard" (where "Jarl" P1))) (define "SurroundThrone" (surround (from (last To)) Orthogonal (between if:(and { (= (between) ("Throne")) ("IsPieceAt" "Jarl" P1 (between)) ("PiecesSurroundingAreNotAdjacent")}) (apply (remove (between)))) (to if:("IsFriendAt" (to))) except:3)) (define "SurroundCorners" (surround (from (last To)) Orthogonal (between if:(and { (is In (between) (sites "Fortresses")) ("IsEnemyAt" (between)) ("PiecesSurroundingAreNotAdjacent")}) (apply (remove (between)))) (to if:("IsFriendAt" (to))) except:1)) (define "PiecesSurroundingAreNotAdjacent" (all Sites (sites Around (between) Own) if:(all Sites (sites Around (site) Own) if:(not (is In (to) (sites Around (between) Own)))))) (define "Custodial" (custodial (from (last To)) Orthogonal (between (max 1) if:(and (!= (between) ("Throne")) ("IsEnemyAt" (between))) (apply (remove (between)))) (to if:("IsFriendAt" (to))))) (game "HeXentafl" (players 2) (equipment { (board (rotate 90 (hex 4))) (piece "Thrall" P1 (move Slide (between if:(and (!= (between) ("Throne")) (is Empty (between)))) (then (and ("SurroundCorners") ("Custodial"))))) (piece "Thrall" P2 (move Slide (between if:(and (!= (between) ("Throne")) (is Empty (between)))) (then (and {("SurroundThrone") ("SurroundCorners") ("Custodial")})))) (piece "Jarl" P1 (move Step (to if:(is Empty (to))) (then (and ("SurroundCorners") ("Custodial"))))) (regions "Fortresses" (sites Corners))}) (rules (start { (place "Jarl1" ("Throne")) (place "Thrall2" (sites "Fortresses")) (place "Thrall1" {"D3" "C4" "E5"})}) (play (forEach Piece)) (end { ("PieceTypeReachWin" "Jarl1" (sites "Fortresses") P1) (if "JarlWasCaptured" (result P2 Win))}))) END |
Construct a Ludii game based on the following description
4x8 board. Two counters in each hole. Opening play: Two players play simultaneously, lifting and sowing counters from their outer rows. Rules for sowing and capturing are the same as in the main phase of the game. Sowing cannot begin from the fourth or fifth hole from the left in the player's outer hole. Players play until both drop the final counter in an empty hole, the first to do so plays first in the main phase. Players then move alternately. Main phase: Play begins from any hole on the player's side of the board with counters in it. Singletons cannot move. Sowing happens in an anti-clockwise direction. If the last counter lands in an empty hole, the turn is over. For capturing: Holes are in 'opposition' when one player has the front row hole occupied and the opponent has both of the holes opposite it occupied. If the last hole in a sowing is in opposition, the player takes the counters in both of the opponent's holes and places them in the empty hole from which the player lifted the counters. The player then sows the captured counters from this hole. Further captures in the sowing can occur in the same way. However, each player has two hole from which clockwise plays can be made: the leftmost hole in the outer row and the second from the left in the inner row. Clockwise moves can only be made from these holes if they immediately lead to a capture. When the captured counters are sown, starting from the same hole, they can also be sown clockwise if they lead to a capture. If they cannot lead to a capture, they are sown anti-clockwise. Another alternative the player has is that, if the player plays clockwise from one of these holes and therefore makes a capture, the captured counters may be placed in the hole and left there, and the player may play instead from the other hole from which clockwise captures are allowed in a clockwise direction, if it leads to a capture. The player may continue playing from this hole as above until the possibilities to move are exhausted, and then may move from any hole in an anti-clockwise direction. Multiple captures can only be made in a clockwise direction from these holes if it is made on the first sowing of the turn. Otherwise, only one clockwise capture can be made and sowing must proceed in an anti-clockwise direction. If the last counter lands on a hole that is occupied but not in opposition, these counters are picked up and sowing continues. Play ends when one player captures all the opponent's counters or one player cannot play. The player who cannot play loses. A player may also win by capturing the counters from both of the opponent's end holes in the inner row in a single turn.
###
| (define "NextHole" ("NextSiteOnTrack" #3 from:#1 #2)) (define "OuterPhaseOppositePit" (if (is Mover P1) (+ (to) (* 3 ("Columns"))) (- (to) (* ("Columns") 3)))) (define "Columns" 8) (game "Mweiso" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "TrackCCW1" "0,E,N1,W" loop:True P1) (track "TrackCCW2" "16,E,N1,W" loop:True P2) (track "TrackCW1" "7,W,N1,E" loop:True P1) (track "TrackCW2" "24,E,S1,W" loop:True P2)}) (regions "Home" P1 (sites Track "TrackCCW1")) (regions "Home" P2 (sites Track "TrackCCW2")) (regions "Inner" P1 (difference (sites Track "TrackCCW1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "TrackCCW2") (sites Top))) (regions "Outer" P1 (difference (sites Bottom) (sites {3 4}))) (regions "Outer" P2 (difference (sites Top) (sites {27 28}))) (map "LeftMostOuter" {(pair P1 0) (pair P2 31)}) (map "SecondLeftInner" {(pair P1 9) (pair P2 22)}) (piece "Seed" Shared) (hand Each)}) (rules (start (set Count 2 to:(union (sites P1 "Home") (sites P2 "Home")))) phases:{ (phase "OuterPhase" (play (move Select (from (if ("SameTurn") (sites {(var "Replay")}) (sites Mover "Outer")) if:(if ("SameTurn") (< 0 (count at:(from))) (< 1 (count at:(from))))) (then (sow "TrackCCW" owner:(mover) apply: (if (< 1 (count at:(to))) (and (moveAgain) (if (and { (is Occupied ("OppositePit" (to))) (is Occupied ("OppositeOuterPit" (to))) (is In (to) (sites Mover "Inner"))}) (and { (fromTo (from ("OppositePit" (to))) (to (last From)) count:(count at:("OppositePit" (to)))) (fromTo (from ("OppositeOuterPit" (to))) (to (last From)) count:(count at:("OppositeOuterPit" (to)))) (set Var "Replay" (from))}) (set Var "Replay" (to))))))))) (nextPhase Mover (= 1 (count at:(last To afterConsequence:True))) "MainPhase")) (phase "MainPhase" (play (or (move Select (from (if ("SameTurn") (sites {(var "Replay")}) (sites {(mapEntry "LeftMostOuter" Mover) (mapEntry "SecondLeftInner" Mover)})) if:(and { if:(if ("SameTurn") (< 0 (count at:(from))) (< 1 (count at:(from)))) (is In (from) (sites {(mapEntry "LeftMostOuter" Mover) (mapEntry "SecondLeftInner" Mover)})) (is In ("NextHole" (from) "TrackCW" (count at:(from))) (sites Mover "Inner")) (is Occupied ("OppositePit" ("NextHole" (from) "TrackCW" (count at:(from))))) (is Occupied ("OppositeOuterPit" ("NextHole" (from) "TrackCW" (count at:(from)))))})) (then (sow "TrackCW" owner:(mover) apply: (if (< 1 (count at:(to))) (and (moveAgain) (if (and { (is Occupied ("OppositePit" (to))) (is Occupied ("OppositeOuterPit" (to))) (is In (to) (sites Mover "Inner"))}) (and { (fromTo (from ("OppositePit" (to))) (to (last From)) count:(count at:("OppositePit" (to)))) (fromTo (from ("OppositeOuterPit" (to))) (to (last From)) count:(count at:("OppositeOuterPit" (to)))) (set Var "Replay" (from))}) (set Var "Replay" (to)))))))) (move Select (from (if ("SameTurn") (sites {(var "Replay")}) (sites Mover)) if:(if ("SameTurn") (< 0 (count at:(from))) (< 1 (count at:(from))))) (then (sow "TrackCCW" owner:(mover) apply: (if (< 1 (count at:(to))) (and (moveAgain) (if (and { (is Occupied ("OppositePit" (to))) (is Occupied ("OppositeOuterPit" (to))) (is In (to) (sites Mover "Inner"))}) (and { (fromTo (from ("OppositePit" (to))) (to (last From)) count:(count at:("OppositePit" (to)))) (fromTo (from ("OppositeOuterPit" (to))) (to (last From)) count:(count at:("OppositeOuterPit" (to)))) (set Var "Replay" (from))}) (set Var "Replay" (to)))))))))) (end ("BlockWin")))})) END |
Construct a Ludii game based on the following description
2x6 board. Four counters per hole. Each player takes their first turn from their leftmost hole. Sowing occurs in an anti-clockwise direction. If the final counter falls into an occupied hole, these are picked up and sowing continues. If the final counter falls into an empty hole, the turn ends. At any time during the sowing, if a hole is made to contain four counters, the owner of the hole in which the four counters are located captures them, unless it is the final hole of the sowing, in which case the player who is sowing captures them. The captures happen immediately. If a player does not capture when they should have, and a subsequent sowing causes this hole to contain five counters, it becomes a Jen. Players can no longer capture from a Jen in the same manner as before. Captures are made from it when the final counter of a sowing lands in it, in which case the final counter and one counter from the Jen are captured by the player who is sowing. Play continues until a player can no longer move because there are no counters in their row, and the opponent captures the remaining counters. Players then count their pieces by placing four in each hole, and the player who has more than their original number takes ownership of one of the opponent's holes for every four counters more than the original number that have been taken. If no player took four more than the original, the player with three extra gets the hole, if each player has two extra the weaker player is given the two extra counters. Play then begins again as before. The game ends when one player owns all of the counters, and thus all of the holes.
###
| (define "LeftMostEmpty" (trackSite FirstSite "Track" from:(mapEntry "LeftMost" Mover) if:(is Empty (to)))) (define "RememberOwnedHolesRandom" (if (< 50 (value Random (range 1 100))) (remember Value "OwnedP1" #1) (remember Value "OwnedP2" #1))) (define "OwnedHoles" (if (is Mover P1) (sites (values Remembered "OwnedP1")) (sites (values Remembered "OwnedP2")))) (define "RemmemberOwnedHoles" (if (is Mover P1) (remember Value "OwnedP1" #1) (remember Value "OwnedP2" #1))) (define "NoPieceOnOwnedHolesP2" (all Sites (sites (values Remembered "OwnedP2")) if:(= 0 (count at:(site))))) (define "NoPieceOnOwnedHolesP1" (all Sites (sites (values Remembered "OwnedP1")) if:(= 0 (count at:(site))))) (define "NextHole" ("NextSiteOnTrack" #2 from:#1 "Track")) (game "Gabata (Ghinda)" (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 4 to:(sites Track "Track"))}) phases:{ (phase "Sowing" (play (or { (move Select (from (if ("SameTurn") (sites {(var "Replay")}) (if (= 1 (value Player Mover)) ("OwnedHoles") (sites {(mapEntry "LeftMost" Mover)}))) if:(is Occupied (from))) (then (and (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 (if (is In (site) (sites (values Remembered "OwnedP1"))) (handSite P1) (handSite P2))) count:4))) (set Var "NumSowed" 0)))) (if (!= 1 (value Player Mover)) (set Value Mover 1)))))} (then (if (or ("NoPieceOnOwnedHolesP1") ("NoPieceOnOwnedHolesP2")) (and { (if ("NoPieceOnOwnedHolesP2") (forEach Site (sites Board) (fromTo (from (site)) (to (handSite P1)) count:(count at:(site)))) (forEach Site (sites Board) (fromTo (from (site)) (to (handSite P2)) count:(count at:(site))))) (forget Value "OwnedP1" All) (forget Value "OwnedP2" All)}))))) (end (if ("NoPieceOnBoard") { (if (= 0 (count Cell at:(handSite P1))) (result P2 Win)) (if (= 0 (count Cell at:(handSite P2))) (result P1 Win))})) (nextPhase ("NoPieceOnBoard") "BetweenRounds")) (phase "BetweenRounds" (play (if (<= 4 (count Cell at:(handSite Mover))) (move (from (handSite Mover)) (to ("LeftMostEmpty")) count:4 (then (and { ("RemmemberOwnedHoles" (last To)) (if (<= 4 (count Cell at:(handSite Mover))) (moveAgain) (if (= 3 (count Cell at:(handSite Mover))) (and { (fromTo (from (handSite Mover)) (to ("LeftMostEmpty")) count:3) (fromTo (from (handSite Next)) (to ("LeftMostEmpty")) count:1) ("RemmemberOwnedHoles" ("LeftMostEmpty"))}) (if (= 2 (count Cell at:(handSite Mover))) (and { (fromTo (from (handSite Mover)) (to ("LeftMostEmpty")) count:2) (fromTo (from (handSite Next)) (to ("LeftMostEmpty")) count:2) ("RememberOwnedHolesRandom" ("LeftMostEmpty"))}))))}))))) (nextPhase (and (is Empty (handSite P1)) (is Empty (handSite P2))) "Sowing"))})) END |
Describe the mechanics of the following Ludii game
(game "Ilpion" (players 2) (equipment { (board (graph vertices:{ {1 0.5} {3 0} {5 0} {6 0} {7 0} {8 0} {10 0} {11 0} {12 3} {0 2} {3 2} {5 2} {8 2} {8.5 2} {2 3} {7 3} {1 4} {12 4} {2 5} {5 5} {10 5} {10 8} {2 7} {6 7} {8 7} {0 10} {2 9} {5 9} {10 9} {1 10} {5 14} {10 10} {1 12} {4 12} {7 14} {9 12}} edges:{ {0 10} {1 10} {2 11} {3 11} {4 12} {5 12} {6 13} {7 13} {8 13} {10 19} {16 9} {9 10} {11 19} {15 12} {12 20} {13 20} {13 17} {14 18} {18 19} {19 23} {20 23} {20 24} {21 24} {23 26} {22 26} {26 33} {26 32} {32 29} {29 25} {23 27} {27 34} {30 34} {27 35} {31 35} {27 28}}) use:Vertex) (piece "Disc" Each) (piece "Marker" Shared)}) (rules (start { (set Shared Edge (sites Board Edge))}) (play (forEach Site (sites Board) (if (> (count Sites in:(sites Incident Edge of:Vertex at:(to) Shared)) 0) (move Add (to (intersection (sites Empty) (sites {(to)}))) (then (and (if (is TreeCentre Shared) (addScore Mover 1)) (forEach Site (sites Incident Edge of:Vertex at:(last To)) (remove Edge (to))))))))) (end (if (no Moves Mover) (byScore)))))
###
| Players take turns adding his friendly colour in an uncoloured vertex. The aim of each player is to colour the centre vertex of the coloured tree. It is a scoring based game, and it has two versions. At the centroid version, each player gets one point for correctly coloured a tree centre. In the second version is the degree version, where a player gets a score, which is equal to the degree of his last coloured tree centre. For both versions, all the incident edges of last move are uncoloured. So the tree is divided into subtrees. The game ends when there is no coloured tree available. The player with the highest score wins. The scoring is based on centroid. The version of the game played with 2 players. END |
Construct a Ludii game based on the following description
Each turn, a player selects a graph element (vertex or edge) to create a disjoint path with size k. When a player successfully makes a path of a specific size, he gets a point. The player with the highest score wins the game. The players play on edges of the graph.
###
| (game "DisPath" (players 2) (equipment { (board (graph vertices:{ {0 0} {0 1} {0 2} {0 3} {0 4} {1 0} {1 1} {1 2} {1 3} {1 4} {2 0} {2 1} {2 2} {2 3} {2 4} {3 0} {3 1} {3 2} {3 3} {3 4} {4 0} {4 1} {4 2} {4 3} {4 4}} edges:{ {0 1} {0 5} {1 6} {1 2} {2 7} {2 3} {3 8} {3 4} {4 9} {5 6} {5 10} {6 11} {6 7} {7 12} {7 8} {8 13} {8 9} {9 14} {10 11} {11 12} {12 13} {13 14} {10 15} {11 16} {12 17} {13 18} {14 19} {15 16} {15 20} {16 21} {20 21} {16 17} {17 22} {21 22} {17 18} {18 23} {22 23} {18 19} {19 24} {23 24}}) use:Vertex)}) (rules (play (or (move Add (to Edge (sites Empty Edge)) (then (if (is Path Edge Mover length:(exact 3)) (addScore Mover 1)))) (move Pass))) (end (if (all Passed) (byScore))))) END |
Construct a Ludii game based on the following description
2x5 board. Five counters in each hole. Sowing occurs in an anti-clockwise direction. When the final counters of a sowing lands in a hole, the contents of the next hole are picked up and sowing continues. When the final counter lands in a hole, and the next hole, from which sowing would normally continue, is empty, the player captures any counters in the next hole after the empty one. and the turn ends. Play continues until no more captures are possible, and the player who captured the most counters wins.
###
| (define "LastHoleSowed" (sites {(value Pending)})) (define "NextNextHole" ("NextSiteOnTrack" 2 from:(to))) (define "NextHole" ("NextSiteOnTrack" 1 from:(to))) (define "PiecesOwnedBy" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (game "Pachgarhwa" (players 2) (equipment { (mancalaBoard 2 5 store:None (track "Track" "0,E,N,W" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece "Seed" Shared) (hand Each)}) (rules (start (set Count 5 to:(sites Track))) (play (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover)) if:(> (count at:(from)) 0)) (then (sow if:True apply:(if (is Occupied ("NextHole")) (and { (set Pending (to)) (fromTo (from ("NextHole")) (to (handSite Mover)) count:(count at:("NextHole"))) (moveAgain)}) (if (is Occupied ("NextNextHole")) (fromTo (from ("NextNextHole")) (to (handSite Mover)) count:(count at:("NextNextHole"))))))))) (end ("MancalaByScoreWhen" (= 1 (count in:(sites Board))))))) END |
Construct a Ludii game based on the following description
Six or more players, even number of players, played on two teams. The board consists of twenty kernels of corn, spaced evenly in a line. If there are ten to fourteen players, the board is expanded to 25 kernels. If there are more than sixteen players, it is expanded to 30. Sticks are used to play, (five per player), and are played in the spaces between corn kernels. Dice are also corn kernels, with one side marked with a black dot. Four dice are used, the value of a move determined by the number of black dots that land face up. Each player has two throws on their turn, and moves after the second throw. The throws both must be used, and can be used in any order. Each team's home is the side of the board to their left. Each team moves toward the opposite end of the track, exiting at the opposing team's 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 opposing team's home field, the piece may be re-entered on that player's team's own home field. 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 captured piece is placed on top of the piece that captured it, and the stack continues toward the opposing team's home space. If the player successfully carries the captured piece to the opposing 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 their opposing team's side. Any pieces captured belonging to the team which brings them off the board are returned to their players. Pieces belonging to the same team may occupy the same space with no consequence for the game. When one team has no more counters left to enter, the winner is the team that captured most of the opposing team's pieces.
The game has 6 players.
###
| (define "CapturedPiecesFollowCapturingPiece" (forEach Level (last From) FromTop (if ("CapturedPiece" (state at:(last From) level:(level))) (fromTo (from (last From) level:(level)) (to (last To)))))) (define "RebirthCapturingPiece" (add (piece (id "Stick" Mover)) (to (handSite Mover)))) (define "RemoveCapturedPieces" (forEach Level (last From) FromTop (if ("CapturedPiece" (state at:(last From) level:(level))) (remove (last From) level:(level))))) (define "CaptureMove" (forEach Level (last To) FromTop (and (if ("IsEnemyAt" (last To) level:(level)) ("SetCapturePiece" at:(last To) level:(level))) (if ("IsFriendAt" (last To) level:(level)) ("SetCapturingPiece" at:(last To) level:(level)))))) (define "AtLeastAnEnemyPieceThere" (is In #1 (sites Occupied by:Enemy top:False))) (define "FreePiece" (= 0 #1)) (define "CapturedPiece" (= 2 #1)) (define "CapturingPiece" (= 1 #1)) (define "UnsetCapturingPieces" (forEach Level (last From) FromTop (if ("IsFriendAt" (last From) level:(level)) ("UnsetCapturingPiece" at:(last From) level:(level))))) (define "UnsetCapturingPiece" (set State #1 #2 0)) (define "SetCapturingPiece" (set State #1 #2 1)) (define "SetCapturePiece" (set State #1 #2 2)) (define "NoPieceOnBoard" (< (count Pieces Mover in:(sites Board)) 1)) (define "ThrowValue" (count Pips)) (game "Aj Sakakil" (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)} 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))) (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)) (apply (forget Value "Throws" (value)))) (then (if ("AtLeastAnEnemyPieceThere" (last To)) ("CaptureMove")))))) (if ("CapturingPiece" (state at:(from) level:(level))) (if ("IsOffBoard" ("NextSiteOnTrack" (value) from:(from))) (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)) (apply (forget Value "Throws" (value)))) (then (and ("CapturedPiecesFollowCapturingPiece") ("UnsetCapturingPieces"))))))))) ("StickDice" 4) (hand Each)}) (rules (start { (set Team 1 {P1 P2 P3}) (set Team 2 {P4 P5 P6}) (place Stack "Stick1" (handSite P1) count:5) (place Stack "Stick2" (handSite P2) count:5) (place Stack "Stick3" (handSite P3) count:5) (place Stack "Stick4" (handSite P4) count:5) (place Stack "Stick5" (handSite P5) count:5) (place Stack "Stick6" (handSite P6) count:5)}) phases:{ (phase "ThrowPhase" (play ("RollMove" (move Pass (then (if (not (no Pieces Mover)) (and { (if (!= 0 ("ThrowValue")) (do (remember Value "Throws" ("ThrowValue")) ifAfterwards:(can Move (or (forEach Piece container:(mover)) (forEach Piece))))) (moveAgain) (if ("SameTurn") (set Pending))})))))) (nextPhase (is Pending) "MovePhase")) (phase "MovePhase" (play (or (forEach Piece) (forEach Piece container:(mover)) (then (if (< 0 (size Array (values Remembered "Throws"))) (moveAgain))))) (nextPhase (= 0 (size Array (values Remembered "Throws"))) "ThrowPhase"))} (end ("CaptureAllTeam")))) END |
Construct a Ludii game based on the following description
Players take turns placing their pieces on one space on the board, with the goal of connecting the opposite sides of the board corresponding to the color of their pieces with a line of pieces. The game is played on a 11x11 board. The board is a diamond tiling by hexagon. The game uses the swap rule. The first player to connect their two sides wins. The connection between two stones is using all the diagonal directions.
###
| (game "Diagonal Hex" (players 2) (equipment { (board (hex Diamond 11)) (piece "Marker" Each) (regions P1 { (sites Side NE) (sites Side SW)}) (regions P2 { (sites Side NW) (sites Side SE)})}) (rules (meta (swap)) (play (move Add (to (sites Empty)))) (end (if (is Connected Diagonal Mover) (result Mover Win))))) END |
Construct a Ludii game based on the following description
Played on cross-shaped board, made of five squares, each divided into four squares and with the diagonals of the larger squares drawn. One player plays as thirteen hens, which begin on the points on one of the arms of the cross and along the line immediately perpendicular to that arm. The other player plays as one fox, which can be placed on any empty point of the board. Players alternate turns moving to an empty adjacent spot along the lines of the board. The hens, however, can only move in a forward direction. The fox may hop over an adjacent hen to an empty spot immediately on the opposite side of the hen along the lines of the board. The fox wins by capturing all the hens, the hens win by blocking the fox from being able to move.
###
| (game "Jeu du Renard et de la Poule" (players 2) (equipment { ("CrossBoard" 3 7 use:Vertex diagonals:Alternating) (hand P1) (piece "Fox" P1 (or ("HopSequenceCapture") "StepToEmpty")) (piece "Hen" P2 N "StepForwardsToEmpty")}) (rules (start { (place "Fox1" (handSite P1)) (place "Hen2" (union (expand (sites Bottom)) (sites Row 2)))}) phases:{ (phase "Placement" P1 (play (move (from (handSite P1)) (to (sites Empty)))) (nextPhase ("HandEmpty" P1) "Movement")) ("PhaseMovePiece" "Movement")} (end ("NoMovesLossAndNoPiecesPlayerLoss" P2)))) END |
Construct a Ludii game based on the following description
Initially, there is a number of edges in a plane, where some of them cross each other. At each turn, a player selects an edge to remove it and all of its intersecting edges. The number of edges with which a selected edge intersects is added to the player's score. When there are no moves left, the game is over. Finally, the player with the highest score wins. The version of the game played with 2 players.
###
| (game "Line and Cross" (players 2) (equipment { (board (graph vertices:{{2 0} {1 1} {4 1} {7 1} {10 1} {0 2} {2 2} {3 2} {5 2} {9 2} {0 3} {6 3} {7 3} {9 3} {10 3} {11 3} {2 4} {4 4} {6 4} {7 4} {8 4} {10 4} {12 4} {7 5} {9 5} {11 5} {13 5} {1 6} {2 6} {4 6} {6 6} {8 6} {10 6} {12 6} {14 6}} edges:{ {0 6} {5 7} {1 27} {10 11} {2 17} {16 28} {8 9} {3 12} {17 19} {18 30} {29 30} {23 24} {20 31} {13 15} {4 14} {21 32} {25 26} {22 33} {33 34} {1 2} {6 16} {16 17} {27 29} {11 18} {12 19} {19 23} {19 20} {21 22} {15 25} {13 24}}) use:Edge) (piece "Marker" Shared)}) (rules (start { (set Shared Edge (sites Board Edge))}) (play (move Remove (sites Occupied by:Shared) (then (and (remove Edge (last To)) (forEach Site (sites Crossing at:(last To) All) (and (remove Edge (to)) (addScore Mover 1))))))) (end (if (no Moves Next) (byScore))))) END |
Construct a Ludii game based on the following description
5x5 board. Twelve pieces per player. Players alternate turns placing a piece on the board or moving a piece already on the board. Pieces move one space in any orthogonal direction. A player may capture an opponent's piece by hopping over it to an empty space on the other side of it. When a capture is made in this fashion, the player chooses another piece belonging to the opponent to capture in addition. The player who captures all of the opponent's pieces wins.
###
| (define "RemoveEnemyPiece" (move Remove (sites Occupied by:Next container:"Board"))) (game "Yote" (players 2) (equipment { (board (square 5)) (piece "Marker" Each (or ("StepOrthogonalToEmpty") ("HopCapture" ~ ~ (then (moveAgain))))) (hand Each)}) (rules (start (place "Marker" "Hand" count:12)) (play (if "SameTurn" "RemoveEnemyPiece" (or (if ("HandOccupied" Mover) (move (from (handSite Mover)) (to (sites Empty)))) (forEach Piece)))) (end ("CaptureAll" Next)))) END |
What does the following global Ludii definition do?
(define "HandOccupied" (not (all Sites (sites Hand #1) if:(= 0 (count Cell at:(site))))))
###
| Checks if at least a site in a specific hand is not empty. This ludemeplex is working only for non stacking games. END |
What does the following global Ludii definition do?
(define "DominoWalk" { {F R F R F L F L F R F R F}})
###
| Defines a graphics turtle walk to build a domino as a large piece. END |
Modify the Ludii game according to the following option changes:
Base 3 hexagonal board of triangles -> Base 5 square board
(define "CombinedGroupCounts" ( + { (* 10000 (count Groups Orthogonal #1)) (* 100 (- (count Groups Orthogonal #1) (count Groups Orthogonal #1 min:3))) (- (- (count Groups Orthogonal #1) (count Groups Orthogonal #1 min:5)) (- (count Groups Orthogonal #1) (count Groups Orthogonal #1 min:3)))})) (game "Hermit" (players 2) (equipment { (board (tri Hexagon 3) use:Vertex) (piece "Marker" Each) (piece "Marker" Neutral)}) (rules (start { (set Score P1 0) (set Score P2 0)}) (play (do (move Add (to (sites Empty))) ifAfterwards: (or { (= 1 (size Group at:(last To) Orthogonal)) (= 3 (size Group at:(last To) Orthogonal)) (= 5 (size Group at:(last To) Orthogonal))}) (then (addScore Mover (- ("CombinedGroupCounts" if:(= (who at:(to)) (mover))) (score Mover)))))) (end (if (all Passed) { (if (> ("CombinedGroupCounts" if:(= (who at:(to)) P1)) ("CombinedGroupCounts" if:(= (who at:(to)) P2))) (result P1 Win)) (if (< ("CombinedGroupCounts" if:(= (who at:(to)) P1)) ("CombinedGroupCounts" if:(= (who at:(to)) P2))) (result P2 Win))} (result Mover Win)))))
###
| (define "CombinedGroupCounts" ( + { (* 10000 (count Groups Orthogonal #1)) (* 100 (- (count Groups Orthogonal #1) (count Groups Orthogonal #1 min:3))) (- (- (count Groups Orthogonal #1) (count Groups Orthogonal #1 min:5)) (- (count Groups Orthogonal #1) (count Groups Orthogonal #1 min:3)))})) (game "Hermit" (players 2) (equipment { (board (square 5) use:Vertex) (piece "Marker" Each) (piece "Marker" Neutral)}) (rules (start { (set Score P1 0) (set Score P2 0)}) (play (do (move Add (to (sites Empty))) ifAfterwards: (or { (= 1 (size Group at:(last To) Orthogonal)) (= 3 (size Group at:(last To) Orthogonal)) (= 5 (size Group at:(last To) Orthogonal))}) (then (addScore Mover (- ("CombinedGroupCounts" if:(= (who at:(to)) (mover))) (score Mover)))))) (end (if (all Passed) { (if (> ("CombinedGroupCounts" if:(= (who at:(to)) P1)) ("CombinedGroupCounts" if:(= (who at:(to)) P2))) (result P1 Win)) (if (< ("CombinedGroupCounts" if:(= (who at:(to)) P1)) ("CombinedGroupCounts" if:(= (who at:(to)) P2))) (result P2 Win))} (result Mover Win))))) END |
Modify the Ludii game according to the following option changes:
The game has 3 players. -> The game has 4 players.
(define "MadeACompleteCircuit" (if (= 1 (state at:(where "Stick" Mover))) (is In (value Piece at:(where "Stick" Mover)) (sites Track "TrackCCW" from:("NextSite" (last From) "TrackCCW") to:(last To))) (is In (value Piece at:(where "Stick" Mover)) (sites Track "TrackCW" from:("NextSite" (last From) "TrackCW") to:(last To))))) (define "MoveOn" (if ("IsNotOffBoard" #1) (if (or (is Empty #1) ("IsEnemyAt" #1)) (move (from (from) level:(level)) (to #1 ("HittingCapture" (value Piece at:((to))))))))) (define "NextSite" ("NextSiteOnTrack" 1 from:#1 #2)) (define "SiteToMoveOnSelectedTrack" (if (= (state at:(from)) 1) ("NextSiteOnTrack" #1 "TrackCCW") ("NextSiteOnTrack" #1 "TrackCW"))) (define "ThrowValue" (mapEntry "ThrowDiceValue" (count Pips))) (game "Tsaydithl" (players 3) (equipment { ("FortyStonesWithFourGapsBoard" { (track "TrackCW" {39 35 33 31 29 27 25 23 21 19 38 17 15 13 11 9 7 5 3 1 37 0 2 4 6 8 10 12 14 16 36 18 20 22 24 26 28 30 32 34} loop:True) (track "TrackCCW" {39 34 32 30 28 26 24 22 20 18 36 16 14 12 10 8 6 4 2 0 37 1 3 5 7 9 11 13 15 17 38 19 21 23 25 27 29 31 33 35} loop:True)}) (piece "Stick" Each (or (if (= 2 ("ThrowValue")) ("MoveOn" ("SiteToMoveOnSelectedTrack" (- ("ThrowValue") 1)))) ("MoveOn" ("SiteToMoveOnSelectedTrack" ("ThrowValue"))))) (regions "Gates" (sites {36..39})) (map "ThrowDiceValue" {(pair 0 5) (pair 1 3) (pair 2 2) (pair 3 10)}) ("StickDice" 3) (hand Each)}) (rules (start { (place "Stick1" 36 state:1 value:36) (place "Stick2" 38 state:2 value:38) (place "Stick3" 37 state:1 value:37)}) (play ("RollMove" (forEach Piece))) (end (if ("MadeACompleteCircuit") (result Mover Win)))))
###
| (define "MadeACompleteCircuit" (if (= 1 (state at:(where "Stick" Mover))) (is In (value Piece at:(where "Stick" Mover)) (sites Track "TrackCCW" from:("NextSite" (last From) "TrackCCW") to:(last To))) (is In (value Piece at:(where "Stick" Mover)) (sites Track "TrackCW" from:("NextSite" (last From) "TrackCW") to:(last To))))) (define "MoveOn" (if ("IsNotOffBoard" #1) (if (or (is Empty #1) ("IsEnemyAt" #1)) (move (from (from) level:(level)) (to #1 ("HittingCapture" (value Piece at:((to))))))))) (define "NextSite" ("NextSiteOnTrack" 1 from:#1 #2)) (define "SiteToMoveOnSelectedTrack" (if (= (state at:(from)) 1) ("NextSiteOnTrack" #1 "TrackCCW") ("NextSiteOnTrack" #1 "TrackCW"))) (define "ThrowValue" (mapEntry "ThrowDiceValue" (count Pips))) (game "Tsaydithl" (players 4) (equipment { ("FortyStonesWithFourGapsBoard" { (track "TrackCW" {39 35 33 31 29 27 25 23 21 19 38 17 15 13 11 9 7 5 3 1 37 0 2 4 6 8 10 12 14 16 36 18 20 22 24 26 28 30 32 34} loop:True) (track "TrackCCW" {39 34 32 30 28 26 24 22 20 18 36 16 14 12 10 8 6 4 2 0 37 1 3 5 7 9 11 13 15 17 38 19 21 23 25 27 29 31 33 35} loop:True)}) (piece "Stick" Each (or (if (= 2 ("ThrowValue")) ("MoveOn" ("SiteToMoveOnSelectedTrack" (- ("ThrowValue") 1)))) ("MoveOn" ("SiteToMoveOnSelectedTrack" ("ThrowValue"))))) (regions "Gates" (sites {36..39})) (map "ThrowDiceValue" {(pair 0 5) (pair 1 3) (pair 2 2) (pair 3 10)}) ("StickDice" 3) (hand Each)}) (rules (start { (place "Stick1" 36 state:1 value:36) (place "Stick2" 38 state:2 value:38) (place "Stick3" 37 state:1 value:37) (place "Stick4" 39 state:2 value:39)}) (play ("RollMove" (forEach Piece))) (end (if ("MadeACompleteCircuit") (result Mover Win))))) END |
Construct a global Ludii definition which fulfills the following requirements.
Defines a custodial capture in all the directions specified (by default Adjacent) to capture an enemy piece. The enemy piece is removed.
###
| (define "CustodialCapture" (custodial (from (last To)) #1 (between #2 if:("IsEnemyAt" (between)) (apply (remove (between)))) (to if:("IsFriendAt" (to))) #3)) END |
Construct a Ludii game based on the following description
3x3 board. Each player plays with three Horse-shaped pieces, which begin on the row of squares closest to the player. Pieces move one space forward and one space diagonally, jumping over any intervening pieces. The first player to place their pieces in the squares where the opponent started wins.
###
| (game "Aralzaa" (players 2) (equipment { (board (square 3)) (piece "Knight" Each ("LeapToEmpty" "KnightWalk")) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start { (place "Knight1" (sites P1)) (place "Knight2" (sites P2))}) (play (forEach Piece)) (end ("FillWin" (sites Next))))) END |
Modify the Ludii game according to the following option changes:
Order 3-4, Hex Grid -> Order 4, Hex Grid
(define "AddOrPass" (or { (move Add (piece (id "Disc" Mover)) (to (sites Empty) if:(> 3 (count Pieces Mover in:(sites Around (to) "GridDirection")))) (then (set Var "Added" 1))) (move Pass)})) (define "Score4" (do (forEach Site (sites Occupied by:#1) (if (> 3 (count Pieces #1 in:(sites Around (site) "GridDirection"))) (set State at:(site) 0) (set State at:(site) 1))) next:(do (and { (remember Value 0) (remember Value 0) (forEach Group "GridDirection" (if (no Pieces in:(intersection (sites) (sites State 1))) (remember Value (count Sites in:(sites)))))}) next:(set Var "TopValue" (max (values Remembered)) (then (forget Value (max (values Remembered)) (then (set Score #1 (* (var "TopValue") (max (values Remembered))) (then (forget Value All)))))))))) (define "GridDirection" Orthogonal) (game "Wrigglers" (players 2) (equipment { (board (tri Limping 3) use:Vertex) (piece "Disc" Each)}) (rules (play (if (= 1 (var "Added")) (or { "AddOrPass" (forEach Piece (if (< 2 (count Pieces Mover in:(sites Around (from) "GridDirection"))) (move Remove (from) (then (set Var "Added" 0)))) Mover)}) "AddOrPass" (then ("Score4" Mover)))) (end (if (all Passed) { (if (>= (score Mover) (score Next)) (result Mover Win))} (result Next Win)))))
###
| (define "AddOrPass" (or { (move Add (piece (id "Disc" Mover)) (to (sites Empty) if:(> 3 (count Pieces Mover in:(sites Around (to) "GridDirection")))) (then (set Var "Added" 1))) (move Pass)})) (define "Score4" (do (forEach Site (sites Occupied by:#1) (if (> 3 (count Pieces #1 in:(sites Around (site) "GridDirection"))) (set State at:(site) 0) (set State at:(site) 1))) next:(do (and { (remember Value 0) (remember Value 0) (forEach Group "GridDirection" (if (no Pieces in:(intersection (sites) (sites State 1))) (remember Value (count Sites in:(sites)))))}) next:(set Var "TopValue" (max (values Remembered)) (then (forget Value (max (values Remembered)) (then (set Score #1 (* (var "TopValue") (max (values Remembered))) (then (forget Value All)))))))))) (define "GridDirection" Orthogonal) (game "Wrigglers" (players 2) (equipment { (board (tri Hexagon 4) use:Vertex) (piece "Disc" Each)}) (rules (play (if (= 1 (var "Added")) (or { "AddOrPass" (forEach Piece (if (< 2 (count Pieces Mover in:(sites Around (from) "GridDirection"))) (move Remove (from) (then (set Var "Added" 0)))) Mover)}) "AddOrPass" (then ("Score4" Mover)))) (end (if (all Passed) { (if (>= (score Mover) (score Next)) (result Mover Win))} (result Next Win))))) END |
Modify the Ludii game according to the following option changes:
The game is played with no constraint on the centre site. -> The constraint to move a piece adjacent to an enemy is applied only for the first move.
(define "MoveOnlyIfAdjacentToEnemy" (move Step (to if:(and ("IsEmpty") (is Related Adjacent (from) (sites Occupied by:Next)))))) (define "MoveOnlyIfAdjacentToEnemyOrCentre" (move Step (to if:(and ("IsEmpty") (or (not "Centre") (is Related Adjacent (from) (sites Occupied by:Next))))))) (define "Centre" (= (to) (centrePoint))) (define "IsEmpty" (is Empty (to))) (game "Mu Torere" (players 2) (equipment { (board (concentric {1 8}) use:Vertex) (piece "Marker" Each "StepToEmpty")}) (rules (start { (place "Marker1" {1..3 8}) (place "Marker2" {4..7})}) (play (forEach Piece)) (end ("NoMoves" Loss))))
###
| (define "MoveOnlyIfAdjacentToEnemy" (move Step (to if:(and ("IsEmpty") (is Related Adjacent (from) (sites Occupied by:Next)))))) (define "MoveOnlyIfAdjacentToEnemyOrCentre" (move Step (to if:(and ("IsEmpty") (or (not "Centre") (is Related Adjacent (from) (sites Occupied by:Next))))))) (define "Centre" (= (to) (centrePoint))) (define "IsEmpty" (is Empty (to))) (game "Mu Torere" (players 2) (equipment { (board (concentric {1 8}) use:Vertex) (piece "Marker" Each (if (> (count Moves) 1) "StepToEmpty" ("MoveOnlyIfAdjacentToEnemyOrCentre")))}) (rules (start { (place "Marker1" {1..3 8}) (place "Marker2" {4..7})}) (play (forEach Piece)) (end ("NoMoves" Loss)))) END |
Construct a Ludii game based on the following description
The game consists of a 5 by 5 grid of lights. When the game starts, some lights are switched on. Pressing any of the lights will toggle it and the four adjacent lights. The goal of the puzzle is to switch all the lights off, preferably in as few button presses as possible.
Ludii allows 100 moves maximum before losing.
###
| (game "Lights Out" (players 1) (equipment { (board (square 5)) (piece "Light" Shared)}) (rules (start (place Random {"Light"} count:(value Random (range 10 20)))) (play (move Select (from (sites Board)) (then (forEach Site (sites Around (last To) Orthogonal includeSelf:True) (if (is Occupied (site)) (remove (site)) (add (piece "Light") (to (site)))))))) (end { (if (all Sites (sites Board) if:(is Empty (site))) (result Mover Win)) (if (= 98 (counter)) (result Mover Loss))}))) END |
Construct a Ludii game based on the following description
A triangle, with a line drawn from the apex to the base. A rectangle intersects with the triangle, and has a line connecting the midpoints of the short sides. One player plays as the tiger(s), one to four in number. The other player plays as five to 23 goats (or dogs, or lambs). The tiger begins on the apex of the triangle, and any other tigers on the spots adjacent to the apex. The tiger player moves by moving a piece to an empty adjacent spot along the lines of the board. The goat player begins the game by placing a goat on an empty point on the board, and then the tiger player moves. When all of the goats are placed, they move like the tiger. The tiger may capture a goat by hopping over it to an empty spot on the opposite adjacent side of the goat along the lines of the board. The goats win by blocking the tiger(s) from being able to move; the tiger(s) win by capturing enough goats to prevent them from blocking it/them. 1 Tiger. 5 Goats.
###
| (game "Pulijudamu" (players 2) (equipment { (board (add (remove (merge (scale 1 2 (wedge 5 3)) (shift 0 2 (scale 8 2 (rectangle 3 2)))) edges:{{17 18} {15 16} {13 14}}) edges:{{13 7} {15 4} {17 1} {3 18} {6 16} {9 14}}) use:Vertex) (hand Each) (piece "Goat" P2 ("StepToEmpty")) (piece "Tiger" P1 (or ("StepToEmpty") ("HopCapture")))}) (rules (start { (place "Goat2" (handSite P2) count:5) (place "Tiger1" (handSite P1) count:1)}) phases:{ (phase "Opening" P1 (play (move (from (handSite Mover)) (to (if (= 0 (count Sites in:(intersection (sites Top) (sites Occupied by:Mover)))) (sites Top) (intersection (sites Empty) (sites {1 2 3})))) (then (if ("HandOccupied" Mover) (moveAgain))))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) (phase "Opening" P2 (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) ("PhaseMovePiece" "Movement")} (end ("NoMovesP1NoPiecesP2")))) END |
Construct a Ludii game based on the following description
Twenty squares arranged in a cross shape, with diagonals in each square. The pieces are played on the intersections of the lines. Two foxes are placed on the outer corners of one of the arms of the cross, and twenty geese are placed on the points in the opposite arm, as well as the first two long lines in the perpendicular arms. Players alternate turns moving a piece to an empty spot along the lines on the board. The geese cannot move backward. The foxes may hop over a goose to an empty adjacent spot immediately on the opposite side of it along the lines on the board. The geese win by blocking the foxes from being able to move. The foxes win by capturing all the geese.
###
| (game "Gasetavl" (players 2) (equipment { ("CrossBoard" 3 7 use:Vertex diagonals:Solid) (piece "Fox" P1 (or ("HopCapture") ("StepToEmpty"))) (piece "Geese" P2 N ("StepToEmpty" (directions {Rightward Forwards Leftward})))}) (rules (start { (place "Fox1" (sites {"G9" "I7"})) (place "Geese2" (sites {"A3" "B2" "C1" "B4" "C3" "D2" "A7" "B6" "C5" "D4" "E3" "F2" "G1" "B8" "C7" "D6" "E5" "F4" "G3" "H2"}))}) (play (forEach Piece)) (end ("NoMovesP1NoPiecesP2")))) END |
Construct a Ludii game based on the following description
2x6 board with two store holes on either end. Play begins with four counters in each row. For the opening move, a player may take all of the counters in one hole and add them to the next hole. Play continues with players sowing from any one of the holes in their row in an anti-clockwise direction. If a sowing reaches the hole from which the sowing began, this hole is skipped. If the final counter falls in a hole containing three counters, thus making it contain four counters, these are captured. An unbroken sequence of holes containing four counters moving backwards from the final hole are also captured. Single counters cannot be sown. If a player cannot move, the opponent must sow in a way that allows them to play on the next turn. Play continues until one player has no counters on their side of the board. The player with the most captured counters wins.
###
| (define "PiecesOwnedBy" (+ (count at:(mapEntry #1)) (count in:(sites #1)))) (define "NoMovesNext" (if (is Mover P1) (not (and { (< (count at:7) 2) (< (count at:8) 2) (< (count at:9) 2) (< (count at:10) 2) (< (count at:11) 2) (< (count at:12) 2)})) (not (and { (< (count at:1) 2) (< (count at:2) 2) (< (count at:3) 2) (< (count at:4) 2) (< (count at:5) 2) (< (count at:6) 2)})))) (game "English Wari (St. Lucia)" (players 2) (equipment { (mancalaBoard 2 6 (track "Track" "1,E,N,W" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 FirstSite) (pair P2 LastSite)}) (piece "Seed" Shared)}) (rules (start (set Count 4 to:(sites Track))) phases:{ (phase "Init" (play (move Select (from (sites Mover)) (then (fromTo (from (last To)) (to ("NextSiteOnTrack" 1 from:(last To))) count:(count at:(last To)))))) (nextPhase (= (next) 1) "Sowing")) (phase "Sowing" (play (do (move Select (from (sites Mover) if:(> (count at:(from)) 1)) (then (sow if:(= (count at:(to)) 4) apply:(fromTo (from (to)) (to (mapEntry (mover))) count:(count at:(to))) includeSelf:False backtracking:True))) ifAfterwards:"NoMovesNext")))} (end ("MancalaByScoreWhen" (no Moves Mover))))) END |
Construct a Ludii game based on the following description
GOAL
Get your king into the enemy home square, or kill the enemy king.
MOVES
Players make one move per turn, starting with Red. There are three possible
types of moves, explained below. Players will always have a move available,
and must make one. Passing is not allowed.
NON-CAPTURING MOVES
Kings and courtesans can move to an adjacent, unoccupied square in any of
the three forward directions.
CAPTURING MOVES
Kings and courtesans can move to an adjacent, enemy occupied square in any
of eight directions, capturing the enemy king or courtesan by replacement.
EXCHANGE MOVE
You can transfer the top checker of your king onto an adjacent, friendly
courtesan in any of the three forward directions, thus exchanging king and
courtesan.
In the Ludii implementation, the king is controlled like this:
To make an exchange move you must drag or click the top piece.
To make a step/capture move, you must drag or click the bottom piece. A size 6 board is currently selected
###
| (game "King And Courtesan" ("TwoPlayersNorthSouth") (equipment { (board (rotate 45 (square 6))) (piece "Disc" Each (or { ("StepToEmpty" Forwards stack:True) (move Step (to if:("IsEnemyAt" (to)) (apply (and (if (= 2 (size Stack at:(to))) (set Var "NextLoss" 1)) (remove (to) count:(size Stack at:(to)))))) stack:True) (move Step (from if:(= 2 (size Stack at:(from)))) Forwards (to if:(is Mover (who at:(to)))))}))}) (rules (start { (place "Disc1" (expand (sites Bottom) steps:(- 6 2) Orthogonal)) (place "Disc2" (expand (sites Top) steps:(- 6 2) Orthogonal)) (place Stack "Disc1" (sites Bottom)) (place Stack "Disc2" (sites Top))}) (play (forEach Piece top:True)) (end { (if (= 1 (var "NextLoss")) (result Next Loss)) (if (or (and (= (id P1) (who at:(- (* 6 6) 1))) (= 2 (size Stack at:(- (* 6 6) 1)))) (and (= (id P2) (who at:0)) (= 2 (size Stack at:0)))) (result Mover Win))}))) END |
Modify the Ludii game according to the following option changes:
12 Holes per row. -> 15 Holes per row.
(define "NextHoleFrom" ("NextSiteOnTrack" 1 from:#1 #2)) (define "AHoleHasMoreThanOneCounter" (not (all Sites (forEach (sites Mover) if:(< 1 (count at:(site)))) if:(= 0 (count at:(site)))))) (define "LastHoleSowed" (sites {(var)})) (define "NoPiece" (all Sites (sites Player "Home") if:(= 0 (count at:(site))))) (define "Columns" 12) (game "Misoro Tsoro" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "Track1" "0,E,N1,W" loop:True P1) (track "Track2" "24,E,N1,W" loop:True P2)}) (regions "Home" P1 (sites Track "Track1")) (regions "Home" P2 (sites Track "Track2")) (regions "Inner" P1 (difference (sites Track "Track1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "Track2") (sites Top))) (regions "Outer" P1 (sites Bottom)) (regions "Outer" P2 (sites Top)) (piece "Seed" Shared)}) (rules (start (set Count 2 to:(union (sites Top) (sites Bottom)))) phases:{ (phase "Misoro" (play (move Select (from (forEach (sites Mover "Outer") if:(= 0 (state at:(site))))) (then (set State at:(last To) (mover))))) (nextPhase (= 4 (count Turns)) "Playing")) (phase "Playing" (play (or (if (and (!= 0 (state at:(var))) ("SameTurn")) (move Pass)) (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover "Home")) if:(if "AHoleHasMoreThanOneCounter" (> (count at:(from)) 1) (and (= (count at:(from)) 1) (= 0 (count at:("NextHoleFrom" (from) Mover)))))) (then (and (sow "Track" owner:(mover) apply:(if (= (count at:(to)) 1) (if (is In (to) (sites Mover "Inner")) (if (> (count at:("OppositePit" (to))) 0) (and (remove ("OppositePit" (to))) (if (> (count at:("OppositeOuterPit" (to))) 0) (remove ("OppositeOuterPit" (to))))))) (and (moveAgain) (set Var (to))))) (forEach Site (sites Board) (if (!= 0 (state at:(site))) (set State at:(site) (state at:(site)))))))))))} (end (forEach NonMover if:("NoPiece") (result Player Loss)))))
###
| (define "NextHoleFrom" ("NextSiteOnTrack" 1 from:#1 #2)) (define "AHoleHasMoreThanOneCounter" (not (all Sites (forEach (sites Mover) if:(< 1 (count at:(site)))) if:(= 0 (count at:(site)))))) (define "LastHoleSowed" (sites {(var)})) (define "NoPiece" (all Sites (sites Player "Home") if:(= 0 (count at:(site))))) (define "Columns" 15) (game "Misoro Tsoro" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "Track1" "0,E,N1,W" loop:True P1) (track "Track2" "30,E,N1,W" loop:True P2)}) (regions "Home" P1 (sites Track "Track1")) (regions "Home" P2 (sites Track "Track2")) (regions "Inner" P1 (difference (sites Track "Track1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "Track2") (sites Top))) (regions "Outer" P1 (sites Bottom)) (regions "Outer" P2 (sites Top)) (piece "Seed" Shared)}) (rules (start (set Count 2 to:(union (sites Top) (sites Bottom)))) phases:{ (phase "Misoro" (play (move Select (from (forEach (sites Mover "Outer") if:(= 0 (state at:(site))))) (then (set State at:(last To) (mover))))) (nextPhase (= 4 (count Turns)) "Playing")) (phase "Playing" (play (or (if (and (!= 0 (state at:(var))) ("SameTurn")) (move Pass)) (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover "Home")) if:(if "AHoleHasMoreThanOneCounter" (> (count at:(from)) 1) (and (= (count at:(from)) 1) (= 0 (count at:("NextHoleFrom" (from) Mover)))))) (then (and (sow "Track" owner:(mover) apply:(if (= (count at:(to)) 1) (if (is In (to) (sites Mover "Inner")) (if (> (count at:("OppositePit" (to))) 0) (and (remove ("OppositePit" (to))) (if (> (count at:("OppositeOuterPit" (to))) 0) (remove ("OppositeOuterPit" (to))))))) (and (moveAgain) (set Var (to))))) (forEach Site (sites Board) (if (!= 0 (state at:(site))) (set State at:(site) (state at:(site)))))))))))} (end (forEach NonMover if:("NoPiece") (result Player Loss))))) END |
Construct a Ludii game based on the following description
Each turn the players will put one of their pieces on the boardgame. It's forbidden to put a shape in a line, a column or an area on which this same form has already been posed by the opponent. We can only double a shape if we have played the previous one ourself. The first player who places the fourth different form in a row, column or zone wins the game immediately, no matter who owns the other pieces of that winning move.
###
| (define "AllDifferent" (all Different #1 if:(is Occupied (site)))) (define "NotSameSquare" (if (is In (to) (sites "BottomLeft")) ("NotSameRegion" "BottomLeft") (if (is In (to) (sites "BottomRight")) ("NotSameRegion" "BottomRight") (if (is In (to) (sites "TopLeft")) ("NotSameRegion" "TopLeft") ("NotSameRegion" "TopRight"))))) (define "NotSameRegion" (all Sites (sites #1) if:(!= (what at:(site)) (mapEntry (what at:(from)))))) (define "NotSameColumn" (all Sites (sites Column (column of:(to))) if:(!= (what at:(site)) (mapEntry (what at:(from)))))) (define "NotSameRow" (all Sites (sites Row (row of:(to))) if:(!= (what at:(site)) (mapEntry (what at:(from)))))) (game "Quantik" (players 2) (equipment { (board (square 4) use:Vertex) (piece "Disc" Each) (piece "Square" Each) (piece "Triangle" Each) (piece "Hex" Each) (regions "BottomLeft" (expand origin:(coord "A1") All)) (regions "BottomRight" (expand origin:(coord "D1") All)) (regions "TopLeft" (expand origin:(coord "A4") All)) (regions "TopRight" (expand origin:(coord "D4") All)) (hand Each size:4) (map { (pair (id "Disc1") (id "Disc2")) (pair (id "Disc2") (id "Disc1")) (pair (id "Square1") (id "Square2")) (pair (id "Square2") (id "Square1")) (pair (id "Triangle1") (id "Triangle2")) (pair (id "Triangle2") (id "Triangle1")) (pair (id "Hex1") (id "Hex2")) (pair (id "Hex2") (id "Hex1"))})}) (rules (start { (place "Disc1" (handSite P1) count:2) (place "Disc2" (handSite P2) count:2) (place "Square1" (handSite P1 1) count:2) (place "Square2" (handSite P2 1) count:2) (place "Triangle1" (handSite P1 2) count:2) (place "Triangle2" (handSite P2 2) count:2) (place "Hex1" (handSite P1 3) count:2) (place "Hex2" (handSite P2 3) count:2)}) (play (move (from (sites Occupied by:Mover container:(mover))) (to (sites Empty) if:(and { "NotSameRow" "NotSameColumn" "NotSameSquare"})))) (end (if (or { ("AllDifferent" (sites "BottomLeft")) ("AllDifferent" (sites "BottomRight")) ("AllDifferent" (sites "TopLeft")) ("AllDifferent" (sites "TopRight")) ("AllDifferent" (sites Row 0)) ("AllDifferent" (sites Row 1)) ("AllDifferent" (sites Row 2)) ("AllDifferent" (sites Row 3)) ("AllDifferent" (sites Column 0)) ("AllDifferent" (sites Column 1)) ("AllDifferent" (sites Column 2)) ("AllDifferent" (sites Column 3)) (no Moves Next)}) (result Mover Win))))) END |
Construct a Ludii game based on the following description
4x8 board. Two counters in each hole. Each player may sow in either direction on their first move, but must continue in the same direction for the remainder of the game. When the final counter of a sowing lands in an occupied hole, the counters in that hole are picked up and sowing continues. If the final hole of a sowing is in the inner row, regardless of whether it is occupied or empty, the player then captures the counters in both of the opponent's holes opposite it, and continues sowing with these counters as well as the ones in the final hole of sowing. Captures cannot be made when the final hole of a sowing was empty, and the opponent's opposite holes have only a single counter. When the final counter lands in an empty hole, the turn is over. The player who captures all the counters wins.
###
| (define "Columns" 8) (game "Katra Boaoaka" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "TrackCCW1" "0,E,N1,W" loop:True P1) (track "TrackCCW2" "16,E,N1,W" loop:True P2) (track "TrackCW1" "7,W,N1,E" loop:True P1) (track "TrackCW2" "24,E,S1,W" loop:True P2)}) (regions "Home" P1 (sites Track "TrackCCW1")) (regions "Home" P2 (sites Track "TrackCCW2")) (regions "Inner" P1 (difference (sites Track "TrackCCW1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "TrackCCW2") (sites Top))) (piece "Seed" Shared) (hand Each)}) (rules (start (set Count 2 to:(union (sites P1 "Home") (sites P2 "Home")))) (play (or (if (!= (value Player Mover) 2) (move Select (from (if ("SameTurn") (sites {(var "Replay")}) (sites Mover "Home")) if:(> (count at:(from)) 0)) (then (and (sow "TrackCCW" owner:(mover) apply:(and (if (< 1 (count at:(to))) (and (moveAgain) (set Var "Replay" (to)))) (if (is In (to) (sites Mover "Inner")) (if (not (and { (= 1 (count at:(to))) (= 1 (count at:("OppositePit" (to)))) (= 1 (count at:("OppositeOuterPit" (to))))})) (if (or (is Occupied ("OppositePit" (to))) (is Occupied ("OppositeOuterPit" (to)))) (and { (fromTo (from ("OppositePit" (to))) (to (to)) count:(count at:("OppositePit" (to)))) (fromTo (from ("OppositeOuterPit" (to))) (to (to)) count:(count at:("OppositeOuterPit" (to)))) (if (= 1 (count at:(to))) (and (moveAgain) (set Var "Replay" (to))))})))))) (if (!= (value Player Mover) 1) (set Value Mover 1)))))) (if (!= (value Player Mover) 1) (move Select (from (if ("SameTurn") (sites {(var "Replay")}) (sites Mover "Home")) if:(> (count at:(from)) 0)) (then (and (sow "TrackCW" owner:(mover) apply:(and (if (< 1 (count at:(to))) (and (moveAgain) (set Var "Replay" (to)))) (if (is In (to) (sites Mover "Inner")) (if (not (and { (= 1 (count at:(to))) (= 1 (count at:("OppositePit" (to)))) (= 1 (count at:("OppositeOuterPit" (to))))})) (if (or (is Occupied ("OppositePit" (to))) (is Occupied ("OppositeOuterPit" (to)))) (and { (fromTo (from ("OppositePit" (to))) (to (to)) count:(count at:("OppositePit" (to)))) (fromTo (from ("OppositeOuterPit" (to))) (to (to)) count:(count at:("OppositeOuterPit" (to)))) (if (= 1 (count at:(to))) (and (moveAgain) (set Var "Replay" (to))))})))))) (if (!= (value Player Mover) 2) (set Value Mover 2)))))))) (end "ForEachNonMoverNoMovesLoss"))) END |
Construct a global Ludii definition which fulfills the following requirements.
Move again if the last `to' position just made a line of 3.
###
| (define "ReplayIfLine3" (if (is Line 3 #1 #2) (moveAgain))) END |
Construct a Ludii game based on the following description
Each player has three pieces.
Players take turns moving a piece to an empty dot.
Players cannot return to their starting three dots.
Pieces that move into the opponent’s starting three dots cannot exit them.
A player wins by blocking the other player from being able to move.
###
| (define "MoveSomewhereElseButInOurHome" (and (not (is In (from) (sites Next))) (if (not (is In (from) (sites Mover))) (is In (to) (difference (sites Empty) (sites Mover))) (is Empty (to))))) (define "MoveInTheEnemyHome" (and { (is In (from) (sites Next)) (is In (to) (sites Next)) (is Empty (to))})) (game "Ho-Bag Gonu" (players 2) (equipment { (board (add (merge { (rectangle 1 3) (shift 1 1 (scale 0.5 (concentric {1 4}))) (shift 0 2 (rectangle 1 3))}) edges:{{5 1} {9 7}}) use:Vertex) (piece "Disc" Each (move Step (to if:(or "MoveInTheEnemyHome" "MoveSomewhereElseButInOurHome")))) (regions "Home" P1 (sites {"A1" "C1" "E1"})) (regions "Home" P2 (sites {"A5" "C5" "E5"}))}) (rules (start { (place "Disc1" (sites P1)) (place "Disc2" (sites P2))}) (play (forEach Piece)) (end ("NoMoves" Loss)))) END |
Construct a Ludii game based on the following description
3x8 board. Eight pieces per player, which start in the spaces of the outer rows of the board. Four cowrie shells used as dice, the number of mouths face up being the value of the throw. A throw of 1 grants the player another throw. A player must throw 1 for the first move of each of their pieces. Players may only play with one piece out of the home row at a time and cannot move the next of their pieces until the piece being played has been captured. Throws of 1 must be used to move a piece in the home row, if possible. Pieces move from left to right in the player's home row, then from right to left in the central row, left to right in the opponent's home row, and right to left in the central row. When a piece lands on a space occupied by an opponent's piece, the opponent's piece is captured. The player who captures all of the opponent's pieces wins.
###
| (define "Move" (if (and { (if ("PieceActivated" (from)) True (= 1 ("ThrowValue"))) #1}) (if (and (not ("IsFriendAt" ("NextSiteOnTrack" ("ThrowValue")))) ("OnlyOnePieceMovingOutOfHome")) (move (from) (to ("NextSiteOnTrack" ("ThrowValue")) "CaptureEnemyPiece") (then (if (and (not ("PieceActivated" (last To))) (= 1 ("ThrowValue"))) ("ActivatePiece" (last To)))))))) (define "OnlyOnePieceMovingOutOfHome" (if (not ("SiteInHome" (from))) True (if ("SiteInHome" ("NextSiteOnTrack" ("ThrowValue"))) True (= ("CountOwnPiecesOutHome") 0)))) (define "CountOwnPiecesOutHome" (count Pieces Mover in:(difference (sites Board) (sites Mover "Home")))) (define "SiteInHome" (is In #1 (sites Mover "Home"))) (define "PieceActivated" (!= 0 (state at:#1))) (define "ActivatePiece" (set State at:#1 1)) (define "CaptureEnemyPiece" (apply if:("IsEnemyAt" (to)) (remove (to)))) (define "ThrowValue" (count Pips)) (game "Bheri Bakhri" (players 2) (equipment { (board (rectangle 3 8) { (track "Track1" "0,E,N1,W,N1,E,S1,W" loop:True P1) (track "Track2" "23,W,S1,E,S1,W,N1,E" loop:True P2)}) ("StickDice" 4) (piece "Marker" Each ("Move")) (regions "Home" P1 (sites Bottom)) (regions "Home" P2 (sites Top))}) (rules (start { (place "Marker1" (sites Bottom)) (place "Marker2" (sites Top))}) (play ("RollMove" (if (= 1 ("ThrowValue")) (priority { (forEach Piece ("Move" (is In (from) (sites Mover "Home")))) (forEach Piece)}) (forEach Piece)) (then (if (= 1 ("ThrowValue")) (moveAgain))))) (end ("CaptureAll" Next)))) END |
Construct a Ludii game based on the following description
The game LastEdge can be played in an undirected and unweighted graph. The edge colours are related to the playing rules of each version. For the basic version, LastEdge all the edges are in the same colour (green). At each turn, a player selects a vertex, which contains at least one green edge and after each turn, all the edges of the selected vertex are removed. The game is over when there are no green edges in the graph. The second version is the Red blue version (LastEdgeR-B). There are one red player and one blue player. The players can select only those vertices, that contain at least one friendly edge. After each turn, all the edges (any colour) of the selected vertex are removed. The last version is LastEdgeR-G-B; there is a graph with red, green, and blue edges. The players can select a vertex, which has at least one friendly colour or shared colour edge. Importantly, the green edges are used as shared edges between both players. After each turn, all the edges (any colour) of the selected vertex are removed. For all the versions of LastEdge, if the current player has no move, then the opponent player wins. The game is played on the Graph1. The players play on LastEdge version.
###
| (game "LastEdge" (players 2) (equipment { (board (graph vertices:{ {0 0} {0 1} {0 2} {0 3} {0 4} {1 0} {1 1} {1 2} {1 3} {1 4} {2 0} {2 1} {2 2} {2 3} {2 4} {3 0} {3 1} {3 2} {3 3} {3 4} {4 0} {4 1} {4 2} {4 3} {4 4}} edges:{ {0 1} {0 5} {1 6} {1 2} {2 7} {2 3} {3 8} {3 4} {4 9} {5 6} {5 10} {6 11} {6 7} {7 12} {7 8} {8 13} {8 9} {9 14} {10 11} {11 12} {12 13} {13 14} {10 15} {11 16} {12 17} {13 18} {14 19} {15 16} {15 20} {16 21} {20 21} {16 17} {17 22} {21 22} {17 18} {18 23} {22 23} {18 19} {19 24} {23 24}}) use:Vertex) (piece "Disc" Each) (piece "Marker" Shared)}) (rules (start { (set Shared Edge (sites Board Edge))}) (play (forEach Site (sites Board) (if (> (count Sites in:(sites Incident Edge of:Vertex at:(to) Shared)) 0) (move Add (to (intersection (sites Empty) (sites {(to)}))) (then (forEach Site (sites Incident Edge of:Vertex at:(last To)) (remove Edge (to)))))))) (end ("BlockWin")))) END |
Describe the mechanics of the following Ludii game
(define "PreviousHole" ("NextSiteOnTrack" 1 from:(from) "TrackCW")) (define "NoPiece" (all Sites (sites Player) if:(= 0 (count at:(site))))) (define "Columns" 13) (game "Tsoro (Baia)" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "TrackCCW1" "0,E,N1,W" loop:True P1) (track "TrackCCW2" "26,E,N1,W" loop:True P2) (track "TrackCW1" "12,W,N1,E" loop:True P1) (track "TrackCW2" "39,E,S1,W" loop:True P2)}) (regions "Home" P1 (sites Track "TrackCCW1")) (regions "Home" P2 (sites Track "TrackCCW2")) (regions "Inner" P1 (difference (sites Track "TrackCCW1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "TrackCCW2") (sites Top))) (regions "Outer" P1 (sites Bottom)) (regions "Outer" P2 (sites Top)) (regions "FirstMove" P1 (difference (expand (intersection (difference (sites Track "TrackCCW1") (sites Bottom)) (sites Left)) steps:2 E) (expand (intersection (difference (sites Track "TrackCCW1") (sites Bottom)) (sites Left)) E))) (regions "FirstMove" P2 (difference (expand (intersection (difference (sites Track "TrackCCW2") (sites Top)) (sites Right)) steps:2 W) (expand (intersection (difference (sites Track "TrackCCW2") (sites Top)) (sites Right)) W))) (piece "Seed" Shared) (hand Each)}) (rules (start { (set Count 2 to:(difference (sites P1 "Outer") (sites Left))) (set Count 2 to:(difference (sites P2 "Outer") (sites Right))) (set Count 2 to:(difference (sites P1 "Inner") (expand (sites Left)))) (set Count 2 to:(difference (sites P2 "Inner") (expand (sites Right)))) (set Count 1 to:(difference (sites P1 "Inner") (union (sites Left) (difference (sites P1 "Inner") (expand (sites Left)))))) (set Count 1 to:(difference (sites P2 "Inner") (union (sites Right) (difference (sites P2 "Inner") (expand (sites Right))))))}) phases:{ (phase "FirstTurn" (play (if (>= 0 (var "FreeCapture")) (move Select (from (sites Mover "FirstMove")) (then (sow "TrackCCW" owner:(mover) apply:(if (is In (to) (sites Mover "Inner")) (if (is Occupied ("OppositePit" (to))) (and { (fromTo (from ("OppositePit" (to))) (to (handSite Mover)) count: (count at:("OppositePit" (to)))) (if (is Occupied ("OppositeOuterPit" (to))) (fromTo (from ("OppositeOuterPit" (to))) (to (handSite Mover)) count: (count at:("OppositeOuterPit" (to))))) (set Value Mover (+ 1 (value Player Mover))) (set Var "FreeCapture" 5) (moveAgain)})))))) (move (from (sites Next "Home") if:(and (is Occupied (from)) (not (is In (from) (sites Next "FirstMove"))))) (to (handSite Mover)) count:(count at:(from)) (then (and (set Var "FreeCapture" (- (var "FreeCapture") 1)) (if (< 1 (var "FreeCapture")) (moveAgain))))))) (nextPhase Mover (not (is Next Mover)) "Main")) (phase "Main" (play (if (>= 0 (var "FreeCapture")) (or (move Select (from (if ("SameTurn") (sites {(var "Replay")}) (sites Mover "Home")) if:(and (< 1 (count at:(from))) (if ("SameTurn") True (is Empty ("PreviousHole"))))) (then (sow "TrackCCW" owner:(mover) apply:(if (< 1 (count at:(to))) (and { (moveAgain) (set Var "Replay" (to))}) (if (is In (to) (sites Mover "Inner")) (if (is Occupied ("OppositePit" (to))) (and { (fromTo (from ("OppositePit" (to))) (to (handSite Mover)) count: (count at:("OppositePit" (to)))) (if (is Occupied ("OppositeOuterPit" (to))) (fromTo (from ("OppositeOuterPit" (to))) (to (handSite Mover)) count: (count at:("OppositeOuterPit" (to))))) (set Value Mover (+ 1 (value Player Mover))) (if (= 0 (value Player Mover)) (set Var "FreeCapture" 3) (set Var "FreeCapture" 2)) (moveAgain)}))))))) (move Select (from (if ("SameTurn") (sites {(var "Replay")}) (sites Mover "Home")) if:(and (= 1 (count at:(from))) (if ("SameTurn") True (is Empty ("PreviousHole"))))) (then (sow "TrackCCW" owner:(mover) apply:(if (< 1 (count at:(to))) (and { (moveAgain) (set Var "Replay" (to))})))))) (move (from (sites Next "Home") if:(and (is Occupied (from)) (not (is In (from) (sites Next "FirstMove"))))) (to (handSite Mover)) count:(count at:(from)) (then (and (set Var "FreeCapture" (- (var "FreeCapture") 1)) (if (< 1 (var "FreeCapture")) (moveAgain))))))))} (end (forEach NonMover if:("NoPiece") (result Player Loss)))))
###
| 4x13-19 board. Two counters in every hole, except the leftmost in both of a player's rows, which are empty, and the second from the left in the inner row, which has one. Sowing occurs in an anti-clockwise direction. When the final counter lands in an occupied hole, these counters are picked up and sowing continues. Captures are made when the final counters lands in an empty hole in the inner row, capturing the contents of the opponent's opposite inner row hole, as well as the contents of the outer row hole only if there was a capture from the inner row hole. Captures from extra holes are also made, which are graduated based on the number of captures the player has made. On their first turn, players sow from the third hole from the left in the front row. This triggers a capture of the counters in the opposite holes in the opponent's inner and outer rows, plus the contents of any other five holes on the opponent's side of the board. In subsequent turns, sowing must occur from a hole which follows an empty hole according to the circuit of the holes. On their second capture, the player captures three extra holes. All other subsequent captures capture from two extra holes. Sowing a single counter cannot result in a capture. The player who captures all of their opponent's counters wins. Each row has 13 holes. END |
Construct a Ludii game based on the following description
2x6 board. Four counters in each hole. Players sow from any of the holes in their row in an anti-clockwise direction. When the final counter of a sowing falls into an occupied hole (except in the scenario below), these are picked up and sowing continues. If the final counter falls into either an empty hole or one of the opponent's holes with three counters, making that hole now have four counters, the sowing ends. When the final counter falls into a hole in the opponent's row containing four counters after sowing concludes, this hole is marked. If a player sows their final counter into their opponent's marked hole, the final counter and one of the counters in the hole are captured. The player then gets another turn. If the final counter falls into a player's own marked hole, the turn ends. The contents of marked holes cannot be sown. The game ends when only marked holes contain counters. These are then captured by the players who marked them. A new game begins. The player with the most counters places four in each hole beginning from the left hole in their row. Each hole that contains four counters is owned by that player for the new round. If the player has three counters remaining after filling as many holes with four as possible, they borrow one counter from the opponent to make four and own the corresponding hole. If there are two or one remaining, the opponent borrows these to fill and own the last hole. Play continues until one player owns no more holes.
###
| (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 "NumCapturedPieces" (+ (count Cell at:(handSite #1)) (count in:("SitesMarkedBy" #1)))) (define "SitesMarkedBy" (forEach (sites Board) if:(= #1 (state at:(site))))) (define "OnlyPiecesInMarked" (all Sites (forEach (sites Board) if:(= 0 (state at:(site)))) if:(= 0 (count at:(site))))) (define "OwnedHoles" (if (is Mover P1) (sites (values Remembered "OwnedP1")) (sites (values Remembered "OwnedP2")))) (game "Um el Banat" (players 2) (equipment { (mancalaBoard 2 6 store:None (track "Track" "0,E,N,W" loop:True)) (regions "Home" P1 (sites Bottom)) (regions "Home" P2 (sites Top)) (piece "Seed" Shared) (hand Each) (map "LeftMost" {(pair P1 0) (pair P2 11)})}) (rules (start { (set Count 4 to:(sites Track)) (set RememberValue "OwnedP1" (sites Bottom)) (set RememberValue "OwnedP2" (sites Top))}) phases:{ (phase "Sowing" (play (or { (move Select (from (if (and ("SameTurn") (= 1 (var "ContinueSowing"))) ("LastHoleSowed") ("OwnedHoles")) if:(and (< 0 (count at:(from))) (= 0 (state at:(from))))) (then (sow apply: (if (= (next) (state at:(to))) (and { (move (from (to)) (to (handSite Mover)) count:(min 2 (count at:(to)))) (moveAgain) (set Var "ContinueSowing" 0)}) (if (= (mover) (state at:(to))) (set Var "ContinueSowing" 0) (if (and (< 1 (count at:(to))) (!= 4 (count at:(to)))) (and (moveAgain) (set Var "ContinueSowing" 1)) (if (and (= 4 (count at:(to))) (not (is In (sites Mover "Home")))) (and (set State at:(to) (mover)) (set Var "ContinueSowing" 0)))))))))} (then (if ("OnlyPiecesInMarked") (and { (forEach Site ("SitesMarkedBy" 1) (fromTo (from (site)) (to (handSite P1)) count:(count at:(site)))) (forEach Site ("SitesMarkedBy" 2) (fromTo (from (site)) (to (handSite P2)) count:(count at:(site)))) (forget Value "OwnedP1" All) (forget Value "OwnedP2" All) (if (>= ("NumCapturedPieces" 1) ("NumCapturedPieces" 2)) (set NextPlayer (player 1)) (set NextPlayer (player 2)))}))))) (end (if ("NoPieceOnBoard") { (if (= 0 (count Cell at:(handSite P1))) (result P2 Win)) (if (= 0 (count Cell at:(handSite P2))) (result P1 Win))})) (nextPhase ("NoPieceOnBoard") "BetweenRounds")) (phase "BetweenRounds" (play (if (<= 4 (count Cell at:(handSite Mover))) (move (from (handSite Mover)) (to ("LeftMostEmpty")) count:4 (then (and { ("RemmemberOwnedHoles" (last To)) (if (<= 4 (count Cell at:(handSite Mover))) (moveAgain) (if (= 3 (count Cell at:(handSite Mover))) (and { (fromTo (from (handSite Mover)) (to ("LeftMostEmpty")) count:3) (fromTo (from (handSite Next)) (to ("LeftMostEmpty")) count:1) ("RemmemberOwnedHoles" ("LeftMostEmpty"))}) (fromTo (from (handSite Mover)) (to (handSite Next)) count:(count Cell at:(handSite Mover)))))}))))) (nextPhase (and (is Empty (handSite P1)) (is Empty (handSite P2))) "Sowing"))})) END |
What does the following global Ludii definition do?
(define "OppositeOuterPit" (if (is Mover P1) (+ #1 (* "Columns" 2)) (- #1 (* "Columns" 2))))
###
| Returns the index of the outer opposite pit on a mancala board with four rows. This ludemeplex is working only if the description is defining "Columns" as the number of holes of the board. END |
Describe the mechanics of the following Ludii game
(game "Dash Guti" (players 2) (equipment { (board (add (merge { (wedge 4) (shift 0 3 (rotate 180 (wedge 4)))}) vertices:{{0 3} {6 3}} edges:{{7 19} {19 18} {0 19} {0 20} {20 16} {20 9}}) use:Vertex) (piece "Counter" Each (or ("HopCapture") ("StepToEmpty")))}) (rules (start { (place "Counter1" (union {(sites Row 0) (sites Row 1) (sites Row 2) (intersection (sites Row 3) (sites Left))})) (place "Counter2" (union {(sites Row 6) (sites Row 5) (sites Row 4) (intersection (sites Row 3) (sites Right))}))}) (play (forEach Piece)) (end ("NoMoves" Loss))))
###
| Each player lays out the pieces on the board on the intersections of the lines, each filling all the intersections of the triangle closest to the player, plus the extra intersection to their right. Play moves to the next adjacent intersection connected by a line. Opponent's pieces can be captured by hopping over them. The player who captures all of the opponent's pieces wins. END |
Construct a Ludii game based on the following description
There are 30 game-pieces for each player and eleven castles. The gameboard is divided into three sections: homes and center section. Object of the game is to capture four castles (among those of the central section and the other side) or 28 pawns of your opponent. In a turn a player moves one of their pieces, horizontally, vertically. A pawn can step to an adjacent empty cell. Additionally a pawn can jump over another pawn as long as the square behind that pawn is free. Multiple jumps are allowed and all enemy pawns are captured this way and removed from the deck. A pawn can capture a maximum of five enemy pieces, and his movement ends after the fifth piece is captured. A castle is conquered when it is surrounded by three pawns.
###
| (define "StorageMiddleCastle" (handSite Mover 1)) (define "StorageRightCastle" (handSite Mover 2)) (define "StorageLeftCastle" (handSite Mover)) (define "CaptureCastleAndStoreItTo" (surround (from (last To)) Orthogonal (between if:(= (what at:(between)) (id "Castle0")) (apply (fromTo (from (between)) (to #1)))) (to if:("IsFriendAt" (to))) except:1)) (define "JumpAgain" (move Hop (from (last To)) Orthogonal (between if:(if (< (counter) "NumMaxCapture") "NotEmptyAndNoCastle" ("IsFriendAt" (between))) "CaptureEnemyPiece") (to if:"EmptyAndNotVisited") (then (if "CanJumpAgain" (moveAgain) (set Counter))))) (define "CanJumpAgain" (can Move (hop (from (last To)) Orthogonal (between if:(if (< (counter) (- "NumMaxCapture" 1)) "NotEmptyAndNoCastle" ("IsFriendAt" (between))) "CaptureEnemyPiece") (to if:"EmptyAndNotVisited")))) (define "EmptyAndNotVisited" (and (is Empty (to)) (not (is Visited (to))))) (define "CaptureEnemyPiece" (apply (if (= (who at:(between)) (next)) (remove (between))))) (define "NotEmptyAndNoCastle" (and (!= (what at:(between)) (id "Castle0")) (is Occupied (between)))) (define "NumMaxCapture" 5) (game "Castello" (players 2) (equipment { (board (rectangle 15 21)) (piece "Pawn" Each (or (move Hop Orthogonal (between if:"NotEmptyAndNoCastle" "CaptureEnemyPiece") (to if:(is Empty (to))) (then (if "CanJumpAgain" (moveAgain) (set Counter)))) ("StepToEmpty" Orthogonal))) (piece "Castle" Neutral) (hand Each size:3) (regions "LeftPart" (expand (sites Left) steps:6)) (regions "RightPart" (expand (sites Right) steps:6)) (regions "Middle" (expand (sites Centre)))}) (rules (start { (place "Pawn1" (expand (sites Left))) (place "Pawn2" (expand (sites Right))) (place "Castle0" (sites {"G2" "F6" "G10" "F14" "K3" "K8" "K13" "P2" "O6" "P10" "O14"}))}) (play (if "SameTurn" (or "JumpAgain" (move Pass)) (forEach Piece) (then (and (if (is In (last To) (sites "LeftPart")) (if (< (count Cell at:(handSite Mover)) 3) ("CaptureCastleAndStoreItTo" "StorageLeftCastle")) (if (is In (last To) (sites "RightPart")) ("CaptureCastleAndStoreItTo" "StorageRightCastle") (if (is In (last To) (sites "Middle")) (if (> (count Cell at:(handSite Mover 2)) 0) ("CaptureCastleAndStoreItTo" "StorageMiddleCastle")) ("CaptureCastleAndStoreItTo" "StorageMiddleCastle")))) (set Counter))))) (end { ("HavingLessPiecesLoss" Next 3) (if (> (count in:(sites Hand Mover)) 3) (result Mover Win))}))) END |
Construct a Ludii game based on the following description
Three concentric hexagons, with lines connecting the corners and midpoints of the sides. Seventeen pieces per player. Players alternate turns placing one of their pieces on an empty spot on the board. When all of the pieces are placed, they alternate turns moving one of their pieces to an empty adjacent spot along the lines of the board. During either phase, when a player places three of their pieces in a row, they may remove one of the opponent's pieces from the board. Pieces which are in a three-in-a-row arrangement cannot be removed from the board. The player who captures all of the opponent's pieces wins.
###
| (game "Zurgaan Tal" (players 2) (equipment { (board (rotate 30 (concentric Hexagon rings:3 joinCorners:True)) use:Vertex) (hand Each) (piece "Marker" Each ("StepToEmpty" ~ (then ("ReplayIfLine3"))))}) (rules (start (place "Marker" "Hand" count:17)) phases:{ (phase "Placement" (play (if "SameTurn" ("RemoveAnyEnemyPieceNotInLine3" Orthogonal) (move (from (handSite Mover)) (to (sites Empty)) (then ("ReplayIfLine3"))))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) (phase "Movement" (play (if "SameTurn" ("RemoveAnyEnemyPieceNotInLine3" Orthogonal) (forEach Piece))))} (end ("CaptureAll" Next)))) END |
Construct a Ludii game based on the following description
3x3 intersecting lines with diagonals. Play occurs on the intersections of the lines. Three pieces per player. Play begins with each player placing pieces on empty points. If they make three in a row along the lines, they win. Once all pieces are place, players take turns moving pieces one spot to an adjacent point along the lines trying to make three in a row.
###
| (game "Tapatan" (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 |
Construct a Ludii game based on the following description
2x6 board. Eight counters in each hole; two holes in one player's row and one in the opponent's row are left empty. Sowing in an anti-clockwise direction. No captures in first two turns. If the last counter falls into a hole that is occupied, these are picked up and the sowing continues. When the last counter of a sowing falls into an empty hole, the counters in the opposite hole are captured. The player continues play by moving the counter that made the capture into the next hole, and continuing play. If the last counter falls into an empty hole and the opposite hole is also empty, the turn ends. The player who captures the most counters wins.
###
| (define "PiecesOwnedBy" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (define "Columns" 6) (game "Mangala (Suez)" (players 2) (equipment { (mancalaBoard 2 "Columns" store:None (track "Track" "0,E,N,W" loop:True)) (piece "Seed" Shared) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (hand Each)}) (rules (start (set Count 8 to:(sites Track))) phases:{ (phase "Opening" (play (move Remove (sites Mover) count:(count at:(to)))) (nextPhase (<= 3 (count Turns)) "Sowing")) (phase "Sowing" (play (move Select (from (if ("SameTurn") (sites {(var "Replay")}) (sites Mover)) if:(is Occupied (from))) (then (sow apply:(if (< 1 (count at:(to))) (and (moveAgain) (set Var "Replay" (to))) (if (<= 7 (count Turns)) (if (is Occupied ("OppositePitTwoRows" (to))) (and { (fromTo (from ("OppositePitTwoRows" (to))) (to (handSite Mover)) count:(count at:("OppositePitTwoRows" (to)))) (moveAgain) (set Var "Replay" (to))})))))))) (end ("MancalaByScoreWhen" (no Moves Next))))})) END |
Modify the Ludii game according to the following option changes:
Order 5 board -> Order 13 board
(define "Invisible" (colour 0 0 0 0)) (define "ColourBackground" (colour LightTan)) (define "SquareGrid" (board (square 5) use:Vertex)) (define "ResolveTheValue" (forEach Site (intersection (sites Around #1 Orthogonal) (sites Around ("CrosscutSites" #1) Orthogonal)) (move (from #1) (to (site) if:(!= (last From) (to)) (apply (remove (site)))) (then (and (add (piece (id "Ball" Next)) (to (var "LT"))) (set Var "LT" (last To) (then (if ("HasCrosscuts" (var "LT")) (set NextPlayer (player (mover))) (set Var "LT" -1))))))))) (define "Choose2Resolve" (forEach Site (sites Occupied by:Mover) (do (set Var "LT" (site)) next:("ResolveTheValue" (var "LT"))))) (define "Place" (move Add (to (sites Empty)) (then (if (and ("NewTurn") ("HasCrosscuts" (last To))) (set Var "LT" (last To) (then (moveAgain))) (set Var "LT" -1))))) (define "HasCrosscuts" (< 0 (count Sites in:("CrosscutSites" #1)))) (define "CrosscutSites" (sites (results from:#1 to:(sites Around (from) Diagonal if:(and (is Mover (who at:(to))) (= 2 (count Pieces Next in:(intersection (sites Around (to) Orthogonal) (sites Around (from) Orthogonal)))))) (to)))) (game "Resolve" (players 2) (equipment { "SquareGrid" (regions P1 {(sites Side N) (sites Side S)}) (regions P2 {(sites Side W) (sites Side E)}) (piece "Ball" P1) (piece "Ball" P2)}) (rules (play (if ("NewTurn") (or ("Place") ("Choose2Resolve")) (if (<= 0 (var "LT")) ("ResolveTheValue" (var "LT")) ("Place")))) (end { (if (is Connected Orthogonal Mover) (result Mover Win))})))
###
| (define "Invisible" (colour 0 0 0 0)) (define "ColourBackground" (colour LightTan)) (define "SquareGrid" (board (square 13) use:Vertex)) (define "ResolveTheValue" (forEach Site (intersection (sites Around #1 Orthogonal) (sites Around ("CrosscutSites" #1) Orthogonal)) (move (from #1) (to (site) if:(!= (last From) (to)) (apply (remove (site)))) (then (and (add (piece (id "Ball" Next)) (to (var "LT"))) (set Var "LT" (last To) (then (if ("HasCrosscuts" (var "LT")) (set NextPlayer (player (mover))) (set Var "LT" -1))))))))) (define "Choose2Resolve" (forEach Site (sites Occupied by:Mover) (do (set Var "LT" (site)) next:("ResolveTheValue" (var "LT"))))) (define "Place" (move Add (to (sites Empty)) (then (if (and ("NewTurn") ("HasCrosscuts" (last To))) (set Var "LT" (last To) (then (moveAgain))) (set Var "LT" -1))))) (define "HasCrosscuts" (< 0 (count Sites in:("CrosscutSites" #1)))) (define "CrosscutSites" (sites (results from:#1 to:(sites Around (from) Diagonal if:(and (is Mover (who at:(to))) (= 2 (count Pieces Next in:(intersection (sites Around (to) Orthogonal) (sites Around (from) Orthogonal)))))) (to)))) (game "Resolve" (players 2) (equipment { "SquareGrid" (regions P1 {(sites Side N) (sites Side S)}) (regions P2 {(sites Side W) (sites Side E)}) (piece "Ball" P1) (piece "Ball" P2)}) (rules (play (if ("NewTurn") (or ("Place") ("Choose2Resolve")) (if (<= 0 (var "LT")) ("ResolveTheValue" (var "LT")) ("Place")))) (end { (if (is Connected Orthogonal Mover) (result Mover Win))}))) END |
Construct a Ludii game based on the following description
The game is played on a board with twelve points on either side. The points form a continuous track in a horseshoe shape; each player progresses in opposite directions (one from their bottom right to the top right, the other from their bottom left to their top left). Each player has fifteen pieces, which all begin on the first point of their track. Two dice are used. Players move according to the number on each die by moving one piece the value on one die then another piece the value on the other die, or by moving one piece the value of one die and then the value of the other. The maximum number of pieces per point is two, except for the starting point. Placing pieces on the twelfth point of a player's side is only allowed when it can be achieved by two pieces on the same dice roll. A player's pieces only actually move on the player's half of the board; points are awarded for any hypothetical move that would move a player's pieces along the imagined track onto the opponent's side of the board that would land on a point with a lone opposing piece (a \
###
| (games { (subgame "GrandTrictracSubgame")}) 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. One player places fourteen of their pieces on the first point of the table to their right closest to them, with the other piece on the point opposite it on the other side of the board. The other player places three pieces on each of the four spots following the spot with the other player's fourteen, two on the spot following this, and one on the opposite end of the row of spots where the opponent's single piece is located. Two 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. Players move along the spaces of the board toward the spot where the first player's single piece is located, and from there they bear off. Pieces cannot be hit as in similar games. If a player cannot play the value on a die (or on both dice), the opponent may play it. The first player to bear off all of their pieces wins.
###
| (define "RemoveAPiece" (move Remove (from))) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" (pips))) (game "Laquet" (players 2) (equipment { ("TableBoard" (track "Track1" {11..6 5..0 12..17 18..23} directed:True)) (dice d:6 num:2) (piece "Disc" Each (forEach Die if:("DieNotUsed") (if ("IsOffBoard" "SiteToMoveOnTrack") "RemoveAPiece" (if (not ("IsEnemyAt" "SiteToMoveOnTrack")) (move (from) (to "SiteToMoveOnTrack"))))))}) (rules (start { (place Stack "Disc1" 11 count:14) (place Stack "Disc1" 23) (place Stack "Disc2" (sites {7..10}) count:3) (place Stack "Disc2" 6 count:2) (place Stack "Disc2" 12)}) (play (do (if (and (not (is Pending)) ("NewTurn")) (roll)) next:(if (can Move (forEach Piece)) (forEach Piece top:True (then ("ReplayNotAllDiceUsed"))) (move Pass (then (set Pending)))))) (end ("EscapeWin")))) END |
Construct a Ludii game based on the following description
A move in Alice chess has two basic stipulations: the move must be legal on the board on which it is played, and the square transferred to on the opposite board must be vacant. (Consequently, capture is possible only on the board upon which a piece currently stands). The en passant rule is removed.
###
| (define "CaptureToPieceAndResetCounter" (apply if: (or (and ("IsEnemyAt" (to)) (= (value Piece at:(from)) (value Piece at:(to)))) (is Empty (to))) (if (and ("IsEnemyAt" (to)) (= (value Piece at:(from)) (value Piece at:(to)))) (remove (to) (then (set Counter)))))) (define "CaptureForwardDiagonal" (move Step (directions {FR FL}) (to if:(and ("IsEnemyAt" (to)) (= (value Piece at:(from)) (value Piece at:(to)))) (apply (remove (to)))))) (define "DoubleStep" (move Slide Forward (between (exact 2) if:(or (is Empty (between)) (!= (value Piece at:(from)) (value Piece at:(between))))) (to if:(is Empty (to)) (apply if:(is Empty (to)))))) (define "Castling" (if (and ("HasNeverMoved" "King") (not ("IsInCheck" "King" Mover))) (or (if (and ("HasNeverMoved" "RookLeft") (can Move ("CastleRook" "RookLeft" E 3 (or (is Empty (between)) (!= (value Piece at:(from)) (value Piece at:(between))))))) "BigCastling") (if (and ("HasNeverMoved" "RookRight") (can Move ("CastleRook" "RookRight" W 2 (or (is Empty (between)) (!= (value Piece at:(from)) (value Piece at:(between))))))) "SmallCastling")))) (define "BigCastling" ("DecideToCastle" "King" W 2 "KingNotCheckedAndToEmpty" (then ("CastleRook" "RookLeft" E 3 True)))) (define "SmallCastling" ("DecideToCastle" "King" E 2 "KingNotCheckedAndToEmpty" (then ("CastleRook" "RookRight" W 2 True)))) (define "CastleRook" (do (set Value at:(mapEntry #1 (mover)) (% (+ (value Piece at:(mapEntry #1 (mover))) 1) 2)) next:(slide (from (mapEntry #1 (mover))) #2 (between (exact #3) if:#4) (to if:True (apply ("PieceHasMoved" (from))))))) (define "DecideToCastle" (do (set Value at:(mapEntry #1 (mover)) (% (+ (value Piece at:(mapEntry #1 (mover))) 1) 2)) next:(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 (and (if (= (state at:(last To)) 1) ("PieceHasMoved" (last To))) (set Value at:(last To) (% (+ (value Piece at:(last To)) 1) 2))))) (define "PieceHasMoved" (set State at:#1 0)) (define "HasNeverMoved" (= (state at:(mapEntry #1 (mover))) 1)) (game "Alice Chess" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) (piece "Pawn" Each (or { (if (is In (from) (sites Start (piece (what at:(from))))) "DoubleStep") "StepForwardToEmpty" "CaptureForwardDiagonal"} (then (and { (if (is In (last To) (sites Mover "Promotion")) (moveAgain)) (set Counter) (set Value at:(last To) (% (+ (value Piece at:(last To)) 1) 2))})))) (piece "Rook" Each (move Slide Orthogonal (between if:(or (is Empty (between)) (!= (value Piece at:(from)) (value Piece at:(between))))) (to if:(and ("IsEnemyAt" (to)) (= (value Piece at:(from)) (value Piece at:(to)))) "CaptureToPieceAndResetCounter") "RememberPieceHasMoved")) (piece "King" Each (move Step (to if:(and (not ("IsFriendAt" (to))) (or (is Empty (to)) (= (value Piece at:(from)) (value Piece at:(to))))) "CaptureToPieceAndResetCounter") "RememberPieceHasMoved")) (piece "Bishop" Each (move Slide Diagonal (between if:(or (is Empty (between)) (!= (value Piece at:(from)) (value Piece at:(between))))) (to if:(and ("IsEnemyAt" (to)) (= (value Piece at:(from)) (value Piece at:(to)))) "CaptureToPieceAndResetCounter") (then (set Value at:(last To) (% (+ (value Piece at:(last To)) 1) 2))))) (piece "Knight" Each (move Leap "KnightWalk" (to if:(and (not ("IsFriendAt" (to))) (or (is Empty (to)) (= (value Piece at:(from)) (value Piece at:(to))))) "CaptureToPieceAndResetCounter") (then (set Value at:(last To) (% (+ (value Piece at:(last To)) 1) 2))))) (piece "Queen" Each (move Slide (between if:(or (is Empty (between)) (!= (value Piece at:(from)) (value Piece at:(between))))) (to if:(and ("IsEnemyAt" (to)) (= (value Piece at:(from)) (value Piece at:(to)))) "CaptureToPieceAndResetCounter") (then (set Value at:(last To) (% (+ (value Piece at:(last To)) 1) 2))))) (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" (do (set Var "promotedValue" (value Piece at:(last To))) next:(move Promote (last To) (piece {"Queen" "Knight" "Bishop" "Rook"}) Mover (then (set Value at:(last To) (var "promotedValue"))))) (do (or (forEach Piece) ("Castling")) ifAfterwards:(not ("IsInCheck" "King" Mover))))) (end { ("Checkmate" "King") (if (or (no Moves Mover) (= (counter) 99)) (result Mover Draw))}))) END |
Construct a Ludii game based on the following description
MOVEMENT - A stone must move as far as it can (no jumps) in a forward direction (orthogonal or diagonal).
- At the first move, a player may choose any of his stones to move.
- After that, a player must move a stone that is adjacent to the last moved enemy stone. If that is not possible, the player may choose any unblocked of his stones to move.
- There is no capturing.
GOAL - Wins the player that moved the last stone.
###
| (game "Forge" ("TwoPlayersNorthSouth") (equipment { (board (rectangle 8 6) use:Vertex) (piece "Ball" Each (move Slide (directions Forwards of:All)))}) (rules (start { (place "Ball1" (expand (sites Bottom))) (place "Ball2" (expand (sites Top)))}) phases:{ (phase "Opening" (play (forEach Piece)) (nextPhase "Main")) (phase "Main" (play (priority { (forEach Piece (move Slide (from (from) if:(is In (from) (sites Around (last To) All))) (directions Forwards of:All))) (forEach Piece)})))} (end ("BlockWin")))) END |
Construct a Ludii game based on the following description
5x5 intersecting lines with diagonals drawn in each quadrant. Twelve pieces per player, which begin on the rows closest to the player and the two spots to the right of the central point, leaving the central point open. Players alternate turns moving the pieces along the lines of the board. The first play is from one of the pieces directly above or below the central point. Pieces cannot move backwards. A player may capture an opponent's piece by hopping over it to an empty spot immediately adjacent to the opponent's piece on the opposite side, along the lines of the board. Pieces which reach the opposite edge of the board from where they started are promoted and can move and capture any distance along the two large diagonals of the board. The player who captures all of the opponent's pieces wins.
###
| (define "HopLargeDiagonals" (move Hop (from (from) if:(is In (from) ("LargeDiagonals"))) Adjacent (between before:(count Rows) after:(count Rows) if:(and ("IsEnemyAt" (between)) (is In (between) ("LargeDiagonals"))) (apply (remove (between)))) (to if:(and (is Empty (to)) (is In (to) ("LargeDiagonals")))))) (define "LargeDiagonals" (union (sites Direction from:4 NW included:True) (sites Direction from:0 NE included:True))) (game "Fetach" ("TwoPlayersNorthSouth") (equipment { ("AlquerqueBoard" 5 5) (piece "Counter" Each (or { ("StepToEmpty" (if (!= 0 (count Moves)) (difference Adjacent Backwards) Forwards) (then ("PromoteIfReach" (sites Next) "DoubleCounter"))) ("HopCapture" ~ (difference Adjacent Backwards) (then ("PromoteIfReach" (sites Next) "DoubleCounter")))})) (piece "DoubleCounter" Each (or { ("StepToEmpty" Adjacent) ("HopCapture" ~ Adjacent) ("HopLargeDiagonals")})) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start { (place "Counter1" (union {(expand (sites Bottom)) (sites {"D3" "E3"})})) (place "Counter2" (union {(sites {"A3" "B3"}) (expand (sites Top))}))}) (play (forEach Piece)) (end ("CaptureAll" Next)))) END |
Construct a Ludii game based on the following description
8x8 board. The pieces move as follows, with the number per player: 1 x King (king): moves one space orthogonally or diagonally. The King may leap one, two, or three squares on its first move if it has not yet been checked and does not hop over an opponent's piece. The King cannot make this leap over an opponent's piece. A capture cannot be made with this special first move. 1 x Queen: One square diagonally. On its first move, the Queen may jump diagonally two squares. The Queen cannot capture when making this move. 2 x Rook: Any number of spaces orthogonally. 2 x Bishop: Two squares diagonally, jumping over the first. Cannot capture another Bishop. 2 x Knight: Moves as a chess knight. 8 x Pawn: Moves one space forward orthogonally; one space forward diagonally to capture. The Rook's, King's and Queen's Pawns may move two spaces on its first move. The King's and Queen's Pawns are restricted in having this ability only if no piece on the board has been captured. Promoted to Queen when reaching the eighth rank, and may make the Queen's leap on its first move after being promoted, but cannot capture with this move. No castling. An opponent's piece is captured by moving a player's own piece onto a space occupied by the opponent's piece. When a King can be captured on the next turn by an opponent's piece, it is in check. The King must not be in check at the end of the player's turn. If this is not possible, it is checkmate and the opponent wins.
###
| (define "PieceHasMoved" (set State at:#1 0)) (define "RememberPieceHasMoved" (then (if (= (state at:(last To)) 1) ("PieceHasMoved" (last To))))) (game "Schachzabel" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) (piece "King" Each (or ("StepToNotFriend") (if (= 1 (state at:(from))) (move Hop (between (range 1 3) if:(not ("IsEnemyAt" (between)))) (to if:(is Empty (to))))) ("RememberPieceHasMoved"))) ("ChessRook" "Rook") (piece "Bishop" Each (move Hop Diagonal (between if:True) (to if:(not ("IsFriendAt" (to))) (apply (if ("IsEnemyAt" (to)) (remove (to))))))) ("ChessKnight" "Knight") (piece "Queen" Each (or ("StepToNotFriend" Diagonal "RememberPieceHasMoved") (if (= 1 (state at:(from))) (move Hop Diagonal (between if:True) (to if:(is Empty (to))))) ("RememberPieceHasMoved"))) ("ChessPawn" "Pawn" (if (and { (is In (from) (sites Start (piece (what at:(from))))) (= 1 (state at:(from))) (= 32 (count Sites in:(sites Occupied by:All)))}) ("DoubleStepForwardToEmpty")) (then (if (is In (last To) (sites Mover "Promotion")) (and (promote (last To) (piece (id "Queen" Mover))) (set State at:(last To) 1))))) (regions "Promotion" P1 (sites Top)) (regions "Promotion" P2 (sites Bottom))}) (rules (start { (place "Pawn1" (sites {"A2" "D2" "E2" "H2"}) state:1) (place "Pawn2" (sites {"A7" "D7" "E7" "H7"}) state:1) (place "Pawn1" (sites {"B2" "C2" "F2" "G2"})) (place "Pawn2" (sites {"B7" "C7" "F7" "G7"})) (place "Rook1" {"A1" "H1"}) (place "Knight1" {"B1" "G1"}) (place "Bishop1" {"C1" "F1"}) (place "Queen1" coord:"D1" state:1) (place "King1" coord:"E1" state:1) (place "Rook2" {"A8" "H8"}) (place "Knight2" {"B8" "G8"}) (place "Bishop2" {"C8" "F8"}) (place "Queen2" coord:"D8" state:1) (place "King2" coord:"E8" state:1)}) (play (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King" Mover)) (then (if (and (= 1 (state at:(where "King" Next))) ("IsInCheck" "King" Next)) ("PieceHasMoved" (where "King" Next)))))) (end ("Checkmate" "King")))) END |
Construct a Ludii game based on the following description
5x5 board. Twelve pieces per player. Pieces begin in the rows closest to the player, and the two spaces to the right of the central space. Players alternate turns moving a piece orthogonally any distance. A player may capture an opponent's adjacent piece by hopping over it in an orthogonal direction to an empty space immediately on the opposite side of the opponent's piece. Multiple captures are allowed. The player who captures all of the opponent's pieces wins.
###
| (game "Zuz Mel (5x5)" (players 2) (equipment { (board (square 5)) (piece "Marker" Each (or ("HopOrthogonalSequenceCapture") (move Slide Orthogonal)))}) (rules (start { (place "Marker1" (union (expand (sites Bottom)) (sites {"D3" "E3"}))) (place "Marker2" (union (expand (sites Top)) (sites {"A3" "B3"})))}) (play (if "SameTurn" (or ("HopSequenceCaptureAgain") (move Pass)) (forEach Piece))) (end ("CaptureAll" Next)))) END |
Construct a Ludii game based on the following description
On your turn, place a single piece of your color on an empty position that is not next to another friendly piece. This is compulsory whenever it is possible to do so.
When it is not possible to place a piece; then instead, step one of your pieces to an adjacent empty position.
You win either:
-- when all your pieces become connected, or
-- when you cut-off your opponent from being able to connect theirs. Board: Muster order 3 board - 45 positions Angled cells
###
| (define "Order6" (poly { { 1 8} { 2 7} { 14 1} { 15 2} { 21 14} { 20 15} { 8 21} { 7 20}})) (define "Order5" (poly { { 1 7} { 2 6} { 12 1} { 13 2} { 18 12} { 17 13} { 7 18} { 6 17}})) (define "Order4" (poly { { 1 6} { 2 5} { 10 1} { 11 2} { 15 10} { 14 11} { 6 15} { 5 14}})) (define "Order3" (poly { { 1 5} { 2 4} { 8 1} { 9 2} { 12 8} { 11 9} { 5 12} { 4 11}})) (define "Order2" (poly { { 1 4} { 2 3} { 6 1} { 7 2} { 9 6} { 8 7} { 4 9} { 3 8}})) (define "NoPlacementAvailable" (all Sites (sites Empty) if:(not (no Pieces Mover in:(sites Around (site) All))))) (game "Make Muster" (players 2) (equipment { (board (rotate (- 90 62) (square "Order3")) use:Cell) (piece "Disc" Each ("StepToEmpty"))}) (rules (play (priority (move Add (to (sites Empty) if:(no Pieces Mover in:(sites Around (to) Adjacent)))) (forEach Piece))) (end (if (or (and { ("IsSingleGroup" Mover All) (< 1 (count Pieces Mover))}) (< 1 (count Groups All if:(!= (mover) (who at:(to)))))) (result Mover Win))))) END |
Construct a Ludii game based on the following description
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 and immediately leaved the board with the capture. Neither piece is reentered. Pieces belonging to the same team may occupy the same space with no consequence for the game. When one team has no more counters left to enter, the winner is the team that captured most of the opposing team's pieces.
The game has 6 players.
###
| (define "CaptureMove" (forEach Level (to) FromTop (if ("IsEnemyAt" (to) level:(level)) (remove (to) level:(level))))) (define "NoPieceOnBoard" (< (count Pieces Mover in:(sites Board)) 1)) (define "ThrowValue" (count Pips)) (game "Aj T'iwil" (players 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)} use:Edge) (regions "AllSites" (sites Board Vertex)) (piece "Stick" Each (forEach Value (values Remembered "Throws") (if ("IsOffBoard" ("NextSiteOnTrack" (value) from:(from) "Track")) (move (from (from) level:(level)) (to (handSite Mover) (apply (forget Value "Throws" (value))))) (move (from (from) level:(level) if:(if (is In (from) (sites Hand Mover)) ("NoPieceOnBoard") True)) (to ("NextSiteOnTrack" (value) from:(from) "Track") (apply (and ("CaptureMove") (forget Value "Throws" (value))))))))) ("StickDice" 4) (hand Each)}) (rules (start { (set Team 1 {P1 P2 P3}) (set Team 2 {P4 P5 P6}) (place Stack "Stick1" (handSite P1) count:5) (place Stack "Stick2" (handSite P2) count:5) (place Stack "Stick3" (handSite P3) count:5) (place Stack "Stick4" (handSite P4) count:5) (place Stack "Stick5" (handSite P5) count:5) (place Stack "Stick6" (handSite P6) count:5)}) phases:{ (phase "ThrowPhase" (play ("RollMove" (move Pass (then (if (not (no Pieces Mover)) (and { (if (!= 0 ("ThrowValue")) (do (remember Value "Throws" ("ThrowValue")) ifAfterwards:(can Move (or (forEach Piece container:(mover)) (forEach Piece))))) (moveAgain) (if ("SameTurn") (set Pending))})))))) (nextPhase (is Pending) "MovePhase")) (phase "MovePhase" (play (or (forEach Piece) (forEach Piece container:(mover)) (then (if (< 0 (size Array (values Remembered "Throws"))) (moveAgain))))) (nextPhase (= 0 (size Array (values Remembered "Throws"))) "ThrowPhase"))} (end ("CaptureAllTeam")))) END |
Modify the Ludii game according to the following option changes:
The puzzle is played on a 4x4 board -> The puzzle is played on a 5x5 board
(game "N Queens" (players 1) (equipment { (board (square 4) (values Cell (range 0 1))) (regions {AllDirections})}) (rules (play (satisfy { (is Count (sites Board) of:1 4) (all Different except:0)})) (end (if (is Solved) (result P1 Win)))))
###
| (game "N Queens" (players 1) (equipment { (board (square 5) (values Cell (range 0 1))) (regions {AllDirections})}) (rules (play (satisfy { (is Count (sites Board) of:1 5) (all Different except:0)})) (end (if (is Solved) (result P1 Win))))) END |
Describe the mechanics of the following Ludii game
(define "JumpToPromotionZone" (is In (last To) (sites Next))) (define "IsQueen" ("IsPieceAt" "DoubleCounter" Mover (last To))) (define "IsUnpromoted" ("IsPieceAt" "Counter" Mover (last To))) (define "HopDoubleCounter" (move Hop #1 Diagonal (between #2 #3 if:(and (not (is In (between) (sites ToClear))) ("IsEnemyAt" (between))) (apply (remove (between) #4))) (to if:(is Empty (to))) (then ("ReplayIfCanMove" (hop (from (last To)) Diagonal (between #2 #3 if:(and (not (is In (between) (sites ToClear))) ("IsEnemyAt" (between))) (apply (remove (between) #4))) (to if:(is Empty (to)))) ("PromoteIfReach" (sites Next) "CounterStar"))))) (game "Unnamed Dutch Draughts Game" ("TwoPlayersNorthSouth") ("DraughtsEquipment" (square 10) ~ (piece "CounterStar" Each)) (rules (start { (place "Counter1" (difference (expand (sites Bottom) steps:3) (union (sites Bottom) (sites Phase 1)))) (place "Counter2" (difference (expand (sites Top) steps:3) (union (sites Top) (sites Phase 1)))) (place "DoubleCounter1" (difference (sites Bottom) (sites Phase 1))) (place "DoubleCounter2" (difference (sites Top) (sites Phase 1)))}) (play (if ("SameTurn") (if ("IsUnpromoted") (max Moves ("HopInternationalDraughtsStyle" (from (last To)) (then ("ReplayIfCanMove" ("HopInternationalDraughtsStyle" (from (last To))) ("PromoteIfReach" (sites Next) "DoubleCounter"))))) (if ("IsQueen") (max Moves ("HopDoubleCounter" (from (last To)) before:(count Rows) after:(count Rows) at:EndOfTurn)) (max Moves ("HopSequenceCaptureAgain" 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" ("HopDoubleCounter" (from) before:(count Rows) after:(count Rows) at:EndOfTurn)) (forEach Piece "CounterStar" ("HopSequenceCapture" 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) (then ("PromoteIfReach" (sites Next) "CounterStar"))) (forEach Piece "CounterStar" (move Slide))})}))) (end ("BlockWin"))))
###
| 10x10 board. Twenty pieces per player, which begin on the four rows closest to the player. The row of pieces on the edge of the board closest to each player begins with the pieces already as Queens. Pieces move diagonally one space forward, or can jump an adjacent piece belonging to the opponent to capture it. Captures are mandatory, and the maximum number of captures possible must be taken. When pieces reach the opposite edge of the board from where they started, they are promoted to Queen. Queens move any number of spaces diagonally, and jump over any number of opponents' pieces over any distance. When a Queen reaches that edge of the board a second time (or, for the first time if one of those which began the game as a Queen), they are further promoted, gaining the power to move and take orthogonally over any distance. The player who captures all of the opponent's pieces wins. END |
Construct a Ludii game based on the following description
8x8 board, not checkered. Pieces, their number, and moves are as follows: Ang/Sdaach (\
###
| (define "PieceHasMoved" (set State at:#1 0)) (define "RememberPieceHasMoved" (then (if (= (state at:(last To)) 1) ("PieceHasMoved" (last To))))) (game "Ouk Chatrang" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) (hand Each size:5) (piece "King_noCross" Each (or ("StepToNotFriend") (if (= 1 (state at:(from))) ("LeapToEmpty" "KnightWalk")) "RememberPieceHasMoved")) ("ChessRook" "Boat") (piece "Ferz_noCross" Each (or ("StepToNotFriend" Diagonal) ("StepToNotFriend" Forward))) ("ChessKnight" "Knight") ("ChessPawn" "Fish" ~ (then ("PromoteIfReach" (sites Mover "Promotion") "Queen"))) (piece "Queen" Each (or ("StepToNotFriend" Diagonal) (if (= 1 (state at:(from))) (move Hop Forward (between if:True) (to if:(not ("IsFriendAt" (to))) (apply (remove (to)))))) "RememberPieceHasMoved")) (regions "Promotion" P1 (sites Row 5)) (regions "Promotion" P2 (sites Row 2))}) (rules (start { (place "Fish1" (sites Row 2)) (place "Fish2" (sites Row 5)) (place "Boat1" {"A1" "H1"}) (place "Knight1" {"B1" "G1"}) (place "Ferz_noCross1" {"C1" "F1"}) (place "Queen1" coord:"D1" state:1) (place "King_noCross1" coord:"E1" state:1) (place "Boat2" {"A8" "H8"}) (place "Knight2" {"B8" "G8"}) (place "Ferz_noCross2" {"C8" "F8"}) (place "Queen2" coord:"D8" state:1) (place "King_noCross2" coord:"E8" state:1)}) (play (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King_noCross" Mover)))) (end { ("Checkmate" "King_noCross") ("DrawIfNoMoves" Mover)}))) END |
What does the following global Ludii definition do?
(define "ChessQueen" (piece #1 Each (move Slide (to if:("IsEnemyAt" (to)) (apply (remove (to) #2))) #3)))
###
| Defines a piece moving like a queen in Chess. END |
Construct a Ludii game based on the following description
4x8 board. Two counters in each hole. Opening play: Players simultaneously arrange their counters in the following patter, beginning from the bottom left and proceeding anti-clockwise: 0, 6, 0, 0, 0, 0, 0, 17, 0, 3, 0, 3, 0, 3, 0, 0. Players then move alternately. The first three turns are made by sowing from the holes with three holes, proceeding in order from the one furthest to the left, sowing two in the next hole and one in the following. They then sow from the next hole to the right with three counters on the next turn in the same way. Main phase: Play begins from any hole on the player's side of the board with counters in it. Singletons cannot move. Sowing happens in an anti-clockwise direction. If the last counter lands in an empty hole, the turn is over. For capturing: Holes are in 'opposition' when one player has the front row hole occupied and the opponent has both of the holes opposite it occupied. If the last hole in a sowing is in opposition, the player takes the counters in both of the opponent's holes and places them in the empty hole from which the player lifted the counters. The player then sows the captured counters from this hole. Further captures in the sowing can occur in the same way. However, each player has two hole from which clockwise plays can be made: the leftmost hole in the outer row and the second from the left in the inner row. Clockwise moves can only be made from these holes if they immediately lead to a capture. When the captured counters are sown, starting from the same hole, they can also be sown clockwise if they lead to a capture. If they cannot lead to a capture, they are sown anti-clockwise. Another alternative the player has is that, if the player plays clockwise from one of these holes and therefore makes a capture, the captured counters may be placed in the hole and left there, and the player may play instead from the other hole from which clockwise captures are allowed in a clockwise direction, if it leads to a capture. The player may continue playing from this hole as above until the possibilities to move are exhausted, and then may move from any hole in an anti-clockwise direction. Multiple captures can only be made in a clockwise direction from these holes if it is made on the first sowing of the turn. Otherwise, only one clockwise capture can be made and sowing must proceed in an anti-clockwise direction. If the last counter lands on a hole that is occupied but not in opposition, these counters are picked up and sowing continues. Play ends when one player captures all the opponent's counters or one player cannot play. The player who cannot play loses. A player may also win by capturing the counters from both of the opponent's end holes in the inner row in a single turn.
###
| (define "NextHole" ("NextSiteOnTrack" #3 from:#1 #2)) (define "OuterPhaseOppositePit" (if (is Mover P1) (+ (to) (* 3 ("Columns"))) (- (to) (* ("Columns") 3)))) (define "Columns" 8) (game "Ikibuguzo (Opening 1)" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "TrackCCW1" "0,E,N1,W" loop:True P1) (track "TrackCCW2" "16,E,N1,W" loop:True P2) (track "TrackCW1" "7,W,N1,E" loop:True P1) (track "TrackCW2" "24,E,S1,W" loop:True P2)}) (regions "Home" P1 (sites Track "TrackCCW1")) (regions "Home" P2 (sites Track "TrackCCW2")) (regions "Inner" P1 (difference (sites Track "TrackCCW1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "TrackCCW2") (sites Top))) (map "FirstMove" {(pair P1 10) (pair P2 21)}) (map "SecondMove" {(pair P1 12) (pair P2 19)}) (map "ThirdMove" {(pair P1 14) (pair P2 17)}) (map "LeftMostOuter" {(pair P1 0) (pair P2 31)}) (map "SecondLeftInner" {(pair P1 9) (pair P2 22)}) (piece "Seed" Shared) (hand Each)}) (rules (start { (set Count 6 to:(sites {"G4" "B1"})) (set Count 17 to:(sites {"H1" "A4"})) (set Count 3 to:(sites {"G2" "E2" "C2" "B3" "D3" "F3"}))}) phases:{ (phase "FirstMove" (play (move (from (mapEntry "FirstMove" Mover)) (to ("NextHole" (from) "TrackCCW" 1)) count:2 (then (fromTo (from (mapEntry "FirstMove" Mover)) (to ("NextHole" (from) "TrackCCW" 2)) count:1)))) (nextPhase Mover "SecondMove")) (phase "SecondMove" (play (move (from (mapEntry "SecondMove" Mover)) (to ("NextHole" (from) "TrackCCW" 1)) count:2 (then (fromTo (from (mapEntry "SecondMove" Mover)) (to ("NextHole" (from) "TrackCCW" 2)) count:1)))) (nextPhase Mover "ThirdMove")) (phase "ThirdMove" (play (move (from (mapEntry "ThirdMove" Mover)) (to ("NextHole" (from) "TrackCCW" 1)) count:2 (then (fromTo (from (mapEntry "ThirdMove" Mover)) (to ("NextHole" (from) "TrackCCW" 2)) count:1)))) (nextPhase Mover "MainPhase")) (phase "MainPhase" (play (or (move Select (from (if ("SameTurn") (sites {(var "Replay")}) (sites {(mapEntry "LeftMostOuter" Mover) (mapEntry "SecondLeftInner" Mover)})) if:(and { if:(if ("SameTurn") (< 0 (count at:(from))) (< 1 (count at:(from)))) (is In (from) (sites {(mapEntry "LeftMostOuter" Mover) (mapEntry "SecondLeftInner" Mover)})) (is In ("NextHole" (from) "TrackCW" (count at:(from))) (sites Mover "Inner")) (is Occupied ("OppositePit" ("NextHole" (from) "TrackCW" (count at:(from))))) (is Occupied ("OppositeOuterPit" ("NextHole" (from) "TrackCW" (count at:(from)))))})) (then (sow "TrackCW" owner:(mover) apply: (if (< 1 (count at:(to))) (and (moveAgain) (if (and { (is Occupied ("OppositePit" (to))) (is Occupied ("OppositeOuterPit" (to))) (is In (to) (sites Mover "Inner"))}) (and { (fromTo (from ("OppositePit" (to))) (to (last From)) count:(count at:("OppositePit" (to)))) (fromTo (from ("OppositeOuterPit" (to))) (to (last From)) count:(count at:("OppositeOuterPit" (to)))) (set Var "Replay" (from))}) (set Var "Replay" (to)))))))) (move Select (from (if ("SameTurn") (sites {(var "Replay")}) (sites Mover)) if:(if ("SameTurn") (< 0 (count at:(from))) (< 1 (count at:(from))))) (then (sow "TrackCCW" owner:(mover) apply: (if (< 1 (count at:(to))) (and (moveAgain) (if (and { (is Occupied ("OppositePit" (to))) (is Occupied ("OppositeOuterPit" (to))) (is In (to) (sites Mover "Inner"))}) (and { (fromTo (from ("OppositePit" (to))) (to (last From)) count:(count at:("OppositePit" (to)))) (fromTo (from ("OppositeOuterPit" (to))) (to (last From)) count:(count at:("OppositeOuterPit" (to)))) (set Var "Replay" (from))}) (set Var "Replay" (to)))))))))) (end ("BlockWin")))})) END |
Construct a Ludii game based on the following description
5x5 board. Twelve pieces per player. Players alternate turns placing two pieces on the board. When all of the pieces are placed, players alternate turns moving one piece orthogonally any distance. The first player to place five of their pieces in an orthogonal or diagonal line wins.
###
| (game "Fart (5x5)" (players 2) (equipment { (board (square 5)) (piece "Marker" Each (move Slide Orthogonal)) (hand Each)}) (rules (start (place "Marker" "Hand" count:12)) phases:{ (phase "Placement" (play (move (from (handSite Mover)) (to (difference (sites Board) (centrePoint)) if:(is Empty (to))) (then (if ("NewTurn") (moveAgain))))) (nextPhase Mover (is Empty (handSite Mover)) "Move")) (phase "Move" (play (forEach Piece)))} (end (if (is Line 5) (result Mover Win))))) END |
Construct a Ludii game based on the following description
On a player's turn he or she must perform one of the following actions:
1) Move a tower (2-stack) by distributing its two stones into the two nearest cells in any one direction. Each destination cell must be empty or contain a single friendly stone.
2) Sacrifice a single tower stone to remove an adjacent enemy wall (1-stack). Sacrifice is not forced.
Goal: A player wins immediately by reaching any cell of his or her opponent's home row, or by stalemating his or her opponent. Stack limit is 2. Standard 7 x 8, one row Immediately after reaching goal.
###
| (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 (rectangle 7 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 {48..55}) 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 |
Construct a Ludii game based on the following description
Goal:Score the product of the sizes of your two largest chains. Highest score wins.
In case of a tie, the last to play wins.
Chains are a series of adjacent like-colored stones with no branching.
Play:
Boards starts empty. The darker color starts.
On a turn the moving player does one of these actions:
- Place one of their stones onto an empty site adjacent to no more than 2 of their stones, or
- Remove one of their stones that is adjacent to more than two of their stones.
Otherwise he passes.
The game ends when both players pass. Order 4-5, Hex Grid
###
| (define "AddOrPass" (or { (move Add (piece (id "Disc" Mover)) (to (sites Empty) if:(> 3 (count Pieces Mover in:(sites Around (to) "GridDirection")))) (then (set Var "Added" 1))) (move Pass)})) (define "Score4" (do (forEach Site (sites Occupied by:#1) (if (> 3 (count Pieces #1 in:(sites Around (site) "GridDirection"))) (set State at:(site) 0) (set State at:(site) 1))) next:(do (and { (remember Value 0) (remember Value 0) (forEach Group "GridDirection" (if (no Pieces in:(intersection (sites) (sites State 1))) (remember Value (count Sites in:(sites)))))}) next:(set Var "TopValue" (max (values Remembered)) (then (forget Value (max (values Remembered)) (then (set Score #1 (* (var "TopValue") (max (values Remembered))) (then (forget Value All)))))))))) (define "GridDirection" Orthogonal) (game "Wrigglers" (players 2) (equipment { (board (tri Limping 4) use:Vertex) (piece "Disc" Each)}) (rules (play (if (= 1 (var "Added")) (or { "AddOrPass" (forEach Piece (if (< 2 (count Pieces Mover in:(sites Around (from) "GridDirection"))) (move Remove (from) (then (set Var "Added" 0)))) Mover)}) "AddOrPass" (then ("Score4" Mover)))) (end (if (all Passed) { (if (>= (score Mover) (score Next)) (result Mover Win))} (result Next Win))))) END |
Modify the Ludii game according to the following option changes:
The players play on CrossGeoR-B version. -> The players play on CrossGeoR-G-B version.
(game "CrossGeo" (players 2) (equipment { (board (graph vertices:{ {2 0} {3 0} {1 1} {1 2} {0 2} {0 4} {1 3} {1 5} {2 4} {2 2} {4 2} {3 3} {3 1} {5 1} {6 2} {6 1} {8 1} {7 3} {9 3} {9 1} {8 4} {8 2} {10 3} {11 2} {11 1} {13 1} {13 3} {14 2} {10 3} {10 5} {8 5} {9 6} {12 3} {11 4} {13 6} {12 4} {14 6} {11 6} {5 7} {11 7} {8 7} {8 6} {7 6} {7 8} {4 4} {5 3} {6 4} {5 5} {7 5} {6 6} {1 7} {3 7} {2 6} {4 6} {3 5} {13 4}} edges:{ {0 1} {0 2} {2 3} {1 3} {4 5} {5 8} {6 7} {9 10} {11 12} {12 13} {14 15} {15 16} {17 18} {18 19} {20 21} {21 22} {23 27} {24 25} {25 26} {28 29} {29 30} {31 32} {33 34} {35 36} {37 55} {42 43} {38 39} {40 41} {44 46} {46 49} {45 47} {47 48} {52 53} {50 51} {51 54}}) use:Edge) (piece "Disc" Each) (piece "Marker" Shared)}) (rules (start { (set P1 Edge (sites {0..9})) (set P2 Edge (difference (sites Board Edge) (sites {0..9})))}) (play (move Remove (sites Occupied by:Mover) (then (forEach Site (sites Crossing at:(last To) All) (remove Edge (to)))))) (end (if (no Moves Mover) (result Next Win)))))
###
| (game "CrossGeo" (players 2) (equipment { (board (graph vertices:{ {2 0} {3 0} {1 1} {1 2} {0 2} {0 4} {1 3} {1 5} {2 4} {2 2} {4 2} {3 3} {3 1} {5 1} {6 2} {6 1} {8 1} {7 3} {9 3} {9 1} {8 4} {8 2} {10 3} {11 2} {11 1} {13 1} {13 3} {14 2} {10 3} {10 5} {8 5} {9 6} {12 3} {11 4} {13 6} {12 4} {14 6} {11 6} {5 7} {11 7} {8 7} {8 6} {7 6} {7 8} {4 4} {5 3} {6 4} {5 5} {7 5} {6 6} {1 7} {3 7} {2 6} {4 6} {3 5} {13 4}} edges:{ {0 1} {0 2} {2 3} {1 3} {4 5} {5 8} {6 7} {9 10} {11 12} {12 13} {14 15} {15 16} {17 18} {18 19} {20 21} {21 22} {23 27} {24 25} {25 26} {28 29} {29 30} {31 32} {33 34} {35 36} {37 55} {42 43} {38 39} {40 41} {44 46} {46 49} {45 47} {47 48} {52 53} {50 51} {51 54}}) use:Edge) (piece "Disc" Each) (piece "Marker" Shared)}) (rules (start { (set P1 Edge (sites {0..5 13..20})) (set P2 Edge (sites {9..12 23..30})) (set Shared Edge (difference (sites Board Edge) (union (sites {0..5 13..20}) (sites {9..12 23..30}))))}) (play (move Remove (difference (sites Occupied by:All) (sites Occupied by:Next)) (then (forEach Site (sites Crossing at:(last To) All) (remove Edge (to)))))) (end (if (no Moves Mover) (result Next Win))))) END |
Construct a Ludii game based on the following description
10x10 board, with an extra square placed diagonally behind each Rukh. The pieces move as follows, with the number per player: 1 x Shah (king): moves one space orthogonally or diagonally. 1 x Fers (counselor): One square diagonally. 2 x Rukh (rook): Any number of spaces orthogonally. 2x Dabbaba: any number of squares diagonally. 2 x Pil (elephant): Two squares diagonally, jumping over the first. Cannot capture another Pil. 2 x Asb (horse): Moves as a Chess knight. 12 x Sarbaz (soldier): Moves one space forward orthogonally; one space forward diagonally to capture. No en passant. Promoted to Fers when reaching the tenth rank. No castling. Stalemate results in win for player causing it. The player who checkmates the king wins. If a player moves their king into one of the extra squares on the opposite side of the board, the game is a draw.
###
| (game "Shatranj al-Husun" ("TwoPlayersNorthSouth") (equipment { (board (merge { (square 10) (shift -1 -1 (square 1)) (shift 10 -1 (square 1)) (shift -1 10 (square 1)) (shift 10 10 (square 1))})) ("ChessKing" "King") (piece "Queen" Each ("StepToNotFriend" Diagonal)) ("ChessRook" "Rook") ("ChessKnight" "Knight") (piece "Elephant" Each (move Hop Diagonal (between if:True) (to if:(or (is Empty (to)) (and ("IsEnemyAt" (to)) (not ("IsPieceAt" "Elephant" Next (to))))) (apply (remove (to)))))) ("ChessBishop" "Bishop") ("ChessPawn" "Pawn" (if (is In (from) (sites Start (piece (what at:(from))))) ("DoubleStepForwardToEmpty")) (then ("PromoteIfReach" (sites Mover "Promotion") "Queen"))) (regions "Promotion" P1 (sites Row 10)) (regions "Promotion" P2 (sites Row 1)) (regions "OppositeExtraSquares" P1 (sites Top)) (regions "OppositeExtraSquares" P2 (sites Bottom))}) (rules (start { (place "Pawn1" (sites Row 2)) (place "Pawn2" (sites Row 9)) (place "Rook1" (sites {"B2" "K2"})) (place "Knight1" (sites {"C2" "J2"})) (place "Elephant1" (sites {"D2" "I2"})) (place "Bishop1" (sites {"E2" "H2"})) (place "King1" coord:"F2") (place "Queen1" coord:"G2") (place "Rook2" (sites {"B11" "K11"})) (place "Knight2" (sites {"C11" "J11"})) (place "Elephant2" (sites {"D11" "I11"})) (place "Bishop2" (sites {"E11" "H11"})) (place "King2" coord:"F11") (place "Queen2" coord:"G11")}) (play (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King" Mover)))) (end { (if (is In (where "King" Mover) (sites Mover "OppositeExtraSquares")) (result Mover Draw)) ("Checkmate" "King") ("BlockWin")}))) END |
Construct a global Ludii definition which fulfills the following requirements.
Defines a rectangular graph with Alquerque-style alternating diagonals.
###
| (define "AlquerqueGraph" (rectangle #1 #2 diagonals:Alternating)) END |
Subsets and Splits